android-audiosystem-1.8+13.10.20130807/0000755000015700001700000000000012200324404017671 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/0000755000015700001700000000000012200324404021314 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/utils/0000755000015700001700000000000012200324404022454 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/utils/PropertyMap.h0000644000015700001700000000657012200324306025120 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _UTILS_PROPERTY_MAP_H #define _UTILS_PROPERTY_MAP_H #include #include #include #include namespace android { /* * Provides a mechanism for passing around string-based property key / value pairs * and loading them from property files. * * The property files have the following simple structure: * * # Comment * key = value * * Keys and values are any sequence of printable ASCII characters. * The '=' separates the key from the value. * The key and value may not contain whitespace. * * The '\' character is reserved for escape sequences and is not currently supported. * The '"" character is reserved for quoting and is not currently supported. * Files that contain the '\' or '"' character will fail to parse. * * The file must not contain duplicate keys. * * TODO Support escape sequences and quoted values when needed. */ class PropertyMap { public: /* Creates an empty property map. */ PropertyMap(); ~PropertyMap(); /* Clears the property map. */ void clear(); /* Adds a property. * Replaces the property with the same key if it is already present. */ void addProperty(const String8& key, const String8& value); /* Returns true if the property map contains the specified key. */ bool hasProperty(const String8& key) const; /* Gets the value of a property and parses it. * Returns true and sets outValue if the key was found and its value was parsed successfully. * Otherwise returns false and does not modify outValue. (Also logs a warning.) */ bool tryGetProperty(const String8& key, String8& outValue) const; bool tryGetProperty(const String8& key, bool& outValue) const; bool tryGetProperty(const String8& key, int32_t& outValue) const; bool tryGetProperty(const String8& key, float& outValue) const; /* Adds all values from the specified property map. */ void addAll(const PropertyMap* map); /* Gets the underlying property map. */ inline const KeyedVector& getProperties() const { return mProperties; } /* Loads a property map from a file. */ static status_t load(const String8& filename, PropertyMap** outMap); private: class Parser { PropertyMap* mMap; Tokenizer* mTokenizer; public: Parser(PropertyMap* map, Tokenizer* tokenizer); ~Parser(); status_t parse(); private: status_t parseType(); status_t parseKey(); status_t parseKeyProperty(); status_t parseModifier(const String8& token, int32_t* outMetaState); status_t parseCharacterLiteral(char16_t* outCharacter); }; KeyedVector mProperties; }; } // namespace android #endif // _UTILS_PROPERTY_MAP_H android-audiosystem-1.8+13.10.20130807/include/utils/RefBase.h0000644000015700001700000003615512200324306024147 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_REF_BASE_H #define ANDROID_REF_BASE_H #include #include #include #include #include #include // --------------------------------------------------------------------------- namespace android { class TextOutput; TextOutput& printWeakPointer(TextOutput& to, const void* val); // --------------------------------------------------------------------------- #define COMPARE_WEAK(_op_) \ inline bool operator _op_ (const sp& o) const { \ return m_ptr _op_ o.m_ptr; \ } \ inline bool operator _op_ (const T* o) const { \ return m_ptr _op_ o; \ } \ template \ inline bool operator _op_ (const sp& o) const { \ return m_ptr _op_ o.m_ptr; \ } \ template \ inline bool operator _op_ (const U* o) const { \ return m_ptr _op_ o; \ } // --------------------------------------------------------------------------- class ReferenceMover; class ReferenceConverterBase { public: virtual size_t getReferenceTypeSize() const = 0; virtual void* getReferenceBase(void const*) const = 0; inline virtual ~ReferenceConverterBase() { } }; // --------------------------------------------------------------------------- class RefBase { public: void incStrong(const void* id) const; void decStrong(const void* id) const; void forceIncStrong(const void* id) const; //! DEBUGGING ONLY: Get current strong ref count. int32_t getStrongCount() const; class weakref_type { public: RefBase* refBase() const; void incWeak(const void* id); void decWeak(const void* id); // acquires a strong reference if there is already one. bool attemptIncStrong(const void* id); // acquires a weak reference if there is already one. // This is not always safe. see ProcessState.cpp and BpBinder.cpp // for proper use. bool attemptIncWeak(const void* id); //! DEBUGGING ONLY: Get current weak ref count. int32_t getWeakCount() const; //! DEBUGGING ONLY: Print references held on object. void printRefs() const; //! DEBUGGING ONLY: Enable tracking for this object. // enable -- enable/disable tracking // retain -- when tracking is enable, if true, then we save a stack trace // for each reference and dereference; when retain == false, we // match up references and dereferences and keep only the // outstanding ones. void trackMe(bool enable, bool retain); }; weakref_type* createWeak(const void* id) const; weakref_type* getWeakRefs() const; //! DEBUGGING ONLY: Print references held on object. inline void printRefs() const { getWeakRefs()->printRefs(); } //! DEBUGGING ONLY: Enable tracking of object. inline void trackMe(bool enable, bool retain) { getWeakRefs()->trackMe(enable, retain); } typedef RefBase basetype; protected: RefBase(); virtual ~RefBase(); //! Flags for extendObjectLifetime() enum { OBJECT_LIFETIME_STRONG = 0x0000, OBJECT_LIFETIME_WEAK = 0x0001, OBJECT_LIFETIME_MASK = 0x0001 }; void extendObjectLifetime(int32_t mode); //! Flags for onIncStrongAttempted() enum { FIRST_INC_STRONG = 0x0001 }; virtual void onFirstRef(); virtual void onLastStrongRef(const void* id); virtual bool onIncStrongAttempted(uint32_t flags, const void* id); virtual void onLastWeakRef(const void* id); private: friend class ReferenceMover; static void moveReferences(void* d, void const* s, size_t n, const ReferenceConverterBase& caster); private: friend class weakref_type; class weakref_impl; RefBase(const RefBase& o); RefBase& operator=(const RefBase& o); weakref_impl* const mRefs; }; // --------------------------------------------------------------------------- template class LightRefBase { public: inline LightRefBase() : mCount(0) { } inline void incStrong(const void* id) const { android_atomic_inc(&mCount); } inline void decStrong(const void* id) const { if (android_atomic_dec(&mCount) == 1) { delete static_cast(this); } } //! DEBUGGING ONLY: Get current strong ref count. inline int32_t getStrongCount() const { return mCount; } typedef LightRefBase basetype; protected: inline ~LightRefBase() { } private: friend class ReferenceMover; inline static void moveReferences(void* d, void const* s, size_t n, const ReferenceConverterBase& caster) { } private: mutable volatile int32_t mCount; }; // --------------------------------------------------------------------------- template class wp { public: typedef typename RefBase::weakref_type weakref_type; inline wp() : m_ptr(0) { } wp(T* other); wp(const wp& other); wp(const sp& other); template wp(U* other); template wp(const sp& other); template wp(const wp& other); ~wp(); // Assignment wp& operator = (T* other); wp& operator = (const wp& other); wp& operator = (const sp& other); template wp& operator = (U* other); template wp& operator = (const wp& other); template wp& operator = (const sp& other); void set_object_and_refs(T* other, weakref_type* refs); // promotion to sp sp promote() const; // Reset void clear(); // Accessors inline weakref_type* get_refs() const { return m_refs; } inline T* unsafe_get() const { return m_ptr; } // Operators COMPARE_WEAK(==) COMPARE_WEAK(!=) COMPARE_WEAK(>) COMPARE_WEAK(<) COMPARE_WEAK(<=) COMPARE_WEAK(>=) inline bool operator == (const wp& o) const { return (m_ptr == o.m_ptr) && (m_refs == o.m_refs); } template inline bool operator == (const wp& o) const { return m_ptr == o.m_ptr; } inline bool operator > (const wp& o) const { return (m_ptr == o.m_ptr) ? (m_refs > o.m_refs) : (m_ptr > o.m_ptr); } template inline bool operator > (const wp& o) const { return (m_ptr == o.m_ptr) ? (m_refs > o.m_refs) : (m_ptr > o.m_ptr); } inline bool operator < (const wp& o) const { return (m_ptr == o.m_ptr) ? (m_refs < o.m_refs) : (m_ptr < o.m_ptr); } template inline bool operator < (const wp& o) const { return (m_ptr == o.m_ptr) ? (m_refs < o.m_refs) : (m_ptr < o.m_ptr); } inline bool operator != (const wp& o) const { return m_refs != o.m_refs; } template inline bool operator != (const wp& o) const { return !operator == (o); } inline bool operator <= (const wp& o) const { return !operator > (o); } template inline bool operator <= (const wp& o) const { return !operator > (o); } inline bool operator >= (const wp& o) const { return !operator < (o); } template inline bool operator >= (const wp& o) const { return !operator < (o); } private: template friend class sp; template friend class wp; T* m_ptr; weakref_type* m_refs; }; template TextOutput& operator<<(TextOutput& to, const wp& val); #undef COMPARE_WEAK // --------------------------------------------------------------------------- // No user serviceable parts below here. template wp::wp(T* other) : m_ptr(other) { if (other) m_refs = other->createWeak(this); } template wp::wp(const wp& other) : m_ptr(other.m_ptr), m_refs(other.m_refs) { if (m_ptr) m_refs->incWeak(this); } template wp::wp(const sp& other) : m_ptr(other.m_ptr) { if (m_ptr) { m_refs = m_ptr->createWeak(this); } } template template wp::wp(U* other) : m_ptr(other) { if (other) m_refs = other->createWeak(this); } template template wp::wp(const wp& other) : m_ptr(other.m_ptr) { if (m_ptr) { m_refs = other.m_refs; m_refs->incWeak(this); } } template template wp::wp(const sp& other) : m_ptr(other.m_ptr) { if (m_ptr) { m_refs = m_ptr->createWeak(this); } } template wp::~wp() { if (m_ptr) m_refs->decWeak(this); } template wp& wp::operator = (T* other) { weakref_type* newRefs = other ? other->createWeak(this) : 0; if (m_ptr) m_refs->decWeak(this); m_ptr = other; m_refs = newRefs; return *this; } template wp& wp::operator = (const wp& other) { weakref_type* otherRefs(other.m_refs); T* otherPtr(other.m_ptr); if (otherPtr) otherRefs->incWeak(this); if (m_ptr) m_refs->decWeak(this); m_ptr = otherPtr; m_refs = otherRefs; return *this; } template wp& wp::operator = (const sp& other) { weakref_type* newRefs = other != NULL ? other->createWeak(this) : 0; T* otherPtr(other.m_ptr); if (m_ptr) m_refs->decWeak(this); m_ptr = otherPtr; m_refs = newRefs; return *this; } template template wp& wp::operator = (U* other) { weakref_type* newRefs = other ? other->createWeak(this) : 0; if (m_ptr) m_refs->decWeak(this); m_ptr = other; m_refs = newRefs; return *this; } template template wp& wp::operator = (const wp& other) { weakref_type* otherRefs(other.m_refs); U* otherPtr(other.m_ptr); if (otherPtr) otherRefs->incWeak(this); if (m_ptr) m_refs->decWeak(this); m_ptr = otherPtr; m_refs = otherRefs; return *this; } template template wp& wp::operator = (const sp& other) { weakref_type* newRefs = other != NULL ? other->createWeak(this) : 0; U* otherPtr(other.m_ptr); if (m_ptr) m_refs->decWeak(this); m_ptr = otherPtr; m_refs = newRefs; return *this; } template void wp::set_object_and_refs(T* other, weakref_type* refs) { if (other) refs->incWeak(this); if (m_ptr) m_refs->decWeak(this); m_ptr = other; m_refs = refs; } template sp wp::promote() const { sp result; if (m_ptr && m_refs->attemptIncStrong(&result)) { result.set_pointer(m_ptr); } return result; } template void wp::clear() { if (m_ptr) { m_refs->decWeak(this); m_ptr = 0; } } template inline TextOutput& operator<<(TextOutput& to, const wp& val) { return printWeakPointer(to, val.unsafe_get()); } // --------------------------------------------------------------------------- // this class just serves as a namespace so TYPE::moveReferences can stay // private. class ReferenceMover { // StrongReferenceCast and WeakReferenceCast do the impedance matching // between the generic (void*) implementation in Refbase and the strongly typed // template specializations below. template struct StrongReferenceCast : public ReferenceConverterBase { virtual size_t getReferenceTypeSize() const { return sizeof( sp ); } virtual void* getReferenceBase(void const* p) const { sp const* sptr(reinterpret_cast const*>(p)); return static_cast(sptr->get()); } }; template struct WeakReferenceCast : public ReferenceConverterBase { virtual size_t getReferenceTypeSize() const { return sizeof( wp ); } virtual void* getReferenceBase(void const* p) const { wp const* sptr(reinterpret_cast const*>(p)); return static_cast(sptr->unsafe_get()); } }; public: template static inline void move_references(sp* d, sp const* s, size_t n) { memmove(d, s, n*sizeof(sp)); StrongReferenceCast caster; TYPE::moveReferences(d, s, n, caster); } template static inline void move_references(wp* d, wp const* s, size_t n) { memmove(d, s, n*sizeof(wp)); WeakReferenceCast caster; TYPE::moveReferences(d, s, n, caster); } }; // specialization for moving sp<> and wp<> types. // these are used by the [Sorted|Keyed]Vector<> implementations // sp<> and wp<> need to be handled specially, because they do not // have trivial copy operation in the general case (see RefBase.cpp // when DEBUG ops are enabled), but can be implemented very // efficiently in most cases. template inline void move_forward_type(sp* d, sp const* s, size_t n) { ReferenceMover::move_references(d, s, n); } template inline void move_backward_type(sp* d, sp const* s, size_t n) { ReferenceMover::move_references(d, s, n); } template inline void move_forward_type(wp* d, wp const* s, size_t n) { ReferenceMover::move_references(d, s, n); } template inline void move_backward_type(wp* d, wp const* s, size_t n) { ReferenceMover::move_references(d, s, n); } }; // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_REF_BASE_H android-audiosystem-1.8+13.10.20130807/include/utils/Unicode.h0000644000015700001700000001354012200324306024217 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_UNICODE_H #define ANDROID_UNICODE_H #include #include extern "C" { typedef uint32_t char32_t; typedef uint16_t char16_t; // Standard string functions on char16_t strings. int strcmp16(const char16_t *, const char16_t *); int strncmp16(const char16_t *s1, const char16_t *s2, size_t n); size_t strlen16(const char16_t *); size_t strnlen16(const char16_t *, size_t); char16_t *strcpy16(char16_t *, const char16_t *); char16_t *strncpy16(char16_t *, const char16_t *, size_t); // Version of comparison that supports embedded nulls. // This is different than strncmp() because we don't stop // at a nul character and consider the strings to be different // if the lengths are different (thus we need to supply the // lengths of both strings). This can also be used when // your string is not nul-terminated as it will have the // equivalent result as strcmp16 (unlike strncmp16). int strzcmp16(const char16_t *s1, size_t n1, const char16_t *s2, size_t n2); // Version of strzcmp16 for comparing strings in different endianness. int strzcmp16_h_n(const char16_t *s1H, size_t n1, const char16_t *s2N, size_t n2); // Standard string functions on char32_t strings. size_t strlen32(const char32_t *); size_t strnlen32(const char32_t *, size_t); /** * Measure the length of a UTF-32 string in UTF-8. If the string is invalid * such as containing a surrogate character, -1 will be returned. */ ssize_t utf32_to_utf8_length(const char32_t *src, size_t src_len); /** * Stores a UTF-8 string converted from "src" in "dst", if "dst_length" is not * large enough to store the string, the part of the "src" string is stored * into "dst" as much as possible. See the examples for more detail. * Returns the size actually used for storing the string. * dst" is not null-terminated when dst_len is fully used (like strncpy). * * Example 1 * "src" == \u3042\u3044 (\xE3\x81\x82\xE3\x81\x84) * "src_len" == 2 * "dst_len" >= 7 * -> * Returned value == 6 * "dst" becomes \xE3\x81\x82\xE3\x81\x84\0 * (note that "dst" is null-terminated) * * Example 2 * "src" == \u3042\u3044 (\xE3\x81\x82\xE3\x81\x84) * "src_len" == 2 * "dst_len" == 5 * -> * Returned value == 3 * "dst" becomes \xE3\x81\x82\0 * (note that "dst" is null-terminated, but \u3044 is not stored in "dst" * since "dst" does not have enough size to store the character) * * Example 3 * "src" == \u3042\u3044 (\xE3\x81\x82\xE3\x81\x84) * "src_len" == 2 * "dst_len" == 6 * -> * Returned value == 6 * "dst" becomes \xE3\x81\x82\xE3\x81\x84 * (note that "dst" is NOT null-terminated, like strncpy) */ void utf32_to_utf8(const char32_t* src, size_t src_len, char* dst); /** * Returns the unicode value at "index". * Returns -1 when the index is invalid (equals to or more than "src_len"). * If returned value is positive, it is able to be converted to char32_t, which * is unsigned. Then, if "next_index" is not NULL, the next index to be used is * stored in "next_index". "next_index" can be NULL. */ int32_t utf32_from_utf8_at(const char *src, size_t src_len, size_t index, size_t *next_index); /** * Returns the UTF-8 length of UTF-16 string "src". */ ssize_t utf16_to_utf8_length(const char16_t *src, size_t src_len); /** * Converts a UTF-16 string to UTF-8. The destination buffer must be large * enough to fit the UTF-16 as measured by utf16_to_utf8_length with an added * NULL terminator. */ void utf16_to_utf8(const char16_t* src, size_t src_len, char* dst); /** * Returns the length of "src" when "src" is valid UTF-8 string. * Returns 0 if src is NULL or 0-length string. Returns -1 when the source * is an invalid string. * * This function should be used to determine whether "src" is valid UTF-8 * characters with valid unicode codepoints. "src" must be null-terminated. * * If you are going to use other utf8_to_... functions defined in this header * with string which may not be valid UTF-8 with valid codepoint (form 0 to * 0x10FFFF), you should use this function before calling others, since the * other functions do not check whether the string is valid UTF-8 or not. * * If you do not care whether "src" is valid UTF-8 or not, you should use * strlen() as usual, which should be much faster. */ ssize_t utf8_length(const char *src); /** * Measure the length of a UTF-32 string. */ size_t utf8_to_utf32_length(const char *src, size_t src_len); /** * Stores a UTF-32 string converted from "src" in "dst". "dst" must be large * enough to store the entire converted string as measured by * utf8_to_utf32_length plus space for a NULL terminator. */ void utf8_to_utf32(const char* src, size_t src_len, char32_t* dst); /** * Returns the UTF-16 length of UTF-8 string "src". */ ssize_t utf8_to_utf16_length(const uint8_t* src, size_t srcLen); /** * Convert UTF-8 to UTF-16 including surrogate pairs. * Returns a pointer to the end of the string (where a null terminator might go * if you wanted to add one). */ char16_t* utf8_to_utf16_no_null_terminator(const uint8_t* src, size_t srcLen, char16_t* dst); /** * Convert UTF-8 to UTF-16 including surrogate pairs. The destination buffer * must be large enough to hold the result as measured by utf8_to_utf16_length * plus an added NULL terminator. */ void utf8_to_utf16(const uint8_t* src, size_t srcLen, char16_t* dst); } #endif android-audiosystem-1.8+13.10.20130807/include/utils/BackupHelpers.h0000644000015700001700000001037512200324306025364 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _UTILS_BACKUP_HELPERS_H #define _UTILS_BACKUP_HELPERS_H #include #include #include namespace android { enum { BACKUP_HEADER_ENTITY_V1 = 0x61746144, // Data (little endian) }; typedef struct { int type; // BACKUP_HEADER_ENTITY_V1 int keyLen; // length of the key name, not including the null terminator int dataSize; // size of the data, not including the padding, -1 means delete } entity_header_v1; struct SnapshotHeader { int magic0; int fileCount; int magic1; int totalSize; }; struct FileState { int modTime_sec; int modTime_nsec; int mode; int size; int crc32; int nameLen; }; struct FileRec { String8 file; bool deleted; FileState s; }; /** * Writes the data. * * If an error occurs, it poisons this object and all write calls will fail * with the error that occurred. */ class BackupDataWriter { public: BackupDataWriter(int fd); // does not close fd ~BackupDataWriter(); status_t WriteEntityHeader(const String8& key, size_t dataSize); /* Note: WriteEntityData will write arbitrary data into the file without * validation or a previously-supplied header. The full backup implementation * uses it this way to generate a controlled binary stream that is not * entity-structured. If the implementation here is changed, either this * use case must remain valid, or the full backup implementation should be * adjusted to use some other appropriate mechanism. */ status_t WriteEntityData(const void* data, size_t size); void SetKeyPrefix(const String8& keyPrefix); private: explicit BackupDataWriter(); status_t write_padding_for(int n); int m_fd; status_t m_status; ssize_t m_pos; int m_entityCount; String8 m_keyPrefix; }; /** * Reads the data. * * If an error occurs, it poisons this object and all write calls will fail * with the error that occurred. */ class BackupDataReader { public: BackupDataReader(int fd); // does not close fd ~BackupDataReader(); status_t Status(); status_t ReadNextHeader(bool* done, int* type); bool HasEntities(); status_t ReadEntityHeader(String8* key, size_t* dataSize); status_t SkipEntityData(); // must be called with the pointer at the beginning of the data. ssize_t ReadEntityData(void* data, size_t size); private: explicit BackupDataReader(); status_t skip_padding(); int m_fd; bool m_done; status_t m_status; ssize_t m_pos; ssize_t m_dataEndPos; int m_entityCount; union { int type; entity_header_v1 entity; } m_header; String8 m_key; }; int back_up_files(int oldSnapshotFD, BackupDataWriter* dataStream, int newSnapshotFD, char const* const* files, char const* const *keys, int fileCount); int write_tarfile(const String8& packageName, const String8& domain, const String8& rootPath, const String8& filePath, BackupDataWriter* outputStream); class RestoreHelperBase { public: RestoreHelperBase(); ~RestoreHelperBase(); status_t WriteFile(const String8& filename, BackupDataReader* in); status_t WriteSnapshot(int fd); private: void* m_buf; bool m_loggedUnknownMetadata; KeyedVector m_files; }; #define TEST_BACKUP_HELPERS 1 #if TEST_BACKUP_HELPERS int backup_helper_test_empty(); int backup_helper_test_four(); int backup_helper_test_files(); int backup_helper_test_null_base(); int backup_helper_test_missing_file(); int backup_helper_test_data_writer(); int backup_helper_test_data_reader(); #endif } // namespace android #endif // _UTILS_BACKUP_HELPERS_H android-audiosystem-1.8+13.10.20130807/include/utils/Singleton.h0000644000015700001700000000437612200324306024602 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_UTILS_SINGLETON_H #define ANDROID_UTILS_SINGLETON_H #include #include #include #include namespace android { // --------------------------------------------------------------------------- template class ANDROID_API Singleton { public: static TYPE& getInstance() { Mutex::Autolock _l(sLock); TYPE* instance = sInstance; if (instance == 0) { instance = new TYPE(); sInstance = instance; } return *instance; } static bool hasInstance() { Mutex::Autolock _l(sLock); return sInstance != 0; } protected: ~Singleton() { }; Singleton() { }; private: Singleton(const Singleton&); Singleton& operator = (const Singleton&); static Mutex sLock; static TYPE* sInstance; }; /* * use ANDROID_SINGLETON_STATIC_INSTANCE(TYPE) in your implementation file * (eg: .cpp) to create the static instance of Singleton<>'s attributes, * and avoid to have a copy of them in each compilation units Singleton * is used. * NOTE: we use a version of Mutex ctor that takes a parameter, because * for some unknown reason using the default ctor doesn't emit the variable! */ #define ANDROID_SINGLETON_STATIC_INSTANCE(TYPE) \ template class Singleton< TYPE >; \ template<> Mutex Singleton< TYPE >::sLock(Mutex::PRIVATE); \ template<> TYPE* Singleton< TYPE >::sInstance(0); // --------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_UTILS_SINGLETON_H android-audiosystem-1.8+13.10.20130807/include/utils/SystemClock.h0000644000015700001700000000162512200324306025072 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_UTILS_SYSTEMCLOCK_H #define ANDROID_UTILS_SYSTEMCLOCK_H #include #include namespace android { int setCurrentTimeMillis(int64_t millis); int64_t uptimeMillis(); int64_t elapsedRealtime(); }; // namespace android #endif // ANDROID_UTILS_SYSTEMCLOCK_H android-audiosystem-1.8+13.10.20130807/include/utils/ObbFile.h0000644000015700001700000000627012200324306024135 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef OBBFILE_H_ #define OBBFILE_H_ #include #include #include #include namespace android { // OBB flags (bit 0) #define OBB_OVERLAY (1 << 0) #define OBB_SALTED (1 << 1) class ObbFile : public RefBase { protected: virtual ~ObbFile(); public: ObbFile(); bool readFrom(const char* filename); bool readFrom(int fd); bool writeTo(const char* filename); bool writeTo(int fd); bool removeFrom(const char* filename); bool removeFrom(int fd); const char* getFileName() const { return mFileName; } const String8 getPackageName() const { return mPackageName; } void setPackageName(String8 packageName) { mPackageName = packageName; } int32_t getVersion() const { return mVersion; } void setVersion(int32_t version) { mVersion = version; } int32_t getFlags() const { return mFlags; } void setFlags(int32_t flags) { mFlags = flags; } const unsigned char* getSalt(size_t* length) const { if ((mFlags & OBB_SALTED) == 0) { *length = 0; return NULL; } *length = sizeof(mSalt); return mSalt; } bool setSalt(const unsigned char* salt, size_t length) { if (length != sizeof(mSalt)) { return false; } memcpy(mSalt, salt, sizeof(mSalt)); mFlags |= OBB_SALTED; return true; } bool isOverlay() { return (mFlags & OBB_OVERLAY) == OBB_OVERLAY; } void setOverlay(bool overlay) { if (overlay) { mFlags |= OBB_OVERLAY; } else { mFlags &= ~OBB_OVERLAY; } } static inline uint32_t get4LE(const unsigned char* buf) { return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); } static inline void put4LE(unsigned char* buf, uint32_t val) { buf[0] = val & 0xFF; buf[1] = (val >> 8) & 0xFF; buf[2] = (val >> 16) & 0xFF; buf[3] = (val >> 24) & 0xFF; } private: /* Package name this ObbFile is associated with */ String8 mPackageName; /* Package version this ObbFile is associated with */ int32_t mVersion; /* Flags for this OBB type. */ int32_t mFlags; /* Whether the file is salted. */ bool mSalted; /* The encryption salt. */ unsigned char mSalt[8]; const char* mFileName; size_t mFileSize; size_t mFooterStart; unsigned char* mReadBuf; bool parseObbFile(int fd); }; } #endif /* OBBFILE_H_ */ android-audiosystem-1.8+13.10.20130807/include/utils/Flattenable.h0000644000015700001700000000365412200324306025057 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_UTILS_FLATTENABLE_H #define ANDROID_UTILS_FLATTENABLE_H #include #include #include namespace android { class Flattenable { public: // size in bytes of the flattened object virtual size_t getFlattenedSize() const = 0; // number of file descriptors to flatten virtual size_t getFdCount() const = 0; // flattens the object into buffer. // size should be at least of getFlattenedSize() // file descriptors are written in the fds[] array but ownership is // not transfered (ie: they must be dupped by the caller of // flatten() if needed). virtual status_t flatten(void* buffer, size_t size, int fds[], size_t count) const = 0; // unflattens the object from buffer. // size should be equal to the value of getFlattenedSize() when the // object was flattened. // unflattened file descriptors are found in the fds[] array and // don't need to be dupped(). ie: the caller of unflatten doesn't // keep ownership. If a fd is not retained by unflatten() it must be // explicitly closed. virtual status_t unflatten(void const* buffer, size_t size, int fds[], size_t count) = 0; protected: virtual ~Flattenable() = 0; }; }; // namespace android #endif /* ANDROID_UTILS_FLATTENABLE_H */ android-audiosystem-1.8+13.10.20130807/include/utils/String16.h0000644000015700001700000001625012200324306024247 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_STRING16_H #define ANDROID_STRING16_H #include #include #include // --------------------------------------------------------------------------- extern "C" { } // --------------------------------------------------------------------------- namespace android { // --------------------------------------------------------------------------- class String8; class TextOutput; //! This is a string holding UTF-16 characters. class String16 { public: String16(); String16(const String16& o); String16(const String16& o, size_t len, size_t begin=0); explicit String16(const char16_t* o); explicit String16(const char16_t* o, size_t len); explicit String16(const String8& o); explicit String16(const char* o); explicit String16(const char* o, size_t len); ~String16(); inline const char16_t* string() const; inline size_t size() const; inline const SharedBuffer* sharedBuffer() const; void setTo(const String16& other); status_t setTo(const char16_t* other); status_t setTo(const char16_t* other, size_t len); status_t setTo(const String16& other, size_t len, size_t begin=0); status_t append(const String16& other); status_t append(const char16_t* other, size_t len); inline String16& operator=(const String16& other); inline String16& operator+=(const String16& other); inline String16 operator+(const String16& other) const; status_t insert(size_t pos, const char16_t* chrs); status_t insert(size_t pos, const char16_t* chrs, size_t len); ssize_t findFirst(char16_t c) const; ssize_t findLast(char16_t c) const; bool startsWith(const String16& prefix) const; bool startsWith(const char16_t* prefix) const; status_t makeLower(); status_t replaceAll(char16_t replaceThis, char16_t withThis); status_t remove(size_t len, size_t begin=0); inline int compare(const String16& other) const; inline bool operator<(const String16& other) const; inline bool operator<=(const String16& other) const; inline bool operator==(const String16& other) const; inline bool operator!=(const String16& other) const; inline bool operator>=(const String16& other) const; inline bool operator>(const String16& other) const; inline bool operator<(const char16_t* other) const; inline bool operator<=(const char16_t* other) const; inline bool operator==(const char16_t* other) const; inline bool operator!=(const char16_t* other) const; inline bool operator>=(const char16_t* other) const; inline bool operator>(const char16_t* other) const; inline operator const char16_t*() const; private: const char16_t* mString; }; TextOutput& operator<<(TextOutput& to, const String16& val); // --------------------------------------------------------------------------- // No user servicable parts below. inline int compare_type(const String16& lhs, const String16& rhs) { return lhs.compare(rhs); } inline int strictly_order_type(const String16& lhs, const String16& rhs) { return compare_type(lhs, rhs) < 0; } inline const char16_t* String16::string() const { return mString; } inline size_t String16::size() const { return SharedBuffer::sizeFromData(mString)/sizeof(char16_t)-1; } inline const SharedBuffer* String16::sharedBuffer() const { return SharedBuffer::bufferFromData(mString); } inline String16& String16::operator=(const String16& other) { setTo(other); return *this; } inline String16& String16::operator+=(const String16& other) { append(other); return *this; } inline String16 String16::operator+(const String16& other) const { String16 tmp(*this); tmp += other; return tmp; } inline int String16::compare(const String16& other) const { return strzcmp16(mString, size(), other.mString, other.size()); } inline bool String16::operator<(const String16& other) const { return strzcmp16(mString, size(), other.mString, other.size()) < 0; } inline bool String16::operator<=(const String16& other) const { return strzcmp16(mString, size(), other.mString, other.size()) <= 0; } inline bool String16::operator==(const String16& other) const { return strzcmp16(mString, size(), other.mString, other.size()) == 0; } inline bool String16::operator!=(const String16& other) const { return strzcmp16(mString, size(), other.mString, other.size()) != 0; } inline bool String16::operator>=(const String16& other) const { return strzcmp16(mString, size(), other.mString, other.size()) >= 0; } inline bool String16::operator>(const String16& other) const { return strzcmp16(mString, size(), other.mString, other.size()) > 0; } inline bool String16::operator<(const char16_t* other) const { return strcmp16(mString, other) < 0; } inline bool String16::operator<=(const char16_t* other) const { return strcmp16(mString, other) <= 0; } inline bool String16::operator==(const char16_t* other) const { return strcmp16(mString, other) == 0; } inline bool String16::operator!=(const char16_t* other) const { return strcmp16(mString, other) != 0; } inline bool String16::operator>=(const char16_t* other) const { return strcmp16(mString, other) >= 0; } inline bool String16::operator>(const char16_t* other) const { return strcmp16(mString, other) > 0; } inline String16::operator const char16_t*() const { return mString; } }; // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_STRING16_H android-audiosystem-1.8+13.10.20130807/include/utils/StringArray.h0000644000015700001700000000365512200324306025104 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Sortable array of strings. STL-ish, but STL-free. // #ifndef _LIBS_UTILS_STRING_ARRAY_H #define _LIBS_UTILS_STRING_ARRAY_H #include #include namespace android { // // An expanding array of strings. Add, get, sort, delete. // class StringArray { public: StringArray(); virtual ~StringArray(); // // Add a string. A copy of the string is made. // bool push_back(const char* str); // // Delete an entry. // void erase(int idx); // // Sort the array. // void sort(int (*compare)(const void*, const void*)); // // Pass this to the sort routine to do an ascending alphabetical sort. // static int cmpAscendingAlpha(const void* pstr1, const void* pstr2); // // Get the #of items in the array. // inline int size(void) const { return mCurrent; } // // Return entry N. // [should use operator[] here] // const char* getEntry(int idx) const { return (unsigned(idx) >= unsigned(mCurrent)) ? NULL : mArray[idx]; } // // Set entry N to specified string. // [should use operator[] here] // void setEntry(int idx, const char* str); private: int mMax; int mCurrent; char** mArray; }; }; // namespace android #endif // _LIBS_UTILS_STRING_ARRAY_H android-audiosystem-1.8+13.10.20130807/include/utils/Errors.h0000644000015700001700000000465312200324306024112 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_ERRORS_H #define ANDROID_ERRORS_H #include #include namespace android { // use this type to return error codes #ifdef HAVE_MS_C_RUNTIME typedef int status_t; #else typedef int32_t status_t; #endif /* the MS C runtime lacks a few error codes */ /* * Error codes. * All error codes are negative values. */ // Win32 #defines NO_ERROR as well. It has the same value, so there's no // real conflict, though it's a bit awkward. #ifdef _WIN32 # undef NO_ERROR #endif enum { OK = 0, // Everything's swell. NO_ERROR = 0, // No errors. UNKNOWN_ERROR = 0x80000000, NO_MEMORY = -ENOMEM, INVALID_OPERATION = -ENOSYS, BAD_VALUE = -EINVAL, BAD_TYPE = 0x80000001, NAME_NOT_FOUND = -ENOENT, PERMISSION_DENIED = -EPERM, NO_INIT = -ENODEV, ALREADY_EXISTS = -EEXIST, DEAD_OBJECT = -EPIPE, FAILED_TRANSACTION = 0x80000002, JPARKS_BROKE_IT = -EPIPE, #if !defined(HAVE_MS_C_RUNTIME) BAD_INDEX = -EOVERFLOW, NOT_ENOUGH_DATA = -ENODATA, WOULD_BLOCK = -EWOULDBLOCK, TIMED_OUT = -ETIMEDOUT, UNKNOWN_TRANSACTION = -EBADMSG, #else BAD_INDEX = -E2BIG, NOT_ENOUGH_DATA = 0x80000003, WOULD_BLOCK = 0x80000004, TIMED_OUT = 0x80000005, UNKNOWN_TRANSACTION = 0x80000006, #endif FDS_NOT_ALLOWED = 0x80000007, }; // Restore define; enumeration is in "android" namespace, so the value defined // there won't work for Win32 code in a different namespace. #ifdef _WIN32 # define NO_ERROR 0L #endif }; // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_ERRORS_H android-audiosystem-1.8+13.10.20130807/include/utils/FileMap.h0000644000015700001700000000741712200324306024154 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Encapsulate a shared file mapping. // #ifndef __LIBS_FILE_MAP_H #define __LIBS_FILE_MAP_H #include #include #ifdef HAVE_WIN32_FILEMAP #include #endif namespace android { /* * This represents a memory-mapped file. It might be the entire file or * only part of it. This requires a little bookkeeping because the mapping * needs to be aligned on page boundaries, and in some cases we'd like to * have multiple references to the mapped area without creating additional * maps. * * This always uses MAP_SHARED. * * TODO: we should be able to create a new FileMap that is a subset of * an existing FileMap and shares the underlying mapped pages. Requires * completing the refcounting stuff and possibly introducing the notion * of a FileMap hierarchy. */ class FileMap { public: FileMap(void); /* * Create a new mapping on an open file. * * Closing the file descriptor does not unmap the pages, so we don't * claim ownership of the fd. * * Returns "false" on failure. */ bool create(const char* origFileName, int fd, off64_t offset, size_t length, bool readOnly); /* * Return the name of the file this map came from, if known. */ const char* getFileName(void) const { return mFileName; } /* * Get a pointer to the piece of the file we requested. */ void* getDataPtr(void) const { return mDataPtr; } /* * Get the length we requested. */ size_t getDataLength(void) const { return mDataLength; } /* * Get the data offset used to create this map. */ off64_t getDataOffset(void) const { return mDataOffset; } /* * Get a "copy" of the object. */ FileMap* acquire(void) { mRefCount++; return this; } /* * Call this when mapping is no longer needed. */ void release(void) { if (--mRefCount <= 0) delete this; } /* * This maps directly to madvise() values, but allows us to avoid * including everywhere. */ enum MapAdvice { NORMAL, RANDOM, SEQUENTIAL, WILLNEED, DONTNEED }; /* * Apply an madvise() call to the entire file. * * Returns 0 on success, -1 on failure. */ int advise(MapAdvice advice); protected: // don't delete objects; call release() ~FileMap(void); private: // these are not implemented FileMap(const FileMap& src); const FileMap& operator=(const FileMap& src); int mRefCount; // reference count char* mFileName; // original file name, if known void* mBasePtr; // base of mmap area; page aligned size_t mBaseLength; // length, measured from "mBasePtr" off64_t mDataOffset; // offset used when map was created void* mDataPtr; // start of requested data, offset from base size_t mDataLength; // length, measured from "mDataPtr" #ifdef HAVE_WIN32_FILEMAP HANDLE mFileHandle; // Win32 file handle HANDLE mFileMapping; // Win32 file mapping handle #endif static long mPageSize; }; }; // namespace android #endif // __LIBS_FILE_MAP_H android-audiosystem-1.8+13.10.20130807/include/utils/Functor.h0000644000015700001700000000163312200324306024251 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_FUNCTOR_H #define ANDROID_FUNCTOR_H #include namespace android { class Functor { public: Functor() {} virtual ~Functor() {} virtual status_t operator ()(int what, void* data) { return NO_ERROR; } }; }; // namespace android #endif // ANDROID_FUNCTOR_H android-audiosystem-1.8+13.10.20130807/include/utils/TypeHelpers.h0000644000015700001700000001674112200324306025103 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_TYPE_HELPERS_H #define ANDROID_TYPE_HELPERS_H #include #include #include #include // --------------------------------------------------------------------------- namespace android { /* * Types traits */ template struct trait_trivial_ctor { enum { value = false }; }; template struct trait_trivial_dtor { enum { value = false }; }; template struct trait_trivial_copy { enum { value = false }; }; template struct trait_trivial_move { enum { value = false }; }; template struct trait_pointer { enum { value = false }; }; template struct trait_pointer { enum { value = true }; }; template struct traits { enum { // whether this type is a pointer is_pointer = trait_pointer::value, // whether this type's constructor is a no-op has_trivial_ctor = is_pointer || trait_trivial_ctor::value, // whether this type's destructor is a no-op has_trivial_dtor = is_pointer || trait_trivial_dtor::value, // whether this type type can be copy-constructed with memcpy has_trivial_copy = is_pointer || trait_trivial_copy::value, // whether this type can be moved with memmove has_trivial_move = is_pointer || trait_trivial_move::value }; }; template struct aggregate_traits { enum { is_pointer = false, has_trivial_ctor = traits::has_trivial_ctor && traits::has_trivial_ctor, has_trivial_dtor = traits::has_trivial_dtor && traits::has_trivial_dtor, has_trivial_copy = traits::has_trivial_copy && traits::has_trivial_copy, has_trivial_move = traits::has_trivial_move && traits::has_trivial_move }; }; #define ANDROID_BASIC_TYPES_TRAITS( T ) \ template<> struct trait_trivial_ctor< T > { enum { value = true }; }; \ template<> struct trait_trivial_dtor< T > { enum { value = true }; }; \ template<> struct trait_trivial_copy< T > { enum { value = true }; }; \ template<> struct trait_trivial_move< T > { enum { value = true }; }; // --------------------------------------------------------------------------- /* * basic types traits */ ANDROID_BASIC_TYPES_TRAITS( void ) ANDROID_BASIC_TYPES_TRAITS( bool ) ANDROID_BASIC_TYPES_TRAITS( char ) ANDROID_BASIC_TYPES_TRAITS( unsigned char ) ANDROID_BASIC_TYPES_TRAITS( short ) ANDROID_BASIC_TYPES_TRAITS( unsigned short ) ANDROID_BASIC_TYPES_TRAITS( int ) ANDROID_BASIC_TYPES_TRAITS( unsigned int ) ANDROID_BASIC_TYPES_TRAITS( long ) ANDROID_BASIC_TYPES_TRAITS( unsigned long ) ANDROID_BASIC_TYPES_TRAITS( long long ) ANDROID_BASIC_TYPES_TRAITS( unsigned long long ) ANDROID_BASIC_TYPES_TRAITS( float ) ANDROID_BASIC_TYPES_TRAITS( double ) // --------------------------------------------------------------------------- /* * compare and order types */ template inline int strictly_order_type(const TYPE& lhs, const TYPE& rhs) { return (lhs < rhs) ? 1 : 0; } template inline int compare_type(const TYPE& lhs, const TYPE& rhs) { return strictly_order_type(rhs, lhs) - strictly_order_type(lhs, rhs); } /* * create, destroy, copy and move types... */ template inline void construct_type(TYPE* p, size_t n) { if (!traits::has_trivial_ctor) { while (n--) { new(p++) TYPE; } } } template inline void destroy_type(TYPE* p, size_t n) { if (!traits::has_trivial_dtor) { while (n--) { p->~TYPE(); p++; } } } template inline void copy_type(TYPE* d, const TYPE* s, size_t n) { if (!traits::has_trivial_copy) { while (n--) { new(d) TYPE(*s); d++, s++; } } else { memcpy(d,s,n*sizeof(TYPE)); } } template inline void splat_type(TYPE* where, const TYPE* what, size_t n) { if (!traits::has_trivial_copy) { while (n--) { new(where) TYPE(*what); where++; } } else { while (n--) { *where++ = *what; } } } template inline void move_forward_type(TYPE* d, const TYPE* s, size_t n = 1) { if ((traits::has_trivial_dtor && traits::has_trivial_copy) || traits::has_trivial_move) { memmove(d,s,n*sizeof(TYPE)); } else { d += n; s += n; while (n--) { --d, --s; if (!traits::has_trivial_copy) { new(d) TYPE(*s); } else { *d = *s; } if (!traits::has_trivial_dtor) { s->~TYPE(); } } } } template inline void move_backward_type(TYPE* d, const TYPE* s, size_t n = 1) { if ((traits::has_trivial_dtor && traits::has_trivial_copy) || traits::has_trivial_move) { memmove(d,s,n*sizeof(TYPE)); } else { while (n--) { if (!traits::has_trivial_copy) { new(d) TYPE(*s); } else { *d = *s; } if (!traits::has_trivial_dtor) { s->~TYPE(); } d++, s++; } } } // --------------------------------------------------------------------------- /* * a key/value pair */ template struct key_value_pair_t { KEY key; VALUE value; key_value_pair_t() { } key_value_pair_t(const key_value_pair_t& o) : key(o.key), value(o.value) { } key_value_pair_t(const KEY& k, const VALUE& v) : key(k), value(v) { } key_value_pair_t(const KEY& k) : key(k) { } inline bool operator < (const key_value_pair_t& o) const { return strictly_order_type(key, o.key); } }; template<> template struct trait_trivial_ctor< key_value_pair_t > { enum { value = aggregate_traits::has_trivial_ctor }; }; template<> template struct trait_trivial_dtor< key_value_pair_t > { enum { value = aggregate_traits::has_trivial_dtor }; }; template<> template struct trait_trivial_copy< key_value_pair_t > { enum { value = aggregate_traits::has_trivial_copy }; }; template<> template struct trait_trivial_move< key_value_pair_t > { enum { value = aggregate_traits::has_trivial_move }; }; // --------------------------------------------------------------------------- }; // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_TYPE_HELPERS_H android-audiosystem-1.8+13.10.20130807/include/utils/Tokenizer.h0000644000015700001700000000670412200324306024607 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _UTILS_TOKENIZER_H #define _UTILS_TOKENIZER_H #include #include #include #include namespace android { /** * A simple tokenizer for loading and parsing ASCII text files line by line. */ class Tokenizer { Tokenizer(const String8& filename, FileMap* fileMap, char* buffer, size_t length); public: ~Tokenizer(); /** * Opens a file and maps it into memory. * * Returns NO_ERROR and a tokenizer for the file, if successful. * Otherwise returns an error and sets outTokenizer to NULL. */ static status_t open(const String8& filename, Tokenizer** outTokenizer); /** * Returns true if at the end of the file. */ inline bool isEof() const { return mCurrent == getEnd(); } /** * Returns true if at the end of the line or end of the file. */ inline bool isEol() const { return isEof() || *mCurrent == '\n'; } /** * Gets the name of the file. */ inline String8 getFilename() const { return mFilename; } /** * Gets a 1-based line number index for the current position. */ inline int32_t getLineNumber() const { return mLineNumber; } /** * Formats a location string consisting of the filename and current line number. * Returns a string like "MyFile.txt:33". */ String8 getLocation() const; /** * Gets the character at the current position. * Returns null at end of file. */ inline char peekChar() const { return isEof() ? '\0' : *mCurrent; } /** * Gets the remainder of the current line as a string, excluding the newline character. */ String8 peekRemainderOfLine() const; /** * Gets the character at the current position and advances past it. * Returns null at end of file. */ inline char nextChar() { return isEof() ? '\0' : *(mCurrent++); } /** * Gets the next token on this line stopping at the specified delimiters * or the end of the line whichever comes first and advances past it. * Also stops at embedded nulls. * Returns the token or an empty string if the current character is a delimiter * or is at the end of the line. */ String8 nextToken(const char* delimiters); /** * Advances to the next line. * Does nothing if already at the end of the file. */ void nextLine(); /** * Skips over the specified delimiters in the line. * Also skips embedded nulls. */ void skipDelimiters(const char* delimiters); private: Tokenizer(const Tokenizer& other); // not copyable String8 mFilename; FileMap* mFileMap; char* mBuffer; size_t mLength; const char* mCurrent; int32_t mLineNumber; inline const char* getEnd() const { return mBuffer + mLength; } }; } // namespace android #endif // _UTILS_TOKENIZER_H android-audiosystem-1.8+13.10.20130807/include/utils/ByteOrder.h0000644000015700001700000000417312200324306024532 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // #ifndef _LIBS_UTILS_BYTE_ORDER_H #define _LIBS_UTILS_BYTE_ORDER_H #include #include #ifdef HAVE_WINSOCK #include #else #include #endif /* * These macros are like the hton/ntoh byte swapping macros, * except they allow you to swap to and from the "device" byte * order. The device byte order is the endianness of the target * device -- for the ARM CPUs we use today, this is little endian. * * Note that the byte swapping functions have not been optimized * much; performance is currently not an issue for them since the * intent is to allow us to avoid byte swapping on the device. */ static inline uint32_t android_swap_long(uint32_t v) { return (v<<24) | ((v<<8)&0x00FF0000) | ((v>>8)&0x0000FF00) | (v>>24); } static inline uint16_t android_swap_short(uint16_t v) { return (v<<8) | (v>>8); } #define DEVICE_BYTE_ORDER LITTLE_ENDIAN #if BYTE_ORDER == DEVICE_BYTE_ORDER #define dtohl(x) (x) #define dtohs(x) (x) #define htodl(x) (x) #define htods(x) (x) #else #define dtohl(x) (android_swap_long(x)) #define dtohs(x) (android_swap_short(x)) #define htodl(x) (android_swap_long(x)) #define htods(x) (android_swap_short(x)) #endif #if BYTE_ORDER == LITTLE_ENDIAN #define fromlel(x) (x) #define fromles(x) (x) #define tolel(x) (x) #define toles(x) (x) #else #define fromlel(x) (android_swap_long(x)) #define fromles(x) (android_swap_short(x)) #define tolel(x) (android_swap_long(x)) #define toles(x) (android_swap_short(x)) #endif #endif // _LIBS_UTILS_BYTE_ORDER_H android-audiosystem-1.8+13.10.20130807/include/utils/VectorImpl.h0000644000015700001700000002013012200324306024706 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_VECTOR_IMPL_H #define ANDROID_VECTOR_IMPL_H #include #include #include #include // --------------------------------------------------------------------------- // No user serviceable parts in here... // --------------------------------------------------------------------------- namespace android { /*! * Implementation of the guts of the vector<> class * this ensures backward binary compatibility and * reduces code size. * For performance reasons, we expose mStorage and mCount * so these fields are set in stone. * */ class VectorImpl { public: enum { // flags passed to the ctor HAS_TRIVIAL_CTOR = 0x00000001, HAS_TRIVIAL_DTOR = 0x00000002, HAS_TRIVIAL_COPY = 0x00000004, }; VectorImpl(size_t itemSize, uint32_t flags); VectorImpl(const VectorImpl& rhs); virtual ~VectorImpl(); /*! must be called from subclasses destructor */ void finish_vector(); VectorImpl& operator = (const VectorImpl& rhs); /*! C-style array access */ inline const void* arrayImpl() const { return mStorage; } void* editArrayImpl(); /*! vector stats */ inline size_t size() const { return mCount; } inline bool isEmpty() const { return mCount == 0; } size_t capacity() const; ssize_t setCapacity(size_t size); /*! append/insert another vector or array */ ssize_t insertVectorAt(const VectorImpl& vector, size_t index); ssize_t appendVector(const VectorImpl& vector); ssize_t insertArrayAt(const void* array, size_t index, size_t length); ssize_t appendArray(const void* array, size_t length); /*! add/insert/replace items */ ssize_t insertAt(size_t where, size_t numItems = 1); ssize_t insertAt(const void* item, size_t where, size_t numItems = 1); void pop(); void push(); void push(const void* item); ssize_t add(); ssize_t add(const void* item); ssize_t replaceAt(size_t index); ssize_t replaceAt(const void* item, size_t index); /*! remove items */ ssize_t removeItemsAt(size_t index, size_t count = 1); void clear(); const void* itemLocation(size_t index) const; void* editItemLocation(size_t index); typedef int (*compar_t)(const void* lhs, const void* rhs); typedef int (*compar_r_t)(const void* lhs, const void* rhs, void* state); status_t sort(compar_t cmp); status_t sort(compar_r_t cmp, void* state); protected: size_t itemSize() const; void release_storage(); virtual void do_construct(void* storage, size_t num) const = 0; virtual void do_destroy(void* storage, size_t num) const = 0; virtual void do_copy(void* dest, const void* from, size_t num) const = 0; virtual void do_splat(void* dest, const void* item, size_t num) const = 0; virtual void do_move_forward(void* dest, const void* from, size_t num) const = 0; virtual void do_move_backward(void* dest, const void* from, size_t num) const = 0; // take care of FBC... virtual void reservedVectorImpl1(); virtual void reservedVectorImpl2(); virtual void reservedVectorImpl3(); virtual void reservedVectorImpl4(); virtual void reservedVectorImpl5(); virtual void reservedVectorImpl6(); virtual void reservedVectorImpl7(); virtual void reservedVectorImpl8(); private: void* _grow(size_t where, size_t amount); void _shrink(size_t where, size_t amount); inline void _do_construct(void* storage, size_t num) const; inline void _do_destroy(void* storage, size_t num) const; inline void _do_copy(void* dest, const void* from, size_t num) const; inline void _do_splat(void* dest, const void* item, size_t num) const; inline void _do_move_forward(void* dest, const void* from, size_t num) const; inline void _do_move_backward(void* dest, const void* from, size_t num) const; // These 2 fields are exposed in the inlines below, // so they're set in stone. void * mStorage; // base address of the vector size_t mCount; // number of items const uint32_t mFlags; const size_t mItemSize; }; class SortedVectorImpl : public VectorImpl { public: SortedVectorImpl(size_t itemSize, uint32_t flags); SortedVectorImpl(const VectorImpl& rhs); virtual ~SortedVectorImpl(); SortedVectorImpl& operator = (const SortedVectorImpl& rhs); //! finds the index of an item ssize_t indexOf(const void* item) const; //! finds where this item should be inserted size_t orderOf(const void* item) const; //! add an item in the right place (or replaces it if there is one) ssize_t add(const void* item); //! merges a vector into this one ssize_t merge(const VectorImpl& vector); ssize_t merge(const SortedVectorImpl& vector); //! removes an item ssize_t remove(const void* item); protected: virtual int do_compare(const void* lhs, const void* rhs) const = 0; // take care of FBC... virtual void reservedSortedVectorImpl1(); virtual void reservedSortedVectorImpl2(); virtual void reservedSortedVectorImpl3(); virtual void reservedSortedVectorImpl4(); virtual void reservedSortedVectorImpl5(); virtual void reservedSortedVectorImpl6(); virtual void reservedSortedVectorImpl7(); virtual void reservedSortedVectorImpl8(); private: ssize_t _indexOrderOf(const void* item, size_t* order = 0) const; // these are made private, because they can't be used on a SortedVector // (they don't have an implementation either) ssize_t add(); void pop(); void push(); void push(const void* item); ssize_t insertVectorAt(const VectorImpl& vector, size_t index); ssize_t appendVector(const VectorImpl& vector); ssize_t insertArrayAt(const void* array, size_t index, size_t length); ssize_t appendArray(const void* array, size_t length); ssize_t insertAt(size_t where, size_t numItems = 1); ssize_t insertAt(const void* item, size_t where, size_t numItems = 1); ssize_t replaceAt(size_t index); ssize_t replaceAt(const void* item, size_t index); }; }; // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_VECTOR_IMPL_H android-audiosystem-1.8+13.10.20130807/include/utils/AssetManager.h0000644000015700001700000003153112200324306025203 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Asset management class. AssetManager objects are thread-safe. // #ifndef __LIBS_ASSETMANAGER_H #define __LIBS_ASSETMANAGER_H #include #include #include #include #include #include #include #include /* * Native-app access is via the opaque typedef struct AAssetManager in the C namespace. */ #ifdef __cplusplus extern "C" { #endif struct AAssetManager { }; #ifdef __cplusplus }; #endif /* * Now the proper C++ android-namespace definitions */ namespace android { class Asset; // fwd decl for things that include Asset.h first class ResTable; struct ResTable_config; /* * Every application that uses assets needs one instance of this. A * single instance may be shared across multiple threads, and a single * thread may have more than one instance (the latter is discouraged). * * The purpose of the AssetManager is to create Asset objects. To do * this efficiently it may cache information about the locations of * files it has seen. This can be controlled with the "cacheMode" * argument. * * The asset hierarchy may be examined like a filesystem, using * AssetDir objects to peruse a single directory. */ class AssetManager : public AAssetManager { public: typedef enum CacheMode { CACHE_UNKNOWN = 0, CACHE_OFF, // don't try to cache file locations CACHE_DEFER, // construct cache as pieces are needed //CACHE_SCAN, // scan full(!) asset hierarchy at init() time } CacheMode; AssetManager(CacheMode cacheMode = CACHE_OFF); virtual ~AssetManager(void); static int32_t getGlobalCount(); /* * Add a new source for assets. This can be called multiple times to * look in multiple places for assets. It can be either a directory (for * finding assets as raw files on the disk) or a ZIP file. This newly * added asset path will be examined first when searching for assets, * before any that were previously added. * * Returns "true" on success, "false" on failure. If 'cookie' is non-NULL, * then on success, *cookie is set to the value corresponding to the * newly-added asset source. */ bool addAssetPath(const String8& path, void** cookie); /* * Convenience for adding the standard system assets. Uses the * ANDROID_ROOT environment variable to find them. */ bool addDefaultAssets(); /* * Iterate over the asset paths in this manager. (Previously * added via addAssetPath() and addDefaultAssets().) On first call, * 'cookie' must be NULL, resulting in the first cookie being returned. * Each next cookie will be returned there-after, until NULL indicating * the end has been reached. */ void* nextAssetPath(void* cookie) const; /* * Return an asset path in the manager. 'which' must be between 0 and * countAssetPaths(). */ String8 getAssetPath(void* cookie) const; /* * Set the current locale and vendor. The locale can change during * the lifetime of an AssetManager if the user updates the device's * language setting. The vendor is less likely to change. * * Pass in NULL to indicate no preference. */ void setLocale(const char* locale); void setVendor(const char* vendor); /* * Choose screen orientation for resources values returned. */ void setConfiguration(const ResTable_config& config, const char* locale = NULL); void getConfiguration(ResTable_config* outConfig) const; typedef Asset::AccessMode AccessMode; // typing shortcut /* * Open an asset. * * This will search through locale-specific and vendor-specific * directories and packages to find the file. * * The object returned does not depend on the AssetManager. It should * be freed by calling Asset::close(). */ Asset* open(const char* fileName, AccessMode mode); /* * Open a non-asset file as an asset. * * This is for opening files that are included in an asset package * but aren't assets. These sit outside the usual "locale/vendor" * path hierarchy, and will not be seen by "AssetDir" or included * in our filename cache. */ Asset* openNonAsset(const char* fileName, AccessMode mode); /* * Explicit non-asset file. The file explicitly named by the cookie (the * resource set to look in) and fileName will be opened and returned. */ Asset* openNonAsset(void* cookie, const char* fileName, AccessMode mode); /* * Open a directory within the asset hierarchy. * * The contents of the directory are an amalgam of vendor-specific, * locale-specific, and generic assets stored loosely or in asset * packages. Depending on the cache setting and previous accesses, * this call may incur significant disk overhead. * * To open the top-level directory, pass in "". */ AssetDir* openDir(const char* dirName); /* * Open a directory within a particular path of the asset manager. * * The contents of the directory are an amalgam of vendor-specific, * locale-specific, and generic assets stored loosely or in asset * packages. Depending on the cache setting and previous accesses, * this call may incur significant disk overhead. * * To open the top-level directory, pass in "". */ AssetDir* openNonAssetDir(void* cookie, const char* dirName); /* * Get the type of a file in the asset hierarchy. They will either * be "regular" or "directory". [Currently only works for "regular".] * * Can also be used as a quick test for existence of a file. */ FileType getFileType(const char* fileName); /* * Return the complete resource table to find things in the package. */ const ResTable& getResources(bool required = true) const; /* * Discard cached filename information. This only needs to be called * if somebody has updated the set of "loose" files, and we want to * discard our cached notion of what's where. */ void purge(void) { purgeFileNameCacheLocked(); } /* * Return true if the files this AssetManager references are all * up-to-date (have not been changed since it was created). If false * is returned, you will need to create a new AssetManager to get * the current data. */ bool isUpToDate(); /** * Get the known locales for this asset manager object. */ void getLocales(Vector* locales) const; private: struct asset_path { String8 path; FileType type; String8 idmap; }; Asset* openInPathLocked(const char* fileName, AccessMode mode, const asset_path& path); Asset* openNonAssetInPathLocked(const char* fileName, AccessMode mode, const asset_path& path); Asset* openInLocaleVendorLocked(const char* fileName, AccessMode mode, const asset_path& path, const char* locale, const char* vendor); String8 createPathNameLocked(const asset_path& path, const char* locale, const char* vendor); String8 createPathNameLocked(const asset_path& path, const char* rootDir); String8 createZipSourceNameLocked(const String8& zipFileName, const String8& dirName, const String8& fileName); ZipFileRO* getZipFileLocked(const asset_path& path); Asset* openAssetFromFileLocked(const String8& fileName, AccessMode mode); Asset* openAssetFromZipLocked(const ZipFileRO* pZipFile, const ZipEntryRO entry, AccessMode mode, const String8& entryName); bool scanAndMergeDirLocked(SortedVector* pMergedInfo, const asset_path& path, const char* rootDir, const char* dirName); SortedVector* scanDirLocked(const String8& path); bool scanAndMergeZipLocked(SortedVector* pMergedInfo, const asset_path& path, const char* rootDir, const char* dirName); void mergeInfoLocked(SortedVector* pMergedInfo, const SortedVector* pContents); void loadFileNameCacheLocked(void); void fncScanLocked(SortedVector* pMergedInfo, const char* dirName); bool fncScanAndMergeDirLocked( SortedVector* pMergedInfo, const asset_path& path, const char* locale, const char* vendor, const char* dirName); void purgeFileNameCacheLocked(void); const ResTable* getResTable(bool required = true) const; void setLocaleLocked(const char* locale); void updateResourceParamsLocked() const; bool createIdmapFileLocked(const String8& originalPath, const String8& overlayPath, const String8& idmapPath); bool isIdmapStaleLocked(const String8& originalPath, const String8& overlayPath, const String8& idmapPath); Asset* openIdmapLocked(const struct asset_path& ap) const; bool getZipEntryCrcLocked(const String8& zipPath, const char* entryFilename, uint32_t* pCrc); class SharedZip : public RefBase { public: static sp get(const String8& path); ZipFileRO* getZip(); Asset* getResourceTableAsset(); Asset* setResourceTableAsset(Asset* asset); ResTable* getResourceTable(); ResTable* setResourceTable(ResTable* res); bool isUpToDate(); protected: ~SharedZip(); private: SharedZip(const String8& path, time_t modWhen); SharedZip(); // <-- not implemented String8 mPath; ZipFileRO* mZipFile; time_t mModWhen; Asset* mResourceTableAsset; ResTable* mResourceTable; static Mutex gLock; static DefaultKeyedVector > gOpen; }; /* * Manage a set of Zip files. For each file we need a pointer to the * ZipFile and a time_t with the file's modification date. * * We currently only have two zip files (current app, "common" app). * (This was originally written for 8, based on app/locale/vendor.) */ class ZipSet { public: ZipSet(void); ~ZipSet(void); /* * Return a ZipFileRO structure for a ZipFileRO with the specified * parameters. */ ZipFileRO* getZip(const String8& path); Asset* getZipResourceTableAsset(const String8& path); Asset* setZipResourceTableAsset(const String8& path, Asset* asset); ResTable* getZipResourceTable(const String8& path); ResTable* setZipResourceTable(const String8& path, ResTable* res); // generate path, e.g. "common/en-US-noogle.zip" static String8 getPathName(const char* path); bool isUpToDate(); private: void closeZip(int idx); int getIndex(const String8& zip) const; mutable Vector mZipPath; mutable Vector > mZipFile; }; // Protect all internal state. mutable Mutex mLock; ZipSet mZipSet; Vector mAssetPaths; char* mLocale; char* mVendor; mutable ResTable* mResources; ResTable_config* mConfig; /* * Cached data for "loose" files. This lets us avoid poking at the * filesystem when searching for loose assets. Each entry is the * "extended partial" path, e.g. "default/default/foo/bar.txt". The * full set of files is present, including ".EXCLUDE" entries. * * We do not cache directory names. We don't retain the ".gz", * because to our clients "foo" and "foo.gz" both look like "foo". */ CacheMode mCacheMode; // is the cache enabled? bool mCacheValid; // clear when locale or vendor changes SortedVector mCache; }; }; // namespace android #endif // __LIBS_ASSETMANAGER_H android-audiosystem-1.8+13.10.20130807/include/utils/List.h0000644000015700001700000002401212200324306023540 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Templated list class. Normally we'd use STL, but we don't have that. // This class mimics STL's interfaces. // // Objects are copied into the list with the '=' operator or with copy- // construction, so if the compiler's auto-generated versions won't work for // you, define your own. // // The only class you want to use from here is "List". // #ifndef _LIBS_UTILS_LIST_H #define _LIBS_UTILS_LIST_H #include #include namespace android { /* * Doubly-linked list. Instantiate with "List myList". * * Objects added to the list are copied using the assignment operator, * so this must be defined. */ template class List { protected: /* * One element in the list. */ class _Node { public: explicit _Node(const T& val) : mVal(val) {} ~_Node() {} inline T& getRef() { return mVal; } inline const T& getRef() const { return mVal; } inline _Node* getPrev() const { return mpPrev; } inline _Node* getNext() const { return mpNext; } inline void setVal(const T& val) { mVal = val; } inline void setPrev(_Node* ptr) { mpPrev = ptr; } inline void setNext(_Node* ptr) { mpNext = ptr; } private: friend class List; friend class _ListIterator; T mVal; _Node* mpPrev; _Node* mpNext; }; /* * Iterator for walking through the list. */ template struct CONST_ITERATOR { typedef _Node const * NodePtr; typedef const TYPE Type; }; template struct NON_CONST_ITERATOR { typedef _Node* NodePtr; typedef TYPE Type; }; template< typename U, template class Constness > class _ListIterator { typedef _ListIterator _Iter; typedef typename Constness::NodePtr _NodePtr; typedef typename Constness::Type _Type; explicit _ListIterator(_NodePtr ptr) : mpNode(ptr) {} public: _ListIterator() {} _ListIterator(const _Iter& rhs) : mpNode(rhs.mpNode) {} ~_ListIterator() {} // this will handle conversions from iterator to const_iterator // (and also all convertible iterators) // Here, in this implementation, the iterators can be converted // if the nodes can be converted template explicit _ListIterator(const V& rhs) : mpNode(rhs.mpNode) {} /* * Dereference operator. Used to get at the juicy insides. */ _Type& operator*() const { return mpNode->getRef(); } _Type* operator->() const { return &(mpNode->getRef()); } /* * Iterator comparison. */ inline bool operator==(const _Iter& right) const { return mpNode == right.mpNode; } inline bool operator!=(const _Iter& right) const { return mpNode != right.mpNode; } /* * handle comparisons between iterator and const_iterator */ template inline bool operator==(const OTHER& right) const { return mpNode == right.mpNode; } template inline bool operator!=(const OTHER& right) const { return mpNode != right.mpNode; } /* * Incr/decr, used to move through the list. */ inline _Iter& operator++() { // pre-increment mpNode = mpNode->getNext(); return *this; } const _Iter operator++(int) { // post-increment _Iter tmp(*this); mpNode = mpNode->getNext(); return tmp; } inline _Iter& operator--() { // pre-increment mpNode = mpNode->getPrev(); return *this; } const _Iter operator--(int) { // post-increment _Iter tmp(*this); mpNode = mpNode->getPrev(); return tmp; } inline _NodePtr getNode() const { return mpNode; } _NodePtr mpNode; /* should be private, but older gcc fails */ private: friend class List; }; public: List() { prep(); } List(const List& src) { // copy-constructor prep(); insert(begin(), src.begin(), src.end()); } virtual ~List() { clear(); delete[] (unsigned char*) mpMiddle; } typedef _ListIterator iterator; typedef _ListIterator const_iterator; List& operator=(const List& right); /* returns true if the list is empty */ inline bool empty() const { return mpMiddle->getNext() == mpMiddle; } /* return #of elements in list */ size_t size() const { return size_t(distance(begin(), end())); } /* * Return the first element or one past the last element. The * _Node* we're returning is converted to an "iterator" by a * constructor in _ListIterator. */ inline iterator begin() { return iterator(mpMiddle->getNext()); } inline const_iterator begin() const { return const_iterator(const_cast<_Node const*>(mpMiddle->getNext())); } inline iterator end() { return iterator(mpMiddle); } inline const_iterator end() const { return const_iterator(const_cast<_Node const*>(mpMiddle)); } /* add the object to the head or tail of the list */ void push_front(const T& val) { insert(begin(), val); } void push_back(const T& val) { insert(end(), val); } /* insert before the current node; returns iterator at new node */ iterator insert(iterator posn, const T& val) { _Node* newNode = new _Node(val); // alloc & copy-construct newNode->setNext(posn.getNode()); newNode->setPrev(posn.getNode()->getPrev()); posn.getNode()->getPrev()->setNext(newNode); posn.getNode()->setPrev(newNode); return iterator(newNode); } /* insert a range of elements before the current node */ void insert(iterator posn, const_iterator first, const_iterator last) { for ( ; first != last; ++first) insert(posn, *first); } /* remove one entry; returns iterator at next node */ iterator erase(iterator posn) { _Node* pNext = posn.getNode()->getNext(); _Node* pPrev = posn.getNode()->getPrev(); pPrev->setNext(pNext); pNext->setPrev(pPrev); delete posn.getNode(); return iterator(pNext); } /* remove a range of elements */ iterator erase(iterator first, iterator last) { while (first != last) erase(first++); // don't erase than incr later! return iterator(last); } /* remove all contents of the list */ void clear() { _Node* pCurrent = mpMiddle->getNext(); _Node* pNext; while (pCurrent != mpMiddle) { pNext = pCurrent->getNext(); delete pCurrent; pCurrent = pNext; } mpMiddle->setPrev(mpMiddle); mpMiddle->setNext(mpMiddle); } /* * Measure the distance between two iterators. On exist, "first" * will be equal to "last". The iterators must refer to the same * list. * * FIXME: This is actually a generic iterator function. It should be a * template function at the top-level with specializations for things like * vector<>, which can just do pointer math). Here we limit it to * _ListIterator of the same type but different constness. */ template< typename U, template class CL, template class CR > ptrdiff_t distance( _ListIterator first, _ListIterator last) const { ptrdiff_t count = 0; while (first != last) { ++first; ++count; } return count; } private: /* * I want a _Node but don't need it to hold valid data. More * to the point, I don't want T's constructor to fire, since it * might have side-effects or require arguments. So, we do this * slightly uncouth storage alloc. */ void prep() { mpMiddle = (_Node*) new unsigned char[sizeof(_Node)]; mpMiddle->setPrev(mpMiddle); mpMiddle->setNext(mpMiddle); } /* * This node plays the role of "pointer to head" and "pointer to tail". * It sits in the middle of a circular list of nodes. The iterator * runs around the circle until it encounters this one. */ _Node* mpMiddle; }; /* * Assignment operator. * * The simplest way to do this would be to clear out the target list and * fill it with the source. However, we can speed things along by * re-using existing elements. */ template List& List::operator=(const List& right) { if (this == &right) return *this; // self-assignment iterator firstDst = begin(); iterator lastDst = end(); const_iterator firstSrc = right.begin(); const_iterator lastSrc = right.end(); while (firstSrc != lastSrc && firstDst != lastDst) *firstDst++ = *firstSrc++; if (firstSrc == lastSrc) // ran out of elements in source? erase(firstDst, lastDst); // yes, erase any extras else insert(lastDst, firstSrc, lastSrc); // copy remaining over return *this; } }; // namespace android #endif // _LIBS_UTILS_LIST_H android-audiosystem-1.8+13.10.20130807/include/utils/CallStack.h0000644000015700001700000000403312200324306024467 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_CALLSTACK_H #define ANDROID_CALLSTACK_H #include #include #include // --------------------------------------------------------------------------- namespace android { class CallStack { public: enum { MAX_DEPTH = 31 }; CallStack(); CallStack(const CallStack& rhs); ~CallStack(); CallStack& operator = (const CallStack& rhs); bool operator == (const CallStack& rhs) const; bool operator != (const CallStack& rhs) const; bool operator < (const CallStack& rhs) const; bool operator >= (const CallStack& rhs) const; bool operator > (const CallStack& rhs) const; bool operator <= (const CallStack& rhs) const; const void* operator [] (int index) const; void clear(); void update(int32_t ignoreDepth=1, int32_t maxDepth=MAX_DEPTH); // Dump a stack trace to the log void dump(const char* prefix = 0) const; // Return a string (possibly very long) containing the complete stack trace String8 toString(const char* prefix = 0) const; size_t size() const { return mCount; } private: // Internal helper function String8 toStringSingleLevel(const char* prefix, int32_t level) const; size_t mCount; const void* mStack[MAX_DEPTH]; }; }; // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_CALLSTACK_H android-audiosystem-1.8+13.10.20130807/include/utils/Log.h0000644000015700001700000000227712200324306023357 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // C/C++ logging functions. See the logging documentation for API details. // // We'd like these to be available from C code (in case we import some from // somewhere), so this has a C interface. // // The output will be correct when the log file is shared between multiple // threads and/or multiple processes so long as the operating system // supports O_APPEND. These calls have mutex-protected data structures // and so are NOT reentrant. Do not use LOG in a signal handler. // #ifndef _LIBS_UTILS_LOG_H #define _LIBS_UTILS_LOG_H #include #endif // _LIBS_UTILS_LOG_H android-audiosystem-1.8+13.10.20130807/include/utils/threads.h0000644000015700001700000004350012200324306024262 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _LIBS_UTILS_THREADS_H #define _LIBS_UTILS_THREADS_H #include #include #include #include #if defined(HAVE_PTHREADS) # include #endif // ------------------------------------------------------------------ // C API #ifdef __cplusplus extern "C" { #endif typedef void* android_thread_id_t; typedef int (*android_thread_func_t)(void*); enum { /* * *********************************************** * ** Keep in sync with android.os.Process.java ** * *********************************************** * * This maps directly to the "nice" priorities we use in Android. * A thread priority should be chosen inverse-proportionally to * the amount of work the thread is expected to do. The more work * a thread will do, the less favorable priority it should get so that * it doesn't starve the system. Threads not behaving properly might * be "punished" by the kernel. * Use the levels below when appropriate. Intermediate values are * acceptable, preferably use the {MORE|LESS}_FAVORABLE constants below. */ ANDROID_PRIORITY_LOWEST = 19, /* use for background tasks */ ANDROID_PRIORITY_BACKGROUND = 10, /* most threads run at normal priority */ ANDROID_PRIORITY_NORMAL = 0, /* threads currently running a UI that the user is interacting with */ ANDROID_PRIORITY_FOREGROUND = -2, /* the main UI thread has a slightly more favorable priority */ ANDROID_PRIORITY_DISPLAY = -4, /* ui service treads might want to run at a urgent display (uncommon) */ ANDROID_PRIORITY_URGENT_DISPLAY = HAL_PRIORITY_URGENT_DISPLAY, /* all normal audio threads */ ANDROID_PRIORITY_AUDIO = -16, /* service audio threads (uncommon) */ ANDROID_PRIORITY_URGENT_AUDIO = -19, /* should never be used in practice. regular process might not * be allowed to use this level */ ANDROID_PRIORITY_HIGHEST = -20, ANDROID_PRIORITY_DEFAULT = ANDROID_PRIORITY_NORMAL, ANDROID_PRIORITY_MORE_FAVORABLE = -1, ANDROID_PRIORITY_LESS_FAVORABLE = +1, }; enum { ANDROID_TGROUP_DEFAULT = 0, ANDROID_TGROUP_BG_NONINTERACT = 1, ANDROID_TGROUP_FG_BOOST = 2, ANDROID_TGROUP_MAX = ANDROID_TGROUP_FG_BOOST, }; // Create and run a new thread. extern int androidCreateThread(android_thread_func_t, void *); // Create thread with lots of parameters extern int androidCreateThreadEtc(android_thread_func_t entryFunction, void *userData, const char* threadName, int32_t threadPriority, size_t threadStackSize, android_thread_id_t *threadId); // Get some sort of unique identifier for the current thread. extern android_thread_id_t androidGetThreadId(); // Low-level thread creation -- never creates threads that can // interact with the Java VM. extern int androidCreateRawThreadEtc(android_thread_func_t entryFunction, void *userData, const char* threadName, int32_t threadPriority, size_t threadStackSize, android_thread_id_t *threadId); // Used by the Java Runtime to control how threads are created, so that // they can be proper and lovely Java threads. typedef int (*android_create_thread_fn)(android_thread_func_t entryFunction, void *userData, const char* threadName, int32_t threadPriority, size_t threadStackSize, android_thread_id_t *threadId); extern void androidSetCreateThreadFunc(android_create_thread_fn func); // ------------------------------------------------------------------ // Extra functions working with raw pids. // Get pid for the current thread. extern pid_t androidGetTid(); // Change the scheduling group of a particular thread. The group // should be one of the ANDROID_TGROUP constants. Returns BAD_VALUE if // grp is out of range, else another non-zero value with errno set if // the operation failed. Thread ID zero means current thread. extern int androidSetThreadSchedulingGroup(pid_t tid, int grp); // Change the priority AND scheduling group of a particular thread. The priority // should be one of the ANDROID_PRIORITY constants. Returns INVALID_OPERATION // if the priority set failed, else another value if just the group set failed; // in either case errno is set. Thread ID zero means current thread. extern int androidSetThreadPriority(pid_t tid, int prio); // Get the current priority of a particular thread. Returns one of the // ANDROID_PRIORITY constants or a negative result in case of error. extern int androidGetThreadPriority(pid_t tid); // Get the current scheduling group of a particular thread. Normally returns // one of the ANDROID_TGROUP constants other than ANDROID_TGROUP_DEFAULT. // Returns ANDROID_TGROUP_DEFAULT if no pthread support (e.g. on host) or if // scheduling groups are disabled. Returns INVALID_OPERATION if unexpected error. // Thread ID zero means current thread. extern int androidGetThreadSchedulingGroup(pid_t tid); #ifdef __cplusplus } #endif // ------------------------------------------------------------------ // C++ API #ifdef __cplusplus #include #include #include namespace android { typedef android_thread_id_t thread_id_t; typedef android_thread_func_t thread_func_t; enum { PRIORITY_LOWEST = ANDROID_PRIORITY_LOWEST, PRIORITY_BACKGROUND = ANDROID_PRIORITY_BACKGROUND, PRIORITY_NORMAL = ANDROID_PRIORITY_NORMAL, PRIORITY_FOREGROUND = ANDROID_PRIORITY_FOREGROUND, PRIORITY_DISPLAY = ANDROID_PRIORITY_DISPLAY, PRIORITY_URGENT_DISPLAY = ANDROID_PRIORITY_URGENT_DISPLAY, PRIORITY_AUDIO = ANDROID_PRIORITY_AUDIO, PRIORITY_URGENT_AUDIO = ANDROID_PRIORITY_URGENT_AUDIO, PRIORITY_HIGHEST = ANDROID_PRIORITY_HIGHEST, PRIORITY_DEFAULT = ANDROID_PRIORITY_DEFAULT, PRIORITY_MORE_FAVORABLE = ANDROID_PRIORITY_MORE_FAVORABLE, PRIORITY_LESS_FAVORABLE = ANDROID_PRIORITY_LESS_FAVORABLE, }; // Create and run a new thread. inline bool createThread(thread_func_t f, void *a) { return androidCreateThread(f, a) ? true : false; } // Create thread with lots of parameters inline bool createThreadEtc(thread_func_t entryFunction, void *userData, const char* threadName = "android:unnamed_thread", int32_t threadPriority = PRIORITY_DEFAULT, size_t threadStackSize = 0, thread_id_t *threadId = 0) { return androidCreateThreadEtc(entryFunction, userData, threadName, threadPriority, threadStackSize, threadId) ? true : false; } // Get some sort of unique identifier for the current thread. inline thread_id_t getThreadId() { return androidGetThreadId(); } /*****************************************************************************/ /* * Simple mutex class. The implementation is system-dependent. * * The mutex must be unlocked by the thread that locked it. They are not * recursive, i.e. the same thread can't lock it multiple times. */ class Mutex { public: enum { PRIVATE = 0, SHARED = 1 }; Mutex(); Mutex(const char* name); Mutex(int type, const char* name = NULL); ~Mutex(); // lock or unlock the mutex status_t lock(); void unlock(); // lock if possible; returns 0 on success, error otherwise status_t tryLock(); // Manages the mutex automatically. It'll be locked when Autolock is // constructed and released when Autolock goes out of scope. class Autolock { public: inline Autolock(Mutex& mutex) : mLock(mutex) { mLock.lock(); } inline Autolock(Mutex* mutex) : mLock(*mutex) { mLock.lock(); } inline ~Autolock() { mLock.unlock(); } private: Mutex& mLock; }; private: friend class Condition; // A mutex cannot be copied Mutex(const Mutex&); Mutex& operator = (const Mutex&); #if defined(HAVE_PTHREADS) pthread_mutex_t mMutex; #else void _init(); void* mState; #endif }; #if defined(HAVE_PTHREADS) inline Mutex::Mutex() { pthread_mutex_init(&mMutex, NULL); } inline Mutex::Mutex(const char* name) { pthread_mutex_init(&mMutex, NULL); } inline Mutex::Mutex(int type, const char* name) { if (type == SHARED) { pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); pthread_mutex_init(&mMutex, &attr); pthread_mutexattr_destroy(&attr); } else { pthread_mutex_init(&mMutex, NULL); } } inline Mutex::~Mutex() { pthread_mutex_destroy(&mMutex); } inline status_t Mutex::lock() { return -pthread_mutex_lock(&mMutex); } inline void Mutex::unlock() { pthread_mutex_unlock(&mMutex); } inline status_t Mutex::tryLock() { return -pthread_mutex_trylock(&mMutex); } #endif // HAVE_PTHREADS /* * Automatic mutex. Declare one of these at the top of a function. * When the function returns, it will go out of scope, and release the * mutex. */ typedef Mutex::Autolock AutoMutex; /*****************************************************************************/ #if defined(HAVE_PTHREADS) /* * Simple mutex class. The implementation is system-dependent. * * The mutex must be unlocked by the thread that locked it. They are not * recursive, i.e. the same thread can't lock it multiple times. */ class RWLock { public: enum { PRIVATE = 0, SHARED = 1 }; RWLock(); RWLock(const char* name); RWLock(int type, const char* name = NULL); ~RWLock(); status_t readLock(); status_t tryReadLock(); status_t writeLock(); status_t tryWriteLock(); void unlock(); class AutoRLock { public: inline AutoRLock(RWLock& rwlock) : mLock(rwlock) { mLock.readLock(); } inline ~AutoRLock() { mLock.unlock(); } private: RWLock& mLock; }; class AutoWLock { public: inline AutoWLock(RWLock& rwlock) : mLock(rwlock) { mLock.writeLock(); } inline ~AutoWLock() { mLock.unlock(); } private: RWLock& mLock; }; private: // A RWLock cannot be copied RWLock(const RWLock&); RWLock& operator = (const RWLock&); pthread_rwlock_t mRWLock; }; inline RWLock::RWLock() { pthread_rwlock_init(&mRWLock, NULL); } inline RWLock::RWLock(const char* name) { pthread_rwlock_init(&mRWLock, NULL); } inline RWLock::RWLock(int type, const char* name) { if (type == SHARED) { pthread_rwlockattr_t attr; pthread_rwlockattr_init(&attr); pthread_rwlockattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); pthread_rwlock_init(&mRWLock, &attr); pthread_rwlockattr_destroy(&attr); } else { pthread_rwlock_init(&mRWLock, NULL); } } inline RWLock::~RWLock() { pthread_rwlock_destroy(&mRWLock); } inline status_t RWLock::readLock() { return -pthread_rwlock_rdlock(&mRWLock); } inline status_t RWLock::tryReadLock() { return -pthread_rwlock_tryrdlock(&mRWLock); } inline status_t RWLock::writeLock() { return -pthread_rwlock_wrlock(&mRWLock); } inline status_t RWLock::tryWriteLock() { return -pthread_rwlock_trywrlock(&mRWLock); } inline void RWLock::unlock() { pthread_rwlock_unlock(&mRWLock); } #endif // HAVE_PTHREADS /*****************************************************************************/ /* * Condition variable class. The implementation is system-dependent. * * Condition variables are paired up with mutexes. Lock the mutex, * call wait(), then either re-wait() if things aren't quite what you want, * or unlock the mutex and continue. All threads calling wait() must * use the same mutex for a given Condition. */ class Condition { public: enum { PRIVATE = 0, SHARED = 1 }; Condition(); Condition(int type); ~Condition(); // Wait on the condition variable. Lock the mutex before calling. status_t wait(Mutex& mutex); // same with relative timeout status_t waitRelative(Mutex& mutex, nsecs_t reltime); // Signal the condition variable, allowing one thread to continue. void signal(); // Signal the condition variable, allowing all threads to continue. void broadcast(); private: #if defined(HAVE_PTHREADS) pthread_cond_t mCond; #else void* mState; #endif }; #if defined(HAVE_PTHREADS) inline Condition::Condition() { pthread_cond_init(&mCond, NULL); } inline Condition::Condition(int type) { if (type == SHARED) { pthread_condattr_t attr; pthread_condattr_init(&attr); pthread_condattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); pthread_cond_init(&mCond, &attr); pthread_condattr_destroy(&attr); } else { pthread_cond_init(&mCond, NULL); } } inline Condition::~Condition() { pthread_cond_destroy(&mCond); } inline status_t Condition::wait(Mutex& mutex) { return -pthread_cond_wait(&mCond, &mutex.mMutex); } inline status_t Condition::waitRelative(Mutex& mutex, nsecs_t reltime) { #if defined(HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE) struct timespec ts; ts.tv_sec = reltime/1000000000; ts.tv_nsec = reltime%1000000000; return -pthread_cond_timedwait_relative_np(&mCond, &mutex.mMutex, &ts); #else // HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE struct timespec ts; #if defined(HAVE_POSIX_CLOCKS) clock_gettime(CLOCK_REALTIME, &ts); #else // HAVE_POSIX_CLOCKS // we don't support the clocks here. struct timeval t; gettimeofday(&t, NULL); ts.tv_sec = t.tv_sec; ts.tv_nsec= t.tv_usec*1000; #endif // HAVE_POSIX_CLOCKS ts.tv_sec += reltime/1000000000; ts.tv_nsec+= reltime%1000000000; if (ts.tv_nsec >= 1000000000) { ts.tv_nsec -= 1000000000; ts.tv_sec += 1; } return -pthread_cond_timedwait(&mCond, &mutex.mMutex, &ts); #endif // HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE } inline void Condition::signal() { pthread_cond_signal(&mCond); } inline void Condition::broadcast() { pthread_cond_broadcast(&mCond); } #endif // HAVE_PTHREADS /*****************************************************************************/ /* * This is our spiffy thread object! */ class Thread : virtual public RefBase { public: // Create a Thread object, but doesn't create or start the associated // thread. See the run() method. Thread(bool canCallJava = true); virtual ~Thread(); // Start the thread in threadLoop() which needs to be implemented. virtual status_t run( const char* name = 0, int32_t priority = PRIORITY_DEFAULT, size_t stack = 0); // Ask this object's thread to exit. This function is asynchronous, when the // function returns the thread might still be running. Of course, this // function can be called from a different thread. virtual void requestExit(); // Good place to do one-time initializations virtual status_t readyToRun(); // Call requestExit() and wait until this object's thread exits. // BE VERY CAREFUL of deadlocks. In particular, it would be silly to call // this function from this object's thread. Will return WOULD_BLOCK in // that case. status_t requestExitAndWait(); // Wait until this object's thread exits. Returns immediately if not yet running. // Do not call from this object's thread; will return WOULD_BLOCK in that case. status_t join(); protected: // exitPending() returns true if requestExit() has been called. bool exitPending() const; private: // Derived class must implement threadLoop(). The thread starts its life // here. There are two ways of using the Thread object: // 1) loop: if threadLoop() returns true, it will be called again if // requestExit() wasn't called. // 2) once: if threadLoop() returns false, the thread will exit upon return. virtual bool threadLoop() = 0; private: Thread& operator=(const Thread&); static int _threadLoop(void* user); const bool mCanCallJava; // always hold mLock when reading or writing thread_id_t mThread; mutable Mutex mLock; Condition mThreadExitedCondition; status_t mStatus; // note that all accesses of mExitPending and mRunning need to hold mLock volatile bool mExitPending; volatile bool mRunning; sp mHoldSelf; #if HAVE_ANDROID_OS int mTid; #endif }; }; // namespace android #endif // __cplusplus #endif // _LIBS_UTILS_THREADS_H android-audiosystem-1.8+13.10.20130807/include/utils/Debug.h0000644000015700001700000000421412200324306023655 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_DEBUG_H #define ANDROID_DEBUG_H #include #include namespace android { // --------------------------------------------------------------------------- #ifdef __cplusplus template struct CompileTimeAssert; template<> struct CompileTimeAssert {}; #define COMPILE_TIME_ASSERT(_exp) \ template class CompileTimeAssert< (_exp) >; #endif #define COMPILE_TIME_ASSERT_FUNCTION_SCOPE(_exp) \ CompileTimeAssert<( _exp )>(); // --------------------------------------------------------------------------- #ifdef __cplusplus template struct CompileTimeIfElse; template struct CompileTimeIfElse { typedef LHS TYPE; }; template struct CompileTimeIfElse { typedef RHS TYPE; }; #endif // --------------------------------------------------------------------------- #ifdef __cplusplus extern "C" { #endif const char* stringForIndent(int32_t indentLevel); typedef void (*debugPrintFunc)(void* cookie, const char* txt); void printTypeCode(uint32_t typeCode, debugPrintFunc func = 0, void* cookie = 0); void printHexData(int32_t indent, const void *buf, size_t length, size_t bytesPerLine=16, int32_t singleLineBytesCutoff=16, size_t alignment=0, bool cArrayStyle=false, debugPrintFunc func = 0, void* cookie = 0); #ifdef __cplusplus } #endif // --------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_DEBUG_H android-audiosystem-1.8+13.10.20130807/include/utils/String8.h0000644000015700001700000002656012200324306024175 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_STRING8_H #define ANDROID_STRING8_H #include #include #include #include // for strcmp #include // --------------------------------------------------------------------------- namespace android { class String16; class TextOutput; //! This is a string holding UTF-8 characters. Does not allow the value more // than 0x10FFFF, which is not valid unicode codepoint. class String8 { public: String8(); String8(const String8& o); explicit String8(const char* o); explicit String8(const char* o, size_t numChars); explicit String8(const String16& o); explicit String8(const char16_t* o); explicit String8(const char16_t* o, size_t numChars); explicit String8(const char32_t* o); explicit String8(const char32_t* o, size_t numChars); ~String8(); static inline const String8 empty(); static String8 format(const char* fmt, ...) __attribute__((format (printf, 1, 2))); static String8 formatV(const char* fmt, va_list args); inline const char* string() const; inline size_t size() const; inline size_t length() const; inline size_t bytes() const; inline bool isEmpty() const; inline const SharedBuffer* sharedBuffer() const; void clear(); void setTo(const String8& other); status_t setTo(const char* other); status_t setTo(const char* other, size_t numChars); status_t setTo(const char16_t* other, size_t numChars); status_t setTo(const char32_t* other, size_t length); status_t append(const String8& other); status_t append(const char* other); status_t append(const char* other, size_t numChars); status_t appendFormat(const char* fmt, ...) __attribute__((format (printf, 2, 3))); status_t appendFormatV(const char* fmt, va_list args); // Note that this function takes O(N) time to calculate the value. // No cache value is stored. size_t getUtf32Length() const; int32_t getUtf32At(size_t index, size_t *next_index) const; void getUtf32(char32_t* dst) const; inline String8& operator=(const String8& other); inline String8& operator=(const char* other); inline String8& operator+=(const String8& other); inline String8 operator+(const String8& other) const; inline String8& operator+=(const char* other); inline String8 operator+(const char* other) const; inline int compare(const String8& other) const; inline bool operator<(const String8& other) const; inline bool operator<=(const String8& other) const; inline bool operator==(const String8& other) const; inline bool operator!=(const String8& other) const; inline bool operator>=(const String8& other) const; inline bool operator>(const String8& other) const; inline bool operator<(const char* other) const; inline bool operator<=(const char* other) const; inline bool operator==(const char* other) const; inline bool operator!=(const char* other) const; inline bool operator>=(const char* other) const; inline bool operator>(const char* other) const; inline operator const char*() const; char* lockBuffer(size_t size); void unlockBuffer(); status_t unlockBuffer(size_t size); // return the index of the first byte of other in this at or after // start, or -1 if not found ssize_t find(const char* other, size_t start = 0) const; void toLower(); void toLower(size_t start, size_t numChars); void toUpper(); void toUpper(size_t start, size_t numChars); /* * These methods operate on the string as if it were a path name. */ /* * Set the filename field to a specific value. * * Normalizes the filename, removing a trailing '/' if present. */ void setPathName(const char* name); void setPathName(const char* name, size_t numChars); /* * Get just the filename component. * * "/tmp/foo/bar.c" --> "bar.c" */ String8 getPathLeaf(void) const; /* * Remove the last (file name) component, leaving just the directory * name. * * "/tmp/foo/bar.c" --> "/tmp/foo" * "/tmp" --> "" // ????? shouldn't this be "/" ???? XXX * "bar.c" --> "" */ String8 getPathDir(void) const; /* * Retrieve the front (root dir) component. Optionally also return the * remaining components. * * "/tmp/foo/bar.c" --> "tmp" (remain = "foo/bar.c") * "/tmp" --> "tmp" (remain = "") * "bar.c" --> "bar.c" (remain = "") */ String8 walkPath(String8* outRemains = NULL) const; /* * Return the filename extension. This is the last '.' and any number * of characters that follow it. The '.' is included in case we * decide to expand our definition of what constitutes an extension. * * "/tmp/foo/bar.c" --> ".c" * "/tmp" --> "" * "/tmp/foo.bar/baz" --> "" * "foo.jpeg" --> ".jpeg" * "foo." --> "" */ String8 getPathExtension(void) const; /* * Return the path without the extension. Rules for what constitutes * an extension are described in the comment for getPathExtension(). * * "/tmp/foo/bar.c" --> "/tmp/foo/bar" */ String8 getBasePath(void) const; /* * Add a component to the pathname. We guarantee that there is * exactly one path separator between the old path and the new. * If there is no existing name, we just copy the new name in. * * If leaf is a fully qualified path (i.e. starts with '/', it * replaces whatever was there before. */ String8& appendPath(const char* leaf); String8& appendPath(const String8& leaf) { return appendPath(leaf.string()); } /* * Like appendPath(), but does not affect this string. Returns a new one instead. */ String8 appendPathCopy(const char* leaf) const { String8 p(*this); p.appendPath(leaf); return p; } String8 appendPathCopy(const String8& leaf) const { return appendPathCopy(leaf.string()); } /* * Converts all separators in this string to /, the default path separator. * * If the default OS separator is backslash, this converts all * backslashes to slashes, in-place. Otherwise it does nothing. * Returns self. */ String8& convertToResPath(); private: status_t real_append(const char* other, size_t numChars); char* find_extension(void) const; const char* mString; }; TextOutput& operator<<(TextOutput& to, const String16& val); // --------------------------------------------------------------------------- // No user servicable parts below. inline int compare_type(const String8& lhs, const String8& rhs) { return lhs.compare(rhs); } inline int strictly_order_type(const String8& lhs, const String8& rhs) { return compare_type(lhs, rhs) < 0; } inline const String8 String8::empty() { return String8(); } inline const char* String8::string() const { return mString; } inline size_t String8::length() const { return SharedBuffer::sizeFromData(mString)-1; } inline size_t String8::size() const { return length(); } inline bool String8::isEmpty() const { return length() == 0; } inline size_t String8::bytes() const { return SharedBuffer::sizeFromData(mString)-1; } inline const SharedBuffer* String8::sharedBuffer() const { return SharedBuffer::bufferFromData(mString); } inline String8& String8::operator=(const String8& other) { setTo(other); return *this; } inline String8& String8::operator=(const char* other) { setTo(other); return *this; } inline String8& String8::operator+=(const String8& other) { append(other); return *this; } inline String8 String8::operator+(const String8& other) const { String8 tmp(*this); tmp += other; return tmp; } inline String8& String8::operator+=(const char* other) { append(other); return *this; } inline String8 String8::operator+(const char* other) const { String8 tmp(*this); tmp += other; return tmp; } inline int String8::compare(const String8& other) const { return strcmp(mString, other.mString); } inline bool String8::operator<(const String8& other) const { return strcmp(mString, other.mString) < 0; } inline bool String8::operator<=(const String8& other) const { return strcmp(mString, other.mString) <= 0; } inline bool String8::operator==(const String8& other) const { return strcmp(mString, other.mString) == 0; } inline bool String8::operator!=(const String8& other) const { return strcmp(mString, other.mString) != 0; } inline bool String8::operator>=(const String8& other) const { return strcmp(mString, other.mString) >= 0; } inline bool String8::operator>(const String8& other) const { return strcmp(mString, other.mString) > 0; } inline bool String8::operator<(const char* other) const { return strcmp(mString, other) < 0; } inline bool String8::operator<=(const char* other) const { return strcmp(mString, other) <= 0; } inline bool String8::operator==(const char* other) const { return strcmp(mString, other) == 0; } inline bool String8::operator!=(const char* other) const { return strcmp(mString, other) != 0; } inline bool String8::operator>=(const char* other) const { return strcmp(mString, other) >= 0; } inline bool String8::operator>(const char* other) const { return strcmp(mString, other) > 0; } inline String8::operator const char*() const { return mString; } } // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_STRING8_H android-audiosystem-1.8+13.10.20130807/include/utils/Timers.h0000644000015700001700000001012412200324306024067 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Timer functions. // #ifndef _LIBS_UTILS_TIMERS_H #define _LIBS_UTILS_TIMERS_H #include #include #include // ------------------------------------------------------------------ // C API #ifdef __cplusplus extern "C" { #endif typedef int64_t nsecs_t; // nano-seconds static inline nsecs_t seconds_to_nanoseconds(nsecs_t secs) { return secs*1000000000; } static inline nsecs_t milliseconds_to_nanoseconds(nsecs_t secs) { return secs*1000000; } static inline nsecs_t microseconds_to_nanoseconds(nsecs_t secs) { return secs*1000; } static inline nsecs_t nanoseconds_to_seconds(nsecs_t secs) { return secs/1000000000; } static inline nsecs_t nanoseconds_to_milliseconds(nsecs_t secs) { return secs/1000000; } static inline nsecs_t nanoseconds_to_microseconds(nsecs_t secs) { return secs/1000; } static inline nsecs_t s2ns(nsecs_t v) {return seconds_to_nanoseconds(v);} static inline nsecs_t ms2ns(nsecs_t v) {return milliseconds_to_nanoseconds(v);} static inline nsecs_t us2ns(nsecs_t v) {return microseconds_to_nanoseconds(v);} static inline nsecs_t ns2s(nsecs_t v) {return nanoseconds_to_seconds(v);} static inline nsecs_t ns2ms(nsecs_t v) {return nanoseconds_to_milliseconds(v);} static inline nsecs_t ns2us(nsecs_t v) {return nanoseconds_to_microseconds(v);} static inline nsecs_t seconds(nsecs_t v) { return s2ns(v); } static inline nsecs_t milliseconds(nsecs_t v) { return ms2ns(v); } static inline nsecs_t microseconds(nsecs_t v) { return us2ns(v); } enum { SYSTEM_TIME_REALTIME = 0, // system-wide realtime clock SYSTEM_TIME_MONOTONIC = 1, // monotonic time since unspecified starting point SYSTEM_TIME_PROCESS = 2, // high-resolution per-process clock SYSTEM_TIME_THREAD = 3 // high-resolution per-thread clock }; // return the system-time according to the specified clock #ifdef __cplusplus nsecs_t systemTime(int clock = SYSTEM_TIME_MONOTONIC); #else nsecs_t systemTime(int clock); #endif // def __cplusplus /** * Returns the number of milliseconds to wait between the reference time and the timeout time. * If the timeout is in the past relative to the reference time, returns 0. * If the timeout is more than INT_MAX milliseconds in the future relative to the reference time, * such as when timeoutTime == LLONG_MAX, returns -1 to indicate an infinite timeout delay. * Otherwise, returns the difference between the reference time and timeout time * rounded up to the next millisecond. */ int toMillisecondTimeoutDelay(nsecs_t referenceTime, nsecs_t timeoutTime); #ifdef __cplusplus } // extern "C" #endif // ------------------------------------------------------------------ // C++ API #ifdef __cplusplus namespace android { /* * Time the duration of something. * * Includes some timeval manipulation functions. */ class DurationTimer { public: DurationTimer() {} ~DurationTimer() {} // Start the timer. void start(); // Stop the timer. void stop(); // Get the duration in microseconds. long long durationUsecs() const; // Subtract two timevals. Returns the difference (ptv1-ptv2) in // microseconds. static long long subtractTimevals(const struct timeval* ptv1, const struct timeval* ptv2); // Add the specified amount of time to the timeval. static void addToTimeval(struct timeval* ptv, long usec); private: struct timeval mStartWhen; struct timeval mStopWhen; }; }; // android #endif // def __cplusplus #endif // _LIBS_UTILS_TIMERS_H android-audiosystem-1.8+13.10.20130807/include/utils/ZipUtils.h0000644000015700001700000000414412200324306024414 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Miscellaneous zip/gzip utility functions. // #ifndef __LIBS_ZIPUTILS_H #define __LIBS_ZIPUTILS_H #include namespace android { /* * Container class for utility functions, primarily for namespace reasons. */ class ZipUtils { public: /* * General utility function for uncompressing "deflate" data from a file * to a buffer. */ static bool inflateToBuffer(int fd, void* buf, long uncompressedLen, long compressedLen); static bool inflateToBuffer(FILE* fp, void* buf, long uncompressedLen, long compressedLen); /* * Someday we might want to make this generic and handle bzip2 ".bz2" * files too. * * We could declare gzip to be a sub-class of zip that has exactly * one always-compressed entry, but we currently want to treat Zip * and gzip as distinct, so there's no value. * * The zlib library has some gzip utilities, but it has no interface * for extracting the uncompressed length of the file (you do *not* * want to gzseek to the end). * * Pass in a seeked file pointer for the gzip file. If this is a gzip * file, we set our return values appropriately and return "true" with * the file seeked to the start of the compressed data. */ static bool examineGzip(FILE* fp, int* pCompressionMethod, long* pUncompressedLen, long* pCompressedLen, unsigned long* pCRC32); private: ZipUtils() {} ~ZipUtils() {} }; }; // namespace android #endif /*__LIBS_ZIPUTILS_H*/ android-audiosystem-1.8+13.10.20130807/include/utils/StreamingZipInflater.h0000644000015700001700000000554112200324306026734 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __LIBS_STREAMINGZIPINFLATER_H #define __LIBS_STREAMINGZIPINFLATER_H #include #include #include #include namespace android { class StreamingZipInflater { public: static const size_t INPUT_CHUNK_SIZE = 64 * 1024; static const size_t OUTPUT_CHUNK_SIZE = 64 * 1024; // Flavor that pages in the compressed data from a fd StreamingZipInflater(int fd, off64_t compDataStart, size_t uncompSize, size_t compSize); // Flavor that gets the compressed data from an in-memory buffer StreamingZipInflater(class FileMap* dataMap, size_t uncompSize); ~StreamingZipInflater(); // read 'count' bytes of uncompressed data from the current position. outBuf may // be NULL, in which case the data is consumed and discarded. ssize_t read(void* outBuf, size_t count); // seeking backwards requires uncompressing fom the beginning, so is very // expensive. seeking forwards only requires uncompressing from the current // position to the destination. off64_t seekAbsolute(off64_t absoluteInputPosition); private: void initInflateState(); int readNextChunk(); // where to find the uncompressed data int mFd; off64_t mInFileStart; // where the compressed data lives in the file class FileMap* mDataMap; z_stream mInflateState; bool mStreamNeedsInit; // output invariants for this asset uint8_t* mOutBuf; // output buf for decompressed bytes size_t mOutBufSize; // allocated size of mOutBuf size_t mOutTotalSize; // total uncompressed size of the blob // current output state bookkeeping off64_t mOutCurPosition; // current position in total offset size_t mOutLastDecoded; // last decoded byte + 1 in mOutbuf size_t mOutDeliverable; // next undelivered byte of decoded output in mOutBuf // input invariants uint8_t* mInBuf; size_t mInBufSize; // allocated size of mInBuf; size_t mInTotalSize; // total size of compressed data for this blob // input state bookkeeping size_t mInNextChunkOffset; // offset from start of blob at which the next input chunk lies // the z_stream contains state about input block consumption }; } #endif android-audiosystem-1.8+13.10.20130807/include/utils/StopWatch.h0000644000015700001700000000307712200324306024551 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_STOPWATCH_H #define ANDROID_STOPWATCH_H #include #include #include // --------------------------------------------------------------------------- namespace android { class StopWatch { public: StopWatch( const char *name, int clock = SYSTEM_TIME_MONOTONIC, uint32_t flags = 0); ~StopWatch(); const char* name() const; nsecs_t lap(); nsecs_t elapsedTime() const; void reset(); private: const char* mName; int mClock; uint32_t mFlags; struct lap_t { nsecs_t soFar; nsecs_t thisLap; }; nsecs_t mStartTime; lap_t mLaps[8]; int mNumLaps; }; }; // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_STOPWATCH_H android-audiosystem-1.8+13.10.20130807/include/utils/Compat.h0000644000015700001700000000240512200324306024052 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __LIB_UTILS_COMPAT_H #define __LIB_UTILS_COMPAT_H #include /* Compatibility definitions for non-Linux (i.e., BSD-based) hosts. */ #ifndef HAVE_OFF64_T #if _FILE_OFFSET_BITS < 64 #error "_FILE_OFFSET_BITS < 64; large files are not supported on this platform" #endif /* _FILE_OFFSET_BITS < 64 */ typedef off_t off64_t; static inline off64_t lseek64(int fd, off64_t offset, int whence) { return lseek(fd, offset, whence); } #ifdef HAVE_PREAD static inline ssize_t pread64(int fd, void* buf, size_t nbytes, off64_t offset) { return pread(fd, buf, nbytes, offset); } #endif #endif /* !HAVE_OFF64_T */ #endif /* __LIB_UTILS_COMPAT_H */ android-audiosystem-1.8+13.10.20130807/include/utils/SortedVector.h0000644000015700001700000002233312200324306025254 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_SORTED_VECTOR_H #define ANDROID_SORTED_VECTOR_H #include #include #include #include #include #include // --------------------------------------------------------------------------- namespace android { template class SortedVector : private SortedVectorImpl { friend class Vector; public: typedef TYPE value_type; /*! * Constructors and destructors */ SortedVector(); SortedVector(const SortedVector& rhs); virtual ~SortedVector(); /*! copy operator */ const SortedVector& operator = (const SortedVector& rhs) const; SortedVector& operator = (const SortedVector& rhs); /* * empty the vector */ inline void clear() { VectorImpl::clear(); } /*! * vector stats */ //! returns number of items in the vector inline size_t size() const { return VectorImpl::size(); } //! returns wether or not the vector is empty inline bool isEmpty() const { return VectorImpl::isEmpty(); } //! returns how many items can be stored without reallocating the backing store inline size_t capacity() const { return VectorImpl::capacity(); } //! setst the capacity. capacity can never be reduced less than size() inline ssize_t setCapacity(size_t size) { return VectorImpl::setCapacity(size); } /*! * C-style array access */ //! read-only C-style access inline const TYPE* array() const; //! read-write C-style access. BE VERY CAREFUL when modifying the array //! you ust keep it sorted! You usually don't use this function. TYPE* editArray(); //! finds the index of an item ssize_t indexOf(const TYPE& item) const; //! finds where this item should be inserted size_t orderOf(const TYPE& item) const; /*! * accessors */ //! read-only access to an item at a given index inline const TYPE& operator [] (size_t index) const; //! alternate name for operator [] inline const TYPE& itemAt(size_t index) const; //! stack-usage of the vector. returns the top of the stack (last element) const TYPE& top() const; //! same as operator [], but allows to access the vector backward (from the end) with a negative index const TYPE& mirrorItemAt(ssize_t index) const; /*! * modifing the array */ //! add an item in the right place (and replace the one that is there) ssize_t add(const TYPE& item); //! editItemAt() MUST NOT change the order of this item TYPE& editItemAt(size_t index) { return *( static_cast(VectorImpl::editItemLocation(index)) ); } //! merges a vector into this one ssize_t merge(const Vector& vector); ssize_t merge(const SortedVector& vector); //! removes an item ssize_t remove(const TYPE&); //! remove several items inline ssize_t removeItemsAt(size_t index, size_t count = 1); //! remove one item inline ssize_t removeAt(size_t index) { return removeItemsAt(index); } protected: virtual void do_construct(void* storage, size_t num) const; virtual void do_destroy(void* storage, size_t num) const; virtual void do_copy(void* dest, const void* from, size_t num) const; virtual void do_splat(void* dest, const void* item, size_t num) const; virtual void do_move_forward(void* dest, const void* from, size_t num) const; virtual void do_move_backward(void* dest, const void* from, size_t num) const; virtual int do_compare(const void* lhs, const void* rhs) const; }; // --------------------------------------------------------------------------- // No user serviceable parts from here... // --------------------------------------------------------------------------- template inline SortedVector::SortedVector() : SortedVectorImpl(sizeof(TYPE), ((traits::has_trivial_ctor ? HAS_TRIVIAL_CTOR : 0) |(traits::has_trivial_dtor ? HAS_TRIVIAL_DTOR : 0) |(traits::has_trivial_copy ? HAS_TRIVIAL_COPY : 0)) ) { } template inline SortedVector::SortedVector(const SortedVector& rhs) : SortedVectorImpl(rhs) { } template inline SortedVector::~SortedVector() { finish_vector(); } template inline SortedVector& SortedVector::operator = (const SortedVector& rhs) { SortedVectorImpl::operator = (rhs); return *this; } template inline const SortedVector& SortedVector::operator = (const SortedVector& rhs) const { SortedVectorImpl::operator = (rhs); return *this; } template inline const TYPE* SortedVector::array() const { return static_cast(arrayImpl()); } template inline TYPE* SortedVector::editArray() { return static_cast(editArrayImpl()); } template inline const TYPE& SortedVector::operator[](size_t index) const { assert( index inline const TYPE& SortedVector::itemAt(size_t index) const { return operator[](index); } template inline const TYPE& SortedVector::mirrorItemAt(ssize_t index) const { assert( (index>0 ? index : -index) inline const TYPE& SortedVector::top() const { return *(array() + size() - 1); } template inline ssize_t SortedVector::add(const TYPE& item) { return SortedVectorImpl::add(&item); } template inline ssize_t SortedVector::indexOf(const TYPE& item) const { return SortedVectorImpl::indexOf(&item); } template inline size_t SortedVector::orderOf(const TYPE& item) const { return SortedVectorImpl::orderOf(&item); } template inline ssize_t SortedVector::merge(const Vector& vector) { return SortedVectorImpl::merge(reinterpret_cast(vector)); } template inline ssize_t SortedVector::merge(const SortedVector& vector) { return SortedVectorImpl::merge(reinterpret_cast(vector)); } template inline ssize_t SortedVector::remove(const TYPE& item) { return SortedVectorImpl::remove(&item); } template inline ssize_t SortedVector::removeItemsAt(size_t index, size_t count) { return VectorImpl::removeItemsAt(index, count); } // --------------------------------------------------------------------------- template void SortedVector::do_construct(void* storage, size_t num) const { construct_type( reinterpret_cast(storage), num ); } template void SortedVector::do_destroy(void* storage, size_t num) const { destroy_type( reinterpret_cast(storage), num ); } template void SortedVector::do_copy(void* dest, const void* from, size_t num) const { copy_type( reinterpret_cast(dest), reinterpret_cast(from), num ); } template void SortedVector::do_splat(void* dest, const void* item, size_t num) const { splat_type( reinterpret_cast(dest), reinterpret_cast(item), num ); } template void SortedVector::do_move_forward(void* dest, const void* from, size_t num) const { move_forward_type( reinterpret_cast(dest), reinterpret_cast(from), num ); } template void SortedVector::do_move_backward(void* dest, const void* from, size_t num) const { move_backward_type( reinterpret_cast(dest), reinterpret_cast(from), num ); } template int SortedVector::do_compare(const void* lhs, const void* rhs) const { return compare_type( *reinterpret_cast(lhs), *reinterpret_cast(rhs) ); } }; // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_SORTED_VECTOR_H android-audiosystem-1.8+13.10.20130807/include/utils/BufferedTextOutput.h0000644000015700001700000000363612200324306026446 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_BUFFEREDTEXTOUTPUT_H #define ANDROID_BUFFEREDTEXTOUTPUT_H #include #include #include // --------------------------------------------------------------------------- namespace android { class BufferedTextOutput : public TextOutput { public: //** Flags for constructor */ enum { MULTITHREADED = 0x0001 }; BufferedTextOutput(uint32_t flags = 0); virtual ~BufferedTextOutput(); virtual status_t print(const char* txt, size_t len); virtual void moveIndent(int delta); virtual void pushBundle(); virtual void popBundle(); protected: virtual status_t writeLines(const struct iovec& vec, size_t N) = 0; private: struct BufferState; struct ThreadState; static ThreadState* getThreadState(); static void threadDestructor(void *st); BufferState* getBuffer() const; uint32_t mFlags; const int32_t mSeq; const int32_t mIndex; Mutex mLock; BufferState* mGlobalState; }; // --------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_BUFFEREDTEXTOUTPUT_H android-audiosystem-1.8+13.10.20130807/include/utils/Vector.h0000644000015700001700000003273212200324306024077 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_VECTOR_H #define ANDROID_VECTOR_H #include #include #include #include #include #include // --------------------------------------------------------------------------- namespace android { template class SortedVector; /*! * The main templated vector class ensuring type safety * while making use of VectorImpl. * This is the class users want to use. */ template class Vector : private VectorImpl { public: typedef TYPE value_type; /*! * Constructors and destructors */ Vector(); Vector(const Vector& rhs); explicit Vector(const SortedVector& rhs); virtual ~Vector(); /*! copy operator */ const Vector& operator = (const Vector& rhs) const; Vector& operator = (const Vector& rhs); const Vector& operator = (const SortedVector& rhs) const; Vector& operator = (const SortedVector& rhs); /* * empty the vector */ inline void clear() { VectorImpl::clear(); } /*! * vector stats */ //! returns number of items in the vector inline size_t size() const { return VectorImpl::size(); } //! returns wether or not the vector is empty inline bool isEmpty() const { return VectorImpl::isEmpty(); } //! returns how many items can be stored without reallocating the backing store inline size_t capacity() const { return VectorImpl::capacity(); } //! setst the capacity. capacity can never be reduced less than size() inline ssize_t setCapacity(size_t size) { return VectorImpl::setCapacity(size); } /*! * C-style array access */ //! read-only C-style access inline const TYPE* array() const; //! read-write C-style access TYPE* editArray(); /*! * accessors */ //! read-only access to an item at a given index inline const TYPE& operator [] (size_t index) const; //! alternate name for operator [] inline const TYPE& itemAt(size_t index) const; //! stack-usage of the vector. returns the top of the stack (last element) const TYPE& top() const; //! same as operator [], but allows to access the vector backward (from the end) with a negative index const TYPE& mirrorItemAt(ssize_t index) const; /*! * modifing the array */ //! copy-on write support, grants write access to an item TYPE& editItemAt(size_t index); //! grants right acces to the top of the stack (last element) TYPE& editTop(); /*! * append/insert another vector */ //! insert another vector at a given index ssize_t insertVectorAt(const Vector& vector, size_t index); //! append another vector at the end of this one ssize_t appendVector(const Vector& vector); //! insert an array at a given index ssize_t insertArrayAt(const TYPE* array, size_t index, size_t length); //! append an array at the end of this vector ssize_t appendArray(const TYPE* array, size_t length); /*! * add/insert/replace items */ //! insert one or several items initialized with their default constructor inline ssize_t insertAt(size_t index, size_t numItems = 1); //! insert one or several items initialized from a prototype item ssize_t insertAt(const TYPE& prototype_item, size_t index, size_t numItems = 1); //! pop the top of the stack (removes the last element). No-op if the stack's empty inline void pop(); //! pushes an item initialized with its default constructor inline void push(); //! pushes an item on the top of the stack void push(const TYPE& item); //! same as push() but returns the index the item was added at (or an error) inline ssize_t add(); //! same as push() but returns the index the item was added at (or an error) ssize_t add(const TYPE& item); //! replace an item with a new one initialized with its default constructor inline ssize_t replaceAt(size_t index); //! replace an item with a new one ssize_t replaceAt(const TYPE& item, size_t index); /*! * remove items */ //! remove several items inline ssize_t removeItemsAt(size_t index, size_t count = 1); //! remove one item inline ssize_t removeAt(size_t index) { return removeItemsAt(index); } /*! * sort (stable) the array */ typedef int (*compar_t)(const TYPE* lhs, const TYPE* rhs); typedef int (*compar_r_t)(const TYPE* lhs, const TYPE* rhs, void* state); inline status_t sort(compar_t cmp); inline status_t sort(compar_r_t cmp, void* state); // for debugging only inline size_t getItemSize() const { return itemSize(); } /* * these inlines add some level of compatibility with STL. eventually * we should probably turn things around. */ typedef TYPE* iterator; typedef TYPE const* const_iterator; inline iterator begin() { return editArray(); } inline iterator end() { return editArray() + size(); } inline const_iterator begin() const { return array(); } inline const_iterator end() const { return array() + size(); } inline void reserve(size_t n) { setCapacity(n); } inline bool empty() const{ return isEmpty(); } inline void push_back(const TYPE& item) { insertAt(item, size()); } inline void push_front(const TYPE& item) { insertAt(item, 0); } inline iterator erase(iterator pos) { return begin() + removeItemsAt(pos-array()); } protected: virtual void do_construct(void* storage, size_t num) const; virtual void do_destroy(void* storage, size_t num) const; virtual void do_copy(void* dest, const void* from, size_t num) const; virtual void do_splat(void* dest, const void* item, size_t num) const; virtual void do_move_forward(void* dest, const void* from, size_t num) const; virtual void do_move_backward(void* dest, const void* from, size_t num) const; }; // --------------------------------------------------------------------------- // No user serviceable parts from here... // --------------------------------------------------------------------------- template inline Vector::Vector() : VectorImpl(sizeof(TYPE), ((traits::has_trivial_ctor ? HAS_TRIVIAL_CTOR : 0) |(traits::has_trivial_dtor ? HAS_TRIVIAL_DTOR : 0) |(traits::has_trivial_copy ? HAS_TRIVIAL_COPY : 0)) ) { } template inline Vector::Vector(const Vector& rhs) : VectorImpl(rhs) { } template inline Vector::Vector(const SortedVector& rhs) : VectorImpl(static_cast(rhs)) { } template inline Vector::~Vector() { finish_vector(); } template inline Vector& Vector::operator = (const Vector& rhs) { VectorImpl::operator = (rhs); return *this; } template inline const Vector& Vector::operator = (const Vector& rhs) const { VectorImpl::operator = (static_cast(rhs)); return *this; } template inline Vector& Vector::operator = (const SortedVector& rhs) { VectorImpl::operator = (static_cast(rhs)); return *this; } template inline const Vector& Vector::operator = (const SortedVector& rhs) const { VectorImpl::operator = (rhs); return *this; } template inline const TYPE* Vector::array() const { return static_cast(arrayImpl()); } template inline TYPE* Vector::editArray() { return static_cast(editArrayImpl()); } template inline const TYPE& Vector::operator[](size_t index) const { LOG_FATAL_IF( index>=size(), "itemAt: index %d is past size %d", (int)index, (int)size() ); return *(array() + index); } template inline const TYPE& Vector::itemAt(size_t index) const { return operator[](index); } template inline const TYPE& Vector::mirrorItemAt(ssize_t index) const { LOG_FATAL_IF( (index>0 ? index : -index)>=size(), "mirrorItemAt: index %d is past size %d", (int)index, (int)size() ); return *(array() + ((index<0) ? (size()-index) : index)); } template inline const TYPE& Vector::top() const { return *(array() + size() - 1); } template inline TYPE& Vector::editItemAt(size_t index) { return *( static_cast(editItemLocation(index)) ); } template inline TYPE& Vector::editTop() { return *( static_cast(editItemLocation(size()-1)) ); } template inline ssize_t Vector::insertVectorAt(const Vector& vector, size_t index) { return VectorImpl::insertVectorAt(reinterpret_cast(vector), index); } template inline ssize_t Vector::appendVector(const Vector& vector) { return VectorImpl::appendVector(reinterpret_cast(vector)); } template inline ssize_t Vector::insertArrayAt(const TYPE* array, size_t index, size_t length) { return VectorImpl::insertArrayAt(array, index, length); } template inline ssize_t Vector::appendArray(const TYPE* array, size_t length) { return VectorImpl::appendArray(array, length); } template inline ssize_t Vector::insertAt(const TYPE& item, size_t index, size_t numItems) { return VectorImpl::insertAt(&item, index, numItems); } template inline void Vector::push(const TYPE& item) { return VectorImpl::push(&item); } template inline ssize_t Vector::add(const TYPE& item) { return VectorImpl::add(&item); } template inline ssize_t Vector::replaceAt(const TYPE& item, size_t index) { return VectorImpl::replaceAt(&item, index); } template inline ssize_t Vector::insertAt(size_t index, size_t numItems) { return VectorImpl::insertAt(index, numItems); } template inline void Vector::pop() { VectorImpl::pop(); } template inline void Vector::push() { VectorImpl::push(); } template inline ssize_t Vector::add() { return VectorImpl::add(); } template inline ssize_t Vector::replaceAt(size_t index) { return VectorImpl::replaceAt(index); } template inline ssize_t Vector::removeItemsAt(size_t index, size_t count) { return VectorImpl::removeItemsAt(index, count); } template inline status_t Vector::sort(Vector::compar_t cmp) { return VectorImpl::sort((VectorImpl::compar_t)cmp); } template inline status_t Vector::sort(Vector::compar_r_t cmp, void* state) { return VectorImpl::sort((VectorImpl::compar_r_t)cmp, state); } // --------------------------------------------------------------------------- template void Vector::do_construct(void* storage, size_t num) const { construct_type( reinterpret_cast(storage), num ); } template void Vector::do_destroy(void* storage, size_t num) const { destroy_type( reinterpret_cast(storage), num ); } template void Vector::do_copy(void* dest, const void* from, size_t num) const { copy_type( reinterpret_cast(dest), reinterpret_cast(from), num ); } template void Vector::do_splat(void* dest, const void* item, size_t num) const { splat_type( reinterpret_cast(dest), reinterpret_cast(item), num ); } template void Vector::do_move_forward(void* dest, const void* from, size_t num) const { move_forward_type( reinterpret_cast(dest), reinterpret_cast(from), num ); } template void Vector::do_move_backward(void* dest, const void* from, size_t num) const { move_backward_type( reinterpret_cast(dest), reinterpret_cast(from), num ); } }; // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_VECTOR_H android-audiosystem-1.8+13.10.20130807/include/utils/ZipFileCRO.h0000644000015700001700000000323712200324306024541 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // C API for ead-only access to Zip archives, with minimal heap allocation. // #ifndef __LIBS_ZIPFILECRO_H #define __LIBS_ZIPFILECRO_H #include #include #include #include #ifdef __cplusplus extern "C" { #endif /* * Trivial typedef to ensure that ZipFileCRO is not treated as a simple integer. */ typedef void* ZipFileCRO; /* * Trivial typedef to ensure that ZipEntryCRO is not treated as a simple * integer. We use NULL to indicate an invalid value. */ typedef void* ZipEntryCRO; extern ZipFileCRO ZipFileXRO_open(const char* path); extern void ZipFileCRO_destroy(ZipFileCRO zip); extern ZipEntryCRO ZipFileCRO_findEntryByName(ZipFileCRO zip, const char* fileName); extern bool ZipFileCRO_getEntryInfo(ZipFileCRO zip, ZipEntryCRO entry, int* pMethod, size_t* pUncompLen, size_t* pCompLen, off64_t* pOffset, long* pModWhen, long* pCrc32); extern bool ZipFileCRO_uncompressEntry(ZipFileCRO zip, ZipEntryCRO entry, int fd); #ifdef __cplusplus } #endif #endif /*__LIBS_ZIPFILECRO_H*/ android-audiosystem-1.8+13.10.20130807/include/utils/GenerationCache.h0000644000015700001700000001454012200324306025651 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_UTILS_GENERATION_CACHE_H #define ANDROID_UTILS_GENERATION_CACHE_H #include #include namespace android { /** * GenerationCache callback used when an item is removed */ template class OnEntryRemoved { public: virtual ~OnEntryRemoved() { }; virtual void operator()(EntryKey& key, EntryValue& value) = 0; }; // class OnEntryRemoved template struct Entry: public LightRefBase > { Entry() { } Entry(const Entry& e): key(e.key), value(e.value), parent(e.parent), child(e.child) { } Entry(sp > e): key(e->key), value(e->value), parent(e->parent), child(e->child) { } EntryKey key; EntryValue value; sp > parent; sp > child; }; // struct Entry /** * A LRU type cache */ template class GenerationCache { public: GenerationCache(uint32_t maxCapacity); virtual ~GenerationCache(); enum Capacity { kUnlimitedCapacity, }; void setOnEntryRemovedListener(OnEntryRemoved* listener); void clear(); bool contains(K key) const; V get(K key); K getKeyAt(uint32_t index) const; bool put(K key, V value); V remove(K key); V removeOldest(); V getValueAt(uint32_t index) const; uint32_t size() const; void addToCache(sp > entry, K key, V value); void attachToCache(sp > entry); void detachFromCache(sp > entry); V removeAt(ssize_t index); private: KeyedVector > > mCache; uint32_t mMaxCapacity; OnEntryRemoved* mListener; sp > mOldest; sp > mYoungest; }; // class GenerationCache template GenerationCache::GenerationCache(uint32_t maxCapacity): mMaxCapacity(maxCapacity), mListener(NULL) { }; template GenerationCache::~GenerationCache() { clear(); }; template uint32_t GenerationCache::size() const { return mCache.size(); } /** * Should be set by the user of the Cache so that the callback is called whenever an item is * removed from the cache */ template void GenerationCache::setOnEntryRemovedListener(OnEntryRemoved* listener) { mListener = listener; } template void GenerationCache::clear() { if (mListener) { for (uint32_t i = 0; i < mCache.size(); i++) { sp > entry = mCache.valueAt(i); if (mListener) { (*mListener)(entry->key, entry->value); } } } mCache.clear(); mYoungest.clear(); mOldest.clear(); } template bool GenerationCache::contains(K key) const { return mCache.indexOfKey(key) >= 0; } template K GenerationCache::getKeyAt(uint32_t index) const { return mCache.keyAt(index); } template V GenerationCache::getValueAt(uint32_t index) const { return mCache.valueAt(index)->value; } template V GenerationCache::get(K key) { ssize_t index = mCache.indexOfKey(key); if (index >= 0) { sp > entry = mCache.valueAt(index); if (entry.get()) { detachFromCache(entry); attachToCache(entry); return entry->value; } } return NULL; } template bool GenerationCache::put(K key, V value) { if (mMaxCapacity != kUnlimitedCapacity && mCache.size() >= mMaxCapacity) { removeOldest(); } ssize_t index = mCache.indexOfKey(key); if (index < 0) { sp > entry = new Entry; addToCache(entry, key, value); return true; } return false; } template void GenerationCache::addToCache(sp > entry, K key, V value) { entry->key = key; entry->value = value; mCache.add(key, entry); attachToCache(entry); } template V GenerationCache::remove(K key) { ssize_t index = mCache.indexOfKey(key); if (index >= 0) { return removeAt(index); } return NULL; } template V GenerationCache::removeAt(ssize_t index) { sp > entry = mCache.valueAt(index); if (mListener) { (*mListener)(entry->key, entry->value); } mCache.removeItemsAt(index, 1); detachFromCache(entry); return entry->value; } template V GenerationCache::removeOldest() { if (mOldest.get()) { ssize_t index = mCache.indexOfKey(mOldest->key); if (index >= 0) { return removeAt(index); } } return NULL; } template void GenerationCache::attachToCache(sp > entry) { if (!mYoungest.get()) { mYoungest = mOldest = entry; } else { entry->parent = mYoungest; mYoungest->child = entry; mYoungest = entry; } } template void GenerationCache::detachFromCache(sp > entry) { if (entry->parent.get()) { entry->parent->child = entry->child; } if (entry->child.get()) { entry->child->parent = entry->parent; } if (mOldest == entry) { mOldest = entry->child; } if (mYoungest == entry) { mYoungest = entry->parent; } entry->parent.clear(); entry->child.clear(); } }; // namespace android #endif // ANDROID_UTILS_GENERATION_CACHE_H android-audiosystem-1.8+13.10.20130807/include/utils/TextOutput.h0000644000015700001700000001241112200324306024772 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_TEXTOUTPUT_H #define ANDROID_TEXTOUTPUT_H #include #include #include // --------------------------------------------------------------------------- namespace android { class TextOutput { public: TextOutput(); virtual ~TextOutput(); virtual status_t print(const char* txt, size_t len) = 0; virtual void moveIndent(int delta) = 0; class Bundle { public: inline Bundle(TextOutput& to) : mTO(to) { to.pushBundle(); } inline ~Bundle() { mTO.popBundle(); } private: TextOutput& mTO; }; virtual void pushBundle() = 0; virtual void popBundle() = 0; }; // --------------------------------------------------------------------------- // Text output stream for printing to the log (via utils/Log.h). extern TextOutput& alog; // Text output stream for printing to stdout. extern TextOutput& aout; // Text output stream for printing to stderr. extern TextOutput& aerr; typedef TextOutput& (*TextOutputManipFunc)(TextOutput&); TextOutput& endl(TextOutput& to); TextOutput& indent(TextOutput& to); TextOutput& dedent(TextOutput& to); TextOutput& operator<<(TextOutput& to, const char* str); TextOutput& operator<<(TextOutput& to, char); // writes raw character TextOutput& operator<<(TextOutput& to, bool); TextOutput& operator<<(TextOutput& to, int); TextOutput& operator<<(TextOutput& to, long); TextOutput& operator<<(TextOutput& to, unsigned int); TextOutput& operator<<(TextOutput& to, unsigned long); TextOutput& operator<<(TextOutput& to, long long); TextOutput& operator<<(TextOutput& to, unsigned long long); TextOutput& operator<<(TextOutput& to, float); TextOutput& operator<<(TextOutput& to, double); TextOutput& operator<<(TextOutput& to, TextOutputManipFunc func); TextOutput& operator<<(TextOutput& to, const void*); class TypeCode { public: inline TypeCode(uint32_t code); inline ~TypeCode(); inline uint32_t typeCode() const; private: uint32_t mCode; }; TextOutput& operator<<(TextOutput& to, const TypeCode& val); class HexDump { public: HexDump(const void *buf, size_t size, size_t bytesPerLine=16); inline ~HexDump(); inline HexDump& setBytesPerLine(size_t bytesPerLine); inline HexDump& setSingleLineCutoff(int32_t bytes); inline HexDump& setAlignment(size_t alignment); inline HexDump& setCArrayStyle(bool enabled); inline const void* buffer() const; inline size_t size() const; inline size_t bytesPerLine() const; inline int32_t singleLineCutoff() const; inline size_t alignment() const; inline bool carrayStyle() const; private: const void* mBuffer; size_t mSize; size_t mBytesPerLine; int32_t mSingleLineCutoff; size_t mAlignment; bool mCArrayStyle; }; TextOutput& operator<<(TextOutput& to, const HexDump& val); // --------------------------------------------------------------------------- // No user servicable parts below. inline TextOutput& endl(TextOutput& to) { to.print("\n", 1); return to; } inline TextOutput& indent(TextOutput& to) { to.moveIndent(1); return to; } inline TextOutput& dedent(TextOutput& to) { to.moveIndent(-1); return to; } inline TextOutput& operator<<(TextOutput& to, const char* str) { to.print(str, strlen(str)); return to; } inline TextOutput& operator<<(TextOutput& to, char c) { to.print(&c, 1); return to; } inline TextOutput& operator<<(TextOutput& to, TextOutputManipFunc func) { return (*func)(to); } inline TypeCode::TypeCode(uint32_t code) : mCode(code) { } inline TypeCode::~TypeCode() { } inline uint32_t TypeCode::typeCode() const { return mCode; } inline HexDump::~HexDump() { } inline HexDump& HexDump::setBytesPerLine(size_t bytesPerLine) { mBytesPerLine = bytesPerLine; return *this; } inline HexDump& HexDump::setSingleLineCutoff(int32_t bytes) { mSingleLineCutoff = bytes; return *this; } inline HexDump& HexDump::setAlignment(size_t alignment) { mAlignment = alignment; return *this; } inline HexDump& HexDump::setCArrayStyle(bool enabled) { mCArrayStyle = enabled; return *this; } inline const void* HexDump::buffer() const { return mBuffer; } inline size_t HexDump::size() const { return mSize; } inline size_t HexDump::bytesPerLine() const { return mBytesPerLine; } inline int32_t HexDump::singleLineCutoff() const { return mSingleLineCutoff; } inline size_t HexDump::alignment() const { return mAlignment; } inline bool HexDump::carrayStyle() const { return mCArrayStyle; } // --------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_TEXTOUTPUT_H android-audiosystem-1.8+13.10.20130807/include/utils/misc.h0000644000015700001700000000507412200324306023567 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Handy utility functions and portability code. // #ifndef _LIBS_UTILS_MISC_H #define _LIBS_UTILS_MISC_H #include #include namespace android { /* get #of elements in a static array */ #ifndef NELEM # define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0]))) #endif /* * Make a copy of the string, using "new[]" instead of "malloc". Free the * string with delete[]. * * Returns NULL if "str" is NULL. */ char* strdupNew(const char* str); /* * Concatenate an argument vector into a single string. If argc is >= 0 * it will be used; if it's < 0 then the last element in the arg vector * must be NULL. * * This inserts a space between each argument. * * This does not automatically add double quotes around arguments with * spaces in them. This practice is necessary for Win32, because Win32's * CreateProcess call is stupid. * * The caller should delete[] the returned string. */ char* concatArgv(int argc, const char* const argv[]); /* * Count up the number of arguments in "argv". The count does not include * the final NULL entry. */ int countArgv(const char* const argv[]); /* * Some utility functions for working with files. These could be made * part of a "File" class. */ typedef enum FileType { kFileTypeUnknown = 0, kFileTypeNonexistent, // i.e. ENOENT kFileTypeRegular, kFileTypeDirectory, kFileTypeCharDev, kFileTypeBlockDev, kFileTypeFifo, kFileTypeSymlink, kFileTypeSocket, } FileType; /* get the file's type; follows symlinks */ FileType getFileType(const char* fileName); /* get the file's modification date; returns -1 w/errno set on failure */ time_t getFileModDate(const char* fileName); /* * Round up to the nearest power of 2. Handy for hash tables. */ unsigned int roundUpPower2(unsigned int val); void strreverse(char* begin, char* end); void k_itoa(int value, char* str, int base); char* itoa(int val, int base); }; // namespace android #endif // _LIBS_UTILS_MISC_H android-audiosystem-1.8+13.10.20130807/include/utils/StrongPointer.h0000644000015700001700000001323512200324306025447 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_STRONG_POINTER_H #define ANDROID_STRONG_POINTER_H #include #include #include #include // --------------------------------------------------------------------------- namespace android { class TextOutput; TextOutput& printStrongPointer(TextOutput& to, const void* val); template class wp; // --------------------------------------------------------------------------- #define COMPARE(_op_) \ inline bool operator _op_ (const sp& o) const { \ return m_ptr _op_ o.m_ptr; \ } \ inline bool operator _op_ (const T* o) const { \ return m_ptr _op_ o; \ } \ template \ inline bool operator _op_ (const sp& o) const { \ return m_ptr _op_ o.m_ptr; \ } \ template \ inline bool operator _op_ (const U* o) const { \ return m_ptr _op_ o; \ } \ inline bool operator _op_ (const wp& o) const { \ return m_ptr _op_ o.m_ptr; \ } \ template \ inline bool operator _op_ (const wp& o) const { \ return m_ptr _op_ o.m_ptr; \ } // --------------------------------------------------------------------------- template class sp { public: inline sp() : m_ptr(0) { } sp(T* other); sp(const sp& other); template sp(U* other); template sp(const sp& other); ~sp(); // Assignment sp& operator = (T* other); sp& operator = (const sp& other); template sp& operator = (const sp& other); template sp& operator = (U* other); //! Special optimization for use by ProcessState (and nobody else). void force_set(T* other); // Reset void clear(); // Accessors inline T& operator* () const { return *m_ptr; } inline T* operator-> () const { return m_ptr; } inline T* get() const { return m_ptr; } // Operators COMPARE(==) COMPARE(!=) COMPARE(>) COMPARE(<) COMPARE(<=) COMPARE(>=) private: template friend class sp; template friend class wp; void set_pointer(T* ptr); T* m_ptr; }; #undef COMPARE template TextOutput& operator<<(TextOutput& to, const sp& val); // --------------------------------------------------------------------------- // No user serviceable parts below here. template sp::sp(T* other) : m_ptr(other) { if (other) other->incStrong(this); } template sp::sp(const sp& other) : m_ptr(other.m_ptr) { if (m_ptr) m_ptr->incStrong(this); } template template sp::sp(U* other) : m_ptr(other) { if (other) ((T*)other)->incStrong(this); } template template sp::sp(const sp& other) : m_ptr(other.m_ptr) { if (m_ptr) m_ptr->incStrong(this); } template sp::~sp() { if (m_ptr) m_ptr->decStrong(this); } template sp& sp::operator = (const sp& other) { T* otherPtr(other.m_ptr); if (otherPtr) otherPtr->incStrong(this); if (m_ptr) m_ptr->decStrong(this); m_ptr = otherPtr; return *this; } template sp& sp::operator = (T* other) { if (other) other->incStrong(this); if (m_ptr) m_ptr->decStrong(this); m_ptr = other; return *this; } template template sp& sp::operator = (const sp& other) { T* otherPtr(other.m_ptr); if (otherPtr) otherPtr->incStrong(this); if (m_ptr) m_ptr->decStrong(this); m_ptr = otherPtr; return *this; } template template sp& sp::operator = (U* other) { if (other) ((T*)other)->incStrong(this); if (m_ptr) m_ptr->decStrong(this); m_ptr = other; return *this; } template void sp::force_set(T* other) { other->forceIncStrong(this); m_ptr = other; } template void sp::clear() { if (m_ptr) { m_ptr->decStrong(this); m_ptr = 0; } } template void sp::set_pointer(T* ptr) { m_ptr = ptr; } template inline TextOutput& operator<<(TextOutput& to, const sp& val) { return printStrongPointer(to, val.get()); } }; // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_STRONG_POINTER_H android-audiosystem-1.8+13.10.20130807/include/utils/Looper.h0000644000015700001700000003133412200324306024072 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef UTILS_LOOPER_H #define UTILS_LOOPER_H #include #include #include #include #include // When defined, uses epoll_wait() for polling, otherwise uses poll(). #define LOOPER_USES_EPOLL // When defined, logs performance statistics for tuning and debugging purposes. //#define LOOPER_STATISTICS #ifdef LOOPER_USES_EPOLL #include #else #include #endif /* * Declare a concrete type for the NDK's looper forward declaration. */ struct ALooper { }; namespace android { /** * A message that can be posted to a Looper. */ struct Message { Message() : what(0) { } Message(int what) : what(what) { } /* The message type. (interpretation is left up to the handler) */ int what; }; /** * Interface for a Looper message handler. * * The Looper holds a strong reference to the message handler whenever it has * a message to deliver to it. Make sure to call Looper::removeMessages * to remove any pending messages destined for the handler so that the handler * can be destroyed. */ class MessageHandler : public virtual RefBase { protected: virtual ~MessageHandler() { } public: /** * Handles a message. */ virtual void handleMessage(const Message& message) = 0; }; /** * A simple proxy that holds a weak reference to a message handler. */ class WeakMessageHandler : public MessageHandler { public: WeakMessageHandler(const wp& handler); virtual void handleMessage(const Message& message); private: wp mHandler; }; /** * A polling loop that supports monitoring file descriptor events, optionally * using callbacks. The implementation uses epoll() internally. * * A looper can be associated with a thread although there is no requirement that it must be. */ class Looper : public ALooper, public RefBase { protected: virtual ~Looper(); public: /** * Creates a looper. * * If allowNonCallbaks is true, the looper will allow file descriptors to be * registered without associated callbacks. This assumes that the caller of * pollOnce() is prepared to handle callback-less events itself. */ Looper(bool allowNonCallbacks); /** * Returns whether this looper instance allows the registration of file descriptors * using identifiers instead of callbacks. */ bool getAllowNonCallbacks() const; /** * Waits for events to be available, with optional timeout in milliseconds. * Invokes callbacks for all file descriptors on which an event occurred. * * If the timeout is zero, returns immediately without blocking. * If the timeout is negative, waits indefinitely until an event appears. * * Returns ALOOPER_POLL_WAKE if the poll was awoken using wake() before * the timeout expired and no callbacks were invoked and no other file * descriptors were ready. * * Returns ALOOPER_POLL_CALLBACK if one or more callbacks were invoked. * * Returns ALOOPER_POLL_TIMEOUT if there was no data before the given * timeout expired. * * Returns ALOOPER_POLL_ERROR if an error occurred. * * Returns a value >= 0 containing an identifier if its file descriptor has data * and it has no callback function (requiring the caller here to handle it). * In this (and only this) case outFd, outEvents and outData will contain the poll * events and data associated with the fd, otherwise they will be set to NULL. * * This method does not return until it has finished invoking the appropriate callbacks * for all file descriptors that were signalled. */ int pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData); inline int pollOnce(int timeoutMillis) { return pollOnce(timeoutMillis, NULL, NULL, NULL); } /** * Like pollOnce(), but performs all pending callbacks until all * data has been consumed or a file descriptor is available with no callback. * This function will never return ALOOPER_POLL_CALLBACK. */ int pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outData); inline int pollAll(int timeoutMillis) { return pollAll(timeoutMillis, NULL, NULL, NULL); } /** * Wakes the poll asynchronously. * * This method can be called on any thread. * This method returns immediately. */ void wake(); /** * Adds a new file descriptor to be polled by the looper. * If the same file descriptor was previously added, it is replaced. * * "fd" is the file descriptor to be added. * "ident" is an identifier for this event, which is returned from ALooper_pollOnce(). * The identifier must be >= 0, or ALOOPER_POLL_CALLBACK if providing a non-NULL callback. * "events" are the poll events to wake up on. Typically this is ALOOPER_EVENT_INPUT. * "callback" is the function to call when there is an event on the file descriptor. * "data" is a private data pointer to supply to the callback. * * There are two main uses of this function: * * (1) If "callback" is non-NULL, then this function will be called when there is * data on the file descriptor. It should execute any events it has pending, * appropriately reading from the file descriptor. The 'ident' is ignored in this case. * * (2) If "callback" is NULL, the 'ident' will be returned by ALooper_pollOnce * when its file descriptor has data available, requiring the caller to take * care of processing it. * * Returns 1 if the file descriptor was added, 0 if the arguments were invalid. * * This method can be called on any thread. * This method may block briefly if it needs to wake the poll. */ int addFd(int fd, int ident, int events, ALooper_callbackFunc callback, void* data); /** * Removes a previously added file descriptor from the looper. * * When this method returns, it is safe to close the file descriptor since the looper * will no longer have a reference to it. However, it is possible for the callback to * already be running or for it to run one last time if the file descriptor was already * signalled. Calling code is responsible for ensuring that this case is safely handled. * For example, if the callback takes care of removing itself during its own execution either * by returning 0 or by calling this method, then it can be guaranteed to not be invoked * again at any later time unless registered anew. * * Returns 1 if the file descriptor was removed, 0 if none was previously registered. * * This method can be called on any thread. * This method may block briefly if it needs to wake the poll. */ int removeFd(int fd); /** * Enqueues a message to be processed by the specified handler. * * The handler must not be null. * This method can be called on any thread. */ void sendMessage(const sp& handler, const Message& message); /** * Enqueues a message to be processed by the specified handler after all pending messages * after the specified delay. * * The time delay is specified in uptime nanoseconds. * The handler must not be null. * This method can be called on any thread. */ void sendMessageDelayed(nsecs_t uptimeDelay, const sp& handler, const Message& message); /** * Enqueues a message to be processed by the specified handler after all pending messages * at the specified time. * * The time is specified in uptime nanoseconds. * The handler must not be null. * This method can be called on any thread. */ void sendMessageAtTime(nsecs_t uptime, const sp& handler, const Message& message); /** * Removes all messages for the specified handler from the queue. * * The handler must not be null. * This method can be called on any thread. */ void removeMessages(const sp& handler); /** * Removes all messages of a particular type for the specified handler from the queue. * * The handler must not be null. * This method can be called on any thread. */ void removeMessages(const sp& handler, int what); /** * Prepares a looper associated with the calling thread, and returns it. * If the thread already has a looper, it is returned. Otherwise, a new * one is created, associated with the thread, and returned. * * The opts may be ALOOPER_PREPARE_ALLOW_NON_CALLBACKS or 0. */ static sp prepare(int opts); /** * Sets the given looper to be associated with the calling thread. * If another looper is already associated with the thread, it is replaced. * * If "looper" is NULL, removes the currently associated looper. */ static void setForThread(const sp& looper); /** * Returns the looper associated with the calling thread, or NULL if * there is not one. */ static sp getForThread(); private: struct Request { int fd; int ident; ALooper_callbackFunc callback; void* data; }; struct Response { int events; Request request; }; struct MessageEnvelope { MessageEnvelope() : uptime(0) { } MessageEnvelope(nsecs_t uptime, const sp handler, const Message& message) : uptime(uptime), handler(handler), message(message) { } nsecs_t uptime; sp handler; Message message; }; const bool mAllowNonCallbacks; // immutable int mWakeReadPipeFd; // immutable int mWakeWritePipeFd; // immutable Mutex mLock; Vector mMessageEnvelopes; // guarded by mLock bool mSendingMessage; // guarded by mLock #ifdef LOOPER_USES_EPOLL int mEpollFd; // immutable // Locked list of file descriptor monitoring requests. KeyedVector mRequests; // guarded by mLock #else // The lock guards state used to track whether there is a poll() in progress and whether // there are any other threads waiting in wakeAndLock(). The condition variables // are used to transfer control among these threads such that all waiters are // serviced before a new poll can begin. // The wakeAndLock() method increments mWaiters, wakes the poll, blocks on mAwake // until mPolling becomes false, then decrements mWaiters again. // The poll() method blocks on mResume until mWaiters becomes 0, then sets // mPolling to true, blocks until the poll completes, then resets mPolling to false // and signals mResume if there are waiters. bool mPolling; // guarded by mLock uint32_t mWaiters; // guarded by mLock Condition mAwake; // guarded by mLock Condition mResume; // guarded by mLock Vector mRequestedFds; // must hold mLock and mPolling must be false to modify Vector mRequests; // must hold mLock and mPolling must be false to modify ssize_t getRequestIndexLocked(int fd); void wakeAndLock(); #endif #ifdef LOOPER_STATISTICS static const int SAMPLED_WAKE_CYCLES_TO_AGGREGATE = 100; static const int SAMPLED_POLLS_TO_AGGREGATE = 1000; nsecs_t mPendingWakeTime; int mPendingWakeCount; int mSampledWakeCycles; int mSampledWakeCountSum; nsecs_t mSampledWakeLatencySum; int mSampledPolls; int mSampledZeroPollCount; int mSampledZeroPollLatencySum; int mSampledTimeoutPollCount; int mSampledTimeoutPollLatencySum; #endif // This state is only used privately by pollOnce and does not require a lock since // it runs on a single thread. Vector mResponses; size_t mResponseIndex; nsecs_t mNextMessageUptime; // set to LLONG_MAX when none int pollInner(int timeoutMillis); void awoken(); void pushResponse(int events, const Request& request); static void initTLSKey(); static void threadDestructor(void *st); }; } // namespace android #endif // UTILS_LOOPER_H android-audiosystem-1.8+13.10.20130807/include/utils/ashmem.h0000644000015700001700000000240112200324306024075 0ustar pbuserpbgroup00000000000000/* utils/ashmem.h ** ** Copyright 2008 The Android Open Source Project ** ** This file is dual licensed. It may be redistributed and/or modified ** under the terms of the Apache 2.0 License OR version 2 of the GNU ** General Public License. */ #ifndef _UTILS_ASHMEM_H #define _UTILS_ASHMEM_H #include #include #define ASHMEM_NAME_LEN 256 #define ASHMEM_NAME_DEF "dev/ashmem" /* Return values from ASHMEM_PIN: Was the mapping purged while unpinned? */ #define ASHMEM_NOT_REAPED 0 #define ASHMEM_WAS_REAPED 1 /* Return values from ASHMEM_UNPIN: Is the mapping now pinned or unpinned? */ #define ASHMEM_NOW_UNPINNED 0 #define ASHMEM_NOW_PINNED 1 #define __ASHMEMIOC 0x77 #define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN]) #define ASHMEM_GET_NAME _IOR(__ASHMEMIOC, 2, char[ASHMEM_NAME_LEN]) #define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t) #define ASHMEM_GET_SIZE _IO(__ASHMEMIOC, 4) #define ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned long) #define ASHMEM_GET_PROT_MASK _IO(__ASHMEMIOC, 6) #define ASHMEM_PIN _IO(__ASHMEMIOC, 7) #define ASHMEM_UNPIN _IO(__ASHMEMIOC, 8) #define ASHMEM_ISPINNED _IO(__ASHMEMIOC, 9) #define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10) #endif /* _UTILS_ASHMEM_H */ android-audiosystem-1.8+13.10.20130807/include/utils/ZipFileRO.h0000644000015700001700000002053112200324306024432 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Read-only access to Zip archives, with minimal heap allocation. * * This is similar to the more-complete ZipFile class, but no attempt * has been made to make them interchangeable. This class operates under * a very different set of assumptions and constraints. * * One such assumption is that if you're getting file descriptors for * use with this class as a child of a fork() operation, you must be on * a pread() to guarantee correct operation. This is because pread() can * atomically read at a file offset without worrying about a lock around an * lseek() + read() pair. */ #ifndef __LIBS_ZIPFILERO_H #define __LIBS_ZIPFILERO_H #include #include #include #include #include #include #include #include namespace android { /* * Trivial typedef to ensure that ZipEntryRO is not treated as a simple * integer. We use NULL to indicate an invalid value. */ typedef void* ZipEntryRO; /* * Open a Zip archive for reading. * * We want "open" and "find entry by name" to be fast operations, and we * want to use as little memory as possible. We memory-map the file, * and load a hash table with pointers to the filenames (which aren't * null-terminated). The other fields are at a fixed offset from the * filename, so we don't need to extract those (but we do need to byte-read * and endian-swap them every time we want them). * * To speed comparisons when doing a lookup by name, we could make the mapping * "private" (copy-on-write) and null-terminate the filenames after verifying * the record structure. However, this requires a private mapping of * every page that the Central Directory touches. Easier to tuck a copy * of the string length into the hash table entry. * * NOTE: If this is used on file descriptors inherited from a fork() operation, * you must be on a platform that implements pread() to guarantee correctness * on the shared file descriptors. */ class ZipFileRO { public: ZipFileRO() : mFd(-1), mFileName(NULL), mFileLength(-1), mDirectoryMap(NULL), mNumEntries(-1), mDirectoryOffset(-1), mHashTableSize(-1), mHashTable(NULL) {} ~ZipFileRO(); /* * Open an archive. */ status_t open(const char* zipFileName); /* * Find an entry, by name. Returns the entry identifier, or NULL if * not found. * * If two entries have the same name, one will be chosen at semi-random. */ ZipEntryRO findEntryByName(const char* fileName) const; /* * Return the #of entries in the Zip archive. */ int getNumEntries(void) const { return mNumEntries; } /* * Return the Nth entry. Zip file entries are not stored in sorted * order, and updated entries may appear at the end, so anyone walking * the archive needs to avoid making ordering assumptions. We take * that further by returning the Nth non-empty entry in the hash table * rather than the Nth entry in the archive. * * Valid values are [0..numEntries). * * [This is currently O(n). If it needs to be fast we can allocate an * additional data structure or provide an iterator interface.] */ ZipEntryRO findEntryByIndex(int idx) const; /* * Copy the filename into the supplied buffer. Returns 0 on success, * -1 if "entry" is invalid, or the filename length if it didn't fit. The * length, and the returned string, include the null-termination. */ int getEntryFileName(ZipEntryRO entry, char* buffer, int bufLen) const; /* * Get the vital stats for an entry. Pass in NULL pointers for anything * you don't need. * * "*pOffset" holds the Zip file offset of the entry's data. * * Returns "false" if "entry" is bogus or if the data in the Zip file * appears to be bad. */ bool getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen, size_t* pCompLen, off64_t* pOffset, long* pModWhen, long* pCrc32) const; /* * Create a new FileMap object that maps a subset of the archive. For * an uncompressed entry this effectively provides a pointer to the * actual data, for a compressed entry this provides the input buffer * for inflate(). */ FileMap* createEntryFileMap(ZipEntryRO entry) const; /* * Uncompress the data into a buffer. Depending on the compression * format, this is either an "inflate" operation or a memcpy. * * Use "uncompLen" from getEntryInfo() to determine the required * buffer size. * * Returns "true" on success. */ bool uncompressEntry(ZipEntryRO entry, void* buffer) const; /* * Uncompress the data to an open file descriptor. */ bool uncompressEntry(ZipEntryRO entry, int fd) const; /* Zip compression methods we support */ enum { kCompressStored = 0, // no compression kCompressDeflated = 8, // standard deflate }; /* * Utility function: uncompress deflated data, buffer to buffer. */ static bool inflateBuffer(void* outBuf, const void* inBuf, size_t uncompLen, size_t compLen); /* * Utility function: uncompress deflated data, buffer to fd. */ static bool inflateBuffer(int fd, const void* inBuf, size_t uncompLen, size_t compLen); /* * Utility function to convert ZIP's time format to a timespec struct. */ static inline void zipTimeToTimespec(long when, struct tm* timespec) { const long date = when >> 16; timespec->tm_year = ((date >> 9) & 0x7F) + 80; // Zip is years since 1980 timespec->tm_mon = (date >> 5) & 0x0F; timespec->tm_mday = date & 0x1F; timespec->tm_hour = (when >> 11) & 0x1F; timespec->tm_min = (when >> 5) & 0x3F; timespec->tm_sec = (when & 0x1F) << 1; } /* * Some basic functions for raw data manipulation. "LE" means * Little Endian. */ static inline unsigned short get2LE(const unsigned char* buf) { return buf[0] | (buf[1] << 8); } static inline unsigned long get4LE(const unsigned char* buf) { return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); } private: /* these are private and not defined */ ZipFileRO(const ZipFileRO& src); ZipFileRO& operator=(const ZipFileRO& src); /* locate and parse the central directory */ bool mapCentralDirectory(void); /* parse the archive, prepping internal structures */ bool parseZipArchive(void); /* add a new entry to the hash table */ void addToHash(const char* str, int strLen, unsigned int hash); /* compute string hash code */ static unsigned int computeHash(const char* str, int len); /* convert a ZipEntryRO back to a hash table index */ int entryToIndex(const ZipEntryRO entry) const; /* * One entry in the hash table. */ typedef struct HashEntry { const char* name; unsigned short nameLen; //unsigned int hash; } HashEntry; /* open Zip archive */ int mFd; /* Lock for handling the file descriptor (seeks, etc) */ mutable Mutex mFdLock; /* zip file name */ char* mFileName; /* length of file */ size_t mFileLength; /* mapped file */ FileMap* mDirectoryMap; /* number of entries in the Zip archive */ int mNumEntries; /* CD directory offset in the Zip archive */ off64_t mDirectoryOffset; /* * We know how many entries are in the Zip archive, so we have a * fixed-size hash table. We probe for an empty slot. */ int mHashTableSize; HashEntry* mHashTable; }; }; // namespace android #endif /*__LIBS_ZIPFILERO_H*/ android-audiosystem-1.8+13.10.20130807/include/utils/KeyedVector.h0000644000015700001700000001417512200324306025062 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_KEYED_VECTOR_H #define ANDROID_KEYED_VECTOR_H #include #include #include #include #include #include // --------------------------------------------------------------------------- namespace android { template class KeyedVector { public: typedef KEY key_type; typedef VALUE value_type; inline KeyedVector(); /* * empty the vector */ inline void clear() { mVector.clear(); } /*! * vector stats */ //! returns number of items in the vector inline size_t size() const { return mVector.size(); } //! returns wether or not the vector is empty inline bool isEmpty() const { return mVector.isEmpty(); } //! returns how many items can be stored without reallocating the backing store inline size_t capacity() const { return mVector.capacity(); } //! setst the capacity. capacity can never be reduced less than size() inline ssize_t setCapacity(size_t size) { return mVector.setCapacity(size); } /*! * accessors */ const VALUE& valueFor(const KEY& key) const; const VALUE& valueAt(size_t index) const; const KEY& keyAt(size_t index) const; ssize_t indexOfKey(const KEY& key) const; /*! * modifing the array */ VALUE& editValueFor(const KEY& key); VALUE& editValueAt(size_t index); /*! * add/insert/replace items */ ssize_t add(const KEY& key, const VALUE& item); ssize_t replaceValueFor(const KEY& key, const VALUE& item); ssize_t replaceValueAt(size_t index, const VALUE& item); /*! * remove items */ ssize_t removeItem(const KEY& key); ssize_t removeItemsAt(size_t index, size_t count = 1); private: SortedVector< key_value_pair_t > mVector; }; // --------------------------------------------------------------------------- /** * Variation of KeyedVector that holds a default value to return when * valueFor() is called with a key that doesn't exist. */ template class DefaultKeyedVector : public KeyedVector { public: inline DefaultKeyedVector(const VALUE& defValue = VALUE()); const VALUE& valueFor(const KEY& key) const; private: VALUE mDefault; }; // --------------------------------------------------------------------------- template inline KeyedVector::KeyedVector() { } template inline ssize_t KeyedVector::indexOfKey(const KEY& key) const { return mVector.indexOf( key_value_pair_t(key) ); } template inline const VALUE& KeyedVector::valueFor(const KEY& key) const { ssize_t i = indexOfKey(key); assert(i>=0); return mVector.itemAt(i).value; } template inline const VALUE& KeyedVector::valueAt(size_t index) const { return mVector.itemAt(index).value; } template inline const KEY& KeyedVector::keyAt(size_t index) const { return mVector.itemAt(index).key; } template inline VALUE& KeyedVector::editValueFor(const KEY& key) { ssize_t i = indexOfKey(key); assert(i>=0); return mVector.editItemAt(i).value; } template inline VALUE& KeyedVector::editValueAt(size_t index) { return mVector.editItemAt(index).value; } template inline ssize_t KeyedVector::add(const KEY& key, const VALUE& value) { return mVector.add( key_value_pair_t(key, value) ); } template inline ssize_t KeyedVector::replaceValueFor(const KEY& key, const VALUE& value) { key_value_pair_t pair(key, value); mVector.remove(pair); return mVector.add(pair); } template inline ssize_t KeyedVector::replaceValueAt(size_t index, const VALUE& item) { if (index inline ssize_t KeyedVector::removeItem(const KEY& key) { return mVector.remove(key_value_pair_t(key)); } template inline ssize_t KeyedVector::removeItemsAt(size_t index, size_t count) { return mVector.removeItemsAt(index, count); } // --------------------------------------------------------------------------- template inline DefaultKeyedVector::DefaultKeyedVector(const VALUE& defValue) : mDefault(defValue) { } template inline const VALUE& DefaultKeyedVector::valueFor(const KEY& key) const { ssize_t i = this->indexOfKey(key); return i >= 0 ? KeyedVector::valueAt(i) : mDefault; } }; // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_KEYED_VECTOR_H android-audiosystem-1.8+13.10.20130807/include/utils/AssetDir.h0000644000015700001700000001042312200324306024344 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Access a chunk of the asset hierarchy as if it were a single directory. // #ifndef __LIBS_ASSETDIR_H #define __LIBS_ASSETDIR_H #include #include #include #include #include namespace android { /* * This provides vector-style access to a directory. We do this rather * than modeling opendir/readdir access because it's simpler and the * nature of the operation requires us to have all data on hand anyway. * * The list of files will be sorted in ascending order by ASCII value. * * The contents are populated by our friend, the AssetManager. */ class AssetDir { public: AssetDir(void) : mFileInfo(NULL) {} virtual ~AssetDir(void) { delete mFileInfo; } /* * Vector-style access. */ size_t getFileCount(void) { return mFileInfo->size(); } const String8& getFileName(int idx) { return mFileInfo->itemAt(idx).getFileName(); } const String8& getSourceName(int idx) { return mFileInfo->itemAt(idx).getSourceName(); } /* * Get the type of a file (usually regular or directory). */ FileType getFileType(int idx) { return mFileInfo->itemAt(idx).getFileType(); } private: /* these operations are not implemented */ AssetDir(const AssetDir& src); const AssetDir& operator=(const AssetDir& src); friend class AssetManager; /* * This holds information about files in the asset hierarchy. */ class FileInfo { public: FileInfo(void) {} FileInfo(const String8& path) // useful for e.g. svect.indexOf : mFileName(path), mFileType(kFileTypeUnknown) {} ~FileInfo(void) {} FileInfo(const FileInfo& src) { copyMembers(src); } const FileInfo& operator= (const FileInfo& src) { if (this != &src) copyMembers(src); return *this; } void copyMembers(const FileInfo& src) { mFileName = src.mFileName; mFileType = src.mFileType; mSourceName = src.mSourceName; } /* need this for SortedVector; must compare only on file name */ bool operator< (const FileInfo& rhs) const { return mFileName < rhs.mFileName; } /* used by AssetManager */ bool operator== (const FileInfo& rhs) const { return mFileName == rhs.mFileName; } void set(const String8& path, FileType type) { mFileName = path; mFileType = type; } const String8& getFileName(void) const { return mFileName; } void setFileName(const String8& path) { mFileName = path; } FileType getFileType(void) const { return mFileType; } void setFileType(FileType type) { mFileType = type; } const String8& getSourceName(void) const { return mSourceName; } void setSourceName(const String8& path) { mSourceName = path; } /* * Handy utility for finding an entry in a sorted vector of FileInfo. * Returns the index of the matching entry, or -1 if none found. */ static int findEntry(const SortedVector* pVector, const String8& fileName); private: String8 mFileName; // filename only FileType mFileType; // regular, directory, etc String8 mSourceName; // currently debug-only }; /* AssetManager uses this to initialize us */ void setFileList(SortedVector* list) { mFileInfo = list; } SortedVector* mFileInfo; }; }; // namespace android #endif // __LIBS_ASSETDIR_H android-audiosystem-1.8+13.10.20130807/include/utils/LinearTransform.h0000644000015700001700000000363612200324306025744 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _LIBS_UTILS_LINEAR_TRANSFORM_H #define _LIBS_UTILS_LINEAR_TRANSFORM_H #include namespace android { // LinearTransform defines a structure which hold the definition of a // transformation from single dimensional coordinate system A into coordinate // system B (and back again). Values in A and in B are 64 bit, the linear // scale factor is expressed as a rational number using two 32 bit values. // // Specifically, let // f(a) = b // F(b) = f^-1(b) = a // then // // f(a) = (((a - a_zero) * a_to_b_numer) / a_to_b_denom) + b_zero; // // and // // F(b) = (((b - b_zero) * a_to_b_denom) / a_to_b_numer) + a_zero; // struct LinearTransform { int64_t a_zero; int64_t b_zero; int32_t a_to_b_numer; uint32_t a_to_b_denom; // Transform from A->B // Returns true on success, or false in the case of a singularity or an // overflow. bool doForwardTransform(int64_t a_in, int64_t* b_out) const; // Transform from B->A // Returns true on success, or false in the case of a singularity or an // overflow. bool doReverseTransform(int64_t b_in, int64_t* a_out) const; // Helpers which will reduce the fraction N/D using Euclid's method. template static void reduce(T* N, T* D); static void reduce(int32_t* N, uint32_t* D); }; } #endif // _LIBS_UTILS_LINEAR_TRANSFORM_H android-audiosystem-1.8+13.10.20130807/include/utils/Asset.h0000644000015700001700000002373512200324306023717 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Class providing access to a read-only asset. Asset objects are NOT // thread-safe, and should not be shared across threads. // #ifndef __LIBS_ASSET_H #define __LIBS_ASSET_H #include #include #include #include #include #include namespace android { /* * Instances of this class provide read-only operations on a byte stream. * * Access may be optimized for streaming, random, or whole buffer modes. All * operations are supported regardless of how the file was opened, but some * things will be less efficient. [pass that in??] * * "Asset" is the base class for all types of assets. The classes below * provide most of the implementation. The AssetManager uses one of the * static "create" functions defined here to create a new instance. */ class Asset { public: virtual ~Asset(void); static int32_t getGlobalCount(); static String8 getAssetAllocations(); /* used when opening an asset */ typedef enum AccessMode { ACCESS_UNKNOWN = 0, /* read chunks, and seek forward and backward */ ACCESS_RANDOM, /* read sequentially, with an occasional forward seek */ ACCESS_STREAMING, /* caller plans to ask for a read-only buffer with all data */ ACCESS_BUFFER, } AccessMode; /* * Read data from the current offset. Returns the actual number of * bytes read, 0 on EOF, or -1 on error. */ virtual ssize_t read(void* buf, size_t count) = 0; /* * Seek to the specified offset. "whence" uses the same values as * lseek/fseek. Returns the new position on success, or (off64_t) -1 * on failure. */ virtual off64_t seek(off64_t offset, int whence) = 0; /* * Close the asset, freeing all associated resources. */ virtual void close(void) = 0; /* * Get a pointer to a buffer with the entire contents of the file. */ virtual const void* getBuffer(bool wordAligned) = 0; /* * Get the total amount of data that can be read. */ virtual off64_t getLength(void) const = 0; /* * Get the total amount of data that can be read from the current position. */ virtual off64_t getRemainingLength(void) const = 0; /* * Open a new file descriptor that can be used to read this asset. * Returns -1 if you can not use the file descriptor (for example if the * asset is compressed). */ virtual int openFileDescriptor(off64_t* outStart, off64_t* outLength) const = 0; /* * Return whether this asset's buffer is allocated in RAM (not mmapped). * Note: not virtual so it is safe to call even when being destroyed. */ virtual bool isAllocated(void) const { return false; } /* * Get a string identifying the asset's source. This might be a full * path, it might be a colon-separated list of identifiers. * * This is NOT intended to be used for anything except debug output. * DO NOT try to parse this or use it to open a file. */ const char* getAssetSource(void) const { return mAssetSource.string(); } protected: Asset(void); // constructor; only invoked indirectly /* handle common seek() housekeeping */ off64_t handleSeek(off64_t offset, int whence, off64_t curPosn, off64_t maxPosn); /* set the asset source string */ void setAssetSource(const String8& path) { mAssetSource = path; } AccessMode getAccessMode(void) const { return mAccessMode; } private: /* these operations are not implemented */ Asset(const Asset& src); Asset& operator=(const Asset& src); /* AssetManager needs access to our "create" functions */ friend class AssetManager; /* * Create the asset from a named file on disk. */ static Asset* createFromFile(const char* fileName, AccessMode mode); /* * Create the asset from a named, compressed file on disk (e.g. ".gz"). */ static Asset* createFromCompressedFile(const char* fileName, AccessMode mode); #if 0 /* * Create the asset from a segment of an open file. This will fail * if "offset" and "length" don't fit within the bounds of the file. * * The asset takes ownership of the file descriptor. */ static Asset* createFromFileSegment(int fd, off64_t offset, size_t length, AccessMode mode); /* * Create from compressed data. "fd" should be seeked to the start of * the compressed data. This could be inside a gzip file or part of a * Zip archive. * * The asset takes ownership of the file descriptor. * * This may not verify the validity of the compressed data until first * use. */ static Asset* createFromCompressedData(int fd, off64_t offset, int compressionMethod, size_t compressedLength, size_t uncompressedLength, AccessMode mode); #endif /* * Create the asset from a memory-mapped file segment. * * The asset takes ownership of the FileMap. */ static Asset* createFromUncompressedMap(FileMap* dataMap, AccessMode mode); /* * Create the asset from a memory-mapped file segment with compressed * data. "method" is a Zip archive compression method constant. * * The asset takes ownership of the FileMap. */ static Asset* createFromCompressedMap(FileMap* dataMap, int method, size_t uncompressedLen, AccessMode mode); /* * Create from a reference-counted chunk of shared memory. */ // TODO AccessMode mAccessMode; // how the asset was opened String8 mAssetSource; // debug string Asset* mNext; // linked list. Asset* mPrev; }; /* * =========================================================================== * * Innards follow. Do not use these classes directly. */ /* * An asset based on an uncompressed file on disk. It may encompass the * entire file or just a piece of it. Access is through fread/fseek. */ class _FileAsset : public Asset { public: _FileAsset(void); virtual ~_FileAsset(void); /* * Use a piece of an already-open file. * * On success, the object takes ownership of "fd". */ status_t openChunk(const char* fileName, int fd, off64_t offset, size_t length); /* * Use a memory-mapped region. * * On success, the object takes ownership of "dataMap". */ status_t openChunk(FileMap* dataMap); /* * Standard Asset interfaces. */ virtual ssize_t read(void* buf, size_t count); virtual off64_t seek(off64_t offset, int whence); virtual void close(void); virtual const void* getBuffer(bool wordAligned); virtual off64_t getLength(void) const { return mLength; } virtual off64_t getRemainingLength(void) const { return mLength-mOffset; } virtual int openFileDescriptor(off64_t* outStart, off64_t* outLength) const; virtual bool isAllocated(void) const { return mBuf != NULL; } private: off64_t mStart; // absolute file offset of start of chunk off64_t mLength; // length of the chunk off64_t mOffset; // current local offset, 0 == mStart FILE* mFp; // for read/seek char* mFileName; // for opening /* * To support getBuffer() we either need to read the entire thing into * a buffer or memory-map it. For small files it's probably best to * just read them in. */ enum { kReadVsMapThreshold = 4096 }; FileMap* mMap; // for memory map unsigned char* mBuf; // for read const void* ensureAlignment(FileMap* map); }; /* * An asset based on compressed data in a file. */ class _CompressedAsset : public Asset { public: _CompressedAsset(void); virtual ~_CompressedAsset(void); /* * Use a piece of an already-open file. * * On success, the object takes ownership of "fd". */ status_t openChunk(int fd, off64_t offset, int compressionMethod, size_t uncompressedLen, size_t compressedLen); /* * Use a memory-mapped region. * * On success, the object takes ownership of "fd". */ status_t openChunk(FileMap* dataMap, int compressionMethod, size_t uncompressedLen); /* * Standard Asset interfaces. */ virtual ssize_t read(void* buf, size_t count); virtual off64_t seek(off64_t offset, int whence); virtual void close(void); virtual const void* getBuffer(bool wordAligned); virtual off64_t getLength(void) const { return mUncompressedLen; } virtual off64_t getRemainingLength(void) const { return mUncompressedLen-mOffset; } virtual int openFileDescriptor(off64_t* outStart, off64_t* outLength) const { return -1; } virtual bool isAllocated(void) const { return mBuf != NULL; } private: off64_t mStart; // offset to start of compressed data off64_t mCompressedLen; // length of the compressed data off64_t mUncompressedLen; // length of the uncompressed data off64_t mOffset; // current offset, 0 == start of uncomp data FileMap* mMap; // for memory-mapped input int mFd; // for file input class StreamingZipInflater* mZipInflater; // for streaming large compressed assets unsigned char* mBuf; // for getBuffer() }; // need: shared mmap version? }; // namespace android #endif // __LIBS_ASSET_H android-audiosystem-1.8+13.10.20130807/include/utils/Endian.h0000644000015700001700000000201512200324306024022 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Android endian-ness defines. // #ifndef _LIBS_UTILS_ENDIAN_H #define _LIBS_UTILS_ENDIAN_H #if defined(HAVE_ENDIAN_H) #include #else /*not HAVE_ENDIAN_H*/ #define __BIG_ENDIAN 0x1000 #define __LITTLE_ENDIAN 0x0001 #if defined(HAVE_LITTLE_ENDIAN) # define __BYTE_ORDER __LITTLE_ENDIAN #else # define __BYTE_ORDER __BIG_ENDIAN #endif #endif /*not HAVE_ENDIAN_H*/ #endif /*_LIBS_UTILS_ENDIAN_H*/ android-audiosystem-1.8+13.10.20130807/include/utils/Atomic.h0000644000015700001700000000135112200324306024042 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_UTILS_ATOMIC_H #define ANDROID_UTILS_ATOMIC_H #include #endif // ANDROID_UTILS_ATOMIC_H android-audiosystem-1.8+13.10.20130807/include/utils/ResourceTypes.h0000644000015700001700000022673612200324306025462 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Definitions of resource data structures. // #ifndef _LIBS_UTILS_RESOURCE_TYPES_H #define _LIBS_UTILS_RESOURCE_TYPES_H #include #include #include #include #include #include #include #include #include namespace android { /** ******************************************************************** * PNG Extensions * * New private chunks that may be placed in PNG images. * *********************************************************************** */ /** * This chunk specifies how to split an image into segments for * scaling. * * There are J horizontal and K vertical segments. These segments divide * the image into J*K regions as follows (where J=4 and K=3): * * F0 S0 F1 S1 * +-----+----+------+-------+ * S2| 0 | 1 | 2 | 3 | * +-----+----+------+-------+ * | | | | | * | | | | | * F2| 4 | 5 | 6 | 7 | * | | | | | * | | | | | * +-----+----+------+-------+ * S3| 8 | 9 | 10 | 11 | * +-----+----+------+-------+ * * Each horizontal and vertical segment is considered to by either * stretchable (marked by the Sx labels) or fixed (marked by the Fy * labels), in the horizontal or vertical axis, respectively. In the * above example, the first is horizontal segment (F0) is fixed, the * next is stretchable and then they continue to alternate. Note that * the segment list for each axis can begin or end with a stretchable * or fixed segment. * * The relative sizes of the stretchy segments indicates the relative * amount of stretchiness of the regions bordered by the segments. For * example, regions 3, 7 and 11 above will take up more horizontal space * than regions 1, 5 and 9 since the horizontal segment associated with * the first set of regions is larger than the other set of regions. The * ratios of the amount of horizontal (or vertical) space taken by any * two stretchable slices is exactly the ratio of their corresponding * segment lengths. * * xDivs and yDivs point to arrays of horizontal and vertical pixel * indices. The first pair of Divs (in either array) indicate the * starting and ending points of the first stretchable segment in that * axis. The next pair specifies the next stretchable segment, etc. So * in the above example xDiv[0] and xDiv[1] specify the horizontal * coordinates for the regions labeled 1, 5 and 9. xDiv[2] and * xDiv[3] specify the coordinates for regions 3, 7 and 11. Note that * the leftmost slices always start at x=0 and the rightmost slices * always end at the end of the image. So, for example, the regions 0, * 4 and 8 (which are fixed along the X axis) start at x value 0 and * go to xDiv[0] and slices 2, 6 and 10 start at xDiv[1] and end at * xDiv[2]. * * The array pointed to by the colors field lists contains hints for * each of the regions. They are ordered according left-to-right and * top-to-bottom as indicated above. For each segment that is a solid * color the array entry will contain that color value; otherwise it * will contain NO_COLOR. Segments that are completely transparent * will always have the value TRANSPARENT_COLOR. * * The PNG chunk type is "npTc". */ struct Res_png_9patch { Res_png_9patch() : wasDeserialized(false), xDivs(NULL), yDivs(NULL), colors(NULL) { } int8_t wasDeserialized; int8_t numXDivs; int8_t numYDivs; int8_t numColors; // These tell where the next section of a patch starts. // For example, the first patch includes the pixels from // 0 to xDivs[0]-1 and the second patch includes the pixels // from xDivs[0] to xDivs[1]-1. // Note: allocation/free of these pointers is left to the caller. int32_t* xDivs; int32_t* yDivs; int32_t paddingLeft, paddingRight; int32_t paddingTop, paddingBottom; enum { // The 9 patch segment is not a solid color. NO_COLOR = 0x00000001, // The 9 patch segment is completely transparent. TRANSPARENT_COLOR = 0x00000000 }; // Note: allocation/free of this pointer is left to the caller. uint32_t* colors; // Convert data from device representation to PNG file representation. void deviceToFile(); // Convert data from PNG file representation to device representation. void fileToDevice(); // Serialize/Marshall the patch data into a newly malloc-ed block void* serialize(); // Serialize/Marshall the patch data void serialize(void* outData); // Deserialize/Unmarshall the patch data static Res_png_9patch* deserialize(const void* data); // Compute the size of the serialized data structure size_t serializedSize(); }; /** ******************************************************************** * Base Types * * These are standard types that are shared between multiple specific * resource types. * *********************************************************************** */ /** * Header that appears at the front of every data chunk in a resource. */ struct ResChunk_header { // Type identifier for this chunk. The meaning of this value depends // on the containing chunk. uint16_t type; // Size of the chunk header (in bytes). Adding this value to // the address of the chunk allows you to find its associated data // (if any). uint16_t headerSize; // Total size of this chunk (in bytes). This is the chunkSize plus // the size of any data associated with the chunk. Adding this value // to the chunk allows you to completely skip its contents (including // any child chunks). If this value is the same as chunkSize, there is // no data associated with the chunk. uint32_t size; }; enum { RES_NULL_TYPE = 0x0000, RES_STRING_POOL_TYPE = 0x0001, RES_TABLE_TYPE = 0x0002, RES_XML_TYPE = 0x0003, // Chunk types in RES_XML_TYPE RES_XML_FIRST_CHUNK_TYPE = 0x0100, RES_XML_START_NAMESPACE_TYPE= 0x0100, RES_XML_END_NAMESPACE_TYPE = 0x0101, RES_XML_START_ELEMENT_TYPE = 0x0102, RES_XML_END_ELEMENT_TYPE = 0x0103, RES_XML_CDATA_TYPE = 0x0104, RES_XML_LAST_CHUNK_TYPE = 0x017f, // This contains a uint32_t array mapping strings in the string // pool back to resource identifiers. It is optional. RES_XML_RESOURCE_MAP_TYPE = 0x0180, // Chunk types in RES_TABLE_TYPE RES_TABLE_PACKAGE_TYPE = 0x0200, RES_TABLE_TYPE_TYPE = 0x0201, RES_TABLE_TYPE_SPEC_TYPE = 0x0202 }; /** * Macros for building/splitting resource identifiers. */ #define Res_VALIDID(resid) (resid != 0) #define Res_CHECKID(resid) ((resid&0xFFFF0000) != 0) #define Res_MAKEID(package, type, entry) \ (((package+1)<<24) | (((type+1)&0xFF)<<16) | (entry&0xFFFF)) #define Res_GETPACKAGE(id) ((id>>24)-1) #define Res_GETTYPE(id) (((id>>16)&0xFF)-1) #define Res_GETENTRY(id) (id&0xFFFF) #define Res_INTERNALID(resid) ((resid&0xFFFF0000) != 0 && (resid&0xFF0000) == 0) #define Res_MAKEINTERNAL(entry) (0x01000000 | (entry&0xFFFF)) #define Res_MAKEARRAY(entry) (0x02000000 | (entry&0xFFFF)) #define Res_MAXPACKAGE 255 /** * Representation of a value in a resource, supplying type * information. */ struct Res_value { // Number of bytes in this structure. uint16_t size; // Always set to 0. uint8_t res0; // Type of the data value. enum { // Contains no data. TYPE_NULL = 0x00, // The 'data' holds a ResTable_ref, a reference to another resource // table entry. TYPE_REFERENCE = 0x01, // The 'data' holds an attribute resource identifier. TYPE_ATTRIBUTE = 0x02, // The 'data' holds an index into the containing resource table's // global value string pool. TYPE_STRING = 0x03, // The 'data' holds a single-precision floating point number. TYPE_FLOAT = 0x04, // The 'data' holds a complex number encoding a dimension value, // such as "100in". TYPE_DIMENSION = 0x05, // The 'data' holds a complex number encoding a fraction of a // container. TYPE_FRACTION = 0x06, // Beginning of integer flavors... TYPE_FIRST_INT = 0x10, // The 'data' is a raw integer value of the form n..n. TYPE_INT_DEC = 0x10, // The 'data' is a raw integer value of the form 0xn..n. TYPE_INT_HEX = 0x11, // The 'data' is either 0 or 1, for input "false" or "true" respectively. TYPE_INT_BOOLEAN = 0x12, // Beginning of color integer flavors... TYPE_FIRST_COLOR_INT = 0x1c, // The 'data' is a raw integer value of the form #aarrggbb. TYPE_INT_COLOR_ARGB8 = 0x1c, // The 'data' is a raw integer value of the form #rrggbb. TYPE_INT_COLOR_RGB8 = 0x1d, // The 'data' is a raw integer value of the form #argb. TYPE_INT_COLOR_ARGB4 = 0x1e, // The 'data' is a raw integer value of the form #rgb. TYPE_INT_COLOR_RGB4 = 0x1f, // ...end of integer flavors. TYPE_LAST_COLOR_INT = 0x1f, // ...end of integer flavors. TYPE_LAST_INT = 0x1f }; uint8_t dataType; // Structure of complex data values (TYPE_UNIT and TYPE_FRACTION) enum { // Where the unit type information is. This gives us 16 possible // types, as defined below. COMPLEX_UNIT_SHIFT = 0, COMPLEX_UNIT_MASK = 0xf, // TYPE_DIMENSION: Value is raw pixels. COMPLEX_UNIT_PX = 0, // TYPE_DIMENSION: Value is Device Independent Pixels. COMPLEX_UNIT_DIP = 1, // TYPE_DIMENSION: Value is a Scaled device independent Pixels. COMPLEX_UNIT_SP = 2, // TYPE_DIMENSION: Value is in points. COMPLEX_UNIT_PT = 3, // TYPE_DIMENSION: Value is in inches. COMPLEX_UNIT_IN = 4, // TYPE_DIMENSION: Value is in millimeters. COMPLEX_UNIT_MM = 5, // TYPE_FRACTION: A basic fraction of the overall size. COMPLEX_UNIT_FRACTION = 0, // TYPE_FRACTION: A fraction of the parent size. COMPLEX_UNIT_FRACTION_PARENT = 1, // Where the radix information is, telling where the decimal place // appears in the mantissa. This give us 4 possible fixed point // representations as defined below. COMPLEX_RADIX_SHIFT = 4, COMPLEX_RADIX_MASK = 0x3, // The mantissa is an integral number -- i.e., 0xnnnnnn.0 COMPLEX_RADIX_23p0 = 0, // The mantissa magnitude is 16 bits -- i.e, 0xnnnn.nn COMPLEX_RADIX_16p7 = 1, // The mantissa magnitude is 8 bits -- i.e, 0xnn.nnnn COMPLEX_RADIX_8p15 = 2, // The mantissa magnitude is 0 bits -- i.e, 0x0.nnnnnn COMPLEX_RADIX_0p23 = 3, // Where the actual value is. This gives us 23 bits of // precision. The top bit is the sign. COMPLEX_MANTISSA_SHIFT = 8, COMPLEX_MANTISSA_MASK = 0xffffff }; // The data for this item, as interpreted according to dataType. uint32_t data; void copyFrom_dtoh(const Res_value& src); }; /** * This is a reference to a unique entry (a ResTable_entry structure) * in a resource table. The value is structured as: 0xpptteeee, * where pp is the package index, tt is the type index in that * package, and eeee is the entry index in that type. The package * and type values start at 1 for the first item, to help catch cases * where they have not been supplied. */ struct ResTable_ref { uint32_t ident; }; /** * Reference to a string in a string pool. */ struct ResStringPool_ref { // Index into the string pool table (uint32_t-offset from the indices // immediately after ResStringPool_header) at which to find the location // of the string data in the pool. uint32_t index; }; /** ******************************************************************** * String Pool * * A set of strings that can be references by others through a * ResStringPool_ref. * *********************************************************************** */ /** * Definition for a pool of strings. The data of this chunk is an * array of uint32_t providing indices into the pool, relative to * stringsStart. At stringsStart are all of the UTF-16 strings * concatenated together; each starts with a uint16_t of the string's * length and each ends with a 0x0000 terminator. If a string is > * 32767 characters, the high bit of the length is set meaning to take * those 15 bits as a high word and it will be followed by another * uint16_t containing the low word. * * If styleCount is not zero, then immediately following the array of * uint32_t indices into the string table is another array of indices * into a style table starting at stylesStart. Each entry in the * style table is an array of ResStringPool_span structures. */ struct ResStringPool_header { struct ResChunk_header header; // Number of strings in this pool (number of uint32_t indices that follow // in the data). uint32_t stringCount; // Number of style span arrays in the pool (number of uint32_t indices // follow the string indices). uint32_t styleCount; // Flags. enum { // If set, the string index is sorted by the string values (based // on strcmp16()). SORTED_FLAG = 1<<0, // String pool is encoded in UTF-8 UTF8_FLAG = 1<<8 }; uint32_t flags; // Index from header of the string data. uint32_t stringsStart; // Index from header of the style data. uint32_t stylesStart; }; /** * This structure defines a span of style information associated with * a string in the pool. */ struct ResStringPool_span { enum { END = 0xFFFFFFFF }; // This is the name of the span -- that is, the name of the XML // tag that defined it. The special value END (0xFFFFFFFF) indicates // the end of an array of spans. ResStringPool_ref name; // The range of characters in the string that this span applies to. uint32_t firstChar, lastChar; }; /** * Convenience class for accessing data in a ResStringPool resource. */ class ResStringPool { public: ResStringPool(); ResStringPool(const void* data, size_t size, bool copyData=false); ~ResStringPool(); status_t setTo(const void* data, size_t size, bool copyData=false); status_t getError() const; void uninit(); inline const char16_t* stringAt(const ResStringPool_ref& ref, size_t* outLen) const { return stringAt(ref.index, outLen); } const char16_t* stringAt(size_t idx, size_t* outLen) const; const char* string8At(size_t idx, size_t* outLen) const; const ResStringPool_span* styleAt(const ResStringPool_ref& ref) const; const ResStringPool_span* styleAt(size_t idx) const; ssize_t indexOfString(const char16_t* str, size_t strLen) const; size_t size() const; #ifndef HAVE_ANDROID_OS bool isUTF8() const; #endif private: status_t mError; void* mOwnedData; const ResStringPool_header* mHeader; size_t mSize; mutable Mutex mDecodeLock; const uint32_t* mEntries; const uint32_t* mEntryStyles; const void* mStrings; char16_t** mCache; uint32_t mStringPoolSize; // number of uint16_t const uint32_t* mStyles; uint32_t mStylePoolSize; // number of uint32_t }; /** ******************************************************************** * XML Tree * * Binary representation of an XML document. This is designed to * express everything in an XML document, in a form that is much * easier to parse on the device. * *********************************************************************** */ /** * XML tree header. This appears at the front of an XML tree, * describing its content. It is followed by a flat array of * ResXMLTree_node structures; the hierarchy of the XML document * is described by the occurrance of RES_XML_START_ELEMENT_TYPE * and corresponding RES_XML_END_ELEMENT_TYPE nodes in the array. */ struct ResXMLTree_header { struct ResChunk_header header; }; /** * Basic XML tree node. A single item in the XML document. Extended info * about the node can be found after header.headerSize. */ struct ResXMLTree_node { struct ResChunk_header header; // Line number in original source file at which this element appeared. uint32_t lineNumber; // Optional XML comment that was associated with this element; -1 if none. struct ResStringPool_ref comment; }; /** * Extended XML tree node for CDATA tags -- includes the CDATA string. * Appears header.headerSize bytes after a ResXMLTree_node. */ struct ResXMLTree_cdataExt { // The raw CDATA character data. struct ResStringPool_ref data; // The typed value of the character data if this is a CDATA node. struct Res_value typedData; }; /** * Extended XML tree node for namespace start/end nodes. * Appears header.headerSize bytes after a ResXMLTree_node. */ struct ResXMLTree_namespaceExt { // The prefix of the namespace. struct ResStringPool_ref prefix; // The URI of the namespace. struct ResStringPool_ref uri; }; /** * Extended XML tree node for element start/end nodes. * Appears header.headerSize bytes after a ResXMLTree_node. */ struct ResXMLTree_endElementExt { // String of the full namespace of this element. struct ResStringPool_ref ns; // String name of this node if it is an ELEMENT; the raw // character data if this is a CDATA node. struct ResStringPool_ref name; }; /** * Extended XML tree node for start tags -- includes attribute * information. * Appears header.headerSize bytes after a ResXMLTree_node. */ struct ResXMLTree_attrExt { // String of the full namespace of this element. struct ResStringPool_ref ns; // String name of this node if it is an ELEMENT; the raw // character data if this is a CDATA node. struct ResStringPool_ref name; // Byte offset from the start of this structure where the attributes start. uint16_t attributeStart; // Size of the ResXMLTree_attribute structures that follow. uint16_t attributeSize; // Number of attributes associated with an ELEMENT. These are // available as an array of ResXMLTree_attribute structures // immediately following this node. uint16_t attributeCount; // Index (1-based) of the "id" attribute. 0 if none. uint16_t idIndex; // Index (1-based) of the "class" attribute. 0 if none. uint16_t classIndex; // Index (1-based) of the "style" attribute. 0 if none. uint16_t styleIndex; }; struct ResXMLTree_attribute { // Namespace of this attribute. struct ResStringPool_ref ns; // Name of this attribute. struct ResStringPool_ref name; // The original raw string value of this attribute. struct ResStringPool_ref rawValue; // Processesd typed value of this attribute. struct Res_value typedValue; }; class ResXMLTree; class ResXMLParser { public: ResXMLParser(const ResXMLTree& tree); enum event_code_t { BAD_DOCUMENT = -1, START_DOCUMENT = 0, END_DOCUMENT = 1, FIRST_CHUNK_CODE = RES_XML_FIRST_CHUNK_TYPE, START_NAMESPACE = RES_XML_START_NAMESPACE_TYPE, END_NAMESPACE = RES_XML_END_NAMESPACE_TYPE, START_TAG = RES_XML_START_ELEMENT_TYPE, END_TAG = RES_XML_END_ELEMENT_TYPE, TEXT = RES_XML_CDATA_TYPE }; struct ResXMLPosition { event_code_t eventCode; const ResXMLTree_node* curNode; const void* curExt; }; void restart(); const ResStringPool& getStrings() const; event_code_t getEventType() const; // Note, unlike XmlPullParser, the first call to next() will return // START_TAG of the first element. event_code_t next(); // These are available for all nodes: int32_t getCommentID() const; const uint16_t* getComment(size_t* outLen) const; uint32_t getLineNumber() const; // This is available for TEXT: int32_t getTextID() const; const uint16_t* getText(size_t* outLen) const; ssize_t getTextValue(Res_value* outValue) const; // These are available for START_NAMESPACE and END_NAMESPACE: int32_t getNamespacePrefixID() const; const uint16_t* getNamespacePrefix(size_t* outLen) const; int32_t getNamespaceUriID() const; const uint16_t* getNamespaceUri(size_t* outLen) const; // These are available for START_TAG and END_TAG: int32_t getElementNamespaceID() const; const uint16_t* getElementNamespace(size_t* outLen) const; int32_t getElementNameID() const; const uint16_t* getElementName(size_t* outLen) const; // Remaining methods are for retrieving information about attributes // associated with a START_TAG: size_t getAttributeCount() const; // Returns -1 if no namespace, -2 if idx out of range. int32_t getAttributeNamespaceID(size_t idx) const; const uint16_t* getAttributeNamespace(size_t idx, size_t* outLen) const; int32_t getAttributeNameID(size_t idx) const; const uint16_t* getAttributeName(size_t idx, size_t* outLen) const; uint32_t getAttributeNameResID(size_t idx) const; int32_t getAttributeValueStringID(size_t idx) const; const uint16_t* getAttributeStringValue(size_t idx, size_t* outLen) const; int32_t getAttributeDataType(size_t idx) const; int32_t getAttributeData(size_t idx) const; ssize_t getAttributeValue(size_t idx, Res_value* outValue) const; ssize_t indexOfAttribute(const char* ns, const char* attr) const; ssize_t indexOfAttribute(const char16_t* ns, size_t nsLen, const char16_t* attr, size_t attrLen) const; ssize_t indexOfID() const; ssize_t indexOfClass() const; ssize_t indexOfStyle() const; void getPosition(ResXMLPosition* pos) const; void setPosition(const ResXMLPosition& pos); private: friend class ResXMLTree; event_code_t nextNode(); const ResXMLTree& mTree; event_code_t mEventCode; const ResXMLTree_node* mCurNode; const void* mCurExt; }; /** * Convenience class for accessing data in a ResXMLTree resource. */ class ResXMLTree : public ResXMLParser { public: ResXMLTree(); ResXMLTree(const void* data, size_t size, bool copyData=false); ~ResXMLTree(); status_t setTo(const void* data, size_t size, bool copyData=false); status_t getError() const; void uninit(); private: friend class ResXMLParser; status_t validateNode(const ResXMLTree_node* node) const; status_t mError; void* mOwnedData; const ResXMLTree_header* mHeader; size_t mSize; const uint8_t* mDataEnd; ResStringPool mStrings; const uint32_t* mResIds; size_t mNumResIds; const ResXMLTree_node* mRootNode; const void* mRootExt; event_code_t mRootCode; }; /** ******************************************************************** * RESOURCE TABLE * *********************************************************************** */ /** * Header for a resource table. Its data contains a series of * additional chunks: * * A ResStringPool_header containing all table values. * * One or more ResTable_package chunks. * * Specific entries within a resource table can be uniquely identified * with a single integer as defined by the ResTable_ref structure. */ struct ResTable_header { struct ResChunk_header header; // The number of ResTable_package structures. uint32_t packageCount; }; /** * A collection of resource data types within a package. Followed by * one or more ResTable_type and ResTable_typeSpec structures containing the * entry values for each resource type. */ struct ResTable_package { struct ResChunk_header header; // If this is a base package, its ID. Package IDs start // at 1 (corresponding to the value of the package bits in a // resource identifier). 0 means this is not a base package. uint32_t id; // Actual name of this package, \0-terminated. char16_t name[128]; // Offset to a ResStringPool_header defining the resource // type symbol table. If zero, this package is inheriting from // another base package (overriding specific values in it). uint32_t typeStrings; // Last index into typeStrings that is for public use by others. uint32_t lastPublicType; // Offset to a ResStringPool_header defining the resource // key symbol table. If zero, this package is inheriting from // another base package (overriding specific values in it). uint32_t keyStrings; // Last index into keyStrings that is for public use by others. uint32_t lastPublicKey; }; /** * Describes a particular resource configuration. */ struct ResTable_config { // Number of bytes in this structure. uint32_t size; union { struct { // Mobile country code (from SIM). 0 means "any". uint16_t mcc; // Mobile network code (from SIM). 0 means "any". uint16_t mnc; }; uint32_t imsi; }; union { struct { // \0\0 means "any". Otherwise, en, fr, etc. char language[2]; // \0\0 means "any". Otherwise, US, CA, etc. char country[2]; }; uint32_t locale; }; enum { ORIENTATION_ANY = ACONFIGURATION_ORIENTATION_ANY, ORIENTATION_PORT = ACONFIGURATION_ORIENTATION_PORT, ORIENTATION_LAND = ACONFIGURATION_ORIENTATION_LAND, ORIENTATION_SQUARE = ACONFIGURATION_ORIENTATION_SQUARE, }; enum { TOUCHSCREEN_ANY = ACONFIGURATION_TOUCHSCREEN_ANY, TOUCHSCREEN_NOTOUCH = ACONFIGURATION_TOUCHSCREEN_NOTOUCH, TOUCHSCREEN_STYLUS = ACONFIGURATION_TOUCHSCREEN_STYLUS, TOUCHSCREEN_FINGER = ACONFIGURATION_TOUCHSCREEN_FINGER, }; enum { DENSITY_DEFAULT = ACONFIGURATION_DENSITY_DEFAULT, DENSITY_LOW = ACONFIGURATION_DENSITY_LOW, DENSITY_MEDIUM = ACONFIGURATION_DENSITY_MEDIUM, DENSITY_TV = ACONFIGURATION_DENSITY_TV, DENSITY_HIGH = ACONFIGURATION_DENSITY_HIGH, DENSITY_NONE = ACONFIGURATION_DENSITY_NONE }; union { struct { uint8_t orientation; uint8_t touchscreen; uint16_t density; }; uint32_t screenType; }; enum { KEYBOARD_ANY = ACONFIGURATION_KEYBOARD_ANY, KEYBOARD_NOKEYS = ACONFIGURATION_KEYBOARD_NOKEYS, KEYBOARD_QWERTY = ACONFIGURATION_KEYBOARD_QWERTY, KEYBOARD_12KEY = ACONFIGURATION_KEYBOARD_12KEY, }; enum { NAVIGATION_ANY = ACONFIGURATION_NAVIGATION_ANY, NAVIGATION_NONAV = ACONFIGURATION_NAVIGATION_NONAV, NAVIGATION_DPAD = ACONFIGURATION_NAVIGATION_DPAD, NAVIGATION_TRACKBALL = ACONFIGURATION_NAVIGATION_TRACKBALL, NAVIGATION_WHEEL = ACONFIGURATION_NAVIGATION_WHEEL, }; enum { MASK_KEYSHIDDEN = 0x0003, KEYSHIDDEN_ANY = ACONFIGURATION_KEYSHIDDEN_ANY, KEYSHIDDEN_NO = ACONFIGURATION_KEYSHIDDEN_NO, KEYSHIDDEN_YES = ACONFIGURATION_KEYSHIDDEN_YES, KEYSHIDDEN_SOFT = ACONFIGURATION_KEYSHIDDEN_SOFT, }; enum { MASK_NAVHIDDEN = 0x000c, SHIFT_NAVHIDDEN = 2, NAVHIDDEN_ANY = ACONFIGURATION_NAVHIDDEN_ANY << SHIFT_NAVHIDDEN, NAVHIDDEN_NO = ACONFIGURATION_NAVHIDDEN_NO << SHIFT_NAVHIDDEN, NAVHIDDEN_YES = ACONFIGURATION_NAVHIDDEN_YES << SHIFT_NAVHIDDEN, }; union { struct { uint8_t keyboard; uint8_t navigation; uint8_t inputFlags; uint8_t inputPad0; }; uint32_t input; }; enum { SCREENWIDTH_ANY = 0 }; enum { SCREENHEIGHT_ANY = 0 }; union { struct { uint16_t screenWidth; uint16_t screenHeight; }; uint32_t screenSize; }; enum { SDKVERSION_ANY = 0 }; enum { MINORVERSION_ANY = 0 }; union { struct { uint16_t sdkVersion; // For now minorVersion must always be 0!!! Its meaning // is currently undefined. uint16_t minorVersion; }; uint32_t version; }; enum { // screenLayout bits for screen size class. MASK_SCREENSIZE = 0x0f, SCREENSIZE_ANY = ACONFIGURATION_SCREENSIZE_ANY, SCREENSIZE_SMALL = ACONFIGURATION_SCREENSIZE_SMALL, SCREENSIZE_NORMAL = ACONFIGURATION_SCREENSIZE_NORMAL, SCREENSIZE_LARGE = ACONFIGURATION_SCREENSIZE_LARGE, SCREENSIZE_XLARGE = ACONFIGURATION_SCREENSIZE_XLARGE, // screenLayout bits for wide/long screen variation. MASK_SCREENLONG = 0x30, SHIFT_SCREENLONG = 4, SCREENLONG_ANY = ACONFIGURATION_SCREENLONG_ANY << SHIFT_SCREENLONG, SCREENLONG_NO = ACONFIGURATION_SCREENLONG_NO << SHIFT_SCREENLONG, SCREENLONG_YES = ACONFIGURATION_SCREENLONG_YES << SHIFT_SCREENLONG, }; enum { // uiMode bits for the mode type. MASK_UI_MODE_TYPE = 0x0f, UI_MODE_TYPE_ANY = ACONFIGURATION_UI_MODE_TYPE_ANY, UI_MODE_TYPE_NORMAL = ACONFIGURATION_UI_MODE_TYPE_NORMAL, UI_MODE_TYPE_DESK = ACONFIGURATION_UI_MODE_TYPE_DESK, UI_MODE_TYPE_CAR = ACONFIGURATION_UI_MODE_TYPE_CAR, UI_MODE_TYPE_TELEVISION = ACONFIGURATION_UI_MODE_TYPE_TELEVISION, // uiMode bits for the night switch. MASK_UI_MODE_NIGHT = 0x30, SHIFT_UI_MODE_NIGHT = 4, UI_MODE_NIGHT_ANY = ACONFIGURATION_UI_MODE_NIGHT_ANY << SHIFT_UI_MODE_NIGHT, UI_MODE_NIGHT_NO = ACONFIGURATION_UI_MODE_NIGHT_NO << SHIFT_UI_MODE_NIGHT, UI_MODE_NIGHT_YES = ACONFIGURATION_UI_MODE_NIGHT_YES << SHIFT_UI_MODE_NIGHT, }; union { struct { uint8_t screenLayout; uint8_t uiMode; uint16_t smallestScreenWidthDp; }; uint32_t screenConfig; }; union { struct { uint16_t screenWidthDp; uint16_t screenHeightDp; }; uint32_t screenSizeDp; }; inline void copyFromDeviceNoSwap(const ResTable_config& o) { const size_t size = dtohl(o.size); if (size >= sizeof(ResTable_config)) { *this = o; } else { memcpy(this, &o, size); memset(((uint8_t*)this)+size, 0, sizeof(ResTable_config)-size); } } inline void copyFromDtoH(const ResTable_config& o) { copyFromDeviceNoSwap(o); size = sizeof(ResTable_config); mcc = dtohs(mcc); mnc = dtohs(mnc); density = dtohs(density); screenWidth = dtohs(screenWidth); screenHeight = dtohs(screenHeight); sdkVersion = dtohs(sdkVersion); minorVersion = dtohs(minorVersion); smallestScreenWidthDp = dtohs(smallestScreenWidthDp); screenWidthDp = dtohs(screenWidthDp); screenHeightDp = dtohs(screenHeightDp); } inline void swapHtoD() { size = htodl(size); mcc = htods(mcc); mnc = htods(mnc); density = htods(density); screenWidth = htods(screenWidth); screenHeight = htods(screenHeight); sdkVersion = htods(sdkVersion); minorVersion = htods(minorVersion); smallestScreenWidthDp = htods(smallestScreenWidthDp); screenWidthDp = htods(screenWidthDp); screenHeightDp = htods(screenHeightDp); } inline int compare(const ResTable_config& o) const { int32_t diff = (int32_t)(imsi - o.imsi); if (diff != 0) return diff; diff = (int32_t)(locale - o.locale); if (diff != 0) return diff; diff = (int32_t)(screenType - o.screenType); if (diff != 0) return diff; diff = (int32_t)(input - o.input); if (diff != 0) return diff; diff = (int32_t)(screenSize - o.screenSize); if (diff != 0) return diff; diff = (int32_t)(version - o.version); if (diff != 0) return diff; diff = (int32_t)(screenLayout - o.screenLayout); if (diff != 0) return diff; diff = (int32_t)(uiMode - o.uiMode); if (diff != 0) return diff; diff = (int32_t)(smallestScreenWidthDp - o.smallestScreenWidthDp); if (diff != 0) return diff; diff = (int32_t)(screenSizeDp - o.screenSizeDp); return (int)diff; } // Flags indicating a set of config values. These flag constants must // match the corresponding ones in android.content.pm.ActivityInfo and // attrs_manifest.xml. enum { CONFIG_MCC = ACONFIGURATION_MCC, CONFIG_MNC = ACONFIGURATION_MCC, CONFIG_LOCALE = ACONFIGURATION_LOCALE, CONFIG_TOUCHSCREEN = ACONFIGURATION_TOUCHSCREEN, CONFIG_KEYBOARD = ACONFIGURATION_KEYBOARD, CONFIG_KEYBOARD_HIDDEN = ACONFIGURATION_KEYBOARD_HIDDEN, CONFIG_NAVIGATION = ACONFIGURATION_NAVIGATION, CONFIG_ORIENTATION = ACONFIGURATION_ORIENTATION, CONFIG_DENSITY = ACONFIGURATION_DENSITY, CONFIG_SCREEN_SIZE = ACONFIGURATION_SCREEN_SIZE, CONFIG_SMALLEST_SCREEN_SIZE = ACONFIGURATION_SMALLEST_SCREEN_SIZE, CONFIG_VERSION = ACONFIGURATION_VERSION, CONFIG_SCREEN_LAYOUT = ACONFIGURATION_SCREEN_LAYOUT, CONFIG_UI_MODE = ACONFIGURATION_UI_MODE }; // Compare two configuration, returning CONFIG_* flags set for each value // that is different. inline int diff(const ResTable_config& o) const { int diffs = 0; if (mcc != o.mcc) diffs |= CONFIG_MCC; if (mnc != o.mnc) diffs |= CONFIG_MNC; if (locale != o.locale) diffs |= CONFIG_LOCALE; if (orientation != o.orientation) diffs |= CONFIG_ORIENTATION; if (density != o.density) diffs |= CONFIG_DENSITY; if (touchscreen != o.touchscreen) diffs |= CONFIG_TOUCHSCREEN; if (((inputFlags^o.inputFlags)&(MASK_KEYSHIDDEN|MASK_NAVHIDDEN)) != 0) diffs |= CONFIG_KEYBOARD_HIDDEN; if (keyboard != o.keyboard) diffs |= CONFIG_KEYBOARD; if (navigation != o.navigation) diffs |= CONFIG_NAVIGATION; if (screenSize != o.screenSize) diffs |= CONFIG_SCREEN_SIZE; if (version != o.version) diffs |= CONFIG_VERSION; if (screenLayout != o.screenLayout) diffs |= CONFIG_SCREEN_LAYOUT; if (uiMode != o.uiMode) diffs |= CONFIG_UI_MODE; if (smallestScreenWidthDp != o.smallestScreenWidthDp) diffs |= CONFIG_SMALLEST_SCREEN_SIZE; if (screenSizeDp != o.screenSizeDp) diffs |= CONFIG_SCREEN_SIZE; return diffs; } // Return true if 'this' is more specific than 'o'. inline bool isMoreSpecificThan(const ResTable_config& o) const { // The order of the following tests defines the importance of one // configuration parameter over another. Those tests first are more // important, trumping any values in those following them. if (imsi || o.imsi) { if (mcc != o.mcc) { if (!mcc) return false; if (!o.mcc) return true; } if (mnc != o.mnc) { if (!mnc) return false; if (!o.mnc) return true; } } if (locale || o.locale) { if (language[0] != o.language[0]) { if (!language[0]) return false; if (!o.language[0]) return true; } if (country[0] != o.country[0]) { if (!country[0]) return false; if (!o.country[0]) return true; } } if (smallestScreenWidthDp || o.smallestScreenWidthDp) { if (smallestScreenWidthDp != o.smallestScreenWidthDp) { if (!smallestScreenWidthDp) return false; if (!o.smallestScreenWidthDp) return true; } } if (screenSizeDp || o.screenSizeDp) { if (screenWidthDp != o.screenWidthDp) { if (!screenWidthDp) return false; if (!o.screenWidthDp) return true; } if (screenHeightDp != o.screenHeightDp) { if (!screenHeightDp) return false; if (!o.screenHeightDp) return true; } } if (screenLayout || o.screenLayout) { if (((screenLayout^o.screenLayout) & MASK_SCREENSIZE) != 0) { if (!(screenLayout & MASK_SCREENSIZE)) return false; if (!(o.screenLayout & MASK_SCREENSIZE)) return true; } if (((screenLayout^o.screenLayout) & MASK_SCREENLONG) != 0) { if (!(screenLayout & MASK_SCREENLONG)) return false; if (!(o.screenLayout & MASK_SCREENLONG)) return true; } } if (orientation != o.orientation) { if (!orientation) return false; if (!o.orientation) return true; } if (uiMode || o.uiMode) { if (((uiMode^o.uiMode) & MASK_UI_MODE_TYPE) != 0) { if (!(uiMode & MASK_UI_MODE_TYPE)) return false; if (!(o.uiMode & MASK_UI_MODE_TYPE)) return true; } if (((uiMode^o.uiMode) & MASK_UI_MODE_NIGHT) != 0) { if (!(uiMode & MASK_UI_MODE_NIGHT)) return false; if (!(o.uiMode & MASK_UI_MODE_NIGHT)) return true; } } // density is never 'more specific' // as the default just equals 160 if (touchscreen != o.touchscreen) { if (!touchscreen) return false; if (!o.touchscreen) return true; } if (input || o.input) { if (((inputFlags^o.inputFlags) & MASK_KEYSHIDDEN) != 0) { if (!(inputFlags & MASK_KEYSHIDDEN)) return false; if (!(o.inputFlags & MASK_KEYSHIDDEN)) return true; } if (((inputFlags^o.inputFlags) & MASK_NAVHIDDEN) != 0) { if (!(inputFlags & MASK_NAVHIDDEN)) return false; if (!(o.inputFlags & MASK_NAVHIDDEN)) return true; } if (keyboard != o.keyboard) { if (!keyboard) return false; if (!o.keyboard) return true; } if (navigation != o.navigation) { if (!navigation) return false; if (!o.navigation) return true; } } if (screenSize || o.screenSize) { if (screenWidth != o.screenWidth) { if (!screenWidth) return false; if (!o.screenWidth) return true; } if (screenHeight != o.screenHeight) { if (!screenHeight) return false; if (!o.screenHeight) return true; } } if (version || o.version) { if (sdkVersion != o.sdkVersion) { if (!sdkVersion) return false; if (!o.sdkVersion) return true; } if (minorVersion != o.minorVersion) { if (!minorVersion) return false; if (!o.minorVersion) return true; } } return false; } // Return true if 'this' is a better match than 'o' for the 'requested' // configuration. This assumes that match() has already been used to // remove any configurations that don't match the requested configuration // at all; if they are not first filtered, non-matching results can be // considered better than matching ones. // The general rule per attribute: if the request cares about an attribute // (it normally does), if the two (this and o) are equal it's a tie. If // they are not equal then one must be generic because only generic and // '==requested' will pass the match() call. So if this is not generic, // it wins. If this IS generic, o wins (return false). inline bool isBetterThan(const ResTable_config& o, const ResTable_config* requested) const { if (requested) { if (imsi || o.imsi) { if ((mcc != o.mcc) && requested->mcc) { return (mcc); } if ((mnc != o.mnc) && requested->mnc) { return (mnc); } } if (locale || o.locale) { if ((language[0] != o.language[0]) && requested->language[0]) { return (language[0]); } if ((country[0] != o.country[0]) && requested->country[0]) { return (country[0]); } } if (smallestScreenWidthDp || o.smallestScreenWidthDp) { // The configuration closest to the actual size is best. // We assume that larger configs have already been filtered // out at this point. That means we just want the largest one. return smallestScreenWidthDp >= o.smallestScreenWidthDp; } if (screenSizeDp || o.screenSizeDp) { // "Better" is based on the sum of the difference between both // width and height from the requested dimensions. We are // assuming the invalid configs (with smaller dimens) have // already been filtered. Note that if a particular dimension // is unspecified, we will end up with a large value (the // difference between 0 and the requested dimension), which is // good since we will prefer a config that has specified a // dimension value. int myDelta = 0, otherDelta = 0; if (requested->screenWidthDp) { myDelta += requested->screenWidthDp - screenWidthDp; otherDelta += requested->screenWidthDp - o.screenWidthDp; } if (requested->screenHeightDp) { myDelta += requested->screenHeightDp - screenHeightDp; otherDelta += requested->screenHeightDp - o.screenHeightDp; } //ALOGI("Comparing this %dx%d to other %dx%d in %dx%d: myDelta=%d otherDelta=%d", // screenWidthDp, screenHeightDp, o.screenWidthDp, o.screenHeightDp, // requested->screenWidthDp, requested->screenHeightDp, myDelta, otherDelta); return (myDelta <= otherDelta); } if (screenLayout || o.screenLayout) { if (((screenLayout^o.screenLayout) & MASK_SCREENSIZE) != 0 && (requested->screenLayout & MASK_SCREENSIZE)) { // A little backwards compatibility here: undefined is // considered equivalent to normal. But only if the // requested size is at least normal; otherwise, small // is better than the default. int mySL = (screenLayout & MASK_SCREENSIZE); int oSL = (o.screenLayout & MASK_SCREENSIZE); int fixedMySL = mySL; int fixedOSL = oSL; if ((requested->screenLayout & MASK_SCREENSIZE) >= SCREENSIZE_NORMAL) { if (fixedMySL == 0) fixedMySL = SCREENSIZE_NORMAL; if (fixedOSL == 0) fixedOSL = SCREENSIZE_NORMAL; } // For screen size, the best match is the one that is // closest to the requested screen size, but not over // (the not over part is dealt with in match() below). if (fixedMySL == fixedOSL) { // If the two are the same, but 'this' is actually // undefined, then the other is really a better match. if (mySL == 0) return false; return true; } return fixedMySL >= fixedOSL; } if (((screenLayout^o.screenLayout) & MASK_SCREENLONG) != 0 && (requested->screenLayout & MASK_SCREENLONG)) { return (screenLayout & MASK_SCREENLONG); } } if ((orientation != o.orientation) && requested->orientation) { return (orientation); } if (uiMode || o.uiMode) { if (((uiMode^o.uiMode) & MASK_UI_MODE_TYPE) != 0 && (requested->uiMode & MASK_UI_MODE_TYPE)) { return (uiMode & MASK_UI_MODE_TYPE); } if (((uiMode^o.uiMode) & MASK_UI_MODE_NIGHT) != 0 && (requested->uiMode & MASK_UI_MODE_NIGHT)) { return (uiMode & MASK_UI_MODE_NIGHT); } } if (screenType || o.screenType) { if (density != o.density) { // density is tough. Any density is potentially useful // because the system will scale it. Scaling down // is generally better than scaling up. // Default density counts as 160dpi (the system default) // TODO - remove 160 constants int h = (density?density:160); int l = (o.density?o.density:160); bool bImBigger = true; if (l > h) { int t = h; h = l; l = t; bImBigger = false; } int reqValue = (requested->density?requested->density:160); if (reqValue >= h) { // requested value higher than both l and h, give h return bImBigger; } if (l >= reqValue) { // requested value lower than both l and h, give l return !bImBigger; } // saying that scaling down is 2x better than up if (((2 * l) - reqValue) * h > reqValue * reqValue) { return !bImBigger; } else { return bImBigger; } } if ((touchscreen != o.touchscreen) && requested->touchscreen) { return (touchscreen); } } if (input || o.input) { const int keysHidden = inputFlags & MASK_KEYSHIDDEN; const int oKeysHidden = o.inputFlags & MASK_KEYSHIDDEN; if (keysHidden != oKeysHidden) { const int reqKeysHidden = requested->inputFlags & MASK_KEYSHIDDEN; if (reqKeysHidden) { if (!keysHidden) return false; if (!oKeysHidden) return true; // For compatibility, we count KEYSHIDDEN_NO as being // the same as KEYSHIDDEN_SOFT. Here we disambiguate // these by making an exact match more specific. if (reqKeysHidden == keysHidden) return true; if (reqKeysHidden == oKeysHidden) return false; } } const int navHidden = inputFlags & MASK_NAVHIDDEN; const int oNavHidden = o.inputFlags & MASK_NAVHIDDEN; if (navHidden != oNavHidden) { const int reqNavHidden = requested->inputFlags & MASK_NAVHIDDEN; if (reqNavHidden) { if (!navHidden) return false; if (!oNavHidden) return true; } } if ((keyboard != o.keyboard) && requested->keyboard) { return (keyboard); } if ((navigation != o.navigation) && requested->navigation) { return (navigation); } } if (screenSize || o.screenSize) { // "Better" is based on the sum of the difference between both // width and height from the requested dimensions. We are // assuming the invalid configs (with smaller sizes) have // already been filtered. Note that if a particular dimension // is unspecified, we will end up with a large value (the // difference between 0 and the requested dimension), which is // good since we will prefer a config that has specified a // size value. int myDelta = 0, otherDelta = 0; if (requested->screenWidth) { myDelta += requested->screenWidth - screenWidth; otherDelta += requested->screenWidth - o.screenWidth; } if (requested->screenHeight) { myDelta += requested->screenHeight - screenHeight; otherDelta += requested->screenHeight - o.screenHeight; } return (myDelta <= otherDelta); } if (version || o.version) { if ((sdkVersion != o.sdkVersion) && requested->sdkVersion) { return (sdkVersion > o.sdkVersion); } if ((minorVersion != o.minorVersion) && requested->minorVersion) { return (minorVersion); } } return false; } return isMoreSpecificThan(o); } // Return true if 'this' can be considered a match for the parameters in // 'settings'. // Note this is asymetric. A default piece of data will match every request // but a request for the default should not match odd specifics // (ie, request with no mcc should not match a particular mcc's data) // settings is the requested settings inline bool match(const ResTable_config& settings) const { if (imsi != 0) { if (mcc != 0 && mcc != settings.mcc) { return false; } if (mnc != 0 && mnc != settings.mnc) { return false; } } if (locale != 0) { if (language[0] != 0 && (language[0] != settings.language[0] || language[1] != settings.language[1])) { return false; } if (country[0] != 0 && (country[0] != settings.country[0] || country[1] != settings.country[1])) { return false; } } if (screenConfig != 0) { const int screenSize = screenLayout&MASK_SCREENSIZE; const int setScreenSize = settings.screenLayout&MASK_SCREENSIZE; // Any screen sizes for larger screens than the setting do not // match. if (screenSize != 0 && screenSize > setScreenSize) { return false; } const int screenLong = screenLayout&MASK_SCREENLONG; const int setScreenLong = settings.screenLayout&MASK_SCREENLONG; if (screenLong != 0 && screenLong != setScreenLong) { return false; } const int uiModeType = uiMode&MASK_UI_MODE_TYPE; const int setUiModeType = settings.uiMode&MASK_UI_MODE_TYPE; if (uiModeType != 0 && uiModeType != setUiModeType) { return false; } const int uiModeNight = uiMode&MASK_UI_MODE_NIGHT; const int setUiModeNight = settings.uiMode&MASK_UI_MODE_NIGHT; if (uiModeNight != 0 && uiModeNight != setUiModeNight) { return false; } if (smallestScreenWidthDp != 0 && smallestScreenWidthDp > settings.smallestScreenWidthDp) { return false; } } if (screenSizeDp != 0) { if (screenWidthDp != 0 && screenWidthDp > settings.screenWidthDp) { //ALOGI("Filtering out width %d in requested %d", screenWidthDp, settings.screenWidthDp); return false; } if (screenHeightDp != 0 && screenHeightDp > settings.screenHeightDp) { //ALOGI("Filtering out height %d in requested %d", screenHeightDp, settings.screenHeightDp); return false; } } if (screenType != 0) { if (orientation != 0 && orientation != settings.orientation) { return false; } // density always matches - we can scale it. See isBetterThan if (touchscreen != 0 && touchscreen != settings.touchscreen) { return false; } } if (input != 0) { const int keysHidden = inputFlags&MASK_KEYSHIDDEN; const int setKeysHidden = settings.inputFlags&MASK_KEYSHIDDEN; if (keysHidden != 0 && keysHidden != setKeysHidden) { // For compatibility, we count a request for KEYSHIDDEN_NO as also // matching the more recent KEYSHIDDEN_SOFT. Basically // KEYSHIDDEN_NO means there is some kind of keyboard available. //ALOGI("Matching keysHidden: have=%d, config=%d\n", keysHidden, setKeysHidden); if (keysHidden != KEYSHIDDEN_NO || setKeysHidden != KEYSHIDDEN_SOFT) { //ALOGI("No match!"); return false; } } const int navHidden = inputFlags&MASK_NAVHIDDEN; const int setNavHidden = settings.inputFlags&MASK_NAVHIDDEN; if (navHidden != 0 && navHidden != setNavHidden) { return false; } if (keyboard != 0 && keyboard != settings.keyboard) { return false; } if (navigation != 0 && navigation != settings.navigation) { return false; } } if (screenSize != 0) { if (screenWidth != 0 && screenWidth > settings.screenWidth) { return false; } if (screenHeight != 0 && screenHeight > settings.screenHeight) { return false; } } if (version != 0) { if (sdkVersion != 0 && sdkVersion > settings.sdkVersion) { return false; } if (minorVersion != 0 && minorVersion != settings.minorVersion) { return false; } } return true; } void getLocale(char str[6]) const { memset(str, 0, 6); if (language[0]) { str[0] = language[0]; str[1] = language[1]; if (country[0]) { str[2] = '_'; str[3] = country[0]; str[4] = country[1]; } } } String8 toString() const { char buf[200]; sprintf(buf, "imsi=%d/%d lang=%c%c reg=%c%c orient=%d touch=%d dens=%d " "kbd=%d nav=%d input=%d ssz=%dx%d sw%ddp w%ddp h%ddp sz=%d long=%d " "ui=%d night=%d vers=%d.%d", mcc, mnc, language[0] ? language[0] : '-', language[1] ? language[1] : '-', country[0] ? country[0] : '-', country[1] ? country[1] : '-', orientation, touchscreen, density, keyboard, navigation, inputFlags, screenWidth, screenHeight, smallestScreenWidthDp, screenWidthDp, screenHeightDp, screenLayout&MASK_SCREENSIZE, screenLayout&MASK_SCREENLONG, uiMode&MASK_UI_MODE_TYPE, uiMode&MASK_UI_MODE_NIGHT, sdkVersion, minorVersion); return String8(buf); } }; /** * A specification of the resources defined by a particular type. * * There should be one of these chunks for each resource type. * * This structure is followed by an array of integers providing the set of * configuation change flags (ResTable_config::CONFIG_*) that have multiple * resources for that configuration. In addition, the high bit is set if that * resource has been made public. */ struct ResTable_typeSpec { struct ResChunk_header header; // The type identifier this chunk is holding. Type IDs start // at 1 (corresponding to the value of the type bits in a // resource identifier). 0 is invalid. uint8_t id; // Must be 0. uint8_t res0; // Must be 0. uint16_t res1; // Number of uint32_t entry configuration masks that follow. uint32_t entryCount; enum { // Additional flag indicating an entry is public. SPEC_PUBLIC = 0x40000000 }; }; /** * A collection of resource entries for a particular resource data * type. Followed by an array of uint32_t defining the resource * values, corresponding to the array of type strings in the * ResTable_package::typeStrings string block. Each of these hold an * index from entriesStart; a value of NO_ENTRY means that entry is * not defined. * * There may be multiple of these chunks for a particular resource type, * supply different configuration variations for the resource values of * that type. * * It would be nice to have an additional ordered index of entries, so * we can do a binary search if trying to find a resource by string name. */ struct ResTable_type { struct ResChunk_header header; enum { NO_ENTRY = 0xFFFFFFFF }; // The type identifier this chunk is holding. Type IDs start // at 1 (corresponding to the value of the type bits in a // resource identifier). 0 is invalid. uint8_t id; // Must be 0. uint8_t res0; // Must be 0. uint16_t res1; // Number of uint32_t entry indices that follow. uint32_t entryCount; // Offset from header where ResTable_entry data starts. uint32_t entriesStart; // Configuration this collection of entries is designed for. ResTable_config config; }; /** * This is the beginning of information about an entry in the resource * table. It holds the reference to the name of this entry, and is * immediately followed by one of: * * A Res_value structure, if FLAG_COMPLEX is -not- set. * * An array of ResTable_map structures, if FLAG_COMPLEX is set. * These supply a set of name/value mappings of data. */ struct ResTable_entry { // Number of bytes in this structure. uint16_t size; enum { // If set, this is a complex entry, holding a set of name/value // mappings. It is followed by an array of ResTable_map structures. FLAG_COMPLEX = 0x0001, // If set, this resource has been declared public, so libraries // are allowed to reference it. FLAG_PUBLIC = 0x0002 }; uint16_t flags; // Reference into ResTable_package::keyStrings identifying this entry. struct ResStringPool_ref key; }; /** * Extended form of a ResTable_entry for map entries, defining a parent map * resource from which to inherit values. */ struct ResTable_map_entry : public ResTable_entry { // Resource identifier of the parent mapping, or 0 if there is none. ResTable_ref parent; // Number of name/value pairs that follow for FLAG_COMPLEX. uint32_t count; }; /** * A single name/value mapping that is part of a complex resource * entry. */ struct ResTable_map { // The resource identifier defining this mapping's name. For attribute // resources, 'name' can be one of the following special resource types // to supply meta-data about the attribute; for all other resource types // it must be an attribute resource. ResTable_ref name; // Special values for 'name' when defining attribute resources. enum { // This entry holds the attribute's type code. ATTR_TYPE = Res_MAKEINTERNAL(0), // For integral attributes, this is the minimum value it can hold. ATTR_MIN = Res_MAKEINTERNAL(1), // For integral attributes, this is the maximum value it can hold. ATTR_MAX = Res_MAKEINTERNAL(2), // Localization of this resource is can be encouraged or required with // an aapt flag if this is set ATTR_L10N = Res_MAKEINTERNAL(3), // for plural support, see android.content.res.PluralRules#attrForQuantity(int) ATTR_OTHER = Res_MAKEINTERNAL(4), ATTR_ZERO = Res_MAKEINTERNAL(5), ATTR_ONE = Res_MAKEINTERNAL(6), ATTR_TWO = Res_MAKEINTERNAL(7), ATTR_FEW = Res_MAKEINTERNAL(8), ATTR_MANY = Res_MAKEINTERNAL(9) }; // Bit mask of allowed types, for use with ATTR_TYPE. enum { // No type has been defined for this attribute, use generic // type handling. The low 16 bits are for types that can be // handled generically; the upper 16 require additional information // in the bag so can not be handled generically for TYPE_ANY. TYPE_ANY = 0x0000FFFF, // Attribute holds a references to another resource. TYPE_REFERENCE = 1<<0, // Attribute holds a generic string. TYPE_STRING = 1<<1, // Attribute holds an integer value. ATTR_MIN and ATTR_MIN can // optionally specify a constrained range of possible integer values. TYPE_INTEGER = 1<<2, // Attribute holds a boolean integer. TYPE_BOOLEAN = 1<<3, // Attribute holds a color value. TYPE_COLOR = 1<<4, // Attribute holds a floating point value. TYPE_FLOAT = 1<<5, // Attribute holds a dimension value, such as "20px". TYPE_DIMENSION = 1<<6, // Attribute holds a fraction value, such as "20%". TYPE_FRACTION = 1<<7, // Attribute holds an enumeration. The enumeration values are // supplied as additional entries in the map. TYPE_ENUM = 1<<16, // Attribute holds a bitmaks of flags. The flag bit values are // supplied as additional entries in the map. TYPE_FLAGS = 1<<17 }; // Enum of localization modes, for use with ATTR_L10N. enum { L10N_NOT_REQUIRED = 0, L10N_SUGGESTED = 1 }; // This mapping's value. Res_value value; }; /** * Convenience class for accessing data in a ResTable resource. */ class ResTable { public: ResTable(); ResTable(const void* data, size_t size, void* cookie, bool copyData=false); ~ResTable(); status_t add(const void* data, size_t size, void* cookie, bool copyData=false, const void* idmap = NULL); status_t add(Asset* asset, void* cookie, bool copyData=false, const void* idmap = NULL); status_t add(ResTable* src); status_t getError() const; void uninit(); struct resource_name { const char16_t* package; size_t packageLen; const char16_t* type; size_t typeLen; const char16_t* name; size_t nameLen; }; bool getResourceName(uint32_t resID, resource_name* outName) const; /** * Retrieve the value of a resource. If the resource is found, returns a * value >= 0 indicating the table it is in (for use with * getTableStringBlock() and getTableCookie()) and fills in 'outValue'. If * not found, returns a negative error code. * * Note that this function does not do reference traversal. If you want * to follow references to other resources to get the "real" value to * use, you need to call resolveReference() after this function. * * @param resID The desired resoruce identifier. * @param outValue Filled in with the resource data that was found. * * @return ssize_t Either a >= 0 table index or a negative error code. */ ssize_t getResource(uint32_t resID, Res_value* outValue, bool mayBeBag = false, uint16_t density = 0, uint32_t* outSpecFlags = NULL, ResTable_config* outConfig = NULL) const; inline ssize_t getResource(const ResTable_ref& res, Res_value* outValue, uint32_t* outSpecFlags=NULL) const { return getResource(res.ident, outValue, false, 0, outSpecFlags, NULL); } ssize_t resolveReference(Res_value* inOutValue, ssize_t blockIndex, uint32_t* outLastRef = NULL, uint32_t* inoutTypeSpecFlags = NULL, ResTable_config* outConfig = NULL) const; enum { TMP_BUFFER_SIZE = 16 }; const char16_t* valueToString(const Res_value* value, size_t stringBlock, char16_t tmpBuffer[TMP_BUFFER_SIZE], size_t* outLen); struct bag_entry { ssize_t stringBlock; ResTable_map map; }; /** * Retrieve the bag of a resource. If the resoruce is found, returns the * number of bags it contains and 'outBag' points to an array of their * values. If not found, a negative error code is returned. * * Note that this function -does- do reference traversal of the bag data. * * @param resID The desired resource identifier. * @param outBag Filled inm with a pointer to the bag mappings. * * @return ssize_t Either a >= 0 bag count of negative error code. */ ssize_t lockBag(uint32_t resID, const bag_entry** outBag) const; void unlockBag(const bag_entry* bag) const; void lock() const; ssize_t getBagLocked(uint32_t resID, const bag_entry** outBag, uint32_t* outTypeSpecFlags=NULL) const; void unlock() const; class Theme { public: Theme(const ResTable& table); ~Theme(); inline const ResTable& getResTable() const { return mTable; } status_t applyStyle(uint32_t resID, bool force=false); status_t setTo(const Theme& other); /** * Retrieve a value in the theme. If the theme defines this * value, returns a value >= 0 indicating the table it is in * (for use with getTableStringBlock() and getTableCookie) and * fills in 'outValue'. If not found, returns a negative error * code. * * Note that this function does not do reference traversal. If you want * to follow references to other resources to get the "real" value to * use, you need to call resolveReference() after this function. * * @param resID A resource identifier naming the desired theme * attribute. * @param outValue Filled in with the theme value that was * found. * * @return ssize_t Either a >= 0 table index or a negative error code. */ ssize_t getAttribute(uint32_t resID, Res_value* outValue, uint32_t* outTypeSpecFlags = NULL) const; /** * This is like ResTable::resolveReference(), but also takes * care of resolving attribute references to the theme. */ ssize_t resolveAttributeReference(Res_value* inOutValue, ssize_t blockIndex, uint32_t* outLastRef = NULL, uint32_t* inoutTypeSpecFlags = NULL, ResTable_config* inoutConfig = NULL) const; void dumpToLog() const; private: Theme(const Theme&); Theme& operator=(const Theme&); struct theme_entry { ssize_t stringBlock; uint32_t typeSpecFlags; Res_value value; }; struct type_info { size_t numEntries; theme_entry* entries; }; struct package_info { size_t numTypes; type_info types[]; }; void free_package(package_info* pi); package_info* copy_package(package_info* pi); const ResTable& mTable; package_info* mPackages[Res_MAXPACKAGE]; }; void setParameters(const ResTable_config* params); void getParameters(ResTable_config* params) const; // Retrieve an identifier (which can be passed to getResource) // for a given resource name. The 'name' can be fully qualified // (:.) or the package or type components // can be dropped if default values are supplied here. // // Returns 0 if no such resource was found, else a valid resource ID. uint32_t identifierForName(const char16_t* name, size_t nameLen, const char16_t* type = 0, size_t typeLen = 0, const char16_t* defPackage = 0, size_t defPackageLen = 0, uint32_t* outTypeSpecFlags = NULL) const; static bool expandResourceRef(const uint16_t* refStr, size_t refLen, String16* outPackage, String16* outType, String16* outName, const String16* defType = NULL, const String16* defPackage = NULL, const char** outErrorMsg = NULL, bool* outPublicOnly = NULL); static bool stringToInt(const char16_t* s, size_t len, Res_value* outValue); static bool stringToFloat(const char16_t* s, size_t len, Res_value* outValue); // Used with stringToValue. class Accessor { public: inline virtual ~Accessor() { } virtual uint32_t getCustomResource(const String16& package, const String16& type, const String16& name) const = 0; virtual uint32_t getCustomResourceWithCreation(const String16& package, const String16& type, const String16& name, const bool createIfNeeded = false) = 0; virtual uint32_t getRemappedPackage(uint32_t origPackage) const = 0; virtual bool getAttributeType(uint32_t attrID, uint32_t* outType) = 0; virtual bool getAttributeMin(uint32_t attrID, uint32_t* outMin) = 0; virtual bool getAttributeMax(uint32_t attrID, uint32_t* outMax) = 0; virtual bool getAttributeEnum(uint32_t attrID, const char16_t* name, size_t nameLen, Res_value* outValue) = 0; virtual bool getAttributeFlags(uint32_t attrID, const char16_t* name, size_t nameLen, Res_value* outValue) = 0; virtual uint32_t getAttributeL10N(uint32_t attrID) = 0; virtual bool getLocalizationSetting() = 0; virtual void reportError(void* accessorCookie, const char* fmt, ...) = 0; }; // Convert a string to a resource value. Handles standard "@res", // "#color", "123", and "0x1bd" types; performs escaping of strings. // The resulting value is placed in 'outValue'; if it is a string type, // 'outString' receives the string. If 'attrID' is supplied, the value is // type checked against this attribute and it is used to perform enum // evaluation. If 'acccessor' is supplied, it will be used to attempt to // resolve resources that do not exist in this ResTable. If 'attrType' is // supplied, the value will be type checked for this format if 'attrID' // is not supplied or found. bool stringToValue(Res_value* outValue, String16* outString, const char16_t* s, size_t len, bool preserveSpaces, bool coerceType, uint32_t attrID = 0, const String16* defType = NULL, const String16* defPackage = NULL, Accessor* accessor = NULL, void* accessorCookie = NULL, uint32_t attrType = ResTable_map::TYPE_ANY, bool enforcePrivate = true) const; // Perform processing of escapes and quotes in a string. static bool collectString(String16* outString, const char16_t* s, size_t len, bool preserveSpaces, const char** outErrorMsg = NULL, bool append = false); size_t getBasePackageCount() const; const char16_t* getBasePackageName(size_t idx) const; uint32_t getBasePackageId(size_t idx) const; size_t getTableCount() const; const ResStringPool* getTableStringBlock(size_t index) const; void* getTableCookie(size_t index) const; // Return the configurations (ResTable_config) that we know about void getConfigurations(Vector* configs) const; void getLocales(Vector* locales) const; // Generate an idmap. // // Return value: on success: NO_ERROR; caller is responsible for free-ing // outData (using free(3)). On failure, any status_t value other than // NO_ERROR; the caller should not free outData. status_t createIdmap(const ResTable& overlay, uint32_t originalCrc, uint32_t overlayCrc, void** outData, size_t* outSize) const; enum { IDMAP_HEADER_SIZE_BYTES = 3 * sizeof(uint32_t), }; // Retrieve idmap meta-data. // // This function only requires the idmap header (the first // IDMAP_HEADER_SIZE_BYTES) bytes of an idmap file. static bool getIdmapInfo(const void* idmap, size_t size, uint32_t* pOriginalCrc, uint32_t* pOverlayCrc); #ifndef HAVE_ANDROID_OS void print(bool inclValues) const; static String8 normalizeForOutput(const char* input); #endif private: struct Header; struct Type; struct Package; struct PackageGroup; struct bag_set; status_t add(const void* data, size_t size, void* cookie, Asset* asset, bool copyData, const Asset* idmap); ssize_t getResourcePackageIndex(uint32_t resID) const; ssize_t getEntry( const Package* package, int typeIndex, int entryIndex, const ResTable_config* config, const ResTable_type** outType, const ResTable_entry** outEntry, const Type** outTypeClass) const; status_t parsePackage( const ResTable_package* const pkg, const Header* const header, uint32_t idmap_id); void print_value(const Package* pkg, const Res_value& value) const; mutable Mutex mLock; status_t mError; ResTable_config mParams; // Array of all resource tables. Vector mHeaders; // Array of packages in all resource tables. Vector mPackageGroups; // Mapping from resource package IDs to indices into the internal // package array. uint8_t mPackageMap[256]; }; } // namespace android #endif // _LIBS_UTILS_RESOURCE_TYPES_H android-audiosystem-1.8+13.10.20130807/include/utils/BlobCache.h0000644000015700001700000002315412200324306024435 0ustar pbuserpbgroup00000000000000/* ** Copyright 2011, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #ifndef ANDROID_BLOB_CACHE_H #define ANDROID_BLOB_CACHE_H #include #include #include #include #include namespace android { // A BlobCache is an in-memory cache for binary key/value pairs. A BlobCache // does NOT provide any thread-safety guarantees. // // The cache contents can be serialized to an in-memory buffer or mmap'd file // and then reloaded in a subsequent execution of the program. This // serialization is non-portable and the data should only be used by the device // that generated it. class BlobCache : public RefBase, public Flattenable { public: // Create an empty blob cache. The blob cache will cache key/value pairs // with key and value sizes less than or equal to maxKeySize and // maxValueSize, respectively. The total combined size of ALL cache entries // (key sizes plus value sizes) will not exceed maxTotalSize. BlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxTotalSize); // set inserts a new binary value into the cache and associates it with the // given binary key. If the key or value are too large for the cache then // the cache remains unchanged. This includes the case where a different // value was previously associated with the given key - the old value will // remain in the cache. If the given key and value are small enough to be // put in the cache (based on the maxKeySize, maxValueSize, and maxTotalSize // values specified to the BlobCache constructor), then the key/value pair // will be in the cache after set returns. Note, however, that a subsequent // call to set may evict old key/value pairs from the cache. // // Preconditions: // key != NULL // 0 < keySize // value != NULL // 0 < valueSize void set(const void* key, size_t keySize, const void* value, size_t valueSize); // get retrieves from the cache the binary value associated with a given // binary key. If the key is present in the cache then the length of the // binary value associated with that key is returned. If the value argument // is non-NULL and the size of the cached value is less than valueSize bytes // then the cached value is copied into the buffer pointed to by the value // argument. If the key is not present in the cache then 0 is returned and // the buffer pointed to by the value argument is not modified. // // Note that when calling get multiple times with the same key, the later // calls may fail, returning 0, even if earlier calls succeeded. The return // value must be checked for each call. // // Preconditions: // key != NULL // 0 < keySize // 0 <= valueSize size_t get(const void* key, size_t keySize, void* value, size_t valueSize); // getFlattenedSize returns the number of bytes needed to store the entire // serialized cache. virtual size_t getFlattenedSize() const; // getFdCount returns the number of file descriptors that will result from // flattening the cache. This will always return 0 so as to allow the // flattened cache to be saved to disk and then later restored. virtual size_t getFdCount() const; // flatten serializes the current contents of the cache into the memory // pointed to by 'buffer'. The serialized cache contents can later be // loaded into a BlobCache object using the unflatten method. The contents // of the BlobCache object will not be modified. // // Preconditions: // size >= this.getFlattenedSize() // count == 0 virtual status_t flatten(void* buffer, size_t size, int fds[], size_t count) const; // unflatten replaces the contents of the cache with the serialized cache // contents in the memory pointed to by 'buffer'. The previous contents of // the BlobCache will be evicted from the cache. If an error occurs while // unflattening the serialized cache contents then the BlobCache will be // left in an empty state. // // Preconditions: // count == 0 virtual status_t unflatten(void const* buffer, size_t size, int fds[], size_t count); private: // Copying is disallowed. BlobCache(const BlobCache&); void operator=(const BlobCache&); // A random function helper to get around MinGW not having nrand48() long int blob_random(); // clean evicts a randomly chosen set of entries from the cache such that // the total size of all remaining entries is less than mMaxTotalSize/2. void clean(); // isCleanable returns true if the cache is full enough for the clean method // to have some effect, and false otherwise. bool isCleanable() const; // A Blob is an immutable sized unstructured data blob. class Blob : public RefBase { public: Blob(const void* data, size_t size, bool copyData); ~Blob(); bool operator<(const Blob& rhs) const; const void* getData() const; size_t getSize() const; private: // Copying is not allowed. Blob(const Blob&); void operator=(const Blob&); // mData points to the buffer containing the blob data. const void* mData; // mSize is the size of the blob data in bytes. size_t mSize; // mOwnsData indicates whether or not this Blob object should free the // memory pointed to by mData when the Blob gets destructed. bool mOwnsData; }; // A CacheEntry is a single key/value pair in the cache. class CacheEntry { public: CacheEntry(); CacheEntry(const sp& key, const sp& value); CacheEntry(const CacheEntry& ce); bool operator<(const CacheEntry& rhs) const; const CacheEntry& operator=(const CacheEntry&); sp getKey() const; sp getValue() const; void setValue(const sp& value); private: // mKey is the key that identifies the cache entry. sp mKey; // mValue is the cached data associated with the key. sp mValue; }; // A Header is the header for the entire BlobCache serialization format. No // need to make this portable, so we simply write the struct out. struct Header { // mMagicNumber is the magic number that identifies the data as // serialized BlobCache contents. It must always contain 'Blb$'. uint32_t mMagicNumber; // mBlobCacheVersion is the serialization format version. uint32_t mBlobCacheVersion; // mDeviceVersion is the device-specific version of the cache. This can // be used to invalidate the cache. uint32_t mDeviceVersion; // mNumEntries is number of cache entries following the header in the // data. size_t mNumEntries; }; // An EntryHeader is the header for a serialized cache entry. No need to // make this portable, so we simply write the struct out. Each EntryHeader // is followed imediately by the key data and then the value data. // // The beginning of each serialized EntryHeader is 4-byte aligned, so the // number of bytes that a serialized cache entry will occupy is: // // ((sizeof(EntryHeader) + keySize + valueSize) + 3) & ~3 // struct EntryHeader { // mKeySize is the size of the entry key in bytes. size_t mKeySize; // mValueSize is the size of the entry value in bytes. size_t mValueSize; // mData contains both the key and value data for the cache entry. The // key comes first followed immediately by the value. uint8_t mData[]; }; // mMaxKeySize is the maximum key size that will be cached. Calls to // BlobCache::set with a keySize parameter larger than mMaxKeySize will // simply not add the key/value pair to the cache. const size_t mMaxKeySize; // mMaxValueSize is the maximum value size that will be cached. Calls to // BlobCache::set with a valueSize parameter larger than mMaxValueSize will // simply not add the key/value pair to the cache. const size_t mMaxValueSize; // mMaxTotalSize is the maximum size that all cache entries can occupy. This // includes space for both keys and values. When a call to BlobCache::set // would otherwise cause this limit to be exceeded, either the key/value // pair passed to BlobCache::set will not be cached or other cache entries // will be evicted from the cache to make room for the new entry. const size_t mMaxTotalSize; // mTotalSize is the total combined size of all keys and values currently in // the cache. size_t mTotalSize; // mRandState is the pseudo-random number generator state. It is passed to // nrand48 to generate random numbers when needed. unsigned short mRandState[3]; // mCacheEntries stores all the cache entries that are resident in memory. // Cache entries are added to it by the 'set' method. SortedVector mCacheEntries; }; } #endif // ANDROID_BLOB_CACHE_H android-audiosystem-1.8+13.10.20130807/include/utils/BitSet.h0000644000015700001700000000720712200324306024026 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef UTILS_BITSET_H #define UTILS_BITSET_H #include /* * Contains some bit manipulation helpers. */ namespace android { // A simple set of 32 bits that can be individually marked or cleared. struct BitSet32 { uint32_t value; inline BitSet32() : value(0) { } explicit inline BitSet32(uint32_t value) : value(value) { } // Gets the value associated with a particular bit index. static inline uint32_t valueForBit(uint32_t n) { return 0x80000000 >> n; } // Clears the bit set. inline void clear() { value = 0; } // Returns the number of marked bits in the set. inline uint32_t count() const { return __builtin_popcount(value); } // Returns true if the bit set does not contain any marked bits. inline bool isEmpty() const { return ! value; } // Returns true if the bit set does not contain any unmarked bits. inline bool isFull() const { return value == 0xffffffff; } // Returns true if the specified bit is marked. inline bool hasBit(uint32_t n) const { return value & valueForBit(n); } // Marks the specified bit. inline void markBit(uint32_t n) { value |= valueForBit(n); } // Clears the specified bit. inline void clearBit(uint32_t n) { value &= ~ valueForBit(n); } // Finds the first marked bit in the set. // Result is undefined if all bits are unmarked. inline uint32_t firstMarkedBit() const { return __builtin_clz(value); } // Finds the first unmarked bit in the set. // Result is undefined if all bits are marked. inline uint32_t firstUnmarkedBit() const { return __builtin_clz(~ value); } // Finds the last marked bit in the set. // Result is undefined if all bits are unmarked. inline uint32_t lastMarkedBit() const { return 31 - __builtin_ctz(value); } // Finds the first marked bit in the set and clears it. Returns the bit index. // Result is undefined if all bits are unmarked. inline uint32_t clearFirstMarkedBit() { uint32_t n = firstMarkedBit(); clearBit(n); return n; } // Finds the first unmarked bit in the set and marks it. Returns the bit index. // Result is undefined if all bits are marked. inline uint32_t markFirstUnmarkedBit() { uint32_t n = firstUnmarkedBit(); markBit(n); return n; } // Finds the last marked bit in the set and clears it. Returns the bit index. // Result is undefined if all bits are unmarked. inline uint32_t clearLastMarkedBit() { uint32_t n = lastMarkedBit(); clearBit(n); return n; } // Gets the index of the specified bit in the set, which is the number of // marked bits that appear before the specified bit. inline uint32_t getIndexOfBit(uint32_t n) const { return __builtin_popcount(value & ~(0xffffffffUL >> n)); } inline bool operator== (const BitSet32& other) const { return value == other.value; } inline bool operator!= (const BitSet32& other) const { return value != other.value; } }; } // namespace android #endif // UTILS_BITSET_H android-audiosystem-1.8+13.10.20130807/include/utils/SharedBuffer.h0000644000015700001700000001063712200324306025175 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_SHARED_BUFFER_H #define ANDROID_SHARED_BUFFER_H #include #include // --------------------------------------------------------------------------- namespace android { class SharedBuffer { public: /* flags to use with release() */ enum { eKeepStorage = 0x00000001 }; /*! allocate a buffer of size 'size' and acquire() it. * call release() to free it. */ static SharedBuffer* alloc(size_t size); /*! free the memory associated with the SharedBuffer. * Fails if there are any users associated with this SharedBuffer. * In other words, the buffer must have been release by all its * users. */ static ssize_t dealloc(const SharedBuffer* released); //! get the SharedBuffer from the data pointer static inline const SharedBuffer* sharedBuffer(const void* data); //! access the data for read inline const void* data() const; //! access the data for read/write inline void* data(); //! get size of the buffer inline size_t size() const; //! get back a SharedBuffer object from its data static inline SharedBuffer* bufferFromData(void* data); //! get back a SharedBuffer object from its data static inline const SharedBuffer* bufferFromData(const void* data); //! get the size of a SharedBuffer object from its data static inline size_t sizeFromData(const void* data); //! edit the buffer (get a writtable, or non-const, version of it) SharedBuffer* edit() const; //! edit the buffer, resizing if needed SharedBuffer* editResize(size_t size) const; //! like edit() but fails if a copy is required SharedBuffer* attemptEdit() const; //! resize and edit the buffer, loose it's content. SharedBuffer* reset(size_t size) const; //! acquire/release a reference on this buffer void acquire() const; /*! release a reference on this buffer, with the option of not * freeing the memory associated with it if it was the last reference * returns the previous reference count */ int32_t release(uint32_t flags = 0) const; //! returns wether or not we're the only owner inline bool onlyOwner() const; private: inline SharedBuffer() { } inline ~SharedBuffer() { } inline SharedBuffer(const SharedBuffer&); // 16 bytes. must be sized to preserve correct alingment. mutable int32_t mRefs; size_t mSize; uint32_t mReserved[2]; }; // --------------------------------------------------------------------------- const SharedBuffer* SharedBuffer::sharedBuffer(const void* data) { return data ? reinterpret_cast(data)-1 : 0; } const void* SharedBuffer::data() const { return this + 1; } void* SharedBuffer::data() { return this + 1; } size_t SharedBuffer::size() const { return mSize; } SharedBuffer* SharedBuffer::bufferFromData(void* data) { return ((SharedBuffer*)data)-1; } const SharedBuffer* SharedBuffer::bufferFromData(const void* data) { return ((const SharedBuffer*)data)-1; } size_t SharedBuffer::sizeFromData(const void* data) { return (((const SharedBuffer*)data)-1)->mSize; } bool SharedBuffer::onlyOwner() const { return (mRefs == 1); } }; // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_VECTOR_H android-audiosystem-1.8+13.10.20130807/include/hardware/0000755000015700001700000000000012200324404023111 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/hardware/keymaster.h0000644000015700001700000001377112200324306025300 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_HARDWARE_KEYMASTER_H #define ANDROID_HARDWARE_KEYMASTER_H #include #include #include #include __BEGIN_DECLS /** * The id of this module */ #define KEYSTORE_HARDWARE_MODULE_ID "keystore" #define KEYSTORE_KEYMASTER "keymaster" /** * The API level of this version of the header. The allows the implementing * module to recognize which API level of the client it is dealing with in * the case of pre-compiled binary clients. */ #define KEYMASTER_API_VERSION 1 /** * Flags for keymaster_device::flags */ enum { /* * Indicates this keymaster implementation does not have hardware that * keeps private keys out of user space. * * This should not be implemented on anything other than the default * implementation. */ KEYMASTER_SOFTWARE_ONLY = 0x00000001, }; struct keystore_module { hw_module_t common; }; /** * Asymmetric key pair types. */ typedef enum { TYPE_RSA = 1, } keymaster_keypair_t; /** * Parameters needed to generate an RSA key. */ typedef struct { uint32_t modulus_size; uint64_t public_exponent; } keymaster_rsa_keygen_params_t; /** * Digest type used for RSA operations. */ typedef enum { DIGEST_NONE, } keymaster_rsa_digest_t; /** * Type of padding used for RSA operations. */ typedef enum { PADDING_NONE, } keymaster_rsa_padding_t; typedef struct { keymaster_rsa_digest_t digest_type; keymaster_rsa_padding_t padding_type; } keymaster_rsa_sign_params_t; /** * The parameters that can be set for a given keymaster implementation. */ struct keymaster_device { struct hw_device_t common; uint32_t client_version; /** * See flags defined for keymaster_device::flags above. */ uint32_t flags; void* context; /** * Generates a public and private key. The key-blob returned is opaque * and must subsequently provided for signing and verification. * * Returns: 0 on success or an error code less than 0. */ int (*generate_keypair)(const struct keymaster_device* dev, const keymaster_keypair_t key_type, const void* key_params, uint8_t** key_blob, size_t* key_blob_length); /** * Imports a public and private key pair. The imported keys will be in * PKCS#8 format with DER encoding (Java standard). The key-blob * returned is opaque and will be subsequently provided for signing * and verification. * * Returns: 0 on success or an error code less than 0. */ int (*import_keypair)(const struct keymaster_device* dev, const uint8_t* key, const size_t key_length, uint8_t** key_blob, size_t* key_blob_length); /** * Gets the public key part of a key pair. The public key must be in * X.509 format (Java standard) encoded byte array. * * Returns: 0 on success or an error code less than 0. * On error, x509_data should not be allocated. */ int (*get_keypair_public)(const struct keymaster_device* dev, const uint8_t* key_blob, const size_t key_blob_length, uint8_t** x509_data, size_t* x509_data_length); /** * Deletes the key pair associated with the key blob. * * This function is optional and should be set to NULL if it is not * implemented. * * Returns 0 on success or an error code less than 0. */ int (*delete_keypair)(const struct keymaster_device* dev, const uint8_t* key_blob, const size_t key_blob_length); /** * Deletes all keys in the hardware keystore. Used when keystore is * reset completely. * * This function is optional and should be set to NULL if it is not * implemented. * * Returns 0 on success or an error code less than 0. */ int (*delete_all)(const struct keymaster_device* dev); /** * Signs data using a key-blob generated before. This can use either * an asymmetric key or a secret key. * * Returns: 0 on success or an error code less than 0. */ int (*sign_data)(const struct keymaster_device* dev, const void* signing_params, const uint8_t* key_blob, const size_t key_blob_length, const uint8_t* data, const size_t data_length, uint8_t** signed_data, size_t* signed_data_length); /** * Verifies data signed with a key-blob. This can use either * an asymmetric key or a secret key. * * Returns: 0 on successful verification or an error code less than 0. */ int (*verify_data)(const struct keymaster_device* dev, const void* signing_params, const uint8_t* key_blob, const size_t key_blob_length, const uint8_t* signed_data, const size_t signed_data_length, const uint8_t* signature, const size_t signature_length); }; typedef struct keymaster_device keymaster_device_t; /* Convenience API for opening and closing keymaster devices */ static inline int keymaster_open(const struct hw_module_t* module, keymaster_device_t** device) { int rc = module->methods->open(module, KEYSTORE_KEYMASTER, (struct hw_device_t**) device); if (!rc) { (*device)->client_version = KEYMASTER_API_VERSION; } return rc; } static inline int keymaster_close(keymaster_device_t* device) { return device->common.close(&device->common); } __END_DECLS #endif // ANDROID_HARDWARE_KEYMASTER_H android-audiosystem-1.8+13.10.20130807/include/hardware/gralloc.h0000644000015700001700000002503412200324306024712 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_GRALLOC_INTERFACE_H #define ANDROID_GRALLOC_INTERFACE_H #include #include #include #include #include #include #include #include __BEGIN_DECLS #define GRALLOC_API_VERSION 1 /** * The id of this module */ #define GRALLOC_HARDWARE_MODULE_ID "gralloc" /** * Name of the graphics device to open */ #define GRALLOC_HARDWARE_GPU0 "gpu0" enum { /* buffer is never read in software */ GRALLOC_USAGE_SW_READ_NEVER = 0x00000000, /* buffer is rarely read in software */ GRALLOC_USAGE_SW_READ_RARELY = 0x00000002, /* buffer is often read in software */ GRALLOC_USAGE_SW_READ_OFTEN = 0x00000003, /* mask for the software read values */ GRALLOC_USAGE_SW_READ_MASK = 0x0000000F, /* buffer is never written in software */ GRALLOC_USAGE_SW_WRITE_NEVER = 0x00000000, /* buffer is never written in software */ GRALLOC_USAGE_SW_WRITE_RARELY = 0x00000020, /* buffer is never written in software */ GRALLOC_USAGE_SW_WRITE_OFTEN = 0x00000030, /* mask for the software write values */ GRALLOC_USAGE_SW_WRITE_MASK = 0x000000F0, /* buffer will be used as an OpenGL ES texture */ GRALLOC_USAGE_HW_TEXTURE = 0x00000100, /* buffer will be used as an OpenGL ES render target */ GRALLOC_USAGE_HW_RENDER = 0x00000200, /* buffer will be used by the 2D hardware blitter */ GRALLOC_USAGE_HW_2D = 0x00000400, /* buffer will be used by the HWComposer HAL module */ GRALLOC_USAGE_HW_COMPOSER = 0x00000800, /* buffer will be used with the framebuffer device */ GRALLOC_USAGE_HW_FB = 0x00001000, /* buffer will be used with the HW video encoder */ GRALLOC_USAGE_HW_VIDEO_ENCODER = 0x00010000, /* buffer will be written by the HW camera pipeline */ GRALLOC_USAGE_HW_CAMERA_WRITE = 0x00020000, /* buffer will be read by the HW camera pipeline */ GRALLOC_USAGE_HW_CAMERA_READ = 0x00040000, /* buffer will be used as part of zero-shutter-lag queue */ GRALLOC_USAGE_HW_CAMERA_ZSL = 0x00060000, /* mask for the camera access values */ GRALLOC_USAGE_HW_CAMERA_MASK = 0x00060000, /* mask for the software usage bit-mask */ GRALLOC_USAGE_HW_MASK = 0x00071F00, /* buffer should be displayed full-screen on an external display when * possible */ GRALLOC_USAGE_EXTERNAL_DISP = 0x00002000, /* Must have a hardware-protected path to external display sink for * this buffer. If a hardware-protected path is not available, then * either don't composite only this buffer (preferred) to the * external sink, or (less desirable) do not route the entire * composition to the external sink. */ GRALLOC_USAGE_PROTECTED = 0x00004000, /* implementation-specific private usage flags */ GRALLOC_USAGE_PRIVATE_0 = 0x10000000, GRALLOC_USAGE_PRIVATE_1 = 0x20000000, GRALLOC_USAGE_PRIVATE_2 = 0x40000000, GRALLOC_USAGE_PRIVATE_3 = 0x80000000, GRALLOC_USAGE_PRIVATE_MASK = 0xF0000000, #ifdef EXYNOS4_ENHANCEMENTS /* SAMSUNG */ GRALLOC_USAGE_PRIVATE_NONECACHE = 0x00800000, GRALLOC_USAGE_HW_FIMC1 = 0x01000000, GRALLOC_USAGE_HW_ION = 0x02000000, GRALLOC_USAGE_YUV_ADDR = 0x04000000, GRALLOC_USAGE_CAMERA = 0x08000000, /* SEC Private usage , for Overlay path at HWC */ GRALLOC_USAGE_HWC_HWOVERLAY = 0x20000000, #endif }; /*****************************************************************************/ /** * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM * and the fields of this data structure must begin with hw_module_t * followed by module specific information. */ typedef struct gralloc_module_t { struct hw_module_t common; /* * (*registerBuffer)() must be called before a buffer_handle_t that has not * been created with (*alloc_device_t::alloc)() can be used. * * This is intended to be used with buffer_handle_t's that have been * received in this process through IPC. * * This function checks that the handle is indeed a valid one and prepares * it for use with (*lock)() and (*unlock)(). * * It is not necessary to call (*registerBuffer)() on a handle created * with (*alloc_device_t::alloc)(). * * returns an error if this buffer_handle_t is not valid. */ int (*registerBuffer)(struct gralloc_module_t const* module, buffer_handle_t handle); /* * (*unregisterBuffer)() is called once this handle is no longer needed in * this process. After this call, it is an error to call (*lock)(), * (*unlock)(), or (*registerBuffer)(). * * This function doesn't close or free the handle itself; this is done * by other means, usually through libcutils's native_handle_close() and * native_handle_free(). * * It is an error to call (*unregisterBuffer)() on a buffer that wasn't * explicitly registered first. */ int (*unregisterBuffer)(struct gralloc_module_t const* module, buffer_handle_t handle); /* * The (*lock)() method is called before a buffer is accessed for the * specified usage. This call may block, for instance if the h/w needs * to finish rendering or if CPU caches need to be synchronized. * * The caller promises to modify only pixels in the area specified * by (l,t,w,h). * * The content of the buffer outside of the specified area is NOT modified * by this call. * * If usage specifies GRALLOC_USAGE_SW_*, vaddr is filled with the address * of the buffer in virtual memory. * * THREADING CONSIDERATIONS: * * It is legal for several different threads to lock a buffer from * read access, none of the threads are blocked. * * However, locking a buffer simultaneously for write or read/write is * undefined, but: * - shall not result in termination of the process * - shall not block the caller * It is acceptable to return an error or to leave the buffer's content * into an indeterminate state. * * If the buffer was created with a usage mask incompatible with the * requested usage flags here, -EINVAL is returned. * */ int (*lock)(struct gralloc_module_t const* module, buffer_handle_t handle, int usage, int l, int t, int w, int h, void** vaddr); /* * The (*unlock)() method must be called after all changes to the buffer * are completed. */ int (*unlock)(struct gralloc_module_t const* module, buffer_handle_t handle); #ifdef EXYNOS4_ENHANCEMENTS int (*getphys) (struct gralloc_module_t const* module, buffer_handle_t handle, void** paddr); #endif /* reserved for future use */ int (*perform)(struct gralloc_module_t const* module, int operation, ... ); /* reserved for future use */ void* reserved_proc[7]; } gralloc_module_t; /*****************************************************************************/ /** * Every device data structure must begin with hw_device_t * followed by module specific public methods and attributes. */ typedef struct alloc_device_t { struct hw_device_t common; #ifdef QCOM_HARDWARE /* * (*allocSize)() Allocates a buffer in graphic memory with the requested * bufferSize parameter and returns a buffer_handle_t and the stride in * pixels to allow the implementation to satisfy hardware constraints on * the width of a pixmap (eg: it may have to be multiple of 8 pixels). * The CALLER TAKES OWNERSHIP of the buffer_handle_t. * * Returns 0 on success or -errno on error. */ int (*allocSize)(struct alloc_device_t* dev, int w, int h, int format, int usage, buffer_handle_t* handle, int* stride, int bufferSize); #endif /* * (*alloc)() Allocates a buffer in graphic memory with the requested * parameters and returns a buffer_handle_t and the stride in pixels to * allow the implementation to satisfy hardware constraints on the width * of a pixmap (eg: it may have to be multiple of 8 pixels). * The CALLER TAKES OWNERSHIP of the buffer_handle_t. * * Returns 0 on success or -errno on error. */ int (*alloc)(struct alloc_device_t* dev, int w, int h, int format, int usage, buffer_handle_t* handle, int* stride); /* * (*free)() Frees a previously allocated buffer. * Behavior is undefined if the buffer is still mapped in any process, * but shall not result in termination of the program or security breaches * (allowing a process to get access to another process' buffers). * THIS FUNCTION TAKES OWNERSHIP of the buffer_handle_t which becomes * invalid after the call. * * Returns 0 on success or -errno on error. */ int (*free)(struct alloc_device_t* dev, buffer_handle_t handle); /* This hook is OPTIONAL. * * If non NULL it will be caused by SurfaceFlinger on dumpsys */ void (*dump)(struct alloc_device_t *dev, char *buff, int buff_len); void* reserved_proc[7]; } alloc_device_t; /** convenience API for opening and closing a supported device */ static inline int gralloc_open(const struct hw_module_t* module, struct alloc_device_t** device) { return module->methods->open(module, GRALLOC_HARDWARE_GPU0, (struct hw_device_t**)device); } static inline int gralloc_close(struct alloc_device_t* device) { return device->common.close(&device->common); } __END_DECLS #endif // ANDROID_GRALLOC_INTERFACE_H android-audiosystem-1.8+13.10.20130807/include/hardware/fb.h0000644000015700001700000001217312200324306023656 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_FB_INTERFACE_H #define ANDROID_FB_INTERFACE_H #include #include #include #include #include __BEGIN_DECLS #define GRALLOC_HARDWARE_FB0 "fb0" /*****************************************************************************/ /*****************************************************************************/ typedef struct framebuffer_device_t { struct hw_device_t common; /* flags describing some attributes of the framebuffer */ const uint32_t flags; /* dimensions of the framebuffer in pixels */ const uint32_t width; const uint32_t height; /* frambuffer stride in pixels */ const int stride; /* framebuffer pixel format */ const int format; /* resolution of the framebuffer's display panel in pixel per inch*/ const float xdpi; const float ydpi; /* framebuffer's display panel refresh rate in frames per second */ const float fps; /* min swap interval supported by this framebuffer */ const int minSwapInterval; /* max swap interval supported by this framebuffer */ const int maxSwapInterval; /* Number of framebuffers supported*/ const int numFramebuffers; int reserved[7]; /* * requests a specific swap-interval (same definition than EGL) * * Returns 0 on success or -errno on error. */ int (*setSwapInterval)(struct framebuffer_device_t* window, int interval); /* * This hook is OPTIONAL. * * It is non NULL If the framebuffer driver supports "update-on-demand" * and the given rectangle is the area of the screen that gets * updated during (*post)(). * * This is useful on devices that are able to DMA only a portion of * the screen to the display panel, upon demand -- as opposed to * constantly refreshing the panel 60 times per second, for instance. * * Only the area defined by this rectangle is guaranteed to be valid, that * is, the driver is not allowed to post anything outside of this * rectangle. * * The rectangle evaluated during (*post)() and specifies which area * of the buffer passed in (*post)() shall to be posted. * * return -EINVAL if width or height <=0, or if left or top < 0 */ int (*setUpdateRect)(struct framebuffer_device_t* window, int left, int top, int width, int height); /* * Post to the display (display it on the screen) * The buffer must have been allocated with the * GRALLOC_USAGE_HW_FB usage flag. * buffer must be the same width and height as the display and must NOT * be locked. * * The buffer is shown during the next VSYNC. * * If the same buffer is posted again (possibly after some other buffer), * post() will block until the the first post is completed. * * Internally, post() is expected to lock the buffer so that a * subsequent call to gralloc_module_t::(*lock)() with USAGE_RENDER or * USAGE_*_WRITE will block until it is safe; that is typically once this * buffer is shown and another buffer has been posted. * * Returns 0 on success or -errno on error. */ int (*post)(struct framebuffer_device_t* dev, buffer_handle_t buffer); /* * The (*compositionComplete)() method must be called after the * compositor has finished issuing GL commands for client buffers. */ int (*compositionComplete)(struct framebuffer_device_t* dev); /* * This hook is OPTIONAL. * * If non NULL it will be caused by SurfaceFlinger on dumpsys */ void (*dump)(struct framebuffer_device_t* dev, char *buff, int buff_len); /* * (*enableScreen)() is used to either blank (enable=0) or * unblank (enable=1) the screen this framebuffer is attached to. * * Returns 0 on success or -errno on error. */ int (*enableScreen)(struct framebuffer_device_t* dev, int enable); void* reserved_proc[6]; } framebuffer_device_t; /** convenience API for opening and closing a supported device */ static inline int framebuffer_open(const struct hw_module_t* module, struct framebuffer_device_t** device) { return module->methods->open(module, GRALLOC_HARDWARE_FB0, (struct hw_device_t**)device); } static inline int framebuffer_close(struct framebuffer_device_t* device) { return device->common.close(&device->common); } __END_DECLS #endif // ANDROID_FB_INTERFACE_H android-audiosystem-1.8+13.10.20130807/include/hardware/hwcomposer_v0.h0000644000015700001700000002400312200324306026055 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* This header contains deprecated HWCv0 interface declarations. Don't include * this header directly; it will be included by unless * HWC_REMOVE_DEPRECATED_VERSIONS is defined to non-zero. */ #ifndef ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_H #error "This header should only be included by hardware/hwcomposer.h" #endif #ifndef ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_V0_H #define ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_V0_H struct hwc_composer_device; /* * availability: HWC_DEVICE_API_VERSION_0_3 * * struct hwc_methods cannot be embedded in other structures as * sizeof(struct hwc_methods) cannot be relied upon. * */ typedef struct hwc_methods { /************************************************************************* * HWC_DEVICE_API_VERSION_0_3 *************************************************************************/ /* * eventControl(..., event, enabled) * Enables or disables h/w composer events. * * eventControl can be called from any thread and takes effect * immediately. * * Supported events are: * HWC_EVENT_VSYNC * * returns -EINVAL if the "event" parameter is not one of the value above * or if the "enabled" parameter is not 0 or 1. */ int (*eventControl)( struct hwc_composer_device* dev, int event, int enabled); } hwc_methods_t; typedef struct hwc_layer { /* * initially set to HWC_FRAMEBUFFER or HWC_BACKGROUND. * HWC_FRAMEBUFFER * indicates the layer will be drawn into the framebuffer * using OpenGL ES. * The HWC can toggle this value to HWC_OVERLAY, to indicate * it will handle the layer. * * HWC_BACKGROUND * indicates this is a special "background" layer. The only valid * field is backgroundColor. HWC_BACKGROUND can only be used with * HWC_API_VERSION >= 0.2 * The HWC can toggle this value to HWC_FRAMEBUFFER, to indicate * it CANNOT handle the background color * */ int32_t compositionType; /* see hwc_layer_t::hints above */ uint32_t hints; /* see hwc_layer_t::flags above */ uint32_t flags; union { /* color of the background. hwc_color_t.a is ignored */ hwc_color_t backgroundColor; struct { /* handle of buffer to compose. This handle is guaranteed to have been * allocated from gralloc using the GRALLOC_USAGE_HW_COMPOSER usage flag. If * the layer's handle is unchanged across two consecutive prepare calls and * the HWC_GEOMETRY_CHANGED flag is not set for the second call then the * HWComposer implementation may assume that the contents of the buffer have * not changed. */ buffer_handle_t handle; /* transformation to apply to the buffer during composition */ uint32_t transform; /* blending to apply during composition */ int32_t blending; /* area of the source to consider, the origin is the top-left corner of * the buffer */ hwc_rect_t sourceCrop; /* where to composite the sourceCrop onto the display. The sourceCrop * is scaled using linear filtering to the displayFrame. The origin is the * top-left corner of the screen. */ hwc_rect_t displayFrame; /* visible region in screen space. The origin is the * top-left corner of the screen. * The visible region INCLUDES areas overlapped by a translucent layer. */ hwc_region_t visibleRegionScreen; }; }; } hwc_layer_t; /* * List of layers. * The handle members of hwLayers elements must be unique. */ typedef struct hwc_layer_list { uint32_t flags; size_t numHwLayers; hwc_layer_t hwLayers[0]; } hwc_layer_list_t; /*****************************************************************************/ typedef struct hwc_composer_device { struct hw_device_t common; /* * (*prepare)() is called for each frame before composition and is used by * SurfaceFlinger to determine what composition steps the HWC can handle. * * (*prepare)() can be called more than once, the last call prevails. * * The HWC responds by setting the compositionType field to either * HWC_FRAMEBUFFER or HWC_OVERLAY. In the former case, the composition for * this layer is handled by SurfaceFlinger with OpenGL ES, in the later * case, the HWC will have to handle this layer's composition. * * (*prepare)() is called with HWC_GEOMETRY_CHANGED to indicate that the * list's geometry has changed, that is, when more than just the buffer's * handles have been updated. Typically this happens (but is not limited to) * when a window is added, removed, resized or moved. * * a NULL list parameter or a numHwLayers of zero indicates that the * entire composition will be handled by SurfaceFlinger with OpenGL ES. * * returns: 0 on success. An negative error code on error. If an error is * returned, SurfaceFlinger will assume that none of the layer will be * handled by the HWC. */ int (*prepare)(struct hwc_composer_device *dev, hwc_layer_list_t* list); /* * (*set)() is used in place of eglSwapBuffers(), and assumes the same * functionality, except it also commits the work list atomically with * the actual eglSwapBuffers(). * * The list parameter is guaranteed to be the same as the one returned * from the last call to (*prepare)(). * * When this call returns the caller assumes that: * * - the display will be updated in the near future with the content * of the work list, without artifacts during the transition from the * previous frame. * * - all objects are available for immediate access or destruction, in * particular, hwc_region_t::rects data and hwc_layer_t::layer's buffer. * Note that this means that immediately accessing (potentially from a * different process) a buffer used in this call will not result in * screen corruption, the driver must apply proper synchronization or * scheduling (eg: block the caller, such as gralloc_module_t::lock(), * OpenGL ES, Camera, Codecs, etc..., or schedule the caller's work * after the buffer is freed from the actual composition). * * a NULL list parameter or a numHwLayers of zero indicates that the * entire composition has been handled by SurfaceFlinger with OpenGL ES. * In this case, (*set)() behaves just like eglSwapBuffers(). * * dpy, sur, and list are set to NULL to indicate that the screen is * turning off. This happens WITHOUT prepare() being called first. * This is a good time to free h/w resources and/or power * the relevant h/w blocks down. * * IMPORTANT NOTE: there is an implicit layer containing opaque black * pixels behind all the layers in the list. * It is the responsibility of the hwcomposer module to make * sure black pixels are output (or blended from). * * returns: 0 on success. An negative error code on error: * HWC_EGL_ERROR: eglGetError() will provide the proper error code * Another code for non EGL errors. * */ int (*set)(struct hwc_composer_device *dev, hwc_display_t dpy, hwc_surface_t sur, hwc_layer_list_t* list); /* * This field is OPTIONAL and can be NULL. * * If non NULL it will be called by SurfaceFlinger on dumpsys */ void (*dump)(struct hwc_composer_device* dev, char *buff, int buff_len); /* * This field is OPTIONAL and can be NULL. * * (*registerProcs)() registers a set of callbacks the h/w composer HAL * can later use. It is FORBIDDEN to call any of the callbacks from * within registerProcs(). registerProcs() must save the hwc_procs_t pointer * which is needed when calling a registered callback. * Each call to registerProcs replaces the previous set of callbacks. * registerProcs is called with NULL to unregister all callbacks. * * Any of the callbacks can be NULL, in which case the corresponding * functionality is not supported. */ void (*registerProcs)(struct hwc_composer_device* dev, hwc_procs_t const* procs); /* * This field is OPTIONAL and can be NULL. * availability: HWC_DEVICE_API_VERSION_0_2 * * Used to retrieve information about the h/w composer * * Returns 0 on success or -errno on error. */ int (*query)(struct hwc_composer_device* dev, int what, int* value); /* * Reserved for future use. Must be NULL. */ void* reserved_proc[4]; /* * This field is OPTIONAL and can be NULL. * availability: HWC_DEVICE_API_VERSION_0_3 */ hwc_methods_t const *methods; } hwc_composer_device_t; /** convenience API for opening and closing a device */ static inline int hwc_open(const struct hw_module_t* module, hwc_composer_device_t** device) { return module->methods->open(module, HWC_HARDWARE_COMPOSER, (struct hw_device_t**)device); } static inline int hwc_close(hwc_composer_device_t* device) { return device->common.close(&device->common); } /*****************************************************************************/ #endif /* ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_V0_H */ android-audiosystem-1.8+13.10.20130807/include/hardware/gps.h0000644000015700001700000004730512200324306024065 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_INCLUDE_HARDWARE_GPS_H #define ANDROID_INCLUDE_HARDWARE_GPS_H #include #include #include #include #include __BEGIN_DECLS /** * The id of this module */ #define GPS_HARDWARE_MODULE_ID "gps" /** Milliseconds since January 1, 1970 */ typedef int64_t GpsUtcTime; /** Maximum number of SVs for gps_sv_status_callback(). */ #define GPS_MAX_SVS 32 /** Requested operational mode for GPS operation. */ typedef uint32_t GpsPositionMode; // IMPORTANT: Note that the following values must match // constants in GpsLocationProvider.java. /** Mode for running GPS standalone (no assistance). */ #define GPS_POSITION_MODE_STANDALONE 0 /** AGPS MS-Based mode. */ #define GPS_POSITION_MODE_MS_BASED 1 /** AGPS MS-Assisted mode. */ #define GPS_POSITION_MODE_MS_ASSISTED 2 /** Requested recurrence mode for GPS operation. */ typedef uint32_t GpsPositionRecurrence; // IMPORTANT: Note that the following values must match // constants in GpsLocationProvider.java. /** Receive GPS fixes on a recurring basis at a specified period. */ #define GPS_POSITION_RECURRENCE_PERIODIC 0 /** Request a single shot GPS fix. */ #define GPS_POSITION_RECURRENCE_SINGLE 1 /** GPS status event values. */ typedef uint16_t GpsStatusValue; // IMPORTANT: Note that the following values must match // constants in GpsLocationProvider.java. /** GPS status unknown. */ #define GPS_STATUS_NONE 0 /** GPS has begun navigating. */ #define GPS_STATUS_SESSION_BEGIN 1 /** GPS has stopped navigating. */ #define GPS_STATUS_SESSION_END 2 /** GPS has powered on but is not navigating. */ #define GPS_STATUS_ENGINE_ON 3 /** GPS is powered off. */ #define GPS_STATUS_ENGINE_OFF 4 /** Flags to indicate which values are valid in a GpsLocation. */ typedef uint16_t GpsLocationFlags; // IMPORTANT: Note that the following values must match // constants in GpsLocationProvider.java. /** GpsLocation has valid latitude and longitude. */ #define GPS_LOCATION_HAS_LAT_LONG 0x0001 /** GpsLocation has valid altitude. */ #define GPS_LOCATION_HAS_ALTITUDE 0x0002 /** GpsLocation has valid speed. */ #define GPS_LOCATION_HAS_SPEED 0x0004 /** GpsLocation has valid bearing. */ #define GPS_LOCATION_HAS_BEARING 0x0008 /** GpsLocation has valid accuracy. */ #define GPS_LOCATION_HAS_ACCURACY 0x0010 /** Flags for the gps_set_capabilities callback. */ /** GPS HAL schedules fixes for GPS_POSITION_RECURRENCE_PERIODIC mode. If this is not set, then the framework will use 1000ms for min_interval and will start and call start() and stop() to schedule the GPS. */ #define GPS_CAPABILITY_SCHEDULING 0x0000001 /** GPS supports MS-Based AGPS mode */ #define GPS_CAPABILITY_MSB 0x0000002 /** GPS supports MS-Assisted AGPS mode */ #define GPS_CAPABILITY_MSA 0x0000004 /** GPS supports single-shot fixes */ #define GPS_CAPABILITY_SINGLE_SHOT 0x0000008 /** GPS supports on demand time injection */ #define GPS_CAPABILITY_ON_DEMAND_TIME 0x0000010 /** Flags used to specify which aiding data to delete when calling delete_aiding_data(). */ typedef uint16_t GpsAidingData; // IMPORTANT: Note that the following values must match // constants in GpsLocationProvider.java. #define GPS_DELETE_EPHEMERIS 0x0001 #define GPS_DELETE_ALMANAC 0x0002 #define GPS_DELETE_POSITION 0x0004 #define GPS_DELETE_TIME 0x0008 #define GPS_DELETE_IONO 0x0010 #define GPS_DELETE_UTC 0x0020 #define GPS_DELETE_HEALTH 0x0040 #define GPS_DELETE_SVDIR 0x0080 #define GPS_DELETE_SVSTEER 0x0100 #define GPS_DELETE_SADATA 0x0200 #define GPS_DELETE_RTI 0x0400 #define GPS_DELETE_CELLDB_INFO 0x8000 #define GPS_DELETE_ALL 0xFFFF /** AGPS type */ typedef uint16_t AGpsType; #define AGPS_TYPE_SUPL 1 #define AGPS_TYPE_C2K 2 typedef uint16_t AGpsSetIDType; #define AGPS_SETID_TYPE_NONE 0 #define AGPS_SETID_TYPE_IMSI 1 #define AGPS_SETID_TYPE_MSISDN 2 /** * String length constants */ #define GPS_NI_SHORT_STRING_MAXLEN 256 #define GPS_NI_LONG_STRING_MAXLEN 2048 /** * GpsNiType constants */ typedef uint32_t GpsNiType; #define GPS_NI_TYPE_VOICE 1 #define GPS_NI_TYPE_UMTS_SUPL 2 #define GPS_NI_TYPE_UMTS_CTRL_PLANE 3 /** * GpsNiNotifyFlags constants */ typedef uint32_t GpsNiNotifyFlags; /** NI requires notification */ #define GPS_NI_NEED_NOTIFY 0x0001 /** NI requires verification */ #define GPS_NI_NEED_VERIFY 0x0002 /** NI requires privacy override, no notification/minimal trace */ #define GPS_NI_PRIVACY_OVERRIDE 0x0004 /** * GPS NI responses, used to define the response in * NI structures */ typedef int GpsUserResponseType; #define GPS_NI_RESPONSE_ACCEPT 1 #define GPS_NI_RESPONSE_DENY 2 #define GPS_NI_RESPONSE_NORESP 3 /** * NI data encoding scheme */ typedef int GpsNiEncodingType; #define GPS_ENC_NONE 0 #define GPS_ENC_SUPL_GSM_DEFAULT 1 #define GPS_ENC_SUPL_UTF8 2 #define GPS_ENC_SUPL_UCS2 3 #define GPS_ENC_UNKNOWN -1 /** AGPS status event values. */ typedef uint16_t AGpsStatusValue; /** GPS requests data connection for AGPS. */ #define GPS_REQUEST_AGPS_DATA_CONN 1 /** GPS releases the AGPS data connection. */ #define GPS_RELEASE_AGPS_DATA_CONN 2 /** AGPS data connection initiated */ #define GPS_AGPS_DATA_CONNECTED 3 /** AGPS data connection completed */ #define GPS_AGPS_DATA_CONN_DONE 4 /** AGPS data connection failed */ #define GPS_AGPS_DATA_CONN_FAILED 5 #define AGPS_REF_LOCATION_TYPE_GSM_CELLID 1 #define AGPS_REF_LOCATION_TYPE_UMTS_CELLID 2 #define AGPS_REG_LOCATION_TYPE_MAC 3 /** Network types for update_network_state "type" parameter */ #define AGPS_RIL_NETWORK_TYPE_MOBILE 0 #define AGPS_RIL_NETWORK_TYPE_WIFI 1 #define AGPS_RIL_NETWORK_TYPE_MOBILE_MMS 2 #define AGPS_RIL_NETWORK_TYPE_MOBILE_SUPL 3 #define AGPS_RIL_NETWORK_TTYPE_MOBILE_DUN 4 #define AGPS_RIL_NETWORK_TTYPE_MOBILE_HIPRI 5 #define AGPS_RIL_NETWORK_TTYPE_WIMAX 6 /** * Name for the GPS XTRA interface. */ #define GPS_XTRA_INTERFACE "gps-xtra" /** * Name for the GPS DEBUG interface. */ #define GPS_DEBUG_INTERFACE "gps-debug" /** * Name for the AGPS interface. */ #define AGPS_INTERFACE "agps" /** * Name for NI interface */ #define GPS_NI_INTERFACE "gps-ni" /** * Name for the AGPS-RIL interface. */ #define AGPS_RIL_INTERFACE "agps_ril" /** Represents a location. */ typedef struct { /** set to sizeof(GpsLocation) */ size_t size; /** Contains GpsLocationFlags bits. */ uint16_t flags; /** Represents latitude in degrees. */ double latitude; /** Represents longitude in degrees. */ double longitude; /** Represents altitude in meters above the WGS 84 reference * ellipsoid. */ double altitude; /** Represents speed in meters per second. */ float speed; /** Represents heading in degrees. */ float bearing; /** Represents expected accuracy in meters. */ float accuracy; /** Timestamp for the location fix. */ GpsUtcTime timestamp; } GpsLocation; /** Represents the status. */ typedef struct { /** set to sizeof(GpsStatus) */ size_t size; GpsStatusValue status; } GpsStatus; /** Represents SV information. */ typedef struct { /** set to sizeof(GpsSvInfo) */ size_t size; /** Pseudo-random number for the SV. */ int prn; /** Signal to noise ratio. */ float snr; /** Elevation of SV in degrees. */ float elevation; /** Azimuth of SV in degrees. */ float azimuth; } GpsSvInfo; /** Represents SV status. */ typedef struct { /** set to sizeof(GpsSvStatus) */ size_t size; /** Number of SVs currently visible. */ int num_svs; /** Contains an array of SV information. */ GpsSvInfo sv_list[GPS_MAX_SVS]; /** Represents a bit mask indicating which SVs * have ephemeris data. */ uint32_t ephemeris_mask; /** Represents a bit mask indicating which SVs * have almanac data. */ uint32_t almanac_mask; /** * Represents a bit mask indicating which SVs * were used for computing the most recent position fix. */ uint32_t used_in_fix_mask; } GpsSvStatus; /* 2G and 3G */ /* In 3G lac is discarded */ typedef struct { uint16_t type; uint16_t mcc; uint16_t mnc; uint16_t lac; uint32_t cid; } AGpsRefLocationCellID; typedef struct { uint8_t mac[6]; } AGpsRefLocationMac; /** Represents ref locations */ typedef struct { uint16_t type; union { AGpsRefLocationCellID cellID; AGpsRefLocationMac mac; } u; } AGpsRefLocation; /** Callback with location information. * Can only be called from a thread created by create_thread_cb. */ typedef void (* gps_location_callback)(GpsLocation* location); /** Callback with status information. * Can only be called from a thread created by create_thread_cb. */ typedef void (* gps_status_callback)(GpsStatus* status); /** Callback with SV status information. * Can only be called from a thread created by create_thread_cb. */ typedef void (* gps_sv_status_callback)(GpsSvStatus* sv_info); /** Callback for reporting NMEA sentences. * Can only be called from a thread created by create_thread_cb. */ typedef void (* gps_nmea_callback)(GpsUtcTime timestamp, const char* nmea, int length); /** Callback to inform framework of the GPS engine's capabilities. * Capability parameter is a bit field of GPS_CAPABILITY_* flags. */ typedef void (* gps_set_capabilities)(uint32_t capabilities); /** Callback utility for acquiring the GPS wakelock. * This can be used to prevent the CPU from suspending while handling GPS events. */ typedef void (* gps_acquire_wakelock)(); /** Callback utility for releasing the GPS wakelock. */ typedef void (* gps_release_wakelock)(); /** Callback for requesting NTP time */ typedef void (* gps_request_utc_time)(); /** Callback for creating a thread that can call into the Java framework code. * This must be used to create any threads that report events up to the framework. */ typedef pthread_t (* gps_create_thread)(const char* name, void (*start)(void *), void* arg); /** GPS callback structure. */ typedef struct { /** set to sizeof(GpsCallbacks) */ size_t size; gps_location_callback location_cb; gps_status_callback status_cb; gps_sv_status_callback sv_status_cb; gps_nmea_callback nmea_cb; gps_set_capabilities set_capabilities_cb; gps_acquire_wakelock acquire_wakelock_cb; gps_release_wakelock release_wakelock_cb; gps_create_thread create_thread_cb; gps_request_utc_time request_utc_time_cb; } GpsCallbacks; /** Represents the standard GPS interface. */ typedef struct { /** set to sizeof(GpsInterface) */ size_t size; /** * Opens the interface and provides the callback routines * to the implemenation of this interface. */ int (*init)( GpsCallbacks* callbacks ); /** Starts navigating. */ int (*start)( void ); /** Stops navigating. */ int (*stop)( void ); /** Closes the interface. */ void (*cleanup)( void ); /** Injects the current time. */ int (*inject_time)(GpsUtcTime time, int64_t timeReference, int uncertainty); /** Injects current location from another location provider * (typically cell ID). * latitude and longitude are measured in degrees * expected accuracy is measured in meters */ int (*inject_location)(double latitude, double longitude, float accuracy); /** * Specifies that the next call to start will not use the * information defined in the flags. GPS_DELETE_ALL is passed for * a cold start. */ void (*delete_aiding_data)(GpsAidingData flags); /** * min_interval represents the time between fixes in milliseconds. * preferred_accuracy represents the requested fix accuracy in meters. * preferred_time represents the requested time to first fix in milliseconds. */ int (*set_position_mode)(GpsPositionMode mode, GpsPositionRecurrence recurrence, uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time); /** Get a pointer to extension information. */ const void* (*get_extension)(const char* name); } GpsInterface; /** Callback to request the client to download XTRA data. * The client should download XTRA data and inject it by calling inject_xtra_data(). * Can only be called from a thread created by create_thread_cb. */ typedef void (* gps_xtra_download_request)(); /** Callback structure for the XTRA interface. */ typedef struct { gps_xtra_download_request download_request_cb; gps_create_thread create_thread_cb; } GpsXtraCallbacks; /** Extended interface for XTRA support. */ typedef struct { /** set to sizeof(GpsXtraInterface) */ size_t size; /** * Opens the XTRA interface and provides the callback routines * to the implemenation of this interface. */ int (*init)( GpsXtraCallbacks* callbacks ); /** Injects XTRA data into the GPS. */ int (*inject_xtra_data)( char* data, int length ); } GpsXtraInterface; /** Extended interface for DEBUG support. */ typedef struct { /** set to sizeof(GpsDebugInterface) */ size_t size; /** * This function should return any information that the native * implementation wishes to include in a bugreport. */ size_t (*get_internal_state)(char* buffer, size_t bufferSize); } GpsDebugInterface; /** Represents the status of AGPS. */ typedef struct { /** set to sizeof(AGpsStatus) */ size_t size; AGpsType type; AGpsStatusValue status; uint32_t ipaddr; } AGpsStatus; /** Callback with AGPS status information. * Can only be called from a thread created by create_thread_cb. */ typedef void (* agps_status_callback)(AGpsStatus* status); /** Callback structure for the AGPS interface. */ typedef struct { agps_status_callback status_cb; gps_create_thread create_thread_cb; } AGpsCallbacks; /** Extended interface for AGPS support. */ typedef struct { /** set to sizeof(AGpsInterface) */ size_t size; /** * Opens the AGPS interface and provides the callback routines * to the implemenation of this interface. */ void (*init)( AGpsCallbacks* callbacks ); /** * Notifies that a data connection is available and sets * the name of the APN to be used for SUPL. */ int (*data_conn_open)( const char* apn ); /** * Notifies that the AGPS data connection has been closed. */ int (*data_conn_closed)(); /** * Notifies that a data connection is not available for AGPS. */ int (*data_conn_failed)(); /** * Sets the hostname and port for the AGPS server. */ int (*set_server)( AGpsType type, const char* hostname, int port ); } AGpsInterface; /** Represents an NI request */ typedef struct { /** set to sizeof(GpsNiNotification) */ size_t size; /** * An ID generated by HAL to associate NI notifications and UI * responses */ int notification_id; /** * An NI type used to distinguish different categories of NI * events, such as GPS_NI_TYPE_VOICE, GPS_NI_TYPE_UMTS_SUPL, ... */ GpsNiType ni_type; /** * Notification/verification options, combinations of GpsNiNotifyFlags constants */ GpsNiNotifyFlags notify_flags; /** * Timeout period to wait for user response. * Set to 0 for no time out limit. */ int timeout; /** * Default response when time out. */ GpsUserResponseType default_response; /** * Requestor ID */ char requestor_id[GPS_NI_SHORT_STRING_MAXLEN]; /** * Notification message. It can also be used to store client_id in some cases */ char text[GPS_NI_LONG_STRING_MAXLEN]; /** * Client name decoding scheme */ GpsNiEncodingType requestor_id_encoding; /** * Client name decoding scheme */ GpsNiEncodingType text_encoding; /** * A pointer to extra data. Format: * key_1 = value_1 * key_2 = value_2 */ char extras[GPS_NI_LONG_STRING_MAXLEN]; } GpsNiNotification; /** Callback with NI notification. * Can only be called from a thread created by create_thread_cb. */ typedef void (*gps_ni_notify_callback)(GpsNiNotification *notification); /** GPS NI callback structure. */ typedef struct { /** * Sends the notification request from HAL to GPSLocationProvider. */ gps_ni_notify_callback notify_cb; gps_create_thread create_thread_cb; } GpsNiCallbacks; /** * Extended interface for Network-initiated (NI) support. */ typedef struct { /** set to sizeof(GpsNiInterface) */ size_t size; /** Registers the callbacks for HAL to use. */ void (*init) (GpsNiCallbacks *callbacks); /** Sends a response to HAL. */ void (*respond) (int notif_id, GpsUserResponseType user_response); } GpsNiInterface; struct gps_device_t { struct hw_device_t common; /** * Set the provided lights to the provided values. * * Returns: 0 on succes, error code on failure. */ const GpsInterface* (*get_gps_interface)(struct gps_device_t* dev); }; #define AGPS_RIL_REQUEST_SETID_IMSI (1<<0L) #define AGPS_RIL_REQUEST_SETID_MSISDN (1<<1L) #define AGPS_RIL_REQUEST_REFLOC_CELLID (1<<0L) #define AGPS_RIL_REQUEST_REFLOC_MAC (1<<1L) typedef void (*agps_ril_request_set_id)(uint32_t flags); typedef void (*agps_ril_request_ref_loc)(uint32_t flags); typedef struct { agps_ril_request_set_id request_setid; agps_ril_request_ref_loc request_refloc; gps_create_thread create_thread_cb; } AGpsRilCallbacks; /** Extended interface for AGPS_RIL support. */ typedef struct { /** set to sizeof(AGpsRilInterface) */ size_t size; /** * Opens the AGPS interface and provides the callback routines * to the implemenation of this interface. */ void (*init)( AGpsRilCallbacks* callbacks ); /** * Sets the reference location. */ void (*set_ref_location) (const AGpsRefLocation *agps_reflocation, size_t sz_struct); /** * Sets the set ID. */ void (*set_set_id) (AGpsSetIDType type, const char* setid); /** * Send network initiated message. */ void (*ni_message) (uint8_t *msg, size_t len); /** * Notify GPS of network status changes. * These parameters match values in the android.net.NetworkInfo class. */ void (*update_network_state) (int connected, int type, int roaming, const char* extra_info); /** * Notify GPS of network status changes. * These parameters match values in the android.net.NetworkInfo class. */ void (*update_network_availability) (int avaiable, const char* apn); } AGpsRilInterface; __END_DECLS #endif /* ANDROID_INCLUDE_HARDWARE_GPS_H */ android-audiosystem-1.8+13.10.20130807/include/hardware/audio.h0000644000015700001700000005535612200324306024402 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * Copyright (c) 2012, Code Aurora Forum. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_HAL_INTERFACE_H #define ANDROID_AUDIO_HAL_INTERFACE_H #include #include #include #include #include #include #include #include #include __BEGIN_DECLS /** * The id of this module */ #define AUDIO_HARDWARE_MODULE_ID "audio" /** * Name of the audio devices to open */ #define AUDIO_HARDWARE_INTERFACE "audio_hw_if" /* Use version 0.1 to be compatible with first generation of audio hw module with version_major * hardcoded to 1. No audio module API change. */ #define AUDIO_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1) #define AUDIO_MODULE_API_VERSION_CURRENT AUDIO_MODULE_API_VERSION_0_1 /* First generation of audio devices had version hardcoded to 0. all devices with versions < 1.0 * will be considered of first generation API. */ #define AUDIO_DEVICE_API_VERSION_0_0 HARDWARE_DEVICE_API_VERSION(0, 0) #define AUDIO_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0) #define AUDIO_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0) #ifndef ICS_AUDIO_BLOB #define AUDIO_DEVICE_API_VERSION_CURRENT AUDIO_DEVICE_API_VERSION_2_0 #else #define AUDIO_DEVICE_API_VERSION_CURRENT AUDIO_DEVICE_API_VERSION_1_0 #endif /** * List of known audio HAL modules. This is the base name of the audio HAL * library composed of the "audio." prefix, one of the base names below and * a suffix specific to the device. * e.g: audio.primary.goldfish.so or audio.a2dp.default.so */ #define AUDIO_HARDWARE_MODULE_ID_PRIMARY "primary" #define AUDIO_HARDWARE_MODULE_ID_A2DP "a2dp" #define AUDIO_HARDWARE_MODULE_ID_USB "usb" #define AUDIO_HARDWARE_MODULE_ID_REMOTE_SUBMIX "r_submix" /**************************************/ /** * standard audio parameters that the HAL may need to handle */ /** * audio device parameters */ /* BT SCO Noise Reduction + Echo Cancellation parameters */ #define AUDIO_PARAMETER_KEY_BT_NREC "bt_headset_nrec" #define AUDIO_PARAMETER_VALUE_ON "on" #define AUDIO_PARAMETER_VALUE_OFF "off" /* TTY mode selection */ #define AUDIO_PARAMETER_KEY_TTY_MODE "tty_mode" #define AUDIO_PARAMETER_VALUE_TTY_OFF "tty_off" #define AUDIO_PARAMETER_VALUE_TTY_VCO "tty_vco" #define AUDIO_PARAMETER_VALUE_TTY_HCO "tty_hco" #define AUDIO_PARAMETER_VALUE_TTY_FULL "tty_full" /* A2DP sink address set by framework */ #define AUDIO_PARAMETER_A2DP_SINK_ADDRESS "a2dp_sink_address" /* Screen state */ #define AUDIO_PARAMETER_KEY_SCREEN_STATE "screen_state" /** * audio stream parameters */ #define AUDIO_PARAMETER_STREAM_ROUTING "routing" // audio_devices_t #define AUDIO_PARAMETER_STREAM_FORMAT "format" // audio_format_t #define AUDIO_PARAMETER_STREAM_CHANNELS "channels" // audio_channel_mask_t #define AUDIO_PARAMETER_STREAM_FRAME_COUNT "frame_count" // size_t #define AUDIO_PARAMETER_STREAM_INPUT_SOURCE "input_source" // audio_source_t #define AUDIO_PARAMETER_STREAM_SAMPLING_RATE "sampling_rate" // uint32_t /* Query supported formats. The response is a '|' separated list of strings from * audio_format_t enum e.g: "sup_formats=AUDIO_FORMAT_PCM_16_BIT" */ #define AUDIO_PARAMETER_STREAM_SUP_FORMATS "sup_formats" /* Query supported channel masks. The response is a '|' separated list of strings from * audio_channel_mask_t enum e.g: "sup_channels=AUDIO_CHANNEL_OUT_STEREO|AUDIO_CHANNEL_OUT_MONO" */ #define AUDIO_PARAMETER_STREAM_SUP_CHANNELS "sup_channels" /* Query supported sampling rates. The response is a '|' separated list of integer values e.g: * "sup_sampling_rates=44100|48000" */ #define AUDIO_PARAMETER_STREAM_SUP_SAMPLING_RATES "sup_sampling_rates" /* Query handle fm parameter*/ #define AUDIO_PARAMETER_KEY_HANDLE_FM "handle_fm" /* Query voip flag */ #define AUDIO_PARAMETER_KEY_VOIP_CHECK "voip_flag" /* Query Fluence type */ #define AUDIO_PARAMETER_KEY_FLUENCE_TYPE "fluence" /* Query if surround sound recording is supported */ #define AUDIO_PARAMETER_KEY_SSR "ssr" /* Query if a2dp is supported */ #define AUDIO_PARAMETER_KEY_HANDLE_A2DP_DEVICE "isA2dpDeviceSupported" /**************************************/ /* common audio stream configuration parameters */ struct audio_config { uint32_t sample_rate; audio_channel_mask_t channel_mask; audio_format_t format; }; typedef struct audio_config audio_config_t; #ifdef QCOM_HARDWARE typedef struct buf_info; #endif /* common audio stream parameters and operations */ struct audio_stream { /** * Return the sampling rate in Hz - eg. 44100. */ uint32_t (*get_sample_rate)(const struct audio_stream *stream); /* currently unused - use set_parameters with key * AUDIO_PARAMETER_STREAM_SAMPLING_RATE */ int (*set_sample_rate)(struct audio_stream *stream, uint32_t rate); /** * Return size of input/output buffer in bytes for this stream - eg. 4800. * It should be a multiple of the frame size. See also get_input_buffer_size. */ size_t (*get_buffer_size)(const struct audio_stream *stream); /** * Return the channel mask - * e.g. AUDIO_CHANNEL_OUT_STEREO or AUDIO_CHANNEL_IN_STEREO */ audio_channel_mask_t (*get_channels)(const struct audio_stream *stream); /** * Return the audio format - e.g. AUDIO_FORMAT_PCM_16_BIT */ audio_format_t (*get_format)(const struct audio_stream *stream); /* currently unused - use set_parameters with key * AUDIO_PARAMETER_STREAM_FORMAT */ int (*set_format)(struct audio_stream *stream, audio_format_t format); /** * Put the audio hardware input/output into standby mode. * Driver should exit from standby mode at the next I/O operation. * Returns 0 on success and <0 on failure. */ int (*standby)(struct audio_stream *stream); /** dump the state of the audio input/output device */ int (*dump)(const struct audio_stream *stream, int fd); /** Return the set of device(s) which this stream is connected to */ audio_devices_t (*get_device)(const struct audio_stream *stream); /** * Currently unused - set_device() corresponds to set_parameters() with key * AUDIO_PARAMETER_STREAM_ROUTING for both input and output. * AUDIO_PARAMETER_STREAM_INPUT_SOURCE is an additional information used by * input streams only. */ int (*set_device)(struct audio_stream *stream, audio_devices_t device); /** * set/get audio stream parameters. The function accepts a list of * parameter key value pairs in the form: key1=value1;key2=value2;... * * Some keys are reserved for standard parameters (See AudioParameter class) * * If the implementation does not accept a parameter change while * the output is active but the parameter is acceptable otherwise, it must * return -ENOSYS. * * The audio flinger will put the stream in standby and then change the * parameter value. */ int (*set_parameters)(struct audio_stream *stream, const char *kv_pairs); /* * Returns a pointer to a heap allocated string. The caller is responsible * for freeing the memory for it using free(). */ char * (*get_parameters)(const struct audio_stream *stream, const char *keys); int (*add_audio_effect)(const struct audio_stream *stream, effect_handle_t effect); int (*remove_audio_effect)(const struct audio_stream *stream, effect_handle_t effect); }; typedef struct audio_stream audio_stream_t; /** * audio_stream_out is the abstraction interface for the audio output hardware. * * It provides information about various properties of the audio output * hardware driver. */ struct audio_stream_out { struct audio_stream common; /** * Return the audio hardware driver estimated latency in milliseconds. */ uint32_t (*get_latency)(const struct audio_stream_out *stream); /** * Use this method in situations where audio mixing is done in the * hardware. This method serves as a direct interface with hardware, * allowing you to directly set the volume as apposed to via the framework. * This method might produce multiple PCM outputs or hardware accelerated * codecs, such as MP3 or AAC. */ int (*set_volume)(struct audio_stream_out *stream, float left, float right); /** * Write audio buffer to driver. Returns number of bytes written, or a * negative status_t. If at least one frame was written successfully prior to the error, * it is suggested that the driver return that successful (short) byte count * and then return an error in the subsequent call. */ ssize_t (*write)(struct audio_stream_out *stream, const void* buffer, size_t bytes); /* return the number of audio frames written by the audio dsp to DAC since * the output has exited standby */ int (*get_render_position)(const struct audio_stream_out *stream, uint32_t *dsp_frames); #ifdef QCOM_HARDWARE /** * start audio data rendering */ int (*start)(struct audio_stream_out *stream); /** * pause audio rendering */ int (*pause)(struct audio_stream_out *stream); /** * flush audio data with driver */ int (*flush)(struct audio_stream_out *stream); /** * stop audio data rendering */ int (*stop)(struct audio_stream_out *stream); #endif /** * get the local time at which the next write to the audio driver will be presented. * The units are microseconds, where the epoch is decided by the local audio HAL. */ int (*get_next_write_timestamp)(const struct audio_stream_out *stream, int64_t *timestamp); #ifdef QCOM_HARDWARE /** * return the current timestamp after quering to the driver */ int (*get_time_stamp)(const struct audio_stream_out *stream, uint64_t *time_stamp); /** * EOS notification from HAL to Player */ int (*set_observer)(const struct audio_stream_out *stream, void *observer); /** * Get the physical address of the buffer allocated in the * driver */ int (*get_buffer_info) (const struct audio_stream_out *stream, struct buf_info **buf); /** * Check if next buffer is available. Waits until next buffer is * available */ int (*is_buffer_available) (const struct audio_stream_out *stream, int *isAvail); #endif }; typedef struct audio_stream_out audio_stream_out_t; #ifdef QCOM_HARDWARE /** * audio_broadcast_stream is the abstraction interface for the * audio output hardware. * * It provides information about various properties of the audio output * hardware driver. */ struct audio_broadcast_stream { struct audio_stream common; /** * return the audio hardware driver latency in milli seconds. */ uint32_t (*get_latency)(const struct audio_broadcast_stream *stream); /** * Use this method in situations where audio mixing is done in the * hardware. This method serves as a direct interface with hardware, * allowing you to directly set the volume as apposed to via the framework. * This method might produce multiple PCM outputs or hardware accelerated * codecs, such as MP3 or AAC. */ int (*set_volume)(struct audio_broadcast_stream *stream, float left, float right); int (*mute)(struct audio_broadcast_stream *stream, bool mute); int (*start)(struct audio_broadcast_stream *stream, int64_t absTimeToStart); /** * write audio buffer to driver. Returns number of bytes written */ ssize_t (*write)(struct audio_broadcast_stream *stream, const void* buffer, size_t bytes, int64_t timestamp, int audioType); }; typedef struct audio_broadcast_stream audio_broadcast_stream_t; #endif struct audio_stream_in { struct audio_stream common; /** set the input gain for the audio driver. This method is for * for future use */ int (*set_gain)(struct audio_stream_in *stream, float gain); /** Read audio buffer in from audio driver. Returns number of bytes read, or a * negative status_t. If at least one frame was read prior to the error, * read should return that byte count and then return an error in the subsequent call. */ ssize_t (*read)(struct audio_stream_in *stream, void* buffer, size_t bytes); /** * Return the amount of input frames lost in the audio driver since the * last call of this function. * Audio driver is expected to reset the value to 0 and restart counting * upon returning the current value by this function call. * Such loss typically occurs when the user space process is blocked * longer than the capacity of audio driver buffers. * * Unit: the number of input audio frames */ uint32_t (*get_input_frames_lost)(struct audio_stream_in *stream); }; typedef struct audio_stream_in audio_stream_in_t; /** * return the frame size (number of bytes per sample). */ static inline size_t audio_stream_frame_size(const struct audio_stream *s) { size_t chan_samp_sz; uint32_t chan_mask = s->get_channels(s); int format = s->get_format(s); #ifdef QCOM_HARDWARE if (!s) return 0; if (audio_is_input_channel(chan_mask)) { chan_mask &= (AUDIO_CHANNEL_IN_STEREO | \ AUDIO_CHANNEL_IN_MONO | \ AUDIO_CHANNEL_IN_5POINT1); } if(!strncmp(s->get_parameters(s, "voip_flag"),"voip_flag=1",sizeof("voip_flag=1"))) { if(format != AUDIO_FORMAT_PCM_8_BIT) return popcount(chan_mask) * sizeof(int16_t); else return popcount(chan_mask) * sizeof(int8_t); } #endif switch (format) { #ifdef QCOM_HARDWARE case AUDIO_FORMAT_AMR_NB: chan_samp_sz = 32; break; case AUDIO_FORMAT_EVRC: chan_samp_sz = 23; break; case AUDIO_FORMAT_QCELP: chan_samp_sz = 35; break; #endif case AUDIO_FORMAT_PCM_16_BIT: chan_samp_sz = sizeof(int16_t); break; case AUDIO_FORMAT_PCM_8_BIT: default: chan_samp_sz = sizeof(int8_t); break; } return popcount(chan_mask) * chan_samp_sz; } /**********************************************************************/ /** * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM * and the fields of this data structure must begin with hw_module_t * followed by module specific information. */ struct audio_module { struct hw_module_t common; }; struct audio_hw_device { struct hw_device_t common; /** * used by audio flinger to enumerate what devices are supported by * each audio_hw_device implementation. * * Return value is a bitmask of 1 or more values of audio_devices_t * * NOTE: audio HAL implementations starting with * AUDIO_DEVICE_API_VERSION_2_0 do not implement this function. * All supported devices should be listed in audio_policy.conf * file and the audio policy manager must choose the appropriate * audio module based on information in this file. */ uint32_t (*get_supported_devices)(const struct audio_hw_device *dev); /** * check to see if the audio hardware interface has been initialized. * returns 0 on success, -ENODEV on failure. */ int (*init_check)(const struct audio_hw_device *dev); /** set the audio volume of a voice call. Range is between 0.0 and 1.0 */ int (*set_voice_volume)(struct audio_hw_device *dev, float volume); /** * set the audio volume for all audio activities other than voice call. * Range between 0.0 and 1.0. If any value other than 0 is returned, * the software mixer will emulate this capability. */ int (*set_master_volume)(struct audio_hw_device *dev, float volume); #ifndef ICS_AUDIO_BLOB /** * Get the current master volume value for the HAL, if the HAL supports * master volume control. AudioFlinger will query this value from the * primary audio HAL when the service starts and use the value for setting * the initial master volume across all HALs. HALs which do not support * this method may leave it set to NULL. */ int (*get_master_volume)(struct audio_hw_device *dev, float *volume); #endif #ifdef QCOM_FM_ENABLED /** set the fm audio volume. Range is between 0.0 and 1.0 */ int (*set_fm_volume)(struct audio_hw_device *dev, float volume); #endif /** * set_mode is called when the audio mode changes. AUDIO_MODE_NORMAL mode * is for standard audio playback, AUDIO_MODE_RINGTONE when a ringtone is * playing, and AUDIO_MODE_IN_CALL when a call is in progress. */ int (*set_mode)(struct audio_hw_device *dev, audio_mode_t mode); /* mic mute */ int (*set_mic_mute)(struct audio_hw_device *dev, bool state); int (*get_mic_mute)(const struct audio_hw_device *dev, bool *state); /* set/get global audio parameters */ int (*set_parameters)(struct audio_hw_device *dev, const char *kv_pairs); /* * Returns a pointer to a heap allocated string. The caller is responsible * for freeing the memory for it using free(). */ char * (*get_parameters)(const struct audio_hw_device *dev, const char *keys); /* Returns audio input buffer size according to parameters passed or * 0 if one of the parameters is not supported. * See also get_buffer_size which is for a particular stream. */ size_t (*get_input_buffer_size)(const struct audio_hw_device *dev, #ifndef ICS_AUDIO_BLOB const struct audio_config *config); #else uint32_t sample_rate, int format, int channel_count); #endif /** This method creates and opens the audio hardware output stream */ #ifndef ICS_AUDIO_BLOB int (*open_output_stream)(struct audio_hw_device *dev, audio_io_handle_t handle, audio_devices_t devices, audio_output_flags_t flags, struct audio_config *config, struct audio_stream_out **stream_out); #else int (*open_output_stream)(struct audio_hw_device *dev, uint32_t devices, int *format, uint32_t *channels, uint32_t *sample_rate, struct audio_stream_out **out); #endif #ifdef QCOM_ICS_LPA_COMPAT /** This method creates and opens the audio hardware output session */ int (*open_output_session)(struct audio_hw_device *dev, uint32_t devices, int *format, int sessionId, struct audio_stream_out **out); #endif void (*close_output_stream)(struct audio_hw_device *dev, struct audio_stream_out* stream_out); #ifdef QCOM_HARDWARE /** This method creates and opens the audio hardware output * for broadcast stream */ int (*open_broadcast_stream)(struct audio_hw_device *dev, uint32_t devices, int format, uint32_t channels, uint32_t sample_rate, uint32_t audio_source, struct audio_broadcast_stream **out); void (*close_broadcast_stream)(struct audio_hw_device *dev, struct audio_broadcast_stream *out); #endif /** This method creates and opens the audio hardware input stream */ #ifndef ICS_AUDIO_BLOB int (*open_input_stream)(struct audio_hw_device *dev, audio_io_handle_t handle, audio_devices_t devices, struct audio_config *config, struct audio_stream_in **stream_in); #else int (*open_input_stream)(struct audio_hw_device *dev, uint32_t devices, int *format, uint32_t *channels, uint32_t *sample_rate, audio_in_acoustics_t acoustics, struct audio_stream_in **stream_in); #endif void (*close_input_stream)(struct audio_hw_device *dev, struct audio_stream_in *stream_in); /** This method dumps the state of the audio hardware */ int (*dump)(const struct audio_hw_device *dev, int fd); #ifndef ICS_AUDIO_BLOB /** * set the audio mute status for all audio activities. If any value other * than 0 is returned, the software mixer will emulate this capability. */ int (*set_master_mute)(struct audio_hw_device *dev, bool mute); /** * Get the current master mute status for the HAL, if the HAL supports * master mute control. AudioFlinger will query this value from the primary * audio HAL when the service starts and use the value for setting the * initial master mute across all HALs. HALs which do not support this * method may leave it set to NULL. */ int (*get_master_mute)(struct audio_hw_device *dev, bool *mute); #endif }; typedef struct audio_hw_device audio_hw_device_t; /** convenience API for opening and closing a supported device */ static inline int audio_hw_device_open(const struct hw_module_t* module, struct audio_hw_device** device) { return module->methods->open(module, AUDIO_HARDWARE_INTERFACE, (struct hw_device_t**)device); } static inline int audio_hw_device_close(struct audio_hw_device* device) { return device->common.close(&device->common); } #ifdef QCOM_HARDWARE /** Structure to save buffer information for applying effects for * LPA buffers */ struct buf_info { int bufsize; int nBufs; int **buffers; }; #ifdef __cplusplus /** *Observer class to post the Events from HAL to Flinger */ class AudioEventObserver { public: virtual ~AudioEventObserver() {} virtual void postEOS(int64_t delayUs) = 0; }; #endif #endif __END_DECLS #endif // ANDROID_AUDIO_INTERFACE_H android-audiosystem-1.8+13.10.20130807/include/hardware/hwcomposer.h0000644000015700001700000005410112200324306025452 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_H #define ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_H #include #include #include #include #include #include __BEGIN_DECLS /*****************************************************************************/ /* for compatibility */ #define HWC_MODULE_API_VERSION HWC_MODULE_API_VERSION_0_1 #define HWC_DEVICE_API_VERSION HWC_DEVICE_API_VERSION_0_1 #define HWC_API_VERSION HWC_DEVICE_API_VERSION /* Users of this header can define HWC_REMOVE_DEPRECATED_VERSIONS to test that * they still work with just the current version declared, before the * deprecated versions are actually removed. * * To find code that still depends on the old versions, set the #define to 1 * here. Code that explicitly sets it to zero (rather than simply not defining * it) will still see the old versions. */ #if !defined(HWC_REMOVE_DEPRECATED_VERSIONS) #define HWC_REMOVE_DEPRECATED_VERSIONS 0 #endif /*****************************************************************************/ /** * The id of this module */ #define HWC_HARDWARE_MODULE_ID "hwcomposer" /** * Name of the sensors device to open */ #define HWC_HARDWARE_COMPOSER "composer" typedef struct hwc_rect { int left; int top; int right; int bottom; } hwc_rect_t; typedef struct hwc_region { size_t numRects; hwc_rect_t const* rects; } hwc_region_t; typedef struct hwc_color { uint8_t r; uint8_t g; uint8_t b; uint8_t a; } hwc_color_t; typedef struct hwc_layer_1 { /* * Initially set to HWC_FRAMEBUFFER, HWC_BACKGROUND, or * HWC_FRAMEBUFFER_TARGET. * * HWC_FRAMEBUFFER * Indicates the layer will be drawn into the framebuffer * using OpenGL ES. The HWC can toggle this value to HWC_OVERLAY to * indicate it will handle the layer. * * HWC_BACKGROUND * Indicates this is a special "background" layer. The only valid field * is backgroundColor. The HWC can toggle this value to HWC_FRAMEBUFFER * to indicate it CANNOT handle the background color. * * HWC_FRAMEBUFFER_TARGET * Indicates this layer is the framebuffer surface used as the target of * OpenGL ES composition. If the HWC sets all other layers to HWC_OVERLAY * or HWC_BACKGROUND, then no OpenGL ES composition will be done, and * this layer should be ignored during set(). * * This flag (and the framebuffer surface layer) will only be used if the * HWC version is HWC_DEVICE_API_VERSION_1_1 or higher. In older versions, * the OpenGL ES target surface is communicated by the (dpy, sur) fields * in hwc_compositor_device_1_t. */ int32_t compositionType; /* see hwc_layer_t::hints above */ uint32_t hints; /* see hwc_layer_t::flags above */ uint32_t flags; union { /* color of the background. hwc_color_t.a is ignored */ hwc_color_t backgroundColor; struct { /* handle of buffer to compose. This handle is guaranteed to have been * allocated from gralloc using the GRALLOC_USAGE_HW_COMPOSER usage flag. If * the layer's handle is unchanged across two consecutive prepare calls and * the HWC_GEOMETRY_CHANGED flag is not set for the second call then the * HWComposer implementation may assume that the contents of the buffer have * not changed. */ buffer_handle_t handle; /* transformation to apply to the buffer during composition */ uint32_t transform; #ifdef QCOM_HARDWARE /* source transform of the buffer */ uint32_t sourceTransform; #endif /* blending to apply during composition */ int32_t blending; /* area of the source to consider, the origin is the top-left corner of * the buffer */ hwc_rect_t sourceCrop; /* where to composite the sourceCrop onto the display. The sourceCrop * is scaled using linear filtering to the displayFrame. The origin is the * top-left corner of the screen. */ hwc_rect_t displayFrame; /* visible region in screen space. The origin is the * top-left corner of the screen. * The visible region INCLUDES areas overlapped by a translucent layer. */ hwc_region_t visibleRegionScreen; /* Sync fence object that will be signaled when the buffer's * contents are available. May be -1 if the contents are already * available. This field is only valid during set(), and should be * ignored during prepare(). The set() call must not wait for the * fence to be signaled before returning, but the HWC must wait for * all buffers to be signaled before reading from them. * * HWC_FRAMEBUFFER layers will never have an acquire fence, since * reads from them are complete before the framebuffer is ready for * display. * * The HWC takes ownership of the acquireFenceFd and is responsible * for closing it when no longer needed. */ int acquireFenceFd; /* During set() the HWC must set this field to a file descriptor for * a sync fence object that will signal after the HWC has finished * reading from the buffer. The field is ignored by prepare(). Each * layer should have a unique file descriptor, even if more than one * refer to the same underlying fence object; this allows each to be * closed independently. * * If buffer reads can complete at significantly different times, * then using independent fences is preferred. For example, if the * HWC handles some layers with a blit engine and others with * overlays, then the blit layers can be reused immediately after * the blit completes, but the overlay layers can't be reused until * a subsequent frame has been displayed. * * Since HWC doesn't read from HWC_FRAMEBUFFER layers, it shouldn't * produce a release fence for them. The releaseFenceFd will be -1 * for these layers when set() is called. * * The HWC client taks ownership of the releaseFenceFd and is * responsible for closing it when no longer needed. */ int releaseFenceFd; }; }; /* Allow for expansion w/o breaking binary compatibility. * Pad layer to 96 bytes, assuming 32-bit pointers. */ int32_t reserved[24 - 18]; } hwc_layer_1_t; /* This represents a display, typically an EGLDisplay object */ typedef void* hwc_display_t; /* This represents a surface, typically an EGLSurface object */ typedef void* hwc_surface_t; /* * hwc_display_contents_1_t::flags values */ enum { /* * HWC_GEOMETRY_CHANGED is set by SurfaceFlinger to indicate that the list * passed to (*prepare)() has changed by more than just the buffer handles * and acquire fences. */ HWC_GEOMETRY_CHANGED = 0x00000001, }; /* * Description of the contents to output on a display. * * This is the top-level structure passed to the prepare and set calls to * negotiate and commit the composition of a display image. */ typedef struct hwc_display_contents_1 { /* File descriptor referring to a Sync HAL fence object which will signal * when this composition is retired. For a physical display, a composition * is retired when it has been replaced on-screen by a subsequent set. For * a virtual display, the composition is retired when the writes to * outputBuffer are complete and can be read. The fence object is created * and returned by the set call; this field will be -1 on entry to prepare * and set. SurfaceFlinger will close the returned file descriptor. */ int retireFenceFd; union { /* Fields only relevant for HWC_DEVICE_VERSION_1_0. */ struct { /* (dpy, sur) is the target of SurfaceFlinger's OpenGL ES * composition for HWC_DEVICE_VERSION_1_0. They aren't relevant to * prepare. The set call should commit this surface atomically to * the display along with any overlay layers. */ hwc_display_t dpy; hwc_surface_t sur; }; /* Fields only relevant for HWC_DEVICE_VERSION_1_2 and later. */ struct { /* outbuf is the buffer that receives the composed image for * virtual displays. Writes to the outbuf must wait until * outbufAcquireFenceFd signals. A fence that will signal when * writes to outbuf are complete should be returned in * retireFenceFd. * * For physical displays, outbuf will be NULL. */ buffer_handle_t outbuf; /* File descriptor for a fence that will signal when outbuf is * ready to be written. The h/w composer is responsible for closing * this when no longer needed. * * Will be -1 whenever outbuf is NULL, or when the outbuf can be * written immediately. */ int outbufAcquireFenceFd; }; }; /* List of layers that will be composed on the display. The buffer handles * in the list will be unique. If numHwLayers is 0, all composition will be * performed by SurfaceFlinger. */ uint32_t flags; size_t numHwLayers; hwc_layer_1_t hwLayers[0]; } hwc_display_contents_1_t; /* see hwc_composer_device::registerProcs() * All of the callbacks are required and non-NULL unless otherwise noted. */ typedef struct hwc_procs { /* * (*invalidate)() triggers a screen refresh, in particular prepare and set * will be called shortly after this call is made. Note that there is * NO GUARANTEE that the screen refresh will happen after invalidate() * returns (in particular, it could happen before). * invalidate() is GUARANTEED TO NOT CALL BACK into the h/w composer HAL and * it is safe to call invalidate() from any of hwc_composer_device * hooks, unless noted otherwise. */ void (*invalidate)(const struct hwc_procs* procs); /* * (*vsync)() is called by the h/w composer HAL when a vsync event is * received and HWC_EVENT_VSYNC is enabled on a display * (see: hwc_event_control). * * the "disp" parameter indicates which display the vsync event is for. * the "timestamp" parameter is the system monotonic clock timestamp in * nanosecond of when the vsync event happened. * * vsync() is GUARANTEED TO NOT CALL BACK into the h/w composer HAL. * * It is expected that vsync() is called from a thread of at least * HAL_PRIORITY_URGENT_DISPLAY with as little latency as possible, * typically less than 0.5 ms. * * It is a (silent) error to have HWC_EVENT_VSYNC enabled when calling * hwc_composer_device.set(..., 0, 0, 0) (screen off). The implementation * can either stop or continue to process VSYNC events, but must not * crash or cause other problems. */ void (*vsync)(const struct hwc_procs* procs, int disp, int64_t timestamp); /* * (*hotplug)() is called by the h/w composer HAL when a display is * connected or disconnected. The PRIMARY display is always connected and * the hotplug callback should not be called for it. * * The disp parameter indicates which display type this event is for. * The connected parameter indicates whether the display has just been * connected (1) or disconnected (0). * * The hotplug() callback may call back into the h/w composer on the same * thread to query refresh rate and dpi for the display. Additionally, * other threads may be calling into the h/w composer while the callback * is in progress. * * The h/w composer must serialize calls to the hotplug callback; only * one thread may call it at a time. * * This callback will be NULL if the h/w composer is using * HWC_DEVICE_API_VERSION_1_0. */ void (*hotplug)(const struct hwc_procs* procs, int disp, int connected); } hwc_procs_t; /*****************************************************************************/ typedef struct hwc_module { struct hw_module_t common; } hwc_module_t; typedef struct hwc_composer_device_1 { struct hw_device_t common; /* * (*prepare)() is called for each frame before composition and is used by * SurfaceFlinger to determine what composition steps the HWC can handle. * * (*prepare)() can be called more than once, the last call prevails. * * The HWC responds by setting the compositionType field in each layer to * either HWC_FRAMEBUFFER or HWC_OVERLAY. In the former case, the * composition for the layer is handled by SurfaceFlinger with OpenGL ES, * in the later case, the HWC will have to handle the layer's composition. * * (*prepare)() is called with HWC_GEOMETRY_CHANGED to indicate that the * list's geometry has changed, that is, when more than just the buffer's * handles have been updated. Typically this happens (but is not limited to) * when a window is added, removed, resized or moved. * * For HWC 1.0, numDisplays will always be one, and displays[0] will be * non-NULL. * * For HWC 1.1, numDisplays will always be HWC_NUM_DISPLAY_TYPES. Entries * for unsupported or disabled/disconnected display types will be NULL. * * For HWC 1.2 and later, numDisplays will be HWC_NUM_DISPLAY_TYPES or more. * The extra entries correspond to enabled virtual displays, and will be * non-NULL. In HWC 1.2, support for one virtual display is required, and * no more than one will be used. Future HWC versions might require more. * * returns: 0 on success. An negative error code on error. If an error is * returned, SurfaceFlinger will assume that none of the layer will be * handled by the HWC. */ int (*prepare)(struct hwc_composer_device_1 *dev, size_t numDisplays, hwc_display_contents_1_t** displays); /* * (*set)() is used in place of eglSwapBuffers(), and assumes the same * functionality, except it also commits the work list atomically with * the actual eglSwapBuffers(). * * The layer lists are guaranteed to be the same as the ones returned from * the last call to (*prepare)(). * * When this call returns the caller assumes that the displays will be * updated in the near future with the content of their work lists, without * artifacts during the transition from the previous frame. * * A display with zero layers indicates that the entire composition has * been handled by SurfaceFlinger with OpenGL ES. In this case, (*set)() * behaves just like eglSwapBuffers(). * * For HWC 1.0, numDisplays will always be one, and displays[0] will be * non-NULL. * * For HWC 1.1, numDisplays will always be HWC_NUM_DISPLAY_TYPES. Entries * for unsupported or disabled/disconnected display types will be NULL. * * For HWC 1.2 and later, numDisplays will be HWC_NUM_DISPLAY_TYPES or more. * The extra entries correspond to enabled virtual displays, and will be * non-NULL. In HWC 1.2, support for one virtual display is required, and * no more than one will be used. Future HWC versions might require more. * * IMPORTANT NOTE: There is an implicit layer containing opaque black * pixels behind all the layers in the list. It is the responsibility of * the hwcomposer module to make sure black pixels are output (or blended * from). * * IMPORTANT NOTE: In the event of an error this call *MUST* still cause * any fences returned in the previous call to set to eventually become * signaled. The caller may have already issued wait commands on these * fences, and having set return without causing those fences to signal * will likely result in a deadlock. * * returns: 0 on success. A negative error code on error: * HWC_EGL_ERROR: eglGetError() will provide the proper error code (only * allowed prior to HWComposer 1.1) * Another code for non EGL errors. */ int (*set)(struct hwc_composer_device_1 *dev, size_t numDisplays, hwc_display_contents_1_t** displays); /* * eventControl(..., event, enabled) * Enables or disables h/w composer events for a display. * * eventControl can be called from any thread and takes effect * immediately. * * Supported events are: * HWC_EVENT_VSYNC * * returns -EINVAL if the "event" parameter is not one of the value above * or if the "enabled" parameter is not 0 or 1. */ int (*eventControl)(struct hwc_composer_device_1* dev, int disp, int event, int enabled); /* * blank(..., blank) * Blanks or unblanks a display's screen. * * Turns the screen off when blank is nonzero, on when blank is zero. * Multiple sequential calls with the same blank value must be supported. * The screen state transition must be be complete when the function * returns. * * returns 0 on success, negative on error. */ int (*blank)(struct hwc_composer_device_1* dev, int disp, int blank); /* * Used to retrieve information about the h/w composer * * Returns 0 on success or -errno on error. */ int (*query)(struct hwc_composer_device_1* dev, int what, int* value); /* * (*registerProcs)() registers callbacks that the h/w composer HAL can * later use. It will be called immediately after the composer device is * opened with non-NULL procs. It is FORBIDDEN to call any of the callbacks * from within registerProcs(). registerProcs() must save the hwc_procs_t * pointer which is needed when calling a registered callback. */ void (*registerProcs)(struct hwc_composer_device_1* dev, hwc_procs_t const* procs); /* * This field is OPTIONAL and can be NULL. * * If non NULL it will be called by SurfaceFlinger on dumpsys */ void (*dump)(struct hwc_composer_device_1* dev, char *buff, int buff_len); /* * (*getDisplayConfigs)() returns handles for the configurations available * on the connected display. These handles must remain valid as long as the * display is connected. * * Configuration handles are written to configs. The number of entries * allocated by the caller is passed in *numConfigs; getDisplayConfigs must * not try to write more than this number of config handles. On return, the * total number of configurations available for the display is returned in * *numConfigs. If *numConfigs is zero on entry, then configs may be NULL. * * HWC_DEVICE_API_VERSION_1_1 does not provide a way to choose a config. * For displays that support multiple configurations, the h/w composer * implementation should choose one and report it as the first config in * the list. Reporting the not-chosen configs is not required. * * Returns 0 on success or -errno on error. If disp is a hotpluggable * display type and no display is connected, an error should be returned. * * This field is REQUIRED for HWC_DEVICE_API_VERSION_1_1 and later. * It should be NULL for previous versions. */ int (*getDisplayConfigs)(struct hwc_composer_device_1* dev, int disp, uint32_t* configs, size_t* numConfigs); /* * (*getDisplayAttributes)() returns attributes for a specific config of a * connected display. The config parameter is one of the config handles * returned by getDisplayConfigs. * * The list of attributes to return is provided in the attributes * parameter, terminated by HWC_DISPLAY_NO_ATTRIBUTE. The value for each * requested attribute is written in order to the values array. The * HWC_DISPLAY_NO_ATTRIBUTE attribute does not have a value, so the values * array will have one less value than the attributes array. * * This field is REQUIRED for HWC_DEVICE_API_VERSION_1_1 and later. * It should be NULL for previous versions. * * If disp is a hotpluggable display type and no display is connected, * or if config is not a valid configuration for the display, a negative * value should be returned. */ int (*getDisplayAttributes)(struct hwc_composer_device_1* dev, int disp, uint32_t config, const uint32_t* attributes, int32_t* values); /* * Reserved for future use. Must be NULL. */ void* reserved_proc[4]; } hwc_composer_device_1_t; /** convenience API for opening and closing a device */ static inline int hwc_open_1(const struct hw_module_t* module, hwc_composer_device_1_t** device) { return module->methods->open(module, HWC_HARDWARE_COMPOSER, (struct hw_device_t**)device); } static inline int hwc_close_1(hwc_composer_device_1_t* device) { return device->common.close(&device->common); } /*****************************************************************************/ #if !HWC_REMOVE_DEPRECATED_VERSIONS #include #endif __END_DECLS #endif /* ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_H */ android-audiosystem-1.8+13.10.20130807/include/hardware/bt_pan.h0000644000015700001700000000551312200324306024532 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_INCLUDE_BT_PAN_H #define ANDROID_INCLUDE_BT_PAN_H __BEGIN_DECLS #define BTPAN_ROLE_NONE 0 #define BTPAN_ROLE_PANNAP 1 #define BTPAN_ROLE_PANU 2 typedef enum { BTPAN_STATE_CONNECTED = 0, BTPAN_STATE_CONNECTING = 1, BTPAN_STATE_DISCONNECTED = 2, BTPAN_STATE_DISCONNECTING = 3 } btpan_connection_state_t; typedef enum { BTPAN_STATE_ENABLED = 0, BTPAN_STATE_DISABLED = 1 } btpan_control_state_t; /** * Callback for pan connection state */ typedef void (*btpan_connection_state_callback)(btpan_connection_state_t state, bt_status_t error, const bt_bdaddr_t *bd_addr, int local_role, int remote_role); typedef void (*btpan_control_state_callback)(btpan_control_state_t state, bt_status_t error, int local_role, const char* ifname); typedef struct { size_t size; btpan_control_state_callback control_state_cb; btpan_connection_state_callback connection_state_cb; } btpan_callbacks_t; typedef struct { /** set to size of this struct*/ size_t size; /** * Initialize the pan interface and register the btpan callbacks */ bt_status_t (*init)(const btpan_callbacks_t* callbacks); /* * enable the pan service by specified role. The result state of * enabl will be returned by btpan_control_state_callback. when pan-nap is enabled, * the state of connecting panu device will be notified by btpan_connection_state_callback */ bt_status_t (*enable)(int local_role); /* * get current pan local role */ int (*get_local_role)(void); /** * start bluetooth pan connection to the remote device by specified pan role. The result state will be * returned by btpan_connection_state_callback */ bt_status_t (*connect)(const bt_bdaddr_t *bd_addr, int local_role, int remote_role); /** * stop bluetooth pan connection. The result state will be returned by btpan_connection_state_callback */ bt_status_t (*disconnect)(const bt_bdaddr_t *bd_addr); /** * Cleanup the pan interface */ void (*cleanup)(void); } btpan_interface_t; __END_DECLS #endif /* ANDROID_INCLUDE_BT_PAN_H */ android-audiosystem-1.8+13.10.20130807/include/hardware/local_time_hal.h0000644000015700001700000000671712200324306026232 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_LOCAL_TIME_HAL_INTERFACE_H #define ANDROID_LOCAL_TIME_HAL_INTERFACE_H #include #include __BEGIN_DECLS /** * The id of this module */ #define LOCAL_TIME_HARDWARE_MODULE_ID "local_time" /** * Name of the local time devices to open */ #define LOCAL_TIME_HARDWARE_INTERFACE "local_time_hw_if" /**********************************************************************/ /** * A structure used to collect low level sync data in a lab environment. Most * HAL implementations will never need this structure. */ struct local_time_debug_event { int64_t local_timesync_event_id; int64_t local_time; }; /** * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM * and the fields of this data structure must begin with hw_module_t * followed by module specific information. */ struct local_time_module { struct hw_module_t common; }; struct local_time_hw_device { struct hw_device_t common; /** * * Returns the current value of the system wide local time counter */ int64_t (*get_local_time)(struct local_time_hw_device* dev); /** * * Returns the nominal frequency (in hertz) of the system wide local time * counter */ uint64_t (*get_local_freq)(struct local_time_hw_device* dev); /** * * Sets the HW slew rate of oscillator which drives the system wide local * time counter. On success, platforms should return 0. Platforms which * do not support HW slew should leave this method set to NULL. * * Valid values for rate range from MIN_INT16 to MAX_INT16. Platform * implementations should attempt map this range linearly to the min/max * slew rate of their hardware. */ int (*set_local_slew)(struct local_time_hw_device* dev, int16_t rate); /** * * A method used to collect low level sync data in a lab environments. * Most HAL implementations will simply set this member to NULL, or return * -EINVAL to indicate that this functionality is not supported. * Production HALs should never support this method. */ int (*get_debug_log)(struct local_time_hw_device* dev, struct local_time_debug_event* records, int max_records); }; typedef struct local_time_hw_device local_time_hw_device_t; /** convenience API for opening and closing a supported device */ static inline int local_time_hw_device_open( const struct hw_module_t* module, struct local_time_hw_device** device) { return module->methods->open(module, LOCAL_TIME_HARDWARE_INTERFACE, (struct hw_device_t**)device); } static inline int local_time_hw_device_close(struct local_time_hw_device* device) { return device->common.close(&device->common); } __END_DECLS #endif // ANDROID_LOCAL_TIME_INTERFACE_H android-audiosystem-1.8+13.10.20130807/include/hardware/sensors.h0000644000015700001700000003614012200324306024763 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_SENSORS_INTERFACE_H #define ANDROID_SENSORS_INTERFACE_H #include #include #include #include #include __BEGIN_DECLS /** * The id of this module */ #define SENSORS_HARDWARE_MODULE_ID "sensors" /** * Name of the sensors device to open */ #define SENSORS_HARDWARE_POLL "poll" /** * Handles must be higher than SENSORS_HANDLE_BASE and must be unique. * A Handle identifies a given sensors. The handle is used to activate * and/or deactivate sensors. * In this version of the API there can only be 256 handles. */ #define SENSORS_HANDLE_BASE 0 #define SENSORS_HANDLE_BITS 8 #define SENSORS_HANDLE_COUNT (1<0 * ^ * | * +-----------+--> y>0 * | | * | | * | | * | | / z<0 * | | / * | | / * O-----------+/ * |[] [ ] []/ * +----------/+ y<0 * / * / * |/ z>0 (toward the sky) * * O: Origin (x=0,y=0,z=0) * * * SENSOR_TYPE_ORIENTATION * ----------------------- * * All values are angles in degrees. * * Orientation sensors return sensor events for all 3 axes at a constant * rate defined by setDelay(). * * azimuth: angle between the magnetic north direction and the Y axis, around * the Z axis (0<=azimuth<360). * 0=North, 90=East, 180=South, 270=West * * pitch: Rotation around X axis (-180<=pitch<=180), with positive values when * the z-axis moves toward the y-axis. * * roll: Rotation around Y axis (-90<=roll<=90), with positive values when * the x-axis moves towards the z-axis. * * Note: For historical reasons the roll angle is positive in the clockwise * direction (mathematically speaking, it should be positive in the * counter-clockwise direction): * * Z * ^ * (+roll) .--> | * / | * | | roll: rotation around Y axis * X <-------(.) * Y * note that +Y == -roll * * * * Note: This definition is different from yaw, pitch and roll used in aviation * where the X axis is along the long side of the plane (tail to nose). * * * SENSOR_TYPE_ACCELEROMETER * ------------------------- * * All values are in SI units (m/s^2) and measure the acceleration of the * device minus the force of gravity. * * Acceleration sensors return sensor events for all 3 axes at a constant * rate defined by setDelay(). * * x: Acceleration minus Gx on the x-axis * y: Acceleration minus Gy on the y-axis * z: Acceleration minus Gz on the z-axis * * Examples: * When the device lies flat on a table and is pushed on its left side * toward the right, the x acceleration value is positive. * * When the device lies flat on a table, the acceleration value is +9.81, * which correspond to the acceleration of the device (0 m/s^2) minus the * force of gravity (-9.81 m/s^2). * * When the device lies flat on a table and is pushed toward the sky, the * acceleration value is greater than +9.81, which correspond to the * acceleration of the device (+A m/s^2) minus the force of * gravity (-9.81 m/s^2). * * * SENSOR_TYPE_MAGNETIC_FIELD * -------------------------- * * All values are in micro-Tesla (uT) and measure the ambient magnetic * field in the X, Y and Z axis. * * Magnetic Field sensors return sensor events for all 3 axes at a constant * rate defined by setDelay(). * * SENSOR_TYPE_GYROSCOPE * --------------------- * * All values are in radians/second and measure the rate of rotation * around the X, Y and Z axis. The coordinate system is the same as is * used for the acceleration sensor. Rotation is positive in the * counter-clockwise direction (right-hand rule). That is, an observer * looking from some positive location on the x, y or z axis at a device * positioned on the origin would report positive rotation if the device * appeared to be rotating counter clockwise. Note that this is the * standard mathematical definition of positive rotation and does not agree * with the definition of roll given earlier. * The range should at least be 17.45 rad/s (ie: ~1000 deg/s). * * SENSOR_TYPE_PROXIMITY * ---------------------- * * The distance value is measured in centimeters. Note that some proximity * sensors only support a binary "close" or "far" measurement. In this case, * the sensor should report its maxRange value in the "far" state and a value * less than maxRange in the "near" state. * * Proximity sensors report a value only when it changes and each time the * sensor is enabled. * * SENSOR_TYPE_LIGHT * ----------------- * * The light sensor value is returned in SI lux units. * * Light sensors report a value only when it changes and each time the * sensor is enabled. * * SENSOR_TYPE_PRESSURE * -------------------- * * The pressure sensor return the athmospheric pressure in hectopascal (hPa) * * Pressure sensors report events at a constant rate defined by setDelay(). * * SENSOR_TYPE_GRAVITY * ------------------- * * A gravity output indicates the direction of and magnitude of gravity in * the devices's coordinates. On Earth, the magnitude is 9.8 m/s^2. * Units are m/s^2. The coordinate system is the same as is used for the * acceleration sensor. When the device is at rest, the output of the * gravity sensor should be identical to that of the accelerometer. * * SENSOR_TYPE_LINEAR_ACCELERATION * -------------------------------- * * Indicates the linear acceleration of the device in device coordinates, * not including gravity. * This output is essentially Acceleration - Gravity. Units are m/s^2. * The coordinate system is the same as is used for the acceleration sensor. * * * SENSOR_TYPE_ROTATION_VECTOR * --------------------------- * * A rotation vector represents the orientation of the device as a combination * of an angle and an axis, in which the device has rotated through an angle * theta around an axis . The three elements of the rotation vector * are , such that the magnitude * of the rotation vector is equal to sin(theta/2), and the direction of the * rotation vector is equal to the direction of the axis of rotation. The three * elements of the rotation vector are equal to the last three components of a * unit quaternion . * Elements of the rotation vector are unitless. The x, y, and z axis are defined * in the same was as for the acceleration sensor. * * The reference coordinate system is defined as a direct orthonormal basis, * where: * * - X is defined as the vector product Y.Z (It is tangential to * the ground at the device's current location and roughly points East). * * - Y is tangential to the ground at the device's current location and * points towards the magnetic North Pole. * * - Z points towards the sky and is perpendicular to the ground. * * * The rotation-vector is stored as: * * sensors_event_t.data[0] = x*sin(theta/2) * sensors_event_t.data[1] = y*sin(theta/2) * sensors_event_t.data[2] = z*sin(theta/2) * sensors_event_t.data[3] = cos(theta/2) * * * SENSOR_TYPE_RELATIVE_HUMIDITY * ------------------------------ * * A relative humidity sensor measures relative ambient air humidity and * returns a value in percent. * * Relative humidity sensors report a value only when it changes and each * time the sensor is enabled. * * * SENSOR_TYPE_AMBIENT_TEMPERATURE * ------------------------------- * * The ambient (room) temperature in degree Celsius. * * Temperature sensors report a value only when it changes and each time the * sensor is enabled. * */ typedef struct { union { float v[3]; struct { float x; float y; float z; }; struct { float azimuth; float pitch; float roll; }; }; int8_t status; uint8_t reserved[3]; } sensors_vec_t; /** * Union of the various types of sensor data * that can be returned. */ typedef struct sensors_event_t { /* must be sizeof(struct sensors_event_t) */ int32_t version; /* sensor identifier */ int32_t sensor; /* sensor type */ int32_t type; /* reserved */ int32_t reserved0; /* time is in nanosecond */ int64_t timestamp; union { float data[16]; /* acceleration values are in meter per second per second (m/s^2) */ sensors_vec_t acceleration; /* magnetic vector values are in micro-Tesla (uT) */ sensors_vec_t magnetic; /* orientation values are in degrees */ sensors_vec_t orientation; /* gyroscope values are in rad/s */ sensors_vec_t gyro; /* temperature is in degrees centigrade (Celsius) */ float temperature; /* distance in centimeters */ float distance; /* light in SI lux units */ float light; /* pressure in hectopascal (hPa) */ float pressure; /* relative humidity in percent */ float relative_humidity; }; uint32_t reserved1[4]; } sensors_event_t; struct sensor_t; /** * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM * and the fields of this data structure must begin with hw_module_t * followed by module specific information. */ struct sensors_module_t { struct hw_module_t common; /** * Enumerate all available sensors. The list is returned in "list". * @return number of sensors in the list */ int (*get_sensors_list)(struct sensors_module_t* module, struct sensor_t const** list); }; struct sensor_t { /* name of this sensors */ const char* name; /* vendor of the hardware part */ const char* vendor; /* version of the hardware part + driver. The value of this field * must increase when the driver is updated in a way that changes the * output of this sensor. This is important for fused sensors when the * fusion algorithm is updated. */ int version; /* handle that identifies this sensors. This handle is used to activate * and deactivate this sensor. The value of the handle must be 8 bits * in this version of the API. */ int handle; /* this sensor's type. */ int type; /* maximaum range of this sensor's value in SI units */ float maxRange; /* smallest difference between two values reported by this sensor */ float resolution; /* rough estimate of this sensor's power consumption in mA */ float power; /* minimum delay allowed between events in microseconds. A value of zero * means that this sensor doesn't report events at a constant rate, but * rather only when a new data is available */ int32_t minDelay; /* reserved fields, must be zero */ void* reserved[8]; }; /** * Every device data structure must begin with hw_device_t * followed by module specific public methods and attributes. */ struct sensors_poll_device_t { struct hw_device_t common; /** Activate/deactivate one sensor. * * @param handle is the handle of the sensor to change. * @param enabled set to 1 to enable, or 0 to disable the sensor. * * @return 0 on success, negative errno code otherwise */ int (*activate)(struct sensors_poll_device_t *dev, int handle, int enabled); /** * Set the delay between sensor events in nanoseconds for a given sensor. * * If the requested value is less than sensor_t::minDelay, then it's * silently clamped to sensor_t::minDelay unless sensor_t::minDelay is * 0, in which case it is clamped to >= 1ms. * * @return 0 if successful, < 0 on error */ int (*setDelay)(struct sensors_poll_device_t *dev, int handle, int64_t ns); /** * Returns an array of sensor data. * This function must block until events are available. * * @return the number of events read on success, or -errno in case of an error. * This function should never return 0 (no event). * */ int (*poll)(struct sensors_poll_device_t *dev, sensors_event_t* data, int count); }; /** convenience API for opening and closing a device */ static inline int sensors_open(const struct hw_module_t* module, struct sensors_poll_device_t** device) { return module->methods->open(module, SENSORS_HARDWARE_POLL, (struct hw_device_t**)device); } static inline int sensors_close(struct sensors_poll_device_t* device) { return device->common.close(&device->common); } __END_DECLS #endif // ANDROID_SENSORS_INTERFACE_H android-audiosystem-1.8+13.10.20130807/include/hardware/hardware.h0000644000015700001700000001764112200324306025071 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_INCLUDE_HARDWARE_HARDWARE_H #define ANDROID_INCLUDE_HARDWARE_HARDWARE_H #include #include #include #include __BEGIN_DECLS /* * Value for the hw_module_t.tag field */ #define MAKE_TAG_CONSTANT(A,B,C,D) (((A) << 24) | ((B) << 16) | ((C) << 8) | (D)) #define HARDWARE_MODULE_TAG MAKE_TAG_CONSTANT('H', 'W', 'M', 'T') #define HARDWARE_DEVICE_TAG MAKE_TAG_CONSTANT('H', 'W', 'D', 'T') #ifdef QCOM_HARDWARE #define IS_TARGET_MPQ(status) \ { \ int id = 0; \ FILE *fp; \ if ((fp = fopen("/sys/devices/system/soc/soc0/id", "r")) != NULL) { \ fscanf(fp, "%d", &id); \ fclose(fp); \ } \ if (id == 130) \ status = 1; \ else \ status = 0;\ } #endif #define HARDWARE_MAKE_API_VERSION(maj,min) \ ((((maj) & 0xff) << 8) | ((min) & 0xff)) #define HARDWARE_MAKE_API_VERSION_2(maj,min,hdr) \ ((((maj) & 0xff) << 24) | (((min) & 0xff) << 16) | ((hdr) & 0xffff)) #define HARDWARE_API_VERSION_2_MAJ_MIN_MASK 0xffff0000 #define HARDWARE_API_VERSION_2_HEADER_MASK 0x0000ffff /* * The current HAL API version. * * All module implementations must set the hw_module_t.hal_api_version field * to this value when declaring the module with HAL_MODULE_INFO_SYM. * * Note that previous implementations have always set this field to 0. * Therefore, libhardware HAL API will always consider versions 0.0 and 1.0 * to be 100% binary compatible. * */ #define HARDWARE_HAL_API_VERSION HARDWARE_MAKE_API_VERSION(1, 0) /* * Helper macros for module implementors. * * The derived modules should provide convenience macros for supported * versions so that implementations can explicitly specify module/device * versions at definition time. * * Use this macro to set the hw_module_t.module_api_version field. */ #define HARDWARE_MODULE_API_VERSION(maj,min) HARDWARE_MAKE_API_VERSION(maj,min) #define HARDWARE_MODULE_API_VERSION_2(maj,min,hdr) HARDWARE_MAKE_API_VERSION_2(maj,min,hdr) /* * Use this macro to set the hw_device_t.version field */ #define HARDWARE_DEVICE_API_VERSION(maj,min) HARDWARE_MAKE_API_VERSION(maj,min) #define HARDWARE_DEVICE_API_VERSION_2(maj,min,hdr) HARDWARE_MAKE_API_VERSION_2(maj,min,hdr) struct hw_module_t; struct hw_module_methods_t; struct hw_device_t; /** * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM * and the fields of this data structure must begin with hw_module_t * followed by module specific information. */ typedef struct hw_module_t { /** tag must be initialized to HARDWARE_MODULE_TAG */ uint32_t tag; /** * The API version of the implemented module. The module owner is * responsible for updating the version when a module interface has * changed. * * The derived modules such as gralloc and audio own and manage this field. * The module user must interpret the version field to decide whether or * not to inter-operate with the supplied module implementation. * For example, SurfaceFlinger is responsible for making sure that * it knows how to manage different versions of the gralloc-module API, * and AudioFlinger must know how to do the same for audio-module API. * * The module API version should include a major and a minor component. * For example, version 1.0 could be represented as 0x0100. This format * implies that versions 0x0100-0x01ff are all API-compatible. * * In the future, libhardware will expose a hw_get_module_version() * (or equivalent) function that will take minimum/maximum supported * versions as arguments and would be able to reject modules with * versions outside of the supplied range. */ uint16_t module_api_version; #define version_major module_api_version /** * version_major/version_minor defines are supplied here for temporary * source code compatibility. They will be removed in the next version. * ALL clients must convert to the new version format. */ /** * The API version of the HAL module interface. This is meant to * version the hw_module_t, hw_module_methods_t, and hw_device_t * structures and definitions. * * The HAL interface owns this field. Module users/implementations * must NOT rely on this value for version information. * * Presently, 0 is the only valid value. */ uint16_t hal_api_version; #define version_minor hal_api_version /** Identifier of module */ const char *id; /** Name of this module */ const char *name; /** Author/owner/implementor of the module */ const char *author; /** Modules methods */ struct hw_module_methods_t* methods; /** module's dso */ void* dso; /** padding to 128 bytes, reserved for future use */ uint32_t reserved[32-7]; } hw_module_t; typedef struct hw_module_methods_t { /** Open a specific device */ int (*open)(const struct hw_module_t* module, const char* id, struct hw_device_t** device); } hw_module_methods_t; /** * Every device data structure must begin with hw_device_t * followed by module specific public methods and attributes. */ typedef struct hw_device_t { /** tag must be initialized to HARDWARE_DEVICE_TAG */ uint32_t tag; /** * Version of the module-specific device API. This value is used by * the derived-module user to manage different device implementations. * * The module user is responsible for checking the module_api_version * and device version fields to ensure that the user is capable of * communicating with the specific module implementation. * * One module can support multiple devices with different versions. This * can be useful when a device interface changes in an incompatible way * but it is still necessary to support older implementations at the same * time. One such example is the Camera 2.0 API. * * This field is interpreted by the module user and is ignored by the * HAL interface itself. */ uint32_t version; /** reference to the module this device belongs to */ struct hw_module_t* module; /** padding reserved for future use */ uint32_t reserved[12]; /** Close this device */ int (*close)(struct hw_device_t* device); } hw_device_t; /** * Name of the hal_module_info */ #define HAL_MODULE_INFO_SYM HMI /** * Name of the hal_module_info as a string */ #define HAL_MODULE_INFO_SYM_AS_STR "HMI" /** * Get the module info associated with a module by id. * * @return: 0 == success, <0 == error and *module == NULL */ int hw_get_module(const char *id, const struct hw_module_t **module); /** * Get the module info associated with a module instance by class 'class_id' * and instance 'inst'. * * Some modules types necessitate multiple instances. For example audio supports * multiple concurrent interfaces and thus 'audio' is the module class * and 'primary' or 'a2dp' are module interfaces. This implies that the files * providing these modules would be named audio.primary..so and * audio.a2dp..so * * @return: 0 == success, <0 == error and *module == NULL */ int hw_get_module_by_class(const char *class_id, const char *inst, const struct hw_module_t **module); __END_DECLS #endif /* ANDROID_INCLUDE_HARDWARE_HARDWARE_H */ android-audiosystem-1.8+13.10.20130807/include/hardware/bt_hl.h0000644000015700001700000000717112200324306024361 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_INCLUDE_BT_HL_H #define ANDROID_INCLUDE_BT_HL_H __BEGIN_DECLS /* HL connection states */ typedef enum { BTHL_MDEP_ROLE_SOURCE, BTHL_MDEP_ROLE_SINK } bthl_mdep_role_t; typedef enum { BTHL_APP_REG_STATE_REG_SUCCESS, BTHL_APP_REG_STATE_REG_FAILED, BTHL_APP_REG_STATE_DEREG_SUCCESS, BTHL_APP_REG_STATE_DEREG_FAILED } bthl_app_reg_state_t; typedef enum { BTHL_CHANNEL_TYPE_RELIABLE, BTHL_CHANNEL_TYPE_STREAMING, BTHL_CHANNEL_TYPE_ANY } bthl_channel_type_t; /* HL connection states */ typedef enum { BTHL_CONN_STATE_CONNECTING, BTHL_CONN_STATE_CONNECTED, BTHL_CONN_STATE_DISCONNECTING, BTHL_CONN_STATE_DISCONNECTED, BTHL_CONN_STATE_DESTROYED } bthl_channel_state_t; typedef struct { bthl_mdep_role_t mdep_role; int data_type; bthl_channel_type_t channel_type; const char *mdep_description; /* MDEP description to be used in the SDP (optional); null terminated */ } bthl_mdep_cfg_t; typedef struct { const char *application_name; const char *provider_name; /* provider name to be used in the SDP (optional); null terminated */ const char *srv_name; /* service name to be used in the SDP (optional); null terminated*/ const char *srv_desp; /* service description to be used in the SDP (optional); null terminated */ int number_of_mdeps; bthl_mdep_cfg_t *mdep_cfg; /* Dynamic array */ } bthl_reg_param_t; /** Callback for application registration status. * state will have one of the values from bthl_app_reg_state_t */ typedef void (* bthl_app_reg_state_callback)(int app_id, bthl_app_reg_state_t state); /** Callback for channel connection state change. * state will have one of the values from * bthl_connection_state_t and fd (file descriptor) */ typedef void (* bthl_channel_state_callback)(int app_id, bt_bdaddr_t *bd_addr, int mdep_cfg_index, int channel_id, bthl_channel_state_t state, int fd); /** BT-HL callback structure. */ typedef struct { /** set to sizeof(bthl_callbacks_t) */ size_t size; bthl_app_reg_state_callback app_reg_state_cb; bthl_channel_state_callback channel_state_cb; } bthl_callbacks_t; /** Represents the standard BT-HL interface. */ typedef struct { /** set to sizeof(bthl_interface_t) */ size_t size; /** * Register the Bthl callbacks */ bt_status_t (*init)( bthl_callbacks_t* callbacks ); /** Register HL application */ bt_status_t (*register_application) ( bthl_reg_param_t *p_reg_param, int *app_id); /** Unregister HL application */ bt_status_t (*unregister_application) (int app_id); /** connect channel */ bt_status_t (*connect_channel)(int app_id, bt_bdaddr_t *bd_addr, int mdep_cfg_index, int *channel_id); /** destroy channel */ bt_status_t (*destroy_channel)(int channel_id); /** Close the Bthl callback **/ void (*cleanup)(void); } bthl_interface_t; __END_DECLS #endif /* ANDROID_INCLUDE_BT_HL_H */ android-audiosystem-1.8+13.10.20130807/include/hardware/camera2.h0000644000015700001700000010024012200324306024572 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_INCLUDE_CAMERA2_H #define ANDROID_INCLUDE_CAMERA2_H #include "camera_common.h" #include "system/camera_metadata.h" /** * Camera device HAL 2.0 [ CAMERA_DEVICE_API_VERSION_2_0 ] * * EXPERIMENTAL. * * Supports both the android.hardware.ProCamera and * android.hardware.Camera APIs. * * Camera devices that support this version of the HAL must return * CAMERA_DEVICE_API_VERSION_2_0 in camera_device_t.common.version and in * camera_info_t.device_version (from camera_module_t.get_camera_info). * * Camera modules that may contain version 2.0 devices must implement at least * version 2.0 of the camera module interface (as defined by * camera_module_t.common.module_api_version). * * See camera_common.h for more versioning details. * */ __BEGIN_DECLS struct camera2_device; /********************************************************************** * * Input/output stream buffer queue interface definitions * */ /** * Output image stream queue interface. A set of these methods is provided to * the HAL device in allocate_stream(), and are used to interact with the * gralloc buffer queue for that stream. They may not be called until after * allocate_stream returns. */ typedef struct camera2_stream_ops { /** * Get a buffer to fill from the queue. The size and format of the buffer * are fixed for a given stream (defined in allocate_stream), and the stride * should be queried from the platform gralloc module. The gralloc buffer * will have been allocated based on the usage flags provided by * allocate_stream, and will be locked for use. */ int (*dequeue_buffer)(const struct camera2_stream_ops* w, buffer_handle_t** buffer); /** * Push a filled buffer to the stream to be used by the consumer. * * The timestamp represents the time at start of exposure of the first row * of the image; it must be from a monotonic clock, and is measured in * nanoseconds. The timestamps do not need to be comparable between * different cameras, or consecutive instances of the same camera. However, * they must be comparable between streams from the same camera. If one * capture produces buffers for multiple streams, each stream must have the * same timestamp for that buffer, and that timestamp must match the * timestamp in the output frame metadata. */ int (*enqueue_buffer)(const struct camera2_stream_ops* w, int64_t timestamp, buffer_handle_t* buffer); /** * Return a buffer to the queue without marking it as filled. */ int (*cancel_buffer)(const struct camera2_stream_ops* w, buffer_handle_t* buffer); /** * Set the crop window for subsequently enqueued buffers. The parameters are * measured in pixels relative to the buffer width and height. */ int (*set_crop)(const struct camera2_stream_ops *w, int left, int top, int right, int bottom); } camera2_stream_ops_t; /** * Temporary definition during transition. * * These formats will be removed and replaced with * HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED. To maximize forward compatibility, * HAL implementations are strongly recommended to treat FORMAT_OPAQUE and * FORMAT_ZSL as equivalent to HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, and * return HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED in the format_actual output * parameter of allocate_stream, allowing the gralloc module to select the * specific format based on the usage flags from the camera and the stream * consumer. */ enum { CAMERA2_HAL_PIXEL_FORMAT_OPAQUE = HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, CAMERA2_HAL_PIXEL_FORMAT_ZSL = -1 }; /** * Transport header for compressed JPEG buffers in output streams. * * To capture JPEG images, a stream is created using the pixel format * HAL_PIXEL_FORMAT_BLOB, and the static metadata field android.jpeg.maxSize is * used as the buffer size. Since compressed JPEG images are of variable size, * the HAL needs to include the final size of the compressed image using this * structure inside the output stream buffer. The JPEG blob ID field must be set * to CAMERA2_JPEG_BLOB_ID. * * Transport header should be at the end of the JPEG output stream buffer. That * means the jpeg_blob_id must start at byte[android.jpeg.maxSize - * sizeof(camera2_jpeg_blob)]. Any HAL using this transport header must * account for it in android.jpeg.maxSize. The JPEG data itself starts at * byte[0] and should be jpeg_size bytes long. */ typedef struct camera2_jpeg_blob { uint16_t jpeg_blob_id; uint32_t jpeg_size; }; enum { CAMERA2_JPEG_BLOB_ID = 0x00FF }; /** * Input reprocess stream queue management. A set of these methods is provided * to the HAL device in allocate_reprocess_stream(); they are used to interact * with the reprocess stream's input gralloc buffer queue. */ typedef struct camera2_stream_in_ops { /** * Get the next buffer of image data to reprocess. The width, height, and * format of the buffer is fixed in allocate_reprocess_stream(), and the * stride and other details should be queried from the platform gralloc * module as needed. The buffer will already be locked for use. */ int (*acquire_buffer)(const struct camera2_stream_in_ops *w, buffer_handle_t** buffer); /** * Return a used buffer to the buffer queue for reuse. */ int (*release_buffer)(const struct camera2_stream_in_ops *w, buffer_handle_t* buffer); } camera2_stream_in_ops_t; /********************************************************************** * * Metadata queue management, used for requests sent to HAL module, and for * frames produced by the HAL. * */ enum { CAMERA2_REQUEST_QUEUE_IS_BOTTOMLESS = -1 }; /** * Request input queue protocol: * * The framework holds the queue and its contents. At start, the queue is empty. * * 1. When the first metadata buffer is placed into the queue, the framework * signals the device by calling notify_request_queue_not_empty(). * * 2. After receiving notify_request_queue_not_empty, the device must call * dequeue() once it's ready to handle the next buffer. * * 3. Once the device has processed a buffer, and is ready for the next buffer, * it must call dequeue() again instead of waiting for a notification. If * there are no more buffers available, dequeue() will return NULL. After * this point, when a buffer becomes available, the framework must call * notify_request_queue_not_empty() again. If the device receives a NULL * return from dequeue, it does not need to query the queue again until a * notify_request_queue_not_empty() call is received from the source. * * 4. If the device calls buffer_count() and receives 0, this does not mean that * the framework will provide a notify_request_queue_not_empty() call. The * framework will only provide such a notification after the device has * received a NULL from dequeue, or on initial startup. * * 5. The dequeue() call in response to notify_request_queue_not_empty() may be * on the same thread as the notify_request_queue_not_empty() call, and may * be performed from within the notify call. * * 6. All dequeued request buffers must be returned to the framework by calling * free_request, including when errors occur, a device flush is requested, or * when the device is shutting down. */ typedef struct camera2_request_queue_src_ops { /** * Get the count of request buffers pending in the queue. May return * CAMERA2_REQUEST_QUEUE_IS_BOTTOMLESS if a repeating request (stream * request) is currently configured. Calling this method has no effect on * whether the notify_request_queue_not_empty() method will be called by the * framework. */ int (*request_count)(const struct camera2_request_queue_src_ops *q); /** * Get a metadata buffer from the framework. Returns OK if there is no * error. If the queue is empty, returns NULL in buffer. In that case, the * device must wait for a notify_request_queue_not_empty() message before * attempting to dequeue again. Buffers obtained in this way must be * returned to the framework with free_request(). */ int (*dequeue_request)(const struct camera2_request_queue_src_ops *q, camera_metadata_t **buffer); /** * Return a metadata buffer to the framework once it has been used, or if * an error or shutdown occurs. */ int (*free_request)(const struct camera2_request_queue_src_ops *q, camera_metadata_t *old_buffer); } camera2_request_queue_src_ops_t; /** * Frame output queue protocol: * * The framework holds the queue and its contents. At start, the queue is empty. * * 1. When the device is ready to fill an output metadata frame, it must dequeue * a metadata buffer of the required size. * * 2. It should then fill the metadata buffer, and place it on the frame queue * using enqueue_frame. The framework takes ownership of the frame. * * 3. In case of an error, a request to flush the pipeline, or shutdown, the * device must return any affected dequeued frames to the framework by * calling cancel_frame. */ typedef struct camera2_frame_queue_dst_ops { /** * Get an empty metadata buffer to fill from the framework. The new metadata * buffer will have room for entries number of metadata entries, plus * data_bytes worth of extra storage. Frames dequeued here must be returned * to the framework with either cancel_frame or enqueue_frame. */ int (*dequeue_frame)(const struct camera2_frame_queue_dst_ops *q, size_t entries, size_t data_bytes, camera_metadata_t **buffer); /** * Return a dequeued metadata buffer to the framework for reuse; do not mark it as * filled. Use when encountering errors, or flushing the internal request queue. */ int (*cancel_frame)(const struct camera2_frame_queue_dst_ops *q, camera_metadata_t *buffer); /** * Place a completed metadata frame on the frame output queue. */ int (*enqueue_frame)(const struct camera2_frame_queue_dst_ops *q, camera_metadata_t *buffer); } camera2_frame_queue_dst_ops_t; /********************************************************************** * * Notification callback and message definition, and trigger definitions * */ /** * Asynchronous notification callback from the HAL, fired for various * reasons. Only for information independent of frame capture, or that require * specific timing. The user pointer must be the same one that was passed to the * device in set_notify_callback(). */ typedef void (*camera2_notify_callback)(int32_t msg_type, int32_t ext1, int32_t ext2, int32_t ext3, void *user); /** * Possible message types for camera2_notify_callback */ enum { /** * An error has occurred. Argument ext1 contains the error code, and * ext2 and ext3 contain any error-specific information. */ CAMERA2_MSG_ERROR = 0x0001, /** * The exposure of a given request has begun. Argument ext1 contains the * frame number, and ext2 and ext3 contain the low-order and high-order * bytes of the timestamp for when exposure began. * (timestamp = (ext3 << 32 | ext2)) */ CAMERA2_MSG_SHUTTER = 0x0010, /** * The autofocus routine has changed state. Argument ext1 contains the new * state; the values are the same as those for the metadata field * android.control.afState. Ext2 contains the latest trigger ID passed to * trigger_action(CAMERA2_TRIGGER_AUTOFOCUS) or * trigger_action(CAMERA2_TRIGGER_CANCEL_AUTOFOCUS), or 0 if trigger has not * been called with either of those actions. */ CAMERA2_MSG_AUTOFOCUS = 0x0020, /** * The autoexposure routine has changed state. Argument ext1 contains the * new state; the values are the same as those for the metadata field * android.control.aeState. Ext2 contains the latest trigger ID value passed to * trigger_action(CAMERA2_TRIGGER_PRECAPTURE_METERING), or 0 if that method * has not been called. */ CAMERA2_MSG_AUTOEXPOSURE = 0x0021, /** * The auto-whitebalance routine has changed state. Argument ext1 contains * the new state; the values are the same as those for the metadata field * android.control.awbState. Ext2 contains the latest trigger ID passed to * trigger_action(CAMERA2_TRIGGER_PRECAPTURE_METERING), or 0 if that method * has not been called. */ CAMERA2_MSG_AUTOWB = 0x0022 }; /** * Error codes for CAMERA_MSG_ERROR */ enum { /** * A serious failure occured. Camera device may not work without reboot, and * no further frames or buffer streams will be produced by the * device. Device should be treated as closed. */ CAMERA2_MSG_ERROR_HARDWARE = 0x0001, /** * A serious failure occured. No further frames or buffer streams will be * produced by the device. Device should be treated as closed. The client * must reopen the device to use it again. */ CAMERA2_MSG_ERROR_DEVICE, /** * An error has occurred in processing a request. No output (metadata or * buffers) will be produced for this request. ext2 contains the frame * number of the request. Subsequent requests are unaffected, and the device * remains operational. */ CAMERA2_MSG_ERROR_REQUEST, /** * An error has occurred in producing an output frame metadata buffer for a * request, but image buffers for it will still be available. Subsequent * requests are unaffected, and the device remains operational. ext2 * contains the frame number of the request. */ CAMERA2_MSG_ERROR_FRAME, /** * An error has occurred in placing an output buffer into a stream for a * request. The frame metadata and other buffers may still be * available. Subsequent requests are unaffected, and the device remains * operational. ext2 contains the frame number of the request, and ext3 * contains the stream id. */ CAMERA2_MSG_ERROR_STREAM, /** * Number of error types */ CAMERA2_MSG_NUM_ERRORS }; /** * Possible trigger ids for trigger_action() */ enum { /** * Trigger an autofocus cycle. The effect of the trigger depends on the * autofocus mode in effect when the trigger is received, which is the mode * listed in the latest capture request to be dequeued by the HAL. If the * mode is OFF, EDOF, or FIXED, the trigger has no effect. In AUTO, MACRO, * or CONTINUOUS_* modes, see below for the expected behavior. The state of * the autofocus cycle can be tracked in android.control.afMode and the * corresponding notifications. * ** * In AUTO or MACRO mode, the AF state transitions (and notifications) * when calling with trigger ID = N with the previous ID being K are: * * Initial state Transitions * INACTIVE (K) -> ACTIVE_SCAN (N) -> AF_FOCUSED (N) or AF_NOT_FOCUSED (N) * AF_FOCUSED (K) -> ACTIVE_SCAN (N) -> AF_FOCUSED (N) or AF_NOT_FOCUSED (N) * AF_NOT_FOCUSED (K) -> ACTIVE_SCAN (N) -> AF_FOCUSED (N) or AF_NOT_FOCUSED (N) * ACTIVE_SCAN (K) -> AF_FOCUSED(N) or AF_NOT_FOCUSED(N) * PASSIVE_SCAN (K) Not used in AUTO/MACRO mode * PASSIVE_FOCUSED (K) Not used in AUTO/MACRO mode * ** * In CONTINUOUS_PICTURE mode, triggering AF must lock the AF to the current * lens position and transition the AF state to either AF_FOCUSED or * NOT_FOCUSED. If a passive scan is underway, that scan must complete and * then lock the lens position and change AF state. TRIGGER_CANCEL_AUTOFOCUS * will allow the AF to restart its operation. * * Initial state Transitions * INACTIVE (K) -> immediate AF_FOCUSED (N) or AF_NOT_FOCUSED (N) * PASSIVE_FOCUSED (K) -> immediate AF_FOCUSED (N) or AF_NOT_FOCUSED (N) * PASSIVE_SCAN (K) -> AF_FOCUSED (N) or AF_NOT_FOCUSED (N) * AF_FOCUSED (K) no effect except to change next notification ID to N * AF_NOT_FOCUSED (K) no effect except to change next notification ID to N * ** * In CONTINUOUS_VIDEO mode, triggering AF must lock the AF to the current * lens position and transition the AF state to either AF_FOCUSED or * NOT_FOCUSED. If a passive scan is underway, it must immediately halt, in * contrast with CONTINUOUS_PICTURE mode. TRIGGER_CANCEL_AUTOFOCUS will * allow the AF to restart its operation. * * Initial state Transitions * INACTIVE (K) -> immediate AF_FOCUSED (N) or AF_NOT_FOCUSED (N) * PASSIVE_FOCUSED (K) -> immediate AF_FOCUSED (N) or AF_NOT_FOCUSED (N) * PASSIVE_SCAN (K) -> immediate AF_FOCUSED (N) or AF_NOT_FOCUSED (N) * AF_FOCUSED (K) no effect except to change next notification ID to N * AF_NOT_FOCUSED (K) no effect except to change next notification ID to N * * Ext1 is an ID that must be returned in subsequent auto-focus state change * notifications through camera2_notify_callback() and stored in * android.control.afTriggerId. */ CAMERA2_TRIGGER_AUTOFOCUS = 0x0001, /** * Send a cancel message to the autofocus algorithm. The effect of the * cancellation depends on the autofocus mode in effect when the trigger is * received, which is the mode listed in the latest capture request to be * dequeued by the HAL. If the AF mode is OFF or EDOF, the cancel has no * effect. For other modes, the lens should return to its default position, * any current autofocus scan must be canceled, and the AF state should be * set to INACTIVE. * * The state of the autofocus cycle can be tracked in android.control.afMode * and the corresponding notification. Continuous autofocus modes may resume * focusing operations thereafter exactly as if the camera had just been set * to a continuous AF mode. * * Ext1 is an ID that must be returned in subsequent auto-focus state change * notifications through camera2_notify_callback() and stored in * android.control.afTriggerId. */ CAMERA2_TRIGGER_CANCEL_AUTOFOCUS, /** * Trigger a pre-capture metering cycle, which may include firing the flash * to determine proper capture parameters. Typically, this trigger would be * fired for a half-depress of a camera shutter key, or before a snapshot * capture in general. The state of the metering cycle can be tracked in * android.control.aeMode and the corresponding notification. If the * auto-exposure mode is OFF, the trigger does nothing. * * Ext1 is an ID that must be returned in subsequent * auto-exposure/auto-white balance state change notifications through * camera2_notify_callback() and stored in android.control.aePrecaptureId. */ CAMERA2_TRIGGER_PRECAPTURE_METERING }; /** * Possible template types for construct_default_request() */ enum { /** * Standard camera preview operation with 3A on auto. */ CAMERA2_TEMPLATE_PREVIEW = 1, /** * Standard camera high-quality still capture with 3A and flash on auto. */ CAMERA2_TEMPLATE_STILL_CAPTURE, /** * Standard video recording plus preview with 3A on auto, torch off. */ CAMERA2_TEMPLATE_VIDEO_RECORD, /** * High-quality still capture while recording video. Application will * include preview, video record, and full-resolution YUV or JPEG streams in * request. Must not cause stuttering on video stream. 3A on auto. */ CAMERA2_TEMPLATE_VIDEO_SNAPSHOT, /** * Zero-shutter-lag mode. Application will request preview and * full-resolution data for each frame, and reprocess it to JPEG when a * still image is requested by user. Settings should provide highest-quality * full-resolution images without compromising preview frame rate. 3A on * auto. */ CAMERA2_TEMPLATE_ZERO_SHUTTER_LAG, /* Total number of templates */ CAMERA2_TEMPLATE_COUNT }; /********************************************************************** * * Camera device operations * */ typedef struct camera2_device_ops { /********************************************************************** * Request and frame queue setup and management methods */ /** * Pass in input request queue interface methods. */ int (*set_request_queue_src_ops)(const struct camera2_device *, const camera2_request_queue_src_ops_t *request_src_ops); /** * Notify device that the request queue is no longer empty. Must only be * called when the first buffer is added a new queue, or after the source * has returned NULL in response to a dequeue call. */ int (*notify_request_queue_not_empty)(const struct camera2_device *); /** * Pass in output frame queue interface methods */ int (*set_frame_queue_dst_ops)(const struct camera2_device *, const camera2_frame_queue_dst_ops_t *frame_dst_ops); /** * Number of camera requests being processed by the device at the moment * (captures/reprocesses that have had their request dequeued, but have not * yet been enqueued onto output pipeline(s) ). No streams may be released * by the framework until the in-progress count is 0. */ int (*get_in_progress_count)(const struct camera2_device *); /** * Flush all in-progress captures. This includes all dequeued requests * (regular or reprocessing) that have not yet placed any outputs into a * stream or the frame queue. Partially completed captures must be completed * normally. No new requests may be dequeued from the request queue until * the flush completes. */ int (*flush_captures_in_progress)(const struct camera2_device *); /** * Create a filled-in default request for standard camera use cases. * * The device must return a complete request that is configured to meet the * requested use case, which must be one of the CAMERA2_TEMPLATE_* * enums. All request control fields must be included, except for * android.request.outputStreams. * * The metadata buffer returned must be allocated with * allocate_camera_metadata. The framework takes ownership of the buffer. */ int (*construct_default_request)(const struct camera2_device *, int request_template, camera_metadata_t **request); /********************************************************************** * Stream management */ /** * allocate_stream: * * Allocate a new output stream for use, defined by the output buffer width, * height, target, and possibly the pixel format. Returns the new stream's * ID, gralloc usage flags, minimum queue buffer count, and possibly the * pixel format, on success. Error conditions: * * - Requesting a width/height/format combination not listed as * supported by the sensor's static characteristics * * - Asking for too many streams of a given format type (2 bayer raw * streams, for example). * * Input parameters: * * - width, height, format: Specification for the buffers to be sent through * this stream. Format is a value from the HAL_PIXEL_FORMAT_* list. If * HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED is used, then the platform * gralloc module will select a format based on the usage flags provided * by the camera HAL and the consumer of the stream. The camera HAL should * inspect the buffers handed to it in the register_stream_buffers call to * obtain the implementation-specific format if necessary. * * - stream_ops: A structure of function pointers for obtaining and queuing * up buffers for this stream. The underlying stream will be configured * based on the usage and max_buffers outputs. The methods in this * structure may not be called until after allocate_stream returns. * * Output parameters: * * - stream_id: An unsigned integer identifying this stream. This value is * used in incoming requests to identify the stream, and in releasing the * stream. * * - usage: The gralloc usage mask needed by the HAL device for producing * the requested type of data. This is used in allocating new gralloc * buffers for the stream buffer queue. * * - max_buffers: The maximum number of buffers the HAL device may need to * have dequeued at the same time. The device may not dequeue more buffers * than this value at the same time. * */ int (*allocate_stream)( const struct camera2_device *, // inputs uint32_t width, uint32_t height, int format, const camera2_stream_ops_t *stream_ops, // outputs uint32_t *stream_id, uint32_t *format_actual, // IGNORED, will be removed uint32_t *usage, uint32_t *max_buffers); /** * Register buffers for a given stream. This is called after a successful * allocate_stream call, and before the first request referencing the stream * is enqueued. This method is intended to allow the HAL device to map or * otherwise prepare the buffers for later use. num_buffers is guaranteed to * be at least max_buffers (from allocate_stream), but may be larger. The * buffers will already be locked for use. At the end of the call, all the * buffers must be ready to be returned to the queue. If the stream format * was set to HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, the camera HAL should * inspect the passed-in buffers here to determine any platform-private * pixel format information. */ int (*register_stream_buffers)( const struct camera2_device *, uint32_t stream_id, int num_buffers, buffer_handle_t *buffers); /** * Release a stream. Returns an error if called when get_in_progress_count * is non-zero, or if the stream id is invalid. */ int (*release_stream)( const struct camera2_device *, uint32_t stream_id); /** * allocate_reprocess_stream: * * Allocate a new input stream for use, defined by the output buffer width, * height, and the pixel format. Returns the new stream's ID, gralloc usage * flags, and required simultaneously acquirable buffer count, on * success. Error conditions: * * - Requesting a width/height/format combination not listed as * supported by the sensor's static characteristics * * - Asking for too many reprocessing streams to be configured at once. * * Input parameters: * * - width, height, format: Specification for the buffers to be sent through * this stream. Format must be a value from the HAL_PIXEL_FORMAT_* list. * * - reprocess_stream_ops: A structure of function pointers for acquiring * and releasing buffers for this stream. The underlying stream will be * configured based on the usage and max_buffers outputs. * * Output parameters: * * - stream_id: An unsigned integer identifying this stream. This value is * used in incoming requests to identify the stream, and in releasing the * stream. These ids are numbered separately from the input stream ids. * * - consumer_usage: The gralloc usage mask needed by the HAL device for * consuming the requested type of data. This is used in allocating new * gralloc buffers for the stream buffer queue. * * - max_buffers: The maximum number of buffers the HAL device may need to * have acquired at the same time. The device may not have more buffers * acquired at the same time than this value. * */ int (*allocate_reprocess_stream)(const struct camera2_device *, uint32_t width, uint32_t height, uint32_t format, const camera2_stream_in_ops_t *reprocess_stream_ops, // outputs uint32_t *stream_id, uint32_t *consumer_usage, uint32_t *max_buffers); /** * allocate_reprocess_stream_from_stream: * * Allocate a new input stream for use, which will use the buffers allocated * for an existing output stream. That is, after the HAL enqueues a buffer * onto the output stream, it may see that same buffer handed to it from * this input reprocessing stream. After the HAL releases the buffer back to * the reprocessing stream, it will be returned to the output queue for * reuse. * * Error conditions: * * - Using an output stream of unsuitable size/format for the basis of the * reprocessing stream. * * - Attempting to allocatee too many reprocessing streams at once. * * Input parameters: * * - output_stream_id: The ID of an existing output stream which has * a size and format suitable for reprocessing. * * - reprocess_stream_ops: A structure of function pointers for acquiring * and releasing buffers for this stream. The underlying stream will use * the same graphics buffer handles as the output stream uses. * * Output parameters: * * - stream_id: An unsigned integer identifying this stream. This value is * used in incoming requests to identify the stream, and in releasing the * stream. These ids are numbered separately from the input stream ids. * * The HAL client must always release the reprocessing stream before it * releases the output stream it is based on. * */ int (*allocate_reprocess_stream_from_stream)(const struct camera2_device *, uint32_t output_stream_id, const camera2_stream_in_ops_t *reprocess_stream_ops, // outputs uint32_t *stream_id); /** * Release a reprocessing stream. Returns an error if called when * get_in_progress_count is non-zero, or if the stream id is not * valid. */ int (*release_reprocess_stream)( const struct camera2_device *, uint32_t stream_id); /********************************************************************** * Miscellaneous methods */ /** * Trigger asynchronous activity. This is used for triggering special * behaviors of the camera 3A routines when they are in use. See the * documentation for CAMERA2_TRIGGER_* above for details of the trigger ids * and their arguments. */ int (*trigger_action)(const struct camera2_device *, uint32_t trigger_id, int32_t ext1, int32_t ext2); /** * Notification callback setup */ int (*set_notify_callback)(const struct camera2_device *, camera2_notify_callback notify_cb, void *user); /** * Get methods to query for vendor extension metadata tag infomation. May * set ops to NULL if no vendor extension tags are defined. */ int (*get_metadata_vendor_tag_ops)(const struct camera2_device*, vendor_tag_query_ops_t **ops); /** * Dump state of the camera hardware */ int (*dump)(const struct camera2_device *, int fd); } camera2_device_ops_t; /********************************************************************** * * Camera device definition * */ typedef struct camera2_device { /** * common.version must equal CAMERA_DEVICE_API_VERSION_2_0 to identify * this device as implementing version 2.0 of the camera device HAL. */ hw_device_t common; camera2_device_ops_t *ops; void *priv; } camera2_device_t; __END_DECLS #endif /* #ifdef ANDROID_INCLUDE_CAMERA2_H */ android-audiosystem-1.8+13.10.20130807/include/hardware/nfc.h0000644000015700001700000002110312200324306024026 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011, 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_NFC_HAL_INTERFACE_H #define ANDROID_NFC_HAL_INTERFACE_H #include #include #include #include #include __BEGIN_DECLS /* NFC device HAL for NCI-based NFC controllers. * * This HAL allows NCI silicon vendors to make use * of the core NCI stack in Android for their own silicon. * * The responibilities of the NCI HAL implementation * are as follows: * * - Implement the transport to the NFC controller * - Implement each of the HAL methods specified below as applicable to their silicon * - Pass up received NCI messages from the controller to the stack * * A simplified timeline of NCI HAL method calls: * 1) Core NCI stack calls open() * 2) Core NCI stack executes CORE_RESET and CORE_INIT through calls to write() * 3) Core NCI stack calls core_initialized() to allow HAL to do post-init configuration * 4) Core NCI stack calls pre_discover() to allow HAL to prepare for RF discovery * 5) Core NCI stack starts discovery through calls to write() * 6) Core NCI stack stops discovery through calls to write() (e.g. screen turns off) * 7) Core NCI stack calls pre_discover() to prepare for RF discovery (e.g. screen turned back on) * 8) Core NCI stack starts discovery through calls to write() * ... * ... * 9) Core NCI stack calls close() */ #define NFC_NCI_HARDWARE_MODULE_ID "nfc_nci" #define NFC_NCI_CONTROLLER "nci" /* * nfc_nci_module_t should contain module-specific parameters */ typedef struct nfc_nci_module_t { struct hw_module_t common; } nfc_nci_module_t; /* * HAL events that can be passed back to the stack */ typedef uint8_t nfc_event_t; enum { HAL_NFC_OPEN_CPLT_EVT = 0x00, HAL_NFC_CLOSE_CPLT_EVT = 0x01, HAL_NFC_POST_INIT_CPLT_EVT = 0x02, HAL_NFC_PRE_DISCOVER_CPLT_EVT = 0x03, HAL_NFC_REQUEST_CONTROL_EVT = 0x04, HAL_NFC_RELEASE_CONTROL_EVT = 0x05, HAL_NFC_ERROR_EVT = 0x06 }; /* * Allowed status return values for each of the HAL methods */ typedef uint8_t nfc_status_t; enum { HAL_NFC_STATUS_OK = 0x00, HAL_NFC_STATUS_FAILED = 0x01, HAL_NFC_STATUS_ERR_TRANSPORT = 0x02, HAL_NFC_STATUS_ERR_CMD_TIMEOUT = 0x03, HAL_NFC_STATUS_REFUSED = 0x04 }; /* * The callback passed in from the NFC stack that the HAL * can use to pass events back to the stack. */ typedef void (nfc_stack_callback_t) (nfc_event_t event, nfc_status_t event_status); /* * The callback passed in from the NFC stack that the HAL * can use to pass incomming data to the stack. */ typedef void (nfc_stack_data_callback_t) (uint16_t data_len, uint8_t* p_data); /* nfc_nci_device_t starts with a hw_device_t struct, * followed by device-specific methods and members. * * All methods in the NCI HAL are asynchronous. */ typedef struct nfc_nci_device { struct hw_device_t common; /* * (*open)() Opens the NFC controller device and performs initialization. * This may include patch download and other vendor-specific initialization. * * If open completes successfully, the controller should be ready to perform * NCI initialization - ie accept CORE_RESET and subsequent commands through * the write() call. * * If open() returns 0, the NCI stack will wait for a HAL_NFC_OPEN_CPLT_EVT * before continuing. * * If open() returns any other value, the NCI stack will stop. * */ int (*open)(const struct nfc_nci_device *p_dev, nfc_stack_callback_t *p_cback, nfc_stack_data_callback_t *p_data_cback); /* * (*write)() Performs an NCI write. * * This method may queue writes and return immediately. The only * requirement is that the writes are executed in order. */ int (*write)(const struct nfc_nci_device *p_dev, uint16_t data_len, const uint8_t *p_data); /* * (*core_initialized)() is called after the CORE_INIT_RSP is received from the NFCC. * At this time, the HAL can do any chip-specific configuration. * * If core_initialized() returns 0, the NCI stack will wait for a HAL_NFC_POST_INIT_CPLT_EVT * before continuing. * * If core_initialized() returns any other value, the NCI stack will continue * immediately. */ int (*core_initialized)(const struct nfc_nci_device *p_dev, uint8_t* p_core_init_rsp_params); /* * (*pre_discover)() Is called every time before starting RF discovery. * It is a good place to do vendor-specific configuration that must be * performed every time RF discovery is about to be started. * * If pre_discover() returns 0, the NCI stack will wait for a HAL_NFC_PRE_DISCOVER_CPLT_EVT * before continuing. * * If pre_discover() returns any other value, the NCI stack will start * RF discovery immediately. */ int (*pre_discover)(const struct nfc_nci_device *p_dev); /* * (*close)() Closed the NFC controller. Should free all resources. */ int (*close)(const struct nfc_nci_device *p_dev); /* * (*control_granted)() Grant HAL the exclusive control to send NCI commands. * Called in response to HAL_REQUEST_CONTROL_EVT. * Must only be called when there are no NCI commands pending. * HAL_RELEASE_CONTROL_EVT will notify when HAL no longer needs exclusive control. */ int (*control_granted)(const struct nfc_nci_device *p_dev); /* * (*power_cycle)() Restart controller by power cyle; * HAL_OPEN_CPLT_EVT will notify when operation is complete. */ int (*power_cycle)(const struct nfc_nci_device *p_dev); } nfc_nci_device_t; /* * Convenience methods that the NFC stack can use to open * and close an NCI device */ static inline int nfc_nci_open(const struct hw_module_t* module, nfc_nci_device_t** dev) { return module->methods->open(module, NFC_NCI_CONTROLLER, (struct hw_device_t**) dev); } static inline int nfc_nci_close(nfc_nci_device_t* dev) { return dev->common.close(&dev->common); } /* * End NFC NCI HAL */ /* * This is a limited NFC HAL for NXP PN544-based devices. * This HAL as Android is moving to * an NCI-based NFC stack. * * All NCI-based NFC controllers should use the NFC-NCI * HAL instead. * Begin PN544 specific HAL */ #define NFC_HARDWARE_MODULE_ID "nfc" #define NFC_PN544_CONTROLLER "pn544" typedef struct nfc_module_t { struct hw_module_t common; } nfc_module_t; /* * PN544 linktypes. * UART * I2C * USB (uses UART DAL) */ typedef enum { PN544_LINK_TYPE_UART, PN544_LINK_TYPE_I2C, PN544_LINK_TYPE_USB, PN544_LINK_TYPE_INVALID, } nfc_pn544_linktype; typedef struct { struct hw_device_t common; /* The number of EEPROM registers to write */ uint32_t num_eeprom_settings; /* The actual EEPROM settings * For PN544, each EEPROM setting is a 4-byte entry, * of the format [0x00, addr_msb, addr_lsb, value]. */ uint8_t* eeprom_settings; /* The link type to which the PN544 is connected */ nfc_pn544_linktype linktype; /* The device node to which the PN544 is connected */ const char* device_node; /* On Crespo we had an I2C issue that would cause us to sometimes read * the I2C slave address (0x57) over the bus. libnfc contains * a hack to ignore this byte and try to read the length byte * again. * Set to 0 to disable the workaround, 1 to enable it. */ uint8_t enable_i2c_workaround; /* I2C slave address. Multiple I2C addresses are * possible for PN544 module. Configure address according to * board design. */ uint8_t i2c_device_address; } nfc_pn544_device_t; static inline int nfc_pn544_open(const struct hw_module_t* module, nfc_pn544_device_t** dev) { return module->methods->open(module, NFC_PN544_CONTROLLER, (struct hw_device_t**) dev); } static inline int nfc_pn544_close(nfc_pn544_device_t* dev) { return dev->common.close(&dev->common); } /* * End PN544 specific HAL */ __END_DECLS #endif // ANDROID_NFC_HAL_INTERFACE_H android-audiosystem-1.8+13.10.20130807/include/hardware/bt_hf.h0000644000015700001700000002141012200324306024343 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_INCLUDE_BT_HF_H #define ANDROID_INCLUDE_BT_HF_H __BEGIN_DECLS /* AT response code - OK/Error */ typedef enum { BTHF_AT_RESPONSE_ERROR = 0, BTHF_AT_RESPONSE_OK } bthf_at_response_t; typedef enum { BTHF_CONNECTION_STATE_DISCONNECTED = 0, BTHF_CONNECTION_STATE_CONNECTING, BTHF_CONNECTION_STATE_CONNECTED, BTHF_CONNECTION_STATE_SLC_CONNECTED, BTHF_CONNECTION_STATE_DISCONNECTING } bthf_connection_state_t; typedef enum { BTHF_AUDIO_STATE_DISCONNECTED = 0, BTHF_AUDIO_STATE_CONNECTING, BTHF_AUDIO_STATE_CONNECTED, BTHF_AUDIO_STATE_DISCONNECTING } bthf_audio_state_t; typedef enum { BTHF_VR_STATE_STOPPED = 0, BTHF_VR_STATE_STARTED } bthf_vr_state_t; typedef enum { BTHF_VOLUME_TYPE_SPK = 0, BTHF_VOLUME_TYPE_MIC } bthf_volume_type_t; /* Noise Reduction and Echo Cancellation */ typedef enum { BTHF_NREC_STOP, BTHF_NREC_START } bthf_nrec_t; /* CHLD - Call held handling */ typedef enum { BTHF_CHLD_TYPE_RELEASEHELD, // Terminate all held or set UDUB("busy") to a waiting call BTHF_CHLD_TYPE_RELEASEACTIVE_ACCEPTHELD, // Terminate all active calls and accepts a waiting/held call BTHF_CHLD_TYPE_HOLDACTIVE_ACCEPTHELD, // Hold all active calls and accepts a waiting/held call BTHF_CHLD_TYPE_ADDHELDTOCONF, // Add all held calls to a conference } bthf_chld_type_t; /** Callback for connection state change. * state will have one of the values from BtHfConnectionState */ typedef void (* bthf_connection_state_callback)(bthf_connection_state_t state, bt_bdaddr_t *bd_addr); /** Callback for audio connection state change. * state will have one of the values from BtHfAudioState */ typedef void (* bthf_audio_state_callback)(bthf_audio_state_t state, bt_bdaddr_t *bd_addr); /** Callback for VR connection state change. * state will have one of the values from BtHfVRState */ typedef void (* bthf_vr_cmd_callback)(bthf_vr_state_t state); /** Callback for answer incoming call (ATA) */ typedef void (* bthf_answer_call_cmd_callback)(); /** Callback for disconnect call (AT+CHUP) */ typedef void (* bthf_hangup_call_cmd_callback)(); /** Callback for disconnect call (AT+CHUP) * type will denote Speaker/Mic gain (BtHfVolumeControl). */ typedef void (* bthf_volume_cmd_callback)(bthf_volume_type_t type, int volume); /** Callback for dialing an outgoing call * If number is NULL, redial */ typedef void (* bthf_dial_call_cmd_callback)(char *number); /** Callback for sending DTMF tones * tone contains the dtmf character to be sent */ typedef void (* bthf_dtmf_cmd_callback)(char tone); /** Callback for enabling/disabling noise reduction/echo cancellation * value will be 1 to enable, 0 to disable */ typedef void (* bthf_nrec_cmd_callback)(bthf_nrec_t nrec); /** Callback for call hold handling (AT+CHLD) * value will contain the call hold command (0, 1, 2, 3) */ typedef void (* bthf_chld_cmd_callback)(bthf_chld_type_t chld); /** Callback for CNUM (subscriber number) */ typedef void (* bthf_cnum_cmd_callback)(); /** Callback for indicators (CIND) */ typedef void (* bthf_cind_cmd_callback)(); /** Callback for operator selection (COPS) */ typedef void (* bthf_cops_cmd_callback)(); /** Callback for call list (AT+CLCC) */ typedef void (* bthf_clcc_cmd_callback) (); /** Callback for unknown AT command recd from HF * at_string will contain the unparsed AT string */ typedef void (* bthf_unknown_at_cmd_callback)(char *at_string); /** Callback for keypressed (HSP) event. */ typedef void (* bthf_key_pressed_cmd_callback)(); /** BT-HF callback structure. */ typedef struct { /** set to sizeof(BtHfCallbacks) */ size_t size; bthf_connection_state_callback connection_state_cb; bthf_audio_state_callback audio_state_cb; bthf_vr_cmd_callback vr_cmd_cb; bthf_answer_call_cmd_callback answer_call_cmd_cb; bthf_hangup_call_cmd_callback hangup_call_cmd_cb; bthf_volume_cmd_callback volume_cmd_cb; bthf_dial_call_cmd_callback dial_call_cmd_cb; bthf_dtmf_cmd_callback dtmf_cmd_cb; bthf_nrec_cmd_callback nrec_cmd_cb; bthf_chld_cmd_callback chld_cmd_cb; bthf_cnum_cmd_callback cnum_cmd_cb; bthf_cind_cmd_callback cind_cmd_cb; bthf_cops_cmd_callback cops_cmd_cb; bthf_clcc_cmd_callback clcc_cmd_cb; bthf_unknown_at_cmd_callback unknown_at_cmd_cb; bthf_key_pressed_cmd_callback key_pressed_cmd_cb; } bthf_callbacks_t; /** Network Status */ typedef enum { BTHF_NETWORK_STATE_NOT_AVAILABLE = 0, BTHF_NETWORK_STATE_AVAILABLE } bthf_network_state_t; /** Service type */ typedef enum { BTHF_SERVICE_TYPE_HOME = 0, BTHF_SERVICE_TYPE_ROAMING } bthf_service_type_t; typedef enum { BTHF_CALL_STATE_ACTIVE = 0, BTHF_CALL_STATE_HELD, BTHF_CALL_STATE_DIALING, BTHF_CALL_STATE_ALERTING, BTHF_CALL_STATE_INCOMING, BTHF_CALL_STATE_WAITING, BTHF_CALL_STATE_IDLE } bthf_call_state_t; typedef enum { BTHF_CALL_DIRECTION_OUTGOING = 0, BTHF_CALL_DIRECTION_INCOMING } bthf_call_direction_t; typedef enum { BTHF_CALL_TYPE_VOICE = 0, BTHF_CALL_TYPE_DATA, BTHF_CALL_TYPE_FAX } bthf_call_mode_t; typedef enum { BTHF_CALL_MPTY_TYPE_SINGLE = 0, BTHF_CALL_MPTY_TYPE_MULTI } bthf_call_mpty_type_t; typedef enum { BTHF_CALL_ADDRTYPE_UNKNOWN = 0x81, BTHF_CALL_ADDRTYPE_INTERNATIONAL = 0x91 } bthf_call_addrtype_t; /** Represents the standard BT-HF interface. */ typedef struct { /** set to sizeof(BtHfInterface) */ size_t size; /** * Register the BtHf callbacks */ bt_status_t (*init)( bthf_callbacks_t* callbacks ); /** connect to headset */ bt_status_t (*connect)( bt_bdaddr_t *bd_addr ); /** dis-connect from headset */ bt_status_t (*disconnect)( bt_bdaddr_t *bd_addr ); /** create an audio connection */ bt_status_t (*connect_audio)( bt_bdaddr_t *bd_addr ); /** close the audio connection */ bt_status_t (*disconnect_audio)( bt_bdaddr_t *bd_addr ); /** start voice recognition */ bt_status_t (*start_voice_recognition)(); /** stop voice recognition */ bt_status_t (*stop_voice_recognition)(); /** volume control */ bt_status_t (*volume_control) (bthf_volume_type_t type, int volume); /** Combined device status change notification */ bt_status_t (*device_status_notification)(bthf_network_state_t ntk_state, bthf_service_type_t svc_type, int signal, int batt_chg); /** Response for COPS command */ bt_status_t (*cops_response)(const char *cops); /** Response for CIND command */ bt_status_t (*cind_response)(int svc, int num_active, int num_held, bthf_call_state_t call_setup_state, int signal, int roam, int batt_chg); /** Pre-formatted AT response, typically in response to unknown AT cmd */ bt_status_t (*formatted_at_response)(const char *rsp); /** ok/error response * ERROR (0) * OK (1) */ bt_status_t (*at_response) (bthf_at_response_t response_code, int error_code); /** response for CLCC command * Can be iteratively called for each call index * Call index of 0 will be treated as NULL termination (Completes response) */ bt_status_t (*clcc_response) (int index, bthf_call_direction_t dir, bthf_call_state_t state, bthf_call_mode_t mode, bthf_call_mpty_type_t mpty, const char *number, bthf_call_addrtype_t type); /** notify of a call state change * Each update notifies * 1. Number of active/held/ringing calls * 2. call_state: This denotes the state change that triggered this msg * This will take one of the values from BtHfCallState * 3. number & type: valid only for incoming & waiting call */ bt_status_t (*phone_state_change) (int num_active, int num_held, bthf_call_state_t call_setup_state, const char *number, bthf_call_addrtype_t type); /** Closes the interface. */ void (*cleanup)( void ); } bthf_interface_t; __END_DECLS #endif /* ANDROID_INCLUDE_BT_HF_H */ android-audiosystem-1.8+13.10.20130807/include/hardware/bt_av.h0000644000015700001700000000522312200324306024360 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_INCLUDE_BT_AV_H #define ANDROID_INCLUDE_BT_AV_H __BEGIN_DECLS /* Bluetooth AV connection states */ typedef enum { BTAV_CONNECTION_STATE_DISCONNECTED = 0, BTAV_CONNECTION_STATE_CONNECTING, BTAV_CONNECTION_STATE_CONNECTED, BTAV_CONNECTION_STATE_DISCONNECTING } btav_connection_state_t; /* Bluetooth AV datapath states */ typedef enum { BTAV_AUDIO_STATE_REMOTE_SUSPEND = 0, BTAV_AUDIO_STATE_STOPPED, BTAV_AUDIO_STATE_STARTED, } btav_audio_state_t; /** Callback for connection state change. * state will have one of the values from btav_connection_state_t */ typedef void (* btav_connection_state_callback)(btav_connection_state_t state, bt_bdaddr_t *bd_addr); /** Callback for audiopath state change. * state will have one of the values from btav_audio_state_t */ typedef void (* btav_audio_state_callback)(btav_audio_state_t state, bt_bdaddr_t *bd_addr); /** BT-AV callback structure. */ typedef struct { /** set to sizeof(btav_callbacks_t) */ size_t size; btav_connection_state_callback connection_state_cb; btav_audio_state_callback audio_state_cb; } btav_callbacks_t; /** * NOTE: * * 1. AVRCP 1.0 shall be supported initially. AVRCP passthrough commands * shall be handled internally via uinput * * 2. A2DP data path shall be handled via a socket pipe between the AudioFlinger * android_audio_hw library and the Bluetooth stack. * */ /** Represents the standard BT-AV interface. */ typedef struct { /** set to sizeof(btav_interface_t) */ size_t size; /** * Register the BtAv callbacks */ bt_status_t (*init)( btav_callbacks_t* callbacks ); /** connect to headset */ bt_status_t (*connect)( bt_bdaddr_t *bd_addr ); /** dis-connect from headset */ bt_status_t (*disconnect)( bt_bdaddr_t *bd_addr ); /** Closes the interface. */ void (*cleanup)( void ); } btav_interface_t; __END_DECLS #endif /* ANDROID_INCLUDE_BT_AV_H */ android-audiosystem-1.8+13.10.20130807/include/hardware/bluetooth.h0000644000015700001700000003444512200324306025302 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_INCLUDE_BLUETOOTH_H #define ANDROID_INCLUDE_BLUETOOTH_H #include #include #include #include __BEGIN_DECLS /** * The Bluetooth Hardware Module ID */ #define BT_HARDWARE_MODULE_ID "bluetooth" #define BT_STACK_MODULE_ID "bluetooth" #define BT_STACK_TEST_MODULE_ID "bluetooth_test" /* Bluetooth profile interface IDs */ #define BT_PROFILE_HANDSFREE_ID "handsfree" #define BT_PROFILE_ADVANCED_AUDIO_ID "a2dp" #define BT_PROFILE_HEALTH_ID "health" #define BT_PROFILE_SOCKETS_ID "socket" #define BT_PROFILE_HIDHOST_ID "hidhost" #define BT_PROFILE_PAN_ID "pan" /** Bluetooth Address */ typedef struct { uint8_t address[6]; } __attribute__((packed))bt_bdaddr_t; /** Bluetooth Device Name */ typedef struct { uint8_t name[248]; } __attribute__((packed))bt_bdname_t; /** Bluetooth Adapter Visibility Modes*/ typedef enum { BT_SCAN_MODE_NONE, BT_SCAN_MODE_CONNECTABLE, BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE } bt_scan_mode_t; /** Bluetooth Adapter State */ typedef enum { BT_STATE_OFF, BT_STATE_ON } bt_state_t; /** Bluetooth Error Status */ /** We need to build on this */ typedef enum { BT_STATUS_SUCCESS, BT_STATUS_FAIL, BT_STATUS_NOT_READY, BT_STATUS_NOMEM, BT_STATUS_BUSY, BT_STATUS_DONE, /* request already completed */ BT_STATUS_UNSUPPORTED, BT_STATUS_PARM_INVALID, BT_STATUS_UNHANDLED, BT_STATUS_AUTH_FAILURE, BT_STATUS_RMT_DEV_DOWN } bt_status_t; /** Bluetooth PinKey Code */ typedef struct { uint8_t pin[16]; } __attribute__((packed))bt_pin_code_t; /** Bluetooth Adapter Discovery state */ typedef enum { BT_DISCOVERY_STOPPED, BT_DISCOVERY_STARTED } bt_discovery_state_t; /** Bluetooth ACL connection state */ typedef enum { BT_ACL_STATE_CONNECTED, BT_ACL_STATE_DISCONNECTED } bt_acl_state_t; /** Bluetooth 128-bit UUID */ typedef struct { uint8_t uu[16]; } bt_uuid_t; /** Bluetooth SDP service record */ typedef struct { bt_uuid_t uuid; uint16_t channel; char name[256]; // what's the maximum length } bt_service_record_t; /* Bluetooth Adapter and Remote Device property types */ typedef enum { /* Properties common to both adapter and remote device */ /** * Description - Bluetooth Device Name * Access mode - Adapter name can be GET/SET. Remote device can be GET * Data type - bt_bdname_t */ BT_PROPERTY_BDNAME = 0x1, /** * Description - Bluetooth Device Address * Access mode - Only GET. * Data type - bt_bdaddr_t */ BT_PROPERTY_BDADDR, /** * Description - Bluetooth Service 128-bit UUIDs * Access mode - Only GET. * Data type - Array of bt_uuid_t (Array size inferred from property length). */ BT_PROPERTY_UUIDS, /** * Description - Bluetooth Class of Device as found in Assigned Numbers * Access mode - Only GET. * Data type - uint32_t. */ BT_PROPERTY_CLASS_OF_DEVICE, /** * Description - Device Type - BREDR, BLE or DUAL Mode * Access mode - Only GET. * Data type - bt_device_type_t */ BT_PROPERTY_TYPE_OF_DEVICE, /** * Description - Bluetooth Service Record * Access mode - Only GET. * Data type - bt_service_record_t */ BT_PROPERTY_SERVICE_RECORD, /* Properties unique to adapter */ /** * Description - Bluetooth Adapter scan mode * Access mode - GET and SET * Data type - bt_scan_mode_t. */ BT_PROPERTY_ADAPTER_SCAN_MODE, /** * Description - List of bonded devices * Access mode - Only GET. * Data type - Array of bt_bdaddr_t of the bonded remote devices * (Array size inferred from property length). */ BT_PROPERTY_ADAPTER_BONDED_DEVICES, /** * Description - Bluetooth Adapter Discovery timeout (in seconds) * Access mode - GET and SET * Data type - uint32_t */ BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT, /* Properties unique to remote device */ /** * Description - User defined friendly name of the remote device * Access mode - GET and SET * Data type - bt_bdname_t. */ BT_PROPERTY_REMOTE_FRIENDLY_NAME, /** * Description - RSSI value of the inquired remote device * Access mode - Only GET. * Data type - int32_t. */ BT_PROPERTY_REMOTE_RSSI, BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP = 0xFF, } bt_property_type_t; /** Bluetooth Adapter Property data structure */ typedef struct { bt_property_type_t type; int len; void *val; } bt_property_t; /** Bluetooth Device Type */ typedef enum { BT_DEVICE_DEVTYPE_BREDR = 0x1, BT_DEVICE_DEVTYPE_BLE, BT_DEVICE_DEVTYPE_DUAL } bt_device_type_t; /** Bluetooth Bond state */ typedef enum { BT_BOND_STATE_NONE, BT_BOND_STATE_BONDING, BT_BOND_STATE_BONDED } bt_bond_state_t; /** Bluetooth SSP Bonding Variant */ typedef enum { BT_SSP_VARIANT_PASSKEY_CONFIRMATION, BT_SSP_VARIANT_PASSKEY_ENTRY, BT_SSP_VARIANT_CONSENT, BT_SSP_VARIANT_PASSKEY_NOTIFICATION } bt_ssp_variant_t; #define BT_MAX_NUM_UUIDS 32 /** Bluetooth Interface callbacks */ /** Bluetooth Enable/Disable Callback. */ typedef void (*adapter_state_changed_callback)(bt_state_t state); /** GET/SET Adapter Properties callback */ /* TODO: For the GET/SET property APIs/callbacks, we may need a session * identifier to associate the call with the callback. This would be needed * whenever more than one simultaneous instance of the same adapter_type * is get/set. * * If this is going to be handled in the Java framework, then we do not need * to manage sessions here. */ typedef void (*adapter_properties_callback)(bt_status_t status, int num_properties, bt_property_t *properties); /** GET/SET Remote Device Properties callback */ /** TODO: For remote device properties, do not see a need to get/set * multiple properties - num_properties shall be 1 */ typedef void (*remote_device_properties_callback)(bt_status_t status, bt_bdaddr_t *bd_addr, int num_properties, bt_property_t *properties); /** New device discovered callback */ /** If EIR data is not present, then BD_NAME and RSSI shall be NULL and -1 * respectively */ typedef void (*device_found_callback)(int num_properties, bt_property_t *properties); /** Discovery state changed callback */ typedef void (*discovery_state_changed_callback)(bt_discovery_state_t state); /** Bluetooth Legacy PinKey Request callback */ typedef void (*pin_request_callback)(bt_bdaddr_t *remote_bd_addr, bt_bdname_t *bd_name, uint32_t cod); /** Bluetooth SSP Request callback - Just Works & Numeric Comparison*/ /** pass_key - Shall be 0 for BT_SSP_PAIRING_VARIANT_CONSENT & * BT_SSP_PAIRING_PASSKEY_ENTRY */ /* TODO: Passkey request callback shall not be needed for devices with display * capability. We still need support this in the stack for completeness */ typedef void (*ssp_request_callback)(bt_bdaddr_t *remote_bd_addr, bt_bdname_t *bd_name, uint32_t cod, bt_ssp_variant_t pairing_variant, uint32_t pass_key); /** Bluetooth Bond state changed callback */ /* Invoked in response to create_bond, cancel_bond or remove_bond */ typedef void (*bond_state_changed_callback)(bt_status_t status, bt_bdaddr_t *remote_bd_addr, bt_bond_state_t state); /** Bluetooth ACL connection state changed callback */ typedef void (*acl_state_changed_callback)(bt_status_t status, bt_bdaddr_t *remote_bd_addr, bt_acl_state_t state); typedef enum { ASSOCIATE_JVM, DISASSOCIATE_JVM } bt_cb_thread_evt; /** Thread Associate/Disassociate JVM Callback */ /* Callback that is invoked by the callback thread to allow upper layer to attach/detach to/from * the JVM */ typedef void (*callback_thread_event)(bt_cb_thread_evt evt); /** Bluetooth Test Mode Callback */ /* Receive any HCI event from controller. Must be in DUT Mode for this callback to be received */ typedef void (*dut_mode_recv_callback)(uint16_t opcode, uint8_t *buf, uint8_t len); /** TODO: Add callbacks for Link Up/Down and other generic * notifications/callbacks */ /** Bluetooth DM callback structure. */ typedef struct { /** set to sizeof(bt_callbacks_t) */ size_t size; adapter_state_changed_callback adapter_state_changed_cb; adapter_properties_callback adapter_properties_cb; remote_device_properties_callback remote_device_properties_cb; device_found_callback device_found_cb; discovery_state_changed_callback discovery_state_changed_cb; pin_request_callback pin_request_cb; ssp_request_callback ssp_request_cb; bond_state_changed_callback bond_state_changed_cb; acl_state_changed_callback acl_state_changed_cb; callback_thread_event thread_evt_cb; dut_mode_recv_callback dut_mode_recv_cb; } bt_callbacks_t; /** NOTE: By default, no profiles are initialized at the time of init/enable. * Whenever the application invokes the 'init' API of a profile, then one of * the following shall occur: * * 1.) If Bluetooth is not enabled, then the Bluetooth core shall mark the * profile as enabled. Subsequently, when the application invokes the * Bluetooth 'enable', as part of the enable sequence the profile that were * marked shall be enabled by calling appropriate stack APIs. The * 'adapter_properties_cb' shall return the list of UUIDs of the * enabled profiles. * * 2.) If Bluetooth is enabled, then the Bluetooth core shall invoke the stack * profile API to initialize the profile and trigger a * 'adapter_properties_cb' with the current list of UUIDs including the * newly added profile's UUID. * * The reverse shall occur whenever the profile 'cleanup' APIs are invoked */ /** Represents the standard Bluetooth DM interface. */ typedef struct { /** set to sizeof(bt_interface_t) */ size_t size; /** * Opens the interface and provides the callback routines * to the implemenation of this interface. */ int (*init)(bt_callbacks_t* callbacks ); /** Enable Bluetooth. */ int (*enable)(void); /** Disable Bluetooth. */ int (*disable)(void); /** Closes the interface. */ void (*cleanup)(void); /** Get all Bluetooth Adapter properties at init */ int (*get_adapter_properties)(void); /** Get Bluetooth Adapter property of 'type' */ int (*get_adapter_property)(bt_property_type_t type); /** Set Bluetooth Adapter property of 'type' */ /* Based on the type, val shall be one of * bt_bdaddr_t or bt_bdname_t or bt_scanmode_t etc */ int (*set_adapter_property)(const bt_property_t *property); /** Get all Remote Device properties */ int (*get_remote_device_properties)(bt_bdaddr_t *remote_addr); /** Get Remote Device property of 'type' */ int (*get_remote_device_property)(bt_bdaddr_t *remote_addr, bt_property_type_t type); /** Set Remote Device property of 'type' */ int (*set_remote_device_property)(bt_bdaddr_t *remote_addr, const bt_property_t *property); /** Get Remote Device's service record for the given UUID */ int (*get_remote_service_record)(bt_bdaddr_t *remote_addr, bt_uuid_t *uuid); /** Start SDP to get remote services */ int (*get_remote_services)(bt_bdaddr_t *remote_addr); /** Start Discovery */ int (*start_discovery)(void); /** Cancel Discovery */ int (*cancel_discovery)(void); /** Create Bluetooth Bonding */ int (*create_bond)(const bt_bdaddr_t *bd_addr); /** Remove Bond */ int (*remove_bond)(const bt_bdaddr_t *bd_addr); /** Cancel Bond */ int (*cancel_bond)(const bt_bdaddr_t *bd_addr); /** BT Legacy PinKey Reply */ /** If accept==FALSE, then pin_len and pin_code shall be 0x0 */ int (*pin_reply)(const bt_bdaddr_t *bd_addr, uint8_t accept, uint8_t pin_len, bt_pin_code_t *pin_code); /** BT SSP Reply - Just Works, Numeric Comparison and Passkey * passkey shall be zero for BT_SSP_VARIANT_PASSKEY_COMPARISON & * BT_SSP_VARIANT_CONSENT * For BT_SSP_VARIANT_PASSKEY_ENTRY, if accept==FALSE, then passkey * shall be zero */ int (*ssp_reply)(const bt_bdaddr_t *bd_addr, bt_ssp_variant_t variant, uint8_t accept, uint32_t passkey); /** Get Bluetooth profile interface */ const void* (*get_profile_interface) (const char *profile_id); /** Bluetooth Test Mode APIs - Bluetooth must be enabled for these APIs */ /* Configure DUT Mode - Use this mode to enter/exit DUT mode */ int (*dut_mode_configure)(uint8_t enable); /* Send any test HCI (vendor-specific) command to the controller. Must be in DUT Mode */ int (*dut_mode_send)(uint16_t opcode, uint8_t *buf, uint8_t len); } bt_interface_t; /** TODO: Need to add APIs for Service Discovery, Service authorization and * connection management. Also need to add APIs for configuring * properties of remote bonded devices such as name, UUID etc. */ typedef struct { struct hw_device_t common; const bt_interface_t* (*get_bluetooth_interface)(); } bluetooth_device_t; typedef bluetooth_device_t bluetooth_module_t; __END_DECLS #endif /* ANDROID_INCLUDE_BLUETOOTH_H */ android-audiosystem-1.8+13.10.20130807/include/hardware/bt_sock.h0000644000015700001700000000351712200324306024715 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_INCLUDE_BT_SOCK_H #define ANDROID_INCLUDE_BT_SOCK_H __BEGIN_DECLS #define BTSOCK_FLAG_ENCRYPT 1 #define BTSOCK_FLAG_AUTH (1 << 1) typedef enum { BTSOCK_RFCOMM = 1, BTSOCK_SCO = 2, BTSOCK_L2CAP = 3 } btsock_type_t; /** Represents the standard BT SOCKET interface. */ typedef struct { short size; bt_bdaddr_t bd_addr; int channel; int status; } __attribute__((packed)) sock_connect_signal_t; typedef struct { /** set to size of this struct*/ size_t size; /** * listen to a rfcomm uuid or channel. It returns the socket fd from which * btsock_connect_signal can be read out when a remote device connected */ bt_status_t (*listen)(btsock_type_t type, const char* service_name, const uint8_t* service_uuid, int channel, int* sock_fd, int flags); /* * connect to a rfcomm uuid channel of remote device, It returns the socket fd from which * the btsock_connect_signal and a new socket fd to be accepted can be read out when connected */ bt_status_t (*connect)(const bt_bdaddr_t *bd_addr, btsock_type_t type, const uint8_t* uuid, int channel, int* sock_fd, int flags); } btsock_interface_t; __END_DECLS #endif /* ANDROID_INCLUDE_BT_SOCK_H */ android-audiosystem-1.8+13.10.20130807/include/hardware/qemud.h0000644000015700001700000001024412200324306024377 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_INCLUDE_HARDWARE_QEMUD_H #define ANDROID_INCLUDE_HARDWARE_QEMUD_H #include #include "qemu_pipe.h" /* the following is helper code that is used by the QEMU-specific * hardware HAL modules to communicate with the emulator program * through the 'qemud' multiplexing daemon, or through the qemud * pipe. * * see the documentation comments for details in * development/emulator/qemud/qemud.c * * all definitions here are built into the HAL module to avoid * having to write a tiny shared library for this. */ /* we expect the D macro to be defined to a function macro * that sends its formatted string argument(s) to the log. * If not, ignore the traces. */ #ifndef D # define D(...) ((void)0) #endif static __inline__ int qemud_fd_write(int fd, const void* buff, int len) { int len2; do { len2 = write(fd, buff, len); } while (len2 < 0 && errno == EINTR); return len2; } static __inline__ int qemud_fd_read(int fd, void* buff, int len) { int len2; do { len2 = read(fd, buff, len); } while (len2 < 0 && errno == EINTR); return len2; } static __inline__ int qemud_channel_open(const char* name) { int fd; int namelen = strlen(name); char answer[2]; char pipe_name[256]; /* First, try to connect to the pipe. */ snprintf(pipe_name, sizeof(pipe_name), "qemud:%s", name); fd = qemu_pipe_open(pipe_name); if (fd < 0) { D("QEMUD pipe is not available for %s: %s", name, strerror(errno)); /* If pipe is not available, connect to qemud control socket */ fd = socket_local_client( "qemud", ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_STREAM ); if (fd < 0) { D("no qemud control socket: %s", strerror(errno)); return -1; } /* send service name to connect */ if (qemud_fd_write(fd, name, namelen) != namelen) { D("can't send service name to qemud: %s", strerror(errno)); close(fd); return -1; } /* read answer from daemon */ if (qemud_fd_read(fd, answer, 2) != 2 || answer[0] != 'O' || answer[1] != 'K') { D("cant' connect to %s service through qemud", name); close(fd); return -1; } } return fd; } static __inline__ int qemud_channel_send(int fd, const void* msg, int msglen) { char header[5]; if (msglen < 0) msglen = strlen((const char*)msg); if (msglen == 0) return 0; snprintf(header, sizeof header, "%04x", msglen); if (qemud_fd_write(fd, header, 4) != 4) { D("can't write qemud frame header: %s", strerror(errno)); return -1; } if (qemud_fd_write(fd, msg, msglen) != msglen) { D("can4t write qemud frame payload: %s", strerror(errno)); return -1; } return 0; } static __inline__ int qemud_channel_recv(int fd, void* msg, int msgsize) { char header[5]; int size, avail; if (qemud_fd_read(fd, header, 4) != 4) { D("can't read qemud frame header: %s", strerror(errno)); return -1; } header[4] = 0; if (sscanf(header, "%04x", &size) != 1) { D("malformed qemud frame header: '%.*s'", 4, header); return -1; } if (size > msgsize) return -1; if (qemud_fd_read(fd, msg, size) != size) { D("can't read qemud frame payload: %s", strerror(errno)); return -1; } return size; } #endif /* ANDROID_INCLUDE_HARDWARE_QEMUD_H */ android-audiosystem-1.8+13.10.20130807/include/hardware/qemu_pipe.h0000644000015700001700000000525512200324306025256 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_INCLUDE_HARDWARE_QEMU_PIPE_H #define ANDROID_INCLUDE_HARDWARE_QEMU_PIPE_H #include #include #include #include #include /* for pthread_once() */ #include #include #include #ifndef D # define D(...) do{}while(0) #endif /* Try to open a new Qemu fast-pipe. This function returns a file descriptor * that can be used to communicate with a named service managed by the * emulator. * * This file descriptor can be used as a standard pipe/socket descriptor. * * 'pipeName' is the name of the emulator service you want to connect to. * E.g. 'opengles' or 'camera'. * * On success, return a valid file descriptor * Returns -1 on error, and errno gives the error code, e.g.: * * EINVAL -> unknown/unsupported pipeName * ENOSYS -> fast pipes not available in this system. * * ENOSYS should never happen, except if you're trying to run within a * misconfigured emulator. * * You should be able to open several pipes to the same pipe service, * except for a few special cases (e.g. GSM modem), where EBUSY will be * returned if more than one client tries to connect to it. */ static __inline__ int qemu_pipe_open(const char* pipeName) { char buff[256]; int buffLen; int fd, ret; if (pipeName == NULL || pipeName[0] == '\0') { errno = EINVAL; return -1; } snprintf(buff, sizeof buff, "pipe:%s", pipeName); fd = open("/dev/qemu_pipe", O_RDWR); if (fd < 0) { D("%s: Could not open /dev/qemu_pipe: %s", __FUNCTION__, strerror(errno)); //errno = ENOSYS; return -1; } buffLen = strlen(buff); ret = TEMP_FAILURE_RETRY(write(fd, buff, buffLen+1)); if (ret != buffLen+1) { D("%s: Could not connect to %s pipe service: %s", __FUNCTION__, pipeName, strerror(errno)); if (ret == 0) { errno = ECONNRESET; } else if (ret > 0) { errno = EINVAL; } return -1; } return fd; } #endif /* ANDROID_INCLUDE_HARDWARE_QEMUD_PIPE_H */ android-audiosystem-1.8+13.10.20130807/include/hardware/camera.h0000644000015700001700000002555212200324306024524 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010-2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_INCLUDE_CAMERA_H #define ANDROID_INCLUDE_CAMERA_H #include "camera_common.h" /** * Camera device HAL, initial version [ CAMERA_DEVICE_API_VERSION_1_0 ] * * Supports the android.hardware.Camera API. * * Camera devices that support this version of the HAL must return a value in * the range HARDWARE_DEVICE_API_VERSION(0,0)-(1,FF) in * camera_device_t.common.version. CAMERA_DEVICE_API_VERSION_1_0 is the * recommended value. * * Camera modules that implement version 2.0 or higher of camera_module_t must * also return the value of camera_device_t.common.version in * camera_info_t.device_version. * * See camera_common.h for more details. */ __BEGIN_DECLS struct camera_memory; typedef void (*camera_release_memory)(struct camera_memory *mem); typedef struct camera_memory { void *data; size_t size; void *handle; camera_release_memory release; } camera_memory_t; typedef camera_memory_t* (*camera_request_memory)(int fd, size_t buf_size, unsigned int num_bufs, void *user); typedef void (*camera_notify_callback)(int32_t msg_type, int32_t ext1, int32_t ext2, void *user); typedef void (*camera_data_callback)(int32_t msg_type, const camera_memory_t *data, unsigned int index, camera_frame_metadata_t *metadata, void *user); typedef void (*camera_data_timestamp_callback)(int64_t timestamp, int32_t msg_type, const camera_memory_t *data, unsigned int index, void *user); #define HAL_CAMERA_PREVIEW_WINDOW_TAG 0xcafed00d typedef struct preview_stream_ops { int (*dequeue_buffer)(struct preview_stream_ops* w, buffer_handle_t** buffer, int *stride); int (*enqueue_buffer)(struct preview_stream_ops* w, buffer_handle_t* buffer); int (*cancel_buffer)(struct preview_stream_ops* w, buffer_handle_t* buffer); int (*set_buffer_count)(struct preview_stream_ops* w, int count); int (*set_buffers_geometry)(struct preview_stream_ops* pw, int w, int h, int format); int (*set_crop)(struct preview_stream_ops *w, int left, int top, int right, int bottom); int (*set_usage)(struct preview_stream_ops* w, int usage); int (*set_swap_interval)(struct preview_stream_ops *w, int interval); int (*get_min_undequeued_buffer_count)(const struct preview_stream_ops *w, int *count); int (*lock_buffer)(struct preview_stream_ops* w, buffer_handle_t* buffer); // Timestamps are measured in nanoseconds, and must be comparable // and monotonically increasing between two frames in the same // preview stream. They do not need to be comparable between // consecutive or parallel preview streams, cameras, or app runs. int (*set_timestamp)(struct preview_stream_ops *w, int64_t timestamp); } preview_stream_ops_t; struct camera_device; typedef struct camera_device_ops { /** Set the ANativeWindow to which preview frames are sent */ int (*set_preview_window)(struct camera_device *, struct preview_stream_ops *window); /** Set the notification and data callbacks */ void (*set_callbacks)(struct camera_device *, camera_notify_callback notify_cb, camera_data_callback data_cb, camera_data_timestamp_callback data_cb_timestamp, camera_request_memory get_memory, void *user); /** * The following three functions all take a msg_type, which is a bitmask of * the messages defined in include/ui/Camera.h */ /** * Enable a message, or set of messages. */ void (*enable_msg_type)(struct camera_device *, int32_t msg_type); /** * Disable a message, or a set of messages. * * Once received a call to disableMsgType(CAMERA_MSG_VIDEO_FRAME), camera * HAL should not rely on its client to call releaseRecordingFrame() to * release video recording frames sent out by the cameral HAL before and * after the disableMsgType(CAMERA_MSG_VIDEO_FRAME) call. Camera HAL * clients must not modify/access any video recording frame after calling * disableMsgType(CAMERA_MSG_VIDEO_FRAME). */ void (*disable_msg_type)(struct camera_device *, int32_t msg_type); /** * Query whether a message, or a set of messages, is enabled. Note that * this is operates as an AND, if any of the messages queried are off, this * will return false. */ int (*msg_type_enabled)(struct camera_device *, int32_t msg_type); /** * Start preview mode. */ int (*start_preview)(struct camera_device *); /** * Stop a previously started preview. */ void (*stop_preview)(struct camera_device *); /** * Returns true if preview is enabled. */ int (*preview_enabled)(struct camera_device *); /** * Request the camera HAL to store meta data or real YUV data in the video * buffers sent out via CAMERA_MSG_VIDEO_FRAME for a recording session. If * it is not called, the default camera HAL behavior is to store real YUV * data in the video buffers. * * This method should be called before startRecording() in order to be * effective. * * If meta data is stored in the video buffers, it is up to the receiver of * the video buffers to interpret the contents and to find the actual frame * data with the help of the meta data in the buffer. How this is done is * outside of the scope of this method. * * Some camera HALs may not support storing meta data in the video buffers, * but all camera HALs should support storing real YUV data in the video * buffers. If the camera HAL does not support storing the meta data in the * video buffers when it is requested to do do, INVALID_OPERATION must be * returned. It is very useful for the camera HAL to pass meta data rather * than the actual frame data directly to the video encoder, since the * amount of the uncompressed frame data can be very large if video size is * large. * * @param enable if true to instruct the camera HAL to store * meta data in the video buffers; false to instruct * the camera HAL to store real YUV data in the video * buffers. * * @return OK on success. */ int (*store_meta_data_in_buffers)(struct camera_device *, int enable); /** * Start record mode. When a record image is available, a * CAMERA_MSG_VIDEO_FRAME message is sent with the corresponding * frame. Every record frame must be released by a camera HAL client via * releaseRecordingFrame() before the client calls * disableMsgType(CAMERA_MSG_VIDEO_FRAME). After the client calls * disableMsgType(CAMERA_MSG_VIDEO_FRAME), it is the camera HAL's * responsibility to manage the life-cycle of the video recording frames, * and the client must not modify/access any video recording frames. */ int (*start_recording)(struct camera_device *); /** * Stop a previously started recording. */ void (*stop_recording)(struct camera_device *); /** * Returns true if recording is enabled. */ int (*recording_enabled)(struct camera_device *); /** * Release a record frame previously returned by CAMERA_MSG_VIDEO_FRAME. * * It is camera HAL client's responsibility to release video recording * frames sent out by the camera HAL before the camera HAL receives a call * to disableMsgType(CAMERA_MSG_VIDEO_FRAME). After it receives the call to * disableMsgType(CAMERA_MSG_VIDEO_FRAME), it is the camera HAL's * responsibility to manage the life-cycle of the video recording frames. */ void (*release_recording_frame)(struct camera_device *, const void *opaque); /** * Start auto focus, the notification callback routine is called with * CAMERA_MSG_FOCUS once when focusing is complete. autoFocus() will be * called again if another auto focus is needed. */ int (*auto_focus)(struct camera_device *); /** * Cancels auto-focus function. If the auto-focus is still in progress, * this function will cancel it. Whether the auto-focus is in progress or * not, this function will return the focus position to the default. If * the camera does not support auto-focus, this is a no-op. */ int (*cancel_auto_focus)(struct camera_device *); /** * Take a picture. */ int (*take_picture)(struct camera_device *); /** * Cancel a picture that was started with takePicture. Calling this method * when no picture is being taken is a no-op. */ int (*cancel_picture)(struct camera_device *); /** * Set the camera parameters. This returns BAD_VALUE if any parameter is * invalid or not supported. */ int (*set_parameters)(struct camera_device *, const char *parms); /** Retrieve the camera parameters. The buffer returned by the camera HAL must be returned back to it with put_parameters, if put_parameters is not NULL. */ char *(*get_parameters)(struct camera_device *); /** The camera HAL uses its own memory to pass us the parameters when we call get_parameters. Use this function to return the memory back to the camera HAL, if put_parameters is not NULL. If put_parameters is NULL, then you have to use free() to release the memory. */ void (*put_parameters)(struct camera_device *, char *); /** * Send command to camera driver. */ int (*send_command)(struct camera_device *, int32_t cmd, int32_t arg1, int32_t arg2); /** * Release the hardware resources owned by this object. Note that this is * *not* done in the destructor. */ void (*release)(struct camera_device *); /** * Dump state of the camera hardware */ int (*dump)(struct camera_device *, int fd); } camera_device_ops_t; typedef struct camera_device { /** * camera_device.common.version must be in the range * HARDWARE_DEVICE_API_VERSION(0,0)-(1,FF). CAMERA_DEVICE_API_VERSION_1_0 is * recommended. */ hw_device_t common; camera_device_ops_t *ops; void *priv; } camera_device_t; __END_DECLS #endif /* #ifdef ANDROID_INCLUDE_CAMERA_H */ android-audiosystem-1.8+13.10.20130807/include/hardware/bt_hh.h0000644000015700001700000001347312200324306024357 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_INCLUDE_BT_HH_H #define ANDROID_INCLUDE_BT_HH_H #include __BEGIN_DECLS #define BTHH_MAX_DSC_LEN 884 /* HH connection states */ typedef enum { BTHH_CONN_STATE_CONNECTED = 0, BTHH_CONN_STATE_CONNECTING, BTHH_CONN_STATE_DISCONNECTED, BTHH_CONN_STATE_DISCONNECTING, BTHH_CONN_STATE_FAILED_MOUSE_FROM_HOST, BTHH_CONN_STATE_FAILED_KBD_FROM_HOST, BTHH_CONN_STATE_FAILED_TOO_MANY_DEVICES, BTHH_CONN_STATE_FAILED_NO_BTHID_DRIVER, BTHH_CONN_STATE_FAILED_GENERIC, BTHH_CONN_STATE_UNKNOWN } bthh_connection_state_t; typedef enum { BTHH_OK = 0, BTHH_HS_HID_NOT_READY, /* handshake error : device not ready */ BTHH_HS_INVALID_RPT_ID, /* handshake error : invalid report ID */ BTHH_HS_TRANS_NOT_SPT, /* handshake error : transaction not spt */ BTHH_HS_INVALID_PARAM, /* handshake error : invalid paremter */ BTHH_HS_ERROR, /* handshake error : unspecified HS error */ BTHH_ERR, /* general BTA HH error */ BTHH_ERR_SDP, /* SDP error */ BTHH_ERR_PROTO, /* SET_Protocol error, only used in BTA_HH_OPEN_EVT callback */ BTHH_ERR_DB_FULL, /* device database full error, used */ BTHH_ERR_TOD_UNSPT, /* type of device not supported */ BTHH_ERR_NO_RES, /* out of system resources */ BTHH_ERR_AUTH_FAILED, /* authentication fail */ BTHH_ERR_HDL }bthh_status_t; /* Protocol modes */ typedef enum { BTHH_REPORT_MODE = 0x00, BTHH_BOOT_MODE = 0x01, BTHH_UNSUPPORTED_MODE = 0xff }bthh_protocol_mode_t; /* Report types */ typedef enum { BTHH_INPUT_REPORT = 1, BTHH_OUTPUT_REPORT, BTHH_FEATURE_REPORT }bthh_report_type_t; typedef struct { int attr_mask; uint8_t sub_class; uint8_t app_id; int vendor_id; int product_id; int version; uint8_t ctry_code; int dl_len; uint8_t dsc_list[BTHH_MAX_DSC_LEN]; } bthh_hid_info_t; /** Callback for connection state change. * state will have one of the values from bthh_connection_state_t */ typedef void (* bthh_connection_state_callback)(bt_bdaddr_t *bd_addr, bthh_connection_state_t state); /** Callback for vitual unplug api. * the status of the vitual unplug */ typedef void (* bthh_virtual_unplug_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status); /** Callback for get hid info * hid_info will contain attr_mask, sub_class, app_id, vendor_id, product_id, version, ctry_code, len */ typedef void (* bthh_hid_info_callback)(bt_bdaddr_t *bd_addr, bthh_hid_info_t hid_info); /** Callback for get/set protocal api. * the protocol mode is one of the value from bthh_protocol_mode_t */ typedef void (* bthh_protocol_mode_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status,bthh_protocol_mode_t mode); /** Callback for get/set_idle_time api. */ typedef void (* bthh_idle_time_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, int idle_rate); /** Callback for get report api. * if staus is ok rpt_data contains the report data */ typedef void (* bthh_get_report_callback)(bt_bdaddr_t *bd_addr, bthh_status_t hh_status, uint8_t* rpt_data, int rpt_size); /** BT-HH callback structure. */ typedef struct { /** set to sizeof(BtHfCallbacks) */ size_t size; bthh_connection_state_callback connection_state_cb; bthh_hid_info_callback hid_info_cb; bthh_protocol_mode_callback protocol_mode_cb; bthh_idle_time_callback idle_time_cb; bthh_get_report_callback get_report_cb; bthh_virtual_unplug_callback virtual_unplug_cb; } bthh_callbacks_t; /** Represents the standard BT-HH interface. */ typedef struct { /** set to sizeof(BtHhInterface) */ size_t size; /** * Register the BtHh callbacks */ bt_status_t (*init)( bthh_callbacks_t* callbacks ); /** connect to hid device */ bt_status_t (*connect)( bt_bdaddr_t *bd_addr); /** dis-connect from hid device */ bt_status_t (*disconnect)( bt_bdaddr_t *bd_addr ); /** Virtual UnPlug (VUP) the specified HID device */ bt_status_t (*virtual_unplug)(bt_bdaddr_t *bd_addr); /** Set the HID device descriptor for the specified HID device. */ bt_status_t (*set_info)(bt_bdaddr_t *bd_addr, bthh_hid_info_t hid_info ); /** Get the HID proto mode. */ bt_status_t (*get_protocol) (bt_bdaddr_t *bd_addr, bthh_protocol_mode_t protocolMode); /** Set the HID proto mode. */ bt_status_t (*set_protocol)(bt_bdaddr_t *bd_addr, bthh_protocol_mode_t protocolMode); /** Send a GET_REPORT to HID device. */ bt_status_t (*get_report)(bt_bdaddr_t *bd_addr, bthh_report_type_t reportType, uint8_t reportId, int bufferSize); /** Send a SET_REPORT to HID device. */ bt_status_t (*set_report)(bt_bdaddr_t *bd_addr, bthh_report_type_t reportType, char* report); /** Send data to HID device. */ bt_status_t (*send_data)(bt_bdaddr_t *bd_addr, char* data); /** Closes the interface. */ void (*cleanup)( void ); } bthh_interface_t; __END_DECLS #endif /* ANDROID_INCLUDE_BT_HH_H */ android-audiosystem-1.8+13.10.20130807/include/hardware/camera_common.h0000644000015700001700000001323612200324306026070 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // FIXME: add well-defined names for cameras #ifndef ANDROID_INCLUDE_CAMERA_COMMON_H #define ANDROID_INCLUDE_CAMERA_COMMON_H #include #include #include #include #include #include #include __BEGIN_DECLS /** * The id of this module */ #define CAMERA_HARDWARE_MODULE_ID "camera" /** * Module versioning information for the Camera hardware module, based on * camera_module_t.common.module_api_version. The two most significant hex * digits represent the major version, and the two least significant represent * the minor version. * ******************************************************************************* * Versions: 0.X - 1.X [CAMERA_MODULE_API_VERSION_1_0] * * Camera modules that report these version numbers implement the initial * camera module HAL interface. All camera devices openable through this * module support only version 1 of the camera device HAL. The device_version * and static_camera_characteristics fields of camera_info are not valid. Only * the android.hardware.Camera API can be supported by this module and its * devices. * ******************************************************************************* * Version: 2.0 [CAMERA_MODULE_API_VERSION_2_0] * * Camera modules that report this version number implement the second version * of the camera module HAL interface. Camera devices openable through this * module may support either version 1.0 or version 2.0 of the camera device * HAL interface. The device_version field of camera_info is always valid; the * static_camera_characteristics field of camera_info is valid if the * device_version field is 2.0 or higher. */ /** * Predefined macros for currently-defined version numbers */ /** * All module versions <= HARDWARE_MODULE_API_VERSION(1, 0xFF) must be treated * as CAMERA_MODULE_API_VERSION_1_0 */ #define CAMERA_MODULE_API_VERSION_1_0 HARDWARE_MODULE_API_VERSION(1, 0) #define CAMERA_MODULE_API_VERSION_2_0 HARDWARE_MODULE_API_VERSION(2, 0) #define CAMERA_MODULE_API_VERSION_CURRENT CAMERA_MODULE_API_VERSION_2_0 /** * All device versions <= HARDWARE_DEVICE_API_VERSION(1, 0xFF) must be treated * as CAMERA_DEVICE_API_VERSION_1_0 */ #define CAMERA_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0) #define CAMERA_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0) // Device version 2.0 is experimental #define CAMERA_DEVICE_API_VERSION_CURRENT CAMERA_DEVICE_API_VERSION_1_0 /** * Defined in /system/media/camera/include/system/camera_metadata.h */ typedef struct camera_metadata camera_metadata_t; struct camera_info { /** * The direction that the camera faces to. It should be CAMERA_FACING_BACK * or CAMERA_FACING_FRONT. * * Version information: * Valid in all camera_module versions */ int facing; /** * The orientation of the camera image. The value is the angle that the * camera image needs to be rotated clockwise so it shows correctly on the * display in its natural orientation. It should be 0, 90, 180, or 270. * * For example, suppose a device has a naturally tall screen. The * back-facing camera sensor is mounted in landscape. You are looking at * the screen. If the top side of the camera sensor is aligned with the * right edge of the screen in natural orientation, the value should be * 90. If the top side of a front-facing camera sensor is aligned with the * right of the screen, the value should be 270. * * Version information: * Valid in all camera_module versions */ int orientation; /** * The value of camera_device_t.common.version. * * Version information (based on camera_module_t.common.module_api_version): * * CAMERA_MODULE_API_VERSION_1_0: * * Not valid. Can be assumed to be CAMERA_DEVICE_API_VERSION_1_0. Do * not read this field. * * CAMERA_MODULE_API_VERSION_2_0: * * Always valid * */ uint32_t device_version; /** * The camera's fixed characteristics, which include all camera metadata in * the android.*.info.* sections. This should be a sorted metadata buffer, * and may not be modified or freed by the caller. The pointer should remain * valid for the lifetime of the camera module. * * Version information (based on camera_module_t.common.module_api_version): * * CAMERA_MODULE_API_VERSION_1_0: * * Not valid. Extra characteristics are not available. Do not read this * field. * * CAMERA_MODULE_API_VERSION_2_0: * * Valid if device_version >= CAMERA_DEVICE_API_VERSION_2_0. Do not read * otherwise. * */ const camera_metadata_t *static_camera_characteristics; }; typedef struct camera_module { hw_module_t common; int (*get_number_of_cameras)(void); int (*get_camera_info)(int camera_id, struct camera_info *info); } camera_module_t; __END_DECLS #endif /* ANDROID_INCLUDE_CAMERA_COMMON_H */ android-audiosystem-1.8+13.10.20130807/include/hardware/power.h0000644000015700001700000001242012200324306024416 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_INCLUDE_HARDWARE_POWER_H #define ANDROID_INCLUDE_HARDWARE_POWER_H #include #include #include #include __BEGIN_DECLS #define POWER_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1) #define POWER_MODULE_API_VERSION_0_2 HARDWARE_MODULE_API_VERSION(0, 2) /** * The id of this module */ #define POWER_HARDWARE_MODULE_ID "power" /* * Power hint identifiers passed to (*powerHint) */ typedef enum { POWER_HINT_VSYNC = 0x00000001, POWER_HINT_INTERACTION = 0x00000002, POWER_HINT_VIDEO_ENCODE = 0x00000003, POWER_HINT_CPU_BOOST = 0x00000004, } power_hint_t; /** * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM * and the fields of this data structure must begin with hw_module_t * followed by module specific information. */ typedef struct power_module { struct hw_module_t common; /* * (*init)() performs power management setup actions at runtime * startup, such as to set default cpufreq parameters. This is * called only by the Power HAL instance loaded by * PowerManagerService. */ void (*init)(struct power_module *module); /* * (*setInteractive)() performs power management actions upon the * system entering interactive state (that is, the system is awake * and ready for interaction, often with UI devices such as * display and touchscreen enabled) or non-interactive state (the * system appears asleep, display usually turned off). The * non-interactive state is usually entered after a period of * inactivity, in order to conserve battery power during * such inactive periods. * * Typical actions are to turn on or off devices and adjust * cpufreq parameters. This function may also call the * appropriate interfaces to allow the kernel to suspend the * system to low-power sleep state when entering non-interactive * state, and to disallow low-power suspend when the system is in * interactive state. When low-power suspend state is allowed, the * kernel may suspend the system whenever no wakelocks are held. * * on is non-zero when the system is transitioning to an * interactive / awake state, and zero when transitioning to a * non-interactive / asleep state. * * This function is called to enter non-interactive state after * turning off the screen (if present), and called to enter * interactive state prior to turning on the screen. */ void (*setInteractive)(struct power_module *module, int on); /* * (*powerHint) is called to pass hints on power requirements, which * may result in adjustment of power/performance parameters of the * cpufreq governor and other controls. The possible hints are: * * POWER_HINT_VSYNC * * Foreground app has started or stopped requesting a VSYNC pulse * from SurfaceFlinger. If the app has started requesting VSYNC * then CPU and GPU load is expected soon, and it may be appropriate * to raise speeds of CPU, memory bus, etc. The data parameter is * non-zero to indicate VSYNC pulse is now requested, or zero for * VSYNC pulse no longer requested. * * POWER_HINT_INTERACTION * * User is interacting with the device, for example, touchscreen * events are incoming. CPU and GPU load may be expected soon, * and it may be appropriate to raise speeds of CPU, memory bus, * etc. The data parameter is unused. * * POWER_HINT_VIDEO_ENCODE * * The user just started or stopped recording video. When encode * begins, large writes to the SD card will be done and this may * cause CPU frequency to increase. The data parameter is a string * with semicolon-separated 'key:value' pairs. The most common key is * 'state', which takes 0 or 1 as its value. For instance, To * indicate that recording is beginning, the string "state:1" would * need to be used. More keys can be provided depending on the data * that is to be passed. * * POWER_HINT_CPU_BOOST * * An operation is happening where it would be ideal for the CPU to * be boosted for a specific duration. The data parameter is an * integer value of the boost duration in microseconds. * * A particular platform may choose to ignore any hint. * * availability: version 0.2 * */ void (*powerHint)(struct power_module *module, power_hint_t hint, void *data); } power_module_t; __END_DECLS #endif // ANDROID_INCLUDE_HARDWARE_POWER_H android-audiosystem-1.8+13.10.20130807/include/hardware/audio_effect.h0000644000015700001700000015062412200324306025710 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_EFFECT_H #define ANDROID_AUDIO_EFFECT_H #include #include #include #include #include #include #include __BEGIN_DECLS ///////////////////////////////////////////////// // Common Definitions ///////////////////////////////////////////////// // //--- Effect descriptor structure effect_descriptor_t // // Unique effect ID (can be generated from the following site: // http://www.itu.int/ITU-T/asn1/uuid.html) // This format is used for both "type" and "uuid" fields of the effect descriptor structure. // - When used for effect type and the engine is implementing and effect corresponding to a standard // OpenSL ES interface, this ID must be the one defined in OpenSLES_IID.h for that interface. // - When used as uuid, it should be a unique UUID for this particular implementation. typedef struct effect_uuid_s { uint32_t timeLow; uint16_t timeMid; uint16_t timeHiAndVersion; uint16_t clockSeq; uint8_t node[6]; } effect_uuid_t; // Maximum length of character strings in structures defines by this API. #define EFFECT_STRING_LEN_MAX 64 // NULL UUID definition (matches SL_IID_NULL_) #define EFFECT_UUID_INITIALIZER { 0xec7178ec, 0xe5e1, 0x4432, 0xa3f4, \ { 0x46, 0x57, 0xe6, 0x79, 0x52, 0x10 } } static const effect_uuid_t EFFECT_UUID_NULL_ = EFFECT_UUID_INITIALIZER; const effect_uuid_t * const EFFECT_UUID_NULL = &EFFECT_UUID_NULL_; const char * const EFFECT_UUID_NULL_STR = "ec7178ec-e5e1-4432-a3f4-4657e6795210"; // The effect descriptor contains necessary information to facilitate the enumeration of the effect // engines present in a library. typedef struct effect_descriptor_s { effect_uuid_t type; // UUID of to the OpenSL ES interface implemented by this effect effect_uuid_t uuid; // UUID for this particular implementation uint32_t apiVersion; // Version of the effect control API implemented uint32_t flags; // effect engine capabilities/requirements flags (see below) uint16_t cpuLoad; // CPU load indication (see below) uint16_t memoryUsage; // Data Memory usage (see below) char name[EFFECT_STRING_LEN_MAX]; // human readable effect name char implementor[EFFECT_STRING_LEN_MAX]; // human readable effect implementor name } effect_descriptor_t; // CPU load and memory usage indication: each effect implementation must provide an indication of // its CPU and memory usage for the audio effect framework to limit the number of effects // instantiated at a given time on a given platform. // The CPU load is expressed in 0.1 MIPS units as estimated on an ARM9E core (ARMv5TE) with 0 WS. // The memory usage is expressed in KB and includes only dynamically allocated memory // Definitions for flags field of effect descriptor. // +---------------------------+-----------+----------------------------------- // | description | bits | values // +---------------------------+-----------+----------------------------------- // | connection mode | 0..2 | 0 insert: after track process // | | | 1 auxiliary: connect to track auxiliary // | | | output and use send level // | | | 2 replace: replaces track process function; // | | | must implement SRC, volume and mono to stereo. // | | | 3 pre processing: applied below audio HAL on input // | | | 4 post processing: applied below audio HAL on output // | | | 5 - 7 reserved // +---------------------------+-----------+----------------------------------- // | insertion preference | 3..5 | 0 none // | | | 1 first of the chain // | | | 2 last of the chain // | | | 3 exclusive (only effect in the insert chain) // | | | 4..7 reserved // +---------------------------+-----------+----------------------------------- // | Volume management | 6..8 | 0 none // | | | 1 implements volume control // | | | 2 requires volume indication // | | | 4 reserved // +---------------------------+-----------+----------------------------------- // | Device indication | 9..11 | 0 none // | | | 1 requires device updates // | | | 2, 4 reserved // +---------------------------+-----------+----------------------------------- // | Sample input mode | 12..13 | 1 direct: process() function or EFFECT_CMD_SET_CONFIG // | | | command must specify a buffer descriptor // | | | 2 provider: process() function uses the // | | | bufferProvider indicated by the // | | | EFFECT_CMD_SET_CONFIG command to request input. // | | | buffers. // | | | 3 both: both input modes are supported // +---------------------------+-----------+----------------------------------- // | Sample output mode | 14..15 | 1 direct: process() function or EFFECT_CMD_SET_CONFIG // | | | command must specify a buffer descriptor // | | | 2 provider: process() function uses the // | | | bufferProvider indicated by the // | | | EFFECT_CMD_SET_CONFIG command to request output // | | | buffers. // | | | 3 both: both output modes are supported // +---------------------------+-----------+----------------------------------- // | Hardware acceleration | 16..17 | 0 No hardware acceleration // | | | 1 non tunneled hw acceleration: the process() function // | | | reads the samples, send them to HW accelerated // | | | effect processor, reads back the processed samples // | | | and returns them to the output buffer. // | | | 2 tunneled hw acceleration: the process() function is // | | | transparent. The effect interface is only used to // | | | control the effect engine. This mode is relevant for // | | | global effects actually applied by the audio // | | | hardware on the output stream. // +---------------------------+-----------+----------------------------------- // | Audio Mode indication | 18..19 | 0 none // | | | 1 requires audio mode updates // | | | 2..3 reserved // +---------------------------+-----------+----------------------------------- // | Audio source indication | 20..21 | 0 none // | | | 1 requires audio source updates // | | | 2..3 reserved // +---------------------------+-----------+----------------------------------- // Insert mode #define EFFECT_FLAG_TYPE_SHIFT 0 #define EFFECT_FLAG_TYPE_SIZE 3 #define EFFECT_FLAG_TYPE_MASK (((1 << EFFECT_FLAG_TYPE_SIZE) -1) \ << EFFECT_FLAG_TYPE_SHIFT) #define EFFECT_FLAG_TYPE_INSERT (0 << EFFECT_FLAG_TYPE_SHIFT) #define EFFECT_FLAG_TYPE_AUXILIARY (1 << EFFECT_FLAG_TYPE_SHIFT) #define EFFECT_FLAG_TYPE_REPLACE (2 << EFFECT_FLAG_TYPE_SHIFT) #define EFFECT_FLAG_TYPE_PRE_PROC (3 << EFFECT_FLAG_TYPE_SHIFT) #define EFFECT_FLAG_TYPE_POST_PROC (4 << EFFECT_FLAG_TYPE_SHIFT) // Insert preference #define EFFECT_FLAG_INSERT_SHIFT (EFFECT_FLAG_TYPE_SHIFT + EFFECT_FLAG_TYPE_SIZE) #define EFFECT_FLAG_INSERT_SIZE 3 #define EFFECT_FLAG_INSERT_MASK (((1 << EFFECT_FLAG_INSERT_SIZE) -1) \ << EFFECT_FLAG_INSERT_SHIFT) #define EFFECT_FLAG_INSERT_ANY (0 << EFFECT_FLAG_INSERT_SHIFT) #define EFFECT_FLAG_INSERT_FIRST (1 << EFFECT_FLAG_INSERT_SHIFT) #define EFFECT_FLAG_INSERT_LAST (2 << EFFECT_FLAG_INSERT_SHIFT) #define EFFECT_FLAG_INSERT_EXCLUSIVE (3 << EFFECT_FLAG_INSERT_SHIFT) // Volume control #define EFFECT_FLAG_VOLUME_SHIFT (EFFECT_FLAG_INSERT_SHIFT + EFFECT_FLAG_INSERT_SIZE) #define EFFECT_FLAG_VOLUME_SIZE 3 #define EFFECT_FLAG_VOLUME_MASK (((1 << EFFECT_FLAG_VOLUME_SIZE) -1) \ << EFFECT_FLAG_VOLUME_SHIFT) #define EFFECT_FLAG_VOLUME_CTRL (1 << EFFECT_FLAG_VOLUME_SHIFT) #define EFFECT_FLAG_VOLUME_IND (2 << EFFECT_FLAG_VOLUME_SHIFT) #define EFFECT_FLAG_VOLUME_NONE (0 << EFFECT_FLAG_VOLUME_SHIFT) // Device indication #define EFFECT_FLAG_DEVICE_SHIFT (EFFECT_FLAG_VOLUME_SHIFT + EFFECT_FLAG_VOLUME_SIZE) #define EFFECT_FLAG_DEVICE_SIZE 3 #define EFFECT_FLAG_DEVICE_MASK (((1 << EFFECT_FLAG_DEVICE_SIZE) -1) \ << EFFECT_FLAG_DEVICE_SHIFT) #define EFFECT_FLAG_DEVICE_IND (1 << EFFECT_FLAG_DEVICE_SHIFT) #define EFFECT_FLAG_DEVICE_NONE (0 << EFFECT_FLAG_DEVICE_SHIFT) // Sample input modes #define EFFECT_FLAG_INPUT_SHIFT (EFFECT_FLAG_DEVICE_SHIFT + EFFECT_FLAG_DEVICE_SIZE) #define EFFECT_FLAG_INPUT_SIZE 2 #define EFFECT_FLAG_INPUT_MASK (((1 << EFFECT_FLAG_INPUT_SIZE) -1) \ << EFFECT_FLAG_INPUT_SHIFT) #define EFFECT_FLAG_INPUT_DIRECT (1 << EFFECT_FLAG_INPUT_SHIFT) #define EFFECT_FLAG_INPUT_PROVIDER (2 << EFFECT_FLAG_INPUT_SHIFT) #define EFFECT_FLAG_INPUT_BOTH (3 << EFFECT_FLAG_INPUT_SHIFT) // Sample output modes #define EFFECT_FLAG_OUTPUT_SHIFT (EFFECT_FLAG_INPUT_SHIFT + EFFECT_FLAG_INPUT_SIZE) #define EFFECT_FLAG_OUTPUT_SIZE 2 #define EFFECT_FLAG_OUTPUT_MASK (((1 << EFFECT_FLAG_OUTPUT_SIZE) -1) \ << EFFECT_FLAG_OUTPUT_SHIFT) #define EFFECT_FLAG_OUTPUT_DIRECT (1 << EFFECT_FLAG_OUTPUT_SHIFT) #define EFFECT_FLAG_OUTPUT_PROVIDER (2 << EFFECT_FLAG_OUTPUT_SHIFT) #define EFFECT_FLAG_OUTPUT_BOTH (3 << EFFECT_FLAG_OUTPUT_SHIFT) // Hardware acceleration mode #define EFFECT_FLAG_HW_ACC_SHIFT (EFFECT_FLAG_OUTPUT_SHIFT + EFFECT_FLAG_OUTPUT_SIZE) #define EFFECT_FLAG_HW_ACC_SIZE 2 #define EFFECT_FLAG_HW_ACC_MASK (((1 << EFFECT_FLAG_HW_ACC_SIZE) -1) \ << EFFECT_FLAG_HW_ACC_SHIFT) #define EFFECT_FLAG_HW_ACC_SIMPLE (1 << EFFECT_FLAG_HW_ACC_SHIFT) #define EFFECT_FLAG_HW_ACC_TUNNEL (2 << EFFECT_FLAG_HW_ACC_SHIFT) // Audio mode indication #define EFFECT_FLAG_AUDIO_MODE_SHIFT (EFFECT_FLAG_HW_ACC_SHIFT + EFFECT_FLAG_HW_ACC_SIZE) #define EFFECT_FLAG_AUDIO_MODE_SIZE 2 #define EFFECT_FLAG_AUDIO_MODE_MASK (((1 << EFFECT_FLAG_AUDIO_MODE_SIZE) -1) \ << EFFECT_FLAG_AUDIO_MODE_SHIFT) #define EFFECT_FLAG_AUDIO_MODE_IND (1 << EFFECT_FLAG_AUDIO_MODE_SHIFT) #define EFFECT_FLAG_AUDIO_MODE_NONE (0 << EFFECT_FLAG_AUDIO_MODE_SHIFT) // Audio source indication #define EFFECT_FLAG_AUDIO_SOURCE_SHIFT (EFFECT_FLAG_AUDIO_MODE_SHIFT + EFFECT_FLAG_AUDIO_MODE_SIZE) #define EFFECT_FLAG_AUDIO_SOURCE_SIZE 2 #define EFFECT_FLAG_AUDIO_SOURCE_MASK (((1 << EFFECT_FLAG_AUDIO_SOURCE_SIZE) -1) \ << EFFECT_FLAG_AUDIO_SOURCE_SHIFT) #define EFFECT_FLAG_AUDIO_SOURCE_IND (1 << EFFECT_FLAG_AUDIO_SOURCE_SHIFT) #define EFFECT_FLAG_AUDIO_SOURCE_NONE (0 << EFFECT_FLAG_AUDIO_SOURCE_SHIFT) #define EFFECT_MAKE_API_VERSION(M, m) (((M)<<16) | ((m) & 0xFFFF)) #define EFFECT_API_VERSION_MAJOR(v) ((v)>>16) #define EFFECT_API_VERSION_MINOR(v) ((m) & 0xFFFF) ///////////////////////////////////////////////// // Effect control interface ///////////////////////////////////////////////// // Effect control interface version 2.0 #define EFFECT_CONTROL_API_VERSION EFFECT_MAKE_API_VERSION(2,0) // Effect control interface structure: effect_interface_s // The effect control interface is exposed by each effect engine implementation. It consists of // a set of functions controlling the configuration, activation and process of the engine. // The functions are grouped in a structure of type effect_interface_s. // // Effect control interface handle: effect_handle_t // The effect_handle_t serves two purposes regarding the implementation of the effect engine: // - 1 it is the address of a pointer to an effect_interface_s structure where the functions // of the effect control API for a particular effect are located. // - 2 it is the address of the context of a particular effect instance. // A typical implementation in the effect library would define a structure as follows: // struct effect_module_s { // const struct effect_interface_s *itfe; // effect_config_t config; // effect_context_t context; // } // The implementation of EffectCreate() function would then allocate a structure of this // type and return its address as effect_handle_t typedef struct effect_interface_s **effect_handle_t; // Forward definition of type audio_buffer_t typedef struct audio_buffer_s audio_buffer_t; // Effect control interface definition struct effect_interface_s { //////////////////////////////////////////////////////////////////////////////// // // Function: process // // Description: Effect process function. Takes input samples as specified // (count and location) in input buffer descriptor and output processed // samples as specified in output buffer descriptor. If the buffer descriptor // is not specified the function must use either the buffer or the // buffer provider function installed by the EFFECT_CMD_SET_CONFIG command. // The effect framework will call the process() function after the EFFECT_CMD_ENABLE // command is received and until the EFFECT_CMD_DISABLE is received. When the engine // receives the EFFECT_CMD_DISABLE command it should turn off the effect gracefully // and when done indicate that it is OK to stop calling the process() function by // returning the -ENODATA status. // // NOTE: the process() function implementation should be "real-time safe" that is // it should not perform blocking calls: malloc/free, sleep, read/write/open/close, // pthread_cond_wait/pthread_mutex_lock... // // Input: // self: handle to the effect interface this function // is called on. // inBuffer: buffer descriptor indicating where to read samples to process. // If NULL, use the configuration passed by EFFECT_CMD_SET_CONFIG command. // // outBuffer: buffer descriptor indicating where to write processed samples. // If NULL, use the configuration passed by EFFECT_CMD_SET_CONFIG command. // // Output: // returned value: 0 successful operation // -ENODATA the engine has finished the disable phase and the framework // can stop calling process() // -EINVAL invalid interface handle or // invalid input/output buffer description //////////////////////////////////////////////////////////////////////////////// int32_t (*process)(effect_handle_t self, audio_buffer_t *inBuffer, audio_buffer_t *outBuffer); //////////////////////////////////////////////////////////////////////////////// // // Function: command // // Description: Send a command and receive a response to/from effect engine. // // Input: // self: handle to the effect interface this function // is called on. // cmdCode: command code: the command can be a standardized command defined in // effect_command_e (see below) or a proprietary command. // cmdSize: size of command in bytes // pCmdData: pointer to command data // pReplyData: pointer to reply data // // Input/Output: // replySize: maximum size of reply data as input // actual size of reply data as output // // Output: // returned value: 0 successful operation // -EINVAL invalid interface handle or // invalid command/reply size or format according to command code // The return code should be restricted to indicate problems related to the this // API specification. Status related to the execution of a particular command should be // indicated as part of the reply field. // // *pReplyData updated with command response // //////////////////////////////////////////////////////////////////////////////// int32_t (*command)(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, uint32_t *replySize, void *pReplyData); //////////////////////////////////////////////////////////////////////////////// // // Function: get_descriptor // // Description: Returns the effect descriptor // // Input: // self: handle to the effect interface this function // is called on. // // Input/Output: // pDescriptor: address where to return the effect descriptor. // // Output: // returned value: 0 successful operation. // -EINVAL invalid interface handle or invalid pDescriptor // *pDescriptor: updated with the effect descriptor. // //////////////////////////////////////////////////////////////////////////////// int32_t (*get_descriptor)(effect_handle_t self, effect_descriptor_t *pDescriptor); //////////////////////////////////////////////////////////////////////////////// // // Function: process_reverse // // Description: Process reverse stream function. This function is used to pass // a reference stream to the effect engine. If the engine does not need a reference // stream, this function pointer can be set to NULL. // This function would typically implemented by an Echo Canceler. // // Input: // self: handle to the effect interface this function // is called on. // inBuffer: buffer descriptor indicating where to read samples to process. // If NULL, use the configuration passed by EFFECT_CMD_SET_CONFIG_REVERSE command. // // outBuffer: buffer descriptor indicating where to write processed samples. // If NULL, use the configuration passed by EFFECT_CMD_SET_CONFIG_REVERSE command. // If the buffer and buffer provider in the configuration received by // EFFECT_CMD_SET_CONFIG_REVERSE are also NULL, do not return modified reverse // stream data // // Output: // returned value: 0 successful operation // -ENODATA the engine has finished the disable phase and the framework // can stop calling process_reverse() // -EINVAL invalid interface handle or // invalid input/output buffer description //////////////////////////////////////////////////////////////////////////////// int32_t (*process_reverse)(effect_handle_t self, audio_buffer_t *inBuffer, audio_buffer_t *outBuffer); }; // //--- Standardized command codes for command() function // enum effect_command_e { EFFECT_CMD_INIT, // initialize effect engine EFFECT_CMD_SET_CONFIG, // configure effect engine (see effect_config_t) EFFECT_CMD_RESET, // reset effect engine EFFECT_CMD_ENABLE, // enable effect process EFFECT_CMD_DISABLE, // disable effect process EFFECT_CMD_SET_PARAM, // set parameter immediately (see effect_param_t) EFFECT_CMD_SET_PARAM_DEFERRED, // set parameter deferred EFFECT_CMD_SET_PARAM_COMMIT, // commit previous set parameter deferred EFFECT_CMD_GET_PARAM, // get parameter EFFECT_CMD_SET_DEVICE, // set audio device (see audio.h, audio_devices_t) EFFECT_CMD_SET_VOLUME, // set volume EFFECT_CMD_SET_AUDIO_MODE, // set the audio mode (normal, ring, ...) EFFECT_CMD_SET_CONFIG_REVERSE, // configure effect engine reverse stream(see effect_config_t) EFFECT_CMD_SET_INPUT_DEVICE, // set capture device (see audio.h, audio_devices_t) EFFECT_CMD_GET_CONFIG, // read effect engine configuration EFFECT_CMD_GET_CONFIG_REVERSE, // read configure effect engine reverse stream configuration EFFECT_CMD_GET_FEATURE_SUPPORTED_CONFIGS,// get all supported configurations for a feature. EFFECT_CMD_GET_FEATURE_CONFIG, // get current feature configuration EFFECT_CMD_SET_FEATURE_CONFIG, // set current feature configuration EFFECT_CMD_SET_AUDIO_SOURCE, // set the audio source (see audio.h, audio_source_t) EFFECT_CMD_FIRST_PROPRIETARY = 0x10000 // first proprietary command code }; //================================================================================================== // command: EFFECT_CMD_INIT //-------------------------------------------------------------------------------------------------- // description: // Initialize effect engine: All configurations return to default //-------------------------------------------------------------------------------------------------- // command format: // size: 0 // data: N/A //-------------------------------------------------------------------------------------------------- // reply format: // size: sizeof(int) // data: status //================================================================================================== // command: EFFECT_CMD_SET_CONFIG //-------------------------------------------------------------------------------------------------- // description: // Apply new audio parameters configurations for input and output buffers //-------------------------------------------------------------------------------------------------- // command format: // size: sizeof(effect_config_t) // data: effect_config_t //-------------------------------------------------------------------------------------------------- // reply format: // size: sizeof(int) // data: status //================================================================================================== // command: EFFECT_CMD_RESET //-------------------------------------------------------------------------------------------------- // description: // Reset the effect engine. Keep configuration but resets state and buffer content //-------------------------------------------------------------------------------------------------- // command format: // size: 0 // data: N/A //-------------------------------------------------------------------------------------------------- // reply format: // size: 0 // data: N/A //================================================================================================== // command: EFFECT_CMD_ENABLE //-------------------------------------------------------------------------------------------------- // description: // Enable the process. Called by the framework before the first call to process() //-------------------------------------------------------------------------------------------------- // command format: // size: 0 // data: N/A //-------------------------------------------------------------------------------------------------- // reply format: // size: sizeof(int) // data: status //================================================================================================== // command: EFFECT_CMD_DISABLE //-------------------------------------------------------------------------------------------------- // description: // Disable the process. Called by the framework after the last call to process() //-------------------------------------------------------------------------------------------------- // command format: // size: 0 // data: N/A //-------------------------------------------------------------------------------------------------- // reply format: // size: sizeof(int) // data: status //================================================================================================== // command: EFFECT_CMD_SET_PARAM //-------------------------------------------------------------------------------------------------- // description: // Set a parameter and apply it immediately //-------------------------------------------------------------------------------------------------- // command format: // size: sizeof(effect_param_t) + size of param and value // data: effect_param_t + param + value. See effect_param_t definition below for value offset //-------------------------------------------------------------------------------------------------- // reply format: // size: sizeof(int) // data: status //================================================================================================== // command: EFFECT_CMD_SET_PARAM_DEFERRED //-------------------------------------------------------------------------------------------------- // description: // Set a parameter but apply it only when receiving EFFECT_CMD_SET_PARAM_COMMIT command //-------------------------------------------------------------------------------------------------- // command format: // size: sizeof(effect_param_t) + size of param and value // data: effect_param_t + param + value. See effect_param_t definition below for value offset //-------------------------------------------------------------------------------------------------- // reply format: // size: 0 // data: N/A //================================================================================================== // command: EFFECT_CMD_SET_PARAM_COMMIT //-------------------------------------------------------------------------------------------------- // description: // Apply all previously received EFFECT_CMD_SET_PARAM_DEFERRED commands //-------------------------------------------------------------------------------------------------- // command format: // size: 0 // data: N/A //-------------------------------------------------------------------------------------------------- // reply format: // size: sizeof(int) // data: status //================================================================================================== // command: EFFECT_CMD_GET_PARAM //-------------------------------------------------------------------------------------------------- // description: // Get a parameter value //-------------------------------------------------------------------------------------------------- // command format: // size: sizeof(effect_param_t) + size of param // data: effect_param_t + param //-------------------------------------------------------------------------------------------------- // reply format: // size: sizeof(effect_param_t) + size of param and value // data: effect_param_t + param + value. See effect_param_t definition below for value offset //================================================================================================== // command: EFFECT_CMD_SET_DEVICE //-------------------------------------------------------------------------------------------------- // description: // Set the rendering device the audio output path is connected to. See audio.h, audio_devices_t // for device values. // The effect implementation must set EFFECT_FLAG_DEVICE_IND flag in its descriptor to receive this // command when the device changes //-------------------------------------------------------------------------------------------------- // command format: // size: sizeof(uint32_t) // data: uint32_t //-------------------------------------------------------------------------------------------------- // reply format: // size: 0 // data: N/A //================================================================================================== // command: EFFECT_CMD_SET_VOLUME //-------------------------------------------------------------------------------------------------- // description: // Set and get volume. Used by audio framework to delegate volume control to effect engine. // The effect implementation must set EFFECT_FLAG_VOLUME_IND or EFFECT_FLAG_VOLUME_CTRL flag in // its descriptor to receive this command before every call to process() function // If EFFECT_FLAG_VOLUME_CTRL flag is set in the effect descriptor, the effect engine must return // the volume that should be applied before the effect is processed. The overall volume (the volume // actually applied by the effect engine multiplied by the returned value) should match the value // indicated in the command. //-------------------------------------------------------------------------------------------------- // command format: // size: n * sizeof(uint32_t) // data: volume for each channel defined in effect_config_t for output buffer expressed in // 8.24 fixed point format //-------------------------------------------------------------------------------------------------- // reply format: // size: n * sizeof(uint32_t) / 0 // data: - if EFFECT_FLAG_VOLUME_CTRL is set in effect descriptor: // volume for each channel defined in effect_config_t for output buffer expressed in // 8.24 fixed point format // - if EFFECT_FLAG_VOLUME_CTRL is not set in effect descriptor: // N/A // It is legal to receive a null pointer as pReplyData in which case the effect framework has // delegated volume control to another effect //================================================================================================== // command: EFFECT_CMD_SET_AUDIO_MODE //-------------------------------------------------------------------------------------------------- // description: // Set the audio mode. The effect implementation must set EFFECT_FLAG_AUDIO_MODE_IND flag in its // descriptor to receive this command when the audio mode changes. //-------------------------------------------------------------------------------------------------- // command format: // size: sizeof(uint32_t) // data: audio_mode_t //-------------------------------------------------------------------------------------------------- // reply format: // size: 0 // data: N/A //================================================================================================== // command: EFFECT_CMD_SET_CONFIG_REVERSE //-------------------------------------------------------------------------------------------------- // description: // Apply new audio parameters configurations for input and output buffers of reverse stream. // An example of reverse stream is the echo reference supplied to an Acoustic Echo Canceler. //-------------------------------------------------------------------------------------------------- // command format: // size: sizeof(effect_config_t) // data: effect_config_t //-------------------------------------------------------------------------------------------------- // reply format: // size: sizeof(int) // data: status //================================================================================================== // command: EFFECT_CMD_SET_INPUT_DEVICE //-------------------------------------------------------------------------------------------------- // description: // Set the capture device the audio input path is connected to. See audio.h, audio_devices_t // for device values. // The effect implementation must set EFFECT_FLAG_DEVICE_IND flag in its descriptor to receive this // command when the device changes //-------------------------------------------------------------------------------------------------- // command format: // size: sizeof(uint32_t) // data: uint32_t //-------------------------------------------------------------------------------------------------- // reply format: // size: 0 // data: N/A //================================================================================================== // command: EFFECT_CMD_GET_CONFIG //-------------------------------------------------------------------------------------------------- // description: // Read audio parameters configurations for input and output buffers //-------------------------------------------------------------------------------------------------- // command format: // size: 0 // data: N/A //-------------------------------------------------------------------------------------------------- // reply format: // size: sizeof(effect_config_t) // data: effect_config_t //================================================================================================== // command: EFFECT_CMD_GET_CONFIG_REVERSE //-------------------------------------------------------------------------------------------------- // description: // Read audio parameters configurations for input and output buffers of reverse stream //-------------------------------------------------------------------------------------------------- // command format: // size: 0 // data: N/A //-------------------------------------------------------------------------------------------------- // reply format: // size: sizeof(effect_config_t) // data: effect_config_t //================================================================================================== // command: EFFECT_CMD_GET_FEATURE_SUPPORTED_CONFIGS //-------------------------------------------------------------------------------------------------- // description: // Queries for supported configurations for a particular feature (e.g. get the supported // combinations of main and auxiliary channels for a noise suppressor). // The command parameter is the feature identifier (See effect_feature_e for a list of defined // features) followed by the maximum number of configuration descriptor to return. // The reply is composed of: // - status (uint32_t): // - 0 if feature is supported // - -ENOSYS if the feature is not supported, // - -ENOMEM if the feature is supported but the total number of supported configurations // exceeds the maximum number indicated by the caller. // - total number of supported configurations (uint32_t) // - an array of configuration descriptors. // The actual number of descriptors returned must not exceed the maximum number indicated by // the caller. //-------------------------------------------------------------------------------------------------- // command format: // size: 2 x sizeof(uint32_t) // data: effect_feature_e + maximum number of configurations to return //-------------------------------------------------------------------------------------------------- // reply format: // size: 2 x sizeof(uint32_t) + n x sizeof () // data: status + total number of configurations supported + array of n config descriptors //================================================================================================== // command: EFFECT_CMD_GET_FEATURE_CONFIG //-------------------------------------------------------------------------------------------------- // description: // Retrieves current configuration for a given feature. // The reply status is: // - 0 if feature is supported // - -ENOSYS if the feature is not supported, //-------------------------------------------------------------------------------------------------- // command format: // size: sizeof(uint32_t) // data: effect_feature_e //-------------------------------------------------------------------------------------------------- // reply format: // size: sizeof(uint32_t) + sizeof () // data: status + config descriptor //================================================================================================== // command: EFFECT_CMD_SET_FEATURE_CONFIG //-------------------------------------------------------------------------------------------------- // description: // Sets current configuration for a given feature. // The reply status is: // - 0 if feature is supported // - -ENOSYS if the feature is not supported, // - -EINVAL if the configuration is invalid //-------------------------------------------------------------------------------------------------- // command format: // size: sizeof(uint32_t) + sizeof () // data: effect_feature_e + config descriptor //-------------------------------------------------------------------------------------------------- // reply format: // size: sizeof(uint32_t) // data: status //================================================================================================== // command: EFFECT_CMD_SET_AUDIO_SOURCE //-------------------------------------------------------------------------------------------------- // description: // Set the audio source the capture path is configured for (Camcorder, voice recognition...). // See audio.h, audio_source_t for values. //-------------------------------------------------------------------------------------------------- // command format: // size: sizeof(uint32_t) // data: uint32_t //-------------------------------------------------------------------------------------------------- // reply format: // size: 0 // data: N/A //================================================================================================== // command: EFFECT_CMD_FIRST_PROPRIETARY //-------------------------------------------------------------------------------------------------- // description: // All proprietary effect commands must use command codes above this value. The size and format of // command and response fields is free in this case //================================================================================================== // Audio buffer descriptor used by process(), bufferProvider() functions and buffer_config_t // structure. Multi-channel audio is always interleaved. The channel order is from LSB to MSB with // regard to the channel mask definition in audio.h, audio_channel_mask_t e.g : // Stereo: left, right // 5 point 1: front left, front right, front center, low frequency, back left, back right // The buffer size is expressed in frame count, a frame being composed of samples for all // channels at a given time. Frame size for unspecified format (AUDIO_FORMAT_OTHER) is 8 bit by // definition struct audio_buffer_s { size_t frameCount; // number of frames in buffer union { void* raw; // raw pointer to start of buffer int32_t* s32; // pointer to signed 32 bit data at start of buffer int16_t* s16; // pointer to signed 16 bit data at start of buffer uint8_t* u8; // pointer to unsigned 8 bit data at start of buffer }; }; // The buffer_provider_s structure contains functions that can be used // by the effect engine process() function to query and release input // or output audio buffer. // The getBuffer() function is called to retrieve a buffer where data // should read from or written to by process() function. // The releaseBuffer() function MUST be called when the buffer retrieved // with getBuffer() is not needed anymore. // The process function should use the buffer provider mechanism to retrieve // input or output buffer if the inBuffer or outBuffer passed as argument is NULL // and the buffer configuration (buffer_config_t) given by the EFFECT_CMD_SET_CONFIG // command did not specify an audio buffer. typedef int32_t (* buffer_function_t)(void *cookie, audio_buffer_t *buffer); typedef struct buffer_provider_s { buffer_function_t getBuffer; // retrieve next buffer buffer_function_t releaseBuffer; // release used buffer void *cookie; // for use by client of buffer provider functions } buffer_provider_t; // The buffer_config_s structure specifies the input or output audio format // to be used by the effect engine. It is part of the effect_config_t // structure that defines both input and output buffer configurations and is // passed by the EFFECT_CMD_SET_CONFIG or EFFECT_CMD_SET_CONFIG_REVERSE command. typedef struct buffer_config_s { audio_buffer_t buffer; // buffer for use by process() function if not passed explicitly uint32_t samplingRate; // sampling rate uint32_t channels; // channel mask (see audio_channel_mask_t in audio.h) buffer_provider_t bufferProvider; // buffer provider uint8_t format; // Audio format (see see audio_format_t in audio.h) uint8_t accessMode; // read/write or accumulate in buffer (effect_buffer_access_e) uint16_t mask; // indicates which of the above fields is valid } buffer_config_t; // Values for "accessMode" field of buffer_config_t: // overwrite, read only, accumulate (read/modify/write) enum effect_buffer_access_e { EFFECT_BUFFER_ACCESS_WRITE, EFFECT_BUFFER_ACCESS_READ, EFFECT_BUFFER_ACCESS_ACCUMULATE }; // feature identifiers for EFFECT_CMD_GET_FEATURE_SUPPORTED_CONFIGS command enum effect_feature_e { EFFECT_FEATURE_AUX_CHANNELS, // supports auxiliary channels (e.g. dual mic noise suppressor) EFFECT_FEATURE_CNT }; // EFFECT_FEATURE_AUX_CHANNELS feature configuration descriptor. Describe a combination // of main and auxiliary channels supported typedef struct channel_config_s { audio_channel_mask_t main_channels; // channel mask for main channels audio_channel_mask_t aux_channels; // channel mask for auxiliary channels } channel_config_t; // Values for bit field "mask" in buffer_config_t. If a bit is set, the corresponding field // in buffer_config_t must be taken into account when executing the EFFECT_CMD_SET_CONFIG command #define EFFECT_CONFIG_BUFFER 0x0001 // buffer field must be taken into account #define EFFECT_CONFIG_SMP_RATE 0x0002 // samplingRate field must be taken into account #define EFFECT_CONFIG_CHANNELS 0x0004 // channels field must be taken into account #define EFFECT_CONFIG_FORMAT 0x0008 // format field must be taken into account #define EFFECT_CONFIG_ACC_MODE 0x0010 // accessMode field must be taken into account #define EFFECT_CONFIG_PROVIDER 0x0020 // bufferProvider field must be taken into account #define EFFECT_CONFIG_ALL (EFFECT_CONFIG_BUFFER | EFFECT_CONFIG_SMP_RATE | \ EFFECT_CONFIG_CHANNELS | EFFECT_CONFIG_FORMAT | \ EFFECT_CONFIG_ACC_MODE | EFFECT_CONFIG_PROVIDER) // effect_config_s structure describes the format of the pCmdData argument of EFFECT_CMD_SET_CONFIG // command to configure audio parameters and buffers for effect engine input and output. typedef struct effect_config_s { buffer_config_t inputCfg; buffer_config_t outputCfg; } effect_config_t; // effect_param_s structure describes the format of the pCmdData argument of EFFECT_CMD_SET_PARAM // command and pCmdData and pReplyData of EFFECT_CMD_GET_PARAM command. // psize and vsize represent the actual size of parameter and value. // // NOTE: the start of value field inside the data field is always on a 32 bit boundary: // // +-----------+ // | status | sizeof(int) // +-----------+ // | psize | sizeof(int) // +-----------+ // | vsize | sizeof(int) // +-----------+ // | | | | // ~ parameter ~ > psize | // | | | > ((psize - 1)/sizeof(int) + 1) * sizeof(int) // +-----------+ | // | padding | | // +-----------+ // | | | // ~ value ~ > vsize // | | | // +-----------+ typedef struct effect_param_s { int32_t status; // Transaction status (unused for command, used for reply) uint32_t psize; // Parameter size uint32_t vsize; // Value size char data[]; // Start of Parameter + Value data } effect_param_t; ///////////////////////////////////////////////// // Effect library interface ///////////////////////////////////////////////// // Effect library interface version 2.0 #define EFFECT_LIBRARY_API_VERSION EFFECT_MAKE_API_VERSION(2,0) #define AUDIO_EFFECT_LIBRARY_TAG ((('A') << 24) | (('E') << 16) | (('L') << 8) | ('T')) // Every effect library must have a data structure named AUDIO_EFFECT_LIBRARY_INFO_SYM // and the fields of this data structure must begin with audio_effect_library_t typedef struct audio_effect_library_s { // tag must be initialized to AUDIO_EFFECT_LIBRARY_TAG uint32_t tag; // Version of the effect library API : 0xMMMMmmmm MMMM: Major, mmmm: minor uint32_t version; // Name of this library const char *name; // Author/owner/implementor of the library const char *implementor; //////////////////////////////////////////////////////////////////////////////// // // Function: query_num_effects // // Description: Returns the number of different effects exposed by the // library. Each effect must have a unique effect uuid (see // effect_descriptor_t). This function together with EffectQueryEffect() // is used to enumerate all effects present in the library. // // Input/Output: // pNumEffects: address where the number of effects should be returned. // // Output: // returned value: 0 successful operation. // -ENODEV library failed to initialize // -EINVAL invalid pNumEffects // *pNumEffects: updated with number of effects in library // //////////////////////////////////////////////////////////////////////////////// int32_t (*query_num_effects)(uint32_t *pNumEffects); //////////////////////////////////////////////////////////////////////////////// // // Function: query_effect // // Description: Returns the descriptor of the effect engine which index is // given as argument. // See effect_descriptor_t for details on effect descriptors. // This function together with EffectQueryNumberEffects() is used to enumerate all // effects present in the library. The enumeration sequence is: // EffectQueryNumberEffects(&num_effects); // for (i = 0; i < num_effects; i++) // EffectQueryEffect(i,...); // // Input/Output: // index: index of the effect // pDescriptor: address where to return the effect descriptor. // // Output: // returned value: 0 successful operation. // -ENODEV library failed to initialize // -EINVAL invalid pDescriptor or index // -ENOSYS effect list has changed since last execution of // EffectQueryNumberEffects() // -ENOENT no more effect available // *pDescriptor: updated with the effect descriptor. // //////////////////////////////////////////////////////////////////////////////// int32_t (*query_effect)(uint32_t index, effect_descriptor_t *pDescriptor); //////////////////////////////////////////////////////////////////////////////// // // Function: create_effect // // Description: Creates an effect engine of the specified implementation uuid and // returns an effect control interface on this engine. The function will allocate the // resources for an instance of the requested effect engine and return // a handle on the effect control interface. // // Input: // uuid: pointer to the effect uuid. // sessionId: audio session to which this effect instance will be attached. All effects // created with the same session ID are connected in series and process the same signal // stream. Knowing that two effects are part of the same effect chain can help the // library implement some kind of optimizations. // ioId: identifies the output or input stream this effect is directed to at audio HAL. // For future use especially with tunneled HW accelerated effects // // Input/Output: // pHandle: address where to return the effect interface handle. // // Output: // returned value: 0 successful operation. // -ENODEV library failed to initialize // -EINVAL invalid pEffectUuid or pHandle // -ENOENT no effect with this uuid found // *pHandle: updated with the effect interface handle. // //////////////////////////////////////////////////////////////////////////////// int32_t (*create_effect)(const effect_uuid_t *uuid, int32_t sessionId, int32_t ioId, effect_handle_t *pHandle); //////////////////////////////////////////////////////////////////////////////// // // Function: release_effect // // Description: Releases the effect engine whose handle is given as argument. // All resources allocated to this particular instance of the effect are // released. // // Input: // handle: handle on the effect interface to be released. // // Output: // returned value: 0 successful operation. // -ENODEV library failed to initialize // -EINVAL invalid interface handle // //////////////////////////////////////////////////////////////////////////////// int32_t (*release_effect)(effect_handle_t handle); //////////////////////////////////////////////////////////////////////////////// // // Function: get_descriptor // // Description: Returns the descriptor of the effect engine which implementation UUID is // given as argument. // // Input/Output: // uuid: pointer to the effect uuid. // pDescriptor: address where to return the effect descriptor. // // Output: // returned value: 0 successful operation. // -ENODEV library failed to initialize // -EINVAL invalid pDescriptor or uuid // *pDescriptor: updated with the effect descriptor. // //////////////////////////////////////////////////////////////////////////////// int32_t (*get_descriptor)(const effect_uuid_t *uuid, effect_descriptor_t *pDescriptor); } audio_effect_library_t; // Name of the hal_module_info #define AUDIO_EFFECT_LIBRARY_INFO_SYM AELI // Name of the hal_module_info as a string #define AUDIO_EFFECT_LIBRARY_INFO_SYM_AS_STR "AELI" __END_DECLS #endif // ANDROID_AUDIO_EFFECT_H android-audiosystem-1.8+13.10.20130807/include/hardware/audio_policy.h0000644000015700001700000004745312200324306025760 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * Copyright (c) 2012, Code Aurora Forum. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_POLICY_INTERFACE_H #define ANDROID_AUDIO_POLICY_INTERFACE_H #include #include #include #include #include #include __BEGIN_DECLS /** * The id of this module */ #define AUDIO_POLICY_HARDWARE_MODULE_ID "audio_policy" /** * Name of the audio devices to open */ #define AUDIO_POLICY_INTERFACE "policy" /* ---------------------------------------------------------------------------- */ /* * The audio_policy and audio_policy_service_ops structs define the * communication interfaces between the platform specific audio policy manager * and Android generic audio policy manager. * The platform specific audio policy manager must implement methods of the * audio_policy struct. * This implementation makes use of the audio_policy_service_ops to control * the activity and configuration of audio input and output streams. * * The platform specific audio policy manager is in charge of the audio * routing and volume control policies for a given platform. * The main roles of this module are: * - keep track of current system state (removable device connections, phone * state, user requests...). * System state changes and user actions are notified to audio policy * manager with methods of the audio_policy. * * - process get_output() queries received when AudioTrack objects are * created: Those queries return a handler on an output that has been * selected, configured and opened by the audio policy manager and that * must be used by the AudioTrack when registering to the AudioFlinger * with the createTrack() method. * When the AudioTrack object is released, a release_output() query * is received and the audio policy manager can decide to close or * reconfigure the output depending on other streams using this output and * current system state. * * - similarly process get_input() and release_input() queries received from * AudioRecord objects and configure audio inputs. * - process volume control requests: the stream volume is converted from * an index value (received from UI) to a float value applicable to each * output as a function of platform specific settings and current output * route (destination device). It also make sure that streams are not * muted if not allowed (e.g. camera shutter sound in some countries). */ /* XXX: this should be defined OUTSIDE of frameworks/base */ struct effect_descriptor_s; struct audio_policy { /* * configuration functions */ /* indicate a change in device connection status */ int (*set_device_connection_state)(struct audio_policy *pol, audio_devices_t device, audio_policy_dev_state_t state, const char *device_address); /* retrieve a device connection status */ audio_policy_dev_state_t (*get_device_connection_state)( const struct audio_policy *pol, audio_devices_t device, const char *device_address); /* indicate a change in phone state. Valid phones states are defined * by audio_mode_t */ void (*set_phone_state)(struct audio_policy *pol, audio_mode_t state); /* deprecated, never called (was "indicate a change in ringer mode") */ void (*set_ringer_mode)(struct audio_policy *pol, uint32_t mode, uint32_t mask); /* force using a specific device category for the specified usage */ void (*set_force_use)(struct audio_policy *pol, audio_policy_force_use_t usage, audio_policy_forced_cfg_t config); /* retrieve current device category forced for a given usage */ audio_policy_forced_cfg_t (*get_force_use)(const struct audio_policy *pol, audio_policy_force_use_t usage); /* if can_mute is true, then audio streams that are marked ENFORCED_AUDIBLE * can still be muted. */ void (*set_can_mute_enforced_audible)(struct audio_policy *pol, bool can_mute); /* check proper initialization */ int (*init_check)(const struct audio_policy *pol); /* * Audio routing query functions */ #ifdef QCOM_ICS_LPA_COMPAT /* request an session appropriate for playback of the supplied stream type and * parameters */ audio_io_handle_t (*get_session)(struct audio_policy *pol, audio_stream_type_t stream, uint32_t format, audio_output_flags_t flags, int sessionId); /* pause session created for LPA Playback */ void (*pause_session)(struct audio_policy *pol, audio_io_handle_t output, audio_stream_type_t stream); /* resume session created for LPA Playback */ void (*resume_session)(struct audio_policy *pol, audio_io_handle_t output, audio_stream_type_t stream); /* release session created for LPA Playback */ void (*release_session)(struct audio_policy *pol, audio_io_handle_t output); #endif /* request an output appropriate for playback of the supplied stream type and * parameters */ audio_io_handle_t (*get_output)(struct audio_policy *pol, audio_stream_type_t stream, uint32_t samplingRate, audio_format_t format, audio_channel_mask_t channelMask, audio_output_flags_t flags); /* indicates to the audio policy manager that the output starts being used * by corresponding stream. */ int (*start_output)(struct audio_policy *pol, audio_io_handle_t output, audio_stream_type_t stream, int session); /* indicates to the audio policy manager that the output stops being used * by corresponding stream. */ int (*stop_output)(struct audio_policy *pol, audio_io_handle_t output, audio_stream_type_t stream, int session); /* releases the output. */ void (*release_output)(struct audio_policy *pol, audio_io_handle_t output); /* request an input appropriate for record from the supplied device with * supplied parameters. */ audio_io_handle_t (*get_input)(struct audio_policy *pol, audio_source_t inputSource, uint32_t samplingRate, audio_format_t format, audio_channel_mask_t channelMask, audio_in_acoustics_t acoustics); /* indicates to the audio policy manager that the input starts being used */ int (*start_input)(struct audio_policy *pol, audio_io_handle_t input); /* indicates to the audio policy manager that the input stops being used. */ int (*stop_input)(struct audio_policy *pol, audio_io_handle_t input); /* releases the input. */ void (*release_input)(struct audio_policy *pol, audio_io_handle_t input); /* * volume control functions */ /* initialises stream volume conversion parameters by specifying volume * index range. The index range for each stream is defined by AudioService. */ void (*init_stream_volume)(struct audio_policy *pol, audio_stream_type_t stream, int index_min, int index_max); /* sets the new stream volume at a level corresponding to the supplied * index. The index is within the range specified by init_stream_volume() */ int (*set_stream_volume_index)(struct audio_policy *pol, audio_stream_type_t stream, int index); /* retrieve current volume index for the specified stream */ int (*get_stream_volume_index)(const struct audio_policy *pol, audio_stream_type_t stream, int *index); #ifndef ICS_AUDIO_BLOB /* sets the new stream volume at a level corresponding to the supplied * index for the specified device. * The index is within the range specified by init_stream_volume() */ int (*set_stream_volume_index_for_device)(struct audio_policy *pol, audio_stream_type_t stream, int index, audio_devices_t device); /* retrieve current volume index for the specified stream for the specified device */ int (*get_stream_volume_index_for_device)(const struct audio_policy *pol, audio_stream_type_t stream, int *index, audio_devices_t device); #endif /* return the strategy corresponding to a given stream type */ uint32_t (*get_strategy_for_stream)(const struct audio_policy *pol, audio_stream_type_t stream); /* return the enabled output devices for the given stream type */ audio_devices_t (*get_devices_for_stream)(const struct audio_policy *pol, audio_stream_type_t stream); /* Audio effect management */ audio_io_handle_t (*get_output_for_effect)(struct audio_policy *pol, const struct effect_descriptor_s *desc); int (*register_effect)(struct audio_policy *pol, const struct effect_descriptor_s *desc, audio_io_handle_t output, uint32_t strategy, int session, int id); int (*unregister_effect)(struct audio_policy *pol, int id); int (*set_effect_enabled)(struct audio_policy *pol, int id, bool enabled); bool (*is_stream_active)(const struct audio_policy *pol, audio_stream_type_t stream, uint32_t in_past_ms); bool (*is_source_active)(const struct audio_policy *pol, audio_source_t source); /* dump state */ int (*dump)(const struct audio_policy *pol, int fd); }; /* audio hw module handle used by load_hw_module(), open_output_on_module() * and open_input_on_module() */ typedef int audio_module_handle_t; struct audio_policy_service_ops { /* * Audio output Control functions */ /* Opens an audio output with the requested parameters. * * The parameter values can indicate to use the default values in case the * audio policy manager has no specific requirements for the output being * opened. * * When the function returns, the parameter values reflect the actual * values used by the audio hardware output stream. * * The audio policy manager can check if the proposed parameters are * suitable or not and act accordingly. */ audio_io_handle_t (*open_output)(void *service, audio_devices_t *pDevices, uint32_t *pSamplingRate, audio_format_t *pFormat, audio_channel_mask_t *pChannelMask, uint32_t *pLatencyMs, audio_output_flags_t flags); #ifdef QCOM_ICS_LPA_COMPAT audio_io_handle_t (*open_session)(void *service, uint32_t *pDevices, uint32_t *pFormat, audio_output_flags_t flags, int32_t stream, int32_t sessionId); audio_io_handle_t (*close_session)(void *service, audio_io_handle_t output); #endif /* creates a special output that is duplicated to the two outputs passed as * arguments. The duplication is performed by * a special mixer thread in the AudioFlinger. */ audio_io_handle_t (*open_duplicate_output)(void *service, audio_io_handle_t output1, audio_io_handle_t output2); /* closes the output stream */ int (*close_output)(void *service, audio_io_handle_t output); /* suspends the output. * * When an output is suspended, the corresponding audio hardware output * stream is placed in standby and the AudioTracks attached to the mixer * thread are still processed but the output mix is discarded. */ int (*suspend_output)(void *service, audio_io_handle_t output); /* restores a suspended output. */ int (*restore_output)(void *service, audio_io_handle_t output); /* */ /* Audio input Control functions */ /* */ /* opens an audio input * deprecated - new implementations should use open_input_on_module, * and the acoustics parameter is ignored */ audio_io_handle_t (*open_input)(void *service, audio_devices_t *pDevices, uint32_t *pSamplingRate, audio_format_t *pFormat, audio_channel_mask_t *pChannelMask, audio_in_acoustics_t acoustics); /* closes an audio input */ int (*close_input)(void *service, audio_io_handle_t input); /* */ /* misc control functions */ /* */ /* set a stream volume for a particular output. * * For the same user setting, a given stream type can have different * volumes for each output (destination device) it is attached to. */ int (*set_stream_volume)(void *service, audio_stream_type_t stream, float volume, audio_io_handle_t output, int delay_ms); /* reroute a given stream type to the specified output */ int (*set_stream_output)(void *service, audio_stream_type_t stream, audio_io_handle_t output); /* function enabling to send proprietary informations directly from audio * policy manager to audio hardware interface. */ void (*set_parameters)(void *service, audio_io_handle_t io_handle, const char *kv_pairs, int delay_ms); /* function enabling to receive proprietary informations directly from * audio hardware interface to audio policy manager. * * Returns a pointer to a heap allocated string. The caller is responsible * for freeing the memory for it using free(). */ char * (*get_parameters)(void *service, audio_io_handle_t io_handle, const char *keys); /* request the playback of a tone on the specified stream. * used for instance to replace notification sounds when playing over a * telephony device during a phone call. */ int (*start_tone)(void *service, audio_policy_tone_t tone, audio_stream_type_t stream); int (*stop_tone)(void *service); /* set down link audio volume. */ int (*set_voice_volume)(void *service, float volume, int delay_ms); /* move effect to the specified output */ int (*move_effects)(void *service, int session, audio_io_handle_t src_output, audio_io_handle_t dst_output); #ifdef QCOM_FM_ENABLED /* set fm audio volume. */ int (*set_fm_volume)(void *service, float volume, int delay_ms); #endif /* loads an audio hw module. * * The module name passed is the base name of the HW module library, e.g "primary" or "a2dp". * The function returns a handle on the module that will be used to specify a particular * module when calling open_output_on_module() or open_input_on_module() */ audio_module_handle_t (*load_hw_module)(void *service, const char *name); /* Opens an audio output on a particular HW module. * * Same as open_output() but specifying a specific HW module on which the output must be opened. */ audio_io_handle_t (*open_output_on_module)(void *service, audio_module_handle_t module, audio_devices_t *pDevices, uint32_t *pSamplingRate, audio_format_t *pFormat, audio_channel_mask_t *pChannelMask, uint32_t *pLatencyMs, audio_output_flags_t flags); /* Opens an audio input on a particular HW module. * * Same as open_input() but specifying a specific HW module on which the input must be opened. * Also removed deprecated acoustics parameter */ audio_io_handle_t (*open_input_on_module)(void *service, audio_module_handle_t module, audio_devices_t *pDevices, uint32_t *pSamplingRate, audio_format_t *pFormat, audio_channel_mask_t *pChannelMask); }; /**********************************************************************/ /** * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM * and the fields of this data structure must begin with hw_module_t * followed by module specific information. */ typedef struct audio_policy_module { struct hw_module_t common; } audio_policy_module_t; struct audio_policy_device { struct hw_device_t common; int (*create_audio_policy)(const struct audio_policy_device *device, struct audio_policy_service_ops *aps_ops, void *service, struct audio_policy **ap); int (*destroy_audio_policy)(const struct audio_policy_device *device, struct audio_policy *ap); }; /** convenience API for opening and closing a supported device */ static inline int audio_policy_dev_open(const hw_module_t* module, struct audio_policy_device** device) { return module->methods->open(module, AUDIO_POLICY_INTERFACE, (hw_device_t**)device); } static inline int audio_policy_dev_close(struct audio_policy_device* device) { return device->common.close(&device->common); } __END_DECLS #endif // ANDROID_AUDIO_POLICY_INTERFACE_H android-audiosystem-1.8+13.10.20130807/include/hardware/lights.h0000644000015700001700000000747212200324306024567 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_LIGHTS_INTERFACE_H #define ANDROID_LIGHTS_INTERFACE_H #include #include #include #include __BEGIN_DECLS /** * The id of this module */ #define LIGHTS_HARDWARE_MODULE_ID "lights" /* * These light IDs correspond to logical lights, not physical. * So for example, if your INDICATOR light is in line with your * BUTTONS, it might make sense to also light the INDICATOR * light to a reasonable color when the BUTTONS are lit. */ #define LIGHT_ID_BACKLIGHT "backlight" #define LIGHT_ID_KEYBOARD "keyboard" #define LIGHT_ID_BUTTONS "buttons" #define LIGHT_ID_BATTERY "battery" #define LIGHT_ID_NOTIFICATIONS "notifications" #define LIGHT_ID_ATTENTION "attention" /* * These lights aren't currently supported by the higher * layers, but could be someday, so we have the constants * here now. */ #define LIGHT_ID_BLUETOOTH "bluetooth" #define LIGHT_ID_WIFI "wifi" /* ************************************************************************ * Flash modes for the flashMode field of light_state_t. */ #define LIGHT_FLASH_NONE 0 /** * To flash the light at a given rate, set flashMode to LIGHT_FLASH_TIMED, * and then flashOnMS should be set to the number of milliseconds to turn * the light on, followed by the number of milliseconds to turn the light * off. */ #define LIGHT_FLASH_TIMED 1 /** * To flash the light using hardware assist, set flashMode to * the hardware mode. */ #define LIGHT_FLASH_HARDWARE 2 /** * Light brightness is managed by a user setting. */ #define BRIGHTNESS_MODE_USER 0 /** * Light brightness is managed by a light sensor. */ #define BRIGHTNESS_MODE_SENSOR 1 /** * The parameters that can be set for a given light. * * Not all lights must support all parameters. If you * can do something backward-compatible, you should. */ struct light_state_t { /** * The color of the LED in ARGB. * * Do your best here. * - If your light can only do red or green, if they ask for blue, * you should do green. * - If you can only do a brightness ramp, then use this formula: * unsigned char brightness = ((77*((color>>16)&0x00ff)) * + (150*((color>>8)&0x00ff)) + (29*(color&0x00ff))) >> 8; * - If you can only do on or off, 0 is off, anything else is on. * * The high byte should be ignored. Callers will set it to 0xff (which * would correspond to 255 alpha). */ unsigned int color; /** * See the LIGHT_FLASH_* constants */ int flashMode; int flashOnMS; int flashOffMS; /** * Policy used by the framework to manage the light's brightness. * Currently the values are BRIGHTNESS_MODE_USER and BRIGHTNESS_MODE_SENSOR. */ int brightnessMode; }; struct light_device_t { struct hw_device_t common; /** * Set the provided lights to the provided values. * * Returns: 0 on succes, error code on failure. */ int (*set_light)(struct light_device_t* dev, struct light_state_t const* state); }; __END_DECLS #endif // ANDROID_LIGHTS_INTERFACE_H android-audiosystem-1.8+13.10.20130807/include/hardware/hwcomposer_defs.h0000644000015700001700000001444412200324306026461 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_DEFS_H #define ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_DEFS_H #include #include #include #include #include __BEGIN_DECLS /*****************************************************************************/ #define HWC_HEADER_VERSION 1 #define HWC_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1) #define HWC_DEVICE_API_VERSION_0_1 HARDWARE_DEVICE_API_VERSION_2(0, 1, HWC_HEADER_VERSION) #define HWC_DEVICE_API_VERSION_0_2 HARDWARE_DEVICE_API_VERSION_2(0, 2, HWC_HEADER_VERSION) #define HWC_DEVICE_API_VERSION_0_3 HARDWARE_DEVICE_API_VERSION_2(0, 3, HWC_HEADER_VERSION) #define HWC_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION_2(1, 0, HWC_HEADER_VERSION) #define HWC_DEVICE_API_VERSION_1_1 HARDWARE_DEVICE_API_VERSION_2(1, 1, HWC_HEADER_VERSION) #define HWC_DEVICE_API_VERSION_1_2 HARDWARE_DEVICE_API_VERSION_2(1, 2, HWC_HEADER_VERSION) enum { /* hwc_composer_device_t::set failed in EGL */ HWC_EGL_ERROR = -1 }; /* * hwc_layer_t::hints values * Hints are set by the HAL and read by SurfaceFlinger */ enum { /* * HWC can set the HWC_HINT_TRIPLE_BUFFER hint to indicate to SurfaceFlinger * that it should triple buffer this layer. Typically HWC does this when * the layer will be unavailable for use for an extended period of time, * e.g. if the display will be fetching data directly from the layer and * the layer can not be modified until after the next set(). */ HWC_HINT_TRIPLE_BUFFER = 0x00000001, /* * HWC sets HWC_HINT_CLEAR_FB to tell SurfaceFlinger that it should clear the * framebuffer with transparent pixels where this layer would be. * SurfaceFlinger will only honor this flag when the layer has no blending * */ HWC_HINT_CLEAR_FB = 0x00000002 }; /* * hwc_layer_t::flags values * Flags are set by SurfaceFlinger and read by the HAL */ enum { /* * HWC_SKIP_LAYER is set by SurfaceFlnger to indicate that the HAL * shall not consider this layer for composition as it will be handled * by SurfaceFlinger (just as if compositionType was set to HWC_OVERLAY). */ HWC_SKIP_LAYER = 0x00000001, }; /* * hwc_layer_t::compositionType values */ enum { /* this layer is to be drawn into the framebuffer by SurfaceFlinger */ HWC_FRAMEBUFFER = 0, /* this layer will be handled in the HWC */ HWC_OVERLAY = 1, /* this is the background layer. it's used to set the background color. * there is only a single background layer */ HWC_BACKGROUND = 2, /* this layer holds the result of compositing the HWC_FRAMEBUFFER layers. * Added in HWC_DEVICE_API_VERSION_1_1. */ HWC_FRAMEBUFFER_TARGET = 3, }; /* * hwc_layer_t::blending values */ enum { /* no blending */ HWC_BLENDING_NONE = 0x0100, /* ONE / ONE_MINUS_SRC_ALPHA */ HWC_BLENDING_PREMULT = 0x0105, /* SRC_ALPHA / ONE_MINUS_SRC_ALPHA */ HWC_BLENDING_COVERAGE = 0x0405 }; /* * hwc_layer_t::transform values */ enum { /* flip source image horizontally */ HWC_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H, /* flip source image vertically */ HWC_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V, /* rotate source image 90 degrees clock-wise */ HWC_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90, /* rotate source image 180 degrees */ HWC_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180, /* rotate source image 270 degrees clock-wise */ HWC_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270, }; /* attributes queriable with query() */ enum { /* * Availability: HWC_DEVICE_API_VERSION_0_2 * Must return 1 if the background layer is supported, 0 otherwise. */ HWC_BACKGROUND_LAYER_SUPPORTED = 0, /* * Availability: HWC_DEVICE_API_VERSION_0_3 * Returns the vsync period in nanoseconds. * * This query is not used for HWC_DEVICE_API_VERSION_1_1 and later. * Instead, the per-display attribute HWC_DISPLAY_VSYNC_PERIOD is used. */ HWC_VSYNC_PERIOD = 1, /* * Availability: HWC_DEVICE_API_VERSION_1_1 * Returns a mask of supported display types. */ HWC_DISPLAY_TYPES_SUPPORTED = 2, }; /* display attributes returned by getDisplayAttributes() */ enum { /* Indicates the end of an attribute list */ HWC_DISPLAY_NO_ATTRIBUTE = 0, /* The vsync period in nanoseconds */ HWC_DISPLAY_VSYNC_PERIOD = 1, /* The number of pixels in the horizontal and vertical directions. */ HWC_DISPLAY_WIDTH = 2, HWC_DISPLAY_HEIGHT = 3, /* The number of pixels per thousand inches of this configuration. * * Scaling DPI by 1000 allows it to be stored in an int without losing * too much precision. * * If the DPI for a configuration is unavailable or the HWC implementation * considers it unreliable, it should set these attributes to zero. */ HWC_DISPLAY_DPI_X = 4, HWC_DISPLAY_DPI_Y = 5, }; /* Allowed events for hwc_methods::eventControl() */ enum { HWC_EVENT_VSYNC = 0, HWC_EVENT_ORIENTATION // To notify HWC about the device orientation }; /* Display types and associated mask bits. */ enum { HWC_DISPLAY_PRIMARY = 0, HWC_DISPLAY_EXTERNAL = 1, // HDMI, DP, etc. HWC_NUM_DISPLAY_TYPES }; enum { HWC_DISPLAY_PRIMARY_BIT = 1 << HWC_DISPLAY_PRIMARY, HWC_DISPLAY_EXTERNAL_BIT = 1 << HWC_DISPLAY_EXTERNAL, }; /*****************************************************************************/ __END_DECLS #endif /* ANDROID_INCLUDE_HARDWARE_HWCOMPOSER_DEFS_H */ android-audiosystem-1.8+13.10.20130807/include/android/0000755000015700001700000000000012200324404022734 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/android/sensor.h0000644000015700001700000001535712200324306024432 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_SENSOR_H #define ANDROID_SENSOR_H /****************************************************************** * * IMPORTANT NOTICE: * * This file is part of Android's set of stable system headers * exposed by the Android NDK (Native Development Kit). * * Third-party source AND binary code relies on the definitions * here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES. * * - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES) * - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS * - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY * - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES */ /* * Structures and functions to receive and process sensor events in * native code. * */ #include #include #ifdef __cplusplus extern "C" { #endif /* * Sensor types * (keep in sync with hardware/sensor.h) */ enum { ASENSOR_TYPE_ACCELEROMETER = 1, ASENSOR_TYPE_MAGNETIC_FIELD = 2, ASENSOR_TYPE_GYROSCOPE = 4, ASENSOR_TYPE_LIGHT = 5, ASENSOR_TYPE_PROXIMITY = 8 }; /* * Sensor accuracy measure */ enum { ASENSOR_STATUS_UNRELIABLE = 0, ASENSOR_STATUS_ACCURACY_LOW = 1, ASENSOR_STATUS_ACCURACY_MEDIUM = 2, ASENSOR_STATUS_ACCURACY_HIGH = 3 }; /* * A few useful constants */ /* Earth's gravity in m/s^2 */ #define ASENSOR_STANDARD_GRAVITY (9.80665f) /* Maximum magnetic field on Earth's surface in uT */ #define ASENSOR_MAGNETIC_FIELD_EARTH_MAX (60.0f) /* Minimum magnetic field on Earth's surface in uT*/ #define ASENSOR_MAGNETIC_FIELD_EARTH_MIN (30.0f) /* * A sensor event. */ /* NOTE: Must match hardware/sensors.h */ typedef struct ASensorVector { union { float v[3]; struct { float x; float y; float z; }; struct { float azimuth; float pitch; float roll; }; }; int8_t status; uint8_t reserved[3]; } ASensorVector; /* NOTE: Must match hardware/sensors.h */ typedef struct ASensorEvent { int32_t version; /* sizeof(struct ASensorEvent) */ int32_t sensor; int32_t type; int32_t reserved0; int64_t timestamp; union { float data[16]; ASensorVector vector; ASensorVector acceleration; ASensorVector magnetic; float temperature; float distance; float light; float pressure; }; int32_t reserved1[4]; } ASensorEvent; struct ASensorManager; typedef struct ASensorManager ASensorManager; struct ASensorEventQueue; typedef struct ASensorEventQueue ASensorEventQueue; struct ASensor; typedef struct ASensor ASensor; typedef ASensor const* ASensorRef; typedef ASensorRef const* ASensorList; /*****************************************************************************/ /* * Get a reference to the sensor manager. ASensorManager is a singleton. * * Example: * * ASensorManager* sensorManager = ASensorManager_getInstance(); * */ ASensorManager* ASensorManager_getInstance(); /* * Returns the list of available sensors. */ int ASensorManager_getSensorList(ASensorManager* manager, ASensorList* list); /* * Returns the default sensor for the given type, or NULL if no sensor * of that type exist. */ ASensor const* ASensorManager_getDefaultSensor(ASensorManager* manager, int type); /* * Creates a new sensor event queue and associate it with a looper. */ ASensorEventQueue* ASensorManager_createEventQueue(ASensorManager* manager, ALooper* looper, int ident, ALooper_callbackFunc callback, void* data); /* * Destroys the event queue and free all resources associated to it. */ int ASensorManager_destroyEventQueue(ASensorManager* manager, ASensorEventQueue* queue); /*****************************************************************************/ /* * Enable the selected sensor. Returns a negative error code on failure. */ int ASensorEventQueue_enableSensor(ASensorEventQueue* queue, ASensor const* sensor); /* * Disable the selected sensor. Returns a negative error code on failure. */ int ASensorEventQueue_disableSensor(ASensorEventQueue* queue, ASensor const* sensor); /* * Sets the delivery rate of events in microseconds for the given sensor. * Note that this is a hint only, generally event will arrive at a higher * rate. It is an error to set a rate inferior to the value returned by * ASensor_getMinDelay(). * Returns a negative error code on failure. */ int ASensorEventQueue_setEventRate(ASensorEventQueue* queue, ASensor const* sensor, int32_t usec); /* * Returns true if there are one or more events available in the * sensor queue. Returns 1 if the queue has events; 0 if * it does not have events; and a negative value if there is an error. */ int ASensorEventQueue_hasEvents(ASensorEventQueue* queue); /* * Returns the next available events from the queue. Returns a negative * value if no events are available or an error has occurred, otherwise * the number of events returned. * * Examples: * ASensorEvent event; * ssize_t numEvent = ASensorEventQueue_getEvents(queue, &event, 1); * * ASensorEvent eventBuffer[8]; * ssize_t numEvent = ASensorEventQueue_getEvents(queue, eventBuffer, 8); * */ ssize_t ASensorEventQueue_getEvents(ASensorEventQueue* queue, ASensorEvent* events, size_t count); /*****************************************************************************/ /* * Returns this sensor's name (non localized) */ const char* ASensor_getName(ASensor const* sensor); /* * Returns this sensor's vendor's name (non localized) */ const char* ASensor_getVendor(ASensor const* sensor); /* * Return this sensor's type */ int ASensor_getType(ASensor const* sensor); /* * Returns this sensors's resolution */ float ASensor_getResolution(ASensor const* sensor); /* * Returns the minimum delay allowed between events in microseconds. * A value of zero means that this sensor doesn't report events at a * constant rate, but rather only when a new data is available. */ int ASensor_getMinDelay(ASensor const* sensor); #ifdef __cplusplus }; #endif #endif // ANDROID_SENSOR_H android-audiosystem-1.8+13.10.20130807/include/android/obb.h0000644000015700001700000000260012200324306023646 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_OBB_H #define ANDROID_OBB_H #include #ifdef __cplusplus extern "C" { #endif struct AObbInfo; typedef struct AObbInfo AObbInfo; enum { AOBBINFO_OVERLAY = 0x0001, }; /** * Scan an OBB and get information about it. */ AObbInfo* AObbScanner_getObbInfo(const char* filename); /** * Destroy the AObbInfo object. You must call this when finished with the object. */ void AObbInfo_delete(AObbInfo* obbInfo); /** * Get the package name for the OBB. */ const char* AObbInfo_getPackageName(AObbInfo* obbInfo); /** * Get the version of an OBB file. */ int32_t AObbInfo_getVersion(AObbInfo* obbInfo); /** * Get the flags of an OBB file. */ int32_t AObbInfo_getFlags(AObbInfo* obbInfo); #ifdef __cplusplus }; #endif #endif // ANDROID_OBB_H android-audiosystem-1.8+13.10.20130807/include/android/rect.h0000644000015700001700000000164112200324306024045 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_RECT_H #define ANDROID_RECT_H #ifdef __cplusplus extern "C" { #endif typedef struct ARect { #ifdef __cplusplus typedef int32_t value_type; #endif int32_t left; int32_t top; int32_t right; int32_t bottom; } ARect; #ifdef __cplusplus }; #endif #endif // ANDROID_RECT_H android-audiosystem-1.8+13.10.20130807/include/android/configuration.h0000644000015700001700000002607612200324306025770 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_CONFIGURATION_H #define ANDROID_CONFIGURATION_H #include #ifdef __cplusplus extern "C" { #endif struct AConfiguration; typedef struct AConfiguration AConfiguration; enum { ACONFIGURATION_ORIENTATION_ANY = 0x0000, ACONFIGURATION_ORIENTATION_PORT = 0x0001, ACONFIGURATION_ORIENTATION_LAND = 0x0002, ACONFIGURATION_ORIENTATION_SQUARE = 0x0003, ACONFIGURATION_TOUCHSCREEN_ANY = 0x0000, ACONFIGURATION_TOUCHSCREEN_NOTOUCH = 0x0001, ACONFIGURATION_TOUCHSCREEN_STYLUS = 0x0002, ACONFIGURATION_TOUCHSCREEN_FINGER = 0x0003, ACONFIGURATION_DENSITY_DEFAULT = 0, ACONFIGURATION_DENSITY_LOW = 120, ACONFIGURATION_DENSITY_MEDIUM = 160, ACONFIGURATION_DENSITY_TV = 213, ACONFIGURATION_DENSITY_HIGH = 240, ACONFIGURATION_DENSITY_NONE = 0xffff, ACONFIGURATION_KEYBOARD_ANY = 0x0000, ACONFIGURATION_KEYBOARD_NOKEYS = 0x0001, ACONFIGURATION_KEYBOARD_QWERTY = 0x0002, ACONFIGURATION_KEYBOARD_12KEY = 0x0003, ACONFIGURATION_NAVIGATION_ANY = 0x0000, ACONFIGURATION_NAVIGATION_NONAV = 0x0001, ACONFIGURATION_NAVIGATION_DPAD = 0x0002, ACONFIGURATION_NAVIGATION_TRACKBALL = 0x0003, ACONFIGURATION_NAVIGATION_WHEEL = 0x0004, ACONFIGURATION_KEYSHIDDEN_ANY = 0x0000, ACONFIGURATION_KEYSHIDDEN_NO = 0x0001, ACONFIGURATION_KEYSHIDDEN_YES = 0x0002, ACONFIGURATION_KEYSHIDDEN_SOFT = 0x0003, ACONFIGURATION_NAVHIDDEN_ANY = 0x0000, ACONFIGURATION_NAVHIDDEN_NO = 0x0001, ACONFIGURATION_NAVHIDDEN_YES = 0x0002, ACONFIGURATION_SCREENSIZE_ANY = 0x00, ACONFIGURATION_SCREENSIZE_SMALL = 0x01, ACONFIGURATION_SCREENSIZE_NORMAL = 0x02, ACONFIGURATION_SCREENSIZE_LARGE = 0x03, ACONFIGURATION_SCREENSIZE_XLARGE = 0x04, ACONFIGURATION_SCREENLONG_ANY = 0x00, ACONFIGURATION_SCREENLONG_NO = 0x1, ACONFIGURATION_SCREENLONG_YES = 0x2, ACONFIGURATION_UI_MODE_TYPE_ANY = 0x00, ACONFIGURATION_UI_MODE_TYPE_NORMAL = 0x01, ACONFIGURATION_UI_MODE_TYPE_DESK = 0x02, ACONFIGURATION_UI_MODE_TYPE_CAR = 0x03, ACONFIGURATION_UI_MODE_TYPE_TELEVISION = 0x04, ACONFIGURATION_UI_MODE_NIGHT_ANY = 0x00, ACONFIGURATION_UI_MODE_NIGHT_NO = 0x1, ACONFIGURATION_UI_MODE_NIGHT_YES = 0x2, ACONFIGURATION_SCREEN_WIDTH_DP_ANY = 0x0000, ACONFIGURATION_SCREEN_HEIGHT_DP_ANY = 0x0000, ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY = 0x0000, ACONFIGURATION_MCC = 0x0001, ACONFIGURATION_MNC = 0x0002, ACONFIGURATION_LOCALE = 0x0004, ACONFIGURATION_TOUCHSCREEN = 0x0008, ACONFIGURATION_KEYBOARD = 0x0010, ACONFIGURATION_KEYBOARD_HIDDEN = 0x0020, ACONFIGURATION_NAVIGATION = 0x0040, ACONFIGURATION_ORIENTATION = 0x0080, ACONFIGURATION_DENSITY = 0x0100, ACONFIGURATION_SCREEN_SIZE = 0x0200, ACONFIGURATION_VERSION = 0x0400, ACONFIGURATION_SCREEN_LAYOUT = 0x0800, ACONFIGURATION_UI_MODE = 0x1000, ACONFIGURATION_SMALLEST_SCREEN_SIZE = 0x2000, }; /** * Create a new AConfiguration, initialized with no values set. */ AConfiguration* AConfiguration_new(); /** * Free an AConfiguration that was previously created with * AConfiguration_new(). */ void AConfiguration_delete(AConfiguration* config); /** * Create and return a new AConfiguration based on the current configuration in * use in the given AssetManager. */ void AConfiguration_fromAssetManager(AConfiguration* out, AAssetManager* am); /** * Copy the contents of 'src' to 'dest'. */ void AConfiguration_copy(AConfiguration* dest, AConfiguration* src); /** * Return the current MCC set in the configuration. 0 if not set. */ int32_t AConfiguration_getMcc(AConfiguration* config); /** * Set the current MCC in the configuration. 0 to clear. */ void AConfiguration_setMcc(AConfiguration* config, int32_t mcc); /** * Return the current MNC set in the configuration. 0 if not set. */ int32_t AConfiguration_getMnc(AConfiguration* config); /** * Set the current MNC in the configuration. 0 to clear. */ void AConfiguration_setMnc(AConfiguration* config, int32_t mnc); /** * Return the current language code set in the configuration. The output will * be filled with an array of two characters. They are not 0-terminated. If * a language is not set, they will be 0. */ void AConfiguration_getLanguage(AConfiguration* config, char* outLanguage); /** * Set the current language code in the configuration, from the first two * characters in the string. */ void AConfiguration_setLanguage(AConfiguration* config, const char* language); /** * Return the current country code set in the configuration. The output will * be filled with an array of two characters. They are not 0-terminated. If * a country is not set, they will be 0. */ void AConfiguration_getCountry(AConfiguration* config, char* outCountry); /** * Set the current country code in the configuration, from the first two * characters in the string. */ void AConfiguration_setCountry(AConfiguration* config, const char* country); /** * Return the current ACONFIGURATION_ORIENTATION_* set in the configuration. */ int32_t AConfiguration_getOrientation(AConfiguration* config); /** * Set the current orientation in the configuration. */ void AConfiguration_setOrientation(AConfiguration* config, int32_t orientation); /** * Return the current ACONFIGURATION_TOUCHSCREEN_* set in the configuration. */ int32_t AConfiguration_getTouchscreen(AConfiguration* config); /** * Set the current touchscreen in the configuration. */ void AConfiguration_setTouchscreen(AConfiguration* config, int32_t touchscreen); /** * Return the current ACONFIGURATION_DENSITY_* set in the configuration. */ int32_t AConfiguration_getDensity(AConfiguration* config); /** * Set the current density in the configuration. */ void AConfiguration_setDensity(AConfiguration* config, int32_t density); /** * Return the current ACONFIGURATION_KEYBOARD_* set in the configuration. */ int32_t AConfiguration_getKeyboard(AConfiguration* config); /** * Set the current keyboard in the configuration. */ void AConfiguration_setKeyboard(AConfiguration* config, int32_t keyboard); /** * Return the current ACONFIGURATION_NAVIGATION_* set in the configuration. */ int32_t AConfiguration_getNavigation(AConfiguration* config); /** * Set the current navigation in the configuration. */ void AConfiguration_setNavigation(AConfiguration* config, int32_t navigation); /** * Return the current ACONFIGURATION_KEYSHIDDEN_* set in the configuration. */ int32_t AConfiguration_getKeysHidden(AConfiguration* config); /** * Set the current keys hidden in the configuration. */ void AConfiguration_setKeysHidden(AConfiguration* config, int32_t keysHidden); /** * Return the current ACONFIGURATION_NAVHIDDEN_* set in the configuration. */ int32_t AConfiguration_getNavHidden(AConfiguration* config); /** * Set the current nav hidden in the configuration. */ void AConfiguration_setNavHidden(AConfiguration* config, int32_t navHidden); /** * Return the current SDK (API) version set in the configuration. */ int32_t AConfiguration_getSdkVersion(AConfiguration* config); /** * Set the current SDK version in the configuration. */ void AConfiguration_setSdkVersion(AConfiguration* config, int32_t sdkVersion); /** * Return the current ACONFIGURATION_SCREENSIZE_* set in the configuration. */ int32_t AConfiguration_getScreenSize(AConfiguration* config); /** * Set the current screen size in the configuration. */ void AConfiguration_setScreenSize(AConfiguration* config, int32_t screenSize); /** * Return the current ACONFIGURATION_SCREENLONG_* set in the configuration. */ int32_t AConfiguration_getScreenLong(AConfiguration* config); /** * Set the current screen long in the configuration. */ void AConfiguration_setScreenLong(AConfiguration* config, int32_t screenLong); /** * Return the current ACONFIGURATION_UI_MODE_TYPE_* set in the configuration. */ int32_t AConfiguration_getUiModeType(AConfiguration* config); /** * Set the current UI mode type in the configuration. */ void AConfiguration_setUiModeType(AConfiguration* config, int32_t uiModeType); /** * Return the current ACONFIGURATION_UI_MODE_NIGHT_* set in the configuration. */ int32_t AConfiguration_getUiModeNight(AConfiguration* config); /** * Set the current UI mode night in the configuration. */ void AConfiguration_setUiModeNight(AConfiguration* config, int32_t uiModeNight); /** * Return the current configuration screen width in dp units, or * ACONFIGURATION_SCREEN_WIDTH_DP_ANY if not set. */ int32_t AConfiguration_getScreenWidthDp(AConfiguration* config); /** * Set the configuration's current screen width in dp units. */ void AConfiguration_setScreenWidthDp(AConfiguration* config, int32_t value); /** * Return the current configuration screen height in dp units, or * ACONFIGURATION_SCREEN_HEIGHT_DP_ANY if not set. */ int32_t AConfiguration_getScreenHeightDp(AConfiguration* config); /** * Set the configuration's current screen width in dp units. */ void AConfiguration_setScreenHeightDp(AConfiguration* config, int32_t value); /** * Return the configuration's smallest screen width in dp units, or * ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY if not set. */ int32_t AConfiguration_getSmallestScreenWidthDp(AConfiguration* config); /** * Set the configuration's smallest screen width in dp units. */ void AConfiguration_setSmallestScreenWidthDp(AConfiguration* config, int32_t value); /** * Perform a diff between two configurations. Returns a bit mask of * ACONFIGURATION_* constants, each bit set meaning that configuration element * is different between them. */ int32_t AConfiguration_diff(AConfiguration* config1, AConfiguration* config2); /** * Determine whether 'base' is a valid configuration for use within the * environment 'requested'. Returns 0 if there are any values in 'base' * that conflict with 'requested'. Returns 1 if it does not conflict. */ int32_t AConfiguration_match(AConfiguration* base, AConfiguration* requested); /** * Determine whether the configuration in 'test' is better than the existing * configuration in 'base'. If 'requested' is non-NULL, this decision is based * on the overall configuration given there. If it is NULL, this decision is * simply based on which configuration is more specific. Returns non-0 if * 'test' is better than 'base'. * * This assumes you have already filtered the configurations with * AConfiguration_match(). */ int32_t AConfiguration_isBetterThan(AConfiguration* base, AConfiguration* test, AConfiguration* requested); #ifdef __cplusplus }; #endif #endif // ANDROID_CONFIGURATION_H android-audiosystem-1.8+13.10.20130807/include/android/asset_manager_jni.h0000644000015700001700000000227512200324306026565 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_ASSET_MANAGER_JNI_H #define ANDROID_ASSET_MANAGER_JNI_H #include #include #ifdef __cplusplus extern "C" { #endif /** * Given a Dalvik AssetManager object, obtain the corresponding native AAssetManager * object. Note that the caller is responsible for obtaining and holding a VM reference * to the jobject to prevent its being garbage collected while the native object is * in use. */ AAssetManager* AAssetManager_fromJava(JNIEnv* env, jobject assetManager); #ifdef __cplusplus }; #endif #endif // ANDROID_ASSET_MANAGER_JNI_H android-audiosystem-1.8+13.10.20130807/include/android/window.h0000644000015700001700000000423412200324306024420 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_WINDOW_H #define ANDROID_WINDOW_H #ifdef __cplusplus extern "C" { #endif /** * Window flags, as per the Java API at android.view.WindowManager.LayoutParams. */ enum { AWINDOW_FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001, AWINDOW_FLAG_DIM_BEHIND = 0x00000002, AWINDOW_FLAG_BLUR_BEHIND = 0x00000004, AWINDOW_FLAG_NOT_FOCUSABLE = 0x00000008, AWINDOW_FLAG_NOT_TOUCHABLE = 0x00000010, AWINDOW_FLAG_NOT_TOUCH_MODAL = 0x00000020, AWINDOW_FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040, AWINDOW_FLAG_KEEP_SCREEN_ON = 0x00000080, AWINDOW_FLAG_LAYOUT_IN_SCREEN = 0x00000100, AWINDOW_FLAG_LAYOUT_NO_LIMITS = 0x00000200, AWINDOW_FLAG_FULLSCREEN = 0x00000400, AWINDOW_FLAG_FORCE_NOT_FULLSCREEN = 0x00000800, AWINDOW_FLAG_DITHER = 0x00001000, AWINDOW_FLAG_SECURE = 0x00002000, AWINDOW_FLAG_SCALED = 0x00004000, AWINDOW_FLAG_IGNORE_CHEEK_PRESSES = 0x00008000, AWINDOW_FLAG_LAYOUT_INSET_DECOR = 0x00010000, AWINDOW_FLAG_ALT_FOCUSABLE_IM = 0x00020000, AWINDOW_FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000, AWINDOW_FLAG_SHOW_WHEN_LOCKED = 0x00080000, AWINDOW_FLAG_SHOW_WALLPAPER = 0x00100000, AWINDOW_FLAG_TURN_SCREEN_ON = 0x00200000, AWINDOW_FLAG_DISMISS_KEYGUARD = 0x00400000, }; #ifdef __cplusplus }; #endif #endif // ANDROID_WINDOW_H android-audiosystem-1.8+13.10.20130807/include/android/storage_manager.h0000644000015700001700000000730712200324306026253 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_STORAGE_MANAGER_H #define ANDROID_STORAGE_MANAGER_H #include #ifdef __cplusplus extern "C" { #endif struct AStorageManager; typedef struct AStorageManager AStorageManager; enum { /* * The OBB container is now mounted and ready for use. Can be returned * as the status for callbacks made during asynchronous OBB actions. */ AOBB_STATE_MOUNTED = 1, /* * The OBB container is now unmounted and not usable. Can be returned * as the status for callbacks made during asynchronous OBB actions. */ AOBB_STATE_UNMOUNTED = 2, /* * There was an internal system error encountered while trying to * mount the OBB. Can be returned as the status for callbacks made * during asynchronous OBB actions. */ AOBB_STATE_ERROR_INTERNAL = 20, /* * The OBB could not be mounted by the system. Can be returned as the * status for callbacks made during asynchronous OBB actions. */ AOBB_STATE_ERROR_COULD_NOT_MOUNT = 21, /* * The OBB could not be unmounted. This most likely indicates that a * file is in use on the OBB. Can be returned as the status for * callbacks made during asynchronous OBB actions. */ AOBB_STATE_ERROR_COULD_NOT_UNMOUNT = 22, /* * A call was made to unmount the OBB when it was not mounted. Can be * returned as the status for callbacks made during asynchronous OBB * actions. */ AOBB_STATE_ERROR_NOT_MOUNTED = 23, /* * The OBB has already been mounted. Can be returned as the status for * callbacks made during asynchronous OBB actions. */ AOBB_STATE_ERROR_ALREADY_MOUNTED = 24, /* * The current application does not have permission to use this OBB. * This could be because the OBB indicates it's owned by a different * package. Can be returned as the status for callbacks made during * asynchronous OBB actions. */ AOBB_STATE_ERROR_PERMISSION_DENIED = 25, }; /** * Obtains a new instance of AStorageManager. */ AStorageManager* AStorageManager_new(); /** * Release AStorageManager instance. */ void AStorageManager_delete(AStorageManager* mgr); /** * Callback function for asynchronous calls made on OBB files. */ typedef void (*AStorageManager_obbCallbackFunc)(const char* filename, const int32_t state, void* data); /** * Attempts to mount an OBB file. This is an asynchronous operation. */ void AStorageManager_mountObb(AStorageManager* mgr, const char* filename, const char* key, AStorageManager_obbCallbackFunc cb, void* data); /** * Attempts to unmount an OBB file. This is an asynchronous operation. */ void AStorageManager_unmountObb(AStorageManager* mgr, const char* filename, const int force, AStorageManager_obbCallbackFunc cb, void* data); /** * Check whether an OBB is mounted. */ int AStorageManager_isObbMounted(AStorageManager* mgr, const char* filename); /** * Get the mounted path for an OBB. */ const char* AStorageManager_getMountedObbPath(AStorageManager* mgr, const char* filename); #ifdef __cplusplus }; #endif #endif // ANDROID_STORAGE_MANAGER_H android-audiosystem-1.8+13.10.20130807/include/android/native_window_jni.h0000644000015700001700000000304512200324306026625 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_NATIVE_WINDOW_JNI_H #define ANDROID_NATIVE_WINDOW_JNI_H #include #include #ifdef __cplusplus extern "C" { #endif /** * Return the ANativeWindow associated with a Java Surface object, * for interacting with it through native code. This acquires a reference * on the ANativeWindow that is returned; be sure to use ANativeWindow_release() * when done with it so that it doesn't leak. */ ANativeWindow* ANativeWindow_fromSurface(JNIEnv* env, jobject surface); /** * Return the ANativeWindow associated with a Java SurfaceTexture object, * for interacting with it through native code. This acquires a reference * on the ANativeWindow that is returned; be sure to use ANativeWindow_release() * when done with it so that it doesn't leak. */ ANativeWindow* ANativeWindow_fromSurfaceTexture(JNIEnv* env, jobject surfaceTexture); #ifdef __cplusplus }; #endif #endif // ANDROID_NATIVE_WINDOW_H android-audiosystem-1.8+13.10.20130807/include/android/input.h0000644000015700001700000010450412200324306024251 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _ANDROID_INPUT_H #define _ANDROID_INPUT_H /****************************************************************** * * IMPORTANT NOTICE: * * This file is part of Android's set of stable system headers * exposed by the Android NDK (Native Development Kit). * * Third-party source AND binary code relies on the definitions * here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES. * * - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES) * - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS * - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY * - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES */ /* * Structures and functions to receive and process input events in * native code. * * NOTE: These functions MUST be implemented by /system/lib/libui.so */ #include #include #include #include #ifdef __cplusplus extern "C" { #endif /* * Key states (may be returned by queries about the current state of a * particular key code, scan code or switch). */ enum { /* The key state is unknown or the requested key itself is not supported. */ AKEY_STATE_UNKNOWN = -1, /* The key is up. */ AKEY_STATE_UP = 0, /* The key is down. */ AKEY_STATE_DOWN = 1, /* The key is down but is a virtual key press that is being emulated by the system. */ AKEY_STATE_VIRTUAL = 2 }; /* * Meta key / modifer state. */ enum { /* No meta keys are pressed. */ AMETA_NONE = 0, /* This mask is used to check whether one of the ALT meta keys is pressed. */ AMETA_ALT_ON = 0x02, /* This mask is used to check whether the left ALT meta key is pressed. */ AMETA_ALT_LEFT_ON = 0x10, /* This mask is used to check whether the right ALT meta key is pressed. */ AMETA_ALT_RIGHT_ON = 0x20, /* This mask is used to check whether one of the SHIFT meta keys is pressed. */ AMETA_SHIFT_ON = 0x01, /* This mask is used to check whether the left SHIFT meta key is pressed. */ AMETA_SHIFT_LEFT_ON = 0x40, /* This mask is used to check whether the right SHIFT meta key is pressed. */ AMETA_SHIFT_RIGHT_ON = 0x80, /* This mask is used to check whether the SYM meta key is pressed. */ AMETA_SYM_ON = 0x04, /* This mask is used to check whether the FUNCTION meta key is pressed. */ AMETA_FUNCTION_ON = 0x08, /* This mask is used to check whether one of the CTRL meta keys is pressed. */ AMETA_CTRL_ON = 0x1000, /* This mask is used to check whether the left CTRL meta key is pressed. */ AMETA_CTRL_LEFT_ON = 0x2000, /* This mask is used to check whether the right CTRL meta key is pressed. */ AMETA_CTRL_RIGHT_ON = 0x4000, /* This mask is used to check whether one of the META meta keys is pressed. */ AMETA_META_ON = 0x10000, /* This mask is used to check whether the left META meta key is pressed. */ AMETA_META_LEFT_ON = 0x20000, /* This mask is used to check whether the right META meta key is pressed. */ AMETA_META_RIGHT_ON = 0x40000, /* This mask is used to check whether the CAPS LOCK meta key is on. */ AMETA_CAPS_LOCK_ON = 0x100000, /* This mask is used to check whether the NUM LOCK meta key is on. */ AMETA_NUM_LOCK_ON = 0x200000, /* This mask is used to check whether the SCROLL LOCK meta key is on. */ AMETA_SCROLL_LOCK_ON = 0x400000, }; /* * Input events. * * Input events are opaque structures. Use the provided accessors functions to * read their properties. */ struct AInputEvent; typedef struct AInputEvent AInputEvent; /* * Input event types. */ enum { /* Indicates that the input event is a key event. */ AINPUT_EVENT_TYPE_KEY = 1, /* Indicates that the input event is a motion event. */ AINPUT_EVENT_TYPE_MOTION = 2 }; /* * Key event actions. */ enum { /* The key has been pressed down. */ AKEY_EVENT_ACTION_DOWN = 0, /* The key has been released. */ AKEY_EVENT_ACTION_UP = 1, /* Multiple duplicate key events have occurred in a row, or a complex string is * being delivered. The repeat_count property of the key event contains the number * of times the given key code should be executed. */ AKEY_EVENT_ACTION_MULTIPLE = 2 }; /* * Key event flags. */ enum { /* This mask is set if the device woke because of this key event. */ AKEY_EVENT_FLAG_WOKE_HERE = 0x1, /* This mask is set if the key event was generated by a software keyboard. */ AKEY_EVENT_FLAG_SOFT_KEYBOARD = 0x2, /* This mask is set if we don't want the key event to cause us to leave touch mode. */ AKEY_EVENT_FLAG_KEEP_TOUCH_MODE = 0x4, /* This mask is set if an event was known to come from a trusted part * of the system. That is, the event is known to come from the user, * and could not have been spoofed by a third party component. */ AKEY_EVENT_FLAG_FROM_SYSTEM = 0x8, /* This mask is used for compatibility, to identify enter keys that are * coming from an IME whose enter key has been auto-labelled "next" or * "done". This allows TextView to dispatch these as normal enter keys * for old applications, but still do the appropriate action when * receiving them. */ AKEY_EVENT_FLAG_EDITOR_ACTION = 0x10, /* When associated with up key events, this indicates that the key press * has been canceled. Typically this is used with virtual touch screen * keys, where the user can slide from the virtual key area on to the * display: in that case, the application will receive a canceled up * event and should not perform the action normally associated with the * key. Note that for this to work, the application can not perform an * action for a key until it receives an up or the long press timeout has * expired. */ AKEY_EVENT_FLAG_CANCELED = 0x20, /* This key event was generated by a virtual (on-screen) hard key area. * Typically this is an area of the touchscreen, outside of the regular * display, dedicated to "hardware" buttons. */ AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY = 0x40, /* This flag is set for the first key repeat that occurs after the * long press timeout. */ AKEY_EVENT_FLAG_LONG_PRESS = 0x80, /* Set when a key event has AKEY_EVENT_FLAG_CANCELED set because a long * press action was executed while it was down. */ AKEY_EVENT_FLAG_CANCELED_LONG_PRESS = 0x100, /* Set for AKEY_EVENT_ACTION_UP when this event's key code is still being * tracked from its initial down. That is, somebody requested that tracking * started on the key down and a long press has not caused * the tracking to be canceled. */ AKEY_EVENT_FLAG_TRACKING = 0x200, /* Set when a key event has been synthesized to implement default behavior * for an event that the application did not handle. * Fallback key events are generated by unhandled trackball motions * (to emulate a directional keypad) and by certain unhandled key presses * that are declared in the key map (such as special function numeric keypad * keys when numlock is off). */ AKEY_EVENT_FLAG_FALLBACK = 0x400, }; /* * Motion event actions. */ /* Bit shift for the action bits holding the pointer index as * defined by AMOTION_EVENT_ACTION_POINTER_INDEX_MASK. */ #define AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT 8 enum { /* Bit mask of the parts of the action code that are the action itself. */ AMOTION_EVENT_ACTION_MASK = 0xff, /* Bits in the action code that represent a pointer index, used with * AMOTION_EVENT_ACTION_POINTER_DOWN and AMOTION_EVENT_ACTION_POINTER_UP. Shifting * down by AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer * index where the data for the pointer going up or down can be found. */ AMOTION_EVENT_ACTION_POINTER_INDEX_MASK = 0xff00, /* A pressed gesture has started, the motion contains the initial starting location. */ AMOTION_EVENT_ACTION_DOWN = 0, /* A pressed gesture has finished, the motion contains the final release location * as well as any intermediate points since the last down or move event. */ AMOTION_EVENT_ACTION_UP = 1, /* A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and * AMOTION_EVENT_ACTION_UP). The motion contains the most recent point, as well as * any intermediate points since the last down or move event. */ AMOTION_EVENT_ACTION_MOVE = 2, /* The current gesture has been aborted. * You will not receive any more points in it. You should treat this as * an up event, but not perform any action that you normally would. */ AMOTION_EVENT_ACTION_CANCEL = 3, /* A movement has happened outside of the normal bounds of the UI element. * This does not provide a full gesture, but only the initial location of the movement/touch. */ AMOTION_EVENT_ACTION_OUTSIDE = 4, /* A non-primary pointer has gone down. * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed. */ AMOTION_EVENT_ACTION_POINTER_DOWN = 5, /* A non-primary pointer has gone up. * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed. */ AMOTION_EVENT_ACTION_POINTER_UP = 6, /* A change happened but the pointer is not down (unlike AMOTION_EVENT_ACTION_MOVE). * The motion contains the most recent point, as well as any intermediate points since * the last hover move event. */ AMOTION_EVENT_ACTION_HOVER_MOVE = 7, /* The motion event contains relative vertical and/or horizontal scroll offsets. * Use getAxisValue to retrieve the information from AMOTION_EVENT_AXIS_VSCROLL * and AMOTION_EVENT_AXIS_HSCROLL. * The pointer may or may not be down when this event is dispatched. * This action is always delivered to the winder under the pointer, which * may not be the window currently touched. */ AMOTION_EVENT_ACTION_SCROLL = 8, /* The pointer is not down but has entered the boundaries of a window or view. */ AMOTION_EVENT_ACTION_HOVER_ENTER = 9, /* The pointer is not down but has exited the boundaries of a window or view. */ AMOTION_EVENT_ACTION_HOVER_EXIT = 10, }; /* * Motion event flags. */ enum { /* This flag indicates that the window that received this motion event is partly * or wholly obscured by another visible window above it. This flag is set to true * even if the event did not directly pass through the obscured area. * A security sensitive application can check this flag to identify situations in which * a malicious application may have covered up part of its content for the purpose * of misleading the user or hijacking touches. An appropriate response might be * to drop the suspect touches or to take additional precautions to confirm the user's * actual intent. */ AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = 0x1, }; /* * Motion event edge touch flags. */ enum { /* No edges intersected */ AMOTION_EVENT_EDGE_FLAG_NONE = 0, /* Flag indicating the motion event intersected the top edge of the screen. */ AMOTION_EVENT_EDGE_FLAG_TOP = 0x01, /* Flag indicating the motion event intersected the bottom edge of the screen. */ AMOTION_EVENT_EDGE_FLAG_BOTTOM = 0x02, /* Flag indicating the motion event intersected the left edge of the screen. */ AMOTION_EVENT_EDGE_FLAG_LEFT = 0x04, /* Flag indicating the motion event intersected the right edge of the screen. */ AMOTION_EVENT_EDGE_FLAG_RIGHT = 0x08 }; /* * Constants that identify each individual axis of a motion event. * Refer to the documentation on the MotionEvent class for descriptions of each axis. */ enum { AMOTION_EVENT_AXIS_X = 0, AMOTION_EVENT_AXIS_Y = 1, AMOTION_EVENT_AXIS_PRESSURE = 2, AMOTION_EVENT_AXIS_SIZE = 3, AMOTION_EVENT_AXIS_TOUCH_MAJOR = 4, AMOTION_EVENT_AXIS_TOUCH_MINOR = 5, AMOTION_EVENT_AXIS_TOOL_MAJOR = 6, AMOTION_EVENT_AXIS_TOOL_MINOR = 7, AMOTION_EVENT_AXIS_ORIENTATION = 8, AMOTION_EVENT_AXIS_VSCROLL = 9, AMOTION_EVENT_AXIS_HSCROLL = 10, AMOTION_EVENT_AXIS_Z = 11, AMOTION_EVENT_AXIS_RX = 12, AMOTION_EVENT_AXIS_RY = 13, AMOTION_EVENT_AXIS_RZ = 14, AMOTION_EVENT_AXIS_HAT_X = 15, AMOTION_EVENT_AXIS_HAT_Y = 16, AMOTION_EVENT_AXIS_LTRIGGER = 17, AMOTION_EVENT_AXIS_RTRIGGER = 18, AMOTION_EVENT_AXIS_THROTTLE = 19, AMOTION_EVENT_AXIS_RUDDER = 20, AMOTION_EVENT_AXIS_WHEEL = 21, AMOTION_EVENT_AXIS_GAS = 22, AMOTION_EVENT_AXIS_BRAKE = 23, AMOTION_EVENT_AXIS_DISTANCE = 24, AMOTION_EVENT_AXIS_TILT = 25, AMOTION_EVENT_AXIS_GENERIC_1 = 32, AMOTION_EVENT_AXIS_GENERIC_2 = 33, AMOTION_EVENT_AXIS_GENERIC_3 = 34, AMOTION_EVENT_AXIS_GENERIC_4 = 35, AMOTION_EVENT_AXIS_GENERIC_5 = 36, AMOTION_EVENT_AXIS_GENERIC_6 = 37, AMOTION_EVENT_AXIS_GENERIC_7 = 38, AMOTION_EVENT_AXIS_GENERIC_8 = 39, AMOTION_EVENT_AXIS_GENERIC_9 = 40, AMOTION_EVENT_AXIS_GENERIC_10 = 41, AMOTION_EVENT_AXIS_GENERIC_11 = 42, AMOTION_EVENT_AXIS_GENERIC_12 = 43, AMOTION_EVENT_AXIS_GENERIC_13 = 44, AMOTION_EVENT_AXIS_GENERIC_14 = 45, AMOTION_EVENT_AXIS_GENERIC_15 = 46, AMOTION_EVENT_AXIS_GENERIC_16 = 47, // NOTE: If you add a new axis here you must also add it to several other files. // Refer to frameworks/base/core/java/android/view/MotionEvent.java for the full list. }; /* * Constants that identify buttons that are associated with motion events. * Refer to the documentation on the MotionEvent class for descriptions of each button. */ enum { AMOTION_EVENT_BUTTON_PRIMARY = 1 << 0, AMOTION_EVENT_BUTTON_SECONDARY = 1 << 1, AMOTION_EVENT_BUTTON_TERTIARY = 1 << 2, AMOTION_EVENT_BUTTON_BACK = 1 << 3, AMOTION_EVENT_BUTTON_FORWARD = 1 << 4, }; /* * Constants that identify tool types. * Refer to the documentation on the MotionEvent class for descriptions of each tool type. */ enum { AMOTION_EVENT_TOOL_TYPE_UNKNOWN = 0, AMOTION_EVENT_TOOL_TYPE_FINGER = 1, AMOTION_EVENT_TOOL_TYPE_STYLUS = 2, AMOTION_EVENT_TOOL_TYPE_MOUSE = 3, AMOTION_EVENT_TOOL_TYPE_ERASER = 4, }; /* * Input sources. * * Refer to the documentation on android.view.InputDevice for more details about input sources * and their correct interpretation. */ enum { AINPUT_SOURCE_CLASS_MASK = 0x000000ff, AINPUT_SOURCE_CLASS_BUTTON = 0x00000001, AINPUT_SOURCE_CLASS_POINTER = 0x00000002, AINPUT_SOURCE_CLASS_NAVIGATION = 0x00000004, AINPUT_SOURCE_CLASS_POSITION = 0x00000008, AINPUT_SOURCE_CLASS_JOYSTICK = 0x00000010, }; enum { AINPUT_SOURCE_UNKNOWN = 0x00000000, AINPUT_SOURCE_KEYBOARD = 0x00000100 | AINPUT_SOURCE_CLASS_BUTTON, AINPUT_SOURCE_DPAD = 0x00000200 | AINPUT_SOURCE_CLASS_BUTTON, AINPUT_SOURCE_GAMEPAD = 0x00000400 | AINPUT_SOURCE_CLASS_BUTTON, AINPUT_SOURCE_TOUCHSCREEN = 0x00001000 | AINPUT_SOURCE_CLASS_POINTER, AINPUT_SOURCE_MOUSE = 0x00002000 | AINPUT_SOURCE_CLASS_POINTER, AINPUT_SOURCE_STYLUS = 0x00004000 | AINPUT_SOURCE_CLASS_POINTER, AINPUT_SOURCE_TRACKBALL = 0x00010000 | AINPUT_SOURCE_CLASS_NAVIGATION, AINPUT_SOURCE_TOUCHPAD = 0x00100000 | AINPUT_SOURCE_CLASS_POSITION, AINPUT_SOURCE_JOYSTICK = 0x01000000 | AINPUT_SOURCE_CLASS_JOYSTICK, AINPUT_SOURCE_ANY = 0xffffff00, }; /* * Keyboard types. * * Refer to the documentation on android.view.InputDevice for more details. */ enum { AINPUT_KEYBOARD_TYPE_NONE = 0, AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC = 1, AINPUT_KEYBOARD_TYPE_ALPHABETIC = 2, }; /* * Constants used to retrieve information about the range of motion for a particular * coordinate of a motion event. * * Refer to the documentation on android.view.InputDevice for more details about input sources * and their correct interpretation. * * DEPRECATION NOTICE: These constants are deprecated. Use AMOTION_EVENT_AXIS_* constants instead. */ enum { AINPUT_MOTION_RANGE_X = AMOTION_EVENT_AXIS_X, AINPUT_MOTION_RANGE_Y = AMOTION_EVENT_AXIS_Y, AINPUT_MOTION_RANGE_PRESSURE = AMOTION_EVENT_AXIS_PRESSURE, AINPUT_MOTION_RANGE_SIZE = AMOTION_EVENT_AXIS_SIZE, AINPUT_MOTION_RANGE_TOUCH_MAJOR = AMOTION_EVENT_AXIS_TOUCH_MAJOR, AINPUT_MOTION_RANGE_TOUCH_MINOR = AMOTION_EVENT_AXIS_TOUCH_MINOR, AINPUT_MOTION_RANGE_TOOL_MAJOR = AMOTION_EVENT_AXIS_TOOL_MAJOR, AINPUT_MOTION_RANGE_TOOL_MINOR = AMOTION_EVENT_AXIS_TOOL_MINOR, AINPUT_MOTION_RANGE_ORIENTATION = AMOTION_EVENT_AXIS_ORIENTATION, } __attribute__ ((deprecated)); /* * Input event accessors. * * Note that most functions can only be used on input events that are of a given type. * Calling these functions on input events of other types will yield undefined behavior. */ /*** Accessors for all input events. ***/ /* Get the input event type. */ int32_t AInputEvent_getType(const AInputEvent* event); /* Get the id for the device that an input event came from. * * Input events can be generated by multiple different input devices. * Use the input device id to obtain information about the input * device that was responsible for generating a particular event. * * An input device id of 0 indicates that the event didn't come from a physical device; * other numbers are arbitrary and you shouldn't depend on the values. * Use the provided input device query API to obtain information about input devices. */ int32_t AInputEvent_getDeviceId(const AInputEvent* event); /* Get the input event source. */ int32_t AInputEvent_getSource(const AInputEvent* event); /*** Accessors for key events only. ***/ /* Get the key event action. */ int32_t AKeyEvent_getAction(const AInputEvent* key_event); /* Get the key event flags. */ int32_t AKeyEvent_getFlags(const AInputEvent* key_event); /* Get the key code of the key event. * This is the physical key that was pressed, not the Unicode character. */ int32_t AKeyEvent_getKeyCode(const AInputEvent* key_event); /* Get the hardware key id of this key event. * These values are not reliable and vary from device to device. */ int32_t AKeyEvent_getScanCode(const AInputEvent* key_event); /* Get the meta key state. */ int32_t AKeyEvent_getMetaState(const AInputEvent* key_event); /* Get the repeat count of the event. * For both key up an key down events, this is the number of times the key has * repeated with the first down starting at 0 and counting up from there. For * multiple key events, this is the number of down/up pairs that have occurred. */ int32_t AKeyEvent_getRepeatCount(const AInputEvent* key_event); /* Get the time of the most recent key down event, in the * java.lang.System.nanoTime() time base. If this is a down event, * this will be the same as eventTime. * Note that when chording keys, this value is the down time of the most recently * pressed key, which may not be the same physical key of this event. */ int64_t AKeyEvent_getDownTime(const AInputEvent* key_event); /* Get the time this event occurred, in the * java.lang.System.nanoTime() time base. */ int64_t AKeyEvent_getEventTime(const AInputEvent* key_event); /*** Accessors for motion events only. ***/ /* Get the combined motion event action code and pointer index. */ int32_t AMotionEvent_getAction(const AInputEvent* motion_event); /* Get the motion event flags. */ int32_t AMotionEvent_getFlags(const AInputEvent* motion_event); /* Get the state of any meta / modifier keys that were in effect when the * event was generated. */ int32_t AMotionEvent_getMetaState(const AInputEvent* motion_event); /* Get the button state of all buttons that are pressed. */ int32_t AMotionEvent_getButtonState(const AInputEvent* motion_event); /* Get a bitfield indicating which edges, if any, were touched by this motion event. * For touch events, clients can use this to determine if the user's finger was * touching the edge of the display. */ int32_t AMotionEvent_getEdgeFlags(const AInputEvent* motion_event); /* Get the time when the user originally pressed down to start a stream of * position events, in the java.lang.System.nanoTime() time base. */ int64_t AMotionEvent_getDownTime(const AInputEvent* motion_event); /* Get the time when this specific event was generated, * in the java.lang.System.nanoTime() time base. */ int64_t AMotionEvent_getEventTime(const AInputEvent* motion_event); /* Get the X coordinate offset. * For touch events on the screen, this is the delta that was added to the raw * screen coordinates to adjust for the absolute position of the containing windows * and views. */ float AMotionEvent_getXOffset(const AInputEvent* motion_event); /* Get the precision of the Y coordinates being reported. * For touch events on the screen, this is the delta that was added to the raw * screen coordinates to adjust for the absolute position of the containing windows * and views. */ float AMotionEvent_getYOffset(const AInputEvent* motion_event); /* Get the precision of the X coordinates being reported. * You can multiply this number with an X coordinate sample to find the * actual hardware value of the X coordinate. */ float AMotionEvent_getXPrecision(const AInputEvent* motion_event); /* Get the precision of the Y coordinates being reported. * You can multiply this number with a Y coordinate sample to find the * actual hardware value of the Y coordinate. */ float AMotionEvent_getYPrecision(const AInputEvent* motion_event); /* Get the number of pointers of data contained in this event. * Always >= 1. */ size_t AMotionEvent_getPointerCount(const AInputEvent* motion_event); /* Get the pointer identifier associated with a particular pointer * data index in this event. The identifier tells you the actual pointer * number associated with the data, accounting for individual pointers * going up and down since the start of the current gesture. */ int32_t AMotionEvent_getPointerId(const AInputEvent* motion_event, size_t pointer_index); /* Get the tool type of a pointer for the given pointer index. * The tool type indicates the type of tool used to make contact such as a * finger or stylus, if known. */ int32_t AMotionEvent_getToolType(const AInputEvent* motion_event, size_t pointer_index); /* Get the original raw X coordinate of this event. * For touch events on the screen, this is the original location of the event * on the screen, before it had been adjusted for the containing window * and views. */ float AMotionEvent_getRawX(const AInputEvent* motion_event, size_t pointer_index); /* Get the original raw X coordinate of this event. * For touch events on the screen, this is the original location of the event * on the screen, before it had been adjusted for the containing window * and views. */ float AMotionEvent_getRawY(const AInputEvent* motion_event, size_t pointer_index); /* Get the current X coordinate of this event for the given pointer index. * Whole numbers are pixels; the value may have a fraction for input devices * that are sub-pixel precise. */ float AMotionEvent_getX(const AInputEvent* motion_event, size_t pointer_index); /* Get the current Y coordinate of this event for the given pointer index. * Whole numbers are pixels; the value may have a fraction for input devices * that are sub-pixel precise. */ float AMotionEvent_getY(const AInputEvent* motion_event, size_t pointer_index); /* Get the current pressure of this event for the given pointer index. * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), * although values higher than 1 may be generated depending on the calibration of * the input device. */ float AMotionEvent_getPressure(const AInputEvent* motion_event, size_t pointer_index); /* Get the current scaled value of the approximate size for the given pointer index. * This represents some approximation of the area of the screen being * pressed; the actual value in pixels corresponding to the * touch is normalized with the device specific range of values * and scaled to a value between 0 and 1. The value of size can be used to * determine fat touch events. */ float AMotionEvent_getSize(const AInputEvent* motion_event, size_t pointer_index); /* Get the current length of the major axis of an ellipse that describes the touch area * at the point of contact for the given pointer index. */ float AMotionEvent_getTouchMajor(const AInputEvent* motion_event, size_t pointer_index); /* Get the current length of the minor axis of an ellipse that describes the touch area * at the point of contact for the given pointer index. */ float AMotionEvent_getTouchMinor(const AInputEvent* motion_event, size_t pointer_index); /* Get the current length of the major axis of an ellipse that describes the size * of the approaching tool for the given pointer index. * The tool area represents the estimated size of the finger or pen that is * touching the device independent of its actual touch area at the point of contact. */ float AMotionEvent_getToolMajor(const AInputEvent* motion_event, size_t pointer_index); /* Get the current length of the minor axis of an ellipse that describes the size * of the approaching tool for the given pointer index. * The tool area represents the estimated size of the finger or pen that is * touching the device independent of its actual touch area at the point of contact. */ float AMotionEvent_getToolMinor(const AInputEvent* motion_event, size_t pointer_index); /* Get the current orientation of the touch area and tool area in radians clockwise from * vertical for the given pointer index. * An angle of 0 degrees indicates that the major axis of contact is oriented * upwards, is perfectly circular or is of unknown orientation. A positive angle * indicates that the major axis of contact is oriented to the right. A negative angle * indicates that the major axis of contact is oriented to the left. * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians * (finger pointing fully right). */ float AMotionEvent_getOrientation(const AInputEvent* motion_event, size_t pointer_index); /* Get the value of the request axis for the given pointer index. */ float AMotionEvent_getAxisValue(const AInputEvent* motion_event, int32_t axis, size_t pointer_index); /* Get the number of historical points in this event. These are movements that * have occurred between this event and the previous event. This only applies * to AMOTION_EVENT_ACTION_MOVE events -- all other actions will have a size of 0. * Historical samples are indexed from oldest to newest. */ size_t AMotionEvent_getHistorySize(const AInputEvent* motion_event); /* Get the time that a historical movement occurred between this event and * the previous event, in the java.lang.System.nanoTime() time base. */ int64_t AMotionEvent_getHistoricalEventTime(AInputEvent* motion_event, size_t history_index); /* Get the historical raw X coordinate of this event for the given pointer index that * occurred between this event and the previous motion event. * For touch events on the screen, this is the original location of the event * on the screen, before it had been adjusted for the containing window * and views. * Whole numbers are pixels; the value may have a fraction for input devices * that are sub-pixel precise. */ float AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, size_t pointer_index, size_t history_index); /* Get the historical raw Y coordinate of this event for the given pointer index that * occurred between this event and the previous motion event. * For touch events on the screen, this is the original location of the event * on the screen, before it had been adjusted for the containing window * and views. * Whole numbers are pixels; the value may have a fraction for input devices * that are sub-pixel precise. */ float AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, size_t pointer_index, size_t history_index); /* Get the historical X coordinate of this event for the given pointer index that * occurred between this event and the previous motion event. * Whole numbers are pixels; the value may have a fraction for input devices * that are sub-pixel precise. */ float AMotionEvent_getHistoricalX(AInputEvent* motion_event, size_t pointer_index, size_t history_index); /* Get the historical Y coordinate of this event for the given pointer index that * occurred between this event and the previous motion event. * Whole numbers are pixels; the value may have a fraction for input devices * that are sub-pixel precise. */ float AMotionEvent_getHistoricalY(AInputEvent* motion_event, size_t pointer_index, size_t history_index); /* Get the historical pressure of this event for the given pointer index that * occurred between this event and the previous motion event. * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), * although values higher than 1 may be generated depending on the calibration of * the input device. */ float AMotionEvent_getHistoricalPressure(AInputEvent* motion_event, size_t pointer_index, size_t history_index); /* Get the current scaled value of the approximate size for the given pointer index that * occurred between this event and the previous motion event. * This represents some approximation of the area of the screen being * pressed; the actual value in pixels corresponding to the * touch is normalized with the device specific range of values * and scaled to a value between 0 and 1. The value of size can be used to * determine fat touch events. */ float AMotionEvent_getHistoricalSize(AInputEvent* motion_event, size_t pointer_index, size_t history_index); /* Get the historical length of the major axis of an ellipse that describes the touch area * at the point of contact for the given pointer index that * occurred between this event and the previous motion event. */ float AMotionEvent_getHistoricalTouchMajor(const AInputEvent* motion_event, size_t pointer_index, size_t history_index); /* Get the historical length of the minor axis of an ellipse that describes the touch area * at the point of contact for the given pointer index that * occurred between this event and the previous motion event. */ float AMotionEvent_getHistoricalTouchMinor(const AInputEvent* motion_event, size_t pointer_index, size_t history_index); /* Get the historical length of the major axis of an ellipse that describes the size * of the approaching tool for the given pointer index that * occurred between this event and the previous motion event. * The tool area represents the estimated size of the finger or pen that is * touching the device independent of its actual touch area at the point of contact. */ float AMotionEvent_getHistoricalToolMajor(const AInputEvent* motion_event, size_t pointer_index, size_t history_index); /* Get the historical length of the minor axis of an ellipse that describes the size * of the approaching tool for the given pointer index that * occurred between this event and the previous motion event. * The tool area represents the estimated size of the finger or pen that is * touching the device independent of its actual touch area at the point of contact. */ float AMotionEvent_getHistoricalToolMinor(const AInputEvent* motion_event, size_t pointer_index, size_t history_index); /* Get the historical orientation of the touch area and tool area in radians clockwise from * vertical for the given pointer index that * occurred between this event and the previous motion event. * An angle of 0 degrees indicates that the major axis of contact is oriented * upwards, is perfectly circular or is of unknown orientation. A positive angle * indicates that the major axis of contact is oriented to the right. A negative angle * indicates that the major axis of contact is oriented to the left. * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians * (finger pointing fully right). */ float AMotionEvent_getHistoricalOrientation(const AInputEvent* motion_event, size_t pointer_index, size_t history_index); /* Get the historical value of the request axis for the given pointer index * that occurred between this event and the previous motion event. */ float AMotionEvent_getHistoricalAxisValue(const AInputEvent* motion_event, int32_t axis, size_t pointer_index, size_t history_index); /* * Input queue * * An input queue is the facility through which you retrieve input * events. */ struct AInputQueue; typedef struct AInputQueue AInputQueue; /* * Add this input queue to a looper for processing. See * ALooper_addFd() for information on the ident, callback, and data params. */ void AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper, int ident, ALooper_callbackFunc callback, void* data); /* * Remove the input queue from the looper it is currently attached to. */ void AInputQueue_detachLooper(AInputQueue* queue); /* * Returns true if there are one or more events available in the * input queue. Returns 1 if the queue has events; 0 if * it does not have events; and a negative value if there is an error. */ int32_t AInputQueue_hasEvents(AInputQueue* queue); /* * Returns the next available event from the queue. Returns a negative * value if no events are available or an error has occurred. */ int32_t AInputQueue_getEvent(AInputQueue* queue, AInputEvent** outEvent); /* * Sends the key for standard pre-dispatching -- that is, possibly deliver * it to the current IME to be consumed before the app. Returns 0 if it * was not pre-dispatched, meaning you can process it right now. If non-zero * is returned, you must abandon the current event processing and allow the * event to appear again in the event queue (if it does not get consumed during * pre-dispatching). */ int32_t AInputQueue_preDispatchEvent(AInputQueue* queue, AInputEvent* event); /* * Report that dispatching has finished with the given event. * This must be called after receiving an event with AInputQueue_get_event(). */ void AInputQueue_finishEvent(AInputQueue* queue, AInputEvent* event, int handled); #ifdef __cplusplus } #endif #endif // _ANDROID_INPUT_H android-audiosystem-1.8+13.10.20130807/include/android/native_window.h0000644000015700001700000000721112200324306025764 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_NATIVE_WINDOW_H #define ANDROID_NATIVE_WINDOW_H #include #ifdef __cplusplus extern "C" { #endif /* * Pixel formats that a window can use. */ enum { WINDOW_FORMAT_RGBA_8888 = 1, WINDOW_FORMAT_RGBX_8888 = 2, WINDOW_FORMAT_RGB_565 = 4, }; struct ANativeWindow; typedef struct ANativeWindow ANativeWindow; typedef struct ANativeWindow_Buffer { // The number of pixels that are show horizontally. int32_t width; // The number of pixels that are shown vertically. int32_t height; // The number of *pixels* that a line in the buffer takes in // memory. This may be >= width. int32_t stride; // The format of the buffer. One of WINDOW_FORMAT_* int32_t format; // The actual bits. void* bits; // Do not touch. uint32_t reserved[6]; } ANativeWindow_Buffer; /** * Acquire a reference on the given ANativeWindow object. This prevents the object * from being deleted until the reference is removed. */ void ANativeWindow_acquire(ANativeWindow* window); /** * Remove a reference that was previously acquired with ANativeWindow_acquire(). */ void ANativeWindow_release(ANativeWindow* window); /* * Return the current width in pixels of the window surface. Returns a * negative value on error. */ int32_t ANativeWindow_getWidth(ANativeWindow* window); /* * Return the current height in pixels of the window surface. Returns a * negative value on error. */ int32_t ANativeWindow_getHeight(ANativeWindow* window); /* * Return the current pixel format of the window surface. Returns a * negative value on error. */ int32_t ANativeWindow_getFormat(ANativeWindow* window); /* * Change the format and size of the window buffers. * * The width and height control the number of pixels in the buffers, not the * dimensions of the window on screen. If these are different than the * window's physical size, then it buffer will be scaled to match that size * when compositing it to the screen. * * For all of these parameters, if 0 is supplied then the window's base * value will come back in force. * * width and height must be either both zero or both non-zero. * */ int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, int32_t width, int32_t height, int32_t format); /** * Lock the window's next drawing surface for writing. * inOutDirtyBounds is used as an in/out parameter, upon entering the * function, it contains the dirty region, that is, the region the caller * intends to redraw. When the function returns, inOutDirtyBounds is updated * with the actual area the caller needs to redraw -- this region is often * extended by ANativeWindow_lock. */ int32_t ANativeWindow_lock(ANativeWindow* window, ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds); /** * Unlock the window's drawing surface after previously locking it, * posting the new buffer to the display. */ int32_t ANativeWindow_unlockAndPost(ANativeWindow* window); #ifdef __cplusplus }; #endif #endif // ANDROID_NATIVE_WINDOW_H android-audiosystem-1.8+13.10.20130807/include/android/asset_manager.h0000644000015700001700000001164212200324306025723 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_ASSET_MANAGER_H #define ANDROID_ASSET_MANAGER_H #ifdef __cplusplus extern "C" { #endif struct AAssetManager; typedef struct AAssetManager AAssetManager; struct AAssetDir; typedef struct AAssetDir AAssetDir; struct AAsset; typedef struct AAsset AAsset; /* Available modes for opening assets */ enum { AASSET_MODE_UNKNOWN = 0, AASSET_MODE_RANDOM = 1, AASSET_MODE_STREAMING = 2, AASSET_MODE_BUFFER = 3 }; /** * Open the named directory within the asset hierarchy. The directory can then * be inspected with the AAssetDir functions. To open the top-level directory, * pass in "" as the dirName. * * The object returned here should be freed by calling AAssetDir_close(). */ AAssetDir* AAssetManager_openDir(AAssetManager* mgr, const char* dirName); /** * Open an asset. * * The object returned here should be freed by calling AAsset_close(). */ AAsset* AAssetManager_open(AAssetManager* mgr, const char* filename, int mode); /** * Iterate over the files in an asset directory. A NULL string is returned * when all the file names have been returned. * * The returned file name is suitable for passing to AAssetManager_open(). * * The string returned here is owned by the AssetDir implementation and is not * guaranteed to remain valid if any other calls are made on this AAssetDir * instance. */ const char* AAssetDir_getNextFileName(AAssetDir* assetDir); /** * Reset the iteration state of AAssetDir_getNextFileName() to the beginning. */ void AAssetDir_rewind(AAssetDir* assetDir); /** * Close an opened AAssetDir, freeing any related resources. */ void AAssetDir_close(AAssetDir* assetDir); /** * Attempt to read 'count' bytes of data from the current offset. * * Returns the number of bytes read, zero on EOF, or < 0 on error. */ int AAsset_read(AAsset* asset, void* buf, size_t count); /** * Seek to the specified offset within the asset data. 'whence' uses the * same constants as lseek()/fseek(). * * Returns the new position on success, or (off_t) -1 on error. */ off_t AAsset_seek(AAsset* asset, off_t offset, int whence); /** * Seek to the specified offset within the asset data. 'whence' uses the * same constants as lseek()/fseek(). * * Uses 64-bit data type for large files as opposed to the 32-bit type used * by AAsset_seek. * * Returns the new position on success, or (off64_t) -1 on error. */ off64_t AAsset_seek64(AAsset* asset, off64_t offset, int whence); /** * Close the asset, freeing all associated resources. */ void AAsset_close(AAsset* asset); /** * Get a pointer to a buffer holding the entire contents of the assset. * * Returns NULL on failure. */ const void* AAsset_getBuffer(AAsset* asset); /** * Report the total size of the asset data. */ off_t AAsset_getLength(AAsset* asset); /** * Report the total size of the asset data. Reports the size using a 64-bit * number insted of 32-bit as AAsset_getLength. */ off64_t AAsset_getLength64(AAsset* asset); /** * Report the total amount of asset data that can be read from the current position. */ off_t AAsset_getRemainingLength(AAsset* asset); /** * Report the total amount of asset data that can be read from the current position. * * Uses a 64-bit number instead of a 32-bit number as AAsset_getRemainingLength does. */ off64_t AAsset_getRemainingLength64(AAsset* asset); /** * Open a new file descriptor that can be used to read the asset data. If the * start or length cannot be represented by a 32-bit number, it will be * truncated. If the file is large, use AAsset_openFileDescriptor64 instead. * * Returns < 0 if direct fd access is not possible (for example, if the asset is * compressed). */ int AAsset_openFileDescriptor(AAsset* asset, off_t* outStart, off_t* outLength); /** * Open a new file descriptor that can be used to read the asset data. * * Uses a 64-bit number for the offset and length instead of 32-bit instead of * as AAsset_openFileDescriptor does. * * Returns < 0 if direct fd access is not possible (for example, if the asset is * compressed). */ int AAsset_openFileDescriptor64(AAsset* asset, off64_t* outStart, off64_t* outLength); /** * Returns whether this asset's internal buffer is allocated in ordinary RAM (i.e. not * mmapped). */ int AAsset_isAllocated(AAsset* asset); #ifdef __cplusplus }; #endif #endif // ANDROID_ASSET_MANAGER_H android-audiosystem-1.8+13.10.20130807/include/android/log.h0000644000015700001700000000742712200324306023701 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _ANDROID_LOG_H #define _ANDROID_LOG_H /****************************************************************** * * IMPORTANT NOTICE: * * This file is part of Android's set of stable system headers * exposed by the Android NDK (Native Development Kit) since * platform release 1.5 * * Third-party source AND binary code relies on the definitions * here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES. * * - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES) * - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS * - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY * - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES */ /* * Support routines to send messages to the Android in-kernel log buffer, * which can later be accessed through the 'logcat' utility. * * Each log message must have * - a priority * - a log tag * - some text * * The tag normally corresponds to the component that emits the log message, * and should be reasonably small. * * Log message text may be truncated to less than an implementation-specific * limit (e.g. 1023 characters max). * * Note that a newline character ("\n") will be appended automatically to your * log message, if not already there. It is not possible to send several messages * and have them appear on a single line in logcat. * * PLEASE USE LOGS WITH MODERATION: * * - Sending log messages eats CPU and slow down your application and the * system. * * - The circular log buffer is pretty small (<64KB), sending many messages * might push off other important log messages from the rest of the system. * * - In release builds, only send log messages to account for exceptional * conditions. * * NOTE: These functions MUST be implemented by /system/lib/liblog.so */ #include #ifdef __cplusplus extern "C" { #endif /* * Android log priority values, in ascending priority order. */ typedef enum android_LogPriority { ANDROID_LOG_UNKNOWN = 0, ANDROID_LOG_DEFAULT, /* only for SetMinPriority() */ ANDROID_LOG_VERBOSE, ANDROID_LOG_DEBUG, ANDROID_LOG_INFO, ANDROID_LOG_WARN, ANDROID_LOG_ERROR, ANDROID_LOG_FATAL, ANDROID_LOG_SILENT, /* only for SetMinPriority(); must be last */ } android_LogPriority; /* * Send a simple string to the log. */ int __android_log_write(int prio, const char *tag, const char *text); /* * Send a formatted string to the log, used like printf(fmt,...) */ int __android_log_print(int prio, const char *tag, const char *fmt, ...) #if defined(__GNUC__) __attribute__ ((format(printf, 3, 4))) #endif ; /* * A variant of __android_log_print() that takes a va_list to list * additional parameters. */ int __android_log_vprint(int prio, const char *tag, const char *fmt, va_list ap); /* * Log an assertion failure and SIGTRAP the process to have a chance * to inspect it, if a debugger is attached. This uses the FATAL priority. */ void __android_log_assert(const char *cond, const char *tag, const char *fmt, ...) #if defined(__GNUC__) __attribute__ ((noreturn)) __attribute__ ((format(printf, 3, 4))) #endif ; #ifdef __cplusplus } #endif #endif /* _ANDROID_LOG_H */ android-audiosystem-1.8+13.10.20130807/include/android/bitmap.h0000644000015700001700000000455412200324306024372 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_BITMAP_H #define ANDROID_BITMAP_H #include #include #ifdef __cplusplus extern "C" { #endif #define ANDROID_BITMAP_RESUT_SUCCESS 0 #define ANDROID_BITMAP_RESULT_BAD_PARAMETER -1 #define ANDROID_BITMAP_RESULT_JNI_EXCEPTION -2 #define ANDROID_BITMAP_RESULT_ALLOCATION_FAILED -3 enum AndroidBitmapFormat { ANDROID_BITMAP_FORMAT_NONE = 0, ANDROID_BITMAP_FORMAT_RGBA_8888 = 1, ANDROID_BITMAP_FORMAT_RGB_565 = 4, ANDROID_BITMAP_FORMAT_RGBA_4444 = 7, ANDROID_BITMAP_FORMAT_A_8 = 8, }; typedef struct { uint32_t width; uint32_t height; uint32_t stride; int32_t format; uint32_t flags; // 0 for now } AndroidBitmapInfo; /** * Given a java bitmap object, fill out the AndroidBitmap struct for it. * If the call fails, the info parameter will be ignored */ int AndroidBitmap_getInfo(JNIEnv* env, jobject jbitmap, AndroidBitmapInfo* info); /** * Given a java bitmap object, attempt to lock the pixel address. * Locking will ensure that the memory for the pixels will not move * until the unlockPixels call, and ensure that, if the pixels had been * previously purged, they will have been restored. * * If this call succeeds, it must be balanced by a call to * AndroidBitmap_unlockPixels, after which time the address of the pixels should * no longer be used. * * If this succeeds, *addrPtr will be set to the pixel address. If the call * fails, addrPtr will be ignored. */ int AndroidBitmap_lockPixels(JNIEnv* env, jobject jbitmap, void** addrPtr); /** * Call this to balanace a successful call to AndroidBitmap_lockPixels */ int AndroidBitmap_unlockPixels(JNIEnv* env, jobject jbitmap); #ifdef __cplusplus } #endif #endif android-audiosystem-1.8+13.10.20130807/include/android/native_activity.h0000644000015700001700000002504212200324306026313 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_NATIVE_ACTIVITY_H #define ANDROID_NATIVE_ACTIVITY_H #include #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif struct ANativeActivityCallbacks; /** * This structure defines the native side of an android.app.NativeActivity. * It is created by the framework, and handed to the application's native * code as it is being launched. */ typedef struct ANativeActivity { /** * Pointer to the callback function table of the native application. * You can set the functions here to your own callbacks. The callbacks * pointer itself here should not be changed; it is allocated and managed * for you by the framework. */ struct ANativeActivityCallbacks* callbacks; /** * The global handle on the process's Java VM. */ JavaVM* vm; /** * JNI context for the main thread of the app. Note that this field * can ONLY be used from the main thread of the process; that is, the * thread that calls into the ANativeActivityCallbacks. */ JNIEnv* env; /** * The NativeActivity Java class. */ jobject clazz; /** * Path to this application's internal data directory. */ const char* internalDataPath; /** * Path to this application's external (removable/mountable) data directory. */ const char* externalDataPath; /** * The platform's SDK version code. */ int32_t sdkVersion; /** * This is the native instance of the application. It is not used by * the framework, but can be set by the application to its own instance * state. */ void* instance; /** * Pointer to the Asset Manager instance for the application. The application * uses this to access binary assets bundled inside its own .apk file. */ AAssetManager* assetManager; /** * Available starting with Honeycomb: path to the directory containing * the application's OBB files (if any). If the app doesn't have any * OBB files, this directory may not exist. */ const char* obbPath; } ANativeActivity; /** * These are the callbacks the framework makes into a native application. * All of these callbacks happen on the main thread of the application. * By default, all callbacks are NULL; set to a pointer to your own function * to have it called. */ typedef struct ANativeActivityCallbacks { /** * NativeActivity has started. See Java documentation for Activity.onStart() * for more information. */ void (*onStart)(ANativeActivity* activity); /** * NativeActivity has resumed. See Java documentation for Activity.onResume() * for more information. */ void (*onResume)(ANativeActivity* activity); /** * Framework is asking NativeActivity to save its current instance state. * See Java documentation for Activity.onSaveInstanceState() for more * information. The returned pointer needs to be created with malloc(); * the framework will call free() on it for you. You also must fill in * outSize with the number of bytes in the allocation. Note that the * saved state will be persisted, so it can not contain any active * entities (pointers to memory, file descriptors, etc). */ void* (*onSaveInstanceState)(ANativeActivity* activity, size_t* outSize); /** * NativeActivity has paused. See Java documentation for Activity.onPause() * for more information. */ void (*onPause)(ANativeActivity* activity); /** * NativeActivity has stopped. See Java documentation for Activity.onStop() * for more information. */ void (*onStop)(ANativeActivity* activity); /** * NativeActivity is being destroyed. See Java documentation for Activity.onDestroy() * for more information. */ void (*onDestroy)(ANativeActivity* activity); /** * Focus has changed in this NativeActivity's window. This is often used, * for example, to pause a game when it loses input focus. */ void (*onWindowFocusChanged)(ANativeActivity* activity, int hasFocus); /** * The drawing window for this native activity has been created. You * can use the given native window object to start drawing. */ void (*onNativeWindowCreated)(ANativeActivity* activity, ANativeWindow* window); /** * The drawing window for this native activity has been resized. You should * retrieve the new size from the window and ensure that your rendering in * it now matches. */ void (*onNativeWindowResized)(ANativeActivity* activity, ANativeWindow* window); /** * The drawing window for this native activity needs to be redrawn. To avoid * transient artifacts during screen changes (such resizing after rotation), * applications should not return from this function until they have finished * drawing their window in its current state. */ void (*onNativeWindowRedrawNeeded)(ANativeActivity* activity, ANativeWindow* window); /** * The drawing window for this native activity is going to be destroyed. * You MUST ensure that you do not touch the window object after returning * from this function: in the common case of drawing to the window from * another thread, that means the implementation of this callback must * properly synchronize with the other thread to stop its drawing before * returning from here. */ void (*onNativeWindowDestroyed)(ANativeActivity* activity, ANativeWindow* window); /** * The input queue for this native activity's window has been created. * You can use the given input queue to start retrieving input events. */ void (*onInputQueueCreated)(ANativeActivity* activity, AInputQueue* queue); /** * The input queue for this native activity's window is being destroyed. * You should no longer try to reference this object upon returning from this * function. */ void (*onInputQueueDestroyed)(ANativeActivity* activity, AInputQueue* queue); /** * The rectangle in the window in which content should be placed has changed. */ void (*onContentRectChanged)(ANativeActivity* activity, const ARect* rect); /** * The current device AConfiguration has changed. The new configuration can * be retrieved from assetManager. */ void (*onConfigurationChanged)(ANativeActivity* activity); /** * The system is running low on memory. Use this callback to release * resources you do not need, to help the system avoid killing more * important processes. */ void (*onLowMemory)(ANativeActivity* activity); } ANativeActivityCallbacks; /** * This is the function that must be in the native code to instantiate the * application's native activity. It is called with the activity instance (see * above); if the code is being instantiated from a previously saved instance, * the savedState will be non-NULL and point to the saved data. You must make * any copy of this data you need -- it will be released after you return from * this function. */ typedef void ANativeActivity_createFunc(ANativeActivity* activity, void* savedState, size_t savedStateSize); /** * The name of the function that NativeInstance looks for when launching its * native code. This is the default function that is used, you can specify * "android.app.func_name" string meta-data in your manifest to use a different * function. */ extern ANativeActivity_createFunc ANativeActivity_onCreate; /** * Finish the given activity. Its finish() method will be called, causing it * to be stopped and destroyed. Note that this method can be called from * *any* thread; it will send a message to the main thread of the process * where the Java finish call will take place. */ void ANativeActivity_finish(ANativeActivity* activity); /** * Change the window format of the given activity. Calls getWindow().setFormat() * of the given activity. Note that this method can be called from * *any* thread; it will send a message to the main thread of the process * where the Java finish call will take place. */ void ANativeActivity_setWindowFormat(ANativeActivity* activity, int32_t format); /** * Change the window flags of the given activity. Calls getWindow().setFlags() * of the given activity. Note that this method can be called from * *any* thread; it will send a message to the main thread of the process * where the Java finish call will take place. See window.h for flag constants. */ void ANativeActivity_setWindowFlags(ANativeActivity* activity, uint32_t addFlags, uint32_t removeFlags); /** * Flags for ANativeActivity_showSoftInput; see the Java InputMethodManager * API for documentation. */ enum { ANATIVEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT = 0x0001, ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED = 0x0002, }; /** * Show the IME while in the given activity. Calls InputMethodManager.showSoftInput() * for the given activity. Note that this method can be called from * *any* thread; it will send a message to the main thread of the process * where the Java finish call will take place. */ void ANativeActivity_showSoftInput(ANativeActivity* activity, uint32_t flags); /** * Flags for ANativeActivity_hideSoftInput; see the Java InputMethodManager * API for documentation. */ enum { ANATIVEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY = 0x0001, ANATIVEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS = 0x0002, }; /** * Hide the IME while in the given activity. Calls InputMethodManager.hideSoftInput() * for the given activity. Note that this method can be called from * *any* thread; it will send a message to the main thread of the process * where the Java finish call will take place. */ void ANativeActivity_hideSoftInput(ANativeActivity* activity, uint32_t flags); #ifdef __cplusplus }; #endif #endif // ANDROID_NATIVE_ACTIVITY_H android-audiosystem-1.8+13.10.20130807/include/android/looper.h0000644000015700001700000002200312200324306024403 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_LOOPER_H #define ANDROID_LOOPER_H #ifdef __cplusplus extern "C" { #endif /** * ALooper * * A looper is the state tracking an event loop for a thread. * Loopers do not define event structures or other such things; rather * they are a lower-level facility to attach one or more discrete objects * listening for an event. An "event" here is simply data available on * a file descriptor: each attached object has an associated file descriptor, * and waiting for "events" means (internally) polling on all of these file * descriptors until one or more of them have data available. * * A thread can have only one ALooper associated with it. */ struct ALooper; typedef struct ALooper ALooper; /** * Returns the looper associated with the calling thread, or NULL if * there is not one. */ ALooper* ALooper_forThread(); enum { /** * Option for ALooper_prepare: this looper will accept calls to * ALooper_addFd() that do not have a callback (that is provide NULL * for the callback). In this case the caller of ALooper_pollOnce() * or ALooper_pollAll() MUST check the return from these functions to * discover when data is available on such fds and process it. */ ALOOPER_PREPARE_ALLOW_NON_CALLBACKS = 1<<0 }; /** * Prepares a looper associated with the calling thread, and returns it. * If the thread already has a looper, it is returned. Otherwise, a new * one is created, associated with the thread, and returned. * * The opts may be ALOOPER_PREPARE_ALLOW_NON_CALLBACKS or 0. */ ALooper* ALooper_prepare(int opts); enum { /** * Result from ALooper_pollOnce() and ALooper_pollAll(): * The poll was awoken using wake() before the timeout expired * and no callbacks were executed and no other file descriptors were ready. */ ALOOPER_POLL_WAKE = -1, /** * Result from ALooper_pollOnce() and ALooper_pollAll(): * One or more callbacks were executed. */ ALOOPER_POLL_CALLBACK = -2, /** * Result from ALooper_pollOnce() and ALooper_pollAll(): * The timeout expired. */ ALOOPER_POLL_TIMEOUT = -3, /** * Result from ALooper_pollOnce() and ALooper_pollAll(): * An error occurred. */ ALOOPER_POLL_ERROR = -4, }; /** * Acquire a reference on the given ALooper object. This prevents the object * from being deleted until the reference is removed. This is only needed * to safely hand an ALooper from one thread to another. */ void ALooper_acquire(ALooper* looper); /** * Remove a reference that was previously acquired with ALooper_acquire(). */ void ALooper_release(ALooper* looper); /** * Flags for file descriptor events that a looper can monitor. * * These flag bits can be combined to monitor multiple events at once. */ enum { /** * The file descriptor is available for read operations. */ ALOOPER_EVENT_INPUT = 1 << 0, /** * The file descriptor is available for write operations. */ ALOOPER_EVENT_OUTPUT = 1 << 1, /** * The file descriptor has encountered an error condition. * * The looper always sends notifications about errors; it is not necessary * to specify this event flag in the requested event set. */ ALOOPER_EVENT_ERROR = 1 << 2, /** * The file descriptor was hung up. * For example, indicates that the remote end of a pipe or socket was closed. * * The looper always sends notifications about hangups; it is not necessary * to specify this event flag in the requested event set. */ ALOOPER_EVENT_HANGUP = 1 << 3, /** * The file descriptor is invalid. * For example, the file descriptor was closed prematurely. * * The looper always sends notifications about invalid file descriptors; it is not necessary * to specify this event flag in the requested event set. */ ALOOPER_EVENT_INVALID = 1 << 4, }; /** * For callback-based event loops, this is the prototype of the function * that is called when a file descriptor event occurs. * It is given the file descriptor it is associated with, * a bitmask of the poll events that were triggered (typically ALOOPER_EVENT_INPUT), * and the data pointer that was originally supplied. * * Implementations should return 1 to continue receiving callbacks, or 0 * to have this file descriptor and callback unregistered from the looper. */ typedef int (*ALooper_callbackFunc)(int fd, int events, void* data); /** * Waits for events to be available, with optional timeout in milliseconds. * Invokes callbacks for all file descriptors on which an event occurred. * * If the timeout is zero, returns immediately without blocking. * If the timeout is negative, waits indefinitely until an event appears. * * Returns ALOOPER_POLL_WAKE if the poll was awoken using wake() before * the timeout expired and no callbacks were invoked and no other file * descriptors were ready. * * Returns ALOOPER_POLL_CALLBACK if one or more callbacks were invoked. * * Returns ALOOPER_POLL_TIMEOUT if there was no data before the given * timeout expired. * * Returns ALOOPER_POLL_ERROR if an error occurred. * * Returns a value >= 0 containing an identifier if its file descriptor has data * and it has no callback function (requiring the caller here to handle it). * In this (and only this) case outFd, outEvents and outData will contain the poll * events and data associated with the fd, otherwise they will be set to NULL. * * This method does not return until it has finished invoking the appropriate callbacks * for all file descriptors that were signalled. */ int ALooper_pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData); /** * Like ALooper_pollOnce(), but performs all pending callbacks until all * data has been consumed or a file descriptor is available with no callback. * This function will never return ALOOPER_POLL_CALLBACK. */ int ALooper_pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outData); /** * Wakes the poll asynchronously. * * This method can be called on any thread. * This method returns immediately. */ void ALooper_wake(ALooper* looper); /** * Adds a new file descriptor to be polled by the looper. * If the same file descriptor was previously added, it is replaced. * * "fd" is the file descriptor to be added. * "ident" is an identifier for this event, which is returned from ALooper_pollOnce(). * The identifier must be >= 0, or ALOOPER_POLL_CALLBACK if providing a non-NULL callback. * "events" are the poll events to wake up on. Typically this is ALOOPER_EVENT_INPUT. * "callback" is the function to call when there is an event on the file descriptor. * "data" is a private data pointer to supply to the callback. * * There are two main uses of this function: * * (1) If "callback" is non-NULL, then this function will be called when there is * data on the file descriptor. It should execute any events it has pending, * appropriately reading from the file descriptor. The 'ident' is ignored in this case. * * (2) If "callback" is NULL, the 'ident' will be returned by ALooper_pollOnce * when its file descriptor has data available, requiring the caller to take * care of processing it. * * Returns 1 if the file descriptor was added or -1 if an error occurred. * * This method can be called on any thread. * This method may block briefly if it needs to wake the poll. */ int ALooper_addFd(ALooper* looper, int fd, int ident, int events, ALooper_callbackFunc callback, void* data); /** * Removes a previously added file descriptor from the looper. * * When this method returns, it is safe to close the file descriptor since the looper * will no longer have a reference to it. However, it is possible for the callback to * already be running or for it to run one last time if the file descriptor was already * signalled. Calling code is responsible for ensuring that this case is safely handled. * For example, if the callback takes care of removing itself during its own execution either * by returning 0 or by calling this method, then it can be guaranteed to not be invoked * again at any later time unless registered anew. * * Returns 1 if the file descriptor was removed, 0 if none was previously registered * or -1 if an error occurred. * * This method can be called on any thread. * This method may block briefly if it needs to wake the poll. */ int ALooper_removeFd(ALooper* looper, int fd); #ifdef __cplusplus }; #endif #endif // ANDROID_NATIVE_WINDOW_H android-audiosystem-1.8+13.10.20130807/include/android/keycodes.h0000644000015700001700000002163112200324306024717 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _ANDROID_KEYCODES_H #define _ANDROID_KEYCODES_H /****************************************************************** * * IMPORTANT NOTICE: * * This file is part of Android's set of stable system headers * exposed by the Android NDK (Native Development Kit). * * Third-party source AND binary code relies on the definitions * here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES. * * - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES) * - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS * - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY * - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES */ #include #ifdef __cplusplus extern "C" { #endif /* * Key codes. */ enum { AKEYCODE_UNKNOWN = 0, AKEYCODE_SOFT_LEFT = 1, AKEYCODE_SOFT_RIGHT = 2, AKEYCODE_HOME = 3, AKEYCODE_BACK = 4, AKEYCODE_CALL = 5, AKEYCODE_ENDCALL = 6, AKEYCODE_0 = 7, AKEYCODE_1 = 8, AKEYCODE_2 = 9, AKEYCODE_3 = 10, AKEYCODE_4 = 11, AKEYCODE_5 = 12, AKEYCODE_6 = 13, AKEYCODE_7 = 14, AKEYCODE_8 = 15, AKEYCODE_9 = 16, AKEYCODE_STAR = 17, AKEYCODE_POUND = 18, AKEYCODE_DPAD_UP = 19, AKEYCODE_DPAD_DOWN = 20, AKEYCODE_DPAD_LEFT = 21, AKEYCODE_DPAD_RIGHT = 22, AKEYCODE_DPAD_CENTER = 23, AKEYCODE_VOLUME_UP = 24, AKEYCODE_VOLUME_DOWN = 25, AKEYCODE_POWER = 26, AKEYCODE_CAMERA = 27, AKEYCODE_CLEAR = 28, AKEYCODE_A = 29, AKEYCODE_B = 30, AKEYCODE_C = 31, AKEYCODE_D = 32, AKEYCODE_E = 33, AKEYCODE_F = 34, AKEYCODE_G = 35, AKEYCODE_H = 36, AKEYCODE_I = 37, AKEYCODE_J = 38, AKEYCODE_K = 39, AKEYCODE_L = 40, AKEYCODE_M = 41, AKEYCODE_N = 42, AKEYCODE_O = 43, AKEYCODE_P = 44, AKEYCODE_Q = 45, AKEYCODE_R = 46, AKEYCODE_S = 47, AKEYCODE_T = 48, AKEYCODE_U = 49, AKEYCODE_V = 50, AKEYCODE_W = 51, AKEYCODE_X = 52, AKEYCODE_Y = 53, AKEYCODE_Z = 54, AKEYCODE_COMMA = 55, AKEYCODE_PERIOD = 56, AKEYCODE_ALT_LEFT = 57, AKEYCODE_ALT_RIGHT = 58, AKEYCODE_SHIFT_LEFT = 59, AKEYCODE_SHIFT_RIGHT = 60, AKEYCODE_TAB = 61, AKEYCODE_SPACE = 62, AKEYCODE_SYM = 63, AKEYCODE_EXPLORER = 64, AKEYCODE_ENVELOPE = 65, AKEYCODE_ENTER = 66, AKEYCODE_DEL = 67, AKEYCODE_GRAVE = 68, AKEYCODE_MINUS = 69, AKEYCODE_EQUALS = 70, AKEYCODE_LEFT_BRACKET = 71, AKEYCODE_RIGHT_BRACKET = 72, AKEYCODE_BACKSLASH = 73, AKEYCODE_SEMICOLON = 74, AKEYCODE_APOSTROPHE = 75, AKEYCODE_SLASH = 76, AKEYCODE_AT = 77, AKEYCODE_NUM = 78, AKEYCODE_HEADSETHOOK = 79, AKEYCODE_FOCUS = 80, // *Camera* focus AKEYCODE_PLUS = 81, AKEYCODE_MENU = 82, AKEYCODE_NOTIFICATION = 83, AKEYCODE_SEARCH = 84, AKEYCODE_MEDIA_PLAY_PAUSE= 85, AKEYCODE_MEDIA_STOP = 86, AKEYCODE_MEDIA_NEXT = 87, AKEYCODE_MEDIA_PREVIOUS = 88, AKEYCODE_MEDIA_REWIND = 89, AKEYCODE_MEDIA_FAST_FORWARD = 90, AKEYCODE_MUTE = 91, AKEYCODE_PAGE_UP = 92, AKEYCODE_PAGE_DOWN = 93, AKEYCODE_PICTSYMBOLS = 94, AKEYCODE_SWITCH_CHARSET = 95, AKEYCODE_BUTTON_A = 96, AKEYCODE_BUTTON_B = 97, AKEYCODE_BUTTON_C = 98, AKEYCODE_BUTTON_X = 99, AKEYCODE_BUTTON_Y = 100, AKEYCODE_BUTTON_Z = 101, AKEYCODE_BUTTON_L1 = 102, AKEYCODE_BUTTON_R1 = 103, AKEYCODE_BUTTON_L2 = 104, AKEYCODE_BUTTON_R2 = 105, AKEYCODE_BUTTON_THUMBL = 106, AKEYCODE_BUTTON_THUMBR = 107, AKEYCODE_BUTTON_START = 108, AKEYCODE_BUTTON_SELECT = 109, AKEYCODE_BUTTON_MODE = 110, AKEYCODE_ESCAPE = 111, AKEYCODE_FORWARD_DEL = 112, AKEYCODE_CTRL_LEFT = 113, AKEYCODE_CTRL_RIGHT = 114, AKEYCODE_CAPS_LOCK = 115, AKEYCODE_SCROLL_LOCK = 116, AKEYCODE_META_LEFT = 117, AKEYCODE_META_RIGHT = 118, AKEYCODE_FUNCTION = 119, AKEYCODE_SYSRQ = 120, AKEYCODE_BREAK = 121, AKEYCODE_MOVE_HOME = 122, AKEYCODE_MOVE_END = 123, AKEYCODE_INSERT = 124, AKEYCODE_FORWARD = 125, AKEYCODE_MEDIA_PLAY = 126, AKEYCODE_MEDIA_PAUSE = 127, AKEYCODE_MEDIA_CLOSE = 128, AKEYCODE_MEDIA_EJECT = 129, AKEYCODE_MEDIA_RECORD = 130, AKEYCODE_F1 = 131, AKEYCODE_F2 = 132, AKEYCODE_F3 = 133, AKEYCODE_F4 = 134, AKEYCODE_F5 = 135, AKEYCODE_F6 = 136, AKEYCODE_F7 = 137, AKEYCODE_F8 = 138, AKEYCODE_F9 = 139, AKEYCODE_F10 = 140, AKEYCODE_F11 = 141, AKEYCODE_F12 = 142, AKEYCODE_NUM_LOCK = 143, AKEYCODE_NUMPAD_0 = 144, AKEYCODE_NUMPAD_1 = 145, AKEYCODE_NUMPAD_2 = 146, AKEYCODE_NUMPAD_3 = 147, AKEYCODE_NUMPAD_4 = 148, AKEYCODE_NUMPAD_5 = 149, AKEYCODE_NUMPAD_6 = 150, AKEYCODE_NUMPAD_7 = 151, AKEYCODE_NUMPAD_8 = 152, AKEYCODE_NUMPAD_9 = 153, AKEYCODE_NUMPAD_DIVIDE = 154, AKEYCODE_NUMPAD_MULTIPLY = 155, AKEYCODE_NUMPAD_SUBTRACT = 156, AKEYCODE_NUMPAD_ADD = 157, AKEYCODE_NUMPAD_DOT = 158, AKEYCODE_NUMPAD_COMMA = 159, AKEYCODE_NUMPAD_ENTER = 160, AKEYCODE_NUMPAD_EQUALS = 161, AKEYCODE_NUMPAD_LEFT_PAREN = 162, AKEYCODE_NUMPAD_RIGHT_PAREN = 163, AKEYCODE_VOLUME_MUTE = 164, AKEYCODE_INFO = 165, AKEYCODE_CHANNEL_UP = 166, AKEYCODE_CHANNEL_DOWN = 167, AKEYCODE_ZOOM_IN = 168, AKEYCODE_ZOOM_OUT = 169, AKEYCODE_TV = 170, AKEYCODE_WINDOW = 171, AKEYCODE_GUIDE = 172, AKEYCODE_DVR = 173, AKEYCODE_BOOKMARK = 174, AKEYCODE_CAPTIONS = 175, AKEYCODE_SETTINGS = 176, AKEYCODE_TV_POWER = 177, AKEYCODE_TV_INPUT = 178, AKEYCODE_STB_POWER = 179, AKEYCODE_STB_INPUT = 180, AKEYCODE_AVR_POWER = 181, AKEYCODE_AVR_INPUT = 182, AKEYCODE_PROG_RED = 183, AKEYCODE_PROG_GREEN = 184, AKEYCODE_PROG_YELLOW = 185, AKEYCODE_PROG_BLUE = 186, AKEYCODE_APP_SWITCH = 187, AKEYCODE_BUTTON_1 = 188, AKEYCODE_BUTTON_2 = 189, AKEYCODE_BUTTON_3 = 190, AKEYCODE_BUTTON_4 = 191, AKEYCODE_BUTTON_5 = 192, AKEYCODE_BUTTON_6 = 193, AKEYCODE_BUTTON_7 = 194, AKEYCODE_BUTTON_8 = 195, AKEYCODE_BUTTON_9 = 196, AKEYCODE_BUTTON_10 = 197, AKEYCODE_BUTTON_11 = 198, AKEYCODE_BUTTON_12 = 199, AKEYCODE_BUTTON_13 = 200, AKEYCODE_BUTTON_14 = 201, AKEYCODE_BUTTON_15 = 202, AKEYCODE_BUTTON_16 = 203, AKEYCODE_LANGUAGE_SWITCH = 204, AKEYCODE_MANNER_MODE = 205, AKEYCODE_3D_MODE = 206, AKEYCODE_CONTACTS = 207, AKEYCODE_CALENDAR = 208, AKEYCODE_MUSIC = 209, AKEYCODE_CALCULATOR = 210, // NOTE: If you add a new keycode here you must also add it to several other files. // Refer to frameworks/base/core/java/android/view/KeyEvent.java for the full list. }; #ifdef __cplusplus } #endif #endif // _ANDROID_KEYCODES_H android-audiosystem-1.8+13.10.20130807/include/media/0000755000015700001700000000000012200324404022373 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/media/MediaProfiles.h0000644000015700001700000004611712200324306025301 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2010, The Android Open Source Project. ** Copyright (c) 2010 - 2012, The Linux Foundation. All rights reserved. ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #ifndef ANDROID_MEDIAPROFILES_H #define ANDROID_MEDIAPROFILES_H #include #include namespace android { enum camcorder_quality { CAMCORDER_QUALITY_LIST_START = 0, CAMCORDER_QUALITY_LOW = 0, CAMCORDER_QUALITY_HIGH = 1, CAMCORDER_QUALITY_QCIF = 2, CAMCORDER_QUALITY_CIF = 3, CAMCORDER_QUALITY_480P = 4, CAMCORDER_QUALITY_720P = 5, CAMCORDER_QUALITY_1080P = 6, CAMCORDER_QUALITY_QVGA = 11, CAMCORDER_QUALITY_FWVGA = 7, CAMCORDER_QUALITY_WVGA = 8, CAMCORDER_QUALITY_VGA = 9, CAMCORDER_QUALITY_WQVGA = 10, CAMCORDER_QUALITY_LIST_END = 11, CAMCORDER_QUALITY_TIME_LAPSE_LIST_START = 1000, CAMCORDER_QUALITY_TIME_LAPSE_LOW = 1000, CAMCORDER_QUALITY_TIME_LAPSE_HIGH = 1001, CAMCORDER_QUALITY_TIME_LAPSE_QCIF = 1002, CAMCORDER_QUALITY_TIME_LAPSE_CIF = 1003, CAMCORDER_QUALITY_TIME_LAPSE_480P = 1004, CAMCORDER_QUALITY_TIME_LAPSE_720P = 1005, CAMCORDER_QUALITY_TIME_LAPSE_1080P = 1006, CAMCORDER_QUALITY_TIME_LAPSE_QVGA = 1007, CAMCORDER_QUALITY_TIME_LAPSE_LIST_END = 1007, }; /** * Set CIF as default maximum import and export resolution of video editor. * The maximum import and export resolutions are platform specific, * which should be defined in media_profiles.xml. * Set default maximum prefetch YUV frames to 6, which means video editor can * queue up to 6 YUV frames in the video encoder source. * This value is used to limit the amount of memory used by video editor * engine when the encoder consumes YUV frames at a lower speed * than video editor engine produces. */ enum videoeditor_capability { VIDEOEDITOR_DEFAULT_MAX_INPUT_FRAME_WIDTH = 352, VIDEOEDITOR_DEFUALT_MAX_INPUT_FRAME_HEIGHT = 288, VIDEOEDITOR_DEFAULT_MAX_OUTPUT_FRAME_WIDTH = 352, VIDEOEDITOR_DEFUALT_MAX_OUTPUT_FRAME_HEIGHT = 288, VIDEOEDITOR_DEFAULT_MAX_PREFETCH_YUV_FRAMES = 6 }; enum video_decoder { VIDEO_DECODER_WMV, }; enum audio_decoder { AUDIO_DECODER_WMA, }; class MediaProfiles { public: /** * Returns the singleton instance for subsequence queries. * or NULL if error. */ static MediaProfiles* getInstance(); /** * Returns the value for the given param name for the given camera at * the given quality level, or -1 if error. * * Supported param name are: * duration - the recording duration. * file.format - output file format. see mediarecorder.h for details * vid.codec - video encoder. see mediarecorder.h for details. * aud.codec - audio encoder. see mediarecorder.h for details. * vid.width - video frame width * vid.height - video frame height * vid.fps - video frame rate * vid.bps - video bit rate * aud.bps - audio bit rate * aud.hz - audio sample rate * aud.ch - number of audio channels */ int getCamcorderProfileParamByName(const char *name, int cameraId, camcorder_quality quality) const; /** * Returns true if a profile for the given camera at the given quality exists, * or false if not. */ bool hasCamcorderProfile(int cameraId, camcorder_quality quality) const; /** * Returns the output file formats supported. */ Vector getOutputFileFormats() const; /** * Returns the video encoders supported. */ Vector getVideoEncoders() const; /** * Returns the value for the given param name for the given video encoder * returned from getVideoEncoderByIndex or -1 if error. * * Supported param name are: * enc.vid.width.min - min video frame width * enc.vid.width.max - max video frame width * enc.vid.height.min - min video frame height * enc.vid.height.max - max video frame height * enc.vid.bps.min - min bit rate in bits per second * enc.vid.bps.max - max bit rate in bits per second * enc.vid.fps.min - min frame rate in frames per second * enc.vid.fps.max - max frame rate in frames per second */ int getVideoEncoderParamByName(const char *name, video_encoder codec) const; /** * Returns the value for the given param name for the video editor cap * param or -1 if error. * Supported param name are: * videoeditor.input.width.max - max input video frame width * videoeditor.input.height.max - max input video frame height * videoeditor.output.width.max - max output video frame width * videoeditor.output.height.max - max output video frame height * maxPrefetchYUVFrames - max prefetch YUV frames in video editor engine. This value is used * to limit the memory consumption. */ int getVideoEditorCapParamByName(const char *name) const; /** * Returns the value for the given param name for the video editor export codec format * param or -1 if error. * Supported param name are: * videoeditor.export.profile - export video profile * videoeditor.export.level - export video level * Supported param codec are: * 1 for h263 * 2 for h264 * 3 for mpeg4 */ int getVideoEditorExportParamByName(const char *name, int codec) const; /** * Returns the audio encoders supported. */ Vector getAudioEncoders() const; /** * Returns the value for the given param name for the given audio encoder * returned from getAudioEncoderByIndex or -1 if error. * * Supported param name are: * enc.aud.ch.min - min number of channels * enc.aud.ch.max - max number of channels * enc.aud.bps.min - min bit rate in bits per second * enc.aud.bps.max - max bit rate in bits per second * enc.aud.hz.min - min sample rate in samples per second * enc.aud.hz.max - max sample rate in samples per second */ int getAudioEncoderParamByName(const char *name, audio_encoder codec) const; /** * Returns the video decoders supported. */ Vector getVideoDecoders() const; /** * Returns the audio decoders supported. */ Vector getAudioDecoders() const; /** * Returns the number of image encoding quality levels supported. */ Vector getImageEncodingQualityLevels(int cameraId) const; /** * Returns the start time offset (in ms) for the given camera Id. * If the given camera Id does not exist, -1 will be returned. */ int getStartTimeOffsetMs(int cameraId) const; private: enum { // Camcorder profiles (high/low) and timelapse profiles (high/low) kNumRequiredProfiles = 4, }; MediaProfiles& operator=(const MediaProfiles&); // Don't call me MediaProfiles(const MediaProfiles&); // Don't call me MediaProfiles() { mVideoEditorCap = NULL; } // Dummy default constructor ~MediaProfiles(); // Don't delete me struct VideoCodec { VideoCodec(video_encoder codec, int bitRate, int frameWidth, int frameHeight, int frameRate) : mCodec(codec), mBitRate(bitRate), mFrameWidth(frameWidth), mFrameHeight(frameHeight), mFrameRate(frameRate) {} VideoCodec(const VideoCodec& copy) { mCodec = copy.mCodec; mBitRate = copy.mBitRate; mFrameWidth = copy.mFrameWidth; mFrameHeight = copy.mFrameHeight; mFrameRate = copy.mFrameRate; } ~VideoCodec() {} video_encoder mCodec; int mBitRate; int mFrameWidth; int mFrameHeight; int mFrameRate; }; struct AudioCodec { AudioCodec(audio_encoder codec, int bitRate, int sampleRate, int channels) : mCodec(codec), mBitRate(bitRate), mSampleRate(sampleRate), mChannels(channels) {} AudioCodec(const AudioCodec& copy) { mCodec = copy.mCodec; mBitRate = copy.mBitRate; mSampleRate = copy.mSampleRate; mChannels = copy.mChannels; } ~AudioCodec() {} audio_encoder mCodec; int mBitRate; int mSampleRate; int mChannels; }; struct CamcorderProfile { CamcorderProfile() : mCameraId(0), mFileFormat(OUTPUT_FORMAT_THREE_GPP), mQuality(CAMCORDER_QUALITY_HIGH), mDuration(0), mVideoCodec(0), mAudioCodec(0) {} CamcorderProfile(const CamcorderProfile& copy) { mCameraId = copy.mCameraId; mFileFormat = copy.mFileFormat; mQuality = copy.mQuality; mDuration = copy.mDuration; mVideoCodec = new VideoCodec(*copy.mVideoCodec); mAudioCodec = new AudioCodec(*copy.mAudioCodec); } ~CamcorderProfile() { delete mVideoCodec; delete mAudioCodec; } int mCameraId; output_format mFileFormat; camcorder_quality mQuality; int mDuration; VideoCodec *mVideoCodec; AudioCodec *mAudioCodec; }; struct VideoEncoderCap { // Ugly constructor VideoEncoderCap(video_encoder codec, int minBitRate, int maxBitRate, int minFrameWidth, int maxFrameWidth, int minFrameHeight, int maxFrameHeight, int minFrameRate, int maxFrameRate) : mCodec(codec), mMinBitRate(minBitRate), mMaxBitRate(maxBitRate), mMinFrameWidth(minFrameWidth), mMaxFrameWidth(maxFrameWidth), mMinFrameHeight(minFrameHeight), mMaxFrameHeight(maxFrameHeight), mMinFrameRate(minFrameRate), mMaxFrameRate(maxFrameRate) {} ~VideoEncoderCap() {} video_encoder mCodec; int mMinBitRate, mMaxBitRate; int mMinFrameWidth, mMaxFrameWidth; int mMinFrameHeight, mMaxFrameHeight; int mMinFrameRate, mMaxFrameRate; }; struct AudioEncoderCap { // Ugly constructor AudioEncoderCap(audio_encoder codec, int minBitRate, int maxBitRate, int minSampleRate, int maxSampleRate, int minChannels, int maxChannels) : mCodec(codec), mMinBitRate(minBitRate), mMaxBitRate(maxBitRate), mMinSampleRate(minSampleRate), mMaxSampleRate(maxSampleRate), mMinChannels(minChannels), mMaxChannels(maxChannels) {} ~AudioEncoderCap() {} audio_encoder mCodec; int mMinBitRate, mMaxBitRate; int mMinSampleRate, mMaxSampleRate; int mMinChannels, mMaxChannels; }; struct VideoDecoderCap { VideoDecoderCap(video_decoder codec): mCodec(codec) {} ~VideoDecoderCap() {} video_decoder mCodec; }; struct AudioDecoderCap { AudioDecoderCap(audio_decoder codec): mCodec(codec) {} ~AudioDecoderCap() {} audio_decoder mCodec; }; struct NameToTagMap { const char* name; int tag; }; struct ImageEncodingQualityLevels { int mCameraId; Vector mLevels; }; struct ExportVideoProfile { ExportVideoProfile(int codec, int profile, int level) :mCodec(codec),mProfile(profile),mLevel(level) {} ~ExportVideoProfile() {} int mCodec; int mProfile; int mLevel; }; struct VideoEditorCap { VideoEditorCap(int inFrameWidth, int inFrameHeight, int outFrameWidth, int outFrameHeight, int frames) : mMaxInputFrameWidth(inFrameWidth), mMaxInputFrameHeight(inFrameHeight), mMaxOutputFrameWidth(outFrameWidth), mMaxOutputFrameHeight(outFrameHeight), mMaxPrefetchYUVFrames(frames) {} ~VideoEditorCap() {} int mMaxInputFrameWidth; int mMaxInputFrameHeight; int mMaxOutputFrameWidth; int mMaxOutputFrameHeight; int mMaxPrefetchYUVFrames; }; int getCamcorderProfileIndex(int cameraId, camcorder_quality quality) const; void initRequiredProfileRefs(const Vector& cameraIds); int getRequiredProfileRefIndex(int cameraId); // Debug static void logVideoCodec(const VideoCodec& codec); static void logAudioCodec(const AudioCodec& codec); static void logVideoEncoderCap(const VideoEncoderCap& cap); static void logAudioEncoderCap(const AudioEncoderCap& cap); static void logVideoDecoderCap(const VideoDecoderCap& cap); static void logAudioDecoderCap(const AudioDecoderCap& cap); static void logVideoEditorCap(const VideoEditorCap& cap); // If the xml configuration file does exist, use the settings // from the xml static MediaProfiles* createInstanceFromXmlFile(const char *xml); static output_format createEncoderOutputFileFormat(const char **atts); static VideoCodec* createVideoCodec(const char **atts, MediaProfiles *profiles); static AudioCodec* createAudioCodec(const char **atts, MediaProfiles *profiles); static AudioDecoderCap* createAudioDecoderCap(const char **atts); static VideoDecoderCap* createVideoDecoderCap(const char **atts); static VideoEncoderCap* createVideoEncoderCap(const char **atts); static AudioEncoderCap* createAudioEncoderCap(const char **atts); static VideoEditorCap* createVideoEditorCap( const char **atts, MediaProfiles *profiles); static ExportVideoProfile* createExportVideoProfile(const char **atts); static CamcorderProfile* createCamcorderProfile( int cameraId, const char **atts, Vector& cameraIds); static int getCameraId(const char **atts); void addStartTimeOffset(int cameraId, const char **atts); ImageEncodingQualityLevels* findImageEncodingQualityLevels(int cameraId) const; void addImageEncodingQualityLevel(int cameraId, const char** atts); // Customized element tag handler for parsing the xml configuration file. static void startElementHandler(void *userData, const char *name, const char **atts); // If the xml configuration file does not exist, use hard-coded values static MediaProfiles* createDefaultInstance(); static CamcorderProfile *createDefaultCamcorderQcifProfile(camcorder_quality quality); static CamcorderProfile *createDefaultCamcorderCifProfile(camcorder_quality quality); static void createDefaultCamcorderLowProfiles( MediaProfiles::CamcorderProfile **lowProfile, MediaProfiles::CamcorderProfile **lowSpecificProfile); static void createDefaultCamcorderHighProfiles( MediaProfiles::CamcorderProfile **highProfile, MediaProfiles::CamcorderProfile **highSpecificProfile); static CamcorderProfile *createDefaultCamcorderTimeLapseQcifProfile(camcorder_quality quality); static CamcorderProfile *createDefaultCamcorderTimeLapse480pProfile(camcorder_quality quality); static void createDefaultCamcorderTimeLapseLowProfiles( MediaProfiles::CamcorderProfile **lowTimeLapseProfile, MediaProfiles::CamcorderProfile **lowSpecificTimeLapseProfile); static void createDefaultCamcorderTimeLapseHighProfiles( MediaProfiles::CamcorderProfile **highTimeLapseProfile, MediaProfiles::CamcorderProfile **highSpecificTimeLapseProfile); static void createDefaultCamcorderProfiles(MediaProfiles *profiles); static void createDefaultVideoEncoders(MediaProfiles *profiles); static void createDefaultAudioEncoders(MediaProfiles *profiles); static void createDefaultVideoDecoders(MediaProfiles *profiles); static void createDefaultAudioDecoders(MediaProfiles *profiles); static void createDefaultEncoderOutputFileFormats(MediaProfiles *profiles); static void createDefaultImageEncodingQualityLevels(MediaProfiles *profiles); static void createDefaultImageDecodingMaxMemory(MediaProfiles *profiles); static void createDefaultVideoEditorCap(MediaProfiles *profiles); static void createDefaultExportVideoProfiles(MediaProfiles *profiles); static VideoEncoderCap* createDefaultH263VideoEncoderCap(); static VideoEncoderCap* createDefaultM4vVideoEncoderCap(); static AudioEncoderCap* createDefaultAmrNBEncoderCap(); #ifdef QCOM_HARDWARE static AudioEncoderCap* createDefaultAacEncoderCap(); static AudioEncoderCap* createDefaultLpcmEncoderCap(); #endif static int findTagForName(const NameToTagMap *map, size_t nMappings, const char *name); /** * Check on existing profiles with the following criteria: * 1. Low quality profile must have the lowest video * resolution product (width x height) * 2. High quality profile must have the highest video * resolution product (width x height) * * and add required low/high quality camcorder/timelapse * profiles if they are not found. This allows to remove * duplicate profile definitions in the media_profiles.xml * file. */ void checkAndAddRequiredProfilesIfNecessary(); // Mappings from name (for instance, codec name) to enum value static const NameToTagMap sVideoEncoderNameMap[]; static const NameToTagMap sAudioEncoderNameMap[]; static const NameToTagMap sFileFormatMap[]; static const NameToTagMap sVideoDecoderNameMap[]; static const NameToTagMap sAudioDecoderNameMap[]; static const NameToTagMap sCamcorderQualityNameMap[]; static bool sIsInitialized; static MediaProfiles *sInstance; static Mutex sLock; int mCurrentCameraId; Vector mCamcorderProfiles; Vector mAudioEncoders; Vector mVideoEncoders; Vector mAudioDecoders; Vector mVideoDecoders; Vector mEncoderOutputFileFormats; Vector mImageEncodingQualityLevels; KeyedVector mStartTimeOffsets; typedef struct { bool mHasRefProfile; // Refers to an existing profile int mRefProfileIndex; // Reference profile index int mResolutionProduct; // width x height } RequiredProfileRefInfo; // Required low and high profiles typedef struct { RequiredProfileRefInfo mRefs[kNumRequiredProfiles]; int mCameraId; } RequiredProfiles; RequiredProfiles *mRequiredProfileRefs; Vector mCameraIds; VideoEditorCap* mVideoEditorCap; Vector mVideoEditorExportProfiles; }; }; // namespace android #endif // ANDROID_MEDIAPROFILES_H android-audiosystem-1.8+13.10.20130807/include/media/ToneGenerator.h0000644000015700001700000003601312200324306025324 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_TONEGENERATOR_H_ #define ANDROID_TONEGENERATOR_H_ #include #include #include #include #include namespace android { class ToneGenerator { public: // List of all available tones // This enum must be kept consistant with constants in ToneGenerator JAVA class enum tone_type { // DTMF tones ITU-T Recommendation Q.23 TONE_DTMF_0 = 0, // 0 key: 1336Hz, 941Hz TONE_DTMF_1, // 1 key: 1209Hz, 697Hz TONE_DTMF_2, // 2 key: 1336Hz, 697Hz TONE_DTMF_3, // 3 key: 1477Hz, 697Hz TONE_DTMF_4, // 4 key: 1209Hz, 770Hz TONE_DTMF_5, // 5 key: 1336Hz, 770Hz TONE_DTMF_6, // 6 key: 1477Hz, 770Hz TONE_DTMF_7, // 7 key: 1209Hz, 852Hz TONE_DTMF_8, // 8 key: 1336Hz, 852Hz TONE_DTMF_9, // 9 key: 1477Hz, 852Hz TONE_DTMF_S, // * key: 1209Hz, 941Hz TONE_DTMF_P, // # key: 1477Hz, 941Hz TONE_DTMF_A, // A key: 1633Hz, 697Hz TONE_DTMF_B, // B key: 1633Hz, 770Hz TONE_DTMF_C, // C key: 1633Hz, 852Hz TONE_DTMF_D, // D key: 1633Hz, 941Hz // Call supervisory tones: 3GPP TS 22.001 (CEPT) TONE_SUP_DIAL, // Dial tone: CEPT: 425Hz, continuous FIRST_SUP_TONE = TONE_SUP_DIAL, TONE_SUP_BUSY, // Busy tone, CEPT: 425Hz, 500ms ON, 500ms OFF... TONE_SUP_CONGESTION, // Congestion tone CEPT, JAPAN: 425Hz, 200ms ON, 200ms OFF... TONE_SUP_RADIO_ACK, // Radio path acknowlegment, CEPT, ANSI: 425Hz, 200ms ON TONE_SUP_RADIO_NOTAVAIL, // Radio path not available: 425Hz, 200ms ON, 200 OFF 3 bursts TONE_SUP_ERROR, // Error/Special info: 950Hz+1400Hz+1800Hz, 330ms ON, 1s OFF... TONE_SUP_CALL_WAITING, // Call Waiting CEPT,JAPAN: 425Hz, 200ms ON, 600ms OFF, 200ms ON, 3s OFF... TONE_SUP_RINGTONE, // Ring Tone CEPT, JAPAN: 425Hz, 1s ON, 4s OFF... LAST_SUP_TONE = TONE_SUP_RINGTONE, // Proprietary tones: 3GPP TS 31.111 TONE_PROP_BEEP, // General beep: 400Hz+1200Hz, 35ms ON TONE_PROP_ACK, // Positive Acknowlgement: 1200Hz, 100ms ON, 100ms OFF 2 bursts TONE_PROP_NACK, // Negative Acknowlgement: 300Hz+400Hz+500Hz, 400ms ON TONE_PROP_PROMPT, // Prompt tone: 400Hz+1200Hz, 200ms ON TONE_PROP_BEEP2, // General double beep: 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms on // Additional call supervisory tones: specified by IS-95 only TONE_SUP_INTERCEPT, // Intercept tone: alternating 440 Hz and 620 Hz tones, each on for 250 ms. TONE_SUP_INTERCEPT_ABBREV, // Abbreviated intercept: intercept tone limited to 4 seconds TONE_SUP_CONGESTION_ABBREV, // Abbreviated congestion: congestion tone limited to 4 seconds TONE_SUP_CONFIRM, // Confirm tone: a 350 Hz tone added to a 440 Hz tone repeated 3 times in a 100 ms on, 100 ms off cycle. TONE_SUP_PIP, // Pip tone: four bursts of 480 Hz tone (0.1 s on, 0.1 s off). // CDMA Tones TONE_CDMA_DIAL_TONE_LITE, TONE_CDMA_NETWORK_USA_RINGBACK, TONE_CDMA_INTERCEPT, TONE_CDMA_ABBR_INTERCEPT, TONE_CDMA_REORDER, TONE_CDMA_ABBR_REORDER, TONE_CDMA_NETWORK_BUSY, TONE_CDMA_CONFIRM, TONE_CDMA_ANSWER, TONE_CDMA_NETWORK_CALLWAITING, TONE_CDMA_PIP, // ISDN TONE_CDMA_CALL_SIGNAL_ISDN_NORMAL, // ISDN Alert Normal TONE_CDMA_CALL_SIGNAL_ISDN_INTERGROUP, // ISDN Intergroup TONE_CDMA_CALL_SIGNAL_ISDN_SP_PRI, // ISDN SP PRI TONE_CDMA_CALL_SIGNAL_ISDN_PAT3, // ISDN Alert PAT3 TONE_CDMA_CALL_SIGNAL_ISDN_PING_RING, // ISDN Alert PING RING TONE_CDMA_CALL_SIGNAL_ISDN_PAT5, // ISDN Alert PAT5 TONE_CDMA_CALL_SIGNAL_ISDN_PAT6, // ISDN Alert PAT6 TONE_CDMA_CALL_SIGNAL_ISDN_PAT7, // ISDN Alert PAT7 // ISDN end // IS54 TONE_CDMA_HIGH_L, // IS54 High Pitch Long TONE_CDMA_MED_L, // IS54 Med Pitch Long TONE_CDMA_LOW_L, // IS54 Low Pitch Long TONE_CDMA_HIGH_SS, // IS54 High Pitch Short Short TONE_CDMA_MED_SS, // IS54 Medium Pitch Short Short TONE_CDMA_LOW_SS, // IS54 Low Pitch Short Short TONE_CDMA_HIGH_SSL, // IS54 High Pitch Short Short Long TONE_CDMA_MED_SSL, // IS54 Medium Pitch Short Short Long TONE_CDMA_LOW_SSL, // IS54 Low Pitch Short Short Long TONE_CDMA_HIGH_SS_2, // IS54 High Pitch Short Short 2 TONE_CDMA_MED_SS_2, // IS54 Med Pitch Short Short 2 TONE_CDMA_LOW_SS_2, // IS54 Low Pitch Short Short 2 TONE_CDMA_HIGH_SLS, // IS54 High Pitch Short Long Short TONE_CDMA_MED_SLS, // IS54 Med Pitch Short Long Short TONE_CDMA_LOW_SLS, // IS54 Low Pitch Short Long Short TONE_CDMA_HIGH_S_X4, // IS54 High Pitch Short Short Short Short TONE_CDMA_MED_S_X4, // IS54 Med Pitch Short Short Short Short TONE_CDMA_LOW_S_X4, // IS54 Low Pitch Short Short Short Short TONE_CDMA_HIGH_PBX_L, // PBX High Pitch Long TONE_CDMA_MED_PBX_L, // PBX Med Pitch Long TONE_CDMA_LOW_PBX_L, // PBX Low Pitch Long TONE_CDMA_HIGH_PBX_SS, // PBX High Short Short TONE_CDMA_MED_PBX_SS, // PBX Med Short Short TONE_CDMA_LOW_PBX_SS, // PBX Low Short Short TONE_CDMA_HIGH_PBX_SSL, // PBX High Short Short Long TONE_CDMA_MED_PBX_SSL, // PBX Med Short Short Long TONE_CDMA_LOW_PBX_SSL, // PBX Low Short Short Long TONE_CDMA_HIGH_PBX_SLS, // PBX High SLS TONE_CDMA_MED_PBX_SLS, // PBX Med SLS TONE_CDMA_LOW_PBX_SLS, // PBX Low SLS TONE_CDMA_HIGH_PBX_S_X4, // PBX High SSSS TONE_CDMA_MED_PBX_S_X4, // PBX Med SSSS TONE_CDMA_LOW_PBX_S_X4, // PBX LOW SSSS //IS54 end // proprietary TONE_CDMA_ALERT_NETWORK_LITE, TONE_CDMA_ALERT_AUTOREDIAL_LITE, TONE_CDMA_ONE_MIN_BEEP, TONE_CDMA_KEYPAD_VOLUME_KEY_LITE, TONE_CDMA_PRESSHOLDKEY_LITE, TONE_CDMA_ALERT_INCALL_LITE, TONE_CDMA_EMERGENCY_RINGBACK, TONE_CDMA_ALERT_CALL_GUARD, TONE_CDMA_SOFT_ERROR_LITE, TONE_CDMA_CALLDROP_LITE, // proprietary end TONE_CDMA_NETWORK_BUSY_ONE_SHOT, TONE_CDMA_ABBR_ALERT, TONE_CDMA_SIGNAL_OFF, //CDMA end NUM_TONES, NUM_SUP_TONES = LAST_SUP_TONE-FIRST_SUP_TONE+1 }; ToneGenerator(audio_stream_type_t streamType, float volume, bool threadCanCallJava = false); ~ToneGenerator(); bool startTone(tone_type toneType, int durationMs = -1); void stopTone(); bool isInited() { return (mState == TONE_IDLE)?false:true;} // returns the audio session this ToneGenerator belongs to or 0 if an error occured. int getSessionId() { return (mpAudioTrack == NULL) ? 0 : mpAudioTrack->getSessionId(); } private: enum tone_state { TONE_IDLE, // ToneGenerator is being initialized or initialization failed TONE_INIT, // ToneGenerator has been successfully initialized and is not playing TONE_STARTING, // ToneGenerator is starting playing TONE_PLAYING, // ToneGenerator is playing TONE_STOPPING, // ToneGenerator is stoping TONE_STOPPED, // ToneGenerator is stopped: the AudioTrack will be stopped TONE_RESTARTING // A start request was received in active state (playing or stopping) }; // Region specific tones. // These supervisory tones are different depending on the region (USA/CANADA, JAPAN, rest of the world). // When a tone in the range [FIRST_SUP_TONE, LAST_SUP_TONE] is requested, the region is determined // from system property gsm.operator.iso-country and the proper tone descriptor is selected with the // help of sToneMappingTable[] enum regional_tone_type { // ANSI supervisory tones TONE_ANSI_DIAL = NUM_TONES, // Dial tone: a continuous 350 Hz + 440 Hz tone. TONE_ANSI_BUSY, // Busy tone on: a 480 Hz + 620 Hz tone repeated in a 500 ms on, 500 ms off cycle. TONE_ANSI_CONGESTION, // Network congestion (reorder) tone on: a 480 Hz + 620 Hz tone repeated in a 250 ms on, 250 ms off cycle. TONE_ANSI_CALL_WAITING, // Call waiting tone on: 440 Hz, on for 300 ms, 9,7 s off followed by // (440 Hz, on for 100 ms off for 100 ms, on for 100 ms, 9,7s off and repeated as necessary). TONE_ANSI_RINGTONE, // Ring Tone: a 440 Hz + 480 Hz tone repeated in a 2 s on, 4 s off pattern. // JAPAN Supervisory tones TONE_JAPAN_DIAL, // Dial tone: 400Hz, continuous TONE_JAPAN_BUSY, // Busy tone: 400Hz, 500ms ON, 500ms OFF... TONE_JAPAN_RADIO_ACK, // Radio path acknowlegment: 400Hz, 1s ON, 2s OFF... NUM_ALTERNATE_TONES }; enum region { ANSI, JAPAN, CEPT, NUM_REGIONS }; static const unsigned char sToneMappingTable[NUM_REGIONS-1][NUM_SUP_TONES]; static const unsigned int TONEGEN_MAX_WAVES = 3; // Maximun number of sine waves in a tone segment static const unsigned int TONEGEN_MAX_SEGMENTS = 12; // Maximun number of segments in a tone descriptor static const unsigned int TONEGEN_INF = 0xFFFFFFFF; // Represents infinite time duration static const float TONEGEN_GAIN = 0.9; // Default gain passed to WaveGenerator(). // ToneDescriptor class contains all parameters needed to generate a tone: // - The array waveFreq[]: // 1 for static tone descriptors: contains the frequencies of all individual waves making the multi-tone. // 2 for active tone descritors: contains the indexes of the WaveGenerator objects in mWaveGens // The number of sine waves varies from 1 to TONEGEN_MAX_WAVES. // The first null value indicates that no more waves are needed. // - The array segments[] is used to generate the tone pulses. A segment is a period of time // during which the tone is ON or OFF. Segments with even index (starting from 0) // correspond to tone ON state and segments with odd index to OFF state. // The data stored in segments[] is the duration of the corresponding period in ms. // The first segment encountered with a 0 duration indicates that no more segment follows. // - loopCnt - Number of times to repeat a sequence of seqments after playing this // - loopIndx - The segment index to go back and play is loopcnt > 0 // - repeatCnt indicates the number of times the sequence described by segments[] array must be repeated. // When the tone generator encounters the first 0 duration segment, it will compare repeatCnt to mCurCount. // If mCurCount > repeatCnt, the tone is stopped automatically. Otherwise, tone sequence will be // restarted from segment repeatSegment. // - repeatSegment number of the first repeated segment when repeatCnt is not null class ToneSegment { public: unsigned int duration; unsigned short waveFreq[TONEGEN_MAX_WAVES+1]; unsigned short loopCnt; unsigned short loopIndx; }; class ToneDescriptor { public: ToneSegment segments[TONEGEN_MAX_SEGMENTS+1]; unsigned long repeatCnt; unsigned long repeatSegment; }; static const ToneDescriptor sToneDescriptors[]; bool mThreadCanCallJava; unsigned int mTotalSmp; // Total number of audio samples played (gives current time) unsigned int mNextSegSmp; // Position of next segment transition expressed in samples // NOTE: because mTotalSmp, mNextSegSmp are stored on 32 bit, current design will operate properly // only if tone duration is less than about 27 Hours(@44100Hz sampling rate). If this time is exceeded, // no crash will occur but tone sequence will show a glitch. unsigned int mMaxSmp; // Maximum number of audio samples played (maximun tone duration) int mDurationMs; // Maximum tone duration in ms unsigned short mCurSegment; // Current segment index in ToneDescriptor segments[] unsigned short mCurCount; // Current sequence repeat count volatile unsigned short mState; // ToneGenerator state (tone_state) unsigned short mRegion; const ToneDescriptor *mpToneDesc; // pointer to active tone descriptor const ToneDescriptor *mpNewToneDesc; // pointer to next active tone descriptor unsigned short mLoopCounter; // Current tone loopback count int mSamplingRate; // AudioFlinger Sampling rate AudioTrack *mpAudioTrack; // Pointer to audio track used for playback Mutex mLock; // Mutex to control concurent access to ToneGenerator object from audio callback and application API Mutex mCbkCondLock; // Mutex associated to mWaitCbkCond Condition mWaitCbkCond; // condition enabling interface to wait for audio callback completion after a change is requested float mVolume; // Volume applied to audio track audio_stream_type_t mStreamType; // Audio stream used for output unsigned int mProcessSize; // Size of audio blocks generated at a time by audioCallback() (in PCM frames). bool initAudioTrack(); static void audioCallback(int event, void* user, void *info); bool prepareWave(); unsigned int numWaves(unsigned int segmentIdx); void clearWaveGens(); tone_type getToneForRegion(tone_type toneType); // WaveGenerator generates a single sine wave class WaveGenerator { public: enum gen_command { WAVEGEN_START, // Start/restart wave from phase 0 WAVEGEN_CONT, // Continue wave from current phase WAVEGEN_STOP // Stop wave on zero crossing }; WaveGenerator(unsigned short samplingRate, unsigned short frequency, float volume); ~WaveGenerator(); void getSamples(short *outBuffer, unsigned int count, unsigned int command); private: static const short GEN_AMP = 32000; // amplitude of generator static const short S_Q14 = 14; // shift for Q14 static const short S_Q15 = 15; // shift for Q15 short mA1_Q14; // Q14 coefficient // delay line of full amplitude generator short mS1, mS2; // delay line S2 oldest short mS2_0; // saved value for reinitialisation short mAmplitude_Q15; // Q15 amplitude }; KeyedVector mWaveGens; // list of active wave generators. }; } ; // namespace android #endif /*ANDROID_TONEGENERATOR_H_*/ android-audiosystem-1.8+13.10.20130807/include/media/IAudioTrack.h0000644000015700001700000000722412200324306024711 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_IAUDIOTRACK_H #define ANDROID_IAUDIOTRACK_H #include #include #include #include #include #include #include namespace android { // ---------------------------------------------------------------------------- class IAudioTrack : public IInterface { public: DECLARE_META_INTERFACE(AudioTrack); /* Get this track's control block */ virtual sp getCblk() const = 0; /* After it's created the track is not active. Call start() to * make it active. */ virtual status_t start() = 0; /* Stop a track. If set, the callback will cease being called and * obtainBuffer will return an error. Buffers that are already released * will continue to be processed, unless/until flush() is called. */ virtual void stop() = 0; /* Flush a stopped or paused track. All pending/released buffers are discarded. * This function has no effect if the track is not stopped or paused. */ virtual void flush() = 0; /* Mute or unmute this track. * While muted, the callback, if set, is still called. */ virtual void mute(bool) = 0; /* Pause a track. If set, the callback will cease being called and * obtainBuffer will return an error. Buffers that are already released * will continue to be processed, unless/until flush() is called. */ virtual void pause() = 0; /* Attach track auxiliary output to specified effect. Use effectId = 0 * to detach track from effect. */ virtual status_t attachAuxEffect(int effectId) = 0; /* Allocate a shared memory buffer suitable for holding timed audio samples */ virtual status_t allocateTimedBuffer(size_t size, sp* buffer) = 0; /* Queue a buffer obtained via allocateTimedBuffer for playback at the given timestamp */ virtual status_t queueTimedBuffer(const sp& buffer, int64_t pts) = 0; /* Define the linear transform that will be applied to the timestamps given to queueTimedBuffer (which are expressed in media time). Target specifies whether this transform converts media time to local time or Tungsten time. The values for target are defined in AudioTrack.h */ virtual status_t setMediaTimeTransform(const LinearTransform& xform, int target) = 0; }; // ---------------------------------------------------------------------------- class BnAudioTrack : public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; // ---------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_IAUDIOTRACK_H android-audiosystem-1.8+13.10.20130807/include/media/IMediaRecorderClient.h0000644000015700001700000000261512200324306026526 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_IMEDIARECORDERCLIENT_H #define ANDROID_IMEDIARECORDERCLIENT_H #include #include #include namespace android { class IMediaRecorderClient: public IInterface { public: DECLARE_META_INTERFACE(MediaRecorderClient); virtual void notify(int msg, int ext1, int ext2) = 0; }; // ---------------------------------------------------------------------------- class BnMediaRecorderClient: public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; }; // namespace android #endif // ANDROID_IMEDIARECORDERCLIENT_H android-audiosystem-1.8+13.10.20130807/include/media/MediaPlayerInterface.h0000644000015700001700000002112512200324306026563 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_MEDIAPLAYERINTERFACE_H #define ANDROID_MEDIAPLAYERINTERFACE_H #ifdef __cplusplus #include #include #include #include #include #include #include #include // Fwd decl to make sure everyone agrees that the scope of struct sockaddr_in is // global, and not in android:: struct sockaddr_in; namespace android { class Parcel; class Surface; class ISurfaceTexture; template class SortedVector; enum player_type { PV_PLAYER = 1, SONIVOX_PLAYER = 2, STAGEFRIGHT_PLAYER = 3, NU_PLAYER = 4, // Test players are available only in the 'test' and 'eng' builds. // The shared library with the test player is passed passed as an // argument to the 'test:' url in the setDataSource call. TEST_PLAYER = 5, }; #define DEFAULT_AUDIOSINK_BUFFERCOUNT 4 #define DEFAULT_AUDIOSINK_BUFFERSIZE 1200 #define DEFAULT_AUDIOSINK_SAMPLERATE 44100 // when the channel mask isn't known, use the channel count to derive a mask in AudioSink::open() #define CHANNEL_MASK_USE_CHANNEL_ORDER 0 // duration below which we do not allow deep audio buffering #define AUDIO_SINK_MIN_DEEP_BUFFER_DURATION_US 5000000 // callback mechanism for passing messages to MediaPlayer object typedef void (*notify_callback_f)(void* cookie, int msg, int ext1, int ext2, const Parcel *obj); // abstract base class - use MediaPlayerInterface class MediaPlayerBase : public RefBase { public: // AudioSink: abstraction layer for audio output class AudioSink : public RefBase { public: // Callback returns the number of bytes actually written to the buffer. typedef size_t (*AudioCallback)( AudioSink *audioSink, void *buffer, size_t size, void *cookie); virtual ~AudioSink() {} virtual bool ready() const = 0; // audio output is open and ready virtual bool realtime() const = 0; // audio output is real-time output virtual ssize_t bufferSize() const = 0; virtual ssize_t frameCount() const = 0; virtual ssize_t channelCount() const = 0; virtual ssize_t frameSize() const = 0; virtual uint32_t latency() const = 0; virtual float msecsPerFrame() const = 0; virtual status_t getPosition(uint32_t *position) const = 0; virtual status_t getFramesWritten(uint32_t *frameswritten) const = 0; virtual int getSessionId() const = 0; // If no callback is specified, use the "write" API below to submit // audio data. virtual status_t open( uint32_t sampleRate, int channelCount, audio_channel_mask_t channelMask, audio_format_t format=AUDIO_FORMAT_PCM_16_BIT, int bufferCount=DEFAULT_AUDIOSINK_BUFFERCOUNT, AudioCallback cb = NULL, void *cookie = NULL, audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE) = 0; virtual void start() = 0; virtual ssize_t write(const void* buffer, size_t size) = 0; virtual void stop() = 0; virtual void flush() = 0; virtual void pause() = 0; virtual void close() = 0; virtual status_t setPlaybackRatePermille(int32_t rate) { return INVALID_OPERATION; } virtual bool needsTrailingPadding() { return true; } #ifdef QCOM_HARDWARE virtual ssize_t sampleRate() const {return 0;}; virtual status_t getTimeStamp(uint64_t *tstamp) {return 0;}; #endif }; MediaPlayerBase() : mCookie(0), mNotify(0) {} virtual ~MediaPlayerBase() {} virtual status_t initCheck() = 0; virtual bool hardwareOutput() = 0; virtual status_t setUID(uid_t uid) { return INVALID_OPERATION; } virtual status_t setDataSource( const char *url, const KeyedVector *headers = NULL) = 0; virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0; virtual status_t setDataSource(const sp &source) { return INVALID_OPERATION; } // pass the buffered ISurfaceTexture to the media player service virtual status_t setVideoSurfaceTexture( const sp& surfaceTexture) = 0; virtual status_t prepare() = 0; virtual status_t prepareAsync() = 0; virtual status_t start() = 0; virtual status_t stop() = 0; virtual status_t pause() = 0; virtual bool isPlaying() = 0; virtual status_t seekTo(int msec) = 0; virtual status_t getCurrentPosition(int *msec) = 0; virtual status_t getDuration(int *msec) = 0; virtual status_t reset() = 0; virtual status_t setLooping(int loop) = 0; virtual player_type playerType() = 0; virtual status_t setParameter(int key, const Parcel &request) = 0; virtual status_t getParameter(int key, Parcel *reply) = 0; // default no-op implementation of optional extensions virtual status_t setRetransmitEndpoint(const struct sockaddr_in* endpoint) { return INVALID_OPERATION; } virtual status_t getRetransmitEndpoint(struct sockaddr_in* endpoint) { return INVALID_OPERATION; } virtual status_t setNextPlayer(const sp& next) { return OK; } // Invoke a generic method on the player by using opaque parcels // for the request and reply. // // @param request Parcel that is positioned at the start of the // data sent by the java layer. // @param[out] reply Parcel to hold the reply data. Cannot be null. // @return OK if the call was successful. virtual status_t invoke(const Parcel& request, Parcel *reply) = 0; // The Client in the MetadataPlayerService calls this method on // the native player to retrieve all or a subset of metadata. // // @param ids SortedList of metadata ID to be fetch. If empty, all // the known metadata should be returned. // @param[inout] records Parcel where the player appends its metadata. // @return OK if the call was successful. virtual status_t getMetadata(const media::Metadata::Filter& ids, Parcel *records) { return INVALID_OPERATION; }; void setNotifyCallback( void* cookie, notify_callback_f notifyFunc) { Mutex::Autolock autoLock(mNotifyLock); mCookie = cookie; mNotify = notifyFunc; } void sendEvent(int msg, int ext1=0, int ext2=0, const Parcel *obj=NULL) { Mutex::Autolock autoLock(mNotifyLock); if (mNotify) mNotify(mCookie, msg, ext1, ext2, obj); } virtual status_t dump(int fd, const Vector &args) const { return INVALID_OPERATION; } private: friend class MediaPlayerService; Mutex mNotifyLock; void* mCookie; notify_callback_f mNotify; }; // Implement this class for media players that use the AudioFlinger software mixer class MediaPlayerInterface : public MediaPlayerBase { public: virtual ~MediaPlayerInterface() { } virtual bool hardwareOutput() { return false; } virtual void setAudioSink(const sp& audioSink) { mAudioSink = audioSink; } protected: sp mAudioSink; }; // Implement this class for media players that output audio directly to hardware class MediaPlayerHWInterface : public MediaPlayerBase { public: virtual ~MediaPlayerHWInterface() {} virtual bool hardwareOutput() { return true; } virtual status_t setVolume(float leftVolume, float rightVolume) = 0; virtual status_t setAudioStreamType(audio_stream_type_t streamType) = 0; }; }; // namespace android #endif // __cplusplus #endif // ANDROID_MEDIAPLAYERINTERFACE_H android-audiosystem-1.8+13.10.20130807/include/media/IMediaPlayerClient.h0000644000015700001700000000262212200324306026213 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_IMEDIAPLAYERCLIENT_H #define ANDROID_IMEDIAPLAYERCLIENT_H #include #include #include namespace android { class IMediaPlayerClient: public IInterface { public: DECLARE_META_INTERFACE(MediaPlayerClient); virtual void notify(int msg, int ext1, int ext2, const Parcel *obj) = 0; }; // ---------------------------------------------------------------------------- class BnMediaPlayerClient: public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; }; // namespace android #endif // ANDROID_IMEDIAPLAYERCLIENT_H android-audiosystem-1.8+13.10.20130807/include/media/mediaplayer.h0000644000015700001700000002501112200324306025040 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_MEDIAPLAYER_H #define ANDROID_MEDIAPLAYER_H #include #include #include #include #include #include #include #include class ANativeWindow; namespace android { class Surface; class ISurfaceTexture; enum media_event_type { MEDIA_NOP = 0, // interface test message MEDIA_PREPARED = 1, MEDIA_PLAYBACK_COMPLETE = 2, MEDIA_BUFFERING_UPDATE = 3, MEDIA_SEEK_COMPLETE = 4, MEDIA_SET_VIDEO_SIZE = 5, MEDIA_TIMED_TEXT = 99, MEDIA_ERROR = 100, MEDIA_INFO = 200, }; // Generic error codes for the media player framework. Errors are fatal, the // playback must abort. // // Errors are communicated back to the client using the // MediaPlayerListener::notify method defined below. // In this situation, 'notify' is invoked with the following: // 'msg' is set to MEDIA_ERROR. // 'ext1' should be a value from the enum media_error_type. // 'ext2' contains an implementation dependant error code to provide // more details. Should default to 0 when not used. // // The codes are distributed as follow: // 0xx: Reserved // 1xx: Android Player errors. Something went wrong inside the MediaPlayer. // 2xx: Media errors (e.g Codec not supported). There is a problem with the // media itself. // 3xx: Runtime errors. Some extraordinary condition arose making the playback // impossible. // enum media_error_type { // 0xx MEDIA_ERROR_UNKNOWN = 1, // 1xx MEDIA_ERROR_SERVER_DIED = 100, // 2xx MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK = 200, // 3xx }; // Info and warning codes for the media player framework. These are non fatal, // the playback is going on but there might be some user visible issues. // // Info and warning messages are communicated back to the client using the // MediaPlayerListener::notify method defined below. In this situation, // 'notify' is invoked with the following: // 'msg' is set to MEDIA_INFO. // 'ext1' should be a value from the enum media_info_type. // 'ext2' contains an implementation dependant info code to provide // more details. Should default to 0 when not used. // // The codes are distributed as follow: // 0xx: Reserved // 7xx: Android Player info/warning (e.g player lagging behind.) // 8xx: Media info/warning (e.g media badly interleaved.) // enum media_info_type { // 0xx MEDIA_INFO_UNKNOWN = 1, // The player was started because it was used as the next player for another // player, which just completed playback MEDIA_INFO_STARTED_AS_NEXT = 2, // The player just pushed the very first video frame for rendering MEDIA_INFO_RENDERING_START = 3, // 7xx // The video is too complex for the decoder: it can't decode frames fast // enough. Possibly only the audio plays fine at this stage. MEDIA_INFO_VIDEO_TRACK_LAGGING = 700, // MediaPlayer is temporarily pausing playback internally in order to // buffer more data. MEDIA_INFO_BUFFERING_START = 701, // MediaPlayer is resuming playback after filling buffers. MEDIA_INFO_BUFFERING_END = 702, // Bandwidth in recent past MEDIA_INFO_NETWORK_BANDWIDTH = 703, // 8xx // Bad interleaving means that a media has been improperly interleaved or not // interleaved at all, e.g has all the video samples first then all the audio // ones. Video is playing but a lot of disk seek may be happening. MEDIA_INFO_BAD_INTERLEAVING = 800, // The media is not seekable (e.g live stream). MEDIA_INFO_NOT_SEEKABLE = 801, // New media metadata is available. MEDIA_INFO_METADATA_UPDATE = 802, //9xx MEDIA_INFO_TIMED_TEXT_ERROR = 900, }; enum media_player_states { MEDIA_PLAYER_STATE_ERROR = 0, MEDIA_PLAYER_IDLE = 1 << 0, MEDIA_PLAYER_INITIALIZED = 1 << 1, MEDIA_PLAYER_PREPARING = 1 << 2, MEDIA_PLAYER_PREPARED = 1 << 3, MEDIA_PLAYER_STARTED = 1 << 4, MEDIA_PLAYER_PAUSED = 1 << 5, MEDIA_PLAYER_STOPPED = 1 << 6, MEDIA_PLAYER_PLAYBACK_COMPLETE = 1 << 7 }; // Keep KEY_PARAMETER_* in sync with MediaPlayer.java. // The same enum space is used for both set and get, in case there are future keys that // can be both set and get. But as of now, all parameters are either set only or get only. enum media_parameter_keys { // Streaming/buffering parameters KEY_PARAMETER_CACHE_STAT_COLLECT_FREQ_MS = 1100, // set only // Return a Parcel containing a single int, which is the channel count of the // audio track, or zero for error (e.g. no audio track) or unknown. KEY_PARAMETER_AUDIO_CHANNEL_COUNT = 1200, // get only // Playback rate expressed in permille (1000 is normal speed), saved as int32_t, with negative // values used for rewinding or reverse playback. KEY_PARAMETER_PLAYBACK_RATE_PERMILLE = 1300, // set only }; // Keep INVOKE_ID_* in sync with MediaPlayer.java. enum media_player_invoke_ids { INVOKE_ID_GET_TRACK_INFO = 1, INVOKE_ID_ADD_EXTERNAL_SOURCE = 2, INVOKE_ID_ADD_EXTERNAL_SOURCE_FD = 3, INVOKE_ID_SELECT_TRACK = 4, INVOKE_ID_UNSELECT_TRACK = 5, INVOKE_ID_SET_VIDEO_SCALING_MODE = 6, }; // Keep MEDIA_TRACK_TYPE_* in sync with MediaPlayer.java. enum media_track_type { MEDIA_TRACK_TYPE_UNKNOWN = 0, MEDIA_TRACK_TYPE_VIDEO = 1, MEDIA_TRACK_TYPE_AUDIO = 2, MEDIA_TRACK_TYPE_TIMEDTEXT = 3, }; // ---------------------------------------------------------------------------- // ref-counted object for callbacks class MediaPlayerListener: virtual public RefBase { public: virtual void notify(int msg, int ext1, int ext2, const Parcel *obj) = 0; }; class MediaPlayer : public BnMediaPlayerClient, public virtual IMediaDeathNotifier { public: MediaPlayer(); ~MediaPlayer(); void died(); void disconnect(); status_t setDataSource( const char *url, const KeyedVector *headers); status_t setDataSource(int fd, int64_t offset, int64_t length); status_t setDataSource(const sp &source); status_t setVideoSurfaceTexture( const sp& surfaceTexture); status_t setListener(const sp& listener); status_t prepare(); status_t prepareAsync(); status_t start(); status_t stop(); status_t pause(); bool isPlaying(); status_t getVideoWidth(int *w); status_t getVideoHeight(int *h); status_t seekTo(int msec); status_t getCurrentPosition(int *msec); status_t getDuration(int *msec); status_t reset(); status_t setAudioStreamType(audio_stream_type_t type); status_t setLooping(int loop); bool isLooping(); status_t setVolume(float leftVolume, float rightVolume); void notify(int msg, int ext1, int ext2, const Parcel *obj = NULL); static sp decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat); static sp decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat); status_t invoke(const Parcel& request, Parcel *reply); status_t setMetadataFilter(const Parcel& filter); status_t getMetadata(bool update_only, bool apply_filter, Parcel *metadata); status_t setAudioSessionId(int sessionId); int getAudioSessionId(); status_t setAuxEffectSendLevel(float level); status_t attachAuxEffect(int effectId); status_t setParameter(int key, const Parcel& request); status_t getParameter(int key, Parcel* reply); status_t setRetransmitEndpoint(const char* addrString, uint16_t port); status_t setNextMediaPlayer(const sp& player); private: void clear_l(); status_t seekTo_l(int msec); status_t prepareAsync_l(); status_t getDuration_l(int *msec); status_t attachNewPlayer(const sp& player); status_t reset_l(); status_t doSetRetransmitEndpoint(const sp& player); sp mPlayer; thread_id_t mLockThreadId; Mutex mLock; Mutex mNotifyLock; Condition mSignal; sp mListener; void* mCookie; media_player_states mCurrentState; int mDuration; int mCurrentPosition; int mSeekPosition; bool mPrepareSync; status_t mPrepareStatus; audio_stream_type_t mStreamType; bool mLoop; float mLeftVolume; float mRightVolume; int mVideoWidth; int mVideoHeight; int mAudioSessionId; float mSendLevel; struct sockaddr_in mRetransmitEndpoint; bool mRetransmitEndpointValid; }; }; // namespace android #endif // ANDROID_MEDIAPLAYER_H android-audiosystem-1.8+13.10.20130807/include/media/IAudioFlinger.h0000644000015700001700000002361712200324306025237 0ustar pbuserpbgroup00000000000000/* * Copyright (c) 2012, The Linux Foundation. All rights reserved. * Not a Contribution, Apache license notifications and license are retained * for attribution purposes only. * * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_IAUDIOFLINGER_H #define ANDROID_IAUDIOFLINGER_H #include #include #include #include #include #include #ifdef QCOM_HARDWARE #include #include #endif #include #include #include #include #include #include #include #include #include #include namespace android { // ---------------------------------------------------------------------------- class IAudioFlinger : public IInterface { public: DECLARE_META_INTERFACE(AudioFlinger); // or-able bits shared by createTrack and openRecord, but not all combinations make sense enum { TRACK_DEFAULT = 0, // client requests a default AudioTrack TRACK_TIMED = 1, // client requests a TimedAudioTrack TRACK_FAST = 2, // client requests a fast AudioTrack or AudioRecord }; typedef uint32_t track_flags_t; /* create an audio track and registers it with AudioFlinger. * return null if the track cannot be created. */ virtual sp createTrack( pid_t pid, audio_stream_type_t streamType, uint32_t sampleRate, audio_format_t format, audio_channel_mask_t channelMask, int frameCount, track_flags_t flags, const sp& sharedBuffer, audio_io_handle_t output, pid_t tid, // -1 means unused, otherwise must be valid non-0 int *sessionId, status_t *status) = 0; #ifdef QCOM_HARDWARE /* create a direct audio track and registers it with AudioFlinger. * return null if the track cannot be created. */ virtual sp createDirectTrack( pid_t pid, uint32_t sampleRate, audio_channel_mask_t channelMask, audio_io_handle_t output, int *sessionId, IDirectTrackClient* client, audio_stream_type_t streamType, status_t *status) = 0; #endif virtual sp openRecord( pid_t pid, audio_io_handle_t input, uint32_t sampleRate, audio_format_t format, audio_channel_mask_t channelMask, int frameCount, track_flags_t flags, pid_t tid, // -1 means unused, otherwise must be valid non-0 int *sessionId, status_t *status) = 0; /* query the audio hardware state. This state never changes, * and therefore can be cached. */ virtual uint32_t sampleRate(audio_io_handle_t output) const = 0; #if 0 virtual int channelCount(audio_io_handle_t output) const = 0; #endif virtual audio_format_t format(audio_io_handle_t output) const = 0; virtual size_t frameCount(audio_io_handle_t output) const = 0; // return estimated latency in milliseconds virtual uint32_t latency(audio_io_handle_t output) const = 0; /* set/get the audio hardware state. This will probably be used by * the preference panel, mostly. */ virtual status_t setMasterVolume(float value) = 0; virtual status_t setMasterMute(bool muted) = 0; virtual float masterVolume() const = 0; virtual bool masterMute() const = 0; /* set/get stream type state. This will probably be used by * the preference panel, mostly. */ virtual status_t setStreamVolume(audio_stream_type_t stream, float value, audio_io_handle_t output) = 0; virtual status_t setStreamMute(audio_stream_type_t stream, bool muted) = 0; virtual float streamVolume(audio_stream_type_t stream, audio_io_handle_t output) const = 0; virtual bool streamMute(audio_stream_type_t stream) const = 0; // set audio mode virtual status_t setMode(audio_mode_t mode) = 0; // mic mute/state virtual status_t setMicMute(bool state) = 0; virtual bool getMicMute() const = 0; virtual status_t setParameters(audio_io_handle_t ioHandle, const String8& keyValuePairs) = 0; virtual String8 getParameters(audio_io_handle_t ioHandle, const String8& keys) const = 0; // register a current process for audio output change notifications virtual void registerClient(const sp& client) = 0; // retrieve the audio recording buffer size virtual size_t getInputBufferSize(uint32_t sampleRate, audio_format_t format, audio_channel_mask_t channelMask) const = 0; virtual audio_io_handle_t openOutput(audio_module_handle_t module, audio_devices_t *pDevices, uint32_t *pSamplingRate, audio_format_t *pFormat, audio_channel_mask_t *pChannelMask, uint32_t *pLatencyMs, audio_output_flags_t flags) = 0; virtual audio_io_handle_t openDuplicateOutput(audio_io_handle_t output1, audio_io_handle_t output2) = 0; virtual status_t closeOutput(audio_io_handle_t output) = 0; virtual status_t suspendOutput(audio_io_handle_t output) = 0; virtual status_t restoreOutput(audio_io_handle_t output) = 0; virtual audio_io_handle_t openInput(audio_module_handle_t module, audio_devices_t *pDevices, uint32_t *pSamplingRate, audio_format_t *pFormat, audio_channel_mask_t *pChannelMask) = 0; virtual status_t closeInput(audio_io_handle_t input) = 0; virtual status_t setStreamOutput(audio_stream_type_t stream, audio_io_handle_t output) = 0; virtual status_t setVoiceVolume(float volume) = 0; virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, audio_io_handle_t output) const = 0; virtual unsigned int getInputFramesLost(audio_io_handle_t ioHandle) const = 0; virtual int newAudioSessionId() = 0; virtual void acquireAudioSessionId(int audioSession) = 0; virtual void releaseAudioSessionId(int audioSession) = 0; virtual status_t queryNumberEffects(uint32_t *numEffects) const = 0; virtual status_t queryEffect(uint32_t index, effect_descriptor_t *pDescriptor) const = 0; virtual status_t getEffectDescriptor(const effect_uuid_t *pEffectUUID, effect_descriptor_t *pDescriptor) const = 0; virtual sp createEffect(pid_t pid, effect_descriptor_t *pDesc, const sp& client, int32_t priority, audio_io_handle_t output, int sessionId, status_t *status, int *id, int *enabled) = 0; virtual status_t moveEffects(int session, audio_io_handle_t srcOutput, audio_io_handle_t dstOutput) = 0; virtual audio_module_handle_t loadHwModule(const char *name) = 0; // helpers for android.media.AudioManager.getProperty(), see description there for meaning // FIXME move these APIs to AudioPolicy to permit a more accurate implementation // that looks on primary device for a stream with fast flag, primary flag, or first one. virtual int32_t getPrimaryOutputSamplingRate() = 0; virtual int32_t getPrimaryOutputFrameCount() = 0; }; // ---------------------------------------------------------------------------- class BnAudioFlinger : public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; // ---------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_IAUDIOFLINGER_H android-audiosystem-1.8+13.10.20130807/include/media/AudioEffect.h0000644000015700001700000004550112200324306024730 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIOEFFECT_H #define ANDROID_AUDIOEFFECT_H #include #include #include #include #include #include #include #include #include #include #include namespace android { // ---------------------------------------------------------------------------- class effect_param_cblk_t; // ---------------------------------------------------------------------------- class AudioEffect : public RefBase { public: /* * Static methods for effects enumeration. */ /* * Returns the number of effects available. This method together * with queryEffect() is used to enumerate all effects: * The enumeration sequence is: * queryNumberEffects(&num_effects); * for (i = 0; i < num_effects; i++) * queryEffect(i,...); * * Parameters: * numEffects: address where the number of effects should be returned. * * Returned status (from utils/Errors.h) can be: * NO_ERROR successful operation. * PERMISSION_DENIED could not get AudioFlinger interface * NO_INIT effect library failed to initialize * BAD_VALUE invalid numEffects pointer * * Returned value * *numEffects: updated with number of effects available */ static status_t queryNumberEffects(uint32_t *numEffects); /* * Returns an effect descriptor during effect * enumeration. * * Parameters: * index: index of the queried effect. * descriptor: address where the effect descriptor should be returned. * * Returned status (from utils/Errors.h) can be: * NO_ERROR successful operation. * PERMISSION_DENIED could not get AudioFlinger interface * NO_INIT effect library failed to initialize * BAD_VALUE invalid descriptor pointer or index * INVALID_OPERATION effect list has changed since last execution of queryNumberEffects() * * Returned value * *descriptor: updated with effect descriptor */ static status_t queryEffect(uint32_t index, effect_descriptor_t *descriptor); /* * Returns the descriptor for the specified effect uuid. * * Parameters: * uuid: pointer to effect uuid. * descriptor: address where the effect descriptor should be returned. * * Returned status (from utils/Errors.h) can be: * NO_ERROR successful operation. * PERMISSION_DENIED could not get AudioFlinger interface * NO_INIT effect library failed to initialize * BAD_VALUE invalid uuid or descriptor pointers * NAME_NOT_FOUND no effect with this uuid found * * Returned value * *descriptor updated with effect descriptor */ static status_t getEffectDescriptor(const effect_uuid_t *uuid, effect_descriptor_t *descriptor) /*const*/; /* * Returns a list of descriptors corresponding to the pre processings enabled by default * on an AudioRecord with the supplied audio session ID. * * Parameters: * audioSession: audio session ID. * descriptors: address where the effect descriptors should be returned. * count: as input, the maximum number of descriptor than should be returned * as output, the number of descriptor returned if status is NO_ERROR or the actual * number of enabled pre processings if status is NO_MEMORY * * Returned status (from utils/Errors.h) can be: * NO_ERROR successful operation. * NO_MEMORY the number of descriptor to return is more than the maximum number * indicated by count. * PERMISSION_DENIED could not get AudioFlinger interface * NO_INIT effect library failed to initialize * BAD_VALUE invalid audio session or descriptor pointers * * Returned value * *descriptor updated with descriptors of pre processings enabled by default * *count number of descriptors returned if returned status is N_ERROR. * total number of pre processing enabled by default if returned status is * NO_MEMORY. This happens if the count passed as input is less than the number * of descriptors to return */ static status_t queryDefaultPreProcessing(int audioSession, effect_descriptor_t *descriptors, uint32_t *count); /* * Events used by callback function (effect_callback_t). */ enum event_type { EVENT_CONTROL_STATUS_CHANGED = 0, EVENT_ENABLE_STATUS_CHANGED = 1, EVENT_PARAMETER_CHANGED = 2, EVENT_ERROR = 3 }; /* Callback function notifying client application of a change in effect engine state or * configuration. * An effect engine can be shared by several applications but only one has the control * of the engine activity and configuration at a time. * The EVENT_CONTROL_STATUS_CHANGED event is received when an application loses or * retrieves the control of the effect engine. Loss of control happens * if another application requests the use of the engine by creating an AudioEffect for * the same effect type but with a higher priority. Control is returned when the * application having the control deletes its AudioEffect object. * The EVENT_ENABLE_STATUS_CHANGED event is received by all applications not having the * control of the effect engine when the effect is enabled or disabled. * The EVENT_PARAMETER_CHANGED event is received by all applications not having the * control of the effect engine when an effect parameter is changed. * The EVENT_ERROR event is received when the media server process dies. * * Parameters: * * event: type of event notified (see enum AudioEffect::event_type). * user: Pointer to context for use by the callback receiver. * info: Pointer to optional parameter according to event type: * - EVENT_CONTROL_STATUS_CHANGED: boolean indicating if control is granted (true) * or stolen (false). * - EVENT_ENABLE_STATUS_CHANGED: boolean indicating if effect is now enabled (true) * or disabled (false). * - EVENT_PARAMETER_CHANGED: pointer to a effect_param_t structure. * - EVENT_ERROR: status_t indicating the error (DEAD_OBJECT when media server dies). */ typedef void (*effect_callback_t)(int32_t event, void* user, void *info); /* Constructor. * AudioEffect is the base class for creating and controlling an effect engine from * the application process. Creating an AudioEffect object will create the effect engine * in the AudioFlinger if no engine of the specified type exists. If one exists, this engine * will be used. The application creating the AudioEffect object (or a derived class like * Reverb for instance) will either receive control of the effect engine or not, depending * on the priority parameter. If priority is higher than the priority used by the current * effect engine owner, the control will be transfered to the new application. Otherwise * control will remain to the previous application. In this case, the new application will be * notified of changes in effect engine state or control ownership by the effect callback. * After creating the AudioEffect, the application must call the initCheck() method and * check the creation status before trying to control the effect engine (see initCheck()). * If the effect is to be applied to an AudioTrack or MediaPlayer only the application * must specify the audio session ID corresponding to this player. */ /* Simple Constructor. */ AudioEffect(); /* Constructor. * * Parameters: * * type: type of effect created: can be null if uuid is specified. This corresponds to * the OpenSL ES interface implemented by this effect. * uuid: Uuid of effect created: can be null if type is specified. This uuid corresponds to * a particular implementation of an effect type. * priority: requested priority for effect control: the priority level corresponds to the * value of priority parameter: negative values indicate lower priorities, positive values * higher priorities, 0 being the normal priority. * cbf: optional callback function (see effect_callback_t) * user: pointer to context for use by the callback receiver. * sessionID: audio session this effect is associated to. If 0, the effect will be global to * the output mix. If not 0, the effect will be applied to all players * (AudioTrack or MediaPLayer) within the same audio session. * io: HAL audio output or input stream to which this effect must be attached. Leave at 0 for * automatic output selection by AudioFlinger. */ AudioEffect(const effect_uuid_t *type, const effect_uuid_t *uuid = NULL, int32_t priority = 0, effect_callback_t cbf = NULL, void* user = NULL, int sessionId = 0, audio_io_handle_t io = 0 ); /* Constructor. * Same as above but with type and uuid specified by character strings */ AudioEffect(const char *typeStr, const char *uuidStr = NULL, int32_t priority = 0, effect_callback_t cbf = NULL, void* user = NULL, int sessionId = 0, audio_io_handle_t io = 0 ); /* Terminates the AudioEffect and unregisters it from AudioFlinger. * The effect engine is also destroyed if this AudioEffect was the last controlling * the engine. */ ~AudioEffect(); /* Initialize an uninitialized AudioEffect. * Returned status (from utils/Errors.h) can be: * - NO_ERROR or ALREADY_EXISTS: successful initialization * - INVALID_OPERATION: AudioEffect is already initialized * - BAD_VALUE: invalid parameter * - NO_INIT: audio flinger or audio hardware not initialized * */ status_t set(const effect_uuid_t *type, const effect_uuid_t *uuid = NULL, int32_t priority = 0, effect_callback_t cbf = NULL, void* user = NULL, int sessionId = 0, audio_io_handle_t io = 0 ); /* Result of constructing the AudioEffect. This must be checked * before using any AudioEffect API. * initCheck() can return: * - NO_ERROR: the effect engine is successfully created and the application has control. * - ALREADY_EXISTS: the effect engine is successfully created but the application does not * have control. * - NO_INIT: the effect creation failed. * */ status_t initCheck() const; /* Returns the unique effect Id for the controlled effect engine. This ID is unique * system wide and is used for instance in the case of auxiliary effects to attach * the effect to an AudioTrack or MediaPlayer. * */ int32_t id() const { return mId; } /* Returns a descriptor for the effect (see effect_descriptor_t in audio_effect.h). */ effect_descriptor_t descriptor() const; /* Returns effect control priority of this AudioEffect object. */ int32_t priority() const { return mPriority; } /* Enables or disables the effect engine. * * Parameters: * enabled: requested enable state. * * Returned status (from utils/Errors.h) can be: * - NO_ERROR: successful operation * - INVALID_OPERATION: the application does not have control of the effect engine or the * effect is already in the requested state. */ virtual status_t setEnabled(bool enabled); bool getEnabled() const; /* Sets a parameter value. * * Parameters: * param: pointer to effect_param_t structure containing the parameter * and its value (See audio_effect.h). * Returned status (from utils/Errors.h) can be: * - NO_ERROR: successful operation. * - INVALID_OPERATION: the application does not have control of the effect engine. * - BAD_VALUE: invalid parameter identifier or value. * - DEAD_OBJECT: the effect engine has been deleted. */ virtual status_t setParameter(effect_param_t *param); /* Prepare a new parameter value that will be set by next call to * setParameterCommit(). This method can be used to set multiple parameters * in a synchronous manner or to avoid multiple binder calls for each * parameter. * * Parameters: * param: pointer to effect_param_t structure containing the parameter * and its value (See audio_effect.h). * * Returned status (from utils/Errors.h) can be: * - NO_ERROR: successful operation. * - INVALID_OPERATION: the application does not have control of the effect engine. * - NO_MEMORY: no more space available in shared memory used for deferred parameter * setting. */ virtual status_t setParameterDeferred(effect_param_t *param); /* Commit all parameter values previously prepared by setParameterDeferred(). * * Parameters: * none * * Returned status (from utils/Errors.h) can be: * - NO_ERROR: successful operation. * - INVALID_OPERATION: No new parameter values ready for commit. * - BAD_VALUE: invalid parameter identifier or value: there is no indication * as to which of the parameters caused this error. * - DEAD_OBJECT: the effect engine has been deleted. */ virtual status_t setParameterCommit(); /* Gets a parameter value. * * Parameters: * param: pointer to effect_param_t structure containing the parameter * and the returned value (See audio_effect.h). * * Returned status (from utils/Errors.h) can be: * - NO_ERROR: successful operation. * - INVALID_OPERATION: the AudioEffect was not successfully initialized. * - BAD_VALUE: invalid parameter identifier. * - DEAD_OBJECT: the effect engine has been deleted. */ virtual status_t getParameter(effect_param_t *param); /* Sends a command and receives a response to/from effect engine. * See audio_effect.h for details on effect command() function, valid command codes * and formats. */ virtual status_t command(uint32_t cmdCode, uint32_t cmdSize, void *cmdData, uint32_t *replySize, void *replyData); /* * Utility functions. */ /* Converts the string passed as first argument to the effect_uuid_t * pointed to by second argument */ static status_t stringToGuid(const char *str, effect_uuid_t *guid); /* Converts the effect_uuid_t pointed to by first argument to the * string passed as second argument */ static status_t guidToString(const effect_uuid_t *guid, char *str, size_t maxLen); protected: bool mEnabled; // enable state int32_t mSessionId; // audio session ID int32_t mPriority; // priority for effect control status_t mStatus; // effect status effect_callback_t mCbf; // callback function for status, control and // parameter changes notifications void* mUserData; // client context for callback function effect_descriptor_t mDescriptor; // effect descriptor int32_t mId; // system wide unique effect engine instance ID Mutex mLock; // Mutex for mEnabled access // IEffectClient virtual void controlStatusChanged(bool controlGranted); virtual void enableStatusChanged(bool enabled); virtual void commandExecuted(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, uint32_t replySize, void *pReplyData); private: // Implements the IEffectClient interface class EffectClient : public android::BnEffectClient, public android::IBinder::DeathRecipient { public: EffectClient(AudioEffect *effect) : mEffect(effect){} // IEffectClient virtual void controlStatusChanged(bool controlGranted) { mEffect->controlStatusChanged(controlGranted); } virtual void enableStatusChanged(bool enabled) { mEffect->enableStatusChanged(enabled); } virtual void commandExecuted(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, uint32_t replySize, void *pReplyData) { mEffect->commandExecuted(cmdCode, cmdSize, pCmdData, replySize, pReplyData); } // IBinder::DeathRecipient virtual void binderDied(const wp& who) {mEffect->binderDied();} private: AudioEffect *mEffect; }; void binderDied(); sp mIEffect; // IEffect binder interface sp mIEffectClient; // IEffectClient implementation sp mCblkMemory; // shared memory for deferred parameter setting effect_param_cblk_t* mCblk; // control block for deferred parameter setting }; }; // namespace android #endif // ANDROID_AUDIOEFFECT_H android-audiosystem-1.8+13.10.20130807/include/media/mediarecorder.h0000644000015700001700000002136512200324306025361 0ustar pbuserpbgroup00000000000000/* ** Copyright (C) 2008 The Android Open Source Project ** Copyright (c) 2010 - 2012, The Linux Foundation. All rights reserved. ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** ** limitations under the License. */ #ifndef ANDROID_MEDIARECORDER_H #define ANDROID_MEDIARECORDER_H #include #include #include #include #include #include namespace android { class Surface; class IMediaRecorder; class ICamera; class ICameraRecordingProxy; class ISurfaceTexture; class SurfaceTextureClient; typedef void (*media_completion_f)(status_t status, void *cookie); enum video_source { VIDEO_SOURCE_DEFAULT = 0, VIDEO_SOURCE_CAMERA = 1, VIDEO_SOURCE_GRALLOC_BUFFER = 2, VIDEO_SOURCE_LIST_END // must be last - used to validate audio source type }; //Please update media/java/android/media/MediaRecorder.java if the following is updated. enum output_format { OUTPUT_FORMAT_DEFAULT = 0, OUTPUT_FORMAT_THREE_GPP = 1, OUTPUT_FORMAT_MPEG_4 = 2, OUTPUT_FORMAT_AUDIO_ONLY_START = 3, // Used in validating the output format. Should be the // at the start of the audio only output formats. /* These are audio only file formats */ OUTPUT_FORMAT_RAW_AMR = 3, //to be backward compatible OUTPUT_FORMAT_AMR_NB = 3, OUTPUT_FORMAT_AMR_WB = 4, OUTPUT_FORMAT_AAC_ADIF = 5, OUTPUT_FORMAT_AAC_ADTS = 6, /* Stream over a socket, limited to a single stream */ OUTPUT_FORMAT_RTP_AVP = 7, /* H.264/AAC data encapsulated in MPEG2/TS */ OUTPUT_FORMAT_MPEG2TS = 8, #ifdef QCOM_HARDWARE OUTPUT_FORMAT_QCP = 9, // QCP file format OUTPUT_FORMAT_THREE_GPP2 = 10, /*3GPP2*/ OUTPUT_FORMAT_WAVE = 11, /*WAVE*/ #endif OUTPUT_FORMAT_LIST_END // must be last - used to validate format type }; enum audio_encoder { AUDIO_ENCODER_DEFAULT = 0, AUDIO_ENCODER_AMR_NB = 1, AUDIO_ENCODER_AMR_WB = 2, AUDIO_ENCODER_AAC = 3, AUDIO_ENCODER_HE_AAC = 4, AUDIO_ENCODER_AAC_ELD = 5, #ifdef QCOM_HARDWARE AUDIO_ENCODER_EVRC = 6, AUDIO_ENCODER_QCELP = 7, AUDIO_ENCODER_LPCM = 8, #endif AUDIO_ENCODER_LIST_END // must be the last - used to validate the audio encoder type }; enum video_encoder { VIDEO_ENCODER_DEFAULT = 0, VIDEO_ENCODER_H263 = 1, VIDEO_ENCODER_H264 = 2, VIDEO_ENCODER_MPEG_4_SP = 3, VIDEO_ENCODER_LIST_END // must be the last - used to validate the video encoder type }; /* * The state machine of the media_recorder. */ enum media_recorder_states { // Error state. MEDIA_RECORDER_ERROR = 0, // Recorder was just created. MEDIA_RECORDER_IDLE = 1 << 0, // Recorder has been initialized. MEDIA_RECORDER_INITIALIZED = 1 << 1, // Configuration of the recorder has been completed. MEDIA_RECORDER_DATASOURCE_CONFIGURED = 1 << 2, // Recorder is ready to start. MEDIA_RECORDER_PREPARED = 1 << 3, // Recording is in progress. MEDIA_RECORDER_RECORDING = 1 << 4, }; // The "msg" code passed to the listener in notify. enum media_recorder_event_type { MEDIA_RECORDER_EVENT_LIST_START = 1, MEDIA_RECORDER_EVENT_ERROR = 1, MEDIA_RECORDER_EVENT_INFO = 2, #ifdef QCOM_HARDWARE MEDIA_RECORDER_MSG_COMPRESSED_IMAGE = 8, // mzhu: TODO, where to put this? #endif MEDIA_RECORDER_EVENT_LIST_END = 99, // Track related event types MEDIA_RECORDER_TRACK_EVENT_LIST_START = 100, MEDIA_RECORDER_TRACK_EVENT_ERROR = 100, MEDIA_RECORDER_TRACK_EVENT_INFO = 101, MEDIA_RECORDER_TRACK_EVENT_LIST_END = 1000, }; /* * The (part of) "what" code passed to the listener in notify. * When the error or info type is track specific, the what has * the following layout: * the left-most 16-bit is meant for error or info type. * the right-most 4-bit is meant for track id. * the rest is reserved. * * | track id | reserved | error or info type | * 31 28 16 0 * */ enum media_recorder_error_type { MEDIA_RECORDER_ERROR_UNKNOWN = 1, // Track related error type MEDIA_RECORDER_TRACK_ERROR_LIST_START = 100, MEDIA_RECORDER_TRACK_ERROR_GENERAL = 100, MEDIA_RECORDER_ERROR_VIDEO_NO_SYNC_FRAME = 200, MEDIA_RECORDER_TRACK_ERROR_LIST_END = 1000, }; // The codes are distributed as follow: // 0xx: Reserved // 8xx: General info/warning // enum media_recorder_info_type { MEDIA_RECORDER_INFO_UNKNOWN = 1, MEDIA_RECORDER_INFO_MAX_DURATION_REACHED = 800, MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED = 801, // All track related informtional events start here MEDIA_RECORDER_TRACK_INFO_LIST_START = 1000, MEDIA_RECORDER_TRACK_INFO_COMPLETION_STATUS = 1000, MEDIA_RECORDER_TRACK_INFO_PROGRESS_IN_TIME = 1001, MEDIA_RECORDER_TRACK_INFO_TYPE = 1002, MEDIA_RECORDER_TRACK_INFO_DURATION_MS = 1003, // The time to measure the max chunk duration MEDIA_RECORDER_TRACK_INFO_MAX_CHUNK_DUR_MS = 1004, MEDIA_RECORDER_TRACK_INFO_ENCODED_FRAMES = 1005, // The time to measure how well the audio and video // track data is interleaved. MEDIA_RECORDER_TRACK_INTER_CHUNK_TIME_MS = 1006, // The time to measure system response. Note that // the delay does not include the intentional delay // we use to eliminate the recording sound. MEDIA_RECORDER_TRACK_INFO_INITIAL_DELAY_MS = 1007, // The time used to compensate for initial A/V sync. MEDIA_RECORDER_TRACK_INFO_START_OFFSET_MS = 1008, // Total number of bytes of the media data. MEDIA_RECORDER_TRACK_INFO_DATA_KBYTES = 1009, MEDIA_RECORDER_TRACK_INFO_LIST_END = 2000, }; // ---------------------------------------------------------------------------- // ref-counted object for callbacks class MediaRecorderListener: virtual public RefBase { public: virtual void notify(int msg, int ext1, int ext2) = 0; }; class MediaRecorder : public BnMediaRecorderClient, public virtual IMediaDeathNotifier { public: MediaRecorder(); ~MediaRecorder(); void died(); status_t initCheck(); status_t setCamera(const sp& camera, const sp& proxy); status_t setPreviewSurface(const sp& surface); status_t setVideoSource(int vs); status_t setAudioSource(int as); status_t setOutputFormat(int of); status_t setVideoEncoder(int ve); status_t setAudioEncoder(int ae); status_t setOutputFile(const char* path); status_t setOutputFile(int fd, int64_t offset, int64_t length); status_t setVideoSize(int width, int height); status_t setVideoFrameRate(int frames_per_second); status_t setParameters(const String8& params); status_t setListener(const sp& listener); status_t prepare(); status_t getMaxAmplitude(int* max); status_t start(); status_t stop(); status_t reset(); status_t init(); status_t close(); status_t release(); void notify(int msg, int ext1, int ext2); sp querySurfaceMediaSourceFromMediaServer(); private: void doCleanUp(); status_t doReset(); sp mMediaRecorder; sp mListener; // Reference toISurfaceTexture // for encoding GL Frames. That is useful only when the // video source is set to VIDEO_SOURCE_GRALLOC_BUFFER sp mSurfaceMediaSource; media_recorder_states mCurrentState; bool mIsAudioSourceSet; bool mIsVideoSourceSet; bool mIsAudioEncoderSet; bool mIsVideoEncoderSet; bool mIsOutputFileSet; Mutex mLock; Mutex mNotifyLock; }; }; // namespace android #endif // ANDROID_MEDIARECORDER_H android-audiosystem-1.8+13.10.20130807/include/media/IAudioFlingerClient.h0000644000015700001700000000326012200324306026366 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_IAUDIOFLINGERCLIENT_H #define ANDROID_IAUDIOFLINGERCLIENT_H #include #include #include #include namespace android { // ---------------------------------------------------------------------------- class IAudioFlingerClient : public IInterface { public: DECLARE_META_INTERFACE(AudioFlingerClient); // Notifies a change of audio input/output configuration. virtual void ioConfigChanged(int event, audio_io_handle_t ioHandle, const void *param2) = 0; }; // ---------------------------------------------------------------------------- class BnAudioFlingerClient : public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; // ---------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_IAUDIOFLINGERCLIENT_H android-audiosystem-1.8+13.10.20130807/include/media/IStreamSource.h0000644000015700001700000000622312200324306025275 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_ISTREAMSOURCE_H_ #define ANDROID_ISTREAMSOURCE_H_ #include namespace android { struct AMessage; struct IMemory; struct IStreamListener; struct IStreamSource : public IInterface { DECLARE_META_INTERFACE(StreamSource); virtual void setListener(const sp &listener) = 0; virtual void setBuffers(const Vector > &buffers) = 0; virtual void onBufferAvailable(size_t index) = 0; enum { // Video PES packets contain exactly one (aligned) access unit. kFlagAlignedVideoData = 1, }; virtual uint32_t flags() const { return 0; } }; struct IStreamListener : public IInterface { DECLARE_META_INTERFACE(StreamListener); enum Command { EOS, DISCONTINUITY, }; virtual void queueBuffer(size_t index, size_t size) = 0; // When signalling a discontinuity you can optionally // specify an int64_t PTS timestamp in "msg". // If present, rendering of data following the discontinuity // will be suppressed until media time reaches this timestamp. static const char *const kKeyResumeAtPTS; // When signalling a discontinuity you can optionally // specify the type(s) of discontinuity, i.e. if the // audio format has changed, the video format has changed, // time has jumped or any combination thereof. // To do so, include a non-zero int32_t value // under the key "kKeyDiscontinuityMask" when issuing the DISCONTINUITY // command. // If there is a change in audio/video format, The new logical stream // must start with proper codec initialization // information for playback to continue, i.e. SPS and PPS in the case // of AVC video etc. // If this key is not present, only a time discontinuity is assumed. // The value should be a bitmask of values from // ATSParser::DiscontinuityType. static const char *const kKeyDiscontinuityMask; virtual void issueCommand( Command cmd, bool synchronous, const sp &msg = NULL) = 0; }; //////////////////////////////////////////////////////////////////////////////// struct BnStreamSource : public BnInterface { virtual status_t onTransact( uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags = 0); }; struct BnStreamListener : public BnInterface { virtual status_t onTransact( uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags = 0); }; } // namespace android #endif // ANDROID_ISTREAMSOURCE_H_ android-audiosystem-1.8+13.10.20130807/include/media/MediaMetadataRetrieverInterface.h0000644000015700001700000000366712200324306030752 0ustar pbuserpbgroup00000000000000/* ** ** Copyright (C) 2008 The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #ifndef ANDROID_MEDIAMETADATARETRIEVERINTERFACE_H #define ANDROID_MEDIAMETADATARETRIEVERINTERFACE_H #include #include #include namespace android { // Abstract base class class MediaMetadataRetrieverBase : public RefBase { public: MediaMetadataRetrieverBase() {} virtual ~MediaMetadataRetrieverBase() {} virtual status_t setDataSource( const char *url, const KeyedVector *headers = NULL) = 0; virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0; virtual VideoFrame* getFrameAtTime(int64_t timeUs, int option) = 0; virtual MediaAlbumArt* extractAlbumArt() = 0; virtual const char* extractMetadata(int keyCode) = 0; }; // MediaMetadataRetrieverInterface class MediaMetadataRetrieverInterface : public MediaMetadataRetrieverBase { public: MediaMetadataRetrieverInterface() {} virtual ~MediaMetadataRetrieverInterface() {} virtual VideoFrame* getFrameAtTime(int64_t timeUs, int option) { return NULL; } virtual MediaAlbumArt* extractAlbumArt() { return NULL; } virtual const char* extractMetadata(int keyCode) { return NULL; } }; }; // namespace android #endif // ANDROID_MEDIAMETADATARETRIEVERINTERFACE_H android-audiosystem-1.8+13.10.20130807/include/media/IOMX.h0000644000015700001700000001257212200324306023330 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_IOMX_H_ #define ANDROID_IOMX_H_ #include #include #include #include #include #include namespace android { class IMemory; class IOMXObserver; class IOMXRenderer; class Surface; class IOMX : public IInterface { public: DECLARE_META_INTERFACE(OMX); typedef void *buffer_id; typedef void *node_id; // Given a node_id and the calling process' pid, returns true iff // the implementation of the OMX interface lives in the same // process. virtual bool livesLocally(node_id node, pid_t pid) = 0; struct ComponentInfo { String8 mName; List mRoles; }; virtual status_t listNodes(List *list) = 0; virtual status_t allocateNode( const char *name, const sp &observer, node_id *node) = 0; virtual status_t freeNode(node_id node) = 0; virtual status_t sendCommand( node_id node, OMX_COMMANDTYPE cmd, OMX_S32 param) = 0; virtual status_t getParameter( node_id node, OMX_INDEXTYPE index, void *params, size_t size) = 0; virtual status_t setParameter( node_id node, OMX_INDEXTYPE index, const void *params, size_t size) = 0; virtual status_t getConfig( node_id node, OMX_INDEXTYPE index, void *params, size_t size) = 0; virtual status_t setConfig( node_id node, OMX_INDEXTYPE index, const void *params, size_t size) = 0; virtual status_t getState( node_id node, OMX_STATETYPE* state) = 0; virtual status_t storeMetaDataInBuffers( node_id node, OMX_U32 port_index, OMX_BOOL enable) = 0; virtual status_t enableGraphicBuffers( node_id node, OMX_U32 port_index, OMX_BOOL enable) = 0; virtual status_t getGraphicBufferUsage( node_id node, OMX_U32 port_index, OMX_U32* usage) = 0; virtual status_t useBuffer( node_id node, OMX_U32 port_index, const sp ¶ms, buffer_id *buffer) = 0; virtual status_t useGraphicBuffer( node_id node, OMX_U32 port_index, const sp &graphicBuffer, buffer_id *buffer) = 0; // This API clearly only makes sense if the caller lives in the // same process as the callee, i.e. is the media_server, as the // returned "buffer_data" pointer is just that, a pointer into local // address space. virtual status_t allocateBuffer( node_id node, OMX_U32 port_index, size_t size, buffer_id *buffer, void **buffer_data) = 0; virtual status_t allocateBufferWithBackup( node_id node, OMX_U32 port_index, const sp ¶ms, buffer_id *buffer) = 0; virtual status_t freeBuffer( node_id node, OMX_U32 port_index, buffer_id buffer) = 0; virtual status_t fillBuffer(node_id node, buffer_id buffer) = 0; virtual status_t emptyBuffer( node_id node, buffer_id buffer, OMX_U32 range_offset, OMX_U32 range_length, OMX_U32 flags, OMX_TICKS timestamp) = 0; virtual status_t getExtensionIndex( node_id node, const char *parameter_name, OMX_INDEXTYPE *index) = 0; }; struct omx_message { enum { EVENT, EMPTY_BUFFER_DONE, FILL_BUFFER_DONE, } type; IOMX::node_id node; union { // if type == EVENT struct { OMX_EVENTTYPE event; OMX_U32 data1; OMX_U32 data2; } event_data; // if type == EMPTY_BUFFER_DONE struct { IOMX::buffer_id buffer; } buffer_data; // if type == FILL_BUFFER_DONE struct { IOMX::buffer_id buffer; OMX_U32 range_offset; OMX_U32 range_length; OMX_U32 flags; OMX_TICKS timestamp; OMX_PTR platform_private; OMX_PTR data_ptr; } extended_buffer_data; } u; }; class IOMXObserver : public IInterface { public: DECLARE_META_INTERFACE(OMXObserver); virtual void onMessage(const omx_message &msg) = 0; }; //////////////////////////////////////////////////////////////////////////////// class BnOMX : public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags = 0); }; class BnOMXObserver : public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags = 0); }; struct CodecProfileLevel { OMX_U32 mProfile; OMX_U32 mLevel; }; } // namespace android #endif // ANDROID_IOMX_H_ android-audiosystem-1.8+13.10.20130807/include/media/mediascanner.h0000644000015700001700000000630212200324306025177 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MEDIASCANNER_H #define MEDIASCANNER_H #include #include #include #include #include struct dirent; namespace android { class MediaScannerClient; class StringArray; enum MediaScanResult { // This file or directory was scanned successfully. MEDIA_SCAN_RESULT_OK, // This file or directory was skipped because it was not found, could // not be opened, was of an unsupported type, or was malfored in some way. MEDIA_SCAN_RESULT_SKIPPED, // The scan should be aborted due to a fatal error such as out of memory // or an exception. MEDIA_SCAN_RESULT_ERROR, }; struct MediaScanner { MediaScanner(); virtual ~MediaScanner(); virtual MediaScanResult processFile( const char *path, const char *mimeType, MediaScannerClient &client) = 0; virtual MediaScanResult processDirectory( const char *path, MediaScannerClient &client); void setLocale(const char *locale); // extracts album art as a block of data virtual char *extractAlbumArt(int fd) = 0; protected: const char *locale() const; private: // current locale (like "ja_JP"), created/destroyed with strdup()/free() char *mLocale; char *mSkipList; int *mSkipIndex; MediaScanResult doProcessDirectory( char *path, int pathRemaining, MediaScannerClient &client, bool noMedia); MediaScanResult doProcessDirectoryEntry( char *path, int pathRemaining, MediaScannerClient &client, bool noMedia, struct dirent* entry, char* fileSpot); void loadSkipList(); bool shouldSkipDirectory(char *path); MediaScanner(const MediaScanner &); MediaScanner &operator=(const MediaScanner &); }; class MediaScannerClient { public: MediaScannerClient(); virtual ~MediaScannerClient(); void setLocale(const char* locale); void beginFile(); status_t addStringTag(const char* name, const char* value); void endFile(); virtual status_t scanFile(const char* path, long long lastModified, long long fileSize, bool isDirectory, bool noMedia) = 0; virtual status_t handleStringTag(const char* name, const char* value) = 0; virtual status_t setMimeType(const char* mimeType) = 0; protected: void convertValues(uint32_t encoding); protected: // cached name and value strings, for native encoding support. StringArray* mNames; StringArray* mValues; // default encoding based on MediaScanner::mLocale string uint32_t mLocaleEncoding; }; }; // namespace android #endif // MEDIASCANNER_H android-audiosystem-1.8+13.10.20130807/include/media/AudioSystem.h0000644000015700001700000003144312200324306025020 0ustar pbuserpbgroup00000000000000/* * Copyright (c) 2012, The Linux Foundation. All rights reserved. * Not a Contribution, Apache license notifications and license are retained * for attribution purposes only. * * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIOSYSTEM_H_ #define ANDROID_AUDIOSYSTEM_H_ #include #include #include #include #include /* XXX: Should be include by all the users instead */ #include namespace android { typedef void (*audio_error_callback)(status_t err); class IAudioPolicyService; class String8; class AudioSystem { public: /* These are static methods to control the system-wide AudioFlinger * only privileged processes can have access to them */ // mute/unmute microphone static status_t muteMicrophone(bool state); static status_t isMicrophoneMuted(bool *state); // set/get master volume static status_t setMasterVolume(float value); static status_t getMasterVolume(float* volume); // mute/unmute audio outputs static status_t setMasterMute(bool mute); static status_t getMasterMute(bool* mute); // set/get stream volume on specified output static status_t setStreamVolume(audio_stream_type_t stream, float value, audio_io_handle_t output); static status_t getStreamVolume(audio_stream_type_t stream, float* volume, audio_io_handle_t output); // mute/unmute stream static status_t setStreamMute(audio_stream_type_t stream, bool mute); static status_t getStreamMute(audio_stream_type_t stream, bool* mute); // set audio mode in audio hardware static status_t setMode(audio_mode_t mode); // returns true in *state if tracks are active on the specified stream or has been active // in the past inPastMs milliseconds static status_t isStreamActive(audio_stream_type_t stream, bool *state, uint32_t inPastMs = 0); // returns true in *state if a recorder is currently recording with the specified source static status_t isSourceActive(audio_source_t source, bool *state); // set/get audio hardware parameters. The function accepts a list of parameters // key value pairs in the form: key1=value1;key2=value2;... // Some keys are reserved for standard parameters (See AudioParameter class). static status_t setParameters(audio_io_handle_t ioHandle, const String8& keyValuePairs); static String8 getParameters(audio_io_handle_t ioHandle, const String8& keys); static void setErrorCallback(audio_error_callback cb); // helper function to obtain AudioFlinger service handle static const sp& get_audio_flinger(); static float linearToLog(int volume); static int logToLinear(float volume); static status_t getOutputSamplingRate(int* samplingRate, audio_stream_type_t stream = AUDIO_STREAM_DEFAULT); static status_t getOutputFrameCount(int* frameCount, audio_stream_type_t stream = AUDIO_STREAM_DEFAULT); static status_t getOutputLatency(uint32_t* latency, audio_stream_type_t stream = AUDIO_STREAM_DEFAULT); static status_t getSamplingRate(audio_io_handle_t output, audio_stream_type_t streamType, int* samplingRate); // returns the number of frames per audio HAL write buffer. Corresponds to // audio_stream->get_buffer_size()/audio_stream_frame_size() static status_t getFrameCount(audio_io_handle_t output, audio_stream_type_t stream, int* frameCount); // returns the audio output stream latency in ms. Corresponds to // audio_stream_out->get_latency() static status_t getLatency(audio_io_handle_t output, audio_stream_type_t stream, uint32_t* latency); // DEPRECATED static status_t getOutputSamplingRate(int* samplingRate, int stream = AUDIO_STREAM_DEFAULT); // DEPRECATED static status_t getOutputFrameCount(int* frameCount, int stream = AUDIO_STREAM_DEFAULT); static bool routedToA2dpOutput(audio_stream_type_t streamType); static status_t getInputBufferSize(uint32_t sampleRate, audio_format_t format, audio_channel_mask_t channelMask, size_t* buffSize); static status_t setVoiceVolume(float volume); // return the number of audio frames written by AudioFlinger to audio HAL and // audio dsp to DAC since the output on which the specified stream is playing // has exited standby. // returned status (from utils/Errors.h) can be: // - NO_ERROR: successful operation, halFrames and dspFrames point to valid data // - INVALID_OPERATION: Not supported on current hardware platform // - BAD_VALUE: invalid parameter // NOTE: this feature is not supported on all hardware platforms and it is // necessary to check returned status before using the returned values. static status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, audio_stream_type_t stream = AUDIO_STREAM_DEFAULT); // return the number of input frames lost by HAL implementation, or 0 if the handle is invalid static unsigned int getInputFramesLost(audio_io_handle_t ioHandle); static int newAudioSessionId(); static void acquireAudioSessionId(int audioSession); static void releaseAudioSessionId(int audioSession); // types of io configuration change events received with ioConfigChanged() enum io_config_event { OUTPUT_OPENED, OUTPUT_CLOSED, OUTPUT_CONFIG_CHANGED, INPUT_OPENED, INPUT_CLOSED, INPUT_CONFIG_CHANGED, STREAM_CONFIG_CHANGED, #ifdef QCOM_HARDWARE EFFECT_CONFIG_CHANGED, #endif NUM_CONFIG_EVENTS }; // audio output descriptor used to cache output configurations in client process to avoid frequent calls // through IAudioFlinger class OutputDescriptor { public: OutputDescriptor() : samplingRate(0), format(AUDIO_FORMAT_DEFAULT), channels(0), frameCount(0), latency(0) {} uint32_t samplingRate; int32_t format; int32_t channels; size_t frameCount; uint32_t latency; }; // Events used to synchronize actions between audio sessions. // For instance SYNC_EVENT_PRESENTATION_COMPLETE can be used to delay recording start until playback // is complete on another audio session. // See definitions in MediaSyncEvent.java enum sync_event_t { SYNC_EVENT_SAME = -1, // used internally to indicate restart with same event SYNC_EVENT_NONE = 0, SYNC_EVENT_PRESENTATION_COMPLETE, // // Define new events here: SYNC_EVENT_START, SYNC_EVENT_STOP, SYNC_EVENT_TIME ... // SYNC_EVENT_CNT, }; // Timeout for synchronous record start. Prevents from blocking the record thread forever // if the trigger event is not fired. static const uint32_t kSyncRecordStartTimeOutMs = 30000; // // IAudioPolicyService interface (see AudioPolicyInterface for method descriptions) // static status_t setDeviceConnectionState(audio_devices_t device, audio_policy_dev_state_t state, const char *device_address); static audio_policy_dev_state_t getDeviceConnectionState(audio_devices_t device, const char *device_address); static status_t setPhoneState(audio_mode_t state); static status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config); static audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage); static audio_io_handle_t getOutput(audio_stream_type_t stream, uint32_t samplingRate = 0, audio_format_t format = AUDIO_FORMAT_DEFAULT, audio_channel_mask_t channelMask = AUDIO_CHANNEL_OUT_STEREO, audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE); static status_t startOutput(audio_io_handle_t output, audio_stream_type_t stream, int session = 0); static status_t stopOutput(audio_io_handle_t output, audio_stream_type_t stream, int session = 0); static void releaseOutput(audio_io_handle_t output); static audio_io_handle_t getInput(audio_source_t inputSource, uint32_t samplingRate = 0, audio_format_t format = AUDIO_FORMAT_DEFAULT, audio_channel_mask_t channelMask = AUDIO_CHANNEL_IN_MONO, int sessionId = 0); static status_t startInput(audio_io_handle_t input); static status_t stopInput(audio_io_handle_t input); static void releaseInput(audio_io_handle_t input); static status_t initStreamVolume(audio_stream_type_t stream, int indexMin, int indexMax); static status_t setStreamVolumeIndex(audio_stream_type_t stream, int index, audio_devices_t device); static status_t getStreamVolumeIndex(audio_stream_type_t stream, int *index, audio_devices_t device); static uint32_t getStrategyForStream(audio_stream_type_t stream); static audio_devices_t getDevicesForStream(audio_stream_type_t stream); static audio_io_handle_t getOutputForEffect(const effect_descriptor_t *desc); static status_t registerEffect(const effect_descriptor_t *desc, audio_io_handle_t io, uint32_t strategy, int session, int id); static status_t unregisterEffect(int id); static status_t setEffectEnabled(int id, bool enabled); // clear stream to output mapping cache (gStreamOutputMap) // and output configuration cache (gOutputs) static void clearAudioConfigCache(); static const sp& get_audio_policy_service(); // helpers for android.media.AudioManager.getProperty(), see description there for meaning static int32_t getPrimaryOutputSamplingRate(); static int32_t getPrimaryOutputFrameCount(); // ---------------------------------------------------------------------------- private: class AudioFlingerClient: public IBinder::DeathRecipient, public BnAudioFlingerClient { public: AudioFlingerClient() { } // DeathRecipient virtual void binderDied(const wp& who); // IAudioFlingerClient // indicate a change in the configuration of an output or input: keeps the cached // values for output/input parameters up-to-date in client process virtual void ioConfigChanged(int event, audio_io_handle_t ioHandle, const void *param2); }; class AudioPolicyServiceClient: public IBinder::DeathRecipient { public: AudioPolicyServiceClient() { } // DeathRecipient virtual void binderDied(const wp& who); }; static sp gAudioFlingerClient; static sp gAudioPolicyServiceClient; friend class AudioFlingerClient; friend class AudioPolicyServiceClient; static Mutex gLock; static sp gAudioFlinger; static audio_error_callback gAudioErrorCallback; static size_t gInBuffSize; // previous parameters for recording buffer size queries static uint32_t gPrevInSamplingRate; static audio_format_t gPrevInFormat; static audio_channel_mask_t gPrevInChannelMask; static sp gAudioPolicyService; // mapping between stream types and outputs static DefaultKeyedVector gStreamOutputMap; // list of output descriptors containing cached parameters // (sampling rate, framecount, channel count...) static DefaultKeyedVector gOutputs; }; }; // namespace android #endif /*ANDROID_AUDIOSYSTEM_H_*/ android-audiosystem-1.8+13.10.20130807/include/media/IRemoteDisplay.h0000644000015700001700000000342012200324306025436 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_IREMOTEDISPLAY_H #define ANDROID_IREMOTEDISPLAY_H #include #include #include #include #include namespace android { /* * Represents a remote display, such as a Wifi display. * * When the remote display is created, it may not yet be connected to the * display. The remote display asynchronously reports events such as successful * connection, disconnection and errors to an IRemoteDisplayClient interface provided by * the client. */ class IRemoteDisplay : public IInterface { public: DECLARE_META_INTERFACE(RemoteDisplay); // Disconnects the remote display and stops listening for new connections. virtual status_t dispose() = 0; }; // ---------------------------------------------------------------------------- class BnRemoteDisplay : public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; }; // namespace android #endif // ANDROID_IREMOTEDISPLAY_H android-audiosystem-1.8+13.10.20130807/include/media/IHDCP.h0000644000015700001700000000530512200324306023377 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include namespace android { struct IHDCPObserver : public IInterface { DECLARE_META_INTERFACE(HDCPObserver); virtual void notify( int msg, int ext1, int ext2, const Parcel *obj) = 0; private: DISALLOW_EVIL_CONSTRUCTORS(IHDCPObserver); }; struct IHDCP : public IInterface { DECLARE_META_INTERFACE(HDCP); // Called to specify the observer that receives asynchronous notifications // from the HDCP implementation to signal completion/failure of asynchronous // operations (such as initialization) or out of band events. virtual status_t setObserver(const sp &observer) = 0; // Request to setup an HDCP session with the specified host listening // on the specified port. virtual status_t initAsync(const char *host, unsigned port) = 0; // Request to shutdown the active HDCP session. virtual status_t shutdownAsync() = 0; // Encrypt a data according to the HDCP spec. The data is to be // encrypted in-place, only size bytes of data should be read/write, // even if the size is not a multiple of 128 bit (16 bytes). // This operation is to be synchronous, i.e. this call does not return // until outData contains size bytes of encrypted data. // streamCTR will be assigned by the caller (to 0 for the first PES stream, // 1 for the second and so on) // inputCTR will be maintained by the callee for each PES stream. virtual status_t encrypt( const void *inData, size_t size, uint32_t streamCTR, uint64_t *outInputCTR, void *outData) = 0; private: DISALLOW_EVIL_CONSTRUCTORS(IHDCP); }; struct BnHDCPObserver : public BnInterface { virtual status_t onTransact( uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags = 0); }; struct BnHDCP : public BnInterface { virtual status_t onTransact( uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags = 0); }; } // namespace android android-audiosystem-1.8+13.10.20130807/include/media/IRemoteDisplayClient.h0000644000015700001700000000516012200324306026600 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_IREMOTEDISPLAYCLIENT_H #define ANDROID_IREMOTEDISPLAYCLIENT_H #include #include #include #include #include namespace android { class ISurfaceTexture; class IRemoteDisplayClient : public IInterface { public: DECLARE_META_INTERFACE(RemoteDisplayClient); enum { // Flag: The remote display is using a secure transport protocol such as HDCP. kDisplayFlagSecure = 1 << 0, }; enum { // Error: An unknown / generic error occurred. kDisplayErrorUnknown = 1, // Error: The connection was dropped unexpectedly. kDisplayErrorConnectionDropped = 2, }; // Indicates that the remote display has been connected successfully. // Provides a surface texture that the client should use to stream buffers to // the remote display. virtual void onDisplayConnected(const sp& surfaceTexture, uint32_t width, uint32_t height, uint32_t flags) = 0; // one-way // Indicates that the remote display has been disconnected normally. // This method should only be called once the client has called 'dispose()' // on the IRemoteDisplay. // It is currently an error for the display to disconnect for any other reason. virtual void onDisplayDisconnected() = 0; // one-way // Indicates that a connection could not be established to the remote display // or an unrecoverable error occurred and the connection was severed. virtual void onDisplayError(int32_t error) = 0; // one-way }; // ---------------------------------------------------------------------------- class BnRemoteDisplayClient : public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; }; // namespace android #endif // ANDROID_IREMOTEDISPLAYCLIENT_H android-audiosystem-1.8+13.10.20130807/include/media/AudioBufferProvider.h0000644000015700001700000000330012200324306026447 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_BUFFER_PROVIDER_H #define ANDROID_AUDIO_BUFFER_PROVIDER_H #include namespace android { // ---------------------------------------------------------------------------- class AudioBufferProvider { public: struct Buffer { Buffer() : raw(NULL), frameCount(0) { } union { void* raw; short* i16; int8_t* i8; }; size_t frameCount; }; virtual ~AudioBufferProvider() {} // value representing an invalid presentation timestamp static const int64_t kInvalidPTS = 0x7FFFFFFFFFFFFFFFLL; // is too painful // pts is the local time when the next sample yielded by getNextBuffer // will be rendered. // Pass kInvalidPTS if the PTS is unknown or not applicable. virtual status_t getNextBuffer(Buffer* buffer, int64_t pts = kInvalidPTS) = 0; virtual void releaseBuffer(Buffer* buffer) = 0; }; // ---------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_AUDIO_BUFFER_PROVIDER_H android-audiosystem-1.8+13.10.20130807/include/media/SoundPool.h0000644000015700001700000001750512200324306024477 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef SOUNDPOOL_H_ #define SOUNDPOOL_H_ #include #include #include #include #include namespace android { static const int IDLE_PRIORITY = -1; // forward declarations class SoundEvent; class SoundPoolThread; class SoundPool; // for queued events class SoundPoolEvent { public: SoundPoolEvent(int msg, int arg1=0, int arg2=0) : mMsg(msg), mArg1(arg1), mArg2(arg2) {} int mMsg; int mArg1; int mArg2; enum MessageType { INVALID, SAMPLE_LOADED }; }; // callback function prototype typedef void SoundPoolCallback(SoundPoolEvent event, SoundPool* soundPool, void* user); // tracks samples used by application class Sample : public RefBase { public: enum sample_state { UNLOADED, LOADING, READY, UNLOADING }; Sample(int sampleID, const char* url); Sample(int sampleID, int fd, int64_t offset, int64_t length); ~Sample(); int sampleID() { return mSampleID; } int numChannels() { return mNumChannels; } int sampleRate() { return mSampleRate; } audio_format_t format() { return mFormat; } size_t size() { return mSize; } int state() { return mState; } uint8_t* data() { return static_cast(mData->pointer()); } status_t doLoad(); void startLoad() { mState = LOADING; } sp getIMemory() { return mData; } // hack void init(int numChannels, int sampleRate, audio_format_t format, size_t size, sp data ) { mNumChannels = numChannels; mSampleRate = sampleRate; mFormat = format; mSize = size; mData = data; } private: void init(); size_t mSize; volatile int32_t mRefCount; uint16_t mSampleID; uint16_t mSampleRate; uint8_t mState : 3; uint8_t mNumChannels : 2; audio_format_t mFormat; int mFd; int64_t mOffset; int64_t mLength; char* mUrl; sp mData; }; // stores pending events for stolen channels class SoundEvent { public: SoundEvent() : mChannelID(0), mLeftVolume(0), mRightVolume(0), mPriority(IDLE_PRIORITY), mLoop(0), mRate(0) {} void set(const sp& sample, int channelID, float leftVolume, float rightVolume, int priority, int loop, float rate); sp sample() { return mSample; } int channelID() { return mChannelID; } float leftVolume() { return mLeftVolume; } float rightVolume() { return mRightVolume; } int priority() { return mPriority; } int loop() { return mLoop; } float rate() { return mRate; } void clear() { mChannelID = 0; mSample.clear(); } protected: sp mSample; int mChannelID; float mLeftVolume; float mRightVolume; int mPriority; int mLoop; float mRate; }; // for channels aka AudioTracks class SoundChannel : public SoundEvent { public: enum state { IDLE, RESUMING, STOPPING, PAUSED, PLAYING }; SoundChannel() : mAudioTrack(NULL), mState(IDLE), mNumChannels(1), mPos(0), mToggle(0), mAutoPaused(false) {} ~SoundChannel(); void init(SoundPool* soundPool); void play(const sp& sample, int channelID, float leftVolume, float rightVolume, int priority, int loop, float rate); void setVolume_l(float leftVolume, float rightVolume); void setVolume(float leftVolume, float rightVolume); void stop_l(); void stop(); void pause(); void autoPause(); void resume(); void autoResume(); void setRate(float rate); int state() { return mState; } void setPriority(int priority) { mPriority = priority; } void setLoop(int loop); int numChannels() { return mNumChannels; } void clearNextEvent() { mNextEvent.clear(); } void nextEvent(); int nextChannelID() { return mNextEvent.channelID(); } void dump(); private: static void callback(int event, void* user, void *info); void process(int event, void *info, unsigned long toggle); bool doStop_l(); SoundPool* mSoundPool; AudioTrack* mAudioTrack; SoundEvent mNextEvent; Mutex mLock; int mState; int mNumChannels; int mPos; int mAudioBufferSize; unsigned long mToggle; bool mAutoPaused; }; // application object for managing a pool of sounds class SoundPool { friend class SoundPoolThread; friend class SoundChannel; public: SoundPool(int maxChannels, audio_stream_type_t streamType, int srcQuality); ~SoundPool(); int load(const char* url, int priority); int load(int fd, int64_t offset, int64_t length, int priority); bool unload(int sampleID); int play(int sampleID, float leftVolume, float rightVolume, int priority, int loop, float rate); void pause(int channelID); void autoPause(); void resume(int channelID); void autoResume(); void stop(int channelID); void setVolume(int channelID, float leftVolume, float rightVolume); void setPriority(int channelID, int priority); void setLoop(int channelID, int loop); void setRate(int channelID, float rate); audio_stream_type_t streamType() const { return mStreamType; } int srcQuality() const { return mSrcQuality; } // called from SoundPoolThread void sampleLoaded(int sampleID); // called from AudioTrack thread void done_l(SoundChannel* channel); // callback function void setCallback(SoundPoolCallback* callback, void* user); void* getUserData() { return mUserData; } private: SoundPool() {} // no default constructor bool startThreads(); void doLoad(sp& sample); sp findSample(int sampleID) { return mSamples.valueFor(sampleID); } SoundChannel* findChannel (int channelID); SoundChannel* findNextChannel (int channelID); SoundChannel* allocateChannel_l(int priority); void moveToFront_l(SoundChannel* channel); void notify(SoundPoolEvent event); void dump(); // restart thread void addToRestartList(SoundChannel* channel); void addToStopList(SoundChannel* channel); static int beginThread(void* arg); int run(); void quit(); Mutex mLock; Mutex mRestartLock; Condition mCondition; SoundPoolThread* mDecodeThread; SoundChannel* mChannelPool; List mChannels; List mRestart; List mStop; DefaultKeyedVector< int, sp > mSamples; int mMaxChannels; audio_stream_type_t mStreamType; int mSrcQuality; int mAllocated; int mNextSampleID; int mNextChannelID; bool mQuit; // callback Mutex mCallbackLock; SoundPoolCallback* mCallback; void* mUserData; }; } // end namespace android #endif /*SOUNDPOOL_H_*/ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/0000755000015700001700000000000012200324404024702 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/media/stagefright/MediaWriter.h0000644000015700001700000000371612200324306027277 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MEDIA_WRITER_H_ #define MEDIA_WRITER_H_ #include #include namespace android { struct MediaSource; struct MetaData; struct MediaWriter : public RefBase { MediaWriter() : mMaxFileSizeLimitBytes(0), mMaxFileDurationLimitUs(0) { } virtual status_t addSource(const sp &source) = 0; virtual bool reachedEOS() = 0; virtual status_t start(MetaData *params = NULL) = 0; virtual status_t stop() = 0; virtual status_t pause() = 0; virtual void setMaxFileSize(int64_t bytes) { mMaxFileSizeLimitBytes = bytes; } virtual void setMaxFileDuration(int64_t durationUs) { mMaxFileDurationLimitUs = durationUs; } virtual void setListener(const sp& listener) { mListener = listener; } virtual status_t dump(int fd, const Vector& args) { return OK; } protected: virtual ~MediaWriter() {} int64_t mMaxFileSizeLimitBytes; int64_t mMaxFileDurationLimitUs; sp mListener; void notify(int msg, int ext1, int ext2) { if (mListener != NULL) { mListener->notify(msg, ext1, ext2); } } private: MediaWriter(const MediaWriter &); MediaWriter &operator=(const MediaWriter &); }; } // namespace android #endif // MEDIA_WRITER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/OMXClient.h0000644000015700001700000000177612200324306026671 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef OMX_CLIENT_H_ #define OMX_CLIENT_H_ #include namespace android { class OMXClient { public: OMXClient(); status_t connect(); void disconnect(); sp interface() { return mOMX; } private: sp mOMX; OMXClient(const OMXClient &); OMXClient &operator=(const OMXClient &); }; } // namespace android #endif // OMX_CLIENT_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/CameraSourceTimeLapse.h0000644000015700001700000001415512200324306031237 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CAMERA_SOURCE_TIME_LAPSE_H_ #define CAMERA_SOURCE_TIME_LAPSE_H_ #include #include #include namespace android { class ICamera; class IMemory; class Camera; class CameraSourceTimeLapse : public CameraSource { public: static CameraSourceTimeLapse *CreateFromCamera( const sp &camera, const sp &proxy, int32_t cameraId, Size videoSize, int32_t videoFrameRate, const sp& surface, int64_t timeBetweenTimeLapseFrameCaptureUs); virtual ~CameraSourceTimeLapse(); // If the frame capture interval is large, read will block for a long time. // Due to the way the mediaRecorder framework works, a stop() call from // mediaRecorder waits until the read returns, causing a long wait for // stop() to return. To avoid this, we can make read() return a copy of the // last read frame with the same time stamp frequently. This keeps the // read() call from blocking too long. Calling this function quickly // captures another frame, keeps its copy, and enables this mode of read() // returning quickly. void startQuickReadReturns(); private: // size of the encoded video. int32_t mVideoWidth; int32_t mVideoHeight; // Time between two frames in final video (1/frameRate) int64_t mTimeBetweenTimeLapseVideoFramesUs; // Real timestamp of the last encoded time lapse frame int64_t mLastTimeLapseFrameRealTimestampUs; // Variable set in dataCallbackTimestamp() to help skipCurrentFrame() // to know if current frame needs to be skipped. bool mSkipCurrentFrame; // Lock for accessing mCameraIdle Mutex mCameraIdleLock; // Condition variable to wait on if camera is is not yet idle. Once the // camera gets idle, this variable will be signalled. Condition mCameraIdleCondition; // True if camera is in preview mode and ready for takePicture(). // False after a call to takePicture() but before the final compressed // data callback has been called and preview has been restarted. volatile bool mCameraIdle; // True if stop() is waiting for camera to get idle, i.e. for the last // takePicture() to complete. This is needed so that dataCallbackTimestamp() // can return immediately. volatile bool mStopWaitingForIdleCamera; // Lock for accessing quick stop variables. Mutex mQuickStopLock; // mQuickStop is set to true if we use quick read() returns, otherwise it is set // to false. Once in this mode read() return a copy of the last read frame // with the same time stamp. See startQuickReadReturns(). volatile bool mQuickStop; // Forces the next frame passed to dataCallbackTimestamp() to be read // as a time lapse frame. Used by startQuickReadReturns() so that the next // frame wakes up any blocking read. volatile bool mForceRead; // Stores a copy of the MediaBuffer read in the last read() call after // mQuickStop was true. MediaBuffer* mLastReadBufferCopy; // Status code for last read. status_t mLastReadStatus; CameraSourceTimeLapse( const sp &camera, const sp &proxy, int32_t cameraId, Size videoSize, int32_t videoFrameRate, const sp& surface, int64_t timeBetweenTimeLapseFrameCaptureUs); // Wrapper over CameraSource::signalBufferReturned() to implement quick stop. // It only handles the case when mLastReadBufferCopy is signalled. Otherwise // it calls the base class' function. virtual void signalBufferReturned(MediaBuffer* buffer); // Wrapper over CameraSource::read() to implement quick stop. virtual status_t read(MediaBuffer **buffer, const ReadOptions *options = NULL); // mSkipCurrentFrame is set to true in dataCallbackTimestamp() if the current // frame needs to be skipped and this function just returns the value of mSkipCurrentFrame. virtual bool skipCurrentFrame(int64_t timestampUs); // In the video camera case calls skipFrameAndModifyTimeStamp() to modify // timestamp and set mSkipCurrentFrame. // Then it calls the base CameraSource::dataCallbackTimestamp() virtual void dataCallbackTimestamp(int64_t timestampUs, int32_t msgType, const sp &data); // Convenience function to fill mLastReadBufferCopy from the just read // buffer. void fillLastReadBufferCopy(MediaBuffer& sourceBuffer); // If the passed in size (width x height) is a supported video/preview size, // the function sets the camera's video/preview size to it and returns true. // Otherwise returns false. bool trySettingVideoSize(int32_t width, int32_t height); // When video camera is used for time lapse capture, returns true // until enough time has passed for the next time lapse frame. When // the frame needs to be encoded, it returns false and also modifies // the time stamp to be one frame time ahead of the last encoded // frame's time stamp. bool skipFrameAndModifyTimeStamp(int64_t *timestampUs); // Wrapper to enter threadTimeLapseEntry() static void *ThreadTimeLapseWrapper(void *me); // Creates a copy of source_data into a new memory of final type MemoryBase. sp createIMemoryCopy(const sp &source_data); CameraSourceTimeLapse(const CameraSourceTimeLapse &); CameraSourceTimeLapse &operator=(const CameraSourceTimeLapse &); }; } // namespace android #endif // CAMERA_SOURCE_TIME_LAPSE_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/StagefrightMediaScanner.h0000644000015700001700000000257512200324306031606 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef STAGEFRIGHT_MEDIA_SCANNER_H_ #define STAGEFRIGHT_MEDIA_SCANNER_H_ #include namespace android { struct StagefrightMediaScanner : public MediaScanner { StagefrightMediaScanner(); virtual ~StagefrightMediaScanner(); virtual MediaScanResult processFile( const char *path, const char *mimeType, MediaScannerClient &client); virtual char *extractAlbumArt(int fd); private: StagefrightMediaScanner(const StagefrightMediaScanner &); StagefrightMediaScanner &operator=(const StagefrightMediaScanner &); MediaScanResult processFileInternal( const char *path, const char *mimeType, MediaScannerClient &client); }; } // namespace android #endif // STAGEFRIGHT_MEDIA_SCANNER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/AMRWriter.h0000644000015700001700000000341712200324306026675 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef AMR_WRITER_H_ #define AMR_WRITER_H_ #include #include #include namespace android { struct MediaSource; struct MetaData; struct AMRWriter : public MediaWriter { AMRWriter(const char *filename); AMRWriter(int fd); status_t initCheck() const; virtual status_t addSource(const sp &source); virtual bool reachedEOS(); virtual status_t start(MetaData *params = NULL); virtual status_t stop() { return reset(); } virtual status_t pause(); protected: virtual ~AMRWriter(); private: int mFd; status_t mInitCheck; sp mSource; bool mStarted; volatile bool mPaused; volatile bool mResumed; volatile bool mDone; volatile bool mReachedEOS; pthread_t mThread; int64_t mEstimatedSizeBytes; int64_t mEstimatedDurationUs; static void *ThreadWrapper(void *); status_t threadFunc(); bool exceedsFileSizeLimit(); bool exceedsFileDurationLimit(); status_t reset(); AMRWriter(const AMRWriter &); AMRWriter &operator=(const AMRWriter &); }; } // namespace android #endif // AMR_WRITER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/AACWriter.h0000644000015700001700000000401312200324306026633 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef AAC_WRITER_H_ #define AAC_WRITER_H_ #include #include namespace android { struct MediaSource; struct MetaData; struct AACWriter : public MediaWriter { AACWriter(const char *filename); AACWriter(int fd); status_t initCheck() const; virtual status_t addSource(const sp &source); virtual bool reachedEOS(); virtual status_t start(MetaData *params = NULL); virtual status_t stop() { return reset(); } virtual status_t pause(); protected: virtual ~AACWriter(); private: enum { kAdtsHeaderLength = 7, // # of bytes for the adts header kSamplesPerFrame = 1024, // # of samples in a frame }; int mFd; status_t mInitCheck; sp mSource; bool mStarted; volatile bool mPaused; volatile bool mResumed; volatile bool mDone; volatile bool mReachedEOS; pthread_t mThread; int64_t mEstimatedSizeBytes; int64_t mEstimatedDurationUs; int32_t mChannelCount; int32_t mSampleRate; int32_t mAACProfile; int32_t mFrameDurationUs; static void *ThreadWrapper(void *); status_t threadFunc(); bool exceedsFileSizeLimit(); bool exceedsFileDurationLimit(); status_t writeAdtsHeader(uint32_t frameLength); status_t reset(); DISALLOW_EVIL_CONSTRUCTORS(AACWriter); }; } // namespace android #endif // AAC_WRITER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/MediaBufferGroup.h0000644000015700001700000000301412200324306030240 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MEDIA_BUFFER_GROUP_H_ #define MEDIA_BUFFER_GROUP_H_ #include #include #include namespace android { class MediaBuffer; class MetaData; class MediaBufferGroup : public MediaBufferObserver { public: MediaBufferGroup(); ~MediaBufferGroup(); void add_buffer(MediaBuffer *buffer); // Blocks until a buffer is available and returns it to the caller, // the returned buffer will have a reference count of 1. status_t acquire_buffer(MediaBuffer **buffer); protected: virtual void signalBufferReturned(MediaBuffer *buffer); private: friend class MediaBuffer; Mutex mLock; Condition mCondition; MediaBuffer *mFirstBuffer, *mLastBuffer; MediaBufferGroup(const MediaBufferGroup &); MediaBufferGroup &operator=(const MediaBufferGroup &); }; } // namespace android #endif // MEDIA_BUFFER_GROUP_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/FileSource.h0000644000015700001700000000342112200324306027114 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef FILE_SOURCE_H_ #define FILE_SOURCE_H_ #include #include #include #include #include namespace android { class FileSource : public DataSource { public: FileSource(const char *filename); FileSource(int fd, int64_t offset, int64_t length); virtual status_t initCheck() const; virtual ssize_t readAt(off64_t offset, void *data, size_t size); virtual status_t getSize(off64_t *size); virtual sp DrmInitialization(const char *mime); virtual void getDrmInfo(sp &handle, DrmManagerClient **client); protected: virtual ~FileSource(); private: int mFd; int64_t mOffset; int64_t mLength; Mutex mLock; /*for DRM*/ sp mDecryptHandle; DrmManagerClient *mDrmManagerClient; int64_t mDrmBufOffset; int64_t mDrmBufSize; unsigned char *mDrmBuf; ssize_t readAtDRM(off64_t offset, void *data, size_t size); FileSource(const FileSource &); FileSource &operator=(const FileSource &); }; } // namespace android #endif // FILE_SOURCE_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/MediaCodecList.h0000644000015700001700000000567712200324306027704 0ustar pbuserpbgroup00000000000000/* * Copyright 2012, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MEDIA_CODEC_LIST_H_ #define MEDIA_CODEC_LIST_H_ #include #include #include #include #include #include namespace android { struct MediaCodecList { static const MediaCodecList *getInstance(); ssize_t findCodecByType( const char *type, bool encoder, size_t startIndex = 0) const; ssize_t findCodecByName(const char *name) const; size_t countCodecs() const; const char *getCodecName(size_t index) const; bool isEncoder(size_t index) const; bool codecHasQuirk(size_t index, const char *quirkName) const; status_t getSupportedTypes(size_t index, Vector *types) const; struct ProfileLevel { uint32_t mProfile; uint32_t mLevel; }; status_t getCodecCapabilities( size_t index, const char *type, Vector *profileLevels, Vector *colorFormats) const; private: enum Section { SECTION_TOPLEVEL, SECTION_DECODERS, SECTION_DECODER, SECTION_ENCODERS, SECTION_ENCODER, }; struct CodecInfo { AString mName; bool mIsEncoder; uint32_t mTypes; uint32_t mQuirks; }; static MediaCodecList *sCodecList; status_t mInitCheck; Section mCurrentSection; int32_t mDepth; Vector mCodecInfos; KeyedVector mCodecQuirks; KeyedVector mTypes; MediaCodecList(); ~MediaCodecList(); status_t initCheck() const; void parseXMLFile(FILE *file); static void StartElementHandlerWrapper( void *me, const char *name, const char **attrs); static void EndElementHandlerWrapper(void *me, const char *name); void startElementHandler(const char *name, const char **attrs); void endElementHandler(const char *name); status_t addMediaCodecFromAttributes(bool encoder, const char **attrs); void addMediaCodec(bool encoder, const char *name, const char *type = NULL); status_t addQuirk(const char **attrs); status_t addTypeFromAttributes(const char **attrs); void addType(const char *name); DISALLOW_EVIL_CONSTRUCTORS(MediaCodecList); }; } // namespace android #endif // MEDIA_CODEC_LIST_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/NativeWindowWrapper.h0000644000015700001700000000275212200324306031041 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef NATIVE_WINDOW_WRAPPER_H_ #define NATIVE_WINDOW_WRAPPER_H_ #include namespace android { // SurfaceTextureClient derives from ANativeWindow which derives from multiple // base classes, in order to carry it in AMessages, we'll temporarily wrap it // into a NativeWindowWrapper. struct NativeWindowWrapper : RefBase { NativeWindowWrapper( const sp &surfaceTextureClient) : mSurfaceTextureClient(surfaceTextureClient) { } sp getNativeWindow() const { return mSurfaceTextureClient; } sp getSurfaceTextureClient() const { return mSurfaceTextureClient; } private: const sp mSurfaceTextureClient; DISALLOW_EVIL_CONSTRUCTORS(NativeWindowWrapper); }; } // namespace android #endif // NATIVE_WINDOW_WRAPPER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/YUVCanvas.h0000644000015700001700000000504112200324306026673 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // YUVCanvas holds a reference to a YUVImage on which it can do various // drawing operations. It provides various utility functions for filling, // cropping, etc. #ifndef YUV_CANVAS_H_ #define YUV_CANVAS_H_ #include namespace android { class YUVImage; class Rect; class YUVCanvas { public: // Constructor takes in reference to a yuvImage on which it can do // various drawing opreations. YUVCanvas(YUVImage &yuvImage); ~YUVCanvas(); // Fills the entire image with the given YUV values. void FillYUV(uint8_t yValue, uint8_t uValue, uint8_t vValue); // Fills the rectangular region [startX,endX]x[startY,endY] with the given YUV values. void FillYUVRectangle(const Rect& rect, uint8_t yValue, uint8_t uValue, uint8_t vValue); // Copies the region [startX,endX]x[startY,endY] from srcImage into the // canvas' target image (mYUVImage) starting at // (destinationStartX,destinationStartY). // Note that undefined behavior may occur if srcImage is same as the canvas' // target image. void CopyImageRect( const Rect& srcRect, int32_t destStartX, int32_t destStartY, const YUVImage &srcImage); // Downsamples the srcImage into the canvas' target image (mYUVImage) // The downsampling copies pixels from the source image starting at // (srcOffsetX, srcOffsetY) to the target image, starting at (0, 0). // For each X increment in the target image, skipX pixels are skipped // in the source image. // Similarly for each Y increment in the target image, skipY pixels // are skipped in the source image. void downsample( int32_t srcOffsetX, int32_t srcOffsetY, int32_t skipX, int32_t skipY, const YUVImage &srcImage); private: YUVImage& mYUVImage; YUVCanvas(const YUVCanvas &); YUVCanvas &operator=(const YUVCanvas &); }; } // namespace android #endif // YUV_CANVAS_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/CameraSource.h0000644000015700001700000001764712200324306027444 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CAMERA_SOURCE_H_ #define CAMERA_SOURCE_H_ #include #include #include #include #include #include #include namespace android { class IMemory; class Camera; class Surface; class CameraSource : public MediaSource, public MediaBufferObserver { public: /** * Factory method to create a new CameraSource using the current * settings (such as video size, frame rate, color format, etc) * from the default camera. * * @return NULL on error. */ static CameraSource *Create(); /** * Factory method to create a new CameraSource. * * @param camera the video input frame data source. If it is NULL, * we will try to connect to the camera with the given * cameraId. * * @param cameraId the id of the camera that the source will connect * to if camera is NULL; otherwise ignored. * * @param videoSize the dimension (in pixels) of the video frame * @param frameRate the target frames per second * @param surface the preview surface for display where preview * frames are sent to * @param storeMetaDataInVideoBuffers true to request the camera * source to store meta data in video buffers; false to * request the camera source to store real YUV frame data * in the video buffers. The camera source may not support * storing meta data in video buffers, if so, a request * to do that will NOT be honored. To find out whether * meta data is actually being stored in video buffers * during recording, call isMetaDataStoredInVideoBuffers(). * * @return NULL on error. */ static CameraSource *CreateFromCamera(const sp &camera, const sp &proxy, int32_t cameraId, Size videoSize, int32_t frameRate, const sp& surface, bool storeMetaDataInVideoBuffers = false); virtual ~CameraSource(); virtual status_t start(MetaData *params = NULL); virtual status_t stop() { return reset(); } virtual status_t read( MediaBuffer **buffer, const ReadOptions *options = NULL); /** * Check whether a CameraSource object is properly initialized. * Must call this method before stop(). * @return OK if initialization has successfully completed. */ virtual status_t initCheck() const; /** * Returns the MetaData associated with the CameraSource, * including: * kKeyColorFormat: YUV color format of the video frames * kKeyWidth, kKeyHeight: dimension (in pixels) of the video frames * kKeySampleRate: frame rate in frames per second * kKeyMIMEType: always fixed to be MEDIA_MIMETYPE_VIDEO_RAW */ virtual sp getFormat(); /** * Tell whether this camera source stores meta data or real YUV * frame data in video buffers. * * @return true if meta data is stored in the video * buffers; false if real YUV data is stored in * the video buffers. */ bool isMetaDataStoredInVideoBuffers() const; virtual void signalBufferReturned(MediaBuffer* buffer); protected: class ProxyListener: public BnCameraRecordingProxyListener { public: ProxyListener(const sp& source); virtual void dataCallbackTimestamp(int64_t timestampUs, int32_t msgType, const sp &data); private: sp mSource; }; // isBinderAlive needs linkToDeath to work. class DeathNotifier: public IBinder::DeathRecipient { public: DeathNotifier() {} virtual void binderDied(const wp& who); }; enum CameraFlags { FLAGS_SET_CAMERA = 1L << 0, FLAGS_HOT_CAMERA = 1L << 1, }; int32_t mCameraFlags; Size mVideoSize; int32_t mNumInputBuffers; int32_t mVideoFrameRate; int32_t mColorFormat; status_t mInitCheck; sp mCamera; sp mCameraRecordingProxy; sp mDeathNotifier; sp mSurface; sp mMeta; int64_t mStartTimeUs; int32_t mNumFramesReceived; int64_t mLastFrameTimestampUs; bool mStarted; int32_t mNumFramesEncoded; // Time between capture of two frames. int64_t mTimeBetweenFrameCaptureUs; CameraSource(const sp& camera, const sp& proxy, int32_t cameraId, Size videoSize, int32_t frameRate, const sp& surface, bool storeMetaDataInVideoBuffers); virtual void startCameraRecording(); virtual void releaseRecordingFrame(const sp& frame); // Returns true if need to skip the current frame. // Called from dataCallbackTimestamp. virtual bool skipCurrentFrame(int64_t timestampUs) {return false;} // Callback called when still camera raw data is available. virtual void dataCallback(int32_t msgType, const sp &data) {} virtual void dataCallbackTimestamp(int64_t timestampUs, int32_t msgType, const sp &data); private: friend class CameraSourceListener; Mutex mLock; Condition mFrameAvailableCondition; Condition mFrameCompleteCondition; List > mFramesReceived; List > mFramesBeingEncoded; List mFrameTimes; int64_t mFirstFrameTimeUs; int32_t mNumFramesDropped; int32_t mNumGlitches; int64_t mGlitchDurationThresholdUs; bool mCollectStats; bool mIsMetaDataStoredInVideoBuffers; void releaseQueuedFrames(); void releaseOneRecordingFrame(const sp& frame); status_t init(const sp& camera, const sp& proxy, int32_t cameraId, Size videoSize, int32_t frameRate, bool storeMetaDataInVideoBuffers); status_t initWithCameraAccess( const sp& camera, const sp& proxy, int32_t cameraId, Size videoSize, int32_t frameRate, bool storeMetaDataInVideoBuffers); status_t isCameraAvailable(const sp& camera, const sp& proxy, int32_t cameraId); status_t isCameraColorFormatSupported(const CameraParameters& params); status_t configureCamera(CameraParameters* params, int32_t width, int32_t height, int32_t frameRate); status_t checkVideoSize(const CameraParameters& params, int32_t width, int32_t height); status_t checkFrameRate(const CameraParameters& params, int32_t frameRate); void stopCameraRecording(); void releaseCamera(); status_t reset(); CameraSource(const CameraSource &); CameraSource &operator=(const CameraSource &); }; } // namespace android #endif // CAMERA_SOURCE_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/ColorConverter.h0000644000015700001700000000472612200324306030033 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef COLOR_CONVERTER_H_ #define COLOR_CONVERTER_H_ #include #include #include #include namespace android { struct ColorConverter { ColorConverter(OMX_COLOR_FORMATTYPE from, OMX_COLOR_FORMATTYPE to); ~ColorConverter(); bool isValid() const; status_t convert( const void *srcBits, size_t srcWidth, size_t srcHeight, size_t srcCropLeft, size_t srcCropTop, size_t srcCropRight, size_t srcCropBottom, void *dstBits, size_t dstWidth, size_t dstHeight, size_t dstCropLeft, size_t dstCropTop, size_t dstCropRight, size_t dstCropBottom); private: struct BitmapParams { BitmapParams( void *bits, size_t width, size_t height, size_t cropLeft, size_t cropTop, size_t cropRight, size_t cropBottom); size_t cropWidth() const; size_t cropHeight() const; void *mBits; size_t mWidth, mHeight; size_t mCropLeft, mCropTop, mCropRight, mCropBottom; }; OMX_COLOR_FORMATTYPE mSrcFormat, mDstFormat; uint8_t *mClip; uint8_t *initClip(); status_t convertCbYCrY( const BitmapParams &src, const BitmapParams &dst); status_t convertYUV420Planar( const BitmapParams &src, const BitmapParams &dst); status_t convertQCOMYUV420SemiPlanar( const BitmapParams &src, const BitmapParams &dst); status_t convertYUV420SemiPlanar( const BitmapParams &src, const BitmapParams &dst); status_t convertTIYUV420PackedSemiPlanar( const BitmapParams &src, const BitmapParams &dst); ColorConverter(const ColorConverter &); ColorConverter &operator=(const ColorConverter &); }; } // namespace android #endif // COLOR_CONVERTER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/OMXCodec.h0000644000015700001700000003230512200324306026460 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * Copyright (c) 2010 - 2012, The Linux Foundation. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef OMX_CODEC_H_ #define OMX_CODEC_H_ #include #include #include #include #ifdef QCOM_HARDWARE #include #endif #include #include namespace android { struct MediaCodecList; class MemoryDealer; struct OMXCodecObserver; struct CodecProfileLevel; class SkipCutBuffer; struct OMXCodec : public MediaSource, public MediaBufferObserver { enum CreationFlags { kPreferSoftwareCodecs = 1, kIgnoreCodecSpecificData = 2, // The client wants to access the output buffer's video // data for example for thumbnail extraction. kClientNeedsFramebuffer = 4, // Request for software or hardware codecs. If request // can not be fullfilled, Create() returns NULL. kSoftwareCodecsOnly = 8, kHardwareCodecsOnly = 16, // Store meta data in video buffers kStoreMetaDataInVideoBuffers = 32, // Only submit one input buffer at one time. kOnlySubmitOneInputBufferAtOneTime = 64, // Enable GRALLOC_USAGE_PROTECTED for output buffers from native window kEnableGrallocUsageProtected = 128, // Secure decoding mode kUseSecureInputBuffers = 256, }; static sp Create( const sp &omx, const sp &meta, bool createEncoder, const sp &source, const char *matchComponentName = NULL, uint32_t flags = 0, const sp &nativeWindow = NULL); static void setComponentRole( const sp &omx, IOMX::node_id node, bool isEncoder, const char *mime); virtual status_t start(MetaData *params = NULL); virtual status_t stop(); virtual sp getFormat(); virtual status_t read( MediaBuffer **buffer, const ReadOptions *options = NULL); virtual status_t pause(); // from MediaBufferObserver virtual void signalBufferReturned(MediaBuffer *buffer); enum Quirks { kNeedsFlushBeforeDisable = 1, kWantsNALFragments = 2, kRequiresLoadedToIdleAfterAllocation = 4, kRequiresAllocateBufferOnInputPorts = 8, kRequiresFlushCompleteEmulation = 16, kRequiresAllocateBufferOnOutputPorts = 32, kRequiresFlushBeforeShutdown = 64, kDefersOutputBufferAllocation = 128, kDecoderLiesAboutNumberOfChannels = 256, kInputBufferSizesAreBogus = 512, kSupportsMultipleFramesPerInputBuffer = 1024, kRequiresLargerEncoderOutputBuffer = 2048, kOutputBuffersAreUnreadable = 4096, #ifdef QCOM_HARDWARE kRequiresGlobalFlush = 0x20000000, // 2^29 kRequiresWMAProComponent = 0x40000000, //2^30 #endif #if defined(OMAP_ENHANCEMENT) kAvoidMemcopyInputRecordingFrames = 0x20000000, #endif }; struct CodecNameAndQuirks { String8 mName; uint32_t mQuirks; }; // for use by ACodec static void findMatchingCodecs( const char *mime, bool createEncoder, const char *matchComponentName, uint32_t flags, Vector *matchingCodecNamesAndQuirks); static uint32_t getComponentQuirks( const MediaCodecList *list, size_t index); static bool findCodecQuirks(const char *componentName, uint32_t *quirks); protected: virtual ~OMXCodec(); private: // Make sure mLock is accessible to OMXCodecObserver friend class OMXCodecObserver; #ifdef QCOM_HARDWARE // QCOMXCodec can access variables of OMXCodec friend class QCOMXCodec; #endif // Call this with mLock hold void on_message(const omx_message &msg); enum State { DEAD, LOADED, LOADED_TO_IDLE, IDLE_TO_EXECUTING, EXECUTING, EXECUTING_TO_IDLE, IDLE_TO_LOADED, RECONFIGURING, ERROR }; enum { #ifdef QCOM_HARDWARE kPortIndexBoth = -1, #endif kPortIndexInput = 0, kPortIndexOutput = 1 }; enum PortStatus { ENABLED, DISABLING, DISABLED, ENABLING, SHUTTING_DOWN, }; enum BufferStatus { OWNED_BY_US, OWNED_BY_COMPONENT, OWNED_BY_NATIVE_WINDOW, OWNED_BY_CLIENT, }; struct BufferInfo { IOMX::buffer_id mBuffer; BufferStatus mStatus; sp mMem; size_t mSize; void *mData; MediaBuffer *mMediaBuffer; }; struct CodecSpecificData { size_t mSize; uint8_t mData[1]; }; sp mOMX; bool mOMXLivesLocally; IOMX::node_id mNode; uint32_t mQuirks; // Flags specified in the creation of the codec. uint32_t mFlags; bool mIsEncoder; bool mIsVideo; char *mMIME; char *mComponentName; sp mOutputFormat; sp mSource; Vector mCodecSpecificData; size_t mCodecSpecificDataIndex; sp mDealer[2]; State mState; Vector mPortBuffers[2]; PortStatus mPortStatus[2]; bool mInitialBufferSubmit; bool mSignalledEOS; status_t mFinalStatus; bool mNoMoreOutputData; bool mOutputPortSettingsHaveChanged; int64_t mSeekTimeUs; ReadOptions::SeekMode mSeekMode; int64_t mTargetTimeUs; bool mOutputPortSettingsChangedPending; sp mSkipCutBuffer; MediaBuffer *mLeftOverBuffer; Mutex mLock; Condition mAsyncCompletion; bool mPaused; sp mNativeWindow; // The index in each of the mPortBuffers arrays of the buffer that will be // submitted to OMX next. This only applies when using buffers from a // native window. size_t mNextNativeBufferIndex[2]; // A list of indices into mPortStatus[kPortIndexOutput] filled with data. List mFilledBuffers; Condition mBufferFilled; // Used to record the decoding time for an output picture from // a video encoder. List mDecodingTimeList; OMXCodec(const sp &omx, IOMX::node_id node, uint32_t quirks, uint32_t flags, bool isEncoder, const char *mime, const char *componentName, const sp &source, const sp &nativeWindow); void addCodecSpecificData(const void *data, size_t size); void clearCodecSpecificData(); void setComponentRole(); void setAMRFormat(bool isWAMR, int32_t bitRate); status_t setAACFormat( int32_t numChannels, int32_t sampleRate, int32_t bitRate, int32_t aacProfile, bool isADTS); void setG711Format(int32_t numChannels); #ifdef QCOM_HARDWARE void setEVRCFormat( int32_t sampleRate, int32_t numChannels, int32_t bitRate); void setQCELPFormat( int32_t sampleRate, int32_t numChannels, int32_t bitRate); #endif status_t setVideoPortFormatType( OMX_U32 portIndex, OMX_VIDEO_CODINGTYPE compressionFormat, OMX_COLOR_FORMATTYPE colorFormat); void setVideoInputFormat( const char *mime, const sp& meta); status_t setupBitRate(int32_t bitRate); status_t setupErrorCorrectionParameters(); status_t setupH263EncoderParameters(const sp& meta); status_t setupMPEG4EncoderParameters(const sp& meta); status_t setupAVCEncoderParameters(const sp& meta); status_t findTargetColorFormat( const sp& meta, OMX_COLOR_FORMATTYPE *colorFormat); status_t isColorFormatSupported( OMX_COLOR_FORMATTYPE colorFormat, int portIndex); // If profile/level is set in the meta data, its value in the meta // data will be used; otherwise, the default value will be used. status_t getVideoProfileLevel(const sp& meta, const CodecProfileLevel& defaultProfileLevel, CodecProfileLevel& profileLevel); status_t setVideoOutputFormat( const char *mime, const sp& meta); void setImageOutputFormat( OMX_COLOR_FORMATTYPE format, OMX_U32 width, OMX_U32 height); void setJPEGInputFormat( OMX_U32 width, OMX_U32 height, OMX_U32 compressedSize); void setMinBufferSize(OMX_U32 portIndex, OMX_U32 size); void setRawAudioFormat( OMX_U32 portIndex, int32_t sampleRate, int32_t numChannels); status_t allocateBuffers(); status_t allocateBuffersOnPort(OMX_U32 portIndex); #ifdef USE_SAMSUNG_COLORFORMAT void setNativeWindowColorFormat(OMX_COLOR_FORMATTYPE &eNativeColorFormat); #endif status_t allocateOutputBuffersFromNativeWindow(); status_t queueBufferToNativeWindow(BufferInfo *info); status_t cancelBufferToNativeWindow(BufferInfo *info); BufferInfo* dequeueBufferFromNativeWindow(); status_t pushBlankBuffersToNativeWindow(); status_t freeBuffersOnPort( OMX_U32 portIndex, bool onlyThoseWeOwn = false); status_t freeBuffer(OMX_U32 portIndex, size_t bufIndex); bool drainInputBuffer(IOMX::buffer_id buffer); void fillOutputBuffer(IOMX::buffer_id buffer); bool drainInputBuffer(BufferInfo *info); void fillOutputBuffer(BufferInfo *info); void drainInputBuffers(); void fillOutputBuffers(); bool drainAnyInputBuffer(); BufferInfo *findInputBufferByDataPointer(void *ptr); BufferInfo *findEmptyInputBuffer(); // Returns true iff a flush was initiated and a completion event is // upcoming, false otherwise (A flush was not necessary as we own all // the buffers on that port). // This method will ONLY ever return false for a component with quirk // "kRequiresFlushCompleteEmulation". bool flushPortAsync(OMX_U32 portIndex); void disablePortAsync(OMX_U32 portIndex); status_t enablePortAsync(OMX_U32 portIndex); static size_t countBuffersWeOwn(const Vector &buffers); static bool isIntermediateState(State state); void onEvent(OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2); void onCmdComplete(OMX_COMMANDTYPE cmd, OMX_U32 data); void onStateChange(OMX_STATETYPE newState); void onPortSettingsChanged(OMX_U32 portIndex); void setState(State newState); status_t init(); void initOutputFormat(const sp &inputFormat); status_t initNativeWindow(); void initNativeWindowCrop(); void dumpPortStatus(OMX_U32 portIndex); status_t configureCodec(const sp &meta); #if defined(OMAP_ENHANCEMENT) void restorePatchedDataPointer(BufferInfo *info); #endif status_t applyRotation(); status_t waitForBufferFilled_l(); int64_t getDecodingTimeUs(); status_t parseAVCCodecSpecificData( const void *data, size_t size, unsigned *profile, unsigned *level); status_t stopOmxComponent_l(); OMXCodec(const OMXCodec &); OMXCodec &operator=(const OMXCodec &); #ifdef QCOM_HARDWARE status_t setWMAFormat(const sp &inputFormat); void setAC3Format(int32_t numChannels, int32_t sampleRate); #endif }; struct CodecCapabilities { String8 mComponentName; Vector mProfileLevels; Vector mColorFormats; }; // Return a vector of componentNames with supported profile/level pairs // supporting the given mime type, if queryDecoders==true, returns components // that decode content of the given type, otherwise returns components // that encode content of the given type. // profile and level indications only make sense for h.263, mpeg4 and avc // video. // If hwCodecOnly==true, only returns hardware-based components, software and // hardware otherwise. // The profile/level values correspond to // OMX_VIDEO_H263PROFILETYPE, OMX_VIDEO_MPEG4PROFILETYPE, // OMX_VIDEO_AVCPROFILETYPE, OMX_VIDEO_H263LEVELTYPE, OMX_VIDEO_MPEG4LEVELTYPE // and OMX_VIDEO_AVCLEVELTYPE respectively. status_t QueryCodecs( const sp &omx, const char *mimeType, bool queryDecoders, bool hwCodecOnly, Vector *results); status_t QueryCodecs( const sp &omx, const char *mimeType, bool queryDecoders, Vector *results); status_t QueryCodec( const sp &omx, const char *componentName, const char *mime, bool isEncoder, CodecCapabilities *caps); status_t getOMXChannelMapping(size_t numChannels, OMX_AUDIO_CHANNELTYPE map[]); } // namespace android #endif // OMX_CODEC_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/SurfaceMediaSource.h0000644000015700001700000002161212200324306030567 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_GUI_SURFACEMEDIASOURCE_H #define ANDROID_GUI_SURFACEMEDIASOURCE_H #include #include #include #include #include #include namespace android { // ---------------------------------------------------------------------------- class IGraphicBufferAlloc; class String8; class GraphicBuffer; // ASSUMPTIONS // 1. SurfaceMediaSource is initialized with width*height which // can never change. However, deqeueue buffer does not currently // enforce this as in BufferQueue, dequeue can be used by SurfaceTexture // which can modify the default width and heght. Also neither the width // nor height can be 0. // 2. setSynchronousMode is never used (basically no one should call // setSynchronousMode(false) // 3. setCrop, setTransform, setScalingMode should never be used // 4. queueBuffer returns a filled buffer to the SurfaceMediaSource. In addition, a // timestamp must be provided for the buffer. The timestamp is in // nanoseconds, and must be monotonically increasing. Its other semantics // (zero point, etc) are client-dependent and should be documented by the // client. // 5. Once disconnected, SurfaceMediaSource can be reused (can not // connect again) // 6. Stop is a hard stop, the last few frames held by the encoder // may be dropped. It is possible to wait for the buffers to be // returned (but not implemented) #define DEBUG_PENDING_BUFFERS 0 class SurfaceMediaSource : public MediaSource, public MediaBufferObserver, protected BufferQueue::ConsumerListener { public: enum { MIN_UNDEQUEUED_BUFFERS = 4}; struct FrameAvailableListener : public virtual RefBase { // onFrameAvailable() is called from queueBuffer() is the FIFO is // empty. You can use SurfaceMediaSource::getQueuedCount() to // figure out if there are more frames waiting. // This is called without any lock held can be called concurrently by // multiple threads. virtual void onFrameAvailable() = 0; }; SurfaceMediaSource(uint32_t bufferWidth, uint32_t bufferHeight); virtual ~SurfaceMediaSource(); // For the MediaSource interface for use by StageFrightRecorder: virtual status_t start(MetaData *params = NULL); virtual status_t stop(); virtual status_t read(MediaBuffer **buffer, const ReadOptions *options = NULL); virtual sp getFormat(); // Get / Set the frame rate used for encoding. Default fps = 30 status_t setFrameRate(int32_t fps) ; int32_t getFrameRate( ) const; // The call for the StageFrightRecorder to tell us that // it is done using the MediaBuffer data so that its state // can be set to FREE for dequeuing virtual void signalBufferReturned(MediaBuffer* buffer); // end of MediaSource interface // getTimestamp retrieves the timestamp associated with the image // set by the most recent call to read() // // The timestamp is in nanoseconds, and is monotonically increasing. Its // other semantics (zero point, etc) are source-dependent and should be // documented by the source. int64_t getTimestamp(); // setFrameAvailableListener sets the listener object that will be notified // when a new frame becomes available. void setFrameAvailableListener(const sp& listener); // dump our state in a String void dump(String8& result) const; void dump(String8& result, const char* prefix, char* buffer, size_t SIZE) const; // isMetaDataStoredInVideoBuffers tells the encoder whether we will // pass metadata through the buffers. Currently, it is force set to true bool isMetaDataStoredInVideoBuffers() const; sp getBufferQueue() const { return mBufferQueue; } // To be called before start() status_t setMaxAcquiredBufferCount(size_t count); // To be called before start() status_t setUseAbsoluteTimestamps(); protected: // Implementation of the BufferQueue::ConsumerListener interface. These // calls are used to notify the SurfaceTexture of asynchronous events in the // BufferQueue. virtual void onFrameAvailable(); // Used as a hook to BufferQueue::disconnect() // This is called by the client side when it is done // TODO: Currently, this also sets mStopped to true which // is needed for unblocking the encoder which might be // waiting to read more frames. So if on the client side, // the same thread supplies the frames and also calls stop // on the encoder, the client has to call disconnect before // it calls stop. // In the case of the camera, // that need not be required since the thread supplying the // frames is separate than the one calling stop. virtual void onBuffersReleased(); static bool isExternalFormat(uint32_t format); private: // mBufferQueue is the exchange point between the producer and // this consumer sp mBufferQueue; // mBufferSlot caches GraphicBuffers from the buffer queue sp mBufferSlot[BufferQueue::NUM_BUFFER_SLOTS]; // The permenent width and height of SMS buffers int mWidth; int mHeight; // mCurrentSlot is the buffer slot index of the buffer that is currently // being used by buffer consumer // (e.g. StageFrightRecorder in the case of SurfaceMediaSource or GLTexture // in the case of SurfaceTexture). // It is initialized to INVALID_BUFFER_SLOT, // indicating that no buffer slot is currently bound to the texture. Note, // however, that a value of INVALID_BUFFER_SLOT does not necessarily mean // that no buffer is bound to the texture. A call to setBufferCount will // reset mCurrentTexture to INVALID_BUFFER_SLOT. int mCurrentSlot; // mCurrentBuffers is a list of the graphic buffers that are being used by // buffer consumer (i.e. the video encoder). It's possible that these // buffers are not associated with any buffer slots, so we must track them // separately. Buffers are added to this list in read, and removed from // this list in signalBufferReturned Vector > mCurrentBuffers; size_t mNumPendingBuffers; #if DEBUG_PENDING_BUFFERS Vector mPendingBuffers; #endif // mCurrentTimestamp is the timestamp for the current texture. It // gets set to mLastQueuedTimestamp each time updateTexImage is called. int64_t mCurrentTimestamp; // mFrameAvailableListener is the listener object that will be called when a // new frame becomes available. If it is not NULL it will be called from // queueBuffer. sp mFrameAvailableListener; // mMutex is the mutex used to prevent concurrent access to the member // variables of SurfaceMediaSource objects. It must be locked whenever the // member variables are accessed. mutable Mutex mMutex; ////////////////////////// For MediaSource // Set to a default of 30 fps if not specified by the client side int32_t mFrameRate; // mStarted is a flag to check if the recording is going on bool mStarted; // mNumFramesReceived indicates the number of frames recieved from // the client side int mNumFramesReceived; // mNumFramesEncoded indicates the number of frames passed on to the // encoder int mNumFramesEncoded; // mFirstFrameTimestamp is the timestamp of the first received frame. // It is used to offset the output timestamps so recording starts at time 0. int64_t mFirstFrameTimestamp; // mStartTimeNs is the start time passed into the source at start, used to // offset timestamps. int64_t mStartTimeNs; size_t mMaxAcquiredBufferCount; bool mUseAbsoluteTimestamps; // mFrameAvailableCondition condition used to indicate whether there // is a frame available for dequeuing Condition mFrameAvailableCondition; Condition mMediaBuffersAvailableCondition; // Avoid copying and equating and default constructor DISALLOW_IMPLICIT_CONSTRUCTORS(SurfaceMediaSource); }; // ---------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_GUI_SURFACEMEDIASOURCE_H android-audiosystem-1.8+13.10.20130807/include/media/stagefright/MediaErrors.h0000644000015700001700000000516112200324306027273 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MEDIA_ERRORS_H_ #define MEDIA_ERRORS_H_ #include namespace android { enum { MEDIA_ERROR_BASE = -1000, ERROR_ALREADY_CONNECTED = MEDIA_ERROR_BASE, ERROR_NOT_CONNECTED = MEDIA_ERROR_BASE - 1, ERROR_UNKNOWN_HOST = MEDIA_ERROR_BASE - 2, ERROR_CANNOT_CONNECT = MEDIA_ERROR_BASE - 3, ERROR_IO = MEDIA_ERROR_BASE - 4, ERROR_CONNECTION_LOST = MEDIA_ERROR_BASE - 5, ERROR_MALFORMED = MEDIA_ERROR_BASE - 7, ERROR_OUT_OF_RANGE = MEDIA_ERROR_BASE - 8, ERROR_BUFFER_TOO_SMALL = MEDIA_ERROR_BASE - 9, ERROR_UNSUPPORTED = MEDIA_ERROR_BASE - 10, ERROR_END_OF_STREAM = MEDIA_ERROR_BASE - 11, // Not technically an error. INFO_FORMAT_CHANGED = MEDIA_ERROR_BASE - 12, INFO_DISCONTINUITY = MEDIA_ERROR_BASE - 13, INFO_OUTPUT_BUFFERS_CHANGED = MEDIA_ERROR_BASE - 14, // The following constant values should be in sync with // drm/drm_framework_common.h DRM_ERROR_BASE = -2000, ERROR_DRM_UNKNOWN = DRM_ERROR_BASE, ERROR_DRM_NO_LICENSE = DRM_ERROR_BASE - 1, ERROR_DRM_LICENSE_EXPIRED = DRM_ERROR_BASE - 2, ERROR_DRM_SESSION_NOT_OPENED = DRM_ERROR_BASE - 3, ERROR_DRM_DECRYPT_UNIT_NOT_INITIALIZED = DRM_ERROR_BASE - 4, ERROR_DRM_DECRYPT = DRM_ERROR_BASE - 5, ERROR_DRM_CANNOT_HANDLE = DRM_ERROR_BASE - 6, ERROR_DRM_TAMPER_DETECTED = DRM_ERROR_BASE - 7, ERROR_DRM_VENDOR_MAX = DRM_ERROR_BASE - 500, ERROR_DRM_VENDOR_MIN = DRM_ERROR_BASE - 999, // Deprecated ERROR_DRM_WV_VENDOR_MAX = ERROR_DRM_VENDOR_MAX, ERROR_DRM_WV_VENDOR_MIN = ERROR_DRM_VENDOR_MIN, // Heartbeat Error Codes HEARTBEAT_ERROR_BASE = -3000, ERROR_HEARTBEAT_TERMINATE_REQUESTED = HEARTBEAT_ERROR_BASE, }; } // namespace android #endif // MEDIA_ERRORS_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/AudioPlayer.h0000644000015700001700000000662512200324306027303 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef AUDIO_PLAYER_H_ #define AUDIO_PLAYER_H_ #include #include #include #include namespace android { class MediaSource; class AudioTrack; class AwesomePlayer; class AudioPlayer : public TimeSource { public: enum { REACHED_EOS, SEEK_COMPLETE }; AudioPlayer(const sp &audioSink, bool allowDeepBuffering = false, AwesomePlayer *audioObserver = NULL); virtual ~AudioPlayer(); // Caller retains ownership of "source". virtual void setSource(const sp &source); // Return time in us. virtual int64_t getRealTimeUs(); virtual status_t start(bool sourceAlreadyStarted = false); virtual void pause(bool playPendingSamples = false); virtual void resume(); // Returns the timestamp of the last buffer played (in us). virtual int64_t getMediaTimeUs(); // Returns true iff a mapping is established, i.e. the AudioPlayer // has played at least one frame of audio. virtual bool getMediaTimeMapping(int64_t *realtime_us, int64_t *mediatime_us); virtual status_t seekTo(int64_t time_us); virtual bool isSeeking(); virtual bool reachedEOS(status_t *finalStatus); status_t setPlaybackRatePermille(int32_t ratePermille); private: friend class VideoEditorAudioPlayer; sp mSource; AudioTrack *mAudioTrack; MediaBuffer *mInputBuffer; int mSampleRate; int64_t mLatencyUs; size_t mFrameSize; Mutex mLock; int64_t mNumFramesPlayed; int64_t mNumFramesPlayedSysTimeUs; int64_t mPositionTimeMediaUs; int64_t mPositionTimeRealUs; bool mSeeking; bool mReachedEOS; status_t mFinalStatus; int64_t mSeekTimeUs; bool mStarted; #ifdef QCOM_HARDWARE bool mSourcePaused; #endif bool mIsFirstBuffer; status_t mFirstBufferResult; MediaBuffer *mFirstBuffer; sp mAudioSink; bool mAllowDeepBuffering; // allow audio deep audio buffers. Helps with low power audio // playback but implies high latency AwesomePlayer *mObserver; int64_t mPinnedTimeUs; static void AudioCallback(int event, void *user, void *info); void AudioCallback(int event, void *info); static size_t AudioSinkCallback( MediaPlayerBase::AudioSink *audioSink, void *data, size_t size, void *me); size_t fillBuffer(void *data, size_t size); int64_t getRealTimeUsLocked() const; void reset(); uint32_t getNumFramesPendingPlayout() const; AudioPlayer(const AudioPlayer &); AudioPlayer &operator=(const AudioPlayer &); }; } // namespace android #endif // AUDIO_PLAYER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/MediaCodec.h0000644000015700001700000001553412200324306027041 0ustar pbuserpbgroup00000000000000/* * Copyright 2012, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MEDIA_CODEC_H_ #define MEDIA_CODEC_H_ #include #include #include #include namespace android { struct ABuffer; struct ACodec; struct AMessage; struct AString; struct ICrypto; struct SoftwareRenderer; struct SurfaceTextureClient; struct MediaCodec : public AHandler { enum ConfigureFlags { CONFIGURE_FLAG_ENCODE = 1, }; enum BufferFlags { BUFFER_FLAG_SYNCFRAME = 1, BUFFER_FLAG_CODECCONFIG = 2, BUFFER_FLAG_EOS = 4, }; static sp CreateByType( const sp &looper, const char *mime, bool encoder); static sp CreateByComponentName( const sp &looper, const char *name); status_t configure( const sp &format, const sp &nativeWindow, const sp &crypto, uint32_t flags); status_t start(); // Returns to a state in which the component remains allocated but // unconfigured. status_t stop(); // Client MUST call release before releasing final reference to this // object. status_t release(); status_t flush(); status_t queueInputBuffer( size_t index, size_t offset, size_t size, int64_t presentationTimeUs, uint32_t flags, AString *errorDetailMsg = NULL); status_t queueSecureInputBuffer( size_t index, size_t offset, const CryptoPlugin::SubSample *subSamples, size_t numSubSamples, const uint8_t key[16], const uint8_t iv[16], CryptoPlugin::Mode mode, int64_t presentationTimeUs, uint32_t flags, AString *errorDetailMsg = NULL); status_t dequeueInputBuffer(size_t *index, int64_t timeoutUs = 0ll); status_t dequeueOutputBuffer( size_t *index, size_t *offset, size_t *size, int64_t *presentationTimeUs, uint32_t *flags, int64_t timeoutUs = 0ll); status_t renderOutputBufferAndRelease(size_t index); status_t releaseOutputBuffer(size_t index); status_t getOutputFormat(sp *format) const; status_t getInputBuffers(Vector > *buffers) const; status_t getOutputBuffers(Vector > *buffers) const; status_t requestIDRFrame(); // Notification will be posted once there "is something to do", i.e. // an input/output buffer has become available, a format change is // pending, an error is pending. void requestActivityNotification(const sp ¬ify); protected: virtual ~MediaCodec(); virtual void onMessageReceived(const sp &msg); private: enum State { UNINITIALIZED, INITIALIZING, INITIALIZED, CONFIGURING, CONFIGURED, STARTING, STARTED, FLUSHING, STOPPING, RELEASING, }; enum { kPortIndexInput = 0, kPortIndexOutput = 1, }; enum { kWhatInit = 'init', kWhatConfigure = 'conf', kWhatStart = 'strt', kWhatStop = 'stop', kWhatRelease = 'rele', kWhatDequeueInputBuffer = 'deqI', kWhatQueueInputBuffer = 'queI', kWhatDequeueOutputBuffer = 'deqO', kWhatReleaseOutputBuffer = 'relO', kWhatGetBuffers = 'getB', kWhatFlush = 'flus', kWhatGetOutputFormat = 'getO', kWhatDequeueInputTimedOut = 'dITO', kWhatDequeueOutputTimedOut = 'dOTO', kWhatCodecNotify = 'codc', kWhatRequestIDRFrame = 'ridr', kWhatRequestActivityNotification = 'racN', }; enum { kFlagIsSoftwareCodec = 1, kFlagOutputFormatChanged = 2, kFlagOutputBuffersChanged = 4, kFlagStickyError = 8, kFlagDequeueInputPending = 16, kFlagDequeueOutputPending = 32, kFlagIsSecure = 64, }; struct BufferInfo { void *mBufferID; sp mData; sp mEncryptedData; sp mNotify; bool mOwnedByClient; }; State mState; sp mLooper; sp mCodecLooper; sp mCodec; uint32_t mReplyID; uint32_t mFlags; sp mNativeWindow; SoftwareRenderer *mSoftRenderer; sp mOutputFormat; List mAvailPortBuffers[2]; Vector mPortBuffers[2]; int32_t mDequeueInputTimeoutGeneration; uint32_t mDequeueInputReplyID; int32_t mDequeueOutputTimeoutGeneration; uint32_t mDequeueOutputReplyID; sp mCrypto; List > mCSD; sp mActivityNotify; MediaCodec(const sp &looper); static status_t PostAndAwaitResponse( const sp &msg, sp *response); status_t init(const char *name, bool nameIsType, bool encoder); void setState(State newState); void returnBuffersToCodec(); void returnBuffersToCodecOnPort(int32_t portIndex); size_t updateBuffers(int32_t portIndex, const sp &msg); status_t onQueueInputBuffer(const sp &msg); status_t onReleaseOutputBuffer(const sp &msg); ssize_t dequeuePortBuffer(int32_t portIndex); bool handleDequeueInputBuffer(uint32_t replyID, bool newRequest = false); bool handleDequeueOutputBuffer(uint32_t replyID, bool newRequest = false); void cancelPendingDequeueOperations(); void extractCSD(const sp &format); status_t queueCSDInputBuffer(size_t bufferIndex); status_t setNativeWindow( const sp &surfaceTextureClient); void postActivityNotificationIfPossible(); DISALLOW_EVIL_CONSTRUCTORS(MediaCodec); }; } // namespace android #endif // MEDIA_CODEC_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/MediaSource.h0000644000015700001700000000745112200324306027263 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MEDIA_SOURCE_H_ #define MEDIA_SOURCE_H_ #include #include #include #include namespace android { class MediaBuffer; class MetaData; struct MediaSource : public virtual RefBase { MediaSource(); // To be called before any other methods on this object, except // getFormat(). virtual status_t start(MetaData *params = NULL) = 0; // Any blocking read call returns immediately with a result of NO_INIT. // It is an error to call any methods other than start after this call // returns. Any buffers the object may be holding onto at the time of // the stop() call are released. // Also, it is imperative that any buffers output by this object and // held onto by callers be released before a call to stop() !!! virtual status_t stop() = 0; // Returns the format of the data output by this media source. virtual sp getFormat() = 0; struct ReadOptions; // Returns a new buffer of data. Call blocks until a // buffer is available, an error is encountered of the end of the stream // is reached. // End of stream is signalled by a result of ERROR_END_OF_STREAM. // A result of INFO_FORMAT_CHANGED indicates that the format of this // MediaSource has changed mid-stream, the client can continue reading // but should be prepared for buffers of the new configuration. virtual status_t read( MediaBuffer **buffer, const ReadOptions *options = NULL) = 0; // Options that modify read() behaviour. The default is to // a) not request a seek // b) not be late, i.e. lateness_us = 0 struct ReadOptions { enum SeekMode { SEEK_PREVIOUS_SYNC, SEEK_NEXT_SYNC, SEEK_CLOSEST_SYNC, SEEK_CLOSEST, }; ReadOptions(); // Reset everything back to defaults. void reset(); void setSeekTo(int64_t time_us, SeekMode mode = SEEK_CLOSEST_SYNC); void clearSeekTo(); bool getSeekTo(int64_t *time_us, SeekMode *mode) const; void setLateBy(int64_t lateness_us); int64_t getLateBy() const; private: enum Options { kSeekTo_Option = 1, }; uint32_t mOptions; int64_t mSeekTimeUs; SeekMode mSeekMode; int64_t mLatenessUs; }; // Causes this source to suspend pulling data from its upstream source // until a subsequent read-with-seek. Currently only supported by // OMXCodec. virtual status_t pause() { return ERROR_UNSUPPORTED; } // The consumer of this media source requests that the given buffers // are to be returned exclusively in response to read calls. // This will be called after a successful start() and before the // first read() call. // Callee assumes ownership of the buffers if no error is returned. virtual status_t setBuffers(const Vector &buffers) { return ERROR_UNSUPPORTED; } protected: virtual ~MediaSource(); private: MediaSource(const MediaSource &); MediaSource &operator=(const MediaSource &); }; } // namespace android #endif // MEDIA_SOURCE_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/MPEG4Writer.h0000644000015700001700000001405412200324306027071 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MPEG4_WRITER_H_ #define MPEG4_WRITER_H_ #include #include #include #include namespace android { class MediaBuffer; class MediaSource; class MetaData; class MPEG4Writer : public MediaWriter { public: MPEG4Writer(const char *filename); MPEG4Writer(int fd); virtual status_t addSource(const sp &source); virtual status_t start(MetaData *param = NULL); virtual status_t stop() { return reset(); } virtual status_t pause(); virtual bool reachedEOS(); virtual status_t dump(int fd, const Vector& args); void beginBox(const char *fourcc); void writeInt8(int8_t x); void writeInt16(int16_t x); void writeInt32(int32_t x); void writeInt64(int64_t x); void writeCString(const char *s); void writeFourcc(const char *fourcc); void write(const void *data, size_t size); inline size_t write(const void *ptr, size_t size, size_t nmemb); void endBox(); uint32_t interleaveDuration() const { return mInterleaveDurationUs; } status_t setInterleaveDuration(uint32_t duration); int32_t getTimeScale() const { return mTimeScale; } status_t setGeoData(int latitudex10000, int longitudex10000); void setStartTimeOffsetMs(int ms) { mStartTimeOffsetMs = ms; } int32_t getStartTimeOffsetMs() const { return mStartTimeOffsetMs; } protected: virtual ~MPEG4Writer(); private: class Track; int mFd; status_t mInitCheck; bool mUse4ByteNalLength; bool mUse32BitOffset; bool mIsFileSizeLimitExplicitlyRequested; bool mPaused; bool mStarted; // Writer thread + track threads started successfully bool mWriterThreadStarted; // Only writer thread started successfully off64_t mOffset; off_t mMdatOffset; uint8_t *mMoovBoxBuffer; off64_t mMoovBoxBufferOffset; bool mWriteMoovBoxToMemory; off64_t mFreeBoxOffset; bool mStreamableFile; off64_t mEstimatedMoovBoxSize; uint32_t mInterleaveDurationUs; int32_t mTimeScale; int64_t mStartTimestampUs; int mLatitudex10000; int mLongitudex10000; bool mAreGeoTagsAvailable; int32_t mStartTimeOffsetMs; Mutex mLock; List mTracks; List mBoxes; void setStartTimestampUs(int64_t timeUs); int64_t getStartTimestampUs(); // Not const status_t startTracks(MetaData *params); size_t numTracks(); int64_t estimateMoovBoxSize(int32_t bitRate); struct Chunk { Track *mTrack; // Owner int64_t mTimeStampUs; // Timestamp of the 1st sample List mSamples; // Sample data // Convenient constructor Chunk(): mTrack(NULL), mTimeStampUs(0) {} Chunk(Track *track, int64_t timeUs, List samples) : mTrack(track), mTimeStampUs(timeUs), mSamples(samples) { } }; struct ChunkInfo { Track *mTrack; // Owner List mChunks; // Remaining chunks to be written // Previous chunk timestamp that has been written int64_t mPrevChunkTimestampUs; // Max time interval between neighboring chunks int64_t mMaxInterChunkDurUs; }; bool mIsFirstChunk; volatile bool mDone; // Writer thread is done? pthread_t mThread; // Thread id for the writer List mChunkInfos; // Chunk infos Condition mChunkReadyCondition; // Signal that chunks are available // Writer thread handling status_t startWriterThread(); void stopWriterThread(); static void *ThreadWrapper(void *me); void threadFunc(); // Buffer a single chunk to be written out later. void bufferChunk(const Chunk& chunk); // Write all buffered chunks from all tracks void writeAllChunks(); // Retrieve the proper chunk to write if there is one // Return true if a chunk is found; otherwise, return false. bool findChunkToWrite(Chunk *chunk); // Actually write the given chunk to the file. void writeChunkToFile(Chunk* chunk); // Adjust other track media clock (presumably wall clock) // based on audio track media clock with the drift time. int64_t mDriftTimeUs; void setDriftTimeUs(int64_t driftTimeUs); int64_t getDriftTimeUs(); // Return whether the nal length is 4 bytes or 2 bytes // Only makes sense for H.264/AVC bool useNalLengthFour(); void lock(); void unlock(); // Acquire lock before calling these methods off64_t addSample_l(MediaBuffer *buffer); off64_t addLengthPrefixedSample_l(MediaBuffer *buffer); bool exceedsFileSizeLimit(); bool use32BitFileOffset() const; bool exceedsFileDurationLimit(); bool isFileStreamable() const; void trackProgressStatus(size_t trackId, int64_t timeUs, status_t err = OK); void writeCompositionMatrix(int32_t degrees); void writeMvhdBox(int64_t durationUs); void writeMoovBox(int64_t durationUs); void writeFtypBox(MetaData *param); void writeUdtaBox(); void writeGeoDataBox(); void writeLatitude(int degreex10000); void writeLongitude(int degreex10000); void sendSessionSummary(); void release(); status_t reset(); static uint32_t getMpeg4Time(); MPEG4Writer(const MPEG4Writer &); MPEG4Writer &operator=(const MPEG4Writer &); }; } // namespace android #endif // MPEG4_WRITER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/Utils.h0000644000015700001700000000254012200324306026155 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef UTILS_H_ #define UTILS_H_ #include #include #include namespace android { #define FOURCC(c1, c2, c3, c4) \ (c1 << 24 | c2 << 16 | c3 << 8 | c4) uint16_t U16_AT(const uint8_t *ptr); uint32_t U32_AT(const uint8_t *ptr); uint64_t U64_AT(const uint8_t *ptr); uint16_t U16LE_AT(const uint8_t *ptr); uint32_t U32LE_AT(const uint8_t *ptr); uint64_t U64LE_AT(const uint8_t *ptr); uint64_t ntoh64(uint64_t x); uint64_t hton64(uint64_t x); struct MetaData; struct AMessage; status_t convertMetaDataToMessage( const sp &meta, sp *format); void convertMessageToMetaData( const sp &format, sp &meta); } // namespace android #endif // UTILS_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/DataSource.h0000644000015700001700000000563012200324306027112 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef DATA_SOURCE_H_ #define DATA_SOURCE_H_ #include #include #include #include #include #include #include #include namespace android { struct AMessage; class String8; class DataSource : public RefBase { public: enum Flags { kWantsPrefetching = 1, kStreamedFromLocalHost = 2, kIsCachingDataSource = 4, kIsHTTPBasedSource = 8, }; static sp CreateFromURI( const char *uri, const KeyedVector *headers = NULL); DataSource() {} virtual status_t initCheck() const = 0; virtual ssize_t readAt(off64_t offset, void *data, size_t size) = 0; // Convenience methods: bool getUInt16(off64_t offset, uint16_t *x); // May return ERROR_UNSUPPORTED. virtual status_t getSize(off64_t *size); virtual uint32_t flags() { return 0; } virtual status_t reconnectAtOffset(off64_t offset) { return ERROR_UNSUPPORTED; } //////////////////////////////////////////////////////////////////////////// bool sniff(String8 *mimeType, float *confidence, sp *meta); // The sniffer can optionally fill in "meta" with an AMessage containing // a dictionary of values that helps the corresponding extractor initialize // its state without duplicating effort already exerted by the sniffer. typedef bool (*SnifferFunc)( const sp &source, String8 *mimeType, float *confidence, sp *meta); static void RegisterSniffer(SnifferFunc func); static void RegisterDefaultSniffers(); // for DRM virtual sp DrmInitialization(const char *mime = NULL) { return NULL; } virtual void getDrmInfo(sp &handle, DrmManagerClient **client) {}; virtual String8 getUri() { return String8(); } virtual String8 getMIMEType() const; protected: virtual ~DataSource() {} private: static Mutex gSnifferMutex; static List gSniffers; DataSource(const DataSource &); DataSource &operator=(const DataSource &); }; } // namespace android #endif // DATA_SOURCE_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/NuMediaExtractor.h0000644000015700001700000000615612200324306030302 0ustar pbuserpbgroup00000000000000/* * Copyright 2012, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef NU_MEDIA_EXTRACTOR_H_ #define NU_MEDIA_EXTRACTOR_H_ #include #include #include #include #include #include #include #include namespace android { struct ABuffer; struct AMessage; struct DataSource; struct MediaBuffer; struct MediaExtractor; struct MediaSource; struct MetaData; struct NuMediaExtractor : public RefBase { enum SampleFlags { SAMPLE_FLAG_SYNC = 1, SAMPLE_FLAG_ENCRYPTED = 2, }; NuMediaExtractor(); status_t setDataSource( const char *path, const KeyedVector *headers = NULL); status_t setDataSource(int fd, off64_t offset, off64_t size); status_t setDataSource(const sp &datasource); size_t countTracks() const; status_t getTrackFormat(size_t index, sp *format) const; status_t selectTrack(size_t index); status_t unselectTrack(size_t index); status_t seekTo( int64_t timeUs, MediaSource::ReadOptions::SeekMode mode = MediaSource::ReadOptions::SEEK_CLOSEST_SYNC); status_t advance(); status_t readSampleData(const sp &buffer); status_t getSampleTrackIndex(size_t *trackIndex); status_t getSampleTime(int64_t *sampleTimeUs); status_t getSampleMeta(sp *sampleMeta); bool getCachedDuration(int64_t *durationUs, bool *eos) const; protected: virtual ~NuMediaExtractor(); private: enum TrackFlags { kIsVorbis = 1, }; struct TrackInfo { sp mSource; size_t mTrackIndex; status_t mFinalResult; MediaBuffer *mSample; int64_t mSampleTimeUs; uint32_t mTrackFlags; // bitmask of "TrackFlags" }; mutable Mutex mLock; sp mDataSource; sp mImpl; bool mIsWidevineExtractor; Vector mSelectedTracks; int64_t mTotalBitrate; // in bits/sec int64_t mDurationUs; ssize_t fetchTrackSamples( int64_t seekTimeUs = -1ll, MediaSource::ReadOptions::SeekMode mode = MediaSource::ReadOptions::SEEK_CLOSEST_SYNC); void releaseTrackSamples(); bool getTotalBitrate(int64_t *bitRate) const; void updateDurationAndBitrate(); DISALLOW_EVIL_CONSTRUCTORS(NuMediaExtractor); }; } // namespace android #endif // NU_MEDIA_EXTRACTOR_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/timedtext/0000755000015700001700000000000012200324404026711 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/media/stagefright/timedtext/TimedTextDriver.h0000644000015700001700000000520412200324306032147 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef TIMED_TEXT_DRIVER_H_ #define TIMED_TEXT_DRIVER_H_ #include // for DISALLOW_* macro #include // for status_t #include #include namespace android { class ALooper; class MediaPlayerBase; class MediaSource; class Parcel; class TimedTextPlayer; class TimedTextSource; class DataSource; class TimedTextDriver { public: TimedTextDriver(const wp &listener); ~TimedTextDriver(); status_t start(); status_t pause(); status_t selectTrack(size_t index); status_t unselectTrack(size_t index); status_t seekToAsync(int64_t timeUs); status_t addInBandTextSource( size_t trackIndex, const sp& source); status_t addOutOfBandTextSource( size_t trackIndex, const char *uri, const char *mimeType); // Caller owns the file desriptor and caller is responsible for closing it. status_t addOutOfBandTextSource( size_t trackIndex, int fd, off64_t offset, off64_t length, const char *mimeType); void getExternalTrackInfo(Parcel *parcel); size_t countExternalTracks() const; private: Mutex mLock; enum State { UNINITIALIZED, PREPARED, PLAYING, PAUSED, }; enum TextSourceType { TEXT_SOURCE_TYPE_IN_BAND = 0, TEXT_SOURCE_TYPE_OUT_OF_BAND, }; sp mLooper; sp mPlayer; wp mListener; // Variables to be guarded by mLock. State mState; size_t mCurrentTrackIndex; KeyedVector > mTextSourceVector; Vector mTextSourceTypeVector; // -- End of variables to be guarded by mLock status_t selectTrack_l(size_t index); status_t createOutOfBandTextSource( size_t trackIndex, const char* mimeType, const sp& dataSource); DISALLOW_EVIL_CONSTRUCTORS(TimedTextDriver); }; } // namespace android #endif // TIMED_TEXT_DRIVER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/MPEG2TSWriter.h0000644000015700001700000000472612200324306027343 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MPEG2TS_WRITER_H_ #define MPEG2TS_WRITER_H_ #include #include #include #include namespace android { struct ABuffer; struct MPEG2TSWriter : public MediaWriter { MPEG2TSWriter(int fd); MPEG2TSWriter(const char *filename); MPEG2TSWriter( void *cookie, ssize_t (*write)(void *cookie, const void *data, size_t size)); virtual status_t addSource(const sp &source); virtual status_t start(MetaData *param = NULL); virtual status_t stop() { return reset(); } virtual status_t pause(); virtual bool reachedEOS(); virtual status_t dump(int fd, const Vector& args); void onMessageReceived(const sp &msg); protected: virtual ~MPEG2TSWriter(); private: enum { kWhatSourceNotify = 'noti' }; struct SourceInfo; FILE *mFile; void *mWriteCookie; ssize_t (*mWriteFunc)(void *cookie, const void *data, size_t size); sp mLooper; sp > mReflector; bool mStarted; Vector > mSources; size_t mNumSourcesDone; int64_t mNumTSPacketsWritten; int64_t mNumTSPacketsBeforeMeta; int mPATContinuityCounter; int mPMTContinuityCounter; uint32_t mCrcTable[256]; void init(); void writeTS(); void writeProgramAssociationTable(); void writeProgramMap(); void writeAccessUnit(int32_t sourceIndex, const sp &buffer); void initCrcTable(); uint32_t crc32(const uint8_t *start, size_t length); ssize_t internalWrite(const void *data, size_t size); status_t reset(); DISALLOW_EVIL_CONSTRUCTORS(MPEG2TSWriter); }; } // namespace android #endif // MPEG2TS_WRITER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/WAVEWriter.h0000644000015700001700000000634612200324306027024 0ustar pbuserpbgroup00000000000000/* * Copyright (c) 2012, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of The Linux Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef WAVE_WRITER_H_ #define WAVE_WRITER_H_ #include #include #include namespace android { #define ID_RIFF 0x46464952 #define ID_WAVE 0x45564157 #define ID_FMT 0x20746d66 #define ID_DATA 0x61746164 #define FORMAT_PCM 1 struct MediaSource; struct MetaData; struct wav_header { uint32_t riff_id; uint32_t riff_sz; uint32_t riff_fmt; uint32_t fmt_id; uint32_t fmt_sz; uint16_t audio_format; uint16_t num_channels; uint32_t sample_rate; uint32_t byte_rate; /* sample_rate * num_channels * bps / 8 */ uint16_t block_align; /* num_channels * bps / 8 */ uint16_t bits_per_sample; uint32_t data_id; uint32_t data_sz; }; struct WAVEWriter : public MediaWriter { WAVEWriter(const char *filename); WAVEWriter(int fd); status_t initCheck() const; virtual status_t addSource(const sp &source); virtual bool reachedEOS(); virtual status_t start(MetaData *params = NULL); virtual status_t stop(); virtual status_t pause(); protected: virtual ~WAVEWriter(); private: int mFd; status_t mInitCheck; sp mSource; bool mStarted; volatile bool mPaused; volatile bool mResumed; volatile bool mDone; volatile bool mReachedEOS; pthread_t mThread; int64_t mEstimatedSizeBytes; int64_t mEstimatedDurationUs; static void *ThreadWrapper(void *); status_t threadFunc(); bool exceedsFileSizeLimit(); bool exceedsFileDurationLimit(); WAVEWriter(const WAVEWriter &); WAVEWriter &operator=(const WAVEWriter &); }; } // namespace android #endif // WAVE_WRITER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/MediaDefs.h0000644000015700001700000000434212200324306026700 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MEDIA_DEFS_H_ #define MEDIA_DEFS_H_ namespace android { extern const char *MEDIA_MIMETYPE_IMAGE_JPEG; extern const char *MEDIA_MIMETYPE_VIDEO_VPX; extern const char *MEDIA_MIMETYPE_VIDEO_AVC; extern const char *MEDIA_MIMETYPE_VIDEO_MPEG4; extern const char *MEDIA_MIMETYPE_VIDEO_H263; extern const char *MEDIA_MIMETYPE_VIDEO_MPEG2; extern const char *MEDIA_MIMETYPE_VIDEO_RAW; extern const char *MEDIA_MIMETYPE_AUDIO_AMR_NB; extern const char *MEDIA_MIMETYPE_AUDIO_AMR_WB; extern const char *MEDIA_MIMETYPE_AUDIO_AMR_WB_PLUS; extern const char *MEDIA_MIMETYPE_AUDIO_MPEG; // layer III extern const char *MEDIA_MIMETYPE_AUDIO_MPEG_LAYER_I; extern const char *MEDIA_MIMETYPE_AUDIO_MPEG_LAYER_II; extern const char *MEDIA_MIMETYPE_AUDIO_AAC; extern const char *MEDIA_MIMETYPE_AUDIO_QCELP; extern const char *MEDIA_MIMETYPE_AUDIO_VORBIS; extern const char *MEDIA_MIMETYPE_AUDIO_G711_ALAW; extern const char *MEDIA_MIMETYPE_AUDIO_G711_MLAW; extern const char *MEDIA_MIMETYPE_AUDIO_RAW; extern const char *MEDIA_MIMETYPE_AUDIO_FLAC; extern const char *MEDIA_MIMETYPE_AUDIO_AAC_ADTS; extern const char *MEDIA_MIMETYPE_CONTAINER_MPEG4; extern const char *MEDIA_MIMETYPE_CONTAINER_WAV; extern const char *MEDIA_MIMETYPE_CONTAINER_OGG; extern const char *MEDIA_MIMETYPE_CONTAINER_MATROSKA; extern const char *MEDIA_MIMETYPE_CONTAINER_MPEG2TS; extern const char *MEDIA_MIMETYPE_CONTAINER_AVI; extern const char *MEDIA_MIMETYPE_CONTAINER_MPEG2PS; extern const char *MEDIA_MIMETYPE_CONTAINER_WVM; extern const char *MEDIA_MIMETYPE_TEXT_3GPP; extern const char *MEDIA_MIMETYPE_TEXT_SUBRIP; } // namespace android #endif // MEDIA_DEFS_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/JPEGSource.h0000644000015700001700000000264512200324306026771 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef JPEG_SOURCE_H_ #define JPEG_SOURCE_H_ #include namespace android { class DataSource; class MediaBufferGroup; struct JPEGSource : public MediaSource { JPEGSource(const sp &source); virtual status_t start(MetaData *params = NULL); virtual status_t stop(); virtual sp getFormat(); virtual status_t read( MediaBuffer **buffer, const ReadOptions *options = NULL); protected: virtual ~JPEGSource(); private: sp mSource; MediaBufferGroup *mGroup; bool mStarted; off64_t mSize; int32_t mWidth, mHeight; off64_t mOffset; status_t parseJPEG(); JPEGSource(const JPEGSource &); JPEGSource &operator=(const JPEGSource &); }; } // namespace android #endif // JPEG_SOURCE_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/SkipCutBuffer.h0000644000015700001700000000357412200324306027601 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef SKIP_CUT_BUFFER_H_ #define SKIP_CUT_BUFFER_H_ #include #include namespace android { /** * utility class to cut the start and end off a stream of data in MediaBuffers * */ class SkipCutBuffer: public RefBase { public: // 'skip' is the number of bytes to skip from the beginning // 'cut' is the number of bytes to cut from the end SkipCutBuffer(int32_t skip, int32_t cut); // Submit one MediaBuffer for skipping and cutting. This may consume all or // some of the data in the buffer, or it may add data to it. // After this, the caller should continue processing the buffer as usual. void submit(MediaBuffer *buffer); void submit(const sp& buffer); // same as above, but with an ABuffer void clear(); size_t size(); // how many bytes are currently stored in the buffer protected: virtual ~SkipCutBuffer(); private: void write(const char *src, size_t num); size_t read(char *dst, size_t num); int32_t mFrontPadding; int32_t mBackPadding; int32_t mWriteHead; int32_t mReadHead; int32_t mCapacity; char* mCutBuffer; DISALLOW_EVIL_CONSTRUCTORS(SkipCutBuffer); }; } // namespace android #endif // OMX_CODEC_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/QCOMXCodec.h0000644000015700001700000001020212200324306026674 0ustar pbuserpbgroup00000000000000/* * Copyright (c) 2012, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of The Linux Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef QC_OMX_CODEC_H_ #define QC_OMX_CODEC_H_ #include #include #include #include #include #include #include namespace android { struct MediaCodecList; struct OMXCodec; enum{ kRequiresWMAProComponent = 0x40000000, }; struct QCOMXCodec { static uint32_t getQCComponentQuirks(const MediaCodecList *list, size_t index); static status_t configureDIVXCodec(const sp &meta, char* mime, sp OMXhandle,IOMX::node_id nodeID, int port_index); static status_t setQCFormat(const sp &meta, char* mime, sp OMXhandle,IOMX::node_id nodeID, OMXCodec *handle, bool isEncoder); static status_t setWMAFormat(const sp &meta, sp OMXhandle, IOMX::node_id nodeID, bool isEncoder ); static status_t setQCVideoInputFormat(const char *mime, OMX_VIDEO_CODINGTYPE *compressionFormat); static status_t setQCVideoOutputFormat(const char *mime, OMX_VIDEO_CODINGTYPE *compressionFormat); static status_t checkQCFormats(int format, AString* meta); static void setASFQuirks(uint32_t quirks, const sp &meta, const char* componentName); static void checkAndAddRawFormat(OMXCodec *handle, const sp &meta); static void setEVRCFormat(int32_t numChannels, int32_t sampleRate, sp OMXhandle, IOMX::node_id nodeID, OMXCodec *handle, bool isEncoder ); static void setQCELPFormat(int32_t numChannels, int32_t sampleRate, sp OMXhandle, IOMX::node_id nodeID, OMXCodec *handle, bool isEncoder ); static void setAC3Format(int32_t numChannels, int32_t sampleRate, sp OMXhandle, IOMX::node_id nodeID); static void checkQCRole(const sp &omx, IOMX::node_id node, bool isEncoder,const char *mime); static void setQCSpecificVideoFormat(const sp &meta, sp OMXhandle, IOMX::node_id nodeID, char* componentName ); }; } #endif /*QC_OMX_CODEC_H_ */ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/AudioSource.h0000644000015700001700000000605612200324306027305 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef AUDIO_SOURCE_H_ #define AUDIO_SOURCE_H_ #include #include #include #include #include #include namespace android { class AudioRecord; struct AudioSource : public MediaSource, public MediaBufferObserver { // Note that the "channels" parameter _is_ the number of channels, // _not_ a bitmask of audio_channels_t constants. AudioSource( audio_source_t inputSource, uint32_t sampleRate, uint32_t channels = 1); status_t initCheck() const; virtual status_t start(MetaData *params = NULL); virtual status_t stop() { return reset(); } virtual sp getFormat(); // Returns the maximum amplitude since last call. int16_t getMaxAmplitude(); virtual status_t read( MediaBuffer **buffer, const ReadOptions *options = NULL); status_t dataCallback(const AudioRecord::Buffer& buffer); virtual void signalBufferReturned(MediaBuffer *buffer); protected: virtual ~AudioSource(); private: enum { kMaxBufferSize = 2048, // After the initial mute, we raise the volume linearly // over kAutoRampDurationUs. kAutoRampDurationUs = 300000, // This is the initial mute duration to suppress // the video recording signal tone kAutoRampStartUs = 0, }; Mutex mLock; Condition mFrameAvailableCondition; Condition mFrameEncodingCompletionCondition; AudioRecord *mRecord; status_t mInitCheck; bool mStarted; int32_t mSampleRate; bool mTrackMaxAmplitude; int64_t mStartTimeUs; int16_t mMaxAmplitude; int64_t mPrevSampleTimeUs; int64_t mInitialReadTimeUs; int64_t mNumFramesReceived; int64_t mNumClientOwnedBuffers; List mBuffersReceived; void trackMaxAmplitude(int16_t *data, int nSamples); // This is used to raise the volume from mute to the // actual level linearly. void rampVolume( int32_t startFrame, int32_t rampDurationFrames, uint8_t *data, size_t bytes); void queueInputBuffer_l(MediaBuffer *buffer, int64_t timeUs); void releaseQueuedFrames_l(); void waitOutstandingEncodingFrames_l(); status_t reset(); AudioSource(const AudioSource &); AudioSource &operator=(const AudioSource &); }; } // namespace android #endif // AUDIO_SOURCE_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/MediaBuffer.h0000644000015700001700000000572012200324306027231 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MEDIA_BUFFER_H_ #define MEDIA_BUFFER_H_ #include #include #include namespace android { struct ABuffer; class GraphicBuffer; class MediaBuffer; class MediaBufferObserver; class MetaData; class MediaBufferObserver { public: MediaBufferObserver() {} virtual ~MediaBufferObserver() {} virtual void signalBufferReturned(MediaBuffer *buffer) = 0; private: MediaBufferObserver(const MediaBufferObserver &); MediaBufferObserver &operator=(const MediaBufferObserver &); }; class MediaBuffer { public: // The underlying data remains the responsibility of the caller! MediaBuffer(void *data, size_t size); MediaBuffer(size_t size); MediaBuffer(const sp& graphicBuffer); MediaBuffer(const sp &buffer); // Decrements the reference count and returns the buffer to its // associated MediaBufferGroup if the reference count drops to 0. void release(); // Increments the reference count. void add_ref(); void *data() const; size_t size() const; size_t range_offset() const; size_t range_length() const; void set_range(size_t offset, size_t length); sp graphicBuffer() const; sp meta_data(); // Clears meta data and resets the range to the full extent. void reset(); void setObserver(MediaBufferObserver *group); // Returns a clone of this MediaBuffer increasing its reference count. // The clone references the same data but has its own range and // MetaData. MediaBuffer *clone(); int refcount() const; protected: virtual ~MediaBuffer(); private: friend class MediaBufferGroup; friend class OMXDecoder; // For use by OMXDecoder, reference count must be 1, drop reference // count to 0 without signalling the observer. void claim(); MediaBufferObserver *mObserver; MediaBuffer *mNextBuffer; int mRefCount; void *mData; size_t mSize, mRangeOffset, mRangeLength; sp mGraphicBuffer; sp mBuffer; bool mOwnsData; sp mMetaData; MediaBuffer *mOriginal; void setNextBuffer(MediaBuffer *buffer); MediaBuffer *nextBuffer(); MediaBuffer(const MediaBuffer &); MediaBuffer &operator=(const MediaBuffer &); }; } // namespace android #endif // MEDIA_BUFFER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/MetaData.h0000644000015700001700000002216312200324306026540 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef META_DATA_H_ #define META_DATA_H_ #include #include #include #include #include namespace android { // The following keys map to int32_t data unless indicated otherwise. enum { kKeyMIMEType = 'mime', // cstring kKeyWidth = 'widt', // int32_t, image pixel kKeyHeight = 'heig', // int32_t, image pixel kKeyDisplayWidth = 'dWid', // int32_t, display/presentation kKeyDisplayHeight = 'dHgt', // int32_t, display/presentation // a rectangle, if absent assumed to be (0, 0, width - 1, height - 1) kKeyCropRect = 'crop', kKeyRotation = 'rotA', // int32_t (angle in degrees) kKeyIFramesInterval = 'ifiv', // int32_t kKeyStride = 'strd', // int32_t kKeySliceHeight = 'slht', // int32_t kKeyChannelCount = '#chn', // int32_t kKeyChannelMask = 'chnm', // int32_t kKeySampleRate = 'srte', // int32_t (audio sampling rate Hz) kKeyFrameRate = 'frmR', // int32_t (video frame rate fps) kKeyBitRate = 'brte', // int32_t (bps) kKeyESDS = 'esds', // raw data kKeyAACProfile = 'aacp', // int32_t kKeyAVCC = 'avcc', // raw data kKeyD263 = 'd263', // raw data kKeyVorbisInfo = 'vinf', // raw data kKeyVorbisBooks = 'vboo', // raw data kKeyWantsNALFragments = 'NALf', kKeyIsSyncFrame = 'sync', // int32_t (bool) kKeyIsCodecConfig = 'conf', // int32_t (bool) kKeyTime = 'time', // int64_t (usecs) kKeyDecodingTime = 'decT', // int64_t (decoding timestamp in usecs) kKeyNTPTime = 'ntpT', // uint64_t (ntp-timestamp) kKeyTargetTime = 'tarT', // int64_t (usecs) kKeyDriftTime = 'dftT', // int64_t (usecs) kKeyAnchorTime = 'ancT', // int64_t (usecs) kKeyDuration = 'dura', // int64_t (usecs) kKeyColorFormat = 'colf', kKeyPlatformPrivate = 'priv', // pointer kKeyDecoderComponent = 'decC', // cstring kKeyBufferID = 'bfID', kKeyMaxInputSize = 'inpS', kKeyThumbnailTime = 'thbT', // int64_t (usecs) kKeyTrackID = 'trID', kKeyIsDRM = 'idrm', // int32_t (bool) kKeyEncoderDelay = 'encd', // int32_t (frames) kKeyEncoderPadding = 'encp', // int32_t (frames) kKeyAlbum = 'albu', // cstring kKeyArtist = 'arti', // cstring kKeyAlbumArtist = 'aart', // cstring kKeyComposer = 'comp', // cstring kKeyGenre = 'genr', // cstring kKeyTitle = 'titl', // cstring kKeyYear = 'year', // cstring kKeyAlbumArt = 'albA', // compressed image data kKeyAlbumArtMIME = 'alAM', // cstring kKeyAuthor = 'auth', // cstring kKeyCDTrackNumber = 'cdtr', // cstring kKeyDiscNumber = 'dnum', // cstring kKeyDate = 'date', // cstring kKeyWriter = 'writ', // cstring kKeyCompilation = 'cpil', // cstring kKeyLocation = 'loc ', // cstring kKeyTimeScale = 'tmsl', // int32_t // video profile and level kKeyVideoProfile = 'vprf', // int32_t kKeyVideoLevel = 'vlev', // int32_t // Set this key to enable authoring files in 64-bit offset kKey64BitFileOffset = 'fobt', // int32_t (bool) kKey2ByteNalLength = '2NAL', // int32_t (bool) // Identify the file output format for authoring // Please see for the supported // file output formats. kKeyFileType = 'ftyp', // int32_t // Track authoring progress status // kKeyTrackTimeStatus is used to track progress in elapsed time kKeyTrackTimeStatus = 'tktm', // int64_t kKeyNotRealTime = 'ntrt', // bool (int32_t) kKeyNumBuffers = 'nbbf', // int32_t // Ogg files can be tagged to be automatically looping... kKeyAutoLoop = 'autL', // bool (int32_t) kKeyValidSamples = 'valD', // int32_t kKeyIsUnreadable = 'unre', // bool (int32_t) // An indication that a video buffer has been rendered. kKeyRendered = 'rend', // bool (int32_t) // The language code for this media kKeyMediaLanguage = 'lang', // cstring // To store the timed text format data kKeyTextFormatData = 'text', // raw data kKeyRequiresSecureBuffers = 'secu', // bool (int32_t) kKeyIsADTS = 'adts', // bool (int32_t) // If a MediaBuffer's data represents (at least partially) encrypted // data, the following fields aid in decryption. // The data can be thought of as pairs of plain and encrypted data // fragments, i.e. plain and encrypted data alternate. // The first fragment is by convention plain data (if that's not the // case, simply specify plain fragment size of 0). // kKeyEncryptedSizes and kKeyPlainSizes each map to an array of // size_t values. The sum total of all size_t values of both arrays // must equal the amount of data (i.e. MediaBuffer's range_length()). // If both arrays are present, they must be of the same size. // If only encrypted sizes are present it is assumed that all // plain sizes are 0, i.e. all fragments are encrypted. // To programmatically set these array, use the MetaData::setData API, i.e. // const size_t encSizes[]; // meta->setData( // kKeyEncryptedSizes, 0 /* type */, encSizes, sizeof(encSizes)); // A plain sizes array by itself makes no sense. kKeyEncryptedSizes = 'encr', // size_t[] kKeyPlainSizes = 'plai', // size_t[] kKeyCryptoKey = 'cryK', // uint8_t[16] kKeyCryptoIV = 'cryI', // uint8_t[16] kKeyCryptoMode = 'cryM', // int32_t }; enum { kTypeESDS = 'esds', kTypeAVCC = 'avcc', kTypeD263 = 'd263', }; class MetaData : public RefBase { public: MetaData(); MetaData(const MetaData &from); enum Type { TYPE_NONE = 'none', TYPE_C_STRING = 'cstr', TYPE_INT32 = 'in32', TYPE_INT64 = 'in64', TYPE_FLOAT = 'floa', TYPE_POINTER = 'ptr ', TYPE_RECT = 'rect', }; void clear(); bool remove(uint32_t key); bool setCString(uint32_t key, const char *value); bool setInt32(uint32_t key, int32_t value); bool setInt64(uint32_t key, int64_t value); bool setFloat(uint32_t key, float value); bool setPointer(uint32_t key, void *value); bool setRect( uint32_t key, int32_t left, int32_t top, int32_t right, int32_t bottom); bool findCString(uint32_t key, const char **value); bool findInt32(uint32_t key, int32_t *value); bool findInt64(uint32_t key, int64_t *value); bool findFloat(uint32_t key, float *value); bool findPointer(uint32_t key, void **value); bool findRect( uint32_t key, int32_t *left, int32_t *top, int32_t *right, int32_t *bottom); bool setData(uint32_t key, uint32_t type, const void *data, size_t size); bool findData(uint32_t key, uint32_t *type, const void **data, size_t *size) const; void dumpToLog() const; protected: virtual ~MetaData(); private: struct typed_data { typed_data(); ~typed_data(); typed_data(const MetaData::typed_data &); typed_data &operator=(const MetaData::typed_data &); void clear(); void setData(uint32_t type, const void *data, size_t size); void getData(uint32_t *type, const void **data, size_t *size) const; String8 asString() const; private: uint32_t mType; size_t mSize; union { void *ext_data; float reservoir; } u; bool usesReservoir() const { return mSize <= sizeof(u.reservoir); } void allocateStorage(size_t size); void freeStorage(); void *storage() { return usesReservoir() ? &u.reservoir : u.ext_data; } const void *storage() const { return usesReservoir() ? &u.reservoir : u.ext_data; } }; struct Rect { int32_t mLeft, mTop, mRight, mBottom; }; KeyedVector mItems; // MetaData &operator=(const MetaData &); }; } // namespace android #endif // META_DATA_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/TunnelPlayer.h0000644000015700001700000001531012200324306027476 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Copyright (c) 2009-2012, The Linux Foundation. All rights reserved. * Not a Contribution, Apache license notifications and license are retained * for attribution purposes only. * * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef TUNNEL_PLAYER_H_ #define TUNNEL_PLAYER_H_ #include "AudioPlayer.h" #include #include #include #include #include #include #include #include #include #include #include #include // Pause timeout = 3sec #define TUNNEL_PAUSE_TIMEOUT_USEC 3000000 namespace android { class TunnelPlayer : public AudioPlayer { public: enum { REACHED_EOS, SEEK_COMPLETE }; TunnelPlayer(const sp &audioSink, bool &initCheck, AwesomePlayer *audioObserver = NULL, bool hasVideo = false); virtual ~TunnelPlayer(); // Caller retains ownership of "source". virtual void setSource(const sp &source); // Return time in us. virtual int64_t getRealTimeUs(); virtual status_t start(bool sourceAlreadyStarted = false); virtual void pause(bool playPendingSamples = false); virtual void resume(); // Returns the timestamp of the last buffer played (in us). virtual int64_t getMediaTimeUs(); // Returns true iff a mapping is established, i.e. the TunnelPlayer // has played at least one frame of audio. virtual bool getMediaTimeMapping(int64_t *realtime_us, int64_t *mediatime_us); virtual status_t seekTo(int64_t time_us); virtual bool isSeeking(); virtual bool reachedEOS(status_t *finalStatus); static int mTunnelObjectsAlive; private: int64_t mPositionTimeMediaUs; int64_t mPositionTimeRealUs; bool mInternalSeeking; bool mIsAudioRouted; bool mStarted; bool mPaused; bool mA2DPEnabled; int32_t mChannelMask; int32_t numChannels; int32_t mSampleRate; int64_t mLatencyUs; size_t mFrameSize; int64_t mNumFramesPlayed; int64_t mNumFramesPlayedSysTimeUs; audio_format_t mFormat; bool mHasVideo; void clearPowerManager(); class PMDeathRecipient : public IBinder::DeathRecipient { public: PMDeathRecipient(void *obj){parentClass = (TunnelPlayer *)obj;} virtual ~PMDeathRecipient() {} // IBinder::DeathRecipient virtual void binderDied(const wp& who); private: TunnelPlayer *parentClass; PMDeathRecipient(const PMDeathRecipient&); PMDeathRecipient& operator = (const PMDeathRecipient&); friend class TunnelPlayer; }; friend class PMDeathRecipient; void acquireWakeLock(); void releaseWakeLock(); sp mPowerManager; sp mWakeLockToken; sp mDeathRecipient; pthread_t extractorThread; //Kill Thread boolean bool killExtractorThread; //Thread alive boolean bool extractorThreadAlive; //Declare the condition Variables and Mutex pthread_mutex_t extractor_mutex; pthread_cond_t extractor_cv; // make sure Decoder thread has exited void requestAndWaitForExtractorThreadExit(); static void *extractorThreadWrapper(void *me); void extractorThreadEntry(); void createThreads(); volatile bool mIsA2DPEnabled; //Structure to recieve the BT notification from the flinger. class AudioFlingerTunneldecodeClient: public IBinder::DeathRecipient, public BnAudioFlingerClient { public: AudioFlingerTunneldecodeClient(void *obj); TunnelPlayer *pBaseClass; // DeathRecipient virtual void binderDied(const wp& who); // IAudioFlingerClient // indicate a change in the configuration of an output or input: keeps the cached // values for output/input parameters upto date in client process virtual void ioConfigChanged(int event, audio_io_handle_t ioHandle, const void *param2); friend class TunnelPlayer; }; sp mAudioFlinger; // helper function to obtain AudioFlinger service handle void getAudioFlinger(); void onPauseTimeOut(); sp mAudioFlingerClient; friend class AudioFlingerTunneldecodeClient; Mutex mAudioFlingerLock; sp mSource; MediaBuffer *mInputBuffer; Mutex pmLock; Mutex mLock; bool mSeeking; bool mReachedEOS; bool mReachedOutputEOS; status_t mFinalStatus; int64_t mSeekTimeUs; int64_t mPauseTime; bool mIsFirstBuffer; status_t mFirstBufferResult; MediaBuffer *mFirstBuffer; TimedEventQueue mQueue; bool mQueueStarted; sp mPauseEvent; bool mPauseEventPending; sp mAudioSink; AwesomePlayer *mObserver; static size_t AudioSinkCallback( MediaPlayerBase::AudioSink *audioSink, void *data, size_t size, void *me); enum A2DPState { A2DP_ENABLED, A2DP_DISABLED, A2DP_CONNECT, A2DP_DISCONNECT }; void getPlayedTimeFromDSP_l(int64_t *timeStamp); void getOffsetRealTime_l(int64_t *offsetTime); size_t fillBuffer(void *data, size_t size); void reset(); TunnelPlayer(const TunnelPlayer &); TunnelPlayer &operator=(const TunnelPlayer &); }; struct TunnelEvent : public TimedEventQueue::Event { TunnelEvent(TunnelPlayer *player, void (TunnelPlayer::*method)()) : mPlayer(player), mMethod(method) { } protected: virtual ~TunnelEvent() {} virtual void fire(TimedEventQueue *queue, int64_t /* now_us */) { (mPlayer->*mMethod)(); } private: TunnelPlayer *mPlayer; void (TunnelPlayer::*mMethod)(); TunnelEvent(const TunnelEvent &); TunnelEvent &operator=(const TunnelEvent &); }; } // namespace android #endif // LPA_PLAYER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/ACodec.h0000644000015700001700000002011612200324306026172 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef A_CODEC_H_ #define A_CODEC_H_ #include #include #include #include #include #include #define TRACK_BUFFER_TIMING 0 namespace android { struct ABuffer; struct MemoryDealer; struct ACodec : public AHierarchicalStateMachine { enum { kWhatFillThisBuffer = 'fill', kWhatDrainThisBuffer = 'drai', kWhatEOS = 'eos ', kWhatShutdownCompleted = 'scom', kWhatFlushCompleted = 'fcom', kWhatOutputFormatChanged = 'outC', kWhatError = 'erro', kWhatComponentAllocated = 'cAll', kWhatComponentConfigured = 'cCon', kWhatBuffersAllocated = 'allc', }; ACodec(); void setNotificationMessage(const sp &msg); void initiateSetup(const sp &msg); void signalFlush(); void signalResume(); void initiateShutdown(bool keepComponentAllocated = false); void initiateAllocateComponent(const sp &msg); void initiateConfigureComponent(const sp &msg); void initiateStart(); void signalRequestIDRFrame(); struct PortDescription : public RefBase { size_t countBuffers(); IOMX::buffer_id bufferIDAt(size_t index) const; sp bufferAt(size_t index) const; private: friend struct ACodec; Vector mBufferIDs; Vector > mBuffers; PortDescription(); void addBuffer(IOMX::buffer_id id, const sp &buffer); DISALLOW_EVIL_CONSTRUCTORS(PortDescription); }; protected: virtual ~ACodec(); private: struct BaseState; struct UninitializedState; struct LoadedState; struct LoadedToIdleState; struct IdleToExecutingState; struct ExecutingState; struct OutputPortSettingsChangedState; struct ExecutingToIdleState; struct IdleToLoadedState; struct FlushingState; enum { kWhatSetup = 'setu', kWhatOMXMessage = 'omx ', kWhatInputBufferFilled = 'inpF', kWhatOutputBufferDrained = 'outD', kWhatShutdown = 'shut', kWhatFlush = 'flus', kWhatResume = 'resm', kWhatDrainDeferredMessages = 'drai', kWhatAllocateComponent = 'allo', kWhatConfigureComponent = 'conf', kWhatStart = 'star', kWhatRequestIDRFrame = 'ridr', }; enum { kPortIndexInput = 0, kPortIndexOutput = 1 }; enum { kFlagIsSecure = 1, }; struct BufferInfo { enum Status { OWNED_BY_US, OWNED_BY_COMPONENT, OWNED_BY_UPSTREAM, OWNED_BY_DOWNSTREAM, OWNED_BY_NATIVE_WINDOW, }; IOMX::buffer_id mBufferID; Status mStatus; sp mData; sp mGraphicBuffer; }; #if TRACK_BUFFER_TIMING struct BufferStats { int64_t mEmptyBufferTimeUs; int64_t mFillBufferDoneTimeUs; }; KeyedVector mBufferStats; #endif sp mNotify; sp mUninitializedState; sp mLoadedState; sp mLoadedToIdleState; sp mIdleToExecutingState; sp mExecutingState; sp mOutputPortSettingsChangedState; sp mExecutingToIdleState; sp mIdleToLoadedState; sp mFlushingState; sp mSkipCutBuffer; AString mComponentName; uint32_t mFlags; uint32_t mQuirks; sp mOMX; IOMX::node_id mNode; sp mDealer[2]; sp mNativeWindow; Vector mBuffers[2]; bool mPortEOS[2]; status_t mInputEOSResult; List > mDeferredQueue; bool mSentFormat; bool mIsEncoder; bool mShutdownInProgress; // If "mKeepComponentAllocated" we only transition back to Loaded state // and do not release the component instance. bool mKeepComponentAllocated; int32_t mEncoderDelay; int32_t mEncoderPadding; bool mChannelMaskPresent; int32_t mChannelMask; status_t allocateBuffersOnPort(OMX_U32 portIndex); status_t freeBuffersOnPort(OMX_U32 portIndex); status_t freeBuffer(OMX_U32 portIndex, size_t i); status_t allocateOutputBuffersFromNativeWindow(); #ifdef USE_SAMSUNG_COLORFORMAT void setNativeWindowColorFormat(OMX_COLOR_FORMATTYPE &eNativeColorFormat); #endif status_t cancelBufferToNativeWindow(BufferInfo *info); status_t freeOutputBuffersNotOwnedByComponent(); BufferInfo *dequeueBufferFromNativeWindow(); BufferInfo *findBufferByID( uint32_t portIndex, IOMX::buffer_id bufferID, ssize_t *index = NULL); status_t setComponentRole(bool isEncoder, const char *mime); status_t configureCodec(const char *mime, const sp &msg); status_t setVideoPortFormatType( OMX_U32 portIndex, OMX_VIDEO_CODINGTYPE compressionFormat, OMX_COLOR_FORMATTYPE colorFormat); status_t setSupportedOutputFormat(); status_t setupVideoDecoder( const char *mime, int32_t width, int32_t height); status_t setupVideoEncoder( const char *mime, const sp &msg); status_t setVideoFormatOnPort( OMX_U32 portIndex, int32_t width, int32_t height, OMX_VIDEO_CODINGTYPE compressionFormat); status_t setupAACCodec( bool encoder, int32_t numChannels, int32_t sampleRate, int32_t bitRate, int32_t aacProfile, bool isADTS); status_t selectAudioPortFormat( OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE desiredFormat); status_t setupAMRCodec(bool encoder, bool isWAMR, int32_t bitRate); status_t setupG711Codec(bool encoder, int32_t numChannels); status_t setupFlacCodec( bool encoder, int32_t numChannels, int32_t sampleRate, int32_t compressionLevel); status_t setupRawAudioFormat( OMX_U32 portIndex, int32_t sampleRate, int32_t numChannels); status_t setMinBufferSize(OMX_U32 portIndex, size_t size); status_t setupMPEG4EncoderParameters(const sp &msg); status_t setupH263EncoderParameters(const sp &msg); status_t setupAVCEncoderParameters(const sp &msg); status_t verifySupportForProfileAndLevel(int32_t profile, int32_t level); status_t configureBitrate( int32_t bitrate, OMX_VIDEO_CONTROLRATETYPE bitrateMode); status_t setupErrorCorrectionParameters(); status_t initNativeWindow(); status_t pushBlankBuffersToNativeWindow(); // Returns true iff all buffers on the given port have status OWNED_BY_US. bool allYourBuffersAreBelongToUs(OMX_U32 portIndex); bool allYourBuffersAreBelongToUs(); size_t countBuffersOwnedByComponent(OMX_U32 portIndex) const; void deferMessage(const sp &msg); void processDeferredMessages(); void sendFormatChange(); void signalError( OMX_ERRORTYPE error = OMX_ErrorUndefined, status_t internalError = UNKNOWN_ERROR); status_t requestIDRFrame(); DISALLOW_EVIL_CONSTRUCTORS(ACodec); }; } // namespace android #endif // A_CODEC_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/TimeSource.h0000644000015700001700000000215412200324306027135 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef TIME_SOURCE_H_ #define TIME_SOURCE_H_ #include namespace android { class TimeSource { public: TimeSource() {} virtual ~TimeSource() {} virtual int64_t getRealTimeUs() = 0; private: TimeSource(const TimeSource &); TimeSource &operator=(const TimeSource &); }; class SystemTimeSource : public TimeSource { public: SystemTimeSource(); virtual int64_t getRealTimeUs(); private: int64_t mStartTimeUs; }; } // namespace android #endif // TIME_SOURCE_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/MediaExtractor.h0000644000015700001700000000447212200324306027776 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * Copyright (c) 2012, The Linux Foundation. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MEDIA_EXTRACTOR_H_ #define MEDIA_EXTRACTOR_H_ #include namespace android { class DataSource; class MediaSource; class MetaData; class MediaExtractor : public RefBase { public: static sp Create( const sp &source, const char *mime = NULL); virtual size_t countTracks() = 0; virtual sp getTrack(size_t index) = 0; enum GetTrackMetaDataFlags { kIncludeExtensiveMetaData = 1 }; virtual sp getTrackMetaData( size_t index, uint32_t flags = 0) = 0; // Return container specific meta-data. The default implementation // returns an empty metadata object. virtual sp getMetaData(); enum Flags { CAN_SEEK_BACKWARD = 1, // the "seek 10secs back button" CAN_SEEK_FORWARD = 2, // the "seek 10secs forward button" CAN_PAUSE = 4, CAN_SEEK = 8, // the "seek bar" CAN_SEEK_TO_ZERO = 16, // the "previous button" }; // If subclasses do _not_ override this, the default is // CAN_SEEK_BACKWARD | CAN_SEEK_FORWARD | CAN_SEEK | CAN_PAUSE virtual uint32_t flags() const; // for DRM void setDrmFlag(bool flag) { mIsDrm = flag; }; bool getDrmFlag() { return mIsDrm; } virtual char* getDrmTrackInfo(size_t trackID, int *len) { return NULL; } protected: MediaExtractor() {} virtual ~MediaExtractor() {} private: bool mIsDrm; MediaExtractor(const MediaExtractor &); MediaExtractor &operator=(const MediaExtractor &); }; } // namespace android #endif // MEDIA_EXTRACTOR_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/YUVImage.h0000644000015700001700000001520312200324306026503 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // A container class to hold YUV data and provide various utilities, // e.g. to set/get pixel values. // Supported formats: // - YUV420 Planar // - YUV420 Semi Planar // // Currently does not support variable strides. // // Implementation: Two simple abstractions are done to simplify access // to YUV channels for different formats: // - initializeYUVPointers() sets up pointers (mYdata, mUdata, mVdata) to // point to the right start locations of the different channel data depending // on the format. // - getOffsets() returns the correct offset for the different channels // depending on the format. // Location of any pixel's YUV channels can then be easily computed using these. // #ifndef YUV_IMAGE_H_ #define YUV_IMAGE_H_ #include #include namespace android { class Rect; class YUVImage { public: // Supported YUV formats enum YUVFormat { YUV420Planar, YUV420SemiPlanar }; // Constructs an image with the given size, format. Also allocates and owns // the required memory. YUVImage(YUVFormat yuvFormat, int32_t width, int32_t height); // Constructs an image with the given size, format. The memory is provided // by the caller and we don't own it. YUVImage(YUVFormat yuvFormat, int32_t width, int32_t height, uint8_t *buffer); // Destructor to delete the memory if it owns it. ~YUVImage(); // Returns the size of the buffer required to store the YUV data for the given // format and geometry. Useful when the caller wants to allocate the requisite // memory. static size_t bufferSize(YUVFormat yuvFormat, int32_t width, int32_t height); int32_t width() const {return mWidth;} int32_t height() const {return mHeight;} // Returns true if pixel is the range [0, width-1] x [0, height-1] // and false otherwise. bool validPixel(int32_t x, int32_t y) const; // Get the pixel YUV value at pixel (x,y). // Note that the range of x is [0, width-1] and the range of y is [0, height-1]. // Returns true if get was successful and false otherwise. bool getPixelValue(int32_t x, int32_t y, uint8_t *yPtr, uint8_t *uPtr, uint8_t *vPtr) const; // Set the pixel YUV value at pixel (x,y). // Note that the range of x is [0, width-1] and the range of y is [0, height-1]. // Returns true if set was successful and false otherwise. bool setPixelValue(int32_t x, int32_t y, uint8_t yValue, uint8_t uValue, uint8_t vValue); // Uses memcpy to copy an entire row of data static void fastCopyRectangle420Planar( const Rect& srcRect, int32_t destStartX, int32_t destStartY, const YUVImage &srcImage, YUVImage &destImage); // Uses memcpy to copy an entire row of data static void fastCopyRectangle420SemiPlanar( const Rect& srcRect, int32_t destStartX, int32_t destStartY, const YUVImage &srcImage, YUVImage &destImage); // Tries to use memcopy to copy entire rows of data. // Returns false if fast copy is not possible for the passed image formats. static bool fastCopyRectangle( const Rect& srcRect, int32_t destStartX, int32_t destStartY, const YUVImage &srcImage, YUVImage &destImage); // Convert the given YUV value to RGB. void yuv2rgb(uint8_t yValue, uint8_t uValue, uint8_t vValue, uint8_t *r, uint8_t *g, uint8_t *b) const; // Write the image to a human readable PPM file. // Returns true if write was succesful and false otherwise. bool writeToPPM(const char *filename) const; private: // YUV Format of the image. YUVFormat mYUVFormat; int32_t mWidth; int32_t mHeight; // Pointer to the memory buffer. uint8_t *mBuffer; // Boolean telling whether we own the memory buffer. bool mOwnBuffer; // Pointer to start of the Y data plane. uint8_t *mYdata; // Pointer to start of the U data plane. Note that in case of interleaved formats like // YUV420 semiplanar, mUdata points to the start of the U data in the UV plane. uint8_t *mUdata; // Pointer to start of the V data plane. Note that in case of interleaved formats like // YUV420 semiplanar, mVdata points to the start of the V data in the UV plane. uint8_t *mVdata; // Initialize the pointers mYdata, mUdata, mVdata to point to the right locations for // the given format and geometry. // Returns true if initialize was succesful and false otherwise. bool initializeYUVPointers(); // For the given pixel location, this returns the offset of the location of y, u and v // data from the corresponding base pointers -- mYdata, mUdata, mVdata. // Note that the range of x is [0, width-1] and the range of y is [0, height-1]. // Returns true if getting offsets was succesful and false otherwise. bool getOffsets(int32_t x, int32_t y, int32_t *yOffset, int32_t *uOffset, int32_t *vOffset) const; // Returns the offset increments incurred in going from one data row to the next data row // for the YUV channels. Note that this corresponds to data rows and not pixel rows. // E.g. depending on formats, U/V channels may have only one data row corresponding // to two pixel rows. bool getOffsetIncrementsPerDataRow( int32_t *yDataOffsetIncrement, int32_t *uDataOffsetIncrement, int32_t *vDataOffsetIncrement) const; // Given the offset return the address of the corresponding channel's data. uint8_t* getYAddress(int32_t offset) const; uint8_t* getUAddress(int32_t offset) const; uint8_t* getVAddress(int32_t offset) const; // Given the pixel location, returns the address of the corresponding channel's data. // Note that the range of x is [0, width-1] and the range of y is [0, height-1]. bool getYUVAddresses(int32_t x, int32_t y, uint8_t **yAddr, uint8_t **uAddr, uint8_t **vAddr) const; // Disallow implicit casting and copying. YUVImage(const YUVImage &); YUVImage &operator=(const YUVImage &); }; } // namespace android #endif // YUV_IMAGE_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/LPAPlayer.h0000644000015700001700000001660712200324306026657 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * Copyright (c) 2009-2012, The Linux Foundation. All rights reserved. * Not a Contribution, Apache license notifications and license are retained * for attribution purposes only. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef LPA_PLAYER_H_ #define LPA_PLAYER_H_ #include "AudioPlayer.h" #include #include #include #include #include #include #include #include #include #include #include #include // Pause timeout = 3sec #define LPA_PAUSE_TIMEOUT_USEC 3000000 namespace android { class LPAPlayer : public AudioPlayer { public: enum { REACHED_EOS, SEEK_COMPLETE }; enum { TRACK_DIRECT, TRACK_REGULAR, TRACK_NONE }; LPAPlayer(const sp &audioSink, bool &initCheck, AwesomePlayer *audioObserver = NULL); virtual ~LPAPlayer(); // Caller retains ownership of "source". virtual void setSource(const sp &source); // Return time in us. virtual int64_t getRealTimeUs(); virtual status_t start(bool sourceAlreadyStarted = false); virtual void pause(bool playPendingSamples = false); virtual void resume(); // Returns the timestamp of the last buffer played (in us). virtual int64_t getMediaTimeUs(); // Returns true iff a mapping is established, i.e. the LPAPlayer // has played at least one frame of audio. virtual bool getMediaTimeMapping(int64_t *realtime_us, int64_t *mediatime_us); virtual status_t seekTo(int64_t time_us); virtual bool isSeeking(); virtual bool reachedEOS(status_t *finalStatus); static int objectsAlive; private: int64_t mPositionTimeMediaUs; int64_t mPositionTimeRealUs; bool mInternalSeeking; bool mIsAudioRouted; bool mStarted; bool mPaused; bool mA2DPEnabled; int32_t mChannelMask; int32_t numChannels; int32_t mSampleRate; int64_t mLatencyUs; size_t mFrameSize; int64_t mTimeStarted; int64_t mTimePlayed; int64_t mNumFramesPlayed; int64_t mNumFramesPlayedSysTimeUs; int64_t mNumA2DPBytesPlayed; void clearPowerManager(); class PMDeathRecipient : public IBinder::DeathRecipient { public: PMDeathRecipient(void *obj){parentClass = (LPAPlayer *)obj;} virtual ~PMDeathRecipient() {} // IBinder::DeathRecipient virtual void binderDied(const wp& who); private: LPAPlayer *parentClass; PMDeathRecipient(const PMDeathRecipient&); PMDeathRecipient& operator = (const PMDeathRecipient&); friend class LPAPlayer; }; friend class PMDeathRecipient; void acquireWakeLock(); void releaseWakeLock(); sp mPowerManager; sp mWakeLockToken; sp mDeathRecipient; pthread_t decoderThread; pthread_t A2DPNotificationThread; //Kill Thread boolean bool killDecoderThread; bool killA2DPNotificationThread; //Thread alive boolean bool decoderThreadAlive; bool a2dpNotificationThreadAlive; //Declare the condition Variables and Mutex pthread_mutex_t decoder_mutex; pthread_mutex_t audio_sink_setup_mutex; pthread_mutex_t a2dp_notification_mutex; pthread_cond_t decoder_cv; pthread_cond_t a2dp_notification_cv; // make sure Decoder thread has exited void requestAndWaitForDecoderThreadExit(); // make sure the Effects thread also exited void requestAndWaitForA2DPNotificationThreadExit(); static void *decoderThreadWrapper(void *me); void decoderThreadEntry(); static void *A2DPNotificationThreadWrapper(void *me); void A2DPNotificationThreadEntry(); void createThreads(); volatile bool mIsA2DPEnabled; //Structure to recieve the BT notification from the flinger. class AudioFlingerLPAdecodeClient: public IBinder::DeathRecipient, public BnAudioFlingerClient { public: AudioFlingerLPAdecodeClient(void *obj); LPAPlayer *pBaseClass; // DeathRecipient virtual void binderDied(const wp& who); // IAudioFlingerClient // indicate a change in the configuration of an output or input: keeps the cached // values for output/input parameters upto date in client process virtual void ioConfigChanged(int event, audio_io_handle_t ioHandle, const void *param2); friend class LPAPlayer; }; sp mAudioFlinger; // helper function to obtain AudioFlinger service handle void getAudioFlinger(); void handleA2DPSwitch(); void onPauseTimeOut(); sp AudioFlingerClient; friend class AudioFlingerLPAdecodeClient; Mutex AudioFlingerLock; sp mSource; MediaBuffer *mInputBuffer; Mutex mLock; Mutex mResumeLock; bool mSeeking; bool mReachedEOS; bool mReachedOutputEOS; status_t mFinalStatus; int64_t mSeekTimeUs; int64_t mPauseTime; bool mIsFirstBuffer; status_t mFirstBufferResult; MediaBuffer *mFirstBuffer; TimedEventQueue mQueue; bool mQueueStarted; sp mPauseEvent; bool mPauseEventPending; sp mAudioSink; AwesomePlayer *mObserver; int mTrackType; static size_t AudioSinkCallback( MediaPlayerBase::AudioSink *audioSink, void *data, size_t size, void *me); enum A2DPState { A2DP_ENABLED, A2DP_DISABLED, A2DP_CONNECT, A2DP_DISCONNECT }; int64_t getTimeStamp(A2DPState state); size_t fillBuffer(void *data, size_t size); int64_t getRealTimeUsLocked(); void reset(); status_t setupAudioSink(); static size_t AudioCallback( MediaPlayerBase::AudioSink *audioSink, void *buffer, size_t size, void *cookie); size_t AudioCallback(void *cookie, void *data, size_t size); LPAPlayer(const LPAPlayer &); LPAPlayer &operator=(const LPAPlayer &); }; struct TimedEvent : public TimedEventQueue::Event { TimedEvent(LPAPlayer *player, void (LPAPlayer::*method)()) : mPlayer(player), mMethod(method) { } protected: virtual ~TimedEvent() {} virtual void fire(TimedEventQueue *queue, int64_t /* now_us */) { (mPlayer->*mMethod)(); } private: LPAPlayer *mPlayer; void (LPAPlayer::*mMethod)(); TimedEvent(const TimedEvent &); TimedEvent &operator=(const TimedEvent &); }; } // namespace android #endif // LPA_PLAYER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/foundation/0000755000015700001700000000000012200324404027050 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/media/stagefright/foundation/ABitReader.h0000644000015700001700000000240012200324306031160 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef A_BIT_READER_H_ #define A_BIT_READER_H_ #include #include #include namespace android { struct ABitReader { ABitReader(const uint8_t *data, size_t size); uint32_t getBits(size_t n); void skipBits(size_t n); void putBits(uint32_t x, size_t n); size_t numBitsLeft() const; const uint8_t *data() const; private: const uint8_t *mData; size_t mSize; uint32_t mReservoir; // left-aligned bits size_t mNumBitsLeft; void fillReservoir(); DISALLOW_EVIL_CONSTRUCTORS(ABitReader); }; } // namespace android #endif // A_BIT_READER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/foundation/hexdump.h0000644000015700001700000000155712200324306030704 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef HEXDUMP_H_ #define HEXDUMP_H_ #include namespace android { struct AString; void hexdump( const void *_data, size_t size, size_t indent = 0, AString *appendTo = NULL); } // namespace android #endif // HEXDUMP_H_ ././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000android-audiosystem-1.8+13.10.20130807/include/media/stagefright/foundation/AHierarchicalStateMachine.handroid-audiosystem-1.8+13.10.20130807/include/media/stagefright/foundation/AHierarchicalStateMachin0000644000015700001700000000316512200324306033601 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef A_HIERARCHICAL_STATE_MACHINE_H_ #define A_HIERARCHICAL_STATE_MACHINE_H_ #include namespace android { struct AState : public RefBase { AState(const sp &parentState = NULL); sp parentState(); protected: virtual ~AState(); virtual void stateEntered(); virtual void stateExited(); virtual bool onMessageReceived(const sp &msg) = 0; private: friend struct AHierarchicalStateMachine; sp mParentState; DISALLOW_EVIL_CONSTRUCTORS(AState); }; struct AHierarchicalStateMachine : public AHandler { AHierarchicalStateMachine(); protected: virtual ~AHierarchicalStateMachine(); virtual void onMessageReceived(const sp &msg); // Only to be called in response to a message. void changeState(const sp &state); private: sp mState; DISALLOW_EVIL_CONSTRUCTORS(AHierarchicalStateMachine); }; } // namespace android #endif // A_HIERARCHICAL_STATE_MACHINE_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/foundation/base64.h0000644000015700001700000000160312200324306030306 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef BASE_64_H_ #define BASE_64_H_ #include namespace android { struct ABuffer; struct AString; sp decodeBase64(const AString &s); void encodeBase64(const void *data, size_t size, AString *out); } // namespace android #endif // BASE_64_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/foundation/AHandlerReflector.h0000644000015700001700000000243312200324306032550 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef A_HANDLER_REFLECTOR_H_ #define A_HANDLER_REFLECTOR_H_ #include namespace android { template struct AHandlerReflector : public AHandler { AHandlerReflector(T *target) : mTarget(target) { } protected: virtual void onMessageReceived(const sp &msg) { sp target = mTarget.promote(); if (target != NULL) { target->onMessageReceived(msg); } } private: wp mTarget; AHandlerReflector(const AHandlerReflector &); AHandlerReflector &operator=(const AHandlerReflector &); }; } // namespace android #endif // A_HANDLER_REFLECTOR_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/foundation/AAtomizer.h0000644000015700001700000000234312200324306031117 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef A_ATOMIZER_H_ #define A_ATOMIZER_H_ #include #include #include #include #include #include namespace android { struct AAtomizer { static const char *Atomize(const char *name); private: static AAtomizer gAtomizer; Mutex mLock; Vector > mAtoms; AAtomizer(); const char *atomize(const char *name); static uint32_t Hash(const char *s); DISALLOW_EVIL_CONSTRUCTORS(AAtomizer); }; } // namespace android #endif // A_ATOMIZER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/foundation/ADebug.h0000644000015700001700000000645312200324306030361 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef A_DEBUG_H_ #define A_DEBUG_H_ #include #include #include #include namespace android { #define LITERAL_TO_STRING_INTERNAL(x) #x #define LITERAL_TO_STRING(x) LITERAL_TO_STRING_INTERNAL(x) #define CHECK(condition) \ LOG_ALWAYS_FATAL_IF( \ !(condition), \ "%s", \ __FILE__ ":" LITERAL_TO_STRING(__LINE__) \ " CHECK(" #condition ") failed.") #define MAKE_COMPARATOR(suffix,op) \ template \ AString Compare_##suffix(const A &a, const B &b) { \ AString res; \ if (!(a op b)) { \ res.append(a); \ res.append(" vs. "); \ res.append(b); \ } \ return res; \ } MAKE_COMPARATOR(EQ,==) MAKE_COMPARATOR(NE,!=) MAKE_COMPARATOR(LE,<=) MAKE_COMPARATOR(GE,>=) MAKE_COMPARATOR(LT,<) MAKE_COMPARATOR(GT,>) #define CHECK_OP(x,y,suffix,op) \ do { \ AString ___res = Compare_##suffix(x, y); \ if (!___res.empty()) { \ AString ___full = \ __FILE__ ":" LITERAL_TO_STRING(__LINE__) \ " CHECK_" #suffix "( " #x "," #y ") failed: "; \ ___full.append(___res); \ \ LOG_ALWAYS_FATAL("%s", ___full.c_str()); \ } \ } while (false) #define CHECK_EQ(x,y) CHECK_OP(x,y,EQ,==) #define CHECK_NE(x,y) CHECK_OP(x,y,NE,!=) #define CHECK_LE(x,y) CHECK_OP(x,y,LE,<=) #define CHECK_LT(x,y) CHECK_OP(x,y,LT,<) #define CHECK_GE(x,y) CHECK_OP(x,y,GE,>=) #define CHECK_GT(x,y) CHECK_OP(x,y,GT,>) #define TRESPASS() \ LOG_ALWAYS_FATAL( \ __FILE__ ":" LITERAL_TO_STRING(__LINE__) \ " Should not be here."); } // namespace android #endif // A_DEBUG_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/foundation/ALooperRoster.h0000644000015700001700000000347412200324306031772 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef A_LOOPER_ROSTER_H_ #define A_LOOPER_ROSTER_H_ #include #include namespace android { struct ALooperRoster { ALooperRoster(); ALooper::handler_id registerHandler( const sp looper, const sp &handler); void unregisterHandler(ALooper::handler_id handlerID); status_t postMessage(const sp &msg, int64_t delayUs = 0); void deliverMessage(const sp &msg); status_t postAndAwaitResponse( const sp &msg, sp *response); void postReply(uint32_t replyID, const sp &reply); sp findLooper(ALooper::handler_id handlerID); private: struct HandlerInfo { wp mLooper; wp mHandler; }; Mutex mLock; KeyedVector mHandlers; ALooper::handler_id mNextHandlerID; uint32_t mNextReplyID; Condition mRepliesCondition; KeyedVector > mReplies; status_t postMessage_l(const sp &msg, int64_t delayUs); DISALLOW_EVIL_CONSTRUCTORS(ALooperRoster); }; } // namespace android #endif // A_LOOPER_ROSTER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/foundation/AHandler.h0000644000015700001700000000235412200324306030704 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef A_HANDLER_H_ #define A_HANDLER_H_ #include #include namespace android { struct AMessage; struct AHandler : public RefBase { AHandler() : mID(0) { } ALooper::handler_id id() const { return mID; } sp looper(); protected: virtual void onMessageReceived(const sp &msg) = 0; private: friend struct ALooperRoster; ALooper::handler_id mID; void setID(ALooper::handler_id id) { mID = id; } DISALLOW_EVIL_CONSTRUCTORS(AHandler); }; } // namespace android #endif // A_HANDLER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/foundation/AString.h0000644000015700001700000000470412200324306030576 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef A_STRING_H_ #define A_STRING_H_ #include namespace android { struct AString { AString(); AString(const char *s); AString(const char *s, size_t size); AString(const AString &from); AString(const AString &from, size_t offset, size_t n); ~AString(); AString &operator=(const AString &from); void setTo(const char *s); void setTo(const char *s, size_t size); void setTo(const AString &from, size_t offset, size_t n); size_t size() const; const char *c_str() const; bool empty() const; void clear(); void trim(); void erase(size_t start, size_t n); void append(char c) { append(&c, 1); } void append(const char *s); void append(const char *s, size_t size); void append(const AString &from); void append(const AString &from, size_t offset, size_t n); void append(int x); void append(unsigned x); void append(long x); void append(unsigned long x); void append(long long x); void append(unsigned long long x); void append(float x); void append(double x); void append(void *x); void insert(const AString &from, size_t insertionPos); void insert(const char *from, size_t size, size_t insertionPos); ssize_t find(const char *substring, size_t start = 0) const; size_t hash() const; bool operator==(const AString &other) const; bool operator<(const AString &other) const; bool operator>(const AString &other) const; int compare(const AString &other) const; bool startsWith(const char *prefix) const; bool endsWith(const char *suffix) const; void tolower(); private: static const char *kEmptyString; char *mData; size_t mSize; size_t mAllocSize; void makeMutable(); }; AString StringPrintf(const char *format, ...); } // namespace android #endif // A_STRING_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/foundation/AMessage.h0000644000015700001700000001124012200324306030705 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef A_MESSAGE_H_ #define A_MESSAGE_H_ #include #include #include #include namespace android { struct ABuffer; struct AString; struct Parcel; struct AMessage : public RefBase { AMessage(uint32_t what = 0, ALooper::handler_id target = 0); static sp FromParcel(const Parcel &parcel); void writeToParcel(Parcel *parcel) const; void setWhat(uint32_t what); uint32_t what() const; void setTarget(ALooper::handler_id target); ALooper::handler_id target() const; void clear(); void setInt32(const char *name, int32_t value); void setInt64(const char *name, int64_t value); void setSize(const char *name, size_t value); void setFloat(const char *name, float value); void setDouble(const char *name, double value); void setPointer(const char *name, void *value); void setString(const char *name, const char *s, ssize_t len = -1); void setObject(const char *name, const sp &obj); void setBuffer(const char *name, const sp &buffer); void setMessage(const char *name, const sp &obj); void setRect( const char *name, int32_t left, int32_t top, int32_t right, int32_t bottom); bool findInt32(const char *name, int32_t *value) const; bool findInt64(const char *name, int64_t *value) const; bool findSize(const char *name, size_t *value) const; bool findFloat(const char *name, float *value) const; bool findDouble(const char *name, double *value) const; bool findPointer(const char *name, void **value) const; bool findString(const char *name, AString *value) const; bool findObject(const char *name, sp *obj) const; bool findBuffer(const char *name, sp *buffer) const; bool findMessage(const char *name, sp *obj) const; bool findRect( const char *name, int32_t *left, int32_t *top, int32_t *right, int32_t *bottom) const; void post(int64_t delayUs = 0); // Posts the message to its target and waits for a response (or error) // before returning. status_t postAndAwaitResponse(sp *response); // If this returns true, the sender of this message is synchronously // awaiting a response, the "replyID" can be used to send the response // via "postReply" below. bool senderAwaitsResponse(uint32_t *replyID) const; void postReply(uint32_t replyID); // Performs a deep-copy of "this", contained messages are in turn "dup'ed". // Warning: RefBase items, i.e. "objects" are _not_ copied but only have // their refcount incremented. sp dup() const; AString debugString(int32_t indent = 0) const; enum Type { kTypeInt32, kTypeInt64, kTypeSize, kTypeFloat, kTypeDouble, kTypePointer, kTypeString, kTypeObject, kTypeMessage, kTypeRect, kTypeBuffer, }; size_t countEntries() const; const char *getEntryNameAt(size_t index, Type *type) const; protected: virtual ~AMessage(); private: uint32_t mWhat; ALooper::handler_id mTarget; struct Rect { int32_t mLeft, mTop, mRight, mBottom; }; struct Item { union { int32_t int32Value; int64_t int64Value; size_t sizeValue; float floatValue; double doubleValue; void *ptrValue; RefBase *refValue; AString *stringValue; Rect rectValue; } u; const char *mName; Type mType; }; enum { kMaxNumItems = 64 }; Item mItems[kMaxNumItems]; size_t mNumItems; Item *allocateItem(const char *name); void freeItem(Item *item); const Item *findItem(const char *name, Type type) const; void setObjectInternal( const char *name, const sp &obj, Type type); DISALLOW_EVIL_CONSTRUCTORS(AMessage); }; } // namespace android #endif // A_MESSAGE_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/foundation/ABase.h0000644000015700001700000000142012200324306030172 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef A_BASE_H_ #define A_BASE_H_ #define DISALLOW_EVIL_CONSTRUCTORS(name) \ name(const name &); \ name &operator=(const name &) #endif // A_BASE_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/foundation/ABuffer.h0000644000015700001700000000334112200324306030535 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef A_BUFFER_H_ #define A_BUFFER_H_ #include #include #include #include namespace android { struct AMessage; struct ABuffer : public RefBase { ABuffer(size_t capacity); ABuffer(void *data, size_t capacity); void setFarewellMessage(const sp msg); uint8_t *base() { return (uint8_t *)mData; } uint8_t *data() { return (uint8_t *)mData + mRangeOffset; } size_t capacity() const { return mCapacity; } size_t size() const { return mRangeLength; } size_t offset() const { return mRangeOffset; } void setRange(size_t offset, size_t size); void setInt32Data(int32_t data) { mInt32Data = data; } int32_t int32Data() const { return mInt32Data; } sp meta(); protected: virtual ~ABuffer(); private: sp mFarewell; sp mMeta; void *mData; size_t mCapacity; size_t mRangeOffset; size_t mRangeLength; int32_t mInt32Data; bool mOwnsData; DISALLOW_EVIL_CONSTRUCTORS(ABuffer); }; } // namespace android #endif // A_BUFFER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/foundation/ALooper.h0000644000015700001700000000372712200324306030574 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef A_LOOPER_H_ #define A_LOOPER_H_ #include #include #include #include #include #include #include namespace android { struct AHandler; struct AMessage; struct ALooper : public RefBase { typedef int32_t event_id; typedef int32_t handler_id; ALooper(); // Takes effect in a subsequent call to start(). void setName(const char *name); handler_id registerHandler(const sp &handler); void unregisterHandler(handler_id handlerID); status_t start( bool runOnCallingThread = false, bool canCallJava = false, int32_t priority = PRIORITY_DEFAULT ); status_t stop(); static int64_t GetNowUs(); protected: virtual ~ALooper(); private: friend struct ALooperRoster; struct Event { int64_t mWhenUs; sp mMessage; }; Mutex mLock; Condition mQueueChangedCondition; AString mName; List mEventQueue; struct LooperThread; sp mThread; bool mRunningLocally; void post(const sp &msg, int64_t delayUs); bool loop(); DISALLOW_EVIL_CONSTRUCTORS(ALooper); }; } // namespace android #endif // A_LOOPER_H_ android-audiosystem-1.8+13.10.20130807/include/media/stagefright/ExtendedWriter.h0000644000015700001700000000761012200324306030015 0ustar pbuserpbgroup00000000000000/* * Copyright (c) 2012, The Linux Foundation. All rights reserved. * * Not a Contribution, Apache license notifications and license are retained * for attribution purposes only. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef EXTENDED_WRITER_H_ #define EXTENDED_WRITER_H_ #include #include #include #include #define LITERAL_TO_STRING_INTERNAL(x) #x #define LITERAL_TO_STRING(x) LITERAL_TO_STRING_INTERNAL(x) #define CHECK_EQ(x,y) \ LOG_ALWAYS_FATAL_IF( \ (x) != (y), \ __FILE__ ":" LITERAL_TO_STRING(__LINE__) " " #x " != " #y) #define CHECK(x) \ LOG_ALWAYS_FATAL_IF( \ !(x), \ __FILE__ ":" LITERAL_TO_STRING(__LINE__) " " #x) namespace android { struct MediaSource; struct MetaData; struct ExtendedWriter : public MediaWriter { ExtendedWriter(const char *filename); ExtendedWriter(int fd); status_t initCheck() const; virtual status_t addSource(const sp &source); virtual bool reachedEOS(); virtual status_t start(MetaData *params = NULL); virtual status_t stop(); virtual status_t pause(); protected: virtual ~ExtendedWriter(); private: FILE *mFile; status_t mInitCheck; sp mSource; bool mStarted; volatile bool mPaused; volatile bool mResumed; volatile bool mDone; volatile bool mReachedEOS; pthread_t mThread; int64_t mEstimatedSizeBytes; int64_t mEstimatedDurationUs; int32_t mFormat; //QCP/EVRC header struct QCPEVRCHeader { /* RIFF Section */ char riff[4]; unsigned int s_riff; char qlcm[4]; /* Format chunk */ char fmt[4]; unsigned int s_fmt; char mjr; char mnr; unsigned int data1; /* UNIQUE ID of the codec */ unsigned short data2; unsigned short data3; char data4[8]; unsigned short ver; /* Codec Info */ char name[80]; unsigned short abps; /* average bits per sec of the codec */ unsigned short bytes_per_pkt; unsigned short samp_per_block; unsigned short samp_per_sec; unsigned short bits_per_samp; unsigned char vr_num_of_rates; /* Rate Header fmt info */ unsigned char rvd1[3]; unsigned short vr_bytes_per_pkt[8]; unsigned int rvd2[5]; /* Vrat chunk */ unsigned char vrat[4]; unsigned int s_vrat; unsigned int v_rate; unsigned int size_in_pkts; /* Data chunk */ unsigned char data[4]; unsigned int s_data; } __attribute__ ((packed)); struct QCPEVRCHeader mHeader; off_t mOffset; //note off_t static void *ThreadWrapper(void *); status_t threadFunc(); bool exceedsFileSizeLimit(); bool exceedsFileDurationLimit(); ExtendedWriter(const ExtendedWriter &); ExtendedWriter &operator=(const ExtendedWriter &); status_t writeQCPHeader( ); status_t writeEVRCHeader( ); }; } // namespace android #endif // AMR_WRITER_H_ android-audiosystem-1.8+13.10.20130807/include/media/EffectsFactoryApi.h0000644000015700001700000001653212200324306026115 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_EFFECTSFACTORYAPI_H_ #define ANDROID_EFFECTSFACTORYAPI_H_ #include #include #include #include #if __cplusplus extern "C" { #endif ///////////////////////////////////////////////// // Effect factory interface ///////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // // Function: EffectQueryNumberEffects // // Description: Returns the number of different effects in all loaded libraries. // Each effect must have a different effect uuid (see // effect_descriptor_t). This function together with EffectQueryEffect() // is used to enumerate all effects present in all loaded libraries. // Each time EffectQueryNumberEffects() is called, the factory must // reset the index of the effect descriptor returned by next call to // EffectQueryEffect() to restart enumeration from the beginning. // // Input/Output: // pNumEffects: address where the number of effects should be returned. // // Output: // returned value: 0 successful operation. // -ENODEV factory failed to initialize // -EINVAL invalid pNumEffects // *pNumEffects: updated with number of effects in factory // //////////////////////////////////////////////////////////////////////////////// int EffectQueryNumberEffects(uint32_t *pNumEffects); //////////////////////////////////////////////////////////////////////////////// // // Function: EffectQueryEffect // // Description: Returns a descriptor of the next available effect. // See effect_descriptor_t for a details on effect descriptor. // This function together with EffectQueryNumberEffects() is used to enumerate all // effects present in all loaded libraries. The enumeration sequence is: // EffectQueryNumberEffects(&num_effects); // for (i = 0; i < num_effects; i++) // EffectQueryEffect(i,...); // // Input/Output: // pDescriptor: address where to return the effect descriptor. // // Output: // returned value: 0 successful operation. // -ENOENT no more effect available // -ENODEV factory failed to initialize // -EINVAL invalid pDescriptor // -ENOSYS effect list has changed since last execution of EffectQueryNumberEffects() // *pDescriptor: updated with the effect descriptor. // //////////////////////////////////////////////////////////////////////////////// int EffectQueryEffect(uint32_t index, effect_descriptor_t *pDescriptor); //////////////////////////////////////////////////////////////////////////////// // // Function: EffectCreate // // Description: Creates an effect engine of the specified type and returns an // effect control interface on this engine. The function will allocate the // resources for an instance of the requested effect engine and return // a handle on the effect control interface. // // Input: // pEffectUuid: pointer to the effect uuid. // sessionId: audio session to which this effect instance will be attached. All effects created // with the same session ID are connected in series and process the same signal stream. // Knowing that two effects are part of the same effect chain can help the library implement // some kind of optimizations. // ioId: identifies the output or input stream this effect is directed to at audio HAL. For future // use especially with tunneled HW accelerated effects // // Input/Output: // pHandle: address where to return the effect handle. // // Output: // returned value: 0 successful operation. // -ENODEV factory failed to initialize // -EINVAL invalid pEffectUuid or pHandle // -ENOENT no effect with this uuid found // *pHandle: updated with the effect handle. // //////////////////////////////////////////////////////////////////////////////// int EffectCreate(const effect_uuid_t *pEffectUuid, int32_t sessionId, int32_t ioId, effect_handle_t *pHandle); //////////////////////////////////////////////////////////////////////////////// // // Function: EffectRelease // // Description: Releases the effect engine whose handle is given as argument. // All resources allocated to this particular instance of the effect are // released. // // Input: // handle: handle on the effect interface to be released. // // Output: // returned value: 0 successful operation. // -ENODEV factory failed to initialize // -EINVAL invalid interface handle // //////////////////////////////////////////////////////////////////////////////// int EffectRelease(effect_handle_t handle); //////////////////////////////////////////////////////////////////////////////// // // Function: EffectGetDescriptor // // Description: Returns the descriptor of the effect which uuid is pointed // to by first argument. // // Input: // pEffectUuid: pointer to the effect uuid. // // Input/Output: // pDescriptor: address where to return the effect descriptor. // // Output: // returned value: 0 successful operation. // -ENODEV factory failed to initialize // -EINVAL invalid pEffectUuid or pDescriptor // -ENOENT no effect with this uuid found // *pDescriptor: updated with the effect descriptor. // //////////////////////////////////////////////////////////////////////////////// int EffectGetDescriptor(const effect_uuid_t *pEffectUuid, effect_descriptor_t *pDescriptor); //////////////////////////////////////////////////////////////////////////////// // // Function: EffectIsNullUuid // // Description: Helper function to compare effect uuid to EFFECT_UUID_NULL // // Input: // pEffectUuid: pointer to effect uuid to compare to EFFECT_UUID_NULL. // // Output: // returned value: 0 if uuid is different from EFFECT_UUID_NULL. // 1 if uuid is equal to EFFECT_UUID_NULL. // //////////////////////////////////////////////////////////////////////////////// int EffectIsNullUuid(const effect_uuid_t *pEffectUuid); #if __cplusplus } // extern "C" #endif #endif /*ANDROID_EFFECTSFACTORYAPI_H_*/ android-audiosystem-1.8+13.10.20130807/include/media/IMediaDeathNotifier.h0000644000015700001700000000366012200324306026350 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_IMEDIADEATHNOTIFIER_H #define ANDROID_IMEDIADEATHNOTIFIER_H #include #include #include namespace android { class IMediaDeathNotifier: virtual public RefBase { public: IMediaDeathNotifier() { addObitRecipient(this); } virtual ~IMediaDeathNotifier() { removeObitRecipient(this); } virtual void died() = 0; static const sp& getMediaPlayerService(); private: IMediaDeathNotifier &operator=(const IMediaDeathNotifier &); IMediaDeathNotifier(const IMediaDeathNotifier &); static void addObitRecipient(const wp& recipient); static void removeObitRecipient(const wp& recipient); class DeathNotifier: public IBinder::DeathRecipient { public: DeathNotifier() {} virtual ~DeathNotifier(); virtual void binderDied(const wp& who); }; friend class DeathNotifier; static Mutex sServiceLock; static sp sMediaPlayerService; static sp sDeathNotifier; static SortedVector< wp > sObitRecipients; }; }; // namespace android #endif // ANDROID_IMEDIADEATHNOTIFIER_H android-audiosystem-1.8+13.10.20130807/include/media/Visualizer.h0000644000015700001700000001547112200324306024712 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_MEDIA_VISUALIZER_H #define ANDROID_MEDIA_VISUALIZER_H #include #include #include /** * The Visualizer class enables application to retrieve part of the currently playing audio for * visualization purpose. It is not an audio recording interface and only returns partial and low * quality audio content. However, to protect privacy of certain audio data (e.g voice mail) the use * of the visualizer requires the permission android.permission.RECORD_AUDIO. * The audio session ID passed to the constructor indicates which audio content should be * visualized: * - If the session is 0, the audio output mix is visualized * - If the session is not 0, the audio from a particular MediaPlayer or AudioTrack * using this audio session is visualized * Two types of representation of audio content can be captured: * - Waveform data: consecutive 8-bit (unsigned) mono samples by using the getWaveForm() method * - Frequency data: 8-bit magnitude FFT by using the getFft() method * * The length of the capture can be retrieved or specified by calling respectively * getCaptureSize() and setCaptureSize() methods. Note that the size of the FFT * is half of the specified capture size but both sides of the spectrum are returned yielding in a * number of bytes equal to the capture size. The capture size must be a power of 2 in the range * returned by getMinCaptureSize() and getMaxCaptureSize(). * In addition to the polling capture mode, a callback mode is also available by installing a * callback function by use of the setCaptureCallBack() method. The rate at which the callback * is called as well as the type of data returned is specified. * Before capturing data, the Visualizer must be enabled by calling the setEnabled() method. * When data capture is not needed any more, the Visualizer should be disabled. */ namespace android { // ---------------------------------------------------------------------------- class Visualizer: public AudioEffect { public: enum callback_flags { CAPTURE_WAVEFORM = 0x00000001, // capture callback returns a PCM wave form CAPTURE_FFT = 0x00000002, // apture callback returns a frequency representation CAPTURE_CALL_JAVA = 0x00000004 // the callback thread can call java }; /* Constructor. * See AudioEffect constructor for details on parameters. */ Visualizer(int32_t priority = 0, effect_callback_t cbf = NULL, void* user = NULL, int sessionId = 0); ~Visualizer(); virtual status_t setEnabled(bool enabled); // maximum capture size in samples static uint32_t getMaxCaptureSize() { return VISUALIZER_CAPTURE_SIZE_MAX; } // minimum capture size in samples static uint32_t getMinCaptureSize() { return VISUALIZER_CAPTURE_SIZE_MIN; } // maximum capture rate in millihertz static uint32_t getMaxCaptureRate() { return CAPTURE_RATE_MAX; } // callback used to return periodic PCM or FFT captures to the application. Either one or both // types of data are returned (PCM and FFT) according to flags indicated when installing the // callback. When a type of data is not present, the corresponding size (waveformSize or // fftSize) is 0. typedef void (*capture_cbk_t)(void* user, uint32_t waveformSize, uint8_t *waveform, uint32_t fftSize, uint8_t *fft, uint32_t samplingrate); // install a callback to receive periodic captures. The capture rate is specified in milliHertz // and the capture format is according to flags (see callback_flags). status_t setCaptureCallBack(capture_cbk_t cbk, void* user, uint32_t flags, uint32_t rate); // set the capture size capture size must be a power of two in the range // [VISUALIZER_CAPTURE_SIZE_MAX. VISUALIZER_CAPTURE_SIZE_MIN] // must be called when the visualizer is not enabled status_t setCaptureSize(uint32_t size); uint32_t getCaptureSize() { return mCaptureSize; } // returns the capture rate indicated when installing the callback uint32_t getCaptureRate() { return mCaptureRate; } // returns the sampling rate of the audio being captured uint32_t getSamplingRate() { return mSampleRate; } // set the way volume affects the captured data // mode must one of VISUALIZER_SCALING_MODE_NORMALIZED, // VISUALIZER_SCALING_MODE_AS_PLAYED status_t setScalingMode(uint32_t mode); uint32_t getScalingMode() { return mScalingMode; } // return a capture in PCM 8 bit unsigned format. The size of the capture is equal to // getCaptureSize() status_t getWaveForm(uint8_t *waveform); // return a capture in FFT 8 bit signed format. The size of the capture is equal to // getCaptureSize() but the length of the FFT is half of the size (both parts of the spectrum // are returned status_t getFft(uint8_t *fft); protected: // from IEffectClient virtual void controlStatusChanged(bool controlGranted); private: static const uint32_t CAPTURE_RATE_MAX = 20000; static const uint32_t CAPTURE_RATE_DEF = 10000; static const uint32_t CAPTURE_SIZE_DEF = VISUALIZER_CAPTURE_SIZE_MAX; /* internal class to handle the callback */ class CaptureThread : public Thread { public: CaptureThread(Visualizer& receiver, uint32_t captureRate, bool bCanCallJava = false); private: friend class Visualizer; virtual bool threadLoop(); Visualizer& mReceiver; Mutex mLock; uint32_t mSleepTimeUs; }; status_t doFft(uint8_t *fft, uint8_t *waveform); void periodicCapture(); uint32_t initCaptureSize(); Mutex mCaptureLock; uint32_t mCaptureRate; uint32_t mCaptureSize; uint32_t mSampleRate; uint32_t mScalingMode; capture_cbk_t mCaptureCallBack; void *mCaptureCbkUser; sp mCaptureThread; uint32_t mCaptureFlags; }; }; // namespace android #endif // ANDROID_MEDIA_VISUALIZER_H android-audiosystem-1.8+13.10.20130807/include/media/MemoryLeakTrackUtil.h0000644000015700001700000000153312200324306026437 0ustar pbuserpbgroup00000000000000/* * Copyright 2011, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MEMORY_LEAK_TRACK_UTIL_H #define MEMORY_LEAK_TRACK_UTIL_H namespace android { /* * Dump the memory address of the calling process to the given fd. */ extern void dumpMemoryAddresses(int fd); }; #endif // MEMORY_LEAK_TRACK_UTIL_H android-audiosystem-1.8+13.10.20130807/include/media/JetPlayer.h0000644000015700001700000000721612200324306024452 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef JETPLAYER_H_ #define JETPLAYER_H_ #include #include #include #include namespace android { typedef void (*jetevent_callback)(int eventType, int val1, int val2, void *cookie); class JetPlayer { public: // to keep in sync with the JetPlayer class constants // defined in frameworks/base/media/java/android/media/JetPlayer.java static const int JET_EVENT = 1; static const int JET_USERID_UPDATE = 2; static const int JET_NUMQUEUEDSEGMENT_UPDATE = 3; static const int JET_PAUSE_UPDATE = 4; JetPlayer(void *javaJetPlayer, int maxTracks = 32, int trackBufferSize = 1200); ~JetPlayer(); int init(); int release(); int loadFromFile(const char* url); int loadFromFD(const int fd, const long long offset, const long long length); int closeFile(); int play(); int pause(); int queueSegment(int segmentNum, int libNum, int repeatCount, int transpose, EAS_U32 muteFlags, EAS_U8 userID); int setMuteFlags(EAS_U32 muteFlags, bool sync); int setMuteFlag(int trackNum, bool muteFlag, bool sync); int triggerClip(int clipId); int clearQueue(); void setEventCallback(jetevent_callback callback); int getMaxTracks() { return mMaxTracks; }; private: int render(); void fireUpdateOnStatusChange(); void fireEventsFromJetQueue(); JetPlayer() {} // no default constructor void dump(); void dumpJetStatus(S_JET_STATUS* pJetStatus); jetevent_callback mEventCallback; void* mJavaJetPlayerRef; Mutex mMutex; // mutex to sync the render and playback thread with the JET calls pid_t mTid; Condition mCondition; volatile bool mRender; bool mPaused; EAS_STATE mState; int* mMemFailedVar; int mMaxTracks; // max number of MIDI tracks, usually 32 EAS_DATA_HANDLE mEasData; EAS_FILE_LOCATOR mEasJetFileLoc; EAS_PCM* mAudioBuffer;// EAS renders the MIDI data into this buffer, AudioTrack* mAudioTrack; // and we play it in this audio track int mTrackBufferSize; S_JET_STATUS mJetStatus; S_JET_STATUS mPreviousJetStatus; char mJetFilePath[PATH_MAX]; class JetPlayerThread : public Thread { public: JetPlayerThread(JetPlayer *player) : mPlayer(player) { } protected: virtual ~JetPlayerThread() {} private: JetPlayer *mPlayer; bool threadLoop() { int result; result = mPlayer->render(); return false; } JetPlayerThread(const JetPlayerThread &); JetPlayerThread &operator=(const JetPlayerThread &); }; sp mThread; }; // end class JetPlayer } // end namespace android #endif /*JETPLAYER_H_*/ android-audiosystem-1.8+13.10.20130807/include/media/AudioTrack.h0000644000015700001700000006152712200324306024606 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIOTRACK_H #define ANDROID_AUDIOTRACK_H #include #include #include #include #include #include #include #include #include #include #include #ifdef QCOM_HARDWARE #include #endif namespace android { // ---------------------------------------------------------------------------- class audio_track_cblk_t; // ---------------------------------------------------------------------------- class AudioTrack : #ifdef QCOM_HARDWARE public BnDirectTrackClient, #endif virtual public RefBase { public: enum channel_index { MONO = 0, LEFT = 0, RIGHT = 1 }; /* Events used by AudioTrack callback function (audio_track_cblk_t). */ enum event_type { EVENT_MORE_DATA = 0, // Request to write more data to PCM buffer. EVENT_UNDERRUN = 1, // PCM buffer underrun occured. EVENT_LOOP_END = 2, // Sample loop end was reached; playback restarted from loop start if loop count was not 0. EVENT_MARKER = 3, // Playback head is at the specified marker position (See setMarkerPosition()). EVENT_NEW_POS = 4, // Playback head is at a new position (See setPositionUpdatePeriod()). EVENT_BUFFER_END = 5 // Playback head is at the end of the buffer. }; /* Client should declare Buffer on the stack and pass address to obtainBuffer() * and releaseBuffer(). See also callback_t for EVENT_MORE_DATA. */ class Buffer { public: enum { MUTE = 0x00000001 }; uint32_t flags; // 0 or MUTE audio_format_t format; // but AUDIO_FORMAT_PCM_8_BIT -> AUDIO_FORMAT_PCM_16_BIT // accessed directly by WebKit ANP callback int channelCount; // will be removed in the future, do not use size_t frameCount; // number of sample frames corresponding to size; // on input it is the number of frames desired, // on output is the number of frames actually filled size_t size; // input/output in byte units union { void* raw; short* i16; // signed 16-bit int8_t* i8; // unsigned 8-bit, offset by 0x80 }; }; /* As a convenience, if a callback is supplied, a handler thread * is automatically created with the appropriate priority. This thread * invokes the callback when a new buffer becomes available or various conditions occur. * Parameters: * * event: type of event notified (see enum AudioTrack::event_type). * user: Pointer to context for use by the callback receiver. * info: Pointer to optional parameter according to event type: * - EVENT_MORE_DATA: pointer to AudioTrack::Buffer struct. The callback must not write * more bytes than indicated by 'size' field and update 'size' if fewer bytes are * written. * - EVENT_UNDERRUN: unused. * - EVENT_LOOP_END: pointer to an int indicating the number of loops remaining. * - EVENT_MARKER: pointer to an uint32_t containing the marker position in frames. * - EVENT_NEW_POS: pointer to an uint32_t containing the new position in frames. * - EVENT_BUFFER_END: unused. */ typedef void (*callback_t)(int event, void* user, void *info); /* Returns the minimum frame count required for the successful creation of * an AudioTrack object. * Returned status (from utils/Errors.h) can be: * - NO_ERROR: successful operation * - NO_INIT: audio server or audio hardware not initialized */ static status_t getMinFrameCount(int* frameCount, audio_stream_type_t streamType = AUDIO_STREAM_DEFAULT, uint32_t sampleRate = 0); /* Constructs an uninitialized AudioTrack. No connection with * AudioFlinger takes place. */ AudioTrack(); /* Creates an audio track and registers it with AudioFlinger. * Once created, the track needs to be started before it can be used. * Unspecified values are set to the audio hardware's current * values. * * Parameters: * * streamType: Select the type of audio stream this track is attached to * (e.g. AUDIO_STREAM_MUSIC). * sampleRate: Track sampling rate in Hz. * format: Audio format (e.g AUDIO_FORMAT_PCM_16_BIT for signed * 16 bits per sample). * channelMask: Channel mask. * frameCount: Minimum size of track PCM buffer in frames. This defines the * latency of the track. The actual size selected by the AudioTrack could be * larger if the requested size is not compatible with current audio HAL * latency. Zero means to use a default value. * flags: See comments on audio_output_flags_t in . * cbf: Callback function. If not null, this function is called periodically * to request new PCM data. * user: Context for use by the callback receiver. * notificationFrames: The callback function is called each time notificationFrames PCM * frames have been consumed from track input buffer. * sessionId: Specific session ID, or zero to use default. * threadCanCallJava: Whether callbacks are made from an attached thread and thus can call JNI. * If not present in parameter list, then fixed at false. */ AudioTrack( audio_stream_type_t streamType, uint32_t sampleRate = 0, audio_format_t format = AUDIO_FORMAT_DEFAULT, audio_channel_mask_t channelMask = 0, int frameCount = 0, audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE, callback_t cbf = NULL, void* user = NULL, int notificationFrames = 0, int sessionId = 0); // DEPRECATED explicit AudioTrack( int streamType, uint32_t sampleRate = 0, int format = AUDIO_FORMAT_DEFAULT, int channelMask = 0, int frameCount = 0, uint32_t flags = (uint32_t) AUDIO_OUTPUT_FLAG_NONE, callback_t cbf = 0, void* user = 0, int notificationFrames = 0, int sessionId = 0); /* Creates an audio track and registers it with AudioFlinger. With this constructor, * the PCM data to be rendered by AudioTrack is passed in a shared memory buffer * identified by the argument sharedBuffer. This prototype is for static buffer playback. * PCM data must be present in memory before the AudioTrack is started. * The write() and flush() methods are not supported in this case. * It is recommended to pass a callback function to be notified of playback end by an * EVENT_UNDERRUN event. */ AudioTrack( audio_stream_type_t streamType, uint32_t sampleRate = 0, audio_format_t format = AUDIO_FORMAT_DEFAULT, audio_channel_mask_t channelMask = 0, const sp& sharedBuffer = 0, audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE, callback_t cbf = NULL, void* user = NULL, int notificationFrames = 0, int sessionId = 0); /* Terminates the AudioTrack and unregisters it from AudioFlinger. * Also destroys all resources associated with the AudioTrack. */ ~AudioTrack(); /* Initialize an uninitialized AudioTrack. * Returned status (from utils/Errors.h) can be: * - NO_ERROR: successful initialization * - INVALID_OPERATION: AudioTrack is already initialized * - BAD_VALUE: invalid parameter (channelMask, format, sampleRate...) * - NO_INIT: audio server or audio hardware not initialized * */ status_t set(audio_stream_type_t streamType = AUDIO_STREAM_DEFAULT, uint32_t sampleRate = 0, audio_format_t format = AUDIO_FORMAT_DEFAULT, audio_channel_mask_t channelMask = 0, int frameCount = 0, audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE, callback_t cbf = NULL, void* user = NULL, int notificationFrames = 0, const sp& sharedBuffer = 0, bool threadCanCallJava = false, int sessionId = 0); /* Result of constructing the AudioTrack. This must be checked * before using any AudioTrack API (except for set()), because using * an uninitialized AudioTrack produces undefined results. * See set() method above for possible return codes. */ status_t initCheck() const; /* Returns this track's estimated latency in milliseconds. * This includes the latency due to AudioTrack buffer size, AudioMixer (if any) * and audio hardware driver. */ uint32_t latency() const; /* getters, see constructors and set() */ audio_stream_type_t streamType() const; audio_format_t format() const; int channelCount() const; uint32_t frameCount() const; /* Return channelCount * (bit depth per channel / 8). * channelCount is determined from channelMask, and bit depth comes from format. */ size_t frameSize() const; sp& sharedBuffer(); /* After it's created the track is not active. Call start() to * make it active. If set, the callback will start being called. */ void start(); /* Stop a track. If set, the callback will cease being called and * obtainBuffer returns STOPPED. Note that obtainBuffer() still works * and will fill up buffers until the pool is exhausted. */ void stop(); bool stopped() const; /* Flush a stopped track. All pending buffers are discarded. * This function has no effect if the track is not stopped. */ void flush(); /* Pause a track. If set, the callback will cease being called and * obtainBuffer returns STOPPED. Note that obtainBuffer() still works * and will fill up buffers until the pool is exhausted. */ void pause(); /* Mute or unmute this track. * While muted, the callback, if set, is still called. */ void mute(bool); bool muted() const; /* Set volume for this track, mostly used for games' sound effects * left and right volumes. Levels must be >= 0.0 and <= 1.0. */ status_t setVolume(float left, float right); void getVolume(float* left, float* right) const; /* Set the send level for this track. An auxiliary effect should be attached * to the track with attachEffect(). Level must be >= 0.0 and <= 1.0. */ status_t setAuxEffectSendLevel(float level); void getAuxEffectSendLevel(float* level) const; /* Set sample rate for this track, mostly used for games' sound effects */ status_t setSampleRate(int sampleRate); uint32_t getSampleRate() const; /* Enables looping and sets the start and end points of looping. * * Parameters: * * loopStart: loop start expressed as the number of PCM frames played since AudioTrack start. * loopEnd: loop end expressed as the number of PCM frames played since AudioTrack start. * loopCount: number of loops to execute. Calling setLoop() with loopCount == 0 cancels any * pending or active loop. loopCount = -1 means infinite looping. * * For proper operation the following condition must be respected: * (loopEnd-loopStart) <= framecount() */ status_t setLoop(uint32_t loopStart, uint32_t loopEnd, int loopCount); /* Sets marker position. When playback reaches the number of frames specified, a callback with * event type EVENT_MARKER is called. Calling setMarkerPosition with marker == 0 cancels marker * notification callback. * If the AudioTrack has been opened with no callback function associated, the operation will fail. * * Parameters: * * marker: marker position expressed in frames. * * Returned status (from utils/Errors.h) can be: * - NO_ERROR: successful operation * - INVALID_OPERATION: the AudioTrack has no callback installed. */ status_t setMarkerPosition(uint32_t marker); status_t getMarkerPosition(uint32_t *marker) const; /* Sets position update period. Every time the number of frames specified has been played, * a callback with event type EVENT_NEW_POS is called. * Calling setPositionUpdatePeriod with updatePeriod == 0 cancels new position notification * callback. * If the AudioTrack has been opened with no callback function associated, the operation will fail. * * Parameters: * * updatePeriod: position update notification period expressed in frames. * * Returned status (from utils/Errors.h) can be: * - NO_ERROR: successful operation * - INVALID_OPERATION: the AudioTrack has no callback installed. */ status_t setPositionUpdatePeriod(uint32_t updatePeriod); status_t getPositionUpdatePeriod(uint32_t *updatePeriod) const; /* Sets playback head position within AudioTrack buffer. The new position is specified * in number of frames. * This method must be called with the AudioTrack in paused or stopped state. * Note that the actual position set is modulo the AudioTrack buffer size in frames. * Therefore using this method makes sense only when playing a "static" audio buffer * as opposed to streaming. * The getPosition() method on the other hand returns the total number of frames played since * playback start. * * Parameters: * * position: New playback head position within AudioTrack buffer. * * Returned status (from utils/Errors.h) can be: * - NO_ERROR: successful operation * - INVALID_OPERATION: the AudioTrack is not stopped. * - BAD_VALUE: The specified position is beyond the number of frames present in AudioTrack buffer */ status_t setPosition(uint32_t position); status_t getPosition(uint32_t *position); /* Forces AudioTrack buffer full condition. When playing a static buffer, this method avoids * rewriting the buffer before restarting playback after a stop. * This method must be called with the AudioTrack in paused or stopped state. * * Returned status (from utils/Errors.h) can be: * - NO_ERROR: successful operation * - INVALID_OPERATION: the AudioTrack is not stopped. */ status_t reload(); /* Returns a handle on the audio output used by this AudioTrack. * * Parameters: * none. * * Returned value: * handle on audio hardware output */ audio_io_handle_t getOutput(); /* Returns the unique session ID associated with this track. * * Parameters: * none. * * Returned value: * AudioTrack session ID. */ int getSessionId() const; /* Attach track auxiliary output to specified effect. Use effectId = 0 * to detach track from effect. * * Parameters: * * effectId: effectId obtained from AudioEffect::id(). * * Returned status (from utils/Errors.h) can be: * - NO_ERROR: successful operation * - INVALID_OPERATION: the effect is not an auxiliary effect. * - BAD_VALUE: The specified effect ID is invalid */ status_t attachAuxEffect(int effectId); /* Obtains a buffer of "frameCount" frames. The buffer must be * filled entirely, and then released with releaseBuffer(). * If the track is stopped, obtainBuffer() returns * STOPPED instead of NO_ERROR as long as there are buffers available, * at which point NO_MORE_BUFFERS is returned. * Buffers will be returned until the pool (buffercount()) * is exhausted, at which point obtainBuffer() will either block * or return WOULD_BLOCK depending on the value of the "blocking" * parameter. * * Interpretation of waitCount: * +n limits wait time to n * WAIT_PERIOD_MS, * -1 causes an (almost) infinite wait time, * 0 non-blocking. */ enum { NO_MORE_BUFFERS = 0x80000001, // same name in AudioFlinger.h, ok to be different value STOPPED = 1 }; status_t obtainBuffer(Buffer* audioBuffer, int32_t waitCount); /* Release a filled buffer of "frameCount" frames for AudioFlinger to process. */ void releaseBuffer(Buffer* audioBuffer); /* As a convenience we provide a write() interface to the audio buffer. * This is implemented on top of obtainBuffer/releaseBuffer. For best * performance use callbacks. Returns actual number of bytes written >= 0, * or one of the following negative status codes: * INVALID_OPERATION AudioTrack is configured for shared buffer mode * BAD_VALUE size is invalid * STOPPED AudioTrack was stopped during the write * NO_MORE_BUFFERS when obtainBuffer() returns same * or any other error code returned by IAudioTrack::start() or restoreTrack_l(). */ ssize_t write(const void* buffer, size_t size); /* * Dumps the state of an audio track. */ status_t dump(int fd, const Vector& args) const; #ifdef QCOM_HARDWARE virtual void notify(int msg); virtual status_t getTimeStamp(uint64_t *tstamp); #endif protected: /* copying audio tracks is not allowed */ AudioTrack(const AudioTrack& other); AudioTrack& operator = (const AudioTrack& other); /* a small internal class to handle the callback */ class AudioTrackThread : public Thread { public: AudioTrackThread(AudioTrack& receiver, bool bCanCallJava = false); // Do not call Thread::requestExitAndWait() without first calling requestExit(). // Thread::requestExitAndWait() is not virtual, and the implementation doesn't do enough. virtual void requestExit(); void pause(); // suspend thread from execution at next loop boundary void resume(); // allow thread to execute, if not requested to exit private: friend class AudioTrack; virtual bool threadLoop(); AudioTrack& mReceiver; ~AudioTrackThread(); Mutex mMyLock; // Thread::mLock is private Condition mMyCond; // Thread::mThreadExitedCondition is private bool mPaused; // whether thread is currently paused }; // body of AudioTrackThread::threadLoop() bool processAudioBuffer(const sp& thread); status_t createTrack_l(audio_stream_type_t streamType, uint32_t sampleRate, audio_format_t format, audio_channel_mask_t channelMask, int frameCount, audio_output_flags_t flags, const sp& sharedBuffer, audio_io_handle_t output); void flush_l(); status_t setLoop_l(uint32_t loopStart, uint32_t loopEnd, int loopCount); audio_io_handle_t getOutput_l(); status_t restoreTrack_l(audio_track_cblk_t*& cblk, bool fromStart); bool stopped_l() const { return !mActive; } #ifdef QCOM_HARDWARE sp mDirectTrack; #endif sp mAudioTrack; sp mCblkMemory; sp mAudioTrackThread; float mVolume[2]; float mSendLevel; uint32_t mFrameCount; audio_track_cblk_t* mCblk; audio_format_t mFormat; audio_stream_type_t mStreamType; uint8_t mChannelCount; uint8_t mMuted; uint8_t mReserved; audio_channel_mask_t mChannelMask; status_t mStatus; uint32_t mLatency; bool mActive; // protected by mLock callback_t mCbf; // callback handler for events, or NULL void* mUserData; uint32_t mNotificationFramesReq; // requested number of frames between each notification callback uint32_t mNotificationFramesAct; // actual number of frames between each notification callback sp mSharedBuffer; int mLoopCount; uint32_t mRemainingFrames; uint32_t mMarkerPosition; bool mMarkerReached; uint32_t mNewPosition; uint32_t mUpdatePeriod; bool mFlushed; // FIXME will be made obsolete by making flush() synchronous audio_output_flags_t mFlags; #ifdef QCOM_HARDWARE sp mAudioFlinger; audio_io_handle_t mAudioDirectOutput; #endif int mSessionId; int mAuxEffectId; mutable Mutex mLock; status_t mRestoreStatus; #ifdef QCOM_HARDWARE void* mObserver; #endif bool mIsTimed; int mPreviousPriority; // before start() SchedPolicy mPreviousSchedulingGroup; }; class TimedAudioTrack : public AudioTrack { public: TimedAudioTrack(); /* allocate a shared memory buffer that can be passed to queueTimedBuffer */ status_t allocateTimedBuffer(size_t size, sp* buffer); /* queue a buffer obtained via allocateTimedBuffer for playback at the given timestamp. PTS units are microseconds on the media time timeline. The media time transform (set with setMediaTimeTransform) set by the audio producer will handle converting from media time to local time (perhaps going through the common time timeline in the case of synchronized multiroom audio case) */ status_t queueTimedBuffer(const sp& buffer, int64_t pts); /* define a transform between media time and either common time or local time */ enum TargetTimeline {LOCAL_TIME, COMMON_TIME}; status_t setMediaTimeTransform(const LinearTransform& xform, TargetTimeline target); }; }; // namespace android #endif // ANDROID_AUDIOTRACK_H android-audiosystem-1.8+13.10.20130807/include/media/ICrypto.h0000644000015700001700000000355212200324306024143 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #ifndef ANDROID_ICRYPTO_H_ #define ANDROID_ICRYPTO_H_ namespace android { struct AString; struct ICrypto : public IInterface { DECLARE_META_INTERFACE(Crypto); virtual status_t initCheck() const = 0; virtual bool isCryptoSchemeSupported(const uint8_t uuid[16]) const = 0; virtual status_t createPlugin( const uint8_t uuid[16], const void *data, size_t size) = 0; virtual status_t destroyPlugin() = 0; virtual bool requiresSecureDecoderComponent( const char *mime) const = 0; virtual ssize_t decrypt( bool secure, const uint8_t key[16], const uint8_t iv[16], CryptoPlugin::Mode mode, const void *srcPtr, const CryptoPlugin::SubSample *subSamples, size_t numSubSamples, void *dstPtr, AString *errorDetailMsg) = 0; private: DISALLOW_EVIL_CONSTRUCTORS(ICrypto); }; struct BnCrypto : public BnInterface { virtual status_t onTransact( uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags = 0); }; } // namespace android #endif // ANDROID_ICRYPTO_H_ android-audiosystem-1.8+13.10.20130807/include/media/ExtendedAudioBufferProvider.h0000644000015700001700000000177312200324306030144 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_EXTENDED_AUDIO_BUFFER_PROVIDER_H #define ANDROID_EXTENDED_AUDIO_BUFFER_PROVIDER_H #include namespace android { class ExtendedAudioBufferProvider : public AudioBufferProvider { public: virtual size_t framesReady() const = 0; // see description at AudioFlinger.h }; } // namespace android #endif // ANDROID_EXTENDED_AUDIO_BUFFER_PROVIDER_H android-audiosystem-1.8+13.10.20130807/include/media/IDirectTrackClient.h0000644000015700001700000000303712200324306026217 0ustar pbuserpbgroup00000000000000/* * Copyright (c) 2012, The Linux Foundation. All rights reserved. * Not a Contribution, Apache license notifications and license are retained * for attribution purposes only. * * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_IDIRECTTRACKCLIENT_H #define ANDROID_IDIRECTTRACKCLIENT_H #include #include #include namespace android { class IDirectTrackClient: public IInterface { public: DECLARE_META_INTERFACE(DirectTrackClient); virtual void notify(int msg) = 0; }; // ---------------------------------------------------------------------------- class BnDirectTrackClient: public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; }; // namespace android #endif // ANDROID_IDIRECTTRACKCLIENT_H android-audiosystem-1.8+13.10.20130807/include/media/IEffectClient.h0000644000015700001700000000327212200324306025215 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_IEFFECTCLIENT_H #define ANDROID_IEFFECTCLIENT_H #include #include #include #include namespace android { class IEffectClient: public IInterface { public: DECLARE_META_INTERFACE(EffectClient); virtual void controlStatusChanged(bool controlGranted) = 0; virtual void enableStatusChanged(bool enabled) = 0; virtual void commandExecuted(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, uint32_t replySize, void *pReplyData) = 0; }; // ---------------------------------------------------------------------------- class BnEffectClient: public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; }; // namespace android #endif // ANDROID_IEFFECTCLIENT_H android-audiosystem-1.8+13.10.20130807/include/media/nbaio/0000755000015700001700000000000012200324404023463 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/media/nbaio/PipeReader.h0000644000015700001700000000352012200324306025655 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_PIPE_READER_H #define ANDROID_AUDIO_PIPE_READER_H #include "Pipe.h" namespace android { // PipeReader is safe for only a single thread class PipeReader : public NBAIO_Source { public: // Construct a PipeReader and associate it with a Pipe // FIXME make this constructor a factory method of Pipe. PipeReader(Pipe& pipe); virtual ~PipeReader(); // NBAIO_Port interface //virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers, // NBAIO_Format counterOffers[], size_t& numCounterOffers); //virtual NBAIO_Format format() const; // NBAIO_Source interface //virtual size_t framesRead() const; virtual size_t framesOverrun() { return mFramesOverrun; } virtual size_t overruns() { return mOverruns; } virtual ssize_t availableToRead(); virtual ssize_t read(void *buffer, size_t count, int64_t readPTS); // NBAIO_Source end #if 0 // until necessary Pipe& pipe() const { return mPipe; } #endif private: Pipe& mPipe; int32_t mFront; // follows behind mPipe.mRear size_t mFramesOverrun; size_t mOverruns; }; } // namespace android #endif // ANDROID_AUDIO_PIPE_READER_H android-audiosystem-1.8+13.10.20130807/include/media/nbaio/MonoPipe.h0000644000015700001700000001520412200324306025365 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_MONO_PIPE_H #define ANDROID_AUDIO_MONO_PIPE_H #include #include #include "NBAIO.h" namespace android { // MonoPipe is similar to Pipe except: // - supports only a single reader, called MonoPipeReader // - write() cannot overrun; instead it will return a short actual count if insufficient space // - write() can optionally block if the pipe is full // Like Pipe, it is not multi-thread safe for either writer or reader // but writer and reader can be different threads. class MonoPipe : public NBAIO_Sink { friend class MonoPipeReader; public: // reqFrames will be rounded up to a power of 2, and all slots are available. Must be >= 2. // Note: whatever shares this object with another thread needs to do so in an SMP-safe way (like // creating it the object before creating the other thread, or storing the object with a // release_store). Otherwise the other thread could see a partially-constructed object. MonoPipe(size_t reqFrames, NBAIO_Format format, bool writeCanBlock = false); virtual ~MonoPipe(); // NBAIO_Port interface //virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers, // NBAIO_Format counterOffers[], size_t& numCounterOffers); //virtual NBAIO_Format format() const; // NBAIO_Sink interface //virtual size_t framesWritten() const; //virtual size_t framesUnderrun() const; //virtual size_t underruns() const; virtual ssize_t availableToWrite() const; virtual ssize_t write(const void *buffer, size_t count); //virtual ssize_t writeVia(writeVia_t via, size_t total, void *user, size_t block); // MonoPipe's implementation of getNextWriteTimestamp works in conjunction // with MonoPipeReader. Every time a MonoPipeReader reads from the pipe, it // receives a "readPTS" indicating the point in time for which the reader // would like to read data. This "last read PTS" is offset by the amt of // data the reader is currently mixing and then cached cached along with the // updated read pointer. This cached value is the local time for which the // reader is going to request data next time it reads data (assuming we are // in steady state and operating with no underflows). Writers to the // MonoPipe who would like to know when their next write operation will hit // the speakers can call getNextWriteTimestamp which will return the value // of the last read PTS plus the duration of the amt of data waiting to be // read in the MonoPipe. virtual status_t getNextWriteTimestamp(int64_t *timestamp); // average number of frames present in the pipe under normal conditions. // See throttling mechanism in MonoPipe::write() size_t getAvgFrames() const { return mSetpoint; } void setAvgFrames(size_t setpoint); size_t maxFrames() const { return mMaxFrames; } // Set the shutdown state for the write side of a pipe. // This may be called by an unrelated thread. When shutdown state is 'true', // a write that would otherwise block instead returns a short transfer count. // There is no guarantee how long it will take for the shutdown to be recognized, // but it will not be an unbounded amount of time. // The state can be restored to normal by calling shutdown(false). void shutdown(bool newState = true); // Return true if the write side of a pipe is currently shutdown. bool isShutdown(); private: // A pair of methods and a helper variable which allows the reader and the // writer to update and observe the values of mFront and mNextRdPTS in an // atomic lock-less fashion. // // :: Important :: // Two assumptions must be true in order for this lock-less approach to // function properly on all systems. First, there may only be one updater // thread in the system. Second, the updater thread must be running at a // strictly higher priority than the observer threads. Currently, both of // these assumptions are true. The only updater is always a single // FastMixer thread (which runs with SCHED_FIFO/RT priority while the only // observer is always an AudioFlinger::PlaybackThread running with // traditional (non-RT) audio priority. void updateFrontAndNRPTS(int32_t newFront, int64_t newNextRdPTS); void observeFrontAndNRPTS(int32_t *outFront, int64_t *outNextRdPTS); volatile int32_t mUpdateSeq; const size_t mReqFrames; // as requested in constructor, unrounded const size_t mMaxFrames; // always a power of 2 void * const mBuffer; // mFront and mRear will never be separated by more than mMaxFrames. // 32-bit overflow is possible if the pipe is active for a long time, but if that happens it's // safe because we "&" with (mMaxFrames-1) at end of computations to calculate a buffer index. volatile int32_t mFront; // written by the reader with updateFrontAndNRPTS, observed by // the writer with observeFrontAndNRPTS volatile int32_t mRear; // written by writer with android_atomic_release_store, // read by reader with android_atomic_acquire_load volatile int64_t mNextRdPTS; // written by the reader with updateFrontAndNRPTS, observed by // the writer with observeFrontAndNRPTS bool mWriteTsValid; // whether mWriteTs is valid struct timespec mWriteTs; // time that the previous write() completed size_t mSetpoint; // target value for pipe fill depth const bool mWriteCanBlock; // whether write() should block if the pipe is full int64_t offsetTimestampByAudioFrames(int64_t ts, size_t audFrames); LinearTransform mSamplesToLocalTime; bool mIsShutdown; // whether shutdown(true) was called, no barriers are needed }; } // namespace android #endif // ANDROID_AUDIO_MONO_PIPE_H android-audiosystem-1.8+13.10.20130807/include/media/nbaio/AudioBufferProviderSource.h0000644000015700001700000000366012200324306030731 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Implementation of NBAIO_Source that wraps an AudioBufferProvider #ifndef ANDROID_AUDIO_BUFFER_PROVIDER_SOURCE_H #define ANDROID_AUDIO_BUFFER_PROVIDER_SOURCE_H #include "NBAIO.h" #include namespace android { class AudioBufferProviderSource : public NBAIO_Source { public: AudioBufferProviderSource(AudioBufferProvider *provider, NBAIO_Format format); virtual ~AudioBufferProviderSource(); // NBAIO_Port interface //virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers, // NBAIO_Format counterOffers[], size_t& numCounterOffers); //virtual NBAIO_Format format(); // NBAIO_Source interface //virtual size_t framesRead() const; //virtual size_t framesOverrun(); //virtual size_t overruns(); virtual ssize_t availableToRead(); virtual ssize_t read(void *buffer, size_t count, int64_t readPTS); virtual ssize_t readVia(readVia_t via, size_t total, void *user, int64_t readPTS, size_t block); private: AudioBufferProvider * const mProvider; AudioBufferProvider::Buffer mBuffer; // current buffer size_t mConsumed; // number of frames consumed so far from current buffer }; } // namespace android #endif // ANDROID_AUDIO_BUFFER_PROVIDER_SOURCE_H android-audiosystem-1.8+13.10.20130807/include/media/nbaio/AudioStreamOutSink.h0000644000015700001700000000426512200324306027376 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_STREAM_OUT_SINK_H #define ANDROID_AUDIO_STREAM_OUT_SINK_H #include #include "NBAIO.h" namespace android { // not multi-thread safe class AudioStreamOutSink : public NBAIO_Sink { public: AudioStreamOutSink(audio_stream_out *stream); virtual ~AudioStreamOutSink(); // NBAIO_Port interface virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers, NBAIO_Format counterOffers[], size_t& numCounterOffers); //virtual NBAIO_Format format(); // NBAIO_Sink interface //virtual size_t framesWritten() const; //virtual size_t framesUnderrun() const; //virtual size_t underruns() const; // This is an over-estimate, and could dupe the caller into making a blocking write() // FIXME Use an audio HAL API to query the buffer emptying status when it's available. virtual ssize_t availableToWrite() const { return mStreamBufferSizeBytes >> mBitShift; } virtual ssize_t write(const void *buffer, size_t count); // AudioStreamOutSink wraps a HAL's output stream. Its // getNextWriteTimestamp method is simply a passthru to the HAL's underlying // implementation of GNWT (if any) virtual status_t getNextWriteTimestamp(int64_t *timestamp); // NBAIO_Sink end #if 0 // until necessary audio_stream_out *stream() const { return mStream; } #endif private: audio_stream_out * const mStream; size_t mStreamBufferSizeBytes; // as reported by get_buffer_size() }; } // namespace android #endif // ANDROID_AUDIO_STREAM_OUT_SINK_H android-audiosystem-1.8+13.10.20130807/include/media/nbaio/MonoPipeReader.h0000644000015700001700000000356112200324306026513 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_MONO_PIPE_READER_H #define ANDROID_AUDIO_MONO_PIPE_READER_H #include "MonoPipe.h" namespace android { // MonoPipeReader is safe for only a single reader thread class MonoPipeReader : public NBAIO_Source { public: // Construct a MonoPipeReader and associate it with a MonoPipe; // any data already in the pipe is visible to this PipeReader. // There can be only a single MonoPipeReader per MonoPipe. // FIXME make this constructor a factory method of MonoPipe. MonoPipeReader(MonoPipe* pipe); virtual ~MonoPipeReader(); // NBAIO_Port interface //virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers, // NBAIO_Format counterOffers[], size_t& numCounterOffers); //virtual NBAIO_Format format() const; // NBAIO_Source interface //virtual size_t framesRead() const; //virtual size_t framesOverrun(); //virtual size_t overruns(); virtual ssize_t availableToRead(); virtual ssize_t read(void *buffer, size_t count, int64_t readPTS); // NBAIO_Source end #if 0 // until necessary MonoPipe* pipe() const { return mPipe; } #endif private: MonoPipe * const mPipe; }; } // namespace android #endif // ANDROID_AUDIO_MONO_PIPE_READER_H android-audiosystem-1.8+13.10.20130807/include/media/nbaio/AudioStreamInSource.h0000644000015700001700000000403612200324306027525 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_STREAM_IN_SOURCE_H #define ANDROID_AUDIO_STREAM_IN_SOURCE_H #include #include "NBAIO.h" namespace android { // not multi-thread safe class AudioStreamInSource : public NBAIO_Source { public: AudioStreamInSource(audio_stream_in *stream); virtual ~AudioStreamInSource(); // NBAIO_Port interface virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers, NBAIO_Format counterOffers[], size_t& numCounterOffers); //virtual NBAIO_Format format() const; // NBAIO_Sink interface //virtual size_t framesRead() const; virtual size_t framesOverrun(); virtual size_t overruns() { (void) framesOverrun(); return mOverruns; } // This is an over-estimate, and could dupe the caller into making a blocking read() // FIXME Use an audio HAL API to query the buffer filling status when it's available. virtual ssize_t availableToRead() { return mStreamBufferSizeBytes >> mBitShift; } virtual ssize_t read(void *buffer, size_t count); // NBAIO_Sink end #if 0 // until necessary audio_stream_in *stream() const { return mStream; } #endif private: audio_stream_in * const mStream; size_t mStreamBufferSizeBytes; // as reported by get_buffer_size() size_t mFramesOverrun; size_t mOverruns; }; } // namespace android #endif // ANDROID_AUDIO_STREAM_IN_SOURCE_H android-audiosystem-1.8+13.10.20130807/include/media/nbaio/NBAIO.h0000644000015700001700000004207112200324306024471 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_NBAIO_H #define ANDROID_AUDIO_NBAIO_H // Non-blocking audio I/O interface // // This header file has the abstract interfaces only. Concrete implementation classes are declared // elsewhere. Implementations _should_ be non-blocking for all methods, especially read() and // write(), but this is not enforced. In general, implementations do not need to be multi-thread // safe, and any exceptions are noted in the particular implementation. #include #include #include #include namespace android { // In addition to the usual status_t enum { NEGOTIATE = 0x80000010, // Must (re-)negotiate format. For negotiate() only, the offeree // doesn't accept offers, and proposes counter-offers OVERRUN = 0x80000011, // availableToRead(), read(), or readVia() detected lost input due // to overrun; an event is counted and the caller should re-try UNDERRUN = 0x80000012, // availableToWrite(), write(), or writeVia() detected a gap in // output due to underrun (not being called often enough, or with // enough data); an event is counted and the caller should re-try }; // Negotiation of format is based on the data provider and data sink, or the data consumer and // data source, exchanging prioritized arrays of offers and counter-offers until a single offer is // mutually agreed upon. Each offer is an NBAIO_Format. For simplicity and performance, // NBAIO_Format is an enum that ties together the most important combinations of the various // attributes, rather than a struct with separate fields for format, sample rate, channel count, // interleave, packing, alignment, etc. The reason is that NBAIO_Format tries to abstract out only // the combinations that are actually needed within AudioFligner. If the list of combinations grows // too large, then this decision should be re-visited. enum NBAIO_Format { Format_Invalid, Format_SR44_1_C2_I16, // 44.1 kHz PCM stereo interleaved 16-bit signed Format_SR48_C2_I16, // 48 kHz PCM stereo interleaved 16-bit signed Format_SR44_1_C1_I16, // 44.1 kHz PCM mono interleaved 16-bit signed Format_SR48_C1_I16, // 48 kHz PCM mono interleaved 16-bit signed }; // Return the frame size of an NBAIO_Format in bytes size_t Format_frameSize(NBAIO_Format format); // Return the frame size of an NBAIO_Format as a bit shift size_t Format_frameBitShift(NBAIO_Format format); // Convert a sample rate in Hz and channel count to an NBAIO_Format NBAIO_Format Format_from_SR_C(unsigned sampleRate, unsigned channelCount); // Return the sample rate in Hz of an NBAIO_Format unsigned Format_sampleRate(NBAIO_Format format); // Return the channel count of an NBAIO_Format unsigned Format_channelCount(NBAIO_Format format); // Callbacks used by NBAIO_Sink::writeVia() and NBAIO_Source::readVia() below. typedef ssize_t (*writeVia_t)(void *user, void *buffer, size_t count); typedef ssize_t (*readVia_t)(void *user, const void *buffer, size_t count, int64_t readPTS); // Abstract class (interface) representing a data port. class NBAIO_Port : public RefBase { public: // negotiate() must called first. The purpose of negotiate() is to check compatibility of // formats, not to automatically adapt if they are incompatible. It's the responsibility of // whoever sets up the graph connections to make sure formats are compatible, and this method // just verifies that. The edges are "dumb" and don't attempt to adapt to bad connections. // How it works: offerer proposes an array of formats, in descending order of preference from // offers[0] to offers[numOffers - 1]. If offeree accepts one of these formats, it returns // the index of that offer. Otherwise, offeree sets numCounterOffers to the number of // counter-offers (up to a maximumum of the entry value of numCounterOffers), fills in the // provided array counterOffers[] with its counter-offers, in descending order of preference // from counterOffers[0] to counterOffers[numCounterOffers - 1], and returns NEGOTIATE. // Note that since the offerer allocates space for counter-offers, but only the offeree knows // how many counter-offers it has, there may be insufficient space for all counter-offers. // In that case, the offeree sets numCounterOffers to the requested number of counter-offers // (which is greater than the entry value of numCounterOffers), fills in as many of the most // important counterOffers as will fit, and returns NEGOTIATE. As this implies a re-allocation, // it should be used as a last resort. It is preferable for the offerer to simply allocate a // larger space to begin with, and/or for the offeree to tolerate a smaller space than desired. // Alternatively, the offerer can pass NULL for offers and counterOffers, and zero for // numOffers. This indicates that it has not allocated space for any counter-offers yet. // In this case, the offerree should set numCounterOffers appropriately and return NEGOTIATE. // Then the offerer will allocate the correct amount of memory and retry. // Format_Invalid is not allowed as either an offer or counter-offer. // Returns: // >= 0 Offer accepted. // NEGOTIATE No offer accepted, and counter-offer(s) optionally made. See above for details. virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers, NBAIO_Format counterOffers[], size_t& numCounterOffers); // Return the current negotiated format, or Format_Invalid if negotiation has not been done, // or if re-negotiation is required. virtual NBAIO_Format format() const { return mNegotiated ? mFormat : Format_Invalid; } protected: NBAIO_Port(NBAIO_Format format) : mNegotiated(false), mFormat(format), mBitShift(Format_frameBitShift(format)) { } virtual ~NBAIO_Port() { } // Implementations are free to ignore these if they don't need them bool mNegotiated; // mNegotiated implies (mFormat != Format_Invalid) NBAIO_Format mFormat; // (mFormat != Format_Invalid) does not imply mNegotiated size_t mBitShift; // assign in parallel with any assignment to mFormat }; // Abstract class (interface) representing a non-blocking data sink, for use by a data provider. class NBAIO_Sink : public NBAIO_Port { public: // For the next two APIs: // 32 bits rolls over after 27 hours at 44.1 kHz; if that concerns you then poll periodically. // Return the number of frames written successfully since construction. virtual size_t framesWritten() const { return mFramesWritten; } // Number of frames lost due to underrun since construction. virtual size_t framesUnderrun() const { return 0; } // Number of underruns since construction, where a set of contiguous lost frames is one event. virtual size_t underruns() const { return 0; } // Estimate of number of frames that could be written successfully now without blocking. // When a write() is actually attempted, the implementation is permitted to return a smaller or // larger transfer count, however it will make a good faith effort to give an accurate estimate. // Errors: // NEGOTIATE (Re-)negotiation is needed. // UNDERRUN write() has not been called frequently enough, or with enough frames to keep up. // An underrun event is counted, and the caller should re-try this operation. // WOULD_BLOCK Determining how many frames can be written without blocking would itself block. virtual ssize_t availableToWrite() const { return SSIZE_MAX; } // Transfer data to sink from single input buffer. Implies a copy. // Inputs: // buffer Non-NULL buffer owned by provider. // count Maximum number of frames to transfer. // Return value: // > 0 Number of frames successfully transferred prior to first error. // = 0 Count was zero. // < 0 status_t error occurred prior to the first frame transfer. // Errors: // NEGOTIATE (Re-)negotiation is needed. // WOULD_BLOCK No frames can be transferred without blocking. // UNDERRUN write() has not been called frequently enough, or with enough frames to keep up. // An underrun event is counted, and the caller should re-try this operation. virtual ssize_t write(const void *buffer, size_t count) = 0; // Transfer data to sink using a series of callbacks. More suitable for zero-fill, synthesis, // and non-contiguous transfers (e.g. circular buffer or writev). // Inputs: // via Callback function that the sink will call as many times as needed to consume data. // total Estimate of the number of frames the provider has available. This is an estimate, // and it can provide a different number of frames during the series of callbacks. // user Arbitrary void * reserved for data provider. // block Number of frames per block, that is a suggested value for 'count' in each callback. // Zero means no preference. This parameter is a hint only, and may be ignored. // Return value: // > 0 Total number of frames successfully transferred prior to first error. // = 0 Count was zero. // < 0 status_t error occurred prior to the first frame transfer. // Errors: // NEGOTIATE (Re-)negotiation is needed. // WOULD_BLOCK No frames can be transferred without blocking. // UNDERRUN write() has not been called frequently enough, or with enough frames to keep up. // An underrun event is counted, and the caller should re-try this operation. // // The 'via' callback is called by the data sink as follows: // Inputs: // user Arbitrary void * reserved for data provider. // buffer Non-NULL buffer owned by sink that callback should fill in with data, // up to a maximum of 'count' frames. // count Maximum number of frames to transfer during this callback. // Return value: // > 0 Number of frames successfully transferred during this callback prior to first error. // = 0 Count was zero. // < 0 status_t error occurred prior to the first frame transfer during this callback. virtual ssize_t writeVia(writeVia_t via, size_t total, void *user, size_t block = 0); // Get the time (on the LocalTime timeline) at which the first frame of audio of the next write // operation to this sink will be eventually rendered by the HAL. // Inputs: // ts A pointer pointing to the int64_t which will hold the result. // Return value: // OK Everything went well, *ts holds the time at which the first audio frame of the next // write operation will be rendered, or AudioBufferProvider::kInvalidPTS if this sink // does not know the answer for some reason. Sinks which eventually lead to a HAL // which implements get_next_write_timestamp may return Invalid temporarily if the DMA // output of the audio driver has not started yet. Sinks which lead to a HAL which // does not implement get_next_write_timestamp, or which don't lead to a HAL at all, // will always return kInvalidPTS. // Something unexpected happened internally. Check the logs and start debugging. virtual status_t getNextWriteTimestamp(int64_t *ts) { return INVALID_OPERATION; } protected: NBAIO_Sink(NBAIO_Format format = Format_Invalid) : NBAIO_Port(format), mFramesWritten(0) { } virtual ~NBAIO_Sink() { } // Implementations are free to ignore these if they don't need them size_t mFramesWritten; }; // Abstract class (interface) representing a non-blocking data source, for use by a data consumer. class NBAIO_Source : public NBAIO_Port { public: // For the next two APIs: // 32 bits rolls over after 27 hours at 44.1 kHz; if that concerns you then poll periodically. // Number of frames read successfully since construction. virtual size_t framesRead() const { return mFramesRead; } // Number of frames lost due to overrun since construction. // Not const because implementations may need to do I/O. virtual size_t framesOverrun() /*const*/ { return 0; } // Number of overruns since construction, where a set of contiguous lost frames is one event. // Not const because implementations may need to do I/O. virtual size_t overruns() /*const*/ { return 0; } // Estimate of number of frames that could be read successfully now. // When a read() is actually attempted, the implementation is permitted to return a smaller or // larger transfer count, however it will make a good faith effort to give an accurate estimate. // Errors: // NEGOTIATE (Re-)negotiation is needed. // OVERRUN One or more frames were lost due to overrun, try again to read more recent data. // WOULD_BLOCK Determining how many frames can be read without blocking would itself block. virtual ssize_t availableToRead() { return SSIZE_MAX; } // Transfer data from source into single destination buffer. Implies a copy. // Inputs: // buffer Non-NULL destination buffer owned by consumer. // count Maximum number of frames to transfer. // readPTS The presentation time (on the LocalTime timeline) for which data // is being requested, or kInvalidPTS if not known. // Return value: // > 0 Number of frames successfully transferred prior to first error. // = 0 Count was zero. // < 0 status_t error occurred prior to the first frame transfer. // Errors: // NEGOTIATE (Re-)negotiation is needed. // WOULD_BLOCK No frames can be transferred without blocking. // OVERRUN read() has not been called frequently enough, or with enough frames to keep up. // One or more frames were lost due to overrun, try again to read more recent data. virtual ssize_t read(void *buffer, size_t count, int64_t readPTS) = 0; // Transfer data from source using a series of callbacks. More suitable for zero-fill, // synthesis, and non-contiguous transfers (e.g. circular buffer or readv). // Inputs: // via Callback function that the source will call as many times as needed to provide data. // total Estimate of the number of frames the consumer desires. This is an estimate, // and it can consume a different number of frames during the series of callbacks. // user Arbitrary void * reserved for data consumer. // readPTS The presentation time (on the LocalTime timeline) for which data // is being requested, or kInvalidPTS if not known. // block Number of frames per block, that is a suggested value for 'count' in each callback. // Zero means no preference. This parameter is a hint only, and may be ignored. // Return value: // > 0 Total number of frames successfully transferred prior to first error. // = 0 Count was zero. // < 0 status_t error occurred prior to the first frame transfer. // Errors: // NEGOTIATE (Re-)negotiation is needed. // WOULD_BLOCK No frames can be transferred without blocking. // OVERRUN read() has not been called frequently enough, or with enough frames to keep up. // One or more frames were lost due to overrun, try again to read more recent data. // // The 'via' callback is called by the data source as follows: // Inputs: // user Arbitrary void * reserved for data consumer. // dest Non-NULL buffer owned by source that callback should consume data from, // up to a maximum of 'count' frames. // count Maximum number of frames to transfer during this callback. // Return value: // > 0 Number of frames successfully transferred during this callback prior to first error. // = 0 Count was zero. // < 0 status_t error occurred prior to the first frame transfer during this callback. virtual ssize_t readVia(readVia_t via, size_t total, void *user, int64_t readPTS, size_t block = 0); protected: NBAIO_Source(NBAIO_Format format = Format_Invalid) : NBAIO_Port(format), mFramesRead(0) { } virtual ~NBAIO_Source() { } // Implementations are free to ignore these if they don't need them size_t mFramesRead; }; } // namespace android #endif // ANDROID_AUDIO_NBAIO_H android-audiosystem-1.8+13.10.20130807/include/media/nbaio/roundup.h0000644000015700001700000000146612200324306025340 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ROUNDUP_H #define ROUNDUP_H #ifdef __cplusplus extern "C" { #endif // Round up to the next highest power of 2 unsigned roundup(unsigned v); #ifdef __cplusplus } #endif #endif // ROUNDUP_H android-audiosystem-1.8+13.10.20130807/include/media/nbaio/SourceAudioBufferProvider.h0000644000015700001700000000360212200324306030725 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Implementation of AudioBufferProvider that wraps an NBAIO_Source #ifndef ANDROID_SOURCE_AUDIO_BUFFER_PROVIDER_H #define ANDROID_SOURCE_AUDIO_BUFFER_PROVIDER_H #include "NBAIO.h" #include namespace android { class SourceAudioBufferProvider : public ExtendedAudioBufferProvider { public: SourceAudioBufferProvider(const sp& source); virtual ~SourceAudioBufferProvider(); // AudioBufferProvider interface virtual status_t getNextBuffer(Buffer *buffer, int64_t pts); virtual void releaseBuffer(Buffer *buffer); // ExtendedAudioBufferProvider interface virtual size_t framesReady() const; private: const sp mSource; // the wrapped source /*const*/ size_t mFrameBitShift; // log2(frame size in bytes) void* mAllocated; // pointer to base of allocated memory size_t mSize; // size of mAllocated in frames size_t mOffset; // frame offset within mAllocated of valid data size_t mRemaining; // frame count within mAllocated of valid data size_t mGetCount; // buffer.frameCount of the most recent getNextBuffer }; } // namespace android #endif // ANDROID_SOURCE_AUDIO_BUFFER_PROVIDER_H android-audiosystem-1.8+13.10.20130807/include/media/nbaio/LibsndfileSink.h0000644000015700001700000000326012200324306026536 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_LIBSNDFILE_SINK_H #define ANDROID_AUDIO_LIBSNDFILE_SINK_H #include "NBAIO.h" #include "sndfile.h" // Implementation of NBAIO_Sink that wraps a libsndfile opened in SFM_WRITE mode namespace android { class LibsndfileSink : public NBAIO_Sink { public: LibsndfileSink(SNDFILE *sndfile, const SF_INFO &sfinfo); virtual ~LibsndfileSink(); // NBAIO_Port interface //virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers, // NBAIO_Format counterOffers[], size_t& numCounterOffers); //virtual NBAIO_Format format() const; // NBAIO_Sink interface //virtual size_t framesWritten() const; //virtual size_t framesUnderrun() const; //virtual size_t underruns() const; //virtual ssize_t availableToWrite() const; virtual ssize_t write(const void *buffer, size_t count); //virtual ssize_t writeVia(writeVia_t via, size_t total, void *user, size_t block); private: SNDFILE * mSndfile; }; } // namespace android #endif // ANDROID_AUDIO_LIBSNDFILE_SINK_H android-audiosystem-1.8+13.10.20130807/include/media/nbaio/LibsndfileSource.h0000644000015700001700000000355012200324306027074 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_LIBSNDFILE_SOURCE_H #define ANDROID_AUDIO_LIBSNDFILE_SOURCE_H #include "NBAIO.h" #include "sndfile.h" // Implementation of NBAIO_Source that wraps a libsndfile opened in SFM_READ mode namespace android { class LibsndfileSource : public NBAIO_Source { public: // If 'loop' is true and it permits seeking, then we'll act as an infinite source LibsndfileSource(SNDFILE *sndfile, const SF_INFO &sfinfo, bool loop = false); virtual ~LibsndfileSource(); // NBAIO_Port interface //virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers, // NBAIO_Format counterOffers[], size_t& numCounterOffers); //virtual NBAIO_Format format() const; // NBAIO_Source interface //virtual size_t framesRead() const; //virtual size_t framesOverrun(); //virtual size_t overruns(); virtual ssize_t availableToRead(); virtual ssize_t read(void *buffer, size_t count); //virtual ssize_t readVia(readVia_t via, size_t total, void *user, size_t block); private: SNDFILE * mSndfile; sf_count_t mEstimatedFramesUntilEOF; bool mLooping; bool mReadAnyFramesThisLoopCycle; }; } // namespace android #endif // ANDROID_AUDIO_LIBSNDFILE_SOURCE_H android-audiosystem-1.8+13.10.20130807/include/media/nbaio/Pipe.h0000644000015700001700000000451212200324306024534 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_PIPE_H #define ANDROID_AUDIO_PIPE_H #include "NBAIO.h" namespace android { // Pipe is multi-thread safe for readers (see PipeReader), but safe for only a single writer thread. // It cannot UNDERRUN on write, unless we allow designation of a master reader that provides the // time-base. Readers can be added and removed dynamically, and it's OK to have no readers. class Pipe : public NBAIO_Sink { friend class PipeReader; public: // maxFrames will be rounded up to a power of 2, and all slots are available. Must be >= 2. Pipe(size_t maxFrames, NBAIO_Format format); virtual ~Pipe(); // NBAIO_Port interface //virtual ssize_t negotiate(const NBAIO_Format offers[], size_t numOffers, // NBAIO_Format counterOffers[], size_t& numCounterOffers); //virtual NBAIO_Format format() const; // NBAIO_Sink interface //virtual size_t framesWritten() const; //virtual size_t framesUnderrun() const; //virtual size_t underruns() const; // The write side of a pipe permits overruns; flow control is the caller's responsibility. // It doesn't return +infinity because that would guarantee an overrun. virtual ssize_t availableToWrite() const { return mMaxFrames; } virtual ssize_t write(const void *buffer, size_t count); //virtual ssize_t writeVia(writeVia_t via, size_t total, void *user, size_t block); private: const size_t mMaxFrames; // always a power of 2 void * const mBuffer; volatile int32_t mRear; // written by android_atomic_release_store volatile int32_t mReaders; // number of PipeReader clients currently attached to this Pipe }; } // namespace android #endif // ANDROID_AUDIO_PIPE_H android-audiosystem-1.8+13.10.20130807/include/media/IMediaMetadataRetriever.h0000644000015700001700000000356412200324306027236 0ustar pbuserpbgroup00000000000000/* ** ** Copyright (C) 2008 The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #ifndef ANDROID_IMEDIAMETADATARETRIEVER_H #define ANDROID_IMEDIAMETADATARETRIEVER_H #include #include #include #include #include namespace android { class IMediaMetadataRetriever: public IInterface { public: DECLARE_META_INTERFACE(MediaMetadataRetriever); virtual void disconnect() = 0; virtual status_t setDataSource( const char *srcUrl, const KeyedVector *headers = NULL) = 0; virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0; virtual sp getFrameAtTime(int64_t timeUs, int option) = 0; virtual sp extractAlbumArt() = 0; virtual const char* extractMetadata(int keyCode) = 0; }; // ---------------------------------------------------------------------------- class BnMediaMetadataRetriever: public BnInterface { public: virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; }; // namespace android #endif // ANDROID_IMEDIAMETADATARETRIEVER_H android-audiosystem-1.8+13.10.20130807/include/media/IEffect.h0000644000015700001700000000324112200324306024052 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_IEFFECT_H #define ANDROID_IEFFECT_H #include #include #include #include namespace android { class IEffect: public IInterface { public: DECLARE_META_INTERFACE(Effect); virtual status_t enable() = 0; virtual status_t disable() = 0; virtual status_t command(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, uint32_t *pReplySize, void *pReplyData) = 0; virtual void disconnect() = 0; virtual sp getCblk() const = 0; }; // ---------------------------------------------------------------------------- class BnEffect: public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; }; // namespace android #endif // ANDROID_IEFFECT_H android-audiosystem-1.8+13.10.20130807/include/media/IMediaPlayer.h0000644000015700001700000001146712200324306025063 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_IMEDIAPLAYER_H #define ANDROID_IMEDIAPLAYER_H #include #include #include #include #include // Fwd decl to make sure everyone agrees that the scope of struct sockaddr_in is // global, and not in android:: struct sockaddr_in; namespace android { class Parcel; class Surface; class IStreamSource; class ISurfaceTexture; class IMediaPlayer: public IInterface { public: DECLARE_META_INTERFACE(MediaPlayer); virtual void disconnect() = 0; virtual status_t setDataSource(const char *url, const KeyedVector* headers) = 0; virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0; virtual status_t setDataSource(const sp& source) = 0; virtual status_t setVideoSurfaceTexture( const sp& surfaceTexture) = 0; virtual status_t prepareAsync() = 0; virtual status_t start() = 0; virtual status_t stop() = 0; virtual status_t pause() = 0; virtual status_t isPlaying(bool* state) = 0; virtual status_t seekTo(int msec) = 0; virtual status_t getCurrentPosition(int* msec) = 0; virtual status_t getDuration(int* msec) = 0; virtual status_t reset() = 0; virtual status_t setAudioStreamType(audio_stream_type_t type) = 0; virtual status_t setLooping(int loop) = 0; virtual status_t setVolume(float leftVolume, float rightVolume) = 0; virtual status_t setAuxEffectSendLevel(float level) = 0; virtual status_t attachAuxEffect(int effectId) = 0; virtual status_t setParameter(int key, const Parcel& request) = 0; virtual status_t getParameter(int key, Parcel* reply) = 0; virtual status_t setRetransmitEndpoint(const struct sockaddr_in* endpoint) = 0; virtual status_t getRetransmitEndpoint(struct sockaddr_in* endpoint) = 0; virtual status_t setNextPlayer(const sp& next) = 0; // Invoke a generic method on the player by using opaque parcels // for the request and reply. // @param request Parcel that must start with the media player // interface token. // @param[out] reply Parcel to hold the reply data. Cannot be null. // @return OK if the invocation was made successfully. virtual status_t invoke(const Parcel& request, Parcel *reply) = 0; // Set a new metadata filter. // @param filter A set of allow and drop rules serialized in a Parcel. // @return OK if the invocation was made successfully. virtual status_t setMetadataFilter(const Parcel& filter) = 0; // Retrieve a set of metadata. // @param update_only Include only the metadata that have changed // since the last invocation of getMetadata. // The set is built using the unfiltered // notifications the native player sent to the // MediaPlayerService during that period of // time. If false, all the metadatas are considered. // @param apply_filter If true, once the metadata set has been built based // on the value update_only, the current filter is // applied. // @param[out] metadata On exit contains a set (possibly empty) of metadata. // Valid only if the call returned OK. // @return OK if the invocation was made successfully. virtual status_t getMetadata(bool update_only, bool apply_filter, Parcel *metadata) = 0; }; // ---------------------------------------------------------------------------- class BnMediaPlayer: public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; }; // namespace android #endif // ANDROID_IMEDIAPLAYER_H android-audiosystem-1.8+13.10.20130807/include/media/AudioRecord.h0000644000015700001700000003654512200324306024762 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef AUDIORECORD_H_ #define AUDIORECORD_H_ #include #include #include #include #include #include #include #include namespace android { class audio_track_cblk_t; // ---------------------------------------------------------------------------- class AudioRecord : virtual public RefBase { public: static const int DEFAULT_SAMPLE_RATE = 8000; /* Events used by AudioRecord callback function (callback_t). * Keep in sync with frameworks/base/media/java/android/media/AudioRecord.java NATIVE_EVENT_*. */ enum event_type { EVENT_MORE_DATA = 0, // Request to read more data from PCM buffer. EVENT_OVERRUN = 1, // PCM buffer overrun occured. EVENT_MARKER = 2, // Record head is at the specified marker position // (See setMarkerPosition()). EVENT_NEW_POS = 3, // Record head is at a new position // (See setPositionUpdatePeriod()). }; /* Create Buffer on the stack and pass it to obtainBuffer() * and releaseBuffer(). */ class Buffer { public: enum { MUTE = 0x00000001 }; uint32_t flags; int channelCount; audio_format_t format; size_t frameCount; size_t size; // total size in bytes == frameCount * frameSize union { void* raw; short* i16; int8_t* i8; }; }; /* As a convenience, if a callback is supplied, a handler thread * is automatically created with the appropriate priority. This thread * invokes the callback when a new buffer becomes ready or an overrun condition occurs. * Parameters: * * event: type of event notified (see enum AudioRecord::event_type). * user: Pointer to context for use by the callback receiver. * info: Pointer to optional parameter according to event type: * - EVENT_MORE_DATA: pointer to AudioRecord::Buffer struct. The callback must not read * more bytes than indicated by 'size' field and update 'size' if less bytes are * read. * - EVENT_OVERRUN: unused. * - EVENT_MARKER: pointer to const uint32_t containing the marker position in frames. * - EVENT_NEW_POS: pointer to const uint32_t containing the new position in frames. */ typedef void (*callback_t)(int event, void* user, void *info); /* Returns the minimum frame count required for the successful creation of * an AudioRecord object. * Returned status (from utils/Errors.h) can be: * - NO_ERROR: successful operation * - NO_INIT: audio server or audio hardware not initialized * - BAD_VALUE: unsupported configuration */ static status_t getMinFrameCount(int* frameCount, uint32_t sampleRate, audio_format_t format, audio_channel_mask_t channelMask); /* Constructs an uninitialized AudioRecord. No connection with * AudioFlinger takes place. */ AudioRecord(); /* Creates an AudioRecord track and registers it with AudioFlinger. * Once created, the track needs to be started before it can be used. * Unspecified values are set to the audio hardware's current * values. * * Parameters: * * inputSource: Select the audio input to record to (e.g. AUDIO_SOURCE_DEFAULT). * sampleRate: Track sampling rate in Hz. * format: Audio format (e.g AUDIO_FORMAT_PCM_16_BIT for signed * 16 bits per sample). * channelMask: Channel mask. * frameCount: Total size of track PCM buffer in frames. This defines the * latency of the track. * cbf: Callback function. If not null, this function is called periodically * to provide new PCM data. * user: Context for use by the callback receiver. * notificationFrames: The callback function is called each time notificationFrames PCM * frames are ready in record track output buffer. * sessionId: Not yet supported. */ AudioRecord(audio_source_t inputSource, uint32_t sampleRate = 0, audio_format_t format = AUDIO_FORMAT_DEFAULT, audio_channel_mask_t channelMask = AUDIO_CHANNEL_IN_MONO, int frameCount = 0, callback_t cbf = NULL, void* user = NULL, int notificationFrames = 0, int sessionId = 0); /* Terminates the AudioRecord and unregisters it from AudioFlinger. * Also destroys all resources associated with the AudioRecord. */ ~AudioRecord(); /* Initialize an uninitialized AudioRecord. * Returned status (from utils/Errors.h) can be: * - NO_ERROR: successful intialization * - INVALID_OPERATION: AudioRecord is already intitialized or record device is already in use * - BAD_VALUE: invalid parameter (channels, format, sampleRate...) * - NO_INIT: audio server or audio hardware not initialized * - PERMISSION_DENIED: recording is not allowed for the requesting process * */ status_t set(audio_source_t inputSource = AUDIO_SOURCE_DEFAULT, uint32_t sampleRate = 0, audio_format_t format = AUDIO_FORMAT_DEFAULT, audio_channel_mask_t channelMask = AUDIO_CHANNEL_IN_MONO, int frameCount = 0, callback_t cbf = NULL, void* user = NULL, int notificationFrames = 0, bool threadCanCallJava = false, int sessionId = 0); /* Result of constructing the AudioRecord. This must be checked * before using any AudioRecord API (except for set()), using * an uninitialized AudioRecord produces undefined results. * See set() method above for possible return codes. */ status_t initCheck() const; /* Returns this track's latency in milliseconds. * This includes the latency due to AudioRecord buffer size * and audio hardware driver. */ uint32_t latency() const; /* getters, see constructor and set() */ audio_format_t format() const; int channelCount() const; uint32_t frameCount() const; size_t frameSize() const; audio_source_t inputSource() const; /* After it's created the track is not active. Call start() to * make it active. If set, the callback will start being called. * if event is not AudioSystem::SYNC_EVENT_NONE, the capture start will be delayed until * the specified event occurs on the specified trigger session. */ status_t start(AudioSystem::sync_event_t event = AudioSystem::SYNC_EVENT_NONE, int triggerSession = 0); /* Stop a track. If set, the callback will cease being called and * obtainBuffer returns STOPPED. Note that obtainBuffer() still works * and will fill up buffers until the pool is exhausted. */ void stop(); bool stopped() const; /* get sample rate for this record track */ uint32_t getSampleRate() const; /* Sets marker position. When record reaches the number of frames specified, * a callback with event type EVENT_MARKER is called. Calling setMarkerPosition * with marker == 0 cancels marker notification callback. * If the AudioRecord has been opened with no callback function associated, * the operation will fail. * * Parameters: * * marker: marker position expressed in frames. * * Returned status (from utils/Errors.h) can be: * - NO_ERROR: successful operation * - INVALID_OPERATION: the AudioRecord has no callback installed. */ status_t setMarkerPosition(uint32_t marker); status_t getMarkerPosition(uint32_t *marker) const; /* Sets position update period. Every time the number of frames specified has been recorded, * a callback with event type EVENT_NEW_POS is called. * Calling setPositionUpdatePeriod with updatePeriod == 0 cancels new position notification * callback. * If the AudioRecord has been opened with no callback function associated, * the operation will fail. * * Parameters: * * updatePeriod: position update notification period expressed in frames. * * Returned status (from utils/Errors.h) can be: * - NO_ERROR: successful operation * - INVALID_OPERATION: the AudioRecord has no callback installed. */ status_t setPositionUpdatePeriod(uint32_t updatePeriod); status_t getPositionUpdatePeriod(uint32_t *updatePeriod) const; /* Gets record head position. The position is the total number of frames * recorded since record start. * * Parameters: * * position: Address where to return record head position within AudioRecord buffer. * * Returned status (from utils/Errors.h) can be: * - NO_ERROR: successful operation * - BAD_VALUE: position is NULL */ status_t getPosition(uint32_t *position) const; /* returns a handle on the audio input used by this AudioRecord. * * Parameters: * none. * * Returned value: * handle on audio hardware input */ audio_io_handle_t getInput() const; /* returns the audio session ID associated with this AudioRecord. * * Parameters: * none. * * Returned value: * AudioRecord session ID. */ int getSessionId() const; /* obtains a buffer of "frameCount" frames. The buffer must be * filled entirely. If the track is stopped, obtainBuffer() returns * STOPPED instead of NO_ERROR as long as there are buffers available, * at which point NO_MORE_BUFFERS is returned. * Buffers will be returned until the pool (buffercount()) * is exhausted, at which point obtainBuffer() will either block * or return WOULD_BLOCK depending on the value of the "blocking" * parameter. */ enum { NO_MORE_BUFFERS = 0x80000001, STOPPED = 1 }; status_t obtainBuffer(Buffer* audioBuffer, int32_t waitCount); void releaseBuffer(Buffer* audioBuffer); /* As a convenience we provide a read() interface to the audio buffer. * This is implemented on top of obtainBuffer/releaseBuffer. */ ssize_t read(void* buffer, size_t size); /* Return the amount of input frames lost in the audio driver since the last call of this * function. Audio driver is expected to reset the value to 0 and restart counting upon * returning the current value by this function call. Such loss typically occurs when the * user space process is blocked longer than the capacity of audio driver buffers. * Unit: the number of input audio frames */ unsigned int getInputFramesLost() const; private: /* copying audio tracks is not allowed */ AudioRecord(const AudioRecord& other); AudioRecord& operator = (const AudioRecord& other); /* a small internal class to handle the callback */ class AudioRecordThread : public Thread { public: AudioRecordThread(AudioRecord& receiver, bool bCanCallJava = false); // Do not call Thread::requestExitAndWait() without first calling requestExit(). // Thread::requestExitAndWait() is not virtual, and the implementation doesn't do enough. virtual void requestExit(); void pause(); // suspend thread from execution at next loop boundary void resume(); // allow thread to execute, if not requested to exit private: friend class AudioRecord; virtual bool threadLoop(); AudioRecord& mReceiver; virtual ~AudioRecordThread(); Mutex mMyLock; // Thread::mLock is private Condition mMyCond; // Thread::mThreadExitedCondition is private bool mPaused; // whether thread is currently paused }; // body of AudioRecordThread::threadLoop() bool processAudioBuffer(const sp& thread); status_t openRecord_l(uint32_t sampleRate, audio_format_t format, audio_channel_mask_t channelMask, int frameCount, audio_io_handle_t input); audio_io_handle_t getInput_l(); status_t restoreRecord_l(audio_track_cblk_t*& cblk); sp mAudioRecordThread; mutable Mutex mLock; bool mActive; // protected by mLock // for client callback handler callback_t mCbf; void* mUserData; // for notification APIs uint32_t mNotificationFrames; uint32_t mRemainingFrames; uint32_t mMarkerPosition; // in frames bool mMarkerReached; uint32_t mNewPosition; // in frames uint32_t mUpdatePeriod; // in ms // constant after constructor or set() uint32_t mFrameCount; audio_format_t mFormat; uint8_t mChannelCount; audio_source_t mInputSource; status_t mStatus; uint32_t mLatency; audio_channel_mask_t mChannelMask; audio_io_handle_t mInput; // returned by AudioSystem::getInput() int mSessionId; // may be changed if IAudioRecord object is re-created sp mAudioRecord; sp mCblkMemory; audio_track_cblk_t* mCblk; int mPreviousPriority; // before start() SchedPolicy mPreviousSchedulingGroup; }; }; // namespace android #endif /*AUDIORECORD_H_*/ android-audiosystem-1.8+13.10.20130807/include/media/MediaRecorderBase.h0000644000015700001700000000471012200324306026047 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MEDIA_RECORDER_BASE_H_ #define MEDIA_RECORDER_BASE_H_ #include #include namespace android { class ICameraRecordingProxy; class Surface; class ISurfaceTexture; struct MediaRecorderBase { MediaRecorderBase() {} virtual ~MediaRecorderBase() {} virtual status_t init() = 0; virtual status_t setAudioSource(audio_source_t as) = 0; virtual status_t setVideoSource(video_source vs) = 0; virtual status_t setOutputFormat(output_format of) = 0; virtual status_t setAudioEncoder(audio_encoder ae) = 0; virtual status_t setVideoEncoder(video_encoder ve) = 0; virtual status_t setVideoSize(int width, int height) = 0; virtual status_t setVideoFrameRate(int frames_per_second) = 0; virtual status_t setCamera(const sp& camera, const sp& proxy) = 0; virtual status_t setPreviewSurface(const sp& surface) = 0; virtual status_t setOutputFile(const char *path) = 0; virtual status_t setOutputFile(int fd, int64_t offset, int64_t length) = 0; virtual status_t setOutputFileAuxiliary(int fd) {return INVALID_OPERATION;} virtual status_t setParameters(const String8& params) = 0; virtual status_t setListener(const sp& listener) = 0; virtual status_t prepare() = 0; virtual status_t start() = 0; virtual status_t stop() = 0; virtual status_t close() = 0; virtual status_t reset() = 0; virtual status_t getMaxAmplitude(int *max) = 0; virtual status_t dump(int fd, const Vector& args) const = 0; virtual sp querySurfaceMediaSource() const = 0; private: MediaRecorderBase(const MediaRecorderBase &); MediaRecorderBase &operator=(const MediaRecorderBase &); }; } // namespace android #endif // MEDIA_RECORDER_BASE_H_ android-audiosystem-1.8+13.10.20130807/include/media/IAudioRecord.h0000644000015700001700000000377512200324306025072 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef IAUDIORECORD_H_ #define IAUDIORECORD_H_ #include #include #include #include #include #include namespace android { // ---------------------------------------------------------------------------- class IAudioRecord : public IInterface { public: DECLARE_META_INTERFACE(AudioRecord); /* After it's created the track is not active. Call start() to * make it active. */ virtual status_t start(int /*AudioSystem::sync_event_t*/ event, int triggerSession) = 0; /* Stop a track. If set, the callback will cease being called and * obtainBuffer will return an error. Buffers that are already released * will be processed, unless flush() is called. */ virtual void stop() = 0; /* get this tracks control block */ virtual sp getCblk() const = 0; }; // ---------------------------------------------------------------------------- class BnAudioRecord : public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; // ---------------------------------------------------------------------------- }; // namespace android #endif /*IAUDIORECORD_H_*/ android-audiosystem-1.8+13.10.20130807/include/media/IMediaPlayerService.h0000644000015700001700000000772212200324306026403 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_IMEDIAPLAYERSERVICE_H #define ANDROID_IMEDIAPLAYERSERVICE_H #include // for status_t #include #include #include #include #include #include #include #include #include namespace android { struct ICrypto; struct IHDCP; class IMediaRecorder; class IOMX; class IRemoteDisplay; class IRemoteDisplayClient; struct IStreamSource; class IMediaPlayerService: public IInterface { public: DECLARE_META_INTERFACE(MediaPlayerService); virtual sp createMediaRecorder(pid_t pid) = 0; virtual sp createMetadataRetriever(pid_t pid) = 0; virtual sp create(pid_t pid, const sp& client, int audioSessionId = 0) = 0; virtual sp decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) = 0; virtual sp decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) = 0; virtual sp getOMX() = 0; virtual sp makeCrypto() = 0; virtual sp makeHDCP() = 0; // Connects to a remote display. // 'iface' specifies the address of the local interface on which to listen for // a connection from the remote display as an ip address and port number // of the form "x.x.x.x:y". The media server should call back into the provided remote // display client when display connection, disconnection or errors occur. // The assumption is that at most one remote display will be connected to the // provided interface at a time. virtual sp listenForRemoteDisplay(const sp& client, const String8& iface) = 0; // codecs and audio devices usage tracking for the battery app enum BatteryDataBits { // tracking audio codec kBatteryDataTrackAudio = 0x1, // tracking video codec kBatteryDataTrackVideo = 0x2, // codec is started, otherwise codec is paused kBatteryDataCodecStarted = 0x4, // tracking decoder (for media player), // otherwise tracking encoder (for media recorder) kBatteryDataTrackDecoder = 0x8, // start to play an audio on an audio device kBatteryDataAudioFlingerStart = 0x10, // stop/pause the audio playback kBatteryDataAudioFlingerStop = 0x20, // audio is rounted to speaker kBatteryDataSpeakerOn = 0x40, // audio is rounted to devices other than speaker kBatteryDataOtherAudioDeviceOn = 0x80, }; virtual void addBatteryData(uint32_t params) = 0; virtual status_t pullBatteryData(Parcel* reply) = 0; }; // ---------------------------------------------------------------------------- class BnMediaPlayerService: public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; }; // namespace android #endif // ANDROID_IMEDIAPLAYERSERVICE_H android-audiosystem-1.8+13.10.20130807/include/media/IMediaRecorder.h0000644000015700001700000000506212200324306025366 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2008, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #ifndef ANDROID_IMEDIARECORDER_H #define ANDROID_IMEDIARECORDER_H #include namespace android { class Surface; class ICamera; class ICameraRecordingProxy; class IMediaRecorderClient; class ISurfaceTexture; class IMediaRecorder: public IInterface { public: DECLARE_META_INTERFACE(MediaRecorder); virtual status_t setCamera(const sp& camera, const sp& proxy) = 0; virtual status_t setPreviewSurface(const sp& surface) = 0; virtual status_t setVideoSource(int vs) = 0; virtual status_t setAudioSource(int as) = 0; virtual status_t setOutputFormat(int of) = 0; virtual status_t setVideoEncoder(int ve) = 0; virtual status_t setAudioEncoder(int ae) = 0; virtual status_t setOutputFile(const char* path) = 0; virtual status_t setOutputFile(int fd, int64_t offset, int64_t length) = 0; virtual status_t setVideoSize(int width, int height) = 0; virtual status_t setVideoFrameRate(int frames_per_second) = 0; virtual status_t setParameters(const String8& params) = 0; virtual status_t setListener(const sp& listener) = 0; virtual status_t prepare() = 0; virtual status_t getMaxAmplitude(int* max) = 0; virtual status_t start() = 0; virtual status_t stop() = 0; virtual status_t reset() = 0; virtual status_t init() = 0; virtual status_t close() = 0; virtual status_t release() = 0; virtual sp querySurfaceMediaSource() = 0; }; // ---------------------------------------------------------------------------- class BnMediaRecorder: public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; }; // namespace android #endif // ANDROID_IMEDIARECORDER_H android-audiosystem-1.8+13.10.20130807/include/media/IAudioPolicyService.h0000644000015700001700000001234012200324306026420 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_IAUDIOPOLICYSERVICE_H #define ANDROID_IAUDIOPOLICYSERVICE_H #include #include #include #include #include #include #include #include namespace android { // ---------------------------------------------------------------------------- class IAudioPolicyService : public IInterface { public: DECLARE_META_INTERFACE(AudioPolicyService); // // IAudioPolicyService interface (see AudioPolicyInterface for method descriptions) // virtual status_t setDeviceConnectionState(audio_devices_t device, audio_policy_dev_state_t state, const char *device_address) = 0; virtual audio_policy_dev_state_t getDeviceConnectionState(audio_devices_t device, const char *device_address) = 0; virtual status_t setPhoneState(audio_mode_t state) = 0; virtual status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config) = 0; virtual audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage) = 0; virtual audio_io_handle_t getOutput(audio_stream_type_t stream, uint32_t samplingRate = 0, audio_format_t format = AUDIO_FORMAT_DEFAULT, audio_channel_mask_t channelMask = 0, audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE) = 0; virtual status_t startOutput(audio_io_handle_t output, audio_stream_type_t stream, int session = 0) = 0; virtual status_t stopOutput(audio_io_handle_t output, audio_stream_type_t stream, int session = 0) = 0; virtual void releaseOutput(audio_io_handle_t output) = 0; virtual audio_io_handle_t getInput(audio_source_t inputSource, uint32_t samplingRate = 0, audio_format_t format = AUDIO_FORMAT_DEFAULT, audio_channel_mask_t channelMask = 0, int audioSession = 0) = 0; virtual status_t startInput(audio_io_handle_t input) = 0; virtual status_t stopInput(audio_io_handle_t input) = 0; virtual void releaseInput(audio_io_handle_t input) = 0; virtual status_t initStreamVolume(audio_stream_type_t stream, int indexMin, int indexMax) = 0; virtual status_t setStreamVolumeIndex(audio_stream_type_t stream, int index, audio_devices_t device) = 0; virtual status_t getStreamVolumeIndex(audio_stream_type_t stream, int *index, audio_devices_t device) = 0; virtual uint32_t getStrategyForStream(audio_stream_type_t stream) = 0; virtual audio_devices_t getDevicesForStream(audio_stream_type_t stream) = 0; virtual audio_io_handle_t getOutputForEffect(const effect_descriptor_t *desc) = 0; virtual status_t registerEffect(const effect_descriptor_t *desc, audio_io_handle_t io, uint32_t strategy, int session, int id) = 0; virtual status_t unregisterEffect(int id) = 0; virtual status_t setEffectEnabled(int id, bool enabled) = 0; virtual bool isStreamActive(audio_stream_type_t stream, uint32_t inPastMs = 0) const = 0; virtual bool isSourceActive(audio_source_t source) const = 0; virtual status_t queryDefaultPreProcessing(int audioSession, effect_descriptor_t *descriptors, uint32_t *count) = 0; }; // ---------------------------------------------------------------------------- class BnAudioPolicyService : public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; // ---------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_IAUDIOPOLICYSERVICE_H android-audiosystem-1.8+13.10.20130807/include/media/Metadata.h0000644000015700001700000001111712200324306024266 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_MEDIA_METADATA_H__ #define ANDROID_MEDIA_METADATA_H__ #include #include #include #include namespace android { class Parcel; namespace media { // Metadata is a class to build/serialize a set of metadata in a Parcel. // // This class should be kept in sync with android/media/Metadata.java. // It provides all the metadata ids available and methods to build the // header, add records and adjust the set size header field. // // Typical Usage: // ============== // Parcel p; // media::Metadata data(&p); // // data.appendHeader(); // data.appendBool(Metadata::kPauseAvailable, true); // ... more append ... // data.updateLength(); // class Metadata { public: typedef int32_t Type; typedef SortedVector Filter; static const Type kAny = 0; // Playback capabilities. static const Type kPauseAvailable = 1; // Boolean static const Type kSeekBackwardAvailable = 2; // Boolean static const Type kSeekForwardAvailable = 3; // Boolean static const Type kSeekAvailable = 4; // Boolean // Keep in sync with android/media/Metadata.java static const Type kTitle = 5; // String static const Type kComment = 6; // String static const Type kCopyright = 7; // String static const Type kAlbum = 8; // String static const Type kArtist = 9; // String static const Type kAuthor = 10; // String static const Type kComposer = 11; // String static const Type kGenre = 12; // String static const Type kDate = 13; // Date static const Type kDuration = 14; // Integer(millisec) static const Type kCdTrackNum = 15; // Integer 1-based static const Type kCdTrackMax = 16; // Integer static const Type kRating = 17; // String static const Type kAlbumArt = 18; // byte[] static const Type kVideoFrame = 19; // Bitmap static const Type kBitRate = 20; // Integer, Aggregate rate of // all the streams in bps. static const Type kAudioBitRate = 21; // Integer, bps static const Type kVideoBitRate = 22; // Integer, bps static const Type kAudioSampleRate = 23; // Integer, Hz static const Type kVideoframeRate = 24; // Integer, Hz // See RFC2046 and RFC4281. static const Type kMimeType = 25; // String static const Type kAudioCodec = 26; // String static const Type kVideoCodec = 27; // String static const Type kVideoHeight = 28; // Integer static const Type kVideoWidth = 29; // Integer static const Type kNumTracks = 30; // Integer static const Type kDrmCrippled = 31; // Boolean // @param p[inout] The parcel to append the metadata records // to. The global metadata header should have been set already. explicit Metadata(Parcel *p); ~Metadata(); // Rewind the underlying parcel, undoing all the changes. void resetParcel(); // Append the size and 'META' marker. bool appendHeader(); // Once all the records have been added, call this to update the // lenght field in the header. void updateLength(); // append* are methods to append metadata. // @param key Is the metadata Id. // @param val Is the value of the metadata. // @return true if successful, false otherwise. // TODO: add more as needed to handle other types. bool appendBool(Type key, bool val); bool appendInt32(Type key, int32_t val); private: Metadata(const Metadata&); Metadata& operator=(const Metadata&); // Checks the key is valid and not already present. bool checkKey(Type key); Parcel *mData; size_t mBegin; }; } // namespace android::media } // namespace android #endif // ANDROID_MEDIA_METADATA_H__ android-audiosystem-1.8+13.10.20130807/include/media/IDirectTrack.h0000644000015700001700000000556312200324306025066 0ustar pbuserpbgroup00000000000000/* * Copyright (c) 2012, The Linux Foundation. All rights reserved. * Not a Contribution, Apache license notifications and license are retained * for attribution purposes only. * * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_IDIRECTTRACK_H #define ANDROID_IDIRECTTRACK_H #include #include #include #include #include #include namespace android { // ---------------------------------------------------------------------------- class IDirectTrack : public IInterface { public: DECLARE_META_INTERFACE(DirectTrack); /* After it's created the track is not active. Call start() to * make it active. If set, the callback will start being called. */ virtual status_t start() = 0; /* Stop a track. If set, the callback will cease being called and * obtainBuffer will return an error. Buffers that are already released * will be processed, unless flush() is called. */ virtual void stop() = 0; /* flush a stopped track. All pending buffers are discarded. * This function has no effect if the track is not stoped. */ virtual void flush() = 0; /* mute or unmutes this track. * While mutted, the callback, if set, is still called. */ virtual void mute(bool) = 0; /* Pause a track. If set, the callback will cease being called and * obtainBuffer will return an error. Buffers that are already released * will be processed, unless flush() is called. */ virtual void pause() = 0; /* set volume for both left and right channels. */ virtual void setVolume(float l, float r) = 0; virtual ssize_t write(const void*, size_t) = 0; virtual int64_t getTimeStamp() = 0; }; // ---------------------------------------------------------------------------- class BnDirectTrack : public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; // ---------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_IAUDIOTRACK_H android-audiosystem-1.8+13.10.20130807/include/media/AudioParameter.h0000644000015700001700000000577112200324306025461 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008-2011 The Android Open Source Project * Copyright (c) 2012, The Linux Foundation. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIOPARAMETER_H_ #define ANDROID_AUDIOPARAMETER_H_ #include #include #include namespace android { class AudioParameter { public: AudioParameter() {} AudioParameter(const String8& keyValuePairs); virtual ~AudioParameter(); // reserved parameter keys for changing standard parameters with setParameters() function. // Using these keys is mandatory for AudioFlinger to properly monitor audio output/input // configuration changes and act accordingly. // keyRouting: to change audio routing, value is an int in audio_devices_t // keySamplingRate: to change sampling rate routing, value is an int // keyFormat: to change audio format, value is an int in audio_format_t // keyChannels: to change audio channel configuration, value is an int in audio_channels_t // keyFrameCount: to change audio output frame count, value is an int // keyInputSource: to change audio input source, value is an int in audio_source_t // (defined in media/mediarecorder.h) // keyScreenState: either "on" or "off" static const char * const keyRouting; static const char * const keySamplingRate; static const char * const keyFormat; static const char * const keyChannels; static const char * const keyFrameCount; static const char * const keyInputSource; static const char * const keyScreenState; #ifdef QCOM_HARDWARE static const char * const keyHandleFm; static const char * const keyVoipCheck; static const char * const keyFluenceType; static const char * const keySSR; static const char * const keyHandleA2dpDevice; #endif String8 toString(); status_t add(const String8& key, const String8& value); status_t addInt(const String8& key, const int value); status_t addFloat(const String8& key, const float value); status_t remove(const String8& key); status_t get(const String8& key, String8& value); status_t getInt(const String8& key, int& value); status_t getFloat(const String8& key, float& value); status_t getAt(size_t index, String8& key, String8& value); size_t size() { return mParameters.size(); } private: String8 mKeyValuePairs; KeyedVector mParameters; }; }; // namespace android #endif /*ANDROID_AUDIOPARAMETER_H_*/ android-audiosystem-1.8+13.10.20130807/include/media/mediametadataretriever.h0000644000015700001700000000605612200324306027264 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MEDIAMETADATARETRIEVER_H #define MEDIAMETADATARETRIEVER_H #include // for status_t #include #include #include namespace android { class IMediaPlayerService; class IMediaMetadataRetriever; // Keep these in synch with the constants defined in MediaMetadataRetriever.java // class. enum { METADATA_KEY_CD_TRACK_NUMBER = 0, METADATA_KEY_ALBUM = 1, METADATA_KEY_ARTIST = 2, METADATA_KEY_AUTHOR = 3, METADATA_KEY_COMPOSER = 4, METADATA_KEY_DATE = 5, METADATA_KEY_GENRE = 6, METADATA_KEY_TITLE = 7, METADATA_KEY_YEAR = 8, METADATA_KEY_DURATION = 9, METADATA_KEY_NUM_TRACKS = 10, METADATA_KEY_WRITER = 11, METADATA_KEY_MIMETYPE = 12, METADATA_KEY_ALBUMARTIST = 13, METADATA_KEY_DISC_NUMBER = 14, METADATA_KEY_COMPILATION = 15, METADATA_KEY_HAS_AUDIO = 16, METADATA_KEY_HAS_VIDEO = 17, METADATA_KEY_VIDEO_WIDTH = 18, METADATA_KEY_VIDEO_HEIGHT = 19, METADATA_KEY_BITRATE = 20, METADATA_KEY_TIMED_TEXT_LANGUAGES = 21, METADATA_KEY_IS_DRM = 22, METADATA_KEY_LOCATION = 23, METADATA_KEY_VIDEO_ROTATION = 24, // Add more here... }; class MediaMetadataRetriever: public RefBase { public: MediaMetadataRetriever(); ~MediaMetadataRetriever(); void disconnect(); status_t setDataSource( const char *dataSourceUrl, const KeyedVector *headers = NULL); status_t setDataSource(int fd, int64_t offset, int64_t length); sp getFrameAtTime(int64_t timeUs, int option); sp extractAlbumArt(); const char* extractMetadata(int keyCode); private: static const sp& getService(); class DeathNotifier: public IBinder::DeathRecipient { public: DeathNotifier() {} virtual ~DeathNotifier(); virtual void binderDied(const wp& who); }; static sp sDeathNotifier; static Mutex sServiceLock; static sp sService; Mutex mLock; sp mRetriever; }; }; // namespace android #endif // MEDIAMETADATARETRIEVER_H android-audiosystem-1.8+13.10.20130807/include/binder/0000755000015700001700000000000012200324404022557 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/binder/MemoryHeapPmem.h0000644000015700001700000000447012200324306025623 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_MEMORY_HEAP_PMEM_H #define ANDROID_MEMORY_HEAP_PMEM_H #include #include #include #include #include #include namespace android { class MemoryHeapBase; // --------------------------------------------------------------------------- class MemoryHeapPmem : public MemoryHeapBase { public: class MemoryPmem : public BnMemory { public: MemoryPmem(const sp& heap); ~MemoryPmem(); protected: const sp& getHeap() const { return mClientHeap; } private: friend class MemoryHeapPmem; virtual void revoke() = 0; sp mClientHeap; }; MemoryHeapPmem(const sp& pmemHeap, uint32_t flags = 0); ~MemoryHeapPmem(); /* HeapInterface additions */ virtual sp mapMemory(size_t offset, size_t size); /* make the whole heap visible (you know who you are) */ virtual status_t slap(); /* hide (revoke) the whole heap (the client will see the garbage page) */ virtual status_t unslap(); /* revoke all allocations made by this heap */ virtual void revoke(); private: /* use this to create your own IMemory for mapMemory */ virtual sp createMemory(size_t offset, size_t size); void remove(const wp& memory); private: sp mParentHeap; mutable Mutex mLock; SortedVector< wp > mAllocations; }; // --------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_MEMORY_HEAP_PMEM_H android-audiosystem-1.8+13.10.20130807/include/binder/IBinder.h0000644000015700001700000001400212200324306024242 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_IBINDER_H #define ANDROID_IBINDER_H #include #include #include #include #define B_PACK_CHARS(c1, c2, c3, c4) \ ((((c1)<<24)) | (((c2)<<16)) | (((c3)<<8)) | (c4)) // --------------------------------------------------------------------------- namespace android { class BBinder; class BpBinder; class IInterface; class Parcel; /** * Base class and low-level protocol for a remotable object. * You can derive from this class to create an object for which other * processes can hold references to it. Communication between processes * (method calls, property get and set) is down through a low-level * protocol implemented on top of the transact() API. */ class IBinder : public virtual RefBase { public: enum { FIRST_CALL_TRANSACTION = 0x00000001, LAST_CALL_TRANSACTION = 0x00ffffff, PING_TRANSACTION = B_PACK_CHARS('_','P','N','G'), DUMP_TRANSACTION = B_PACK_CHARS('_','D','M','P'), INTERFACE_TRANSACTION = B_PACK_CHARS('_', 'N', 'T', 'F'), SYSPROPS_TRANSACTION = B_PACK_CHARS('_', 'S', 'P', 'R'), // Corresponds to TF_ONE_WAY -- an asynchronous call. FLAG_ONEWAY = 0x00000001 }; IBinder(); /** * Check if this IBinder implements the interface named by * @a descriptor. If it does, the base pointer to it is returned, * which you can safely static_cast<> to the concrete C++ interface. */ virtual sp queryLocalInterface(const String16& descriptor); /** * Return the canonical name of the interface provided by this IBinder * object. */ virtual const String16& getInterfaceDescriptor() const = 0; virtual bool isBinderAlive() const = 0; virtual status_t pingBinder() = 0; virtual status_t dump(int fd, const Vector& args) = 0; virtual status_t transact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0) = 0; /** * This method allows you to add data that is transported through * IPC along with your IBinder pointer. When implementing a Binder * object, override it to write your desired data in to @a outData. * You can then call getConstantData() on your IBinder to retrieve * that data, from any process. You MUST return the number of bytes * written in to the parcel (including padding). */ class DeathRecipient : public virtual RefBase { public: virtual void binderDied(const wp& who) = 0; }; /** * Register the @a recipient for a notification if this binder * goes away. If this binder object unexpectedly goes away * (typically because its hosting process has been killed), * then DeathRecipient::binderDied() will be called with a reference * to this. * * The @a cookie is optional -- if non-NULL, it should be a * memory address that you own (that is, you know it is unique). * * @note You will only receive death notifications for remote binders, * as local binders by definition can't die without you dying as well. * Trying to use this function on a local binder will result in an * INVALID_OPERATION code being returned and nothing happening. * * @note This link always holds a weak reference to its recipient. * * @note You will only receive a weak reference to the dead * binder. You should not try to promote this to a strong reference. * (Nor should you need to, as there is nothing useful you can * directly do with it now that it has passed on.) */ virtual status_t linkToDeath(const sp& recipient, void* cookie = NULL, uint32_t flags = 0) = 0; /** * Remove a previously registered death notification. * The @a recipient will no longer be called if this object * dies. The @a cookie is optional. If non-NULL, you can * supply a NULL @a recipient, and the recipient previously * added with that cookie will be unlinked. */ virtual status_t unlinkToDeath( const wp& recipient, void* cookie = NULL, uint32_t flags = 0, wp* outRecipient = NULL) = 0; virtual bool checkSubclass(const void* subclassID) const; typedef void (*object_cleanup_func)(const void* id, void* obj, void* cleanupCookie); virtual void attachObject( const void* objectID, void* object, void* cleanupCookie, object_cleanup_func func) = 0; virtual void* findObject(const void* objectID) const = 0; virtual void detachObject(const void* objectID) = 0; virtual BBinder* localBinder(); virtual BpBinder* remoteBinder(); protected: virtual ~IBinder(); private: }; }; // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_IBINDER_H android-audiosystem-1.8+13.10.20130807/include/binder/MemoryHeapBaseIon.h0000644000015700001700000000264512200324306026247 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * Copyright 2011, Samsung Electronics Co. LTD * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /*! * \file MemoryHeapBaseIon.h * \brief header file for MemoryHeapBaseIon * \author MinGu, Jeon(mingu85.jeon) * \date 2011/11/20 * * Revision History: * - 2011/11/21 : MinGu, Jeon(mingu85.jeon)) \n * Initial version */ #ifndef ANDROID_MEMORY_HEAP_BASE_ION_H #define ANDROID_MEMORY_HEAP_BASE_ION_H #include #include #include namespace android { class MemoryHeapBaseIon : public MemoryHeapBase { public: enum { USE_ION_FD = IMemoryHeap::USE_ION_FD }; MemoryHeapBaseIon(size_t size, uint32_t flags = 0, char const* name = NULL); MemoryHeapBaseIon(int fd, size_t size, uint32_t flags = 0, uint32_t offset = 0); ~MemoryHeapBaseIon(); private: int mIonClient; }; }; #endif android-audiosystem-1.8+13.10.20130807/include/binder/IServiceManager.h0000644000015700001700000000576212200324306025747 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // #ifndef ANDROID_ISERVICE_MANAGER_H #define ANDROID_ISERVICE_MANAGER_H #include #include #include #include namespace android { // ---------------------------------------------------------------------- class IServiceManager : public IInterface { public: DECLARE_META_INTERFACE(ServiceManager); /** * Retrieve an existing service, blocking for a few seconds * if it doesn't yet exist. */ virtual sp getService( const String16& name) const = 0; /** * Retrieve an existing service, non-blocking. */ virtual sp checkService( const String16& name) const = 0; /** * Register a service. */ virtual status_t addService( const String16& name, const sp& service, bool allowIsolated = false) = 0; /** * Return list of all existing services. */ virtual Vector listServices() = 0; enum { GET_SERVICE_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION, CHECK_SERVICE_TRANSACTION, ADD_SERVICE_TRANSACTION, LIST_SERVICES_TRANSACTION, }; }; sp defaultServiceManager(); template status_t getService(const String16& name, sp* outService) { const sp sm = defaultServiceManager(); if (sm != NULL) { *outService = interface_cast(sm->getService(name)); if ((*outService) != NULL) return NO_ERROR; } return NAME_NOT_FOUND; } bool checkCallingPermission(const String16& permission); bool checkCallingPermission(const String16& permission, int32_t* outPid, int32_t* outUid); bool checkPermission(const String16& permission, pid_t pid, uid_t uid); // ---------------------------------------------------------------------- class BnServiceManager : public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; // ---------------------------------------------------------------------- }; // namespace android #endif // ANDROID_ISERVICE_MANAGER_H android-audiosystem-1.8+13.10.20130807/include/binder/ProcessState.h0000644000015700001700000000771612200324306025363 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_PROCESS_STATE_H #define ANDROID_PROCESS_STATE_H #include #include #include #include #include // --------------------------------------------------------------------------- namespace android { // Global variables extern int mArgC; extern const char* const* mArgV; extern int mArgLen; class IPCThreadState; class ProcessState : public virtual RefBase { public: static sp self(); void setContextObject(const sp& object); sp getContextObject(const sp& caller); void setContextObject(const sp& object, const String16& name); sp getContextObject(const String16& name, const sp& caller); void startThreadPool(); typedef bool (*context_check_func)(const String16& name, const sp& caller, void* userData); bool isContextManager(void) const; bool becomeContextManager( context_check_func checkFunc, void* userData); sp getStrongProxyForHandle(int32_t handle); wp getWeakProxyForHandle(int32_t handle); void expungeHandle(int32_t handle, IBinder* binder); void setArgs(int argc, const char* const argv[]); int getArgC() const; const char* const* getArgV() const; void setArgV0(const char* txt); void spawnPooledThread(bool isMain); status_t setThreadPoolMaxThreadCount(size_t maxThreads); private: friend class IPCThreadState; ProcessState(); ~ProcessState(); ProcessState(const ProcessState& o); ProcessState& operator=(const ProcessState& o); struct handle_entry { IBinder* binder; RefBase::weakref_type* refs; }; handle_entry* lookupHandleLocked(int32_t handle); int mDriverFD; void* mVMStart; mutable Mutex mLock; // protects everything below. VectormHandleToObject; bool mManagesContexts; context_check_func mBinderContextCheckFunc; void* mBinderContextUserData; KeyedVector > mContexts; String8 mRootDir; bool mThreadPoolStarted; volatile int32_t mThreadPoolSeq; }; }; // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_PROCESS_STATE_H android-audiosystem-1.8+13.10.20130807/include/binder/MemoryHeapBase.h0000644000015700001700000000563112200324306025577 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_MEMORY_HEAP_BASE_H #define ANDROID_MEMORY_HEAP_BASE_H #include #include #include namespace android { // --------------------------------------------------------------------------- class MemoryHeapBase : public virtual BnMemoryHeap { public: enum { READ_ONLY = IMemoryHeap::READ_ONLY, // memory won't be mapped locally, but will be mapped in the remote // process. DONT_MAP_LOCALLY = 0x00000100, NO_CACHING = 0x00000200 }; /* * maps the memory referenced by fd. but DOESN'T take ownership * of the filedescriptor (it makes a copy with dup() */ MemoryHeapBase(int fd, size_t size, uint32_t flags = 0, uint32_t offset = 0); /* * maps memory from the given device */ MemoryHeapBase(const char* device, size_t size = 0, uint32_t flags = 0); /* * maps memory from ashmem, with the given name for debugging */ MemoryHeapBase(size_t size, uint32_t flags = 0, char const* name = NULL); virtual ~MemoryHeapBase(); /* implement IMemoryHeap interface */ virtual int getHeapID() const; /* virtual address of the heap. returns MAP_FAILED in case of error */ virtual void* getBase() const; virtual size_t getSize() const; virtual uint32_t getFlags() const; virtual uint32_t getOffset() const; const char* getDevice() const; /* this closes this heap -- use carefully */ void dispose(); /* this is only needed as a workaround, use only if you know * what you are doing */ status_t setDevice(const char* device) { if (mDevice == 0) mDevice = device; return mDevice ? NO_ERROR : ALREADY_EXISTS; } protected: MemoryHeapBase(); // init() takes ownership of fd status_t init(int fd, void *base, int size, int flags = 0, const char* device = NULL); private: status_t mapfd(int fd, size_t size, uint32_t offset = 0); int mFD; size_t mSize; void* mBase; uint32_t mFlags; const char* mDevice; bool mNeedUnmap; uint32_t mOffset; }; // --------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_MEMORY_HEAP_BASE_H android-audiosystem-1.8+13.10.20130807/include/binder/BinderService.h0000644000015700001700000000350412200324306025457 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_BINDER_SERVICE_H #define ANDROID_BINDER_SERVICE_H #include #include #include #include #include #include #include // --------------------------------------------------------------------------- namespace android { template class BinderService { public: static status_t publish(bool allowIsolated = false) { sp sm(defaultServiceManager()); return sm->addService(String16(SERVICE::getServiceName()), new SERVICE(), allowIsolated); } static void publishAndJoinThreadPool(bool allowIsolated = false) { sp sm(defaultServiceManager()); sm->addService(String16(SERVICE::getServiceName()), new SERVICE(), allowIsolated); ProcessState::self()->startThreadPool(); IPCThreadState::self()->joinThreadPool(); } static void instantiate() { publish(); } static status_t shutdown() { return NO_ERROR; } }; }; // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_BINDER_SERVICE_H android-audiosystem-1.8+13.10.20130807/include/binder/IPermissionController.h0000644000015700001700000000326612200324306027245 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // #ifndef ANDROID_IPERMISSION_CONTROLLER_H #define ANDROID_IPERMISSION_CONTROLLER_H #include namespace android { // ---------------------------------------------------------------------- class IPermissionController : public IInterface { public: DECLARE_META_INTERFACE(PermissionController); virtual bool checkPermission(const String16& permission, int32_t pid, int32_t uid) = 0; enum { CHECK_PERMISSION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION }; }; // ---------------------------------------------------------------------- class BnPermissionController : public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; // ---------------------------------------------------------------------- }; // namespace android #endif // ANDROID_IPERMISSION_CONTROLLER_H android-audiosystem-1.8+13.10.20130807/include/binder/MemoryDealer.h0000644000015700001700000000324212200324306025317 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_MEMORY_DEALER_H #define ANDROID_MEMORY_DEALER_H #include #include #include #include namespace android { // ---------------------------------------------------------------------------- class SimpleBestFitAllocator; // ---------------------------------------------------------------------------- class MemoryDealer : public RefBase { public: MemoryDealer(size_t size, const char* name = 0); virtual sp allocate(size_t size); virtual void deallocate(size_t offset); virtual void dump(const char* what) const; sp getMemoryHeap() const { return heap(); } protected: virtual ~MemoryDealer(); private: const sp& heap() const; SimpleBestFitAllocator* allocator() const; sp mHeap; SimpleBestFitAllocator* mAllocator; }; // ---------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_MEMORY_DEALER_H android-audiosystem-1.8+13.10.20130807/include/binder/IMemory.h0000644000015700001700000000517712200324306024324 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_IMEMORY_H #define ANDROID_IMEMORY_H #include #include #include #include #include #include namespace android { // ---------------------------------------------------------------------------- class IMemoryHeap : public IInterface { public: DECLARE_META_INTERFACE(MemoryHeap); // flags returned by getFlags() enum { READ_ONLY = 0x00000001, USE_ION_FD = 0x00000008 }; virtual int getHeapID() const = 0; virtual void* getBase() const = 0; virtual size_t getSize() const = 0; virtual uint32_t getFlags() const = 0; virtual uint32_t getOffset() const = 0; // these are there just for backward source compatibility int32_t heapID() const { return getHeapID(); } void* base() const { return getBase(); } size_t virtualSize() const { return getSize(); } }; class BnMemoryHeap : public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); BnMemoryHeap(); protected: virtual ~BnMemoryHeap(); }; // ---------------------------------------------------------------------------- class IMemory : public IInterface { public: DECLARE_META_INTERFACE(Memory); virtual sp getMemory(ssize_t* offset=0, size_t* size=0) const = 0; // helpers void* fastPointer(const sp& heap, ssize_t offset) const; void* pointer() const; size_t size() const; ssize_t offset() const; }; class BnMemory : public BnInterface { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); BnMemory(); protected: virtual ~BnMemory(); }; // ---------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_IMEMORY_H android-audiosystem-1.8+13.10.20130807/include/binder/Parcel.h0000644000015700001700000003046612200324306024150 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_PARCEL_H #define ANDROID_PARCEL_H #include #include #include #include #include #include // --------------------------------------------------------------------------- namespace android { template class LightFlattenable; class Flattenable; class IBinder; class IPCThreadState; class ProcessState; class String8; class TextOutput; struct flat_binder_object; // defined in support_p/binder_module.h class Parcel { public: class ReadableBlob; class WritableBlob; Parcel(); ~Parcel(); const uint8_t* data() const; size_t dataSize() const; size_t dataAvail() const; size_t dataPosition() const; size_t dataCapacity() const; status_t setDataSize(size_t size); void setDataPosition(size_t pos) const; status_t setDataCapacity(size_t size); status_t setData(const uint8_t* buffer, size_t len); status_t appendFrom(const Parcel *parcel, size_t start, size_t len); bool pushAllowFds(bool allowFds); void restoreAllowFds(bool lastValue); bool hasFileDescriptors() const; // Writes the RPC header. status_t writeInterfaceToken(const String16& interface); // Parses the RPC header, returning true if the interface name // in the header matches the expected interface from the caller. // // Additionally, enforceInterface does part of the work of // propagating the StrictMode policy mask, populating the current // IPCThreadState, which as an optimization may optionally be // passed in. bool enforceInterface(const String16& interface, IPCThreadState* threadState = NULL) const; bool checkInterface(IBinder*) const; void freeData(); const size_t* objects() const; size_t objectsCount() const; status_t errorCheck() const; void setError(status_t err); status_t write(const void* data, size_t len); void* writeInplace(size_t len); status_t writeUnpadded(const void* data, size_t len); status_t writeInt32(int32_t val); status_t writeInt64(int64_t val); status_t writeFloat(float val); status_t writeDouble(double val); status_t writeIntPtr(intptr_t val); status_t writeCString(const char* str); status_t writeString8(const String8& str); status_t writeString16(const String16& str); status_t writeString16(const char16_t* str, size_t len); status_t writeStrongBinder(const sp& val); status_t writeWeakBinder(const wp& val); status_t write(const Flattenable& val); template status_t write(const LightFlattenable& val); // Place a native_handle into the parcel (the native_handle's file- // descriptors are dup'ed, so it is safe to delete the native_handle // when this function returns). // Doesn't take ownership of the native_handle. status_t writeNativeHandle(const native_handle* handle); // Place a file descriptor into the parcel. The given fd must remain // valid for the lifetime of the parcel. // The Parcel does not take ownership of the given fd unless you ask it to. status_t writeFileDescriptor(int fd, bool takeOwnership = false); // Place a file descriptor into the parcel. A dup of the fd is made, which // will be closed once the parcel is destroyed. status_t writeDupFileDescriptor(int fd); // Writes a blob to the parcel. // If the blob is small, then it is stored in-place, otherwise it is // transferred by way of an anonymous shared memory region. // The caller should call release() on the blob after writing its contents. status_t writeBlob(size_t len, WritableBlob* outBlob); status_t writeObject(const flat_binder_object& val, bool nullMetaData); // Like Parcel.java's writeNoException(). Just writes a zero int32. // Currently the native implementation doesn't do any of the StrictMode // stack gathering and serialization that the Java implementation does. status_t writeNoException(); void remove(size_t start, size_t amt); status_t read(void* outData, size_t len) const; const void* readInplace(size_t len) const; int32_t readInt32() const; status_t readInt32(int32_t *pArg) const; int64_t readInt64() const; status_t readInt64(int64_t *pArg) const; float readFloat() const; status_t readFloat(float *pArg) const; double readDouble() const; status_t readDouble(double *pArg) const; intptr_t readIntPtr() const; status_t readIntPtr(intptr_t *pArg) const; const char* readCString() const; String8 readString8() const; String16 readString16() const; const char16_t* readString16Inplace(size_t* outLen) const; sp readStrongBinder() const; wp readWeakBinder() const; status_t read(Flattenable& val) const; template status_t read(LightFlattenable& val) const; // Like Parcel.java's readExceptionCode(). Reads the first int32 // off of a Parcel's header, returning 0 or the negative error // code on exceptions, but also deals with skipping over rich // response headers. Callers should use this to read & parse the // response headers rather than doing it by hand. int32_t readExceptionCode() const; // Retrieve native_handle from the parcel. This returns a copy of the // parcel's native_handle (the caller takes ownership). The caller // must free the native_handle with native_handle_close() and // native_handle_delete(). native_handle* readNativeHandle() const; // Retrieve a file descriptor from the parcel. This returns the raw fd // in the parcel, which you do not own -- use dup() to get your own copy. int readFileDescriptor() const; // Reads a blob from the parcel. // The caller should call release() on the blob after reading its contents. status_t readBlob(size_t len, ReadableBlob* outBlob) const; const flat_binder_object* readObject(bool nullMetaData) const; // Explicitly close all file descriptors in the parcel. void closeFileDescriptors(); typedef void (*release_func)(Parcel* parcel, const uint8_t* data, size_t dataSize, const size_t* objects, size_t objectsSize, void* cookie); const uint8_t* ipcData() const; size_t ipcDataSize() const; const size_t* ipcObjects() const; size_t ipcObjectsCount() const; void ipcSetDataReference(const uint8_t* data, size_t dataSize, const size_t* objects, size_t objectsCount, release_func relFunc, void* relCookie); void print(TextOutput& to, uint32_t flags = 0) const; private: Parcel(const Parcel& o); Parcel& operator=(const Parcel& o); status_t finishWrite(size_t len); void releaseObjects(); void acquireObjects(); status_t growData(size_t len); status_t restartWrite(size_t desired); status_t continueWrite(size_t desired); void freeDataNoInit(); void initState(); void scanForFds() const; template status_t readAligned(T *pArg) const; template T readAligned() const; template status_t writeAligned(T val); status_t mError; uint8_t* mData; size_t mDataSize; size_t mDataCapacity; mutable size_t mDataPos; size_t* mObjects; size_t mObjectsSize; size_t mObjectsCapacity; mutable size_t mNextObjectHint; mutable bool mFdsKnown; mutable bool mHasFds; bool mAllowFds; release_func mOwner; void* mOwnerCookie; class Blob { public: Blob(); ~Blob(); void release(); inline size_t size() const { return mSize; } protected: void init(bool mapped, void* data, size_t size); void clear(); bool mMapped; void* mData; size_t mSize; }; public: class ReadableBlob : public Blob { friend class Parcel; public: inline const void* data() const { return mData; } }; class WritableBlob : public Blob { friend class Parcel; public: inline void* data() { return mData; } }; }; // --------------------------------------------------------------------------- template status_t Parcel::write(const LightFlattenable& val) { size_t size(val.getSize()); if (!val.isFixedSize()) { status_t err = writeInt32(size); if (err != NO_ERROR) { return err; } } if (size) { void* buffer = writeInplace(size); return buffer == NULL ? NO_MEMORY : val.flatten(buffer); } return NO_ERROR; } template status_t Parcel::read(LightFlattenable& val) const { size_t size; if (val.isFixedSize()) { size = val.getSize(); } else { int32_t s; status_t err = readInt32(&s); if (err != NO_ERROR) { return err; } size = s; } if (size) { void const* buffer = readInplace(size); return buffer == NULL ? NO_MEMORY : val.unflatten(buffer, size); } return NO_ERROR; } // --------------------------------------------------------------------------- inline TextOutput& operator<<(TextOutput& to, const Parcel& parcel) { parcel.print(to); return to; } // --------------------------------------------------------------------------- // Generic acquire and release of objects. void acquire_object(const sp& proc, const flat_binder_object& obj, const void* who); void release_object(const sp& proc, const flat_binder_object& obj, const void* who); void flatten_binder(const sp& proc, const sp& binder, flat_binder_object* out); void flatten_binder(const sp& proc, const wp& binder, flat_binder_object* out); status_t unflatten_binder(const sp& proc, const flat_binder_object& flat, sp* out); status_t unflatten_binder(const sp& proc, const flat_binder_object& flat, wp* out); }; // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_PARCEL_H android-audiosystem-1.8+13.10.20130807/include/binder/IPCThreadState.h0000644000015700001700000001236612200324306025505 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_IPC_THREAD_STATE_H #define ANDROID_IPC_THREAD_STATE_H #include #include #include #include #ifdef HAVE_WIN32_PROC typedef int uid_t; #endif // --------------------------------------------------------------------------- namespace android { class IPCThreadState { public: static IPCThreadState* self(); static IPCThreadState* selfOrNull(); // self(), but won't instantiate sp process(); status_t clearLastError(); int getCallingPid(); int getCallingUid(); void setStrictModePolicy(int32_t policy); int32_t getStrictModePolicy() const; void setLastTransactionBinderFlags(int32_t flags); int32_t getLastTransactionBinderFlags() const; int64_t clearCallingIdentity(); void restoreCallingIdentity(int64_t token); void flushCommands(); void joinThreadPool(bool isMain = true); // Stop the local process. void stopProcess(bool immediate = true); status_t transact(int32_t handle, uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags); void incStrongHandle(int32_t handle); void decStrongHandle(int32_t handle); void incWeakHandle(int32_t handle); void decWeakHandle(int32_t handle); status_t attemptIncStrongHandle(int32_t handle); static void expungeHandle(int32_t handle, IBinder* binder); status_t requestDeathNotification( int32_t handle, BpBinder* proxy); status_t clearDeathNotification( int32_t handle, BpBinder* proxy); static void shutdown(); // Call this to disable switching threads to background scheduling when // receiving incoming IPC calls. This is specifically here for the // Android system process, since it expects to have background apps calling // in to it but doesn't want to acquire locks in its services while in // the background. static void disableBackgroundScheduling(bool disable); private: IPCThreadState(); ~IPCThreadState(); status_t sendReply(const Parcel& reply, uint32_t flags); status_t waitForResponse(Parcel *reply, status_t *acquireResult=NULL); status_t talkWithDriver(bool doReceive=true); status_t writeTransactionData(int32_t cmd, uint32_t binderFlags, int32_t handle, uint32_t code, const Parcel& data, status_t* statusBuffer); status_t executeCommand(int32_t command); void clearCaller(); static void threadDestructor(void *st); static void freeBuffer(Parcel* parcel, const uint8_t* data, size_t dataSize, const size_t* objects, size_t objectsSize, void* cookie); const sp mProcess; const pid_t mMyThreadId; Vector mPendingStrongDerefs; Vector mPendingWeakDerefs; Parcel mIn; Parcel mOut; status_t mLastError; pid_t mCallingPid; uid_t mCallingUid; int32_t mStrictModePolicy; int32_t mLastTransactionBinderFlags; }; }; // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_IPC_THREAD_STATE_H android-audiosystem-1.8+13.10.20130807/include/binder/BpBinder.h0000644000015700001700000001014612200324306024420 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_BPBINDER_H #define ANDROID_BPBINDER_H #include #include #include // --------------------------------------------------------------------------- namespace android { class BpBinder : public IBinder { public: BpBinder(int32_t handle); inline int32_t handle() const { return mHandle; } virtual const String16& getInterfaceDescriptor() const; virtual bool isBinderAlive() const; virtual status_t pingBinder(); virtual status_t dump(int fd, const Vector& args); virtual status_t transact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); virtual status_t linkToDeath(const sp& recipient, void* cookie = NULL, uint32_t flags = 0); virtual status_t unlinkToDeath( const wp& recipient, void* cookie = NULL, uint32_t flags = 0, wp* outRecipient = NULL); virtual void attachObject( const void* objectID, void* object, void* cleanupCookie, object_cleanup_func func); virtual void* findObject(const void* objectID) const; virtual void detachObject(const void* objectID); virtual BpBinder* remoteBinder(); status_t setConstantData(const void* data, size_t size); void sendObituary(); class ObjectManager { public: ObjectManager(); ~ObjectManager(); void attach( const void* objectID, void* object, void* cleanupCookie, IBinder::object_cleanup_func func); void* find(const void* objectID) const; void detach(const void* objectID); void kill(); private: ObjectManager(const ObjectManager&); ObjectManager& operator=(const ObjectManager&); struct entry_t { void* object; void* cleanupCookie; IBinder::object_cleanup_func func; }; KeyedVector mObjects; }; protected: virtual ~BpBinder(); virtual void onFirstRef(); virtual void onLastStrongRef(const void* id); virtual bool onIncStrongAttempted(uint32_t flags, const void* id); private: const int32_t mHandle; struct Obituary { wp recipient; void* cookie; uint32_t flags; }; void reportOneDeath(const Obituary& obit); bool isDescriptorCached() const; mutable Mutex mLock; volatile int32_t mAlive; volatile int32_t mObitsSent; Vector* mObituaries; ObjectManager mObjects; Parcel* mConstantData; mutable String16 mDescriptorCache; }; }; // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_BPBINDER_H android-audiosystem-1.8+13.10.20130807/include/binder/Binder.h0000644000015700001700000000701412200324306024136 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_BINDER_H #define ANDROID_BINDER_H #include // --------------------------------------------------------------------------- namespace android { class BBinder : public IBinder { public: BBinder(); virtual const String16& getInterfaceDescriptor() const; virtual bool isBinderAlive() const; virtual status_t pingBinder(); virtual status_t dump(int fd, const Vector& args); virtual status_t transact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); virtual status_t linkToDeath(const sp& recipient, void* cookie = NULL, uint32_t flags = 0); virtual status_t unlinkToDeath( const wp& recipient, void* cookie = NULL, uint32_t flags = 0, wp* outRecipient = NULL); virtual void attachObject( const void* objectID, void* object, void* cleanupCookie, object_cleanup_func func); virtual void* findObject(const void* objectID) const; virtual void detachObject(const void* objectID); virtual BBinder* localBinder(); protected: virtual ~BBinder(); virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); private: BBinder(const BBinder& o); BBinder& operator=(const BBinder& o); class Extras; Extras* mExtras; void* mReserved0; }; // --------------------------------------------------------------------------- class BpRefBase : public virtual RefBase { protected: BpRefBase(const sp& o); virtual ~BpRefBase(); virtual void onFirstRef(); virtual void onLastStrongRef(const void* id); virtual bool onIncStrongAttempted(uint32_t flags, const void* id); inline IBinder* remote() { return mRemote; } inline IBinder* remote() const { return mRemote; } private: BpRefBase(const BpRefBase& o); BpRefBase& operator=(const BpRefBase& o); IBinder* const mRemote; RefBase::weakref_type* mRefs; volatile int32_t mState; }; }; // namespace android // --------------------------------------------------------------------------- #endif // ANDROID_BINDER_H android-audiosystem-1.8+13.10.20130807/include/binder/PermissionCache.h0000644000015700001700000000475112200324306026014 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef BINDER_PERMISSION_H #define BINDER_PERMISSION_H #include #include #include #include #include namespace android { // --------------------------------------------------------------------------- /* * PermissionCache caches permission checks for a given uid. * * Currently the cache is not updated when there is a permission change, * for instance when an application is uninstalled. * * IMPORTANT: for the reason stated above, only system permissions are safe * to cache. This restriction may be lifted at a later time. * */ class PermissionCache : Singleton { struct Entry { String16 name; uid_t uid; bool granted; inline bool operator < (const Entry& e) const { return (uid == e.uid) ? (name < e.name) : (uid < e.uid); } }; mutable Mutex mLock; // we pool all the permission names we see, as many permissions checks // will have identical names SortedVector< String16 > mPermissionNamesPool; // this is our cache per say. it stores pooled names. SortedVector< Entry > mCache; // free the whole cache, but keep the permission name pool void purge(); status_t check(bool* granted, const String16& permission, uid_t uid) const; void cache(const String16& permission, uid_t uid, bool granted); public: PermissionCache(); static bool checkCallingPermission(const String16& permission); static bool checkCallingPermission(const String16& permission, int32_t* outPid, int32_t* outUid); static bool checkPermission(const String16& permission, pid_t pid, uid_t uid); }; // --------------------------------------------------------------------------- }; // namespace android #endif /* BINDER_PERMISSION_H */ android-audiosystem-1.8+13.10.20130807/include/binder/IInterface.h0000644000015700001700000001231612200324306024745 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // #ifndef ANDROID_IINTERFACE_H #define ANDROID_IINTERFACE_H #include namespace android { // ---------------------------------------------------------------------- class IInterface : public virtual RefBase { public: IInterface(); sp asBinder(); sp asBinder() const; protected: virtual ~IInterface(); virtual IBinder* onAsBinder() = 0; }; // ---------------------------------------------------------------------- template inline sp interface_cast(const sp& obj) { return INTERFACE::asInterface(obj); } // ---------------------------------------------------------------------- template class BnInterface : public INTERFACE, public BBinder { public: virtual sp queryLocalInterface(const String16& _descriptor); virtual const String16& getInterfaceDescriptor() const; protected: virtual IBinder* onAsBinder(); }; // ---------------------------------------------------------------------- template class BpInterface : public INTERFACE, public BpRefBase { public: BpInterface(const sp& remote); protected: virtual IBinder* onAsBinder(); }; // ---------------------------------------------------------------------- #define DECLARE_META_INTERFACE(INTERFACE) \ static const android::String16 descriptor; \ static android::sp asInterface( \ const android::sp& obj); \ virtual const android::String16& getInterfaceDescriptor() const; \ I##INTERFACE(); \ virtual ~I##INTERFACE(); \ #define IMPLEMENT_META_INTERFACE(INTERFACE, NAME) \ const android::String16 I##INTERFACE::descriptor(NAME); \ const android::String16& \ I##INTERFACE::getInterfaceDescriptor() const { \ return I##INTERFACE::descriptor; \ } \ android::sp I##INTERFACE::asInterface( \ const android::sp& obj) \ { \ android::sp intr; \ if (obj != NULL) { \ intr = static_cast( \ obj->queryLocalInterface( \ I##INTERFACE::descriptor).get()); \ if (intr == NULL) { \ intr = new Bp##INTERFACE(obj); \ } \ } \ return intr; \ } \ I##INTERFACE::I##INTERFACE() { } \ I##INTERFACE::~I##INTERFACE() { } \ #define CHECK_INTERFACE(interface, data, reply) \ if (!data.checkInterface(this)) { return PERMISSION_DENIED; } \ // ---------------------------------------------------------------------- // No user-serviceable parts after this... template inline sp BnInterface::queryLocalInterface( const String16& _descriptor) { if (_descriptor == INTERFACE::descriptor) return this; return NULL; } template inline const String16& BnInterface::getInterfaceDescriptor() const { return INTERFACE::getInterfaceDescriptor(); } template IBinder* BnInterface::onAsBinder() { return this; } template inline BpInterface::BpInterface(const sp& remote) : BpRefBase(remote) { } template inline IBinder* BpInterface::onAsBinder() { return remote(); } // ---------------------------------------------------------------------- }; // namespace android #endif // ANDROID_IINTERFACE_H android-audiosystem-1.8+13.10.20130807/include/binder/MemoryBase.h0000644000015700001700000000270612200324306025001 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_MEMORY_BASE_H #define ANDROID_MEMORY_BASE_H #include #include #include namespace android { // --------------------------------------------------------------------------- class MemoryBase : public BnMemory { public: MemoryBase(const sp& heap, ssize_t offset, size_t size); virtual ~MemoryBase(); virtual sp getMemory(ssize_t* offset, size_t* size) const; protected: size_t getSize() const { return mSize; } ssize_t getOffset() const { return mOffset; } const sp& getHeap() const { return mHeap; } private: size_t mSize; ssize_t mOffset; sp mHeap; }; // --------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_MEMORY_BASE_H android-audiosystem-1.8+13.10.20130807/include/cutils/0000755000015700001700000000000012200324404022617 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/cutils/mq.h0000644000015700001700000000631112200324306023407 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * IPC messaging library. */ #ifndef __MQ_H #define __MQ_H #ifdef __cplusplus extern "C" { #endif /** A message. */ typedef struct MqMessage MqMessage; /** A destination to which messages can be sent. */ typedef struct MqDestination MqDestination; /* Array of bytes. */ typedef struct MqBytes MqBytes; /** * Hears messages. * * @param destination to which the message was sent * @param message the message to hear */ typedef void MqMessageListener(MqDestination* destination, MqMessage* message); /** * Hears a destination close. * * @param destination that closed */ typedef void MqCloseListener(MqDestination* destination); /** Message functions. */ /** * Creates a new Message. * * @param header as defined by user * @param body as defined by user * @param replyTo destination to which replies should be sent, NULL if none */ MqMessage* mqCreateMessage(MqBytes header, MqBytes body, MqDestination* replyTo); /** Sends a message to a destination. */ void mqSendMessage(MqMessage* message, MqDestination* destination); /** Destination functions. */ /** * Creates a new destination. Acquires a reference implicitly. * * @param messageListener function to call when a message is recieved * @param closeListener function to call when the destination closes * @param userData user-specific data to associate with the destination. * Retrieve using mqGetDestinationUserData(). */ MqDestination* mqCreateDestination(MqMessageListener* messageListener, MqCloseListener* closeListener, void* userData); /** * Gets user data which was associated with the given destination at * construction time. * * It is only valid to call this function in the same process that the * given destination was created in. * This function returns a null pointer if you call it on a destination * created in a remote process. */ void* mqGetUserData(MqDestination* destination); /** * Returns 1 if the destination was created in this process, or 0 if * the destination was created in a different process, in which case you have * a remote stub. */ int mqIsDestinationLocal(MqDestination* destination); /** * Increments the destination's reference count. */ void mqKeepDestination(MqDesintation* destination); /** * Decrements the destination's reference count. */ void mqFreeDestination(MqDestination* desintation); /** Registry API. */ /** * Gets the destination bound to a name. */ MqDestination* mqGetDestination(char* name); /** * Binds a destination to a name. */ void mqPutDestination(char* name, MqDestination* desintation); #ifdef __cplusplus } #endif #endif /* __MQ_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/atomic-arm.h0000644000015700001700000001727112200324306025032 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_CUTILS_ATOMIC_ARM_H #define ANDROID_CUTILS_ATOMIC_ARM_H #include #include extern inline void android_compiler_barrier(void) { __asm__ __volatile__ ("" : : : "memory"); } #if ANDROID_SMP == 0 extern inline void android_memory_barrier(void) { android_compiler_barrier(); } extern inline void android_memory_store_barrier(void) { android_compiler_barrier(); } #elif defined(__ARM_HAVE_DMB) extern inline void android_memory_barrier(void) { __asm__ __volatile__ ("dmb" : : : "memory"); } extern inline void android_memory_store_barrier(void) { __asm__ __volatile__ ("dmb st" : : : "memory"); } #elif defined(__ARM_HAVE_LDREX_STREX) extern inline void android_memory_barrier(void) { __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r" (0) : "memory"); } extern inline void android_memory_store_barrier(void) { android_memory_barrier(); } #else extern inline void android_memory_barrier(void) { typedef void (kuser_memory_barrier)(void); (*(kuser_memory_barrier *)0xffff0fa0)(); } extern inline void android_memory_store_barrier(void) { android_memory_barrier(); } #endif extern inline int32_t android_atomic_acquire_load(volatile const int32_t *ptr) { int32_t value = *ptr; android_memory_barrier(); return value; } extern inline int32_t android_atomic_release_load(volatile const int32_t *ptr) { android_memory_barrier(); return *ptr; } extern inline void android_atomic_acquire_store(int32_t value, volatile int32_t *ptr) { *ptr = value; android_memory_barrier(); } extern inline void android_atomic_release_store(int32_t value, volatile int32_t *ptr) { android_memory_barrier(); *ptr = value; } /* #if defined(__thumb__) extern int android_atomic_cas(int32_t old_value, int32_t new_value, volatile int32_t *ptr); #elif defined(__ARM_HAVE_LDREX_STREX) extern inline int android_atomic_cas(int32_t old_value, int32_t new_value, volatile int32_t *ptr) { int32_t prev, status; do { __asm__ __volatile__ ("ldrex %0, [%3]\n" "mov %1, #0\n" "teq %0, %4\n" "strexeq %1, %5, [%3]" : "=&r" (prev), "=&r" (status), "+m"(*ptr) : "r" (ptr), "Ir" (old_value), "r" (new_value) : "cc"); } while (__builtin_expect(status != 0, 0)); return prev != old_value; } #else */ extern inline int android_atomic_cas(int32_t old_value, int32_t new_value, volatile int32_t *ptr) { typedef int (kuser_cmpxchg)(int32_t, int32_t, volatile int32_t *); int32_t prev, status; prev = *ptr; do { status = (*(kuser_cmpxchg *)0xffff0fc0)(old_value, new_value, ptr); if (__builtin_expect(status == 0, 1)) return 0; prev = *ptr; } while (prev == old_value); return 1; } //#endif extern inline int android_atomic_acquire_cas(int32_t old_value, int32_t new_value, volatile int32_t *ptr) { int status = android_atomic_cas(old_value, new_value, ptr); android_memory_barrier(); return status; } extern inline int android_atomic_release_cas(int32_t old_value, int32_t new_value, volatile int32_t *ptr) { android_memory_barrier(); return android_atomic_cas(old_value, new_value, ptr); } //#if defined(__thumb__) extern int32_t android_atomic_add(int32_t increment, volatile int32_t *ptr); /* #elif defined(__ARM_HAVE_LDREX_STREX) extern inline int32_t android_atomic_add(int32_t increment, volatile int32_t *ptr) { int32_t prev, tmp, status; android_memory_barrier(); do { __asm__ __volatile__ ("ldrex %0, [%4]\n" "add %1, %0, %5\n" "strex %2, %1, [%4]" : "=&r" (prev), "=&r" (tmp), "=&r" (status), "+m" (*ptr) : "r" (ptr), "Ir" (increment) : "cc"); } while (__builtin_expect(status != 0, 0)); return prev; } #else extern inline int32_t android_atomic_add(int32_t increment, volatile int32_t *ptr) { int32_t prev, status; android_memory_barrier(); do { prev = *ptr; status = android_atomic_cas(prev, prev + increment, ptr); } while (__builtin_expect(status != 0, 0)); return prev; } #endif extern inline int32_t android_atomic_inc(volatile int32_t *addr) { return android_atomic_add(1, addr); } extern inline int32_t android_atomic_dec(volatile int32_t *addr) { return android_atomic_add(-1, addr); } */ //#if defined(__thumb__) extern int32_t android_atomic_and(int32_t value, volatile int32_t *ptr); /* #elif defined(__ARM_HAVE_LDREX_STREX) extern inline int32_t android_atomic_and(int32_t value, volatile int32_t *ptr) { int32_t prev, tmp, status; android_memory_barrier(); do { __asm__ __volatile__ ("ldrex %0, [%4]\n" "and %1, %0, %5\n" "strex %2, %1, [%4]" : "=&r" (prev), "=&r" (tmp), "=&r" (status), "+m" (*ptr) : "r" (ptr), "Ir" (value) : "cc"); } while (__builtin_expect(status != 0, 0)); return prev; } #else extern inline int32_t android_atomic_and(int32_t value, volatile int32_t *ptr) { int32_t prev, status; android_memory_barrier(); do { prev = *ptr; status = android_atomic_cas(prev, prev & value, ptr); } while (__builtin_expect(status != 0, 0)); return prev; } #endif */ //#if defined(__thumb__) extern int32_t android_atomic_or(int32_t value, volatile int32_t *ptr); /* #elif defined(__ARM_HAVE_LDREX_STREX) extern inline int32_t android_atomic_or(int32_t value, volatile int32_t *ptr) { int32_t prev, tmp, status; android_memory_barrier(); do { __asm__ __volatile__ ("ldrex %0, [%4]\n" "orr %1, %0, %5\n" "strex %2, %1, [%4]" : "=&r" (prev), "=&r" (tmp), "=&r" (status), "+m" (*ptr) : "r" (ptr), "Ir" (value) : "cc"); } while (__builtin_expect(status != 0, 0)); return prev; } #else extern inline int32_t android_atomic_or(int32_t value, volatile int32_t *ptr) { int32_t prev, status; android_memory_barrier(); do { prev = *ptr; status = android_atomic_cas(prev, prev | value, ptr); } while (__builtin_expect(status != 0, 0)); return prev; } #endif */ #endif /* ANDROID_CUTILS_ATOMIC_ARM_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/mot_pthread.h0000644000015700001700000000626412200324306025307 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _MOT_PTHREAD_H_ #define _MOT_PTHREAD_H_ #include #include #include #include #include /* * Types */ typedef struct { int volatile value; } mot_pthread_mutex_t; #define MOT_PTHREAD_MUTEX_INITIALIZER {0} #define MOT_PTHREAD_RECURSIVE_MUTEX_INITIALIZER {0x4000} #define MOT_PTHREAD_ERRORCHECK_MUTEX_INITIALIZER {0x8000} enum { MOT_PTHREAD_MUTEX_NORMAL = 0, MOT_PTHREAD_MUTEX_RECURSIVE = 1, MOT_PTHREAD_MUTEX_ERRORCHECK = 2, MOT_PTHREAD_MUTEX_ERRORCHECK_NP = MOT_PTHREAD_MUTEX_ERRORCHECK, MOT_PTHREAD_MUTEX_RECURSIVE_NP = MOT_PTHREAD_MUTEX_RECURSIVE, MOT_PTHREAD_MUTEX_DEFAULT = MOT_PTHREAD_MUTEX_NORMAL }; typedef struct { int volatile value; } mot_pthread_cond_t; /* * Prototypes */ #if __cplusplus extern "C" { #endif int mot_pthread_mutex_lock(mot_pthread_mutex_t *mutex); int mot_pthread_mutex_unlock(mot_pthread_mutex_t *mutex); int mot_pthread_mutex_trylock(mot_pthread_mutex_t *mutex); int mot_pthread_cond_broadcast(mot_pthread_cond_t *cond); int mot_pthread_cond_signal(mot_pthread_cond_t *cond); int mot_pthread_cond_wait(mot_pthread_cond_t *cond, mot_pthread_mutex_t *mutex); int mot_pthread_cond_timedwait(mot_pthread_cond_t *cond, mot_pthread_mutex_t * mutex, const struct timespec *abstime); /* BIONIC: same as pthread_cond_timedwait, except the 'reltime' given refers * is relative to the current time. */ int mot_pthread_cond_timedwait_relative_np(mot_pthread_cond_t *cond, mot_pthread_mutex_t *mutex, const struct timespec *reltime); //#define HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE 1 #if __cplusplus } /* extern "C" */ #endif #endif // _MOT_PTHREAD_H_ android-audiosystem-1.8+13.10.20130807/include/cutils/abort_socket.h0000644000015700001700000000706112200324306025454 0ustar pbuserpbgroup00000000000000/* * Copyright 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Helper to perform abortable blocking operations on a socket: * asocket_connect() * asocket_accept() * asocket_read() * asocket_write() * These calls are similar to the regular syscalls, but can be aborted with: * asocket_abort() * * Calling close() on a regular POSIX socket does not abort blocked syscalls on * that socket in other threads. * * After calling asocket_abort() the socket cannot be reused. * * Call asocket_destory() *after* all threads have finished with the socket to * finish closing the socket and free the asocket structure. * * The helper is implemented by setting the socket non-blocking to initiate * syscalls connect(), accept(), read(), write(), then using a blocking poll() * on both the primary socket and a local pipe. This makes the poll() abortable * by writing a byte to the local pipe in asocket_abort(). * * asocket_create() sets the fd to non-blocking mode. It must not be changed to * blocking mode. * * Using asocket will triple the number of file descriptors required per * socket, due to the local pipe. It may be possible to use a global pipe per * process rather than per socket, but we have not been able to come up with a * race-free implementation yet. * * All functions except asocket_init() and asocket_destroy() are thread safe. */ #include #include #ifndef __CUTILS_ABORT_SOCKET_H__ #define __CUTILS_ABORT_SOCKET_H__ #ifdef __cplusplus extern "C" { #endif struct asocket { int fd; /* primary socket fd */ int abort_fd[2]; /* pipe used to abort */ }; /* Create an asocket from fd. * Sets the socket to non-blocking mode. * Returns NULL on error with errno set. */ struct asocket *asocket_init(int fd); /* Blocking socket I/O with timeout. * Calling asocket_abort() from another thread will cause each of these * functions to immediately return with value -1 and errno ECANCELED. * timeout is in ms, use -1 to indicate no timeout. On timeout -1 is returned * with errno ETIMEDOUT. * EINTR is handled in-call. * Other semantics are identical to the regular syscalls. */ int asocket_connect(struct asocket *s, const struct sockaddr *addr, socklen_t addrlen, int timeout); int asocket_accept(struct asocket *s, struct sockaddr *addr, socklen_t *addrlen, int timeout); int asocket_read(struct asocket *s, void *buf, size_t count, int timeout); int asocket_write(struct asocket *s, const void *buf, size_t count, int timeout); /* Abort above calls and shutdown socket. * Further I/O operations on this socket will immediately fail after this call. * asocket_destroy() should be used to release resources once all threads * have returned from blocking calls on the socket. */ void asocket_abort(struct asocket *s); /* Close socket and free asocket structure. * Must not be called until all calls on this structure have completed. */ void asocket_destroy(struct asocket *s); #ifdef __cplusplus } #endif #endif //__CUTILS_ABORT_SOCKET__H__ android-audiosystem-1.8+13.10.20130807/include/cutils/logger.h0000644000015700001700000000522112200324306024250 0ustar pbuserpbgroup00000000000000/* utils/logger.h ** ** Copyright 2007, The Android Open Source Project ** ** This file is dual licensed. It may be redistributed and/or modified ** under the terms of the Apache 2.0 License OR version 2 of the GNU ** General Public License. */ #ifndef _UTILS_LOGGER_H #define _UTILS_LOGGER_H #include /* * The userspace structure for version 1 of the logger_entry ABI. * This structure is returned to userspace by the kernel logger * driver unless an upgrade to a newer ABI version is requested. */ struct logger_entry { uint16_t len; /* length of the payload */ uint16_t __pad; /* no matter what, we get 2 bytes of padding */ int32_t pid; /* generating process's pid */ int32_t tid; /* generating process's tid */ int32_t sec; /* seconds since Epoch */ int32_t nsec; /* nanoseconds */ char msg[0]; /* the entry's payload */ }; /* * The userspace structure for version 2 of the logger_entry ABI. * This structure is returned to userspace if ioctl(LOGGER_SET_VERSION) * is called with version==2 */ struct logger_entry_v2 { uint16_t len; /* length of the payload */ uint16_t hdr_size; /* sizeof(struct logger_entry_v2) */ int32_t pid; /* generating process's pid */ int32_t tid; /* generating process's tid */ int32_t sec; /* seconds since Epoch */ int32_t nsec; /* nanoseconds */ uint32_t euid; /* effective UID of logger */ char msg[0]; /* the entry's payload */ }; #define LOGGER_LOG_MAIN "alog/main" #define LOGGER_LOG_RADIO "alog/radio" #define LOGGER_LOG_EVENTS "alog/events" #define LOGGER_LOG_SYSTEM "alog/system" /* * The maximum size of the log entry payload that can be * written to the kernel logger driver. An attempt to write * more than this amount to /dev/log/* will result in a * truncated log entry. */ #define LOGGER_ENTRY_MAX_PAYLOAD 4076 /* * The maximum size of a log entry which can be read from the * kernel logger driver. An attempt to read less than this amount * may result in read() returning EINVAL. */ #define LOGGER_ENTRY_MAX_LEN (5*1024) #ifdef HAVE_IOCTL #include #define __LOGGERIO 0xAE #define LOGGER_GET_LOG_BUF_SIZE _IO(__LOGGERIO, 1) /* size of log */ #define LOGGER_GET_LOG_LEN _IO(__LOGGERIO, 2) /* used log len */ #define LOGGER_GET_NEXT_ENTRY_LEN _IO(__LOGGERIO, 3) /* next entry len */ #define LOGGER_FLUSH_LOG _IO(__LOGGERIO, 4) /* flush log */ #define LOGGER_GET_VERSION _IO(__LOGGERIO, 5) /* abi version */ #define LOGGER_SET_VERSION _IO(__LOGGERIO, 6) /* abi version */ #endif // HAVE_IOCTL #endif /* _UTILS_LOGGER_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/atomic-x86.h0000644000015700001700000000776512200324306024707 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_CUTILS_ATOMIC_X86_H #define ANDROID_CUTILS_ATOMIC_X86_H #include extern inline void android_compiler_barrier(void) { __asm__ __volatile__ ("" : : : "memory"); } #if ANDROID_SMP == 0 extern inline void android_memory_barrier(void) { android_compiler_barrier(); } extern inline void android_memory_store_barrier(void) { android_compiler_barrier(); } #else extern inline void android_memory_barrier(void) { __asm__ __volatile__ ("mfence" : : : "memory"); } extern inline void android_memory_store_barrier(void) { android_compiler_barrier(); } #endif extern inline int32_t android_atomic_acquire_load(volatile const int32_t *ptr) { int32_t value = *ptr; android_compiler_barrier(); return value; } extern inline int32_t android_atomic_release_load(volatile const int32_t *ptr) { android_memory_barrier(); return *ptr; } extern inline void android_atomic_acquire_store(int32_t value, volatile int32_t *ptr) { *ptr = value; android_memory_barrier(); } extern inline void android_atomic_release_store(int32_t value, volatile int32_t *ptr) { android_compiler_barrier(); *ptr = value; } extern inline int android_atomic_cas(int32_t old_value, int32_t new_value, volatile int32_t *ptr) { int32_t prev; __asm__ __volatile__ ("lock; cmpxchgl %1, %2" : "=a" (prev) : "q" (new_value), "m" (*ptr), "0" (old_value) : "memory"); return prev != old_value; } extern inline int android_atomic_acquire_cas(int32_t old_value, int32_t new_value, volatile int32_t *ptr) { /* Loads are not reordered with other loads. */ return android_atomic_cas(old_value, new_value, ptr); } extern inline int android_atomic_release_cas(int32_t old_value, int32_t new_value, volatile int32_t *ptr) { /* Stores are not reordered with other stores. */ return android_atomic_cas(old_value, new_value, ptr); } extern inline int32_t android_atomic_add(int32_t increment, volatile int32_t *ptr) { __asm__ __volatile__ ("lock; xaddl %0, %1" : "+r" (increment), "+m" (*ptr) : : "memory"); /* increment now holds the old value of *ptr */ return increment; } extern inline int32_t android_atomic_inc(volatile int32_t *addr) { return android_atomic_add(1, addr); } extern inline int32_t android_atomic_dec(volatile int32_t *addr) { return android_atomic_add(-1, addr); } extern inline int32_t android_atomic_and(int32_t value, volatile int32_t *ptr) { int32_t prev, status; do { prev = *ptr; status = android_atomic_cas(prev, prev & value, ptr); } while (__builtin_expect(status != 0, 0)); return prev; } extern inline int32_t android_atomic_or(int32_t value, volatile int32_t *ptr) { int32_t prev, status; do { prev = *ptr; status = android_atomic_cas(prev, prev | value, ptr); } while (__builtin_expect(status != 0, 0)); return prev; } #endif /* ANDROID_CUTILS_ATOMIC_X86_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/tztime.h0000644000015700001700000000327212200324306024311 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _CUTILS_TZTIME_H #define _CUTILS_TZTIME_H #include #ifdef __cplusplus extern "C" { #endif time_t mktime_tz(struct tm * const tmp, char const * tz); void localtime_tz(const time_t * const timep, struct tm * tmp, const char* tz); #ifdef HAVE_ANDROID_OS /* the following is defined in the Bionic C library on Android, but the * declarations are only available through a platform-private header */ #include #else /* !HAVE_ANDROID_OS */ struct strftime_locale { const char *mon[12]; /* short names */ const char *month[12]; /* long names */ const char *standalone_month[12]; /* long standalone names */ const char *wday[7]; /* short names */ const char *weekday[7]; /* long names */ const char *X_fmt; const char *x_fmt; const char *c_fmt; const char *am; const char *pm; const char *date_fmt; }; size_t strftime_tz(char *s, size_t max, const char *format, const struct tm *tm, const struct strftime_locale *locale); #endif /* !HAVE_ANDROID_OS */ #ifdef __cplusplus } #endif #endif /* __CUTILS_TZTIME_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/array.h0000644000015700001700000000347612200324306024121 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * A pointer array which intelligently expands its capacity ad needed. */ #ifndef __ARRAY_H #define __ARRAY_H #ifdef __cplusplus extern "C" { #endif #include /** An array. */ typedef struct Array Array; /** Constructs a new array. Returns NULL if we ran out of memory. */ Array* arrayCreate(); /** Frees an array. Does not free elements themselves. */ void arrayFree(Array* array); /** Adds a pointer. Returns 0 is successful, < 0 otherwise. */ int arrayAdd(Array* array, void* pointer); /** Gets the pointer at the specified index. */ void* arrayGet(Array* array, int index); /** Removes the pointer at the given index and returns it. */ void* arrayRemove(Array* array, int index); /** Sets pointer at the given index. Returns old pointer. */ void* arraySet(Array* array, int index, void* pointer); /** Sets the array size. Sets new pointers to NULL. Returns 0 if successful, < 0 otherwise . */ int arraySetSize(Array* array, int size); /** Returns the size of the given array. */ int arraySize(Array* array); /** * Returns a pointer to a C-style array which will be valid until this array * changes. */ const void** arrayUnwrap(Array* array); #ifdef __cplusplus } #endif #endif /* __ARRAY_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/properties.h0000644000015700001700000000435012200324306025167 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __CUTILS_PROPERTIES_H #define __CUTILS_PROPERTIES_H #ifdef __cplusplus extern "C" { #endif /* System properties are *small* name value pairs managed by the ** property service. If your data doesn't fit in the provided ** space it is not appropriate for a system property. ** ** WARNING: system/bionic/include/sys/system_properties.h also defines ** these, but with different names. (TODO: fix that) */ #define PROPERTY_KEY_MAX 32 #define PROPERTY_VALUE_MAX 92 /* property_get: returns the length of the value which will never be ** greater than PROPERTY_VALUE_MAX - 1 and will always be zero terminated. ** (the length does not include the terminating zero). ** ** If the property read fails or returns an empty value, the default ** value is used (if nonnull). */ int property_get(const char *key, char *value, const char *default_value); /* property_set: returns 0 on success, < 0 on failure */ int property_set(const char *key, const char *value); /* property_set_sync: returns 0 on success, < 0 on failure ** ** symbol needed for Motorola RILs. Calls property_set */ int property_set_sync(const char *key, const char *value); int property_list(void (*propfn)(const char *key, const char *value, void *cookie), void *cookie); #ifdef HAVE_SYSTEM_PROPERTY_SERVER /* * We have an external property server instead of built-in libc support. * Used by the simulator. */ #define SYSTEM_PROPERTY_PIPE_NAME "/tmp/android-sysprop" enum { kSystemPropertyUnknown = 0, kSystemPropertyGet, kSystemPropertySet, kSystemPropertyList }; #endif /*HAVE_SYSTEM_PROPERTY_SERVER*/ #ifdef __cplusplus } #endif #endif android-audiosystem-1.8+13.10.20130807/include/cutils/klog.h0000644000015700001700000000232412200324306023726 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _CUTILS_KLOG_H_ #define _CUTILS_KLOG_H_ void klog_init(void); void klog_set_level(int level); void klog_close(void); void klog_write(int level, const char *fmt, ...) __attribute__ ((format(printf, 2, 3))); #define KLOG_ERROR(tag,x...) klog_write(3, "<3>" tag ": " x) #define KLOG_WARNING(tag,x...) klog_write(4, "<4>" tag ": " x) #define KLOG_NOTICE(tag,x...) klog_write(5, "<5>" tag ": " x) #define KLOG_INFO(tag,x...) klog_write(6, "<6>" tag ": " x) #define KLOG_DEBUG(tag,x...) klog_write(7, "<7>" tag ": " x) #define KLOG_DEFAULT_LEVEL 3 /* messages <= this level are logged */ #endif android-audiosystem-1.8+13.10.20130807/include/cutils/config_utils.h0000644000015700001700000000334712200324306025465 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __CUTILS_CONFIG_UTILS_H #define __CUTILS_CONFIG_UTILS_H #ifdef __cplusplus extern "C" { #endif typedef struct cnode cnode; struct cnode { cnode *next; cnode *first_child; cnode *last_child; const char *name; const char *value; }; /* parse a text string into a config node tree */ void config_load(cnode *root, char *data); /* parse a file into a config node tree */ void config_load_file(cnode *root, const char *fn); /* create a single config node */ cnode* config_node(const char *name, const char *value); /* locate a named child of a config node */ cnode* config_find(cnode *root, const char *name); /* look up a child by name and return the boolean value */ int config_bool(cnode *root, const char *name, int _default); /* look up a child by name and return the string value */ const char* config_str(cnode *root, const char *name, const char *_default); /* add a named child to a config node (or modify it if it already exists) */ void config_set(cnode *root, const char *name, const char *value); /* free a config node tree */ void config_free(cnode *root); #ifdef __cplusplus } #endif #endif android-audiosystem-1.8+13.10.20130807/include/cutils/sched_policy.h0000644000015700001700000000413012200324306025434 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __CUTILS_SCHED_POLICY_H #define __CUTILS_SCHED_POLICY_H #ifdef __cplusplus extern "C" { #endif /* Keep in sync with THREAD_GROUP_* in frameworks/base/core/java/android/os/Process.java */ typedef enum { SP_DEFAULT = -1, SP_BACKGROUND = 0, SP_FOREGROUND = 1, SP_SYSTEM = 2, // can't be used with set_sched_policy() SP_AUDIO_APP = 3, SP_AUDIO_SYS = 4, SP_CNT, SP_MAX = SP_CNT - 1, SP_SYSTEM_DEFAULT = SP_FOREGROUND, } SchedPolicy; /* Assign thread tid to the cgroup associated with the specified policy. * If the thread is a thread group leader, that is it's gettid() == getpid(), * then the other threads in the same thread group are _not_ affected. * On platforms which support gettid(), zero tid means current thread. * Return value: 0 for success, or -errno for error. */ extern int set_sched_policy(int tid, SchedPolicy policy); /* Return the policy associated with the cgroup of thread tid via policy pointer. * On platforms which support gettid(), zero tid means current thread. * Return value: 0 for success, or -1 for error and set errno. */ extern int get_sched_policy(int tid, SchedPolicy *policy); /* Return a displayable string corresponding to policy. * Return value: non-NULL NUL-terminated name of unspecified length; * the caller is responsible for displaying the useful part of the string. */ extern const char *get_sched_policy_name(SchedPolicy policy); #ifdef __cplusplus } #endif #endif /* __CUTILS_SCHED_POLICY_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/atomics.h0000644000015700001700000000353712200324306024440 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _SYS_ATOMICS_H #define _SYS_ATOMICS_H #include #include __BEGIN_DECLS extern int __atomic_cmpxchg(int old, int _new, volatile int *ptr); extern int __atomic_swap(int _new, volatile int *ptr); extern int __atomic_dec(volatile int *ptr); extern int __atomic_inc(volatile int *ptr); int __futex_wait(volatile void *ftx, int val, const struct timespec *timeout); int __futex_wake(volatile void *ftx, int count); __END_DECLS #endif /* _SYS_ATOMICS_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/qtaguid.h0000644000015700001700000000345012200324306024431 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __CUTILS_QTAGUID_H #define __CUTILS_QTAGUID_H #include #include #include #ifdef __cplusplus extern "C" { #endif /* * Set tags (and owning UIDs) for network sockets. */ extern int qtaguid_tagSocket(int sockfd, int tag, uid_t uid); /* * Untag a network socket before closing. */ extern int qtaguid_untagSocket(int sockfd); /* * For the given uid, switch counter sets. * The kernel only keeps a limited number of sets. * 2 for now. */ extern int qtaguid_setCounterSet(int counterSetNum, uid_t uid); /* * Delete all tag info that relates to the given tag an uid. * If the tag is 0, then ALL info about the uid is freeded. * The delete data also affects active tagged socketd, which are * then untagged. * The calling process can only operate on its own tags. * Unless it is part of the happy AID_NET_BW_ACCT group. * In which case it can clobber everything. */ extern int qtaguid_deleteTagData(int tag, uid_t uid); /* * Enable/disable qtaguid functionnality at a lower level. * When pacified, the kernel will accept commands but do nothing. */ extern int qtaguid_setPacifier(int on); #ifdef __cplusplus } #endif #endif /* __CUTILS_QTAG_UID_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/atomic-mips.h0000644000015700001700000001261412200324306025217 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_CUTILS_ATOMIC_MIPS_H #define ANDROID_CUTILS_ATOMIC_MIPS_H #include extern inline void android_compiler_barrier(void) { __asm__ __volatile__ ("" : : : "memory"); } #if ANDROID_SMP == 0 extern inline void android_memory_barrier(void) { android_compiler_barrier(); } extern inline void android_memory_store_barrier(void) { android_compiler_barrier(); } #else extern inline void android_memory_barrier(void) { __asm__ __volatile__ ("sync" : : : "memory"); } extern inline void android_memory_store_barrier(void) { __asm__ __volatile__ ("sync" : : : "memory"); } #endif extern inline int32_t android_atomic_acquire_load(volatile const int32_t *ptr) { int32_t value = *ptr; android_memory_barrier(); return value; } extern inline int32_t android_atomic_release_load(volatile const int32_t *ptr) { android_memory_barrier(); return *ptr; } extern inline void android_atomic_acquire_store(int32_t value, volatile int32_t *ptr) { *ptr = value; android_memory_barrier(); } extern inline void android_atomic_release_store(int32_t value, volatile int32_t *ptr) { android_memory_barrier(); *ptr = value; } extern inline int android_atomic_cas(int32_t old_value, int32_t new_value, volatile int32_t *ptr) { int32_t prev, status; do { __asm__ __volatile__ ( " ll %[prev], (%[ptr])\n" " li %[status], 1\n" " bne %[prev], %[old], 9f\n" " move %[status], %[new_value]\n" " sc %[status], (%[ptr])\n" "9:\n" : [prev] "=&r" (prev), [status] "=&r" (status) : [ptr] "r" (ptr), [old] "r" (old_value), [new_value] "r" (new_value) ); } while (__builtin_expect(status == 0, 0)); return prev != old_value; } extern inline int android_atomic_acquire_cas(int32_t old_value, int32_t new_value, volatile int32_t *ptr) { int status = android_atomic_cas(old_value, new_value, ptr); android_memory_barrier(); return status; } extern inline int android_atomic_release_cas(int32_t old_value, int32_t new_value, volatile int32_t *ptr) { android_memory_barrier(); return android_atomic_cas(old_value, new_value, ptr); } extern inline int32_t android_atomic_swap(int32_t new_value, volatile int32_t *ptr) { int32_t prev, status; do { __asm__ __volatile__ ( " move %[status], %[new_value]\n" " ll %[prev], (%[ptr])\n" " sc %[status], (%[ptr])\n" : [prev] "=&r" (prev), [status] "=&r" (status) : [ptr] "r" (ptr), [new_value] "r" (new_value) ); } while (__builtin_expect(status == 0, 0)); android_memory_barrier(); return prev; } extern inline int32_t android_atomic_add(int32_t increment, volatile int32_t *ptr) { int32_t prev, status; android_memory_barrier(); do { __asm__ __volatile__ ( " ll %[prev], (%[ptr])\n" " addu %[status], %[prev], %[inc]\n" " sc %[status], (%[ptr])\n" : [status] "=&r" (status), [prev] "=&r" (prev) : [ptr] "r" (ptr), [inc] "Ir" (increment) ); } while (__builtin_expect(status == 0, 0)); return prev; } extern inline int32_t android_atomic_inc(volatile int32_t *addr) { return android_atomic_add(1, addr); } extern inline int32_t android_atomic_dec(volatile int32_t *addr) { return android_atomic_add(-1, addr); } extern inline int32_t android_atomic_and(int32_t value, volatile int32_t *ptr) { int32_t prev, status; android_memory_barrier(); do { __asm__ __volatile__ ( " ll %[prev], (%[ptr])\n" " and %[status], %[prev], %[value]\n" " sc %[status], (%[ptr])\n" : [prev] "=&r" (prev), [status] "=&r" (status) : [ptr] "r" (ptr), [value] "Ir" (value) ); } while (__builtin_expect(status == 0, 0)); return prev; } extern inline int32_t android_atomic_or(int32_t value, volatile int32_t *ptr) { int32_t prev, status; android_memory_barrier(); do { __asm__ __volatile__ ( " ll %[prev], (%[ptr])\n" " or %[status], %[prev], %[value]\n" " sc %[status], (%[ptr])\n" : [prev] "=&r" (prev), [status] "=&r" (status) : [ptr] "r" (ptr), [value] "Ir" (value) ); } while (__builtin_expect(status == 0, 0)); return prev; } #endif /* ANDROID_CUTILS_ATOMIC_MIPS_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/process_name.h0000644000015700001700000000204512200324306025450 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Gives the current process a name. */ #ifndef __PROCESS_NAME_H #define __PROCESS_NAME_H #ifdef __cplusplus extern "C" { #endif /** * Sets the current process name. * * Warning: This leaks a string every time you call it. Use judiciously! */ void set_process_name(const char* process_name); /** Gets the current process name. */ const char* get_process_name(void); #ifdef __cplusplus } #endif #endif /* __PROCESS_NAME_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/cpu_info.h0000644000015700001700000000177612200324306024606 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __CUTILS_CPU_INFO_H #define __CUTILS_CPU_INFO_H #ifdef __cplusplus extern "C" { #endif /* returns a string contiaining an ASCII representation of the CPU serial number, ** or NULL if cpu info not available. ** The string is a static variable, so don't call free() on it. */ extern const char* get_cpu_serial_number(void); #ifdef __cplusplus } #endif #endif /* __CUTILS_CPU_INFO_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/zygote.h0000644000015700001700000000170612200324306024316 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __CUTILS_ZYGOTE_H #define __CUTILS_ZYGOTE_H #ifdef __cplusplus extern "C" { #endif int zygote_run_oneshot(int sendStdio, int argc, const char **argv); int zygote_run(int argc, const char **argv); int zygote_run_wait(int argc, const char **argv, void (*post_run_func)(int)); #ifdef __cplusplus } #endif #endif /* __CUTILS_ZYGOTE_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/event_tag_map.h0000644000015700001700000000241712200324306025606 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _LIBS_CUTILS_EVENTTAGMAP_H #define _LIBS_CUTILS_EVENTTAGMAP_H #ifdef __cplusplus extern "C" { #endif #define EVENT_TAG_MAP_FILE "/system/etc/event-log-tags" struct EventTagMap; typedef struct EventTagMap EventTagMap; /* * Open the specified file as an event log tag map. * * Returns NULL on failure. */ EventTagMap* android_openEventTagMap(const char* fileName); /* * Close the map. */ void android_closeEventTagMap(EventTagMap* map); /* * Look up a tag by index. Returns the tag string, or NULL if not found. */ const char* android_lookupEventTag(const EventTagMap* map, int tag); #ifdef __cplusplus } #endif #endif /*_LIBS_CUTILS_EVENTTAGMAP_H*/ android-audiosystem-1.8+13.10.20130807/include/cutils/debugger.h0000644000015700001700000000311412200324306024554 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __CUTILS_DEBUGGER_H #define __CUTILS_DEBUGGER_H #include #ifdef __cplusplus extern "C" { #endif #define DEBUGGER_SOCKET_NAME "android:debuggerd" typedef enum { // dump a crash DEBUGGER_ACTION_CRASH, // dump a tombstone file DEBUGGER_ACTION_DUMP_TOMBSTONE, // dump a backtrace only back to the socket DEBUGGER_ACTION_DUMP_BACKTRACE, } debugger_action_t; /* message sent over the socket */ typedef struct { debugger_action_t action; pid_t tid; } debugger_msg_t; /* Dumps a process backtrace, registers, and stack to a tombstone file (requires root). * Stores the tombstone path in the provided buffer. * Returns 0 on success, -1 on error. */ int dump_tombstone(pid_t tid, char* pathbuf, size_t pathlen); /* Dumps a process backtrace only to the specified file (requires root). * Returns 0 on success, -1 on error. */ int dump_backtrace_to_file(pid_t tid, int fd); #ifdef __cplusplus } #endif #endif /* __CUTILS_DEBUGGER_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/multiuser.h0000644000015700001700000000212512200324306025022 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __CUTILS_MULTIUSER_H #define __CUTILS_MULTIUSER_H #include #ifdef __cplusplus extern "C" { #endif // NOTE: keep in sync with android.os.UserId #define MULTIUSER_APP_PER_USER_RANGE 100000 typedef uid_t userid_t; typedef uid_t appid_t; extern userid_t multiuser_get_user_id(uid_t uid); extern appid_t multiuser_get_app_id(uid_t uid); extern uid_t multiuser_get_uid(userid_t userId, appid_t appId); #ifdef __cplusplus } #endif #endif /* __CUTILS_MULTIUSER_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/iosched_policy.h0000644000015700001700000000205212200324306025765 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __CUTILS_IOSCHED_POLICY_H #define __CUTILS_IOSCHED_POLICY_H #ifdef __cplusplus extern "C" { #endif typedef enum { IoSchedClass_NONE, IoSchedClass_RT, IoSchedClass_BE, IoSchedClass_IDLE, } IoSchedClass; extern int android_set_ioprio(int pid, IoSchedClass clazz, int ioprio); extern int android_get_ioprio(int pid, IoSchedClass *clazz, int *ioprio); #ifdef __cplusplus } #endif #endif /* __CUTILS_IOSCHED_POLICY_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/sockets.h0000644000015700001700000000655712200324306024461 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __CUTILS_SOCKETS_H #define __CUTILS_SOCKETS_H #include #include #include #include #ifdef HAVE_WINSOCK #include typedef int socklen_t; #elif HAVE_SYS_SOCKET_H #include #endif #define ANDROID_SOCKET_ENV_PREFIX "ANDROID_SOCKET_" #define ANDROID_SOCKET_DIR "/dev/socket" #ifdef __cplusplus extern "C" { #endif /* * android_get_control_socket - simple helper function to get the file * descriptor of our init-managed Unix domain socket. `name' is the name of the * socket, as given in init.rc. Returns -1 on error. * * This is inline and not in libcutils proper because we want to use this in * third-party daemons with minimal modification. */ static inline int android_get_control_socket(const char *name) { char key[64] = ANDROID_SOCKET_ENV_PREFIX; const char *val; int fd; /* build our environment variable, counting cycles like a wolf ... */ #if HAVE_STRLCPY strlcpy(key + sizeof(ANDROID_SOCKET_ENV_PREFIX) - 1, name, sizeof(key) - sizeof(ANDROID_SOCKET_ENV_PREFIX)); #else /* for the host, which may lack the almightly strncpy ... */ strncpy(key + sizeof(ANDROID_SOCKET_ENV_PREFIX) - 1, name, sizeof(key) - sizeof(ANDROID_SOCKET_ENV_PREFIX)); key[sizeof(key)-1] = '\0'; #endif val = getenv(key); if (!val) return -1; errno = 0; fd = strtol(val, NULL, 10); if (errno) return -1; return fd; } /* * See also android.os.LocalSocketAddress.Namespace */ // Linux "abstract" (non-filesystem) namespace #define ANDROID_SOCKET_NAMESPACE_ABSTRACT 0 // Android "reserved" (/dev/socket) namespace #define ANDROID_SOCKET_NAMESPACE_RESERVED 1 // Normal filesystem namespace #define ANDROID_SOCKET_NAMESPACE_FILESYSTEM 2 extern int socket_loopback_client(int port, int type); extern int socket_network_client(const char *host, int port, int type); extern int socket_loopback_server(int port, int type); extern int socket_local_server(const char *name, int namespaceId, int type); extern int socket_local_server_bind(int s, const char *name, int namespaceId); extern int socket_local_client_connect(int fd, const char *name, int namespaceId, int type); extern int socket_local_client(const char *name, int namespaceId, int type); extern int socket_inaddr_any_server(int port, int type); /* * socket_peer_is_trusted - Takes a socket which is presumed to be a * connected local socket (e.g. AF_LOCAL) and returns whether the peer * (the userid that owns the process on the other end of that socket) * is one of the two trusted userids, root or shell. * * Note: This only works as advertised on the Android OS and always * just returns true when called on other operating systems. */ extern bool socket_peer_is_trusted(int fd); #ifdef __cplusplus } #endif #endif /* __CUTILS_SOCKETS_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/compiler.h0000644000015700001700000000251712200324306024610 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_CUTILS_COMPILER_H #define ANDROID_CUTILS_COMPILER_H /* * helps the compiler's optimizer predicting branches */ #ifdef __cplusplus # define CC_LIKELY( exp ) (__builtin_expect( !!(exp), true )) # define CC_UNLIKELY( exp ) (__builtin_expect( !!(exp), false )) #else # define CC_LIKELY( exp ) (__builtin_expect( !!(exp), 1 )) # define CC_UNLIKELY( exp ) (__builtin_expect( !!(exp), 0 )) #endif /** * exports marked symbols * * if used on a C++ class declaration, this macro must be inserted * after the "class" keyword. For instance: * * template * class ANDROID_API Singleton { } */ #define ANDROID_API __attribute__((visibility("default"))) #endif // ANDROID_CUTILS_COMPILER_H android-audiosystem-1.8+13.10.20130807/include/cutils/threads.h0000644000015700001700000000773312200324306024435 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _LIBS_CUTILS_THREADS_H #define _LIBS_CUTILS_THREADS_H #ifdef __cplusplus extern "C" { #endif /***********************************************************************/ /***********************************************************************/ /***** *****/ /***** local thread storage *****/ /***** *****/ /***********************************************************************/ /***********************************************************************/ #ifdef HAVE_PTHREADS #include typedef struct { pthread_mutex_t lock; int has_tls; pthread_key_t tls; } thread_store_t; #define THREAD_STORE_INITIALIZER { PTHREAD_MUTEX_INITIALIZER, 0, 0 } #elif defined HAVE_WIN32_THREADS #include typedef struct { int lock_init; int has_tls; DWORD tls; CRITICAL_SECTION lock; } thread_store_t; #define THREAD_STORE_INITIALIZER { 0, 0, 0, {0, 0, 0, 0, 0, 0} } #else # error "no thread_store_t implementation for your platform !!" #endif typedef void (*thread_store_destruct_t)(void* value); extern void* thread_store_get(thread_store_t* store); extern void thread_store_set(thread_store_t* store, void* value, thread_store_destruct_t destroy); /***********************************************************************/ /***********************************************************************/ /***** *****/ /***** mutexes *****/ /***** *****/ /***********************************************************************/ /***********************************************************************/ #ifdef HAVE_PTHREADS typedef pthread_mutex_t mutex_t; #define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER static __inline__ void mutex_lock(mutex_t* lock) { pthread_mutex_lock(lock); } static __inline__ void mutex_unlock(mutex_t* lock) { pthread_mutex_unlock(lock); } static __inline__ int mutex_init(mutex_t* lock) { return pthread_mutex_init(lock, NULL); } static __inline__ void mutex_destroy(mutex_t* lock) { pthread_mutex_destroy(lock); } #endif #ifdef HAVE_WIN32_THREADS typedef struct { int init; CRITICAL_SECTION lock[1]; } mutex_t; #define MUTEX_INITIALIZER { 0, {{ NULL, 0, 0, NULL, NULL, 0 }} } static __inline__ void mutex_lock(mutex_t* lock) { if (!lock->init) { lock->init = 1; InitializeCriticalSection( lock->lock ); lock->init = 2; } else while (lock->init != 2) Sleep(10); EnterCriticalSection(lock->lock); } static __inline__ void mutex_unlock(mutex_t* lock) { LeaveCriticalSection(lock->lock); } static __inline__ int mutex_init(mutex_t* lock) { InitializeCriticalSection(lock->lock); lock->init = 2; return 0; } static __inline__ void mutex_destroy(mutex_t* lock) { if (lock->init) { lock->init = 0; DeleteCriticalSection(lock->lock); } } #endif #ifdef __cplusplus } #endif #endif /* _LIBS_CUTILS_THREADS_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/selector.h0000644000015700001700000000744012200324306024616 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Framework for multiplexing I/O. A selector manages a set of file * descriptors and calls out to user-provided callback functions to read and * write data and handle errors. */ #ifndef __SELECTOR_H #define __SELECTOR_H #ifdef __cplusplus extern "C" { #endif #include /** * Manages SelectableFds and invokes their callbacks at appropriate times. */ typedef struct Selector Selector; /** * A selectable descriptor. Contains callbacks which the selector can invoke * before calling select(), when the descriptor is readable or writable, and * when the descriptor contains out-of-band data. Simply set a callback to * NULL if you're not interested in that particular event. * * A selectable descriptor can indicate that it needs to be removed from the * selector by setting the 'remove' flag. The selector will remove the * descriptor at a later time and invoke the onRemove() callback. * * SelectableFd fields should only be modified from the selector loop. */ typedef struct SelectableFd SelectableFd; struct SelectableFd { /** The file descriptor itself. */ int fd; /** Pointer to user-specific data. Can be NULL. */ void* data; /** * Set this flag when you no longer wish to be selected. The selector * will invoke onRemove() when the descriptor is actually removed. */ bool remove; /** * Invoked by the selector before calling select. You can set up other * callbacks from here as necessary. */ void (*beforeSelect)(SelectableFd* self); /** * Invoked by the selector when the descriptor has data available. Set to * NULL to indicate that you're not interested in reading. */ void (*onReadable)(SelectableFd* self); /** * Invoked by the selector when the descriptor can accept data. Set to * NULL to indicate that you're not interested in writing. */ void (*onWritable)(SelectableFd* self); /** * Invoked by the selector when out-of-band (OOB) data is available. Set to * NULL to indicate that you're not interested in OOB data. */ void (*onExcept)(SelectableFd* self); /** * Invoked by the selector after the descriptor is removed from the * selector but before the selector frees the SelectableFd memory. */ void (*onRemove)(SelectableFd* self); /** * The selector which selected this fd. Set by the selector itself. */ Selector* selector; }; /** * Creates a new selector. */ Selector* selectorCreate(void); /** * Creates a new selectable fd, adds it to the given selector and returns a * pointer. Outside of 'selector' and 'fd', all fields are set to 0 or NULL * by default. * * The selectable fd should only be modified from the selector loop thread. */ SelectableFd* selectorAdd(Selector* selector, int fd); /** * Wakes up the selector even though no I/O events occurred. Use this * to indicate that you're ready to write to a descriptor. */ void selectorWakeUp(Selector* selector); /** * Loops continuously selecting file descriptors and firing events. * Does not return. */ void selectorLoop(Selector* selector); #ifdef __cplusplus } #endif #endif /* __SELECTOR_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/partition_utils.h0000644000015700001700000000152712200324306026227 0ustar pbuserpbgroup00000000000000/* * Copyright 2011, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __CUTILS_PARTITION_WIPED_H__ #define __CUTILS_PARTITION_WIPED_H__ __BEGIN_DECLS int partition_wiped(char *source); void erase_footer(const char *dev_path, long long size); __END_DECLS #endif /* __CUTILS_PARTITION_WIPED_H__ */ android-audiosystem-1.8+13.10.20130807/include/cutils/log.h0000644000015700001700000003107412200324306023557 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // C/C++ logging functions. See the logging documentation for API details. // // We'd like these to be available from C code (in case we import some from // somewhere), so this has a C interface. // // The output will be correct when the log file is shared between multiple // threads and/or multiple processes so long as the operating system // supports O_APPEND. These calls have mutex-protected data structures // and so are NOT reentrant. Do not use LOG in a signal handler. // #ifndef _LIBS_CUTILS_LOG_H #define _LIBS_CUTILS_LOG_H #include #include #include #include #ifdef HAVE_PTHREADS #include #endif #include #include #include #ifdef __cplusplus extern "C" { #endif // --------------------------------------------------------------------- /* * Normally we strip ALOGV (VERBOSE messages) from release builds. * You can modify this (for example with "#define LOG_NDEBUG 0" * at the top of your source file) to change that behavior. */ #ifndef LOG_NDEBUG #ifdef NDEBUG #define LOG_NDEBUG 1 #else #define LOG_NDEBUG 0 #endif #endif /* * This is the local tag used for the following simplified * logging macros. You can change this preprocessor definition * before using the other macros to change the tag. */ #ifndef LOG_TAG #define LOG_TAG NULL #endif // --------------------------------------------------------------------- /* * Simplified macro to send a verbose log message using the current LOG_TAG. */ #ifndef ALOGV #if LOG_NDEBUG #define ALOGV(...) ((void)0) #else #define ALOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) #endif #endif #define CONDITION(cond) (__builtin_expect((cond)!=0, 0)) #ifndef ALOGV_IF #if LOG_NDEBUG #define ALOGV_IF(cond, ...) ((void)0) #else #define ALOGV_IF(cond, ...) \ ( (CONDITION(cond)) \ ? ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) #endif #endif /* * Simplified macro to send a debug log message using the current LOG_TAG. */ #ifndef ALOGD #define ALOGD(...) ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) #endif #ifndef ALOGD_IF #define ALOGD_IF(cond, ...) \ ( (CONDITION(cond)) \ ? ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) #endif /* * Simplified macro to send an info log message using the current LOG_TAG. */ #ifndef ALOGI #define ALOGI(...) ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__)) #endif #ifndef ALOGI_IF #define ALOGI_IF(cond, ...) \ ( (CONDITION(cond)) \ ? ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) #endif /* * Simplified macro to send a warning log message using the current LOG_TAG. */ #ifndef ALOGW #define ALOGW(...) ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__)) #endif #ifndef ALOGW_IF #define ALOGW_IF(cond, ...) \ ( (CONDITION(cond)) \ ? ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) #endif /* * Simplified macro to send an error log message using the current LOG_TAG. */ #ifndef ALOGE #define ALOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) #endif #ifndef ALOGE_IF #define ALOGE_IF(cond, ...) \ ( (CONDITION(cond)) \ ? ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) #endif // --------------------------------------------------------------------- /* * Conditional based on whether the current LOG_TAG is enabled at * verbose priority. */ #ifndef IF_ALOGV #if LOG_NDEBUG #define IF_ALOGV() if (false) #else #define IF_ALOGV() IF_ALOG(LOG_VERBOSE, LOG_TAG) #endif #endif /* * Conditional based on whether the current LOG_TAG is enabled at * debug priority. */ #ifndef IF_ALOGD #define IF_ALOGD() IF_ALOG(LOG_DEBUG, LOG_TAG) #endif /* * Conditional based on whether the current LOG_TAG is enabled at * info priority. */ #ifndef IF_ALOGI #define IF_ALOGI() IF_ALOG(LOG_INFO, LOG_TAG) #endif /* * Conditional based on whether the current LOG_TAG is enabled at * warn priority. */ #ifndef IF_ALOGW #define IF_ALOGW() IF_ALOG(LOG_WARN, LOG_TAG) #endif /* * Conditional based on whether the current LOG_TAG is enabled at * error priority. */ #ifndef IF_ALOGE #define IF_ALOGE() IF_ALOG(LOG_ERROR, LOG_TAG) #endif // --------------------------------------------------------------------- /* * Simplified macro to send a verbose system log message using the current LOG_TAG. */ #ifndef SLOGV #if LOG_NDEBUG #define SLOGV(...) ((void)0) #else #define SLOGV(...) ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) #endif #endif #define CONDITION(cond) (__builtin_expect((cond)!=0, 0)) #ifndef SLOGV_IF #if LOG_NDEBUG #define SLOGV_IF(cond, ...) ((void)0) #else #define SLOGV_IF(cond, ...) \ ( (CONDITION(cond)) \ ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) #endif #endif /* * Simplified macro to send a debug system log message using the current LOG_TAG. */ #ifndef SLOGD #define SLOGD(...) ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)) #endif #ifndef SLOGD_IF #define SLOGD_IF(cond, ...) \ ( (CONDITION(cond)) \ ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) #endif /* * Simplified macro to send an info system log message using the current LOG_TAG. */ #ifndef SLOGI #define SLOGI(...) ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)) #endif #ifndef SLOGI_IF #define SLOGI_IF(cond, ...) \ ( (CONDITION(cond)) \ ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) #endif /* * Simplified macro to send a warning system log message using the current LOG_TAG. */ #ifndef SLOGW #define SLOGW(...) ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)) #endif #ifndef SLOGW_IF #define SLOGW_IF(cond, ...) \ ( (CONDITION(cond)) \ ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) #endif /* * Simplified macro to send an error system log message using the current LOG_TAG. */ #ifndef SLOGE #define SLOGE(...) ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)) #endif #ifndef SLOGE_IF #define SLOGE_IF(cond, ...) \ ( (CONDITION(cond)) \ ? ((void)__android_log_buf_print(LOG_ID_SYSTEM, ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)) \ : (void)0 ) #endif // --------------------------------------------------------------------- /* * Log a fatal error. If the given condition fails, this stops program * execution like a normal assertion, but also generating the given message. * It is NOT stripped from release builds. Note that the condition test * is -inverted- from the normal assert() semantics. */ #ifndef LOG_ALWAYS_FATAL_IF #define LOG_ALWAYS_FATAL_IF(cond, ...) \ ( (CONDITION(cond)) \ ? ((void)android_printAssert(#cond, LOG_TAG, ## __VA_ARGS__)) \ : (void)0 ) #endif #ifndef LOG_ALWAYS_FATAL #define LOG_ALWAYS_FATAL(...) \ ( ((void)android_printAssert(NULL, LOG_TAG, ## __VA_ARGS__)) ) #endif /* * Versions of LOG_ALWAYS_FATAL_IF and LOG_ALWAYS_FATAL that * are stripped out of release builds. */ #if LOG_NDEBUG #ifndef LOG_FATAL_IF #define LOG_FATAL_IF(cond, ...) ((void)0) #endif #ifndef LOG_FATAL #define LOG_FATAL(...) ((void)0) #endif #else #ifndef LOG_FATAL_IF #define LOG_FATAL_IF(cond, ...) LOG_ALWAYS_FATAL_IF(cond, ## __VA_ARGS__) #endif #ifndef LOG_FATAL #define LOG_FATAL(...) LOG_ALWAYS_FATAL(__VA_ARGS__) #endif #endif /* * Assertion that generates a log message when the assertion fails. * Stripped out of release builds. Uses the current LOG_TAG. */ #ifndef ALOG_ASSERT #define ALOG_ASSERT(cond, ...) LOG_FATAL_IF(!(cond), ## __VA_ARGS__) //#define ALOG_ASSERT(cond) LOG_FATAL_IF(!(cond), "Assertion failed: " #cond) #endif // --------------------------------------------------------------------- /* * Basic log message macro. * * Example: * ALOG(LOG_WARN, NULL, "Failed with error %d", errno); * * The second argument may be NULL or "" to indicate the "global" tag. */ #ifndef ALOG #define ALOG(priority, tag, ...) \ LOG_PRI(ANDROID_##priority, tag, __VA_ARGS__) #endif /* * Log macro that allows you to specify a number for the priority. */ #ifndef LOG_PRI #define LOG_PRI(priority, tag, ...) \ android_printLog(priority, tag, __VA_ARGS__) #endif /* * Log macro that allows you to pass in a varargs ("args" is a va_list). */ #ifndef LOG_PRI_VA #define LOG_PRI_VA(priority, tag, fmt, args) \ android_vprintLog(priority, NULL, tag, fmt, args) #endif /* * Conditional given a desired logging priority and tag. */ #ifndef IF_ALOG #define IF_ALOG(priority, tag) \ if (android_testLog(ANDROID_##priority, tag)) #endif // --------------------------------------------------------------------- /* * Event logging. */ /* * Event log entry types. These must match up with the declarations in * java/android/android/util/EventLog.java. */ typedef enum { EVENT_TYPE_INT = 0, EVENT_TYPE_LONG = 1, EVENT_TYPE_STRING = 2, EVENT_TYPE_LIST = 3, } AndroidEventLogType; #ifndef LOG_EVENT_INT #define LOG_EVENT_INT(_tag, _value) { \ int intBuf = _value; \ (void) android_btWriteLog(_tag, EVENT_TYPE_INT, &intBuf, \ sizeof(intBuf)); \ } #endif #ifndef LOG_EVENT_LONG #define LOG_EVENT_LONG(_tag, _value) { \ long long longBuf = _value; \ (void) android_btWriteLog(_tag, EVENT_TYPE_LONG, &longBuf, \ sizeof(longBuf)); \ } #endif #ifndef LOG_EVENT_STRING #define LOG_EVENT_STRING(_tag, _value) \ ((void) 0) /* not implemented -- must combine len with string */ #endif /* TODO: something for LIST */ /* * =========================================================================== * * The stuff in the rest of this file should not be used directly. */ #define android_printLog(prio, tag, fmt...) \ __android_log_print(prio, tag, fmt) #define android_vprintLog(prio, cond, tag, fmt...) \ __android_log_vprint(prio, tag, fmt) /* XXX Macros to work around syntax errors in places where format string * arg is not passed to ALOG_ASSERT, LOG_ALWAYS_FATAL or LOG_ALWAYS_FATAL_IF * (happens only in debug builds). */ /* Returns 2nd arg. Used to substitute default value if caller's vararg list * is empty. */ #define __android_second(dummy, second, ...) second /* If passed multiple args, returns ',' followed by all but 1st arg, otherwise * returns nothing. */ #define __android_rest(first, ...) , ## __VA_ARGS__ #define android_printAssert(cond, tag, fmt...) \ __android_log_assert(cond, tag, \ __android_second(0, ## fmt, NULL) __android_rest(fmt)) #define android_writeLog(prio, tag, text) \ __android_log_write(prio, tag, text) #define android_bWriteLog(tag, payload, len) \ __android_log_bwrite(tag, payload, len) #define android_btWriteLog(tag, type, payload, len) \ __android_log_btwrite(tag, type, payload, len) // TODO: remove these prototypes and their users #define android_testLog(prio, tag) (1) #define android_writevLog(vec,num) do{}while(0) #define android_write1Log(str,len) do{}while (0) #define android_setMinPriority(tag, prio) do{}while(0) //#define android_logToCallback(func) do{}while(0) #define android_logToFile(tag, file) (0) #define android_logToFd(tag, fd) (0) typedef enum { LOG_ID_MAIN = 0, LOG_ID_RADIO = 1, LOG_ID_EVENTS = 2, LOG_ID_SYSTEM = 3, LOG_ID_MAX } log_id_t; /* * Send a simple string to the log. */ int __android_log_buf_write(int bufID, int prio, const char *tag, const char *text); int __android_log_buf_print(int bufID, int prio, const char *tag, const char *fmt, ...); #ifdef __cplusplus } #endif #endif // _LIBS_CUTILS_LOG_H android-audiosystem-1.8+13.10.20130807/include/cutils/jstring.h0000644000015700001700000000245612200324306024460 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __CUTILS_STRING16_H #define __CUTILS_STRING16_H #include #include #ifdef __cplusplus extern "C" { #endif typedef uint16_t char16_t; extern char * strndup16to8 (const char16_t* s, size_t n); extern size_t strnlen16to8 (const char16_t* s, size_t n); extern char * strncpy16to8 (char *dest, const char16_t*s, size_t n); extern char16_t * strdup8to16 (const char* s, size_t *out_len); extern size_t strlen8to16 (const char* utf8Str); extern char16_t * strcpy8to16 (char16_t *dest, const char*s, size_t *out_len); extern char16_t * strcpylen8to16 (char16_t *dest, const char*s, int length, size_t *out_len); #ifdef __cplusplus } #endif #endif /* __CUTILS_STRING16_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/android_reboot.h0000644000015700001700000000202112200324306025756 0ustar pbuserpbgroup00000000000000/* * Copyright 2011, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __CUTILS_ANDROID_REBOOT_H__ #define __CUTILS_ANDROID_REBOOT_H__ __BEGIN_DECLS /* Commands */ #define ANDROID_RB_RESTART 0xDEAD0001 #define ANDROID_RB_POWEROFF 0xDEAD0002 #define ANDROID_RB_RESTART2 0xDEAD0003 /* Flags */ #define ANDROID_RB_FLAG_NO_SYNC 0x1 #define ANDROID_RB_FLAG_NO_REMOUNT_RO 0x2 int android_reboot(int cmd, int flags, char *arg); __END_DECLS #endif /* __CUTILS_ANDROID_REBOOT_H__ */ android-audiosystem-1.8+13.10.20130807/include/cutils/atomic-inline.h0000644000015700001700000000376212200324306025531 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_CUTILS_ATOMIC_INLINE_H #define ANDROID_CUTILS_ATOMIC_INLINE_H #ifdef __cplusplus extern "C" { #endif /* * Inline declarations and macros for some special-purpose atomic * operations. These are intended for rare circumstances where a * memory barrier needs to be issued inline rather than as a function * call. * * Most code should not use these. * * Anything that does include this file must set ANDROID_SMP to either * 0 or 1, indicating compilation for UP or SMP, respectively. * * Macros defined in this header: * * void ANDROID_MEMBAR_FULL(void) * Full memory barrier. Provides a compiler reordering barrier, and * on SMP systems emits an appropriate instruction. */ #if !defined(ANDROID_SMP) # error "Must define ANDROID_SMP before including atomic-inline.h" #endif #if defined(__arm__) #include #elif defined(__i386__) || defined(__x86_64__) #include #elif defined(__mips__) #include #else #error atomic operations are unsupported #endif #if ANDROID_SMP == 0 #define ANDROID_MEMBAR_FULL android_compiler_barrier #else #define ANDROID_MEMBAR_FULL android_memory_barrier #endif #if ANDROID_SMP == 0 #define ANDROID_MEMBAR_STORE android_compiler_barrier #else #define ANDROID_MEMBAR_STORE android_memory_store_barrier #endif #ifdef __cplusplus } #endif #endif /* ANDROID_CUTILS_ATOMIC_INLINE_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/list.h0000644000015700001700000000310112200324306023737 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _CUTILS_LIST_H_ #define _CUTILS_LIST_H_ #include #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ struct listnode { struct listnode *next; struct listnode *prev; }; #define node_to_item(node, container, member) \ (container *) (((char*) (node)) - offsetof(container, member)) #define list_declare(name) \ struct listnode name = { \ .next = &name, \ .prev = &name, \ } #define list_for_each(node, list) \ for (node = (list)->next; node != (list); node = node->next) #define list_for_each_reverse(node, list) \ for (node = (list)->prev; node != (list); node = node->prev) void list_init(struct listnode *list); void list_add_tail(struct listnode *list, struct listnode *item); void list_remove(struct listnode *item); #define list_empty(list) ((list) == (list)->next) #define list_head(list) ((list)->next) #define list_tail(list) ((list)->prev) #ifdef __cplusplus }; #endif /* __cplusplus */ #endif android-audiosystem-1.8+13.10.20130807/include/cutils/record_stream.h0000644000015700001700000000222212200324306025620 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * A simple utility for reading fixed records out of a stream fd */ #ifndef _CUTILS_RECORD_STREAM_H #define _CUTILS_RECORD_STREAM_H #ifdef __cplusplus extern "C" { #endif typedef struct RecordStream RecordStream; extern RecordStream *record_stream_new(int fd, size_t maxRecordLen); extern void record_stream_free(RecordStream *p_rs); extern int record_stream_get_next (RecordStream *p_rs, void ** p_outRecord, size_t *p_outRecordLen); #ifdef __cplusplus } #endif #endif /*_CUTILS_RECORD_STREAM_H*/ android-audiosystem-1.8+13.10.20130807/include/cutils/misc.h0000644000015700001700000000270612200324306023731 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __CUTILS_MISC_H #define __CUTILS_MISC_H #ifdef __cplusplus extern "C" { #endif /* Load an entire file into a malloc'd chunk of memory * that is length_of_file + 1 (null terminator). If * sz is non-zero, return the size of the file via sz. * Returns 0 on failure. */ extern void *load_file(const char *fn, unsigned *sz); /* Connects your process to the system debugger daemon * so that on a crash it may be logged or interactively * debugged (depending on system settings). */ extern void debuggerd_connect(void); /* This is the range of UIDs (and GIDs) that are reserved * for assigning to applications. */ #define FIRST_APPLICATION_UID 10000 #define LAST_APPLICATION_UID 99999 #ifdef __cplusplus } #endif #endif /* __CUTILS_MISC_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/ashmem.h0000644000015700001700000000214112200324306024241 0ustar pbuserpbgroup00000000000000/* cutils/ashmem.h ** ** Copyright 2008 The Android Open Source Project ** ** This file is dual licensed. It may be redistributed and/or modified ** under the terms of the Apache 2.0 License OR version 2 of the GNU ** General Public License. */ #ifndef _CUTILS_ASHMEM_H #define _CUTILS_ASHMEM_H #include #ifdef __cplusplus extern "C" { #endif int ashmem_create_region(const char *name, size_t size); int ashmem_set_prot_region(int fd, int prot); int ashmem_pin_region(int fd, size_t offset, size_t len); int ashmem_unpin_region(int fd, size_t offset, size_t len); int ashmem_get_size_region(int fd); #ifdef __cplusplus } #endif #ifndef __ASHMEMIOC /* in case someone included too */ #define ASHMEM_NAME_LEN 256 #define ASHMEM_NAME_DEF "dev/ashmem" /* Return values from ASHMEM_PIN: Was the mapping purged while unpinned? */ #define ASHMEM_NOT_PURGED 0 #define ASHMEM_WAS_PURGED 1 /* Return values from ASHMEM_UNPIN: Is the mapping now pinned or unpinned? */ #define ASHMEM_IS_UNPINNED 0 #define ASHMEM_IS_PINNED 1 #endif /* ! __ASHMEMIOC */ #endif /* _CUTILS_ASHMEM_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/hashmap.h0000644000015700001700000000675512200324306024427 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Hash map. */ #ifndef __HASHMAP_H #define __HASHMAP_H #include #include #ifdef __cplusplus extern "C" { #endif /** A hash map. */ typedef struct Hashmap Hashmap; /** * Creates a new hash map. Returns NULL if memory allocation fails. * * @param initialCapacity number of expected entries * @param hash function which hashes keys * @param equals function which compares keys for equality */ Hashmap* hashmapCreate(size_t initialCapacity, int (*hash)(void* key), bool (*equals)(void* keyA, void* keyB)); /** * Frees the hash map. Does not free the keys or values themselves. */ void hashmapFree(Hashmap* map); /** * Hashes the memory pointed to by key with the given size. Useful for * implementing hash functions. */ int hashmapHash(void* key, size_t keySize); /** * Puts value for the given key in the map. Returns pre-existing value if * any. * * If memory allocation fails, this function returns NULL, the map's size * does not increase, and errno is set to ENOMEM. */ void* hashmapPut(Hashmap* map, void* key, void* value); /** * Gets a value from the map. Returns NULL if no entry for the given key is * found or if the value itself is NULL. */ void* hashmapGet(Hashmap* map, void* key); /** * Returns true if the map contains an entry for the given key. */ bool hashmapContainsKey(Hashmap* map, void* key); /** * Gets the value for a key. If a value is not found, this function gets a * value and creates an entry using the given callback. * * If memory allocation fails, the callback is not called, this function * returns NULL, and errno is set to ENOMEM. */ void* hashmapMemoize(Hashmap* map, void* key, void* (*initialValue)(void* key, void* context), void* context); /** * Removes an entry from the map. Returns the removed value or NULL if no * entry was present. */ void* hashmapRemove(Hashmap* map, void* key); /** * Gets the number of entries in this map. */ size_t hashmapSize(Hashmap* map); /** * Invokes the given callback on each entry in the map. Stops iterating if * the callback returns false. */ void hashmapForEach(Hashmap* map, bool (*callback)(void* key, void* value, void* context), void* context); /** * Concurrency support. */ /** * Locks the hash map so only the current thread can access it. */ void hashmapLock(Hashmap* map); /** * Unlocks the hash map so other threads can access it. */ void hashmapUnlock(Hashmap* map); /** * Key utilities. */ /** * Hashes int keys. 'key' is a pointer to int. */ int hashmapIntHash(void* key); /** * Compares two int keys for equality. */ bool hashmapIntEquals(void* keyA, void* keyB); /** * For debugging. */ /** * Gets current capacity. */ size_t hashmapCurrentCapacity(Hashmap* map); /** * Counts the number of entry collisions. */ size_t hashmapCountCollisions(Hashmap* map); #ifdef __cplusplus } #endif #endif /* __HASHMAP_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/uio.h0000644000015700001700000000221212200324306023562 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // implementation of sys/uio.h for platforms that don't have it (Win32) // #ifndef _LIBS_CUTILS_UIO_H #define _LIBS_CUTILS_UIO_H #ifdef HAVE_SYS_UIO_H #include #else #ifdef __cplusplus extern "C" { #endif #include struct iovec { const void* iov_base; size_t iov_len; }; extern int readv( int fd, struct iovec* vecs, int count ); extern int writev( int fd, const struct iovec* vecs, int count ); #ifdef __cplusplus } #endif #endif /* !HAVE_SYS_UIO_H */ #endif /* _LIBS_UTILS_UIO_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/memory.h0000644000015700001700000000234112200324306024301 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_CUTILS_MEMORY_H #define ANDROID_CUTILS_MEMORY_H #include #include #ifdef __cplusplus extern "C" { #endif /* size is given in bytes and must be multiple of 2 */ void android_memset16(uint16_t* dst, uint16_t value, size_t size); /* size is given in bytes and must be multiple of 4 */ void android_memset32(uint32_t* dst, uint32_t value, size_t size); #if !HAVE_STRLCPY /* Declaration of strlcpy() for platforms that don't already have it. */ size_t strlcpy(char *dst, const char *src, size_t size); #endif #ifdef __cplusplus } // extern "C" #endif #endif // ANDROID_CUTILS_MEMORY_H android-audiosystem-1.8+13.10.20130807/include/cutils/fs.h0000644000015700001700000000340612200324306023404 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __CUTILS_FS_H #define __CUTILS_FS_H #include /* * TEMP_FAILURE_RETRY is defined by some, but not all, versions of * . (Alas, it is not as standard as we'd hoped!) So, if it's * not already defined, then define it here. */ #ifndef TEMP_FAILURE_RETRY /* Used to retry syscalls that can return EINTR. */ #define TEMP_FAILURE_RETRY(exp) ({ \ typeof (exp) _rc; \ do { \ _rc = (exp); \ } while (_rc == -1 && errno == EINTR); \ _rc; }) #endif #ifdef __cplusplus extern "C" { #endif /* * Ensure that directory exists with given mode and owners. */ extern int fs_prepare_dir(const char* path, mode_t mode, uid_t uid, gid_t gid); /* * Read single plaintext integer from given file, correctly handling files * partially written with fs_write_atomic_int(). */ extern int fs_read_atomic_int(const char* path, int* value); /* * Write single plaintext integer to given file, creating backup while * in progress. */ extern int fs_write_atomic_int(const char* path, int value); #ifdef __cplusplus } #endif #endif /* __CUTILS_FS_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/str_parms.h0000644000015700001700000000327712200324306025014 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __CUTILS_STR_PARMS_H #define __CUTILS_STR_PARMS_H #include struct str_parms; struct str_parms *str_parms_create(void); struct str_parms *str_parms_create_str(const char *_string); void str_parms_destroy(struct str_parms *str_parms); void str_parms_del(struct str_parms *str_parms, const char *key); int str_parms_add_str(struct str_parms *str_parms, const char *key, const char *value); int str_parms_add_int(struct str_parms *str_parms, const char *key, int value); int str_parms_add_float(struct str_parms *str_parms, const char *key, float value); int str_parms_get_str(struct str_parms *str_parms, const char *key, char *out_val, int len); int str_parms_get_int(struct str_parms *str_parms, const char *key, int *out_val); int str_parms_get_float(struct str_parms *str_parms, const char *key, float *out_val); char *str_parms_to_str(struct str_parms *str_parms); /* debug */ void str_parms_dump(struct str_parms *str_parms); #endif /* __CUTILS_STR_PARMS_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/bitops.h0000644000015700001700000000177012200324306024276 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __CUTILS_BITOPS_H #define __CUTILS_BITOPS_H #include __BEGIN_DECLS static inline int popcount(unsigned int x) { return __builtin_popcount(x); } static inline int popcountl(unsigned long x) { return __builtin_popcountl(x); } static inline int popcountll(unsigned long long x) { return __builtin_popcountll(x); } __END_DECLS #endif /* __CUTILS_BITOPS_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/uevent.h0000644000015700001700000000202612200324306024277 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __CUTILS_UEVENT_H #define __CUTILS_UEVENT_H #include #include #ifdef __cplusplus extern "C" { #endif int uevent_open_socket(int buf_sz, bool passcred); ssize_t uevent_kernel_multicast_recv(int socket, void *buffer, size_t length); ssize_t uevent_kernel_multicast_uid_recv(int socket, void *buffer, size_t length, uid_t *uid); #ifdef __cplusplus } #endif #endif /* __CUTILS_UEVENT_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/qsort_r_compat.h0000644000015700001700000000224212200324306026025 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Provides a portable version of qsort_r, called qsort_r_compat, which is a * reentrant variant of qsort that passes a user data pointer to its comparator. * This implementation follows the BSD parameter convention. */ #ifndef _LIBS_CUTILS_QSORT_R_COMPAT_H #define _LIBS_CUTILS_QSORT_R_COMPAT_H #include #ifdef __cplusplus extern "C" { #endif void qsort_r_compat(void* base, size_t nel, size_t width, void* thunk, int (*compar)(void*, const void* , const void* )); #ifdef __cplusplus } #endif #endif // _LIBS_CUTILS_QSORT_R_COMPAT_H android-audiosystem-1.8+13.10.20130807/include/cutils/logprint.h0000644000015700001700000000747612200324306024645 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _LOGPRINT_H #define _LOGPRINT_H #include #include #include #include #ifdef __cplusplus extern "C" { #endif typedef enum { FORMAT_OFF = 0, FORMAT_BRIEF, FORMAT_PROCESS, FORMAT_TAG, FORMAT_THREAD, FORMAT_RAW, FORMAT_TIME, FORMAT_THREADTIME, FORMAT_LONG, } AndroidLogPrintFormat; typedef enum { OUTPUT_COLOR_ON = 0, OUTPUT_COLOR_OFF, } AndroidLogColoredOutput; typedef struct AndroidLogFormat_t AndroidLogFormat; typedef struct AndroidLogEntry_t { time_t tv_sec; long tv_nsec; android_LogPriority priority; int32_t pid; int32_t tid; const char * tag; size_t messageLen; const char * message; } AndroidLogEntry; AndroidLogFormat *android_log_format_new(); void android_log_format_free(AndroidLogFormat *p_format); void android_log_setPrintFormat(AndroidLogFormat *p_format, AndroidLogPrintFormat format); void android_log_setColoredOutput(AndroidLogFormat *p_format); /** * Returns FORMAT_OFF on invalid string */ AndroidLogPrintFormat android_log_formatFromString(const char *s); /** * filterExpression: a single filter expression * eg "AT:d" * * returns 0 on success and -1 on invalid expression * * Assumes single threaded execution * */ int android_log_addFilterRule(AndroidLogFormat *p_format, const char *filterExpression); /** * filterString: a whitespace-separated set of filter expressions * eg "AT:d *:i" * * returns 0 on success and -1 on invalid expression * * Assumes single threaded execution * */ int android_log_addFilterString(AndroidLogFormat *p_format, const char *filterString); /** * returns 1 if this log line should be printed based on its priority * and tag, and 0 if it should not */ int android_log_shouldPrintLine ( AndroidLogFormat *p_format, const char *tag, android_LogPriority pri); /** * Splits a wire-format buffer into an AndroidLogEntry * entry allocated by caller. Pointers will point directly into buf * * Returns 0 on success and -1 on invalid wire format (entry will be * in unspecified state) */ int android_log_processLogBuffer(struct logger_entry *buf, AndroidLogEntry *entry); /** * Like android_log_processLogBuffer, but for binary logs. * * If "map" is non-NULL, it will be used to convert the log tag number * into a string. */ int android_log_processBinaryLogBuffer(struct logger_entry *buf, AndroidLogEntry *entry, const EventTagMap* map, char* messageBuf, int messageBufLen); /** * Formats a log message into a buffer * * Uses defaultBuffer if it can, otherwise malloc()'s a new buffer * If return value != defaultBuffer, caller must call free() * Returns NULL on malloc error */ char *android_log_formatLogLine ( AndroidLogFormat *p_format, char *defaultBuffer, size_t defaultBufferSize, const AndroidLogEntry *p_line, size_t *p_outLength); /** * Either print or do not print log line, based on filter * * Assumes single threaded execution * */ int android_log_printLogLine( AndroidLogFormat *p_format, int fd, const AndroidLogEntry *entry); #ifdef __cplusplus } #endif #endif /*_LOGPRINT_H*/ android-audiosystem-1.8+13.10.20130807/include/cutils/open_memstream.h0000644000015700001700000000164712200324306026014 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __CUTILS_OPEN_MEMSTREAM_H__ #define __CUTILS_OPEN_MEMSTREAM_H__ #include #ifndef HAVE_OPEN_MEMSTREAM #ifdef __cplusplus extern "C" { #endif FILE* open_memstream(char** bufp, size_t* sizep); #ifdef __cplusplus } #endif #endif /*!HAVE_OPEN_MEMSTREAM*/ #endif /*__CUTILS_OPEN_MEMSTREAM_H__*/ android-audiosystem-1.8+13.10.20130807/include/cutils/logd.h0000644000015700001700000000245012200324306023717 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _ANDROID_CUTILS_LOGD_H #define _ANDROID_CUTILS_LOGD_H /* the stable/frozen log-related definitions have been * moved to this header, which is exposed by the NDK */ #include /* the rest is only used internally by the system */ #include #include #include #include #include #ifdef HAVE_PTHREADS #include #endif #include #include #ifdef __cplusplus extern "C" { #endif int __android_log_bwrite(int32_t tag, const void *payload, size_t len); int __android_log_btwrite(int32_t tag, char type, const void *payload, size_t len); #ifdef __cplusplus } #endif #endif /* _LOGD_H */ android-audiosystem-1.8+13.10.20130807/include/cutils/dir_hash.h0000644000015700001700000000170512200324306024555 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ typedef enum { SHA_1, } HashAlgorithm; int get_file_hash(HashAlgorithm algorithm, const char *path, char *output_string, size_t max_output_string); int get_recursive_hash_manifest(HashAlgorithm algorithm, const char *directory_path, char **output_string); android-audiosystem-1.8+13.10.20130807/include/cutils/atomic.h0000644000015700001700000001115712200324306024252 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_CUTILS_ATOMIC_H #define ANDROID_CUTILS_ATOMIC_H #include #include #ifdef __cplusplus extern "C" { #endif /* * A handful of basic atomic operations. The appropriate pthread * functions should be used instead of these whenever possible. * * The "acquire" and "release" terms can be defined intuitively in terms * of the placement of memory barriers in a simple lock implementation: * - wait until compare-and-swap(lock-is-free --> lock-is-held) succeeds * - barrier * - [do work] * - barrier * - store(lock-is-free) * In very crude terms, the initial (acquire) barrier prevents any of the * "work" from happening before the lock is held, and the later (release) * barrier ensures that all of the work happens before the lock is released. * (Think of cached writes, cache read-ahead, and instruction reordering * around the CAS and store instructions.) * * The barriers must apply to both the compiler and the CPU. Note it is * legal for instructions that occur before an "acquire" barrier to be * moved down below it, and for instructions that occur after a "release" * barrier to be moved up above it. * * The ARM-driven implementation we use here is short on subtlety, * and actually requests a full barrier from the compiler and the CPU. * The only difference between acquire and release is in whether they * are issued before or after the atomic operation with which they * are associated. To ease the transition to C/C++ atomic intrinsics, * you should not rely on this, and instead assume that only the minimal * acquire/release protection is provided. * * NOTE: all int32_t* values are expected to be aligned on 32-bit boundaries. * If they are not, atomicity is not guaranteed. */ /* * Basic arithmetic and bitwise operations. These all provide a * barrier with "release" ordering, and return the previous value. * * These have the same characteristics (e.g. what happens on overflow) * as the equivalent non-atomic C operations. */ int32_t android_atomic_inc(volatile int32_t* addr); int32_t android_atomic_dec(volatile int32_t* addr); int32_t android_atomic_add(int32_t value, volatile int32_t* addr); int32_t android_atomic_and(int32_t value, volatile int32_t* addr); int32_t android_atomic_or(int32_t value, volatile int32_t* addr); /* * Perform an atomic load with "acquire" or "release" ordering. * * This is only necessary if you need the memory barrier. A 32-bit read * from a 32-bit aligned address is atomic on all supported platforms. */ int32_t android_atomic_acquire_load(volatile const int32_t* addr); int32_t android_atomic_release_load(volatile const int32_t* addr); /* * Perform an atomic store with "acquire" or "release" ordering. * * This is only necessary if you need the memory barrier. A 32-bit write * to a 32-bit aligned address is atomic on all supported platforms. */ void android_atomic_acquire_store(int32_t value, volatile int32_t* addr); void android_atomic_release_store(int32_t value, volatile int32_t* addr); /* * Compare-and-set operation with "acquire" or "release" ordering. * * This returns zero if the new value was successfully stored, which will * only happen when *addr == oldvalue. * * (The return value is inverted from implementations on other platforms, * but matches the ARM ldrex/strex result.) * * Implementations that use the release CAS in a loop may be less efficient * than possible, because we re-issue the memory barrier on each iteration. */ int android_atomic_acquire_cas(int32_t oldvalue, int32_t newvalue, volatile int32_t* addr); int android_atomic_release_cas(int32_t oldvalue, int32_t newvalue, volatile int32_t* addr); /* * Aliases for code using an older version of this header. These are now * deprecated and should not be used. The definitions will be removed * in a future release. */ #define android_atomic_write android_atomic_release_store #define android_atomic_cmpxchg android_atomic_release_cas #ifdef __cplusplus } // extern "C" #endif #endif // ANDROID_CUTILS_ATOMIC_H android-audiosystem-1.8+13.10.20130807/include/cutils/native_handle.h0000644000015700001700000000350112200324306025571 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef NATIVE_HANDLE_H_ #define NATIVE_HANDLE_H_ #ifdef __cplusplus extern "C" { #endif typedef struct native_handle { int version; /* sizeof(native_handle_t) */ int numFds; /* number of file-descriptors at &data[0] */ int numInts; /* number of ints at &data[numFds] */ int data[0]; /* numFds + numInts ints */ } native_handle_t; /* * native_handle_close * * closes the file descriptors contained in this native_handle_t * * return 0 on success, or a negative error code on failure * */ int native_handle_close(const native_handle_t* h); /* * native_handle_create * * creates a native_handle_t and initializes it. must be destroyed with * native_handle_delete(). * */ native_handle_t* native_handle_create(int numFds, int numInts); /* * native_handle_delete * * frees a native_handle_t allocated with native_handle_create(). * This ONLY frees the memory allocated for the native_handle_t, but doesn't * close the file descriptors; which can be achieved with native_handle_close(). * * return 0 on success, or a negative error code on failure * */ int native_handle_delete(native_handle_t* h); #ifdef __cplusplus } #endif #endif /* NATIVE_HANDLE_H_ */ android-audiosystem-1.8+13.10.20130807/include/private/0000755000015700001700000000000012200324404022766 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/private/hwui/0000755000015700001700000000000012200324404023742 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/private/hwui/DrawGlInfo.h0000644000015700001700000000252412200324306026113 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_HWUI_DRAW_GL_INFO_H #define ANDROID_HWUI_DRAW_GL_INFO_H namespace android { namespace uirenderer { /** * Structure used by OpenGLRenderer::callDrawGLFunction() to pass and * receive data from OpenGL functors. */ struct DrawGlInfo { // Input: current clip rect int clipLeft; int clipTop; int clipRight; int clipBottom; // Input: is the render target an FBO bool isLayer; // Input: current transform matrix, in OpenGL format float transform[16]; // Output: dirty region to redraw float dirtyLeft; float dirtyTop; float dirtyRight; float dirtyBottom; }; // struct DrawGlInfo }; // namespace uirenderer }; // namespace android #endif // ANDROID_HWUI_DRAW_GL_INFO_H android-audiosystem-1.8+13.10.20130807/include/private/surfaceflinger/0000755000015700001700000000000012200324404025765 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/private/surfaceflinger/LayerState.h0000644000015700001700000000424612200324306030222 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_SF_LAYER_STATE_H #define ANDROID_SF_LAYER_STATE_H #include #include #include #include #include namespace android { class Parcel; class ISurfaceComposerClient; struct layer_state_t { layer_state_t() : surface(0), what(0), x(0), y(0), z(0), w(0), h(0), alpha(0), tint(0), flags(0), mask(0), reserved(0) { matrix.dsdx = matrix.dtdy = 1.0f; matrix.dsdy = matrix.dtdx = 0.0f; } status_t write(Parcel& output) const; status_t read(const Parcel& input); struct matrix22_t { float dsdx; float dtdx; float dsdy; float dtdy; }; SurfaceID surface; uint32_t what; float x; float y; uint32_t z; uint32_t w; uint32_t h; float alpha; uint32_t tint; uint8_t flags; uint8_t mask; uint8_t reserved; matrix22_t matrix; // non POD must be last. see write/read Region transparentRegion; }; struct ComposerState { sp client; layer_state_t state; status_t write(Parcel& output) const; status_t read(const Parcel& input); }; }; // namespace android #endif // ANDROID_SF_LAYER_STATE_H android-audiosystem-1.8+13.10.20130807/include/private/surfaceflinger/SharedBufferStack.h0000644000015700001700000000315212200324306031466 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_SF_SHARED_BUFFER_STACK_H #define ANDROID_SF_SHARED_BUFFER_STACK_H #include #include #include namespace android { // --------------------------------------------------------------------------- #define NUM_DISPLAY_MAX 4 struct display_cblk_t { uint16_t w; uint16_t h; uint8_t format; uint8_t orientation; uint8_t reserved[2]; float fps; float density; float xdpi; float ydpi; uint32_t pad[2]; }; struct surface_flinger_cblk_t // 4KB max { uint8_t connected; uint8_t reserved[3]; uint32_t pad[7]; display_cblk_t displays[NUM_DISPLAY_MAX]; }; // --------------------------------------------------------------------------- COMPILE_TIME_ASSERT(sizeof(surface_flinger_cblk_t) <= 4096) // --------------------------------------------------------------------------- }; // namespace android #endif /* ANDROID_SF_SHARED_BUFFER_STACK_H */ android-audiosystem-1.8+13.10.20130807/include/private/ui/0000755000015700001700000000000012200324404023403 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/private/ui/android_natives_priv.h0000644000015700001700000000122312200324306027764 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include android-audiosystem-1.8+13.10.20130807/include/private/ui/RegionHelper.h0000644000015700001700000002156112200324306026145 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_UI_PRIVATE_REGION_HELPER_H #define ANDROID_UI_PRIVATE_REGION_HELPER_H #include #include namespace android { // ---------------------------------------------------------------------------- template class region_operator { typedef typename RECT::value_type TYPE; static const TYPE max_value = 0x7FFFFFF; public: /* * Common boolean operations: * value is computed as 0b101 op 0b110 * other boolean operation are possible, simply compute * their corresponding value with the above formulae and use * it when instantiating a region_operator. */ static const uint32_t LHS = 0x5; // 0b101 static const uint32_t RHS = 0x6; // 0b110 enum { op_nand = LHS & ~RHS, op_and = LHS & RHS, op_or = LHS | RHS, op_xor = LHS ^ RHS }; struct region { RECT const* rects; size_t count; TYPE dx; TYPE dy; inline region(const region& rhs) : rects(rhs.rects), count(rhs.count), dx(rhs.dx), dy(rhs.dy) { } inline region(RECT const* r, size_t c) : rects(r), count(c), dx(), dy() { } inline region(RECT const* r, size_t c, TYPE dx, TYPE dy) : rects(r), count(c), dx(dx), dy(dy) { } }; class region_rasterizer { friend class region_operator; virtual void operator()(const RECT& rect) = 0; public: virtual ~region_rasterizer() { }; }; inline region_operator(int op, const region& lhs, const region& rhs) : op_mask(op), spanner(lhs, rhs) { } void operator()(region_rasterizer& rasterizer) { RECT current; do { SpannerInner spannerInner(spanner.lhs, spanner.rhs); int inside = spanner.next(current.top, current.bottom); spannerInner.prepare(inside); do { TYPE left, right; int inside = spannerInner.next(current.left, current.right); if ((op_mask >> inside) & 1) { if (current.left < current.right && current.top < current.bottom) { rasterizer(current); } } } while(!spannerInner.isDone()); } while(!spanner.isDone()); } private: uint32_t op_mask; class SpannerBase { public: enum { lhs_before_rhs = 0, lhs_after_rhs = 1, lhs_coincide_rhs = 2 }; protected: TYPE lhs_head; TYPE lhs_tail; TYPE rhs_head; TYPE rhs_tail; inline int next(TYPE& head, TYPE& tail, bool& more_lhs, bool& more_rhs) { int inside; more_lhs = false; more_rhs = false; if (lhs_head < rhs_head) { inside = lhs_before_rhs; head = lhs_head; if (lhs_tail <= rhs_head) { tail = lhs_tail; more_lhs = true; } else { lhs_head = rhs_head; tail = rhs_head; } } else if (rhs_head < lhs_head) { inside = lhs_after_rhs; head = rhs_head; if (rhs_tail <= lhs_head) { tail = rhs_tail; more_rhs = true; } else { rhs_head = lhs_head; tail = lhs_head; } } else { inside = lhs_coincide_rhs; head = lhs_head; if (lhs_tail <= rhs_tail) { tail = rhs_head = lhs_tail; more_lhs = true; } if (rhs_tail <= lhs_tail) { tail = lhs_head = rhs_tail; more_rhs = true; } } return inside; } }; class Spanner : protected SpannerBase { friend class region_operator; region lhs; region rhs; public: inline Spanner(const region& lhs, const region& rhs) : lhs(lhs), rhs(rhs) { SpannerBase::lhs_head = lhs.rects->top + lhs.dy; SpannerBase::lhs_tail = lhs.rects->bottom + lhs.dy; SpannerBase::rhs_head = rhs.rects->top + rhs.dy; SpannerBase::rhs_tail = rhs.rects->bottom + rhs.dy; } inline bool isDone() const { return !rhs.count && !lhs.count; } inline int next(TYPE& top, TYPE& bottom) { bool more_lhs = false; bool more_rhs = false; int inside = SpannerBase::next(top, bottom, more_lhs, more_rhs); if (more_lhs) { advance(lhs, SpannerBase::lhs_head, SpannerBase::lhs_tail); } if (more_rhs) { advance(rhs, SpannerBase::rhs_head, SpannerBase::rhs_tail); } return inside; } private: static inline void advance(region& reg, TYPE& aTop, TYPE& aBottom) { // got to next span size_t count = reg.count; RECT const * rects = reg.rects; RECT const * const end = rects + count; const int top = rects->top; while (rects != end && rects->top == top) { rects++; count--; } if (rects != end) { aTop = rects->top + reg.dy; aBottom = rects->bottom + reg.dy; } else { aTop = max_value; aBottom = max_value; } reg.rects = rects; reg.count = count; } }; class SpannerInner : protected SpannerBase { region lhs; region rhs; public: inline SpannerInner(const region& lhs, const region& rhs) : lhs(lhs), rhs(rhs) { } inline void prepare(int inside) { if (inside == SpannerBase::lhs_before_rhs) { SpannerBase::lhs_head = lhs.rects->left + lhs.dx; SpannerBase::lhs_tail = lhs.rects->right + lhs.dx; SpannerBase::rhs_head = max_value; SpannerBase::rhs_tail = max_value; } else if (inside == SpannerBase::lhs_after_rhs) { SpannerBase::lhs_head = max_value; SpannerBase::lhs_tail = max_value; SpannerBase::rhs_head = rhs.rects->left + rhs.dx; SpannerBase::rhs_tail = rhs.rects->right + rhs.dx; } else { SpannerBase::lhs_head = lhs.rects->left + lhs.dx; SpannerBase::lhs_tail = lhs.rects->right + lhs.dx; SpannerBase::rhs_head = rhs.rects->left + rhs.dx; SpannerBase::rhs_tail = rhs.rects->right + rhs.dx; } } inline bool isDone() const { return SpannerBase::lhs_head == max_value && SpannerBase::rhs_head == max_value; } inline int next(TYPE& left, TYPE& right) { bool more_lhs = false; bool more_rhs = false; int inside = SpannerBase::next(left, right, more_lhs, more_rhs); if (more_lhs) { advance(lhs, SpannerBase::lhs_head, SpannerBase::lhs_tail); } if (more_rhs) { advance(rhs, SpannerBase::rhs_head, SpannerBase::rhs_tail); } return inside; } private: static inline void advance(region& reg, TYPE& left, TYPE& right) { if (reg.rects && reg.count) { const int cur_span_top = reg.rects->top; reg.rects++; reg.count--; if (!reg.count || reg.rects->top != cur_span_top) { left = max_value; right = max_value; } else { left = reg.rects->left + reg.dx; right = reg.rects->right + reg.dx; } } } }; Spanner spanner; }; // ---------------------------------------------------------------------------- }; #endif /* ANDROID_UI_PRIVATE_REGION_HELPER_H */ android-audiosystem-1.8+13.10.20130807/include/private/android_filesystem_config.h0000644000015700001700000002476612200324306030370 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* This file is used to define the properties of the filesystem ** images generated by build tools (mkbootfs and mkyaffs2image) and ** by the device side of adb. */ #ifndef _ANDROID_FILESYSTEM_CONFIG_H_ #define _ANDROID_FILESYSTEM_CONFIG_H_ #include #include #include /* This is the master Users and Groups config for the platform. ** DO NOT EVER RENUMBER. */ #define AID_ROOT 0 /* traditional unix root user */ #define AID_SYSTEM 1000 /* system server */ #define AID_RADIO 1001 /* telephony subsystem, RIL */ #define AID_BLUETOOTH 1002 /* bluetooth subsystem */ #define AID_GRAPHICS 1003 /* graphics devices */ #define AID_INPUT 1004 /* input devices */ #define AID_AUDIO 1005 /* audio devices */ #define AID_CAMERA 1006 /* camera devices */ #define AID_LOG 1007 /* log devices */ #define AID_COMPASS 1008 /* compass device */ #define AID_MOUNT 1009 /* mountd socket */ #define AID_WIFI 1010 /* wifi subsystem */ #define AID_ADB 1011 /* android debug bridge (adbd) */ #define AID_INSTALL 1012 /* group for installing packages */ #define AID_MEDIA 1013 /* mediaserver process */ #define AID_DHCP 1014 /* dhcp client */ #define AID_SDCARD_RW 1015 /* external storage write access */ #define AID_VPN 1016 /* vpn system */ #define AID_KEYSTORE 1017 /* keystore subsystem */ #define AID_USB 1018 /* USB devices */ #define AID_DRM 1019 /* DRM server */ #define AID_AVAILABLE 1020 /* available for use */ #define AID_GPS 1021 /* GPS daemon */ #define AID_UNUSED1 1022 /* deprecated, DO NOT USE */ #define AID_MEDIA_RW 1023 /* internal media storage write access */ #define AID_MTP 1024 /* MTP USB driver access */ #define AID_UNUSED2 1025 /* deprecated, DO NOT USE */ #define AID_DRMRPC 1026 /* group for drm rpc */ #define AID_NFC 1027 /* nfc subsystem */ #define AID_SHELL 2000 /* adb and debug shell user */ #define AID_CACHE 2001 /* cache access */ #define AID_DIAG 2002 /* access to diagnostic resources */ /* The 3000 series are intended for use as supplemental group id's only. * They indicate special Android capabilities that the kernel is aware of. */ #define AID_NET_BT_ADMIN 3001 /* bluetooth: create any socket */ #define AID_NET_BT 3002 /* bluetooth: create sco, rfcomm or l2cap sockets */ #define AID_INET 3003 /* can create AF_INET and AF_INET6 sockets */ #define AID_NET_RAW 3004 /* can create raw INET sockets */ #define AID_NET_ADMIN 3005 /* can configure interfaces and routing tables. */ #define AID_NET_BW_STATS 3006 /* read bandwidth statistics */ #define AID_NET_BW_ACCT 3007 /* change bandwidth statistics accounting */ #define AID_MISC 9998 /* access to misc storage */ #define AID_NOBODY 9999 #define AID_APP 10000 /* first app user */ #if !defined(EXCLUDE_FS_CONFIG_STRUCTURES) struct android_id_info { const char *name; unsigned aid; }; static const struct android_id_info android_ids[] = { { "root", AID_ROOT, }, { "system", AID_SYSTEM, }, { "radio", AID_RADIO, }, { "bluetooth", AID_BLUETOOTH, }, { "graphics", AID_GRAPHICS, }, { "input", AID_INPUT, }, { "audio", AID_AUDIO, }, { "camera", AID_CAMERA, }, { "log", AID_LOG, }, { "compass", AID_COMPASS, }, { "mount", AID_MOUNT, }, { "wifi", AID_WIFI, }, { "dhcp", AID_DHCP, }, { "adb", AID_ADB, }, { "install", AID_INSTALL, }, { "media", AID_MEDIA, }, { "drm", AID_DRM, }, { "available", AID_AVAILABLE, }, { "nfc", AID_NFC, }, { "drmrpc", AID_DRMRPC, }, { "shell", AID_SHELL, }, { "cache", AID_CACHE, }, { "diag", AID_DIAG, }, { "net_bt_admin", AID_NET_BT_ADMIN, }, { "net_bt", AID_NET_BT, }, { "sdcard_rw", AID_SDCARD_RW, }, { "media_rw", AID_MEDIA_RW, }, { "vpn", AID_VPN, }, { "keystore", AID_KEYSTORE, }, { "usb", AID_USB, }, { "mtp", AID_MTP, }, { "gps", AID_GPS, }, { "inet", AID_INET, }, { "net_raw", AID_NET_RAW, }, { "net_admin", AID_NET_ADMIN, }, { "net_bw_stats", AID_NET_BW_STATS, }, { "net_bw_acct", AID_NET_BW_ACCT, }, { "misc", AID_MISC, }, { "nobody", AID_NOBODY, }, }; #define android_id_count \ (sizeof(android_ids) / sizeof(android_ids[0])) struct fs_path_config { unsigned mode; unsigned uid; unsigned gid; const char *prefix; }; /* Rules for directories. ** These rules are applied based on "first match", so they ** should start with the most specific path and work their ** way up to the root. */ static struct fs_path_config android_dirs[] = { { 00770, AID_SYSTEM, AID_CACHE, "cache" }, { 00771, AID_SYSTEM, AID_SYSTEM, "data/app" }, { 00771, AID_SYSTEM, AID_SYSTEM, "data/app-private" }, { 00771, AID_SYSTEM, AID_SYSTEM, "data/dalvik-cache" }, { 00771, AID_SYSTEM, AID_SYSTEM, "data/data" }, { 00771, AID_SHELL, AID_SHELL, "data/local/tmp" }, { 00771, AID_SHELL, AID_SHELL, "data/local" }, { 01771, AID_SYSTEM, AID_MISC, "data/misc" }, { 00770, AID_DHCP, AID_DHCP, "data/misc/dhcp" }, { 00775, AID_MEDIA_RW, AID_MEDIA_RW, "data/media" }, { 00775, AID_MEDIA_RW, AID_MEDIA_RW, "data/media/Music" }, { 00771, AID_SYSTEM, AID_SYSTEM, "data" }, { 00750, AID_ROOT, AID_SHELL, "sbin" }, { 00755, AID_ROOT, AID_SHELL, "system/bin" }, { 00755, AID_ROOT, AID_SHELL, "system/vendor" }, { 00755, AID_ROOT, AID_SHELL, "system/xbin" }, { 00755, AID_ROOT, AID_ROOT, "system/etc/ppp" }, { 00777, AID_ROOT, AID_ROOT, "sdcard" }, { 00755, AID_ROOT, AID_ROOT, 0 }, }; /* Rules for files. ** These rules are applied based on "first match", so they ** should start with the most specific path and work their ** way up to the root. Prefixes ending in * denotes wildcard ** and will allow partial matches. */ static struct fs_path_config android_files[] = { { 00440, AID_ROOT, AID_SHELL, "system/etc/init.goldfish.rc" }, { 00550, AID_ROOT, AID_SHELL, "system/etc/init.goldfish.sh" }, { 00440, AID_ROOT, AID_SHELL, "system/etc/init.trout.rc" }, { 00550, AID_ROOT, AID_SHELL, "system/etc/init.ril" }, { 00550, AID_ROOT, AID_SHELL, "system/etc/init.testmenu" }, { 00550, AID_DHCP, AID_SHELL, "system/etc/dhcpcd/dhcpcd-run-hooks" }, { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/dbus.conf" }, { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/bluetooth/main.conf" }, { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/bluetooth/input.conf" }, { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/bluetooth/audio.conf" }, { 00440, AID_BLUETOOTH, AID_BLUETOOTH, "system/etc/bluetooth/network.conf" }, { 00444, AID_NET_BT, AID_NET_BT, "system/etc/bluetooth/blacklist.conf" }, { 00640, AID_SYSTEM, AID_SYSTEM, "system/etc/bluetooth/auto_pairing.conf" }, { 00444, AID_RADIO, AID_AUDIO, "system/etc/AudioPara4.csv" }, { 00555, AID_ROOT, AID_ROOT, "system/etc/ppp/*" }, { 00555, AID_ROOT, AID_ROOT, "system/etc/rc.*" }, { 00644, AID_SYSTEM, AID_SYSTEM, "data/app/*" }, { 00644, AID_MEDIA_RW, AID_MEDIA_RW, "data/media/*" }, { 00644, AID_SYSTEM, AID_SYSTEM, "data/app-private/*" }, { 00644, AID_APP, AID_APP, "data/data/*" }, /* the following two files are INTENTIONALLY set-gid and not set-uid. * Do not change. */ { 02755, AID_ROOT, AID_NET_RAW, "system/bin/ping" }, { 02750, AID_ROOT, AID_INET, "system/bin/netcfg" }, /* the following five files are INTENTIONALLY set-uid, but they * are NOT included on user builds. */ { 06755, AID_ROOT, AID_ROOT, "system/xbin/su" }, { 06755, AID_ROOT, AID_ROOT, "system/xbin/librank" }, { 06755, AID_ROOT, AID_ROOT, "system/xbin/procrank" }, { 06755, AID_ROOT, AID_ROOT, "system/xbin/procmem" }, { 06755, AID_ROOT, AID_ROOT, "system/xbin/tcpdump" }, { 04770, AID_ROOT, AID_RADIO, "system/bin/pppd-ril" }, /* the following file is INTENTIONALLY set-uid, and IS included * in user builds. */ { 06750, AID_ROOT, AID_SHELL, "system/bin/run-as" }, { 00755, AID_ROOT, AID_SHELL, "system/bin/*" }, { 00755, AID_ROOT, AID_ROOT, "system/lib/valgrind/*" }, { 00755, AID_ROOT, AID_SHELL, "system/xbin/*" }, { 00755, AID_ROOT, AID_SHELL, "system/vendor/bin/*" }, { 00750, AID_ROOT, AID_SHELL, "sbin/*" }, { 00755, AID_ROOT, AID_ROOT, "bin/*" }, { 00750, AID_ROOT, AID_SHELL, "init*" }, { 00750, AID_ROOT, AID_SHELL, "charger*" }, { 00644, AID_ROOT, AID_ROOT, 0 }, }; static inline void fs_config(const char *path, int dir, unsigned *uid, unsigned *gid, unsigned *mode) { struct fs_path_config *pc; int plen; pc = dir ? android_dirs : android_files; plen = strlen(path); for(; pc->prefix; pc++){ int len = strlen(pc->prefix); if (dir) { if(plen < len) continue; if(!strncmp(pc->prefix, path, len)) break; continue; } /* If name ends in * then allow partial matches. */ if (pc->prefix[len -1] == '*') { if(!strncmp(pc->prefix, path, len - 1)) break; } else if (plen == len){ if(!strncmp(pc->prefix, path, len)) break; } } *uid = pc->uid; *gid = pc->gid; *mode = (*mode & (~07777)) | pc->mode; #if 0 fprintf(stderr,"< '%s' '%s' %d %d %o >\n", path, pc->prefix ? pc->prefix : "", *uid, *gid, *mode); #endif } #endif #endif android-audiosystem-1.8+13.10.20130807/include/private/README0000644000015700001700000000024512200324306023650 0ustar pbuserpbgroup00000000000000This folder contains private include files. These include files are part of the private implementation details of various framework components. Use at your peril. android-audiosystem-1.8+13.10.20130807/include/private/utils/0000755000015700001700000000000012200324404024126 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/private/utils/Static.h0000644000015700001700000000204712200324306025532 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // All static variables go here, to control initialization and // destruction order in the library. #include #include namespace android { // For TextStream.cpp extern Vector gTextBuffers; // For String8.cpp extern void initialize_string8(); extern void terminate_string8(); // For String16.cpp extern void initialize_string16(); extern void terminate_string16(); } // namespace android android-audiosystem-1.8+13.10.20130807/include/private/opengles/0000755000015700001700000000000012200324404024602 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/private/opengles/gl_context.h0000644000015700001700000004216412200324306027131 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_OPENGLES_CONTEXT_H #define ANDROID_OPENGLES_CONTEXT_H #include #include #include #include #ifdef HAVE_ANDROID_OS #include #endif #include #include #include #include namespace android { const unsigned int OGLES_NUM_COMPRESSED_TEXTURE_FORMATS = 10 #ifdef GL_OES_compressed_ETC1_RGB8_texture + 1 #endif ; class EGLTextureObject; class EGLSurfaceManager; class EGLBufferObjectManager; namespace gl { struct ogles_context_t; struct matrixx_t; struct transform_t; struct buffer_t; ogles_context_t* getGlContext(); template static inline void swap(T& a, T& b) { T t(a); a = b; b = t; } template inline T max(T a, T b) { return a inline T max(T a, T b, T c) { return max(a, max(b, c)); } template inline T min(T a, T b) { return a inline T min(T a, T b, T c) { return min(a, min(b, c)); } template inline T min(T a, T b, T c, T d) { return min(min(a,b), min(c,d)); } // ---------------------------------------------------------------------------- // vertices // ---------------------------------------------------------------------------- struct vec3_t { union { struct { GLfixed x, y, z; }; struct { GLfixed r, g, b; }; struct { GLfixed S, T, R; }; GLfixed v[3]; }; }; struct vec4_t { union { struct { GLfixed x, y, z, w; }; struct { GLfixed r, g, b, a; }; struct { GLfixed S, T, R, Q; }; GLfixed v[4]; }; }; struct vertex_t { enum { // these constant matter for our clipping CLIP_L = 0x0001, // clipping flags CLIP_R = 0x0002, CLIP_B = 0x0004, CLIP_T = 0x0008, CLIP_N = 0x0010, CLIP_F = 0x0020, EYE = 0x0040, RESERVED = 0x0080, USER_CLIP_0 = 0x0100, // user clipping flags USER_CLIP_1 = 0x0200, USER_CLIP_2 = 0x0400, USER_CLIP_3 = 0x0800, USER_CLIP_4 = 0x1000, USER_CLIP_5 = 0x2000, LIT = 0x4000, // lighting has been applied TT = 0x8000, // texture coords transformed FRUSTUM_CLIP_ALL= 0x003F, USER_CLIP_ALL = 0x3F00, CLIP_ALL = 0x3F3F, }; // the fields below are arranged to minimize d-cache usage // we group together, by cache-line, the fields most likely to be used union { vec4_t obj; vec4_t eye; }; vec4_t clip; uint32_t flags; size_t index; // cache tag, and vertex index GLfixed fog; uint8_t locked; uint8_t mru; uint8_t reserved[2]; vec4_t window; vec4_t color; vec4_t texture[GGL_TEXTURE_UNIT_COUNT]; uint32_t reserved1[4]; inline void clear() { flags = index = locked = mru = 0; } }; struct point_size_t { GGLcoord size; GLboolean smooth; }; struct line_width_t { GGLcoord width; GLboolean smooth; }; struct polygon_offset_t { GLfixed factor; GLfixed units; GLboolean enable; }; // ---------------------------------------------------------------------------- // arrays // ---------------------------------------------------------------------------- struct array_t { typedef void (*fetcher_t)(ogles_context_t*, GLfixed*, const GLvoid*); fetcher_t fetch; GLvoid const* physical_pointer; GLint size; GLsizei stride; GLvoid const* pointer; buffer_t const* bo; uint16_t type; GLboolean enable; GLboolean pad; GLsizei bounds; void init(GLint, GLenum, GLsizei, const GLvoid *, const buffer_t*, GLsizei); inline void resolve(); inline const GLubyte* element(GLint i) const { return (const GLubyte*)physical_pointer + i * stride; } }; struct array_machine_t { array_t vertex; array_t normal; array_t color; array_t texture[GGL_TEXTURE_UNIT_COUNT]; uint8_t activeTexture; uint8_t tmu; uint16_t cull; uint32_t flags; GLenum indicesType; buffer_t const* array_buffer; buffer_t const* element_array_buffer; void (*compileElements)(ogles_context_t*, vertex_t*, GLint, GLsizei); void (*compileElement)(ogles_context_t*, vertex_t*, GLint); void (*mvp_transform)(transform_t const*, vec4_t*, vec4_t const*); void (*mv_transform)(transform_t const*, vec4_t*, vec4_t const*); void (*tex_transform[2])(transform_t const*, vec4_t*, vec4_t const*); void (*perspective)(ogles_context_t*c, vertex_t* v); void (*clipVertex)(ogles_context_t* c, vertex_t* nv, GGLfixed t, const vertex_t* s, const vertex_t* p); void (*clipEye)(ogles_context_t* c, vertex_t* nv, GGLfixed t, const vertex_t* s, const vertex_t* p); }; struct vertex_cache_t { enum { // must be at least 4 // 3 vertice for triangles // or 2 + 2 for indexed triangles w/ cache contention VERTEX_BUFFER_SIZE = 8, // must be a power of two and at least 3 VERTEX_CACHE_SIZE = 64, // 8 KB INDEX_BITS = 16, INDEX_MASK = ((1LU<(pthread_getspecific(gGLKey)); } #endif struct prims_t { typedef ogles_context_t* GL; void (*renderPoint)(GL, vertex_t*); void (*renderLine)(GL, vertex_t*, vertex_t*); void (*renderTriangle)(GL, vertex_t*, vertex_t*, vertex_t*); }; struct ogles_context_t { context_t rasterizer; array_machine_t arrays __attribute__((aligned(32))); texture_state_t textures; transform_state_t transforms; vertex_cache_t vc; prims_t prims; culling_t cull; lighting_t lighting; user_clip_planes_t clipPlanes; compute_iterators_t lerp; __attribute__((aligned(32))); vertex_t current; vec4_t currentColorClamped; vec3_t currentNormal; viewport_t viewport; point_size_t point; line_width_t line; polygon_offset_t polygonOffset; fog_t fog; uint32_t perspective : 1; uint32_t transformTextures : 1; EGLSurfaceManager* surfaceManager; EGLBufferObjectManager* bufferObjectManager; GLenum error; static inline ogles_context_t* get() { return getGlThreadSpecific(); } }; }; // namespace gl }; // namespace android #endif // ANDROID_OPENGLES_CONTEXT_H android-audiosystem-1.8+13.10.20130807/include/private/media/0000755000015700001700000000000012200324404024045 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/private/media/AudioTrackShared.h0000644000015700001700000001567612200324306027413 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_TRACK_SHARED_H #define ANDROID_AUDIO_TRACK_SHARED_H #include #include #include "motthreads.h" namespace android { // ---------------------------------------------------------------------------- // Maximum cumulated timeout milliseconds before restarting audioflinger thread #define MAX_STARTUP_TIMEOUT_MS 3000 // Longer timeout period at startup to cope with A2DP init time #define MAX_RUN_TIMEOUT_MS 1000 #define WAIT_PERIOD_MS 10 #define RESTORE_TIMEOUT_MS 5000 // Maximum waiting time for a track to be restored #define CBLK_UNDERRUN_MSK 0x0001 #define CBLK_UNDERRUN_ON 0x0001 // underrun (out) or overrrun (in) indication #define CBLK_UNDERRUN_OFF 0x0000 // no underrun #define CBLK_DIRECTION_MSK 0x0002 #define CBLK_DIRECTION_OUT 0x0002 // this cblk is for an AudioTrack #define CBLK_DIRECTION_IN 0x0000 // this cblk is for an AudioRecord #define CBLK_FORCEREADY_MSK 0x0004 #define CBLK_FORCEREADY_ON 0x0004 // track is considered ready immediately by AudioFlinger #define CBLK_FORCEREADY_OFF 0x0000 // track is ready when buffer full #define CBLK_INVALID_MSK 0x0008 #define CBLK_INVALID_ON 0x0008 // track buffer is invalidated by AudioFlinger: #define CBLK_INVALID_OFF 0x0000 // must be re-created #define CBLK_DISABLED_MSK 0x0010 #define CBLK_DISABLED_ON 0x0010 // track disabled by AudioFlinger due to underrun: #define CBLK_DISABLED_OFF 0x0000 // must be re-started #define CBLK_RESTORING_MSK 0x0020 #define CBLK_RESTORING_ON 0x0020 // track is being restored after invalidation #define CBLK_RESTORING_OFF 0x0000 // by AudioFlinger #define CBLK_RESTORED_MSK 0x0040 #define CBLK_RESTORED_ON 0x0040 // track has been restored after invalidation #define CBLK_RESTORED_OFF 0x0040 // by AudioFlinger #define CBLK_FAST 0x0080 // AudioFlinger successfully created a fast track // Important: do not add any virtual methods, including ~ struct audio_track_cblk_t { // The data members are grouped so that members accessed frequently and in the same context // are in the same line of data cache. MotMutex lock; MotCondition cv; // next 4 are offsets within "buffers" volatile uint32_t user; volatile uint32_t server; uint32_t userBase; uint32_t serverBase; // if there is a shared buffer, "buffers" is the value of pointer() for the shared // buffer, otherwise "buffers" points immediately after the control block void* buffers; uint32_t frameCount; // Cache line boundary uint32_t loopStart; uint32_t loopEnd; // read-only for server, read/write for client int loopCount; // read/write for client // Channel volumes are fixed point U4.12, so 0x1000 means 1.0. // Left channel is in [0:15], right channel is in [16:31]. // Always read and write the combined pair atomically. // For AudioTrack only, not used by AudioRecord. private: uint32_t mVolumeLR; public: uint32_t sampleRate; // NOTE: audio_track_cblk_t::frameSize is not equal to AudioTrack::frameSize() for // 8 bit PCM data: in this case, mCblk->frameSize is based on a sample size of // 16 bit because data is converted to 16 bit before being stored in buffer // read-only for client, server writes once at initialization and is then read-only uint8_t frameSize; // would normally be size_t, but 8 bits is plenty uint8_t mName; // normal tracks: track name, fast tracks: track index // used by client only uint16_t bufferTimeoutMs; // Maximum cumulated timeout before restarting audioflinger uint16_t waitTimeMs; // Cumulated wait time, used by client only private: // client write-only, server read-only uint16_t mSendLevel; // Fixed point U4.12 so 0x1000 means 1.0 public: volatile int32_t flags; // Cache line boundary (32 bytes) // Since the control block is always located in shared memory, this constructor // is only used for placement new(). It is never used for regular new() or stack. audio_track_cblk_t(); uint32_t stepUser(uint32_t frameCount); // called by client only, where // client includes regular AudioTrack and AudioFlinger::PlaybackThread::OutputTrack bool stepServer(uint32_t frameCount); // called by server only void* buffer(uint32_t offset) const; uint32_t framesAvailable(); uint32_t framesAvailable_l(); uint32_t framesReady(); // called by server only bool tryLock(); // No barriers on the following operations, so the ordering of loads/stores // with respect to other parameters is UNPREDICTABLE. That's considered safe. // for AudioTrack client only, caller must limit to 0.0 <= sendLevel <= 1.0 void setSendLevel(float sendLevel) { mSendLevel = uint16_t(sendLevel * 0x1000); } // for AudioFlinger only; the return value must be validated by the caller uint16_t getSendLevel_U4_12() const { return mSendLevel; } // for AudioTrack client only, caller must limit to 0 <= volumeLR <= 0x10001000 void setVolumeLR(uint32_t volumeLR) { mVolumeLR = volumeLR; } // for AudioFlinger only; the return value must be validated by the caller uint32_t getVolumeLR() const { return mVolumeLR; } }; // ---------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_AUDIO_TRACK_SHARED_H android-audiosystem-1.8+13.10.20130807/include/private/media/motthreads.h0000755000015700001700000001173312200324306026401 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _MOTTHREADS_H #define _MOTTHREADS_H #include #include #include # include // ------------------------------------------------------------------ // C++ API #ifdef __cplusplus #include #include #include namespace android { /*****************************************************************************/ /* * Simple mutex class. The implementation is system-dependent. * * The mutex must be unlocked by the thread that locked it. They are not * recursive, i.e. the same thread can't lock it multiple times. */ class MotMutex { public: enum { PRIVATE = 0, SHARED = 1 }; MotMutex() {} MotMutex(const char* name) {} MotMutex(int type, const char* name = NULL) {} ~MotMutex() {} // lock or unlock the mutex status_t lock(); void unlock(); // lock if possible; returns 0 on success, error otherwise status_t tryLock(); // Manages the mutex automatically. It'll be locked when Autolock is // constructed and released when Autolock goes out of scope. class Autolock { public: inline Autolock(MotMutex& mutex) : mLock(mutex) { mLock.lock(); } inline Autolock(MotMutex* mutex) : mLock(*mutex) { mLock.lock(); } inline ~Autolock() { mLock.unlock(); } private: MotMutex& mLock; }; private: friend class MotCondition; // A mutex cannot be copied MotMutex(const MotMutex&); MotMutex& operator = (const MotMutex&); mot_pthread_mutex_t mMutex; }; inline status_t MotMutex::lock() { return -mot_pthread_mutex_lock(&mMutex); } inline void MotMutex::unlock() { mot_pthread_mutex_unlock(&mMutex); } inline status_t MotMutex::tryLock() { return -mot_pthread_mutex_trylock(&mMutex); } /* * Automatic mutex. Declare one of these at the top of a function. * When the function returns, it will go out of scope, and release the * mutex. */ typedef MotMutex::Autolock AutoMotMutex; /*****************************************************************************/ /* * Condition variable class. The implementation is system-dependent. * * Condition variables are paired up with mutexes. Lock the mutex, * call wait(), then either re-wait() if things aren't quite what you want, * or unlock the mutex and continue. All threads calling wait() must * use the same mutex for a given Condition. */ class MotCondition { public: enum { PRIVATE = 0, SHARED = 1 }; MotCondition() {} MotCondition(int type) {} ~MotCondition() {} // Wait on the condition variable. Lock the mutex before calling. status_t wait(MotMutex& mutex); // same with relative timeout status_t waitRelative(MotMutex& mutex, nsecs_t reltime); // Signal the condition variable, allowing one thread to continue. void signal(); // Signal the condition variable, allowing all threads to continue. void broadcast(); private: mot_pthread_cond_t mCond; }; inline status_t MotCondition::wait(MotMutex& mutex) { return -mot_pthread_cond_wait(&mCond, &mutex.mMutex); } inline status_t MotCondition::waitRelative(MotMutex& mutex, nsecs_t reltime) { #if defined(HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE) struct timespec ts; ts.tv_sec = reltime/1000000000; ts.tv_nsec = reltime%1000000000; return -mot_pthread_cond_timedwait_relative_np(&mCond, &mutex.mMutex, &ts); #else // HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE struct timespec ts; #if defined(HAVE_POSIX_CLOCKS) clock_gettime(CLOCK_REALTIME, &ts); #else // HAVE_POSIX_CLOCKS // we don't support the clocks here. struct timeval t; gettimeofday(&t, NULL); ts.tv_sec = t.tv_sec; ts.tv_nsec= t.tv_usec*1000; #endif // HAVE_POSIX_CLOCKS ts.tv_sec += reltime/1000000000; ts.tv_nsec+= reltime%1000000000; if (ts.tv_nsec >= 1000000000) { ts.tv_nsec -= 1000000000; ts.tv_sec += 1; } return -mot_pthread_cond_timedwait(&mCond, &mutex.mMutex, &ts); #endif // HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE return 0; } inline void MotCondition::signal() { mot_pthread_cond_signal(&mCond); } inline void MotCondition::broadcast() { mot_pthread_cond_broadcast(&mCond); } }; // namespace android #endif // __cplusplus #endif // _MOTTHREADS_H android-audiosystem-1.8+13.10.20130807/include/private/media/VideoFrame.h0000644000015700001700000000671612200324306026252 0ustar pbuserpbgroup00000000000000/* ** ** Copyright (C) 2008 The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #ifndef ANDROID_VIDEO_FRAME_H #define ANDROID_VIDEO_FRAME_H #include #include #include #include namespace android { // A simple buffer to hold binary data class MediaAlbumArt { public: MediaAlbumArt(): mSize(0), mData(0) {} explicit MediaAlbumArt(const char* url) { mSize = 0; mData = NULL; FILE *in = fopen(url, "r"); if (!in) { return; } fseek(in, 0, SEEK_END); mSize = ftell(in); // Allocating buffer of size equals to the external file size. if (mSize == 0 || (mData = new uint8_t[mSize]) == NULL) { fclose(in); if (mSize != 0) { mSize = 0; } return; } rewind(in); if (fread(mData, 1, mSize, in) != mSize) { // Read failed. delete[] mData; mData = NULL; mSize = 0; return; } fclose(in); } MediaAlbumArt(const MediaAlbumArt& copy) { mSize = copy.mSize; mData = NULL; // initialize it first if (mSize > 0 && copy.mData != NULL) { mData = new uint8_t[copy.mSize]; if (mData != NULL) { memcpy(mData, copy.mData, mSize); } else { mSize = 0; } } } ~MediaAlbumArt() { if (mData != 0) { delete[] mData; } } // Intentional public access modifier: // We have to know the internal structure in order to share it between // processes? uint32_t mSize; // Number of bytes in mData uint8_t* mData; // Actual binary data }; // Represents a color converted (RGB-based) video frame // with bitmap pixels stored in FrameBuffer class VideoFrame { public: VideoFrame(): mWidth(0), mHeight(0), mDisplayWidth(0), mDisplayHeight(0), mSize(0), mData(0) {} VideoFrame(const VideoFrame& copy) { mWidth = copy.mWidth; mHeight = copy.mHeight; mDisplayWidth = copy.mDisplayWidth; mDisplayHeight = copy.mDisplayHeight; mSize = copy.mSize; mData = NULL; // initialize it first if (mSize > 0 && copy.mData != NULL) { mData = new uint8_t[mSize]; if (mData != NULL) { memcpy(mData, copy.mData, mSize); } else { mSize = 0; } } } ~VideoFrame() { if (mData != 0) { delete[] mData; } } // Intentional public access modifier: uint32_t mWidth; uint32_t mHeight; uint32_t mDisplayWidth; uint32_t mDisplayHeight; uint32_t mSize; // Number of bytes in mData uint8_t* mData; // Actual binary data int32_t mRotationAngle; // rotation angle, clockwise }; }; // namespace android #endif // ANDROID_VIDEO_FRAME_H android-audiosystem-1.8+13.10.20130807/include/private/media/AudioEffectShared.h0000644000015700001700000000321412200324306027524 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_EFFECTCBASESHARED_H #define ANDROID_EFFECTCBASESHARED_H #include #include #include namespace android { // ---------------------------------------------------------------------------- // Size of buffer used to exchange parameters between application and mediaserver processes. #define EFFECT_PARAM_BUFFER_SIZE 1024 // Shared memory area used to exchange parameters between application and mediaserver // process. struct effect_param_cblk_t { Mutex lock; volatile uint32_t clientIndex; // Current read/write index for application volatile uint32_t serverIndex; // Current read/write index for mediaserver uint8_t* buffer; // start of parameter buffer effect_param_cblk_t() : lock(Mutex::SHARED), clientIndex(0), serverIndex(0) {} }; // ---------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_EFFECTCBASESHARED_H android-audiosystem-1.8+13.10.20130807/include/private/binder/0000755000015700001700000000000012200324404024231 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/private/binder/Static.h0000644000015700001700000000231212200324306025630 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // All static variables go here, to control initialization and // destruction order in the library. #include #include #include #include #include #include namespace android { // For ProcessState.cpp extern Mutex gProcessMutex; extern sp gProcess; // For ServiceManager.cpp extern Mutex gDefaultServiceManagerLock; extern sp gDefaultServiceManager; extern sp gPermissionController; } // namespace android android-audiosystem-1.8+13.10.20130807/include/private/binder/binder_module.h0000644000015700001700000000162112200324306027213 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _BINDER_MODULE_H_ #define _BINDER_MODULE_H_ #ifdef __cplusplus namespace android { #endif /* obtain structures and constants from the kernel header */ #include #include #ifdef __cplusplus } // namespace android #endif #endif // _BINDER_MODULE_H_ android-audiosystem-1.8+13.10.20130807/include/machine/0000755000015700001700000000000012200324404022720 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/machine/exec.h0000644000015700001700000000361712200324306024025 0ustar pbuserpbgroup00000000000000/* $OpenBSD: exec.h,v 1.9 2003/04/17 03:42:14 drahn Exp $ */ /* $NetBSD: exec.h,v 1.6 1994/10/27 04:16:05 cgd Exp $ */ /* * Copyright (c) 1993 Christopher G. Demetriou * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _ARM_EXEC_H_ #define _ARM_EXEC_H_ #define __LDPGSZ 4096 #define NATIVE_EXEC_ELF #define ARCH_ELFSIZE 32 #define ELF_TARG_CLASS ELFCLASS32 #define ELF_TARG_DATA ELFDATA2LSB #define ELF_TARG_MACH EM_ARM #define _NLIST_DO_AOUT #define _NLIST_DO_ELF #define _KERN_DO_AOUT #define _KERN_DO_ELF #endif /* _ARM_EXEC_H_ */ android-audiosystem-1.8+13.10.20130807/include/machine/_types.h0000644000015700001700000001000712200324306024373 0ustar pbuserpbgroup00000000000000/* $OpenBSD: _types.h,v 1.3 2006/02/14 18:12:58 miod Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)types.h 8.3 (Berkeley) 1/5/94 * @(#)ansi.h 8.2 (Berkeley) 1/4/94 */ #ifndef _ARM__TYPES_H_ #define _ARM__TYPES_H_ #if !defined(__ARM_EABI__) /* the kernel defines size_t as unsigned int, but g++ wants it to be unsigned long */ #define _SIZE_T #define _SSIZE_T #define _PTRDIFF_T typedef unsigned long size_t; typedef long ssize_t; typedef long ptrdiff_t; #endif /* 7.18.1.1 Exact-width integer types */ typedef __signed char __int8_t; typedef unsigned char __uint8_t; typedef short __int16_t; typedef unsigned short __uint16_t; typedef int __int32_t; typedef unsigned int __uint32_t; /* LONGLONG */ typedef long long __int64_t; /* LONGLONG */ typedef unsigned long long __uint64_t; /* 7.18.1.2 Minimum-width integer types */ typedef __int8_t __int_least8_t; typedef __uint8_t __uint_least8_t; typedef __int16_t __int_least16_t; typedef __uint16_t __uint_least16_t; typedef __int32_t __int_least32_t; typedef __uint32_t __uint_least32_t; typedef __int64_t __int_least64_t; typedef __uint64_t __uint_least64_t; /* 7.18.1.3 Fastest minimum-width integer types */ typedef __int32_t __int_fast8_t; typedef __uint32_t __uint_fast8_t; typedef __int32_t __int_fast16_t; typedef __uint32_t __uint_fast16_t; typedef __int32_t __int_fast32_t; typedef __uint32_t __uint_fast32_t; typedef __int64_t __int_fast64_t; typedef __uint64_t __uint_fast64_t; /* 7.18.1.4 Integer types capable of holding object pointers */ typedef int __intptr_t; typedef unsigned int __uintptr_t; /* 7.18.1.5 Greatest-width integer types */ typedef __int64_t __intmax_t; typedef __uint64_t __uintmax_t; /* Register size */ typedef __int32_t __register_t; /* VM system types */ typedef unsigned long __vaddr_t; typedef unsigned long __paddr_t; typedef unsigned long __vsize_t; typedef unsigned long __psize_t; /* Standard system types */ typedef int __clock_t; typedef int __clockid_t; typedef long __ptrdiff_t; typedef int __time_t; typedef int __timer_t; #if defined(__GNUC__) && __GNUC__ >= 3 typedef __builtin_va_list __va_list; #else typedef char * __va_list; #endif /* Wide character support types */ #ifndef __cplusplus typedef int __wchar_t; #endif typedef int __wint_t; typedef int __rune_t; typedef void * __wctrans_t; typedef void * __wctype_t; #ifdef __ARMEB__ #define _BYTE_ORDER _BIG_ENDIAN #else #define _BYTE_ORDER _LITTLE_ENDIAN #endif #endif /* _ARM__TYPES_H_ */ android-audiosystem-1.8+13.10.20130807/include/machine/ieee.h0000644000015700001700000001277112200324306024011 0ustar pbuserpbgroup00000000000000/* $OpenBSD: ieee.h,v 1.1 2004/02/01 05:09:49 drahn Exp $ */ /* $NetBSD: ieee.h,v 1.2 2001/02/21 17:43:50 bjh21 Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This software was developed by the Computer Systems Engineering group * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and * contributed to Berkeley. * * All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Lawrence Berkeley Laboratory. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)ieee.h 8.1 (Berkeley) 6/11/93 */ /* * ieee.h defines the machine-dependent layout of the machine's IEEE * floating point. */ /* * Define the number of bits in each fraction and exponent. * * k k+1 * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented * * (-exp_bias+1) * as fractions that look like 0.fffff x 2 . This means that * * -126 * the number 0.10000 x 2 , for instance, is the same as the normalized * * -127 -128 * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero * * -129 * in the fraction; to represent 2 , we need two, and so on. This * * (-exp_bias-fracbits+1) * implies that the smallest denormalized number is 2 * * for whichever format we are talking about: for single precision, for * * -126 -149 * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and * * -149 == -127 - 23 + 1. */ /* * The ARM has two sets of FP data formats. The FPA supports 32-bit, 64-bit * and 96-bit IEEE formats, with the words in big-endian order. VFP supports * 32-bin and 64-bit IEEE formats with the words in the CPU's native byte * order. * * The FPA also has two packed decimal formats, but we ignore them here. */ #define SNG_EXPBITS 8 #define SNG_FRACBITS 23 #define DBL_EXPBITS 11 #define DBL_FRACBITS 52 #ifndef __VFP_FP__ #define E80_EXPBITS 15 #define E80_FRACBITS 64 #define EXT_EXPBITS 15 #define EXT_FRACBITS 112 #endif struct ieee_single { u_int sng_frac:23; u_int sng_exponent:8; u_int sng_sign:1; }; #ifdef __VFP_FP__ struct ieee_double { #ifdef __ARMEB__ u_int dbl_sign:1; u_int dbl_exp:11; u_int dbl_frach:20; u_int dbl_fracl; #else /* !__ARMEB__ */ u_int dbl_fracl; u_int dbl_frach:20; u_int dbl_exp:11; u_int dbl_sign:1; #endif /* !__ARMEB__ */ }; #else /* !__VFP_FP__ */ struct ieee_double { u_int dbl_frach:20; u_int dbl_exp:11; u_int dbl_sign:1; u_int dbl_fracl; }; union ieee_double_u { double dblu_d; struct ieee_double dblu_dbl; }; struct ieee_e80 { u_int e80_exp:15; u_int e80_zero:16; u_int e80_sign:1; u_int e80_frach:31; u_int e80_j:1; u_int e80_fracl; }; struct ieee_ext { u_int ext_frach:16; u_int ext_exp:15; u_int ext_sign:1; u_int ext_frachm; u_int ext_fraclm; u_int ext_fracl; }; #endif /* !__VFP_FP__ */ /* * Floats whose exponent is in [1..INFNAN) (of whatever type) are * `normal'. Floats whose exponent is INFNAN are either Inf or NaN. * Floats whose exponent is zero are either zero (iff all fraction * bits are zero) or subnormal values. * * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its * high fraction; if the bit is set, it is a `quiet NaN'. */ #define SNG_EXP_INFNAN 255 #define DBL_EXP_INFNAN 2047 #ifndef __VFP_FP__ #define E80_EXP_INFNAN 32767 #define EXT_EXP_INFNAN 32767 #endif /* !__VFP_FP__ */ #if 0 #define SNG_QUIETNAN (1 << 22) #define DBL_QUIETNAN (1 << 19) #ifndef __VFP_FP__ #define E80_QUIETNAN (1 << 15) #define EXT_QUIETNAN (1 << 15) #endif /* !__VFP_FP__ */ #endif /* * Exponent biases. */ #define SNG_EXP_BIAS 127 #define DBL_EXP_BIAS 1023 #ifndef __VFP_FP__ #define E80_EXP_BIAS 16383 #define EXT_EXP_BIAS 16383 #endif /* !__VFP_FP__ */ android-audiosystem-1.8+13.10.20130807/include/machine/cdefs.h0000644000015700001700000000116612200324306024162 0ustar pbuserpbgroup00000000000000/* $OpenBSD: cdefs.h,v 1.2 2005/11/24 20:46:44 deraadt Exp $ */ #ifndef _MACHINE_CDEFS_H_ #define _MACHINE_CDEFS_H_ #if defined(lint) #define __indr_reference(sym,alias) __lint_equal__(sym,alias) #define __warn_references(sym,msg) #define __weak_alias(alias,sym) __lint_equal__(sym,alias) #elif defined(__GNUC__) && defined(__STDC__) #define __weak_alias(alias,sym) \ __asm__(".weak " __STRING(alias) " ; " __STRING(alias) \ " = " __STRING(sym)); #define __warn_references(sym,msg) \ __asm__(".section .gnu.warning." __STRING(sym) \ " ; .ascii \"" msg "\" ; .text"); #endif #endif /* !_MACHINE_CDEFS_H_ */ android-audiosystem-1.8+13.10.20130807/include/machine/kernel.h0000644000015700001700000000357312200324306024362 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _ARCH_ARM_KERNEL_H #define _ARCH_ARM_KERNEL_H /* this file contains kernel-specific definitions that were optimized out of our processed kernel headers, but still useful nonetheless... */ typedef unsigned long __kernel_blkcnt_t; typedef unsigned long __kernel_blksize_t; /* these aren't really defined by the kernel headers though... */ typedef unsigned long __kernel_fsblkcnt_t; typedef unsigned long __kernel_fsfilcnt_t; typedef unsigned int __kernel_id_t; #endif /* _ARCH_ARM_KERNEL_H */ android-audiosystem-1.8+13.10.20130807/include/machine/setjmp.h0000644000015700001700000000620312200324306024375 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /* * machine/setjmp.h: machine dependent setjmp-related information. */ /* _JBLEN is the size of a jmp_buf in longs. * Do not modify this value or you will break the ABI ! * * This value comes from the original OpenBSD ARM-specific header * that was replaced by this one. */ #define _JBLEN 64 /* According to the ARM AAPCS document, we only need to save * the following registers: * * Core r4-r14 * * VFP d8-d15 (see section 5.1.2.1) * * Registers s16-s31 (d8-d15, q4-q7) must be preserved across subroutine * calls; registers s0-s15 (d0-d7, q0-q3) do not need to be preserved * (and can be used for passing arguments or returning results in standard * procedure-call variants). Registers d16-d31 (q8-q15), if present, do * not need to be preserved. * * FPSCR saved because GLibc does saves it too. * */ /* The internal structure of a jmp_buf is totally private. * Current layout (may change in the future): * * word name description * 0 magic magic number * 1 sigmask signal mask (not used with _setjmp / _longjmp) * 2 float_base base of float registers (d8 to d15) * 18 float_state floating-point status and control register * 19 core_base base of core registers (r4 to r14) * 30 reserved reserved entries (room to grow) * 64 * * NOTE: float_base must be at an even word index, since the * FP registers will be loaded/stored with instructions * that expect 8-byte alignment. */ #define _JB_MAGIC 0 #define _JB_SIGMASK (_JB_MAGIC+1) #define _JB_FLOAT_BASE (_JB_SIGMASK+1) #define _JB_FLOAT_STATE (_JB_FLOAT_BASE + (15-8+1)*2) #define _JB_CORE_BASE (_JB_FLOAT_STATE+1) #define _JB_MAGIC__SETJMP 0x4278f500 #define _JB_MAGIC_SETJMP 0x4278f501 android-audiosystem-1.8+13.10.20130807/include/machine/limits.h0000644000015700001700000000500412200324306024372 0ustar pbuserpbgroup00000000000000/* $OpenBSD: limits.h,v 1.3 2006/01/06 22:48:46 millert Exp $ */ /* $NetBSD: limits.h,v 1.4 2003/04/28 23:16:18 bjh21 Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * from: @(#)limits.h 7.2 (Berkeley) 6/28/90 */ #ifndef _ARM32_LIMITS_H_ #define _ARM32_LIMITS_H_ #include #define MB_LEN_MAX 1 /* no multibyte characters */ #ifndef SIZE_MAX #define SIZE_MAX UINT_MAX /* max value for a size_t */ #endif #ifndef SSIZE_MAX #define SSIZE_MAX INT_MAX /* max value for a ssize_t */ #endif #if __BSD_VISIBLE #define SIZE_T_MAX UINT_MAX /* max value for a size_t (historic) */ #define UQUAD_MAX 0xffffffffffffffffULL /* max unsigned quad */ #define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */ #define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */ #endif /* __BSD_VISIBLE */ #define LONGLONG_BIT 64 #define LONGLONG_MIN (-9223372036854775807LL-1) #define LONGLONG_MAX 9223372036854775807LL #define ULONGLONG_MAX 18446744073709551615ULL #endif /* _ARM32_LIMITS_H_ */ android-audiosystem-1.8+13.10.20130807/include/machine/cpu-features.h0000644000015700001700000001361712200324306025505 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _ARM_MACHINE_CPU_FEATURES_H #define _ARM_MACHINE_CPU_FEATURES_H /* The purpose of this file is to define several macros corresponding * to CPU features that may or may not be available at build time on * on the target CPU. * * This is done to abstract us from the various ARM Architecture * quirks and alphabet soup. * * IMPORTANT: We have no intention to support anything below an ARMv4T ! */ /* __ARM_ARCH__ is a number corresponding to the ARM revision * we're going to support * * it looks like our toolchain doesn't define __ARM_ARCH__ * so try to guess it. * * * */ #ifndef __ARM_ARCH__ # if defined __ARM_ARCH_7__ || defined __ARM_ARCH_7A__ || \ defined __ARM_ARCH_7R__ || defined __ARM_ARCH_7M__ # define __ARM_ARCH__ 7 # elif defined __ARM_ARCH_6__ || defined __ARM_ARCH_6J__ || \ defined __ARM_ARCH_6K__ || defined __ARM_ARCH_6Z__ || \ defined __ARM_ARCH_6KZ__ || defined __ARM_ARCH_6T2__ # # define __ARM_ARCH__ 6 # # elif defined __ARM_ARCH_5__ || defined __ARM_ARCH_5T__ || \ defined __ARM_ARCH_5TE__ || defined __ARM_ARCH_5TEJ__ # # define __ARM_ARCH__ 5 # # elif defined __ARM_ARCH_4T__ # # define __ARM_ARCH__ 4 # # elif defined __ARM_ARCH_4__ # error ARMv4 is not supported, please use ARMv4T at a minimum # else # error Unknown or unsupported ARM architecture # endif #endif /* experimental feature used to check that our ARMv4 workarounds * work correctly without a real ARMv4 machine */ #ifdef BIONIC_EXPERIMENTAL_FORCE_ARMV4 # undef __ARM_ARCH__ # define __ARM_ARCH__ 4 #endif /* define __ARM_HAVE_5TE if we have the ARMv5TE instructions */ #if __ARM_ARCH__ > 5 # define __ARM_HAVE_5TE 1 #elif __ARM_ARCH__ == 5 # if defined __ARM_ARCH_5TE__ || defined __ARM_ARCH_5TEJ__ # define __ARM_HAVE_5TE 1 # endif #endif /* instructions introduced in ARMv5 */ #if __ARM_ARCH__ >= 5 # define __ARM_HAVE_BLX 1 # define __ARM_HAVE_CLZ 1 # define __ARM_HAVE_LDC2 1 # define __ARM_HAVE_MCR2 1 # define __ARM_HAVE_MRC2 1 # define __ARM_HAVE_STC2 1 #endif /* ARMv5TE introduces a few instructions */ #if __ARM_HAVE_5TE # define __ARM_HAVE_PLD 1 # define __ARM_HAVE_MCRR 1 # define __ARM_HAVE_MRRC 1 #endif /* define __ARM_HAVE_HALFWORD_MULTIPLY when half-word multiply instructions * this means variants of: smul, smulw, smla, smlaw, smlal */ #if __ARM_HAVE_5TE # define __ARM_HAVE_HALFWORD_MULTIPLY 1 #endif /* define __ARM_HAVE_PAIR_LOAD_STORE when 64-bit memory loads and stored * into/from a pair of 32-bit registers is supported throuhg 'ldrd' and 'strd' */ #if __ARM_HAVE_5TE # define __ARM_HAVE_PAIR_LOAD_STORE 1 #endif /* define __ARM_HAVE_SATURATED_ARITHMETIC is you have the saturated integer * arithmetic instructions: qdd, qdadd, qsub, qdsub */ #if __ARM_HAVE_5TE # define __ARM_HAVE_SATURATED_ARITHMETIC 1 #endif /* define __ARM_HAVE_PC_INTERWORK when a direct assignment to the * pc register will switch into thumb/ARM mode depending on bit 0 * of the new instruction address. Before ARMv5, this was not the * case, and you have to write: * * mov r0, [] * bx r0 * * instead of: * * ldr pc, [] * * note that this affects any instruction that explicitly changes the * value of the pc register, including ldm { ...,pc } or 'add pc, #offset' */ #if __ARM_ARCH__ >= 5 # define __ARM_HAVE_PC_INTERWORK #endif /* define __ARM_HAVE_LDREX_STREX for ARMv6 and ARMv7 architecture to be * used in replacement of deprecated swp instruction */ #if __ARM_ARCH__ >= 6 # define __ARM_HAVE_LDREX_STREX #endif /* define __ARM_HAVE_DMB for ARMv7 architecture */ #if __ARM_ARCH__ >= 7 # define __ARM_HAVE_DMB #endif /* define __ARM_HAVE_LDREXD for ARMv7 architecture * (also present in ARMv6K, but not implemented in ARMv7-M, neither of which * we care about) */ #if __ARM_ARCH__ >= 7 # define __ARM_HAVE_LDREXD #endif /* define _ARM_HAVE_VFP if we have VFPv3 */ #if __ARM_ARCH__ >= 7 && defined __VFP_FP__ # define __ARM_HAVE_VFP #endif /* define _ARM_HAVE_NEON for ARMv7 architecture if we support the * Neon SIMD instruction set extensions. This also implies * that VFPv3-D32 is supported. */ #if __ARM_ARCH__ >= 7 && defined __ARM_NEON__ # define __ARM_HAVE_NEON #endif /* Assembly-only macros */ #ifdef __ASSEMBLY__ /* define a handy PLD(address) macro since the cache preload * is an optional opcode */ #if __ARM_HAVE_PLD # define PLD(reg,offset) pld [reg, offset] #else # define PLD(reg,offset) /* nothing */ #endif #endif /* ! __ASSEMBLY__ */ #endif /* _ARM_MACHINE_CPU_FEATURES_H */ android-audiosystem-1.8+13.10.20130807/include/machine/internal_types.h0000644000015700001700000000034712200324306026136 0ustar pbuserpbgroup00000000000000/* $OpenBSD: internal_types.h,v 1.2 2004/05/06 15:53:39 drahn Exp $ */ /* Public domain */ #ifndef _ARM_INTERNAL_TYPES_H_ #define _ARM_INTERNAL_TYPES_H_ #ifdef __CHAR_UNSIGNED__ #define __machine_has_unsigned_chars #endif #endif android-audiosystem-1.8+13.10.20130807/include/machine/asm.h0000644000015700001700000000765612200324306023670 0ustar pbuserpbgroup00000000000000/* $OpenBSD: asm.h,v 1.1 2004/02/01 05:09:49 drahn Exp $ */ /* $NetBSD: asm.h,v 1.4 2001/07/16 05:43:32 matt Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * William Jolitz. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * from: @(#)asm.h 5.5 (Berkeley) 5/7/91 */ #ifndef _ARM32_ASM_H_ #define _ARM32_ASM_H_ #ifdef __ELF__ # define _C_LABEL(x) x #else # ifdef __STDC__ # define _C_LABEL(x) _ ## x # else # define _C_LABEL(x) _/**/x # endif #endif #define _ASM_LABEL(x) x #ifdef __STDC__ # define __CONCAT(x,y) x ## y # define __STRING(x) #x #else # define __CONCAT(x,y) x/**/y # define __STRING(x) "x" #endif #ifndef _ALIGN_TEXT # define _ALIGN_TEXT .align 0 #endif /* * gas/arm uses @ as a single comment character and thus cannot be used here * Instead it recognised the # instead of an @ symbols in .type directives * We define a couple of macros so that assembly code will not be dependant * on one or the other. */ #define _ASM_TYPE_FUNCTION #function #define _ASM_TYPE_OBJECT #object #define _ENTRY(x) \ .text; _ALIGN_TEXT; .globl x; .type x,_ASM_TYPE_FUNCTION; x: .fnstart #define _ASM_SIZE(x) .size x, .-x; #define _END(x) \ .fnend; \ _ASM_SIZE(x) #ifdef GPROF # ifdef __ELF__ # define _PROF_PROLOGUE \ mov ip, lr; bl __mcount # else # define _PROF_PROLOGUE \ mov ip,lr; bl mcount # endif #else # define _PROF_PROLOGUE #endif #define ENTRY(y) _ENTRY(_C_LABEL(y)); _PROF_PROLOGUE #define ENTRY_NP(y) _ENTRY(_C_LABEL(y)) #define END(y) _END(_C_LABEL(y)) #define ASENTRY(y) _ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE #define ASENTRY_NP(y) _ENTRY(_ASM_LABEL(y)) #define ASEND(y) _END(_ASM_LABEL(y)) #define ASMSTR .asciz #if defined(__ELF__) && defined(PIC) #ifdef __STDC__ #define PIC_SYM(x,y) x ## ( ## y ## ) #else #define PIC_SYM(x,y) x/**/(/**/y/**/) #endif #else #define PIC_SYM(x,y) x #endif #ifdef __ELF__ #define RCSID(x) .section ".ident"; .asciz x #else #define RCSID(x) .text; .asciz x #endif #ifdef __ELF__ #define WEAK_ALIAS(alias,sym) \ .weak alias; \ alias = sym #endif #ifdef __STDC__ #define WARN_REFERENCES(sym,msg) \ .stabs msg ## ,30,0,0,0 ; \ .stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0 #elif defined(__ELF__) #define WARN_REFERENCES(sym,msg) \ .stabs msg,30,0,0,0 ; \ .stabs __STRING(sym),1,0,0,0 #else #define WARN_REFERENCES(sym,msg) \ .stabs msg,30,0,0,0 ; \ .stabs __STRING(_/**/sym),1,0,0,0 #endif /* __STDC__ */ #endif /* !_ARM_ASM_H_ */ android-audiosystem-1.8+13.10.20130807/include/unicode/0000755000015700001700000000000012200324404022742 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/unicode/ucnvsel.h0000644000015700001700000001372712200324306024605 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * * Copyright (C) 2008-2010, International Business Machines * Corporation, Google and others. All Rights Reserved. * ******************************************************************************* */ /* * Author : eldawy@google.com (Mohamed Eldawy) * ucnvsel.h * * Purpose: To generate a list of encodings capable of handling * a given Unicode text * * Started 09-April-2008 */ #ifndef __ICU_UCNV_SEL_H__ #define __ICU_UCNV_SEL_H__ #include "unicode/uset.h" #include "unicode/utypes.h" #include "unicode/utf16.h" #include "unicode/uenum.h" #include "unicode/ucnv.h" #include "unicode/localpointer.h" /** * \file * * A converter selector is built with a set of encoding/charset names * and given an input string returns the set of names of the * corresponding converters which can convert the string. * * A converter selector can be serialized into a buffer and reopened * from the serialized form. */ /** * @{ * The selector data structure */ struct UConverterSelector; typedef struct UConverterSelector UConverterSelector; /** @} */ /** * Open a selector. * If converterListSize is 0, build for all available converters. * If excludedCodePoints is NULL, don't exclude any code points. * * @param converterList a pointer to encoding names needed to be involved. * Can be NULL if converterListSize==0. * The list and the names will be cloned, and the caller * retains ownership of the original. * @param converterListSize number of encodings in above list. * If 0, builds a selector for all available converters. * @param excludedCodePoints a set of code points to be excluded from consideration. * That is, excluded code points in a string do not change * the selection result. (They might be handled by a callback.) * Use NULL to exclude nothing. * @param whichSet what converter set to use? Use this to determine whether * to consider only roundtrip mappings or also fallbacks. * @param status an in/out ICU UErrorCode * @return the new selector * * @stable ICU 4.2 */ U_STABLE UConverterSelector* U_EXPORT2 ucnvsel_open(const char* const* converterList, int32_t converterListSize, const USet* excludedCodePoints, const UConverterUnicodeSet whichSet, UErrorCode* status); /** * Closes a selector. * If any Enumerations were returned by ucnv_select*, they become invalid. * They can be closed before or after calling ucnv_closeSelector, * but should never be used after the selector is closed. * * @see ucnv_selectForString * @see ucnv_selectForUTF8 * * @param sel selector to close * * @stable ICU 4.2 */ U_STABLE void U_EXPORT2 ucnvsel_close(UConverterSelector *sel); #if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN /** * \class LocalUConverterSelectorPointer * "Smart pointer" class, closes a UConverterSelector via ucnvsel_close(). * For most methods see the LocalPointerBase base class. * * @see LocalPointerBase * @see LocalPointer * @stable ICU 4.4 */ U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterSelectorPointer, UConverterSelector, ucnvsel_close); U_NAMESPACE_END #endif /** * Open a selector from its serialized form. * The buffer must remain valid and unchanged for the lifetime of the selector. * This is much faster than creating a selector from scratch. * Using a serialized form from a different machine (endianness/charset) is supported. * * @param buffer pointer to the serialized form of a converter selector; * must be 32-bit-aligned * @param length the capacity of this buffer (can be equal to or larger than * the actual data length) * @param status an in/out ICU UErrorCode * @return the new selector * * @stable ICU 4.2 */ U_STABLE UConverterSelector* U_EXPORT2 ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* status); /** * Serialize a selector into a linear buffer. * The serialized form is portable to different machines. * * @param sel selector to consider * @param buffer pointer to 32-bit-aligned memory to be filled with the * serialized form of this converter selector * @param bufferCapacity the capacity of this buffer * @param status an in/out ICU UErrorCode * @return the required buffer capacity to hold serialize data (even if the call fails * with a U_BUFFER_OVERFLOW_ERROR, it will return the required capacity) * * @stable ICU 4.2 */ U_STABLE int32_t U_EXPORT2 ucnvsel_serialize(const UConverterSelector* sel, void* buffer, int32_t bufferCapacity, UErrorCode* status); /** * Select converters that can map all characters in a UTF-16 string, * ignoring the excluded code points. * * @param sel a selector * @param s UTF-16 string * @param length length of the string, or -1 if NUL-terminated * @param status an in/out ICU UErrorCode * @return an enumeration containing encoding names. * The returned encoding names and their order will be the same as * supplied when building the selector. * * @stable ICU 4.2 */ U_STABLE UEnumeration * U_EXPORT2 ucnvsel_selectForString(const UConverterSelector* sel, const UChar *s, int32_t length, UErrorCode *status); /** * Select converters that can map all characters in a UTF-8 string, * ignoring the excluded code points. * * @param sel a selector * @param s UTF-8 string * @param length length of the string, or -1 if NUL-terminated * @param status an in/out ICU UErrorCode * @return an enumeration containing encoding names. * The returned encoding names and their order will be the same as * supplied when building the selector. * * @stable ICU 4.2 */ U_STABLE UEnumeration * U_EXPORT2 ucnvsel_selectForUTF8(const UConverterSelector* sel, const char *s, int32_t length, UErrorCode *status); #endif /* __ICU_UCNV_SEL_H__ */ android-audiosystem-1.8+13.10.20130807/include/unicode/unimatch.h0000644000015700001700000001366712200324306024741 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2001-2005, International Business Machines Corporation and others. All Rights Reserved. ********************************************************************** * Date Name Description * 07/18/01 aliu Creation. ********************************************************************** */ #ifndef UNIMATCH_H #define UNIMATCH_H #include "unicode/utypes.h" /** * \file * \brief C++ API: Unicode Matcher */ U_NAMESPACE_BEGIN class Replaceable; class UnicodeString; class UnicodeSet; /** * Constants returned by UnicodeMatcher::matches() * indicating the degree of match. * @stable ICU 2.4 */ enum UMatchDegree { /** * Constant returned by matches() indicating a * mismatch between the text and this matcher. The text contains * a character which does not match, or the text does not contain * all desired characters for a non-incremental match. * @stable ICU 2.4 */ U_MISMATCH, /** * Constant returned by matches() indicating a * partial match between the text and this matcher. This value is * only returned for incremental match operations. All characters * of the text match, but more characters are required for a * complete match. Alternatively, for variable-length matchers, * all characters of the text match, and if more characters were * supplied at limit, they might also match. * @stable ICU 2.4 */ U_PARTIAL_MATCH, /** * Constant returned by matches() indicating a * complete match between the text and this matcher. For an * incremental variable-length match, this value is returned if * the given text matches, and it is known that additional * characters would not alter the extent of the match. * @stable ICU 2.4 */ U_MATCH }; /** * UnicodeMatcher defines a protocol for objects that can * match a range of characters in a Replaceable string. * @stable ICU 2.4 */ class U_COMMON_API UnicodeMatcher /* not : public UObject because this is an interface/mixin class */ { public: /** * Destructor. * @stable ICU 2.4 */ virtual ~UnicodeMatcher(); /** * Return a UMatchDegree value indicating the degree of match for * the given text at the given offset. Zero, one, or more * characters may be matched. * * Matching in the forward direction is indicated by limit > * offset. Characters from offset forwards to limit-1 will be * considered for matching. * * Matching in the reverse direction is indicated by limit < * offset. Characters from offset backwards to limit+1 will be * considered for matching. * * If limit == offset then the only match possible is a zero * character match (which subclasses may implement if desired). * * As a side effect, advance the offset parameter to the limit of * the matched substring. In the forward direction, this will be * the index of the last matched character plus one. In the * reverse direction, this will be the index of the last matched * character minus one. * *

Note: This method is not const because some classes may * modify their state as the result of a match. * * @param text the text to be matched * @param offset on input, the index into text at which to begin * matching. On output, the limit of the matched text. The * number of matched characters is the output value of offset * minus the input value. Offset should always point to the * HIGH SURROGATE (leading code unit) of a pair of surrogates, * both on entry and upon return. * @param limit the limit index of text to be matched. Greater * than offset for a forward direction match, less than offset for * a backward direction match. The last character to be * considered for matching will be text.charAt(limit-1) in the * forward direction or text.charAt(limit+1) in the backward * direction. * @param incremental if TRUE, then assume further characters may * be inserted at limit and check for partial matching. Otherwise * assume the text as given is complete. * @return a match degree value indicating a full match, a partial * match, or a mismatch. If incremental is FALSE then * U_PARTIAL_MATCH should never be returned. * @stable ICU 2.4 */ virtual UMatchDegree matches(const Replaceable& text, int32_t& offset, int32_t limit, UBool incremental) = 0; /** * Returns a string representation of this matcher. If the result of * calling this function is passed to the appropriate parser, it * will produce another matcher that is equal to this one. * @param result the string to receive the pattern. Previous * contents will be deleted. * @param escapeUnprintable if TRUE then convert unprintable * character to their hex escape representations, \\uxxxx or * \\Uxxxxxxxx. Unprintable characters are those other than * U+000A, U+0020..U+007E. * @stable ICU 2.4 */ virtual UnicodeString& toPattern(UnicodeString& result, UBool escapeUnprintable = FALSE) const = 0; /** * Returns TRUE if this matcher will match a character c, where c * & 0xFF == v, at offset, in the forward direction (with limit > * offset). This is used by RuleBasedTransliterator for * indexing. * @stable ICU 2.4 */ virtual UBool matchesIndexValue(uint8_t v) const = 0; /** * Union the set of all characters that may be matched by this object * into the given set. * @param toUnionTo the set into which to union the source characters * @stable ICU 2.4 */ virtual void addMatchSetTo(UnicodeSet& toUnionTo) const = 0; }; U_NAMESPACE_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/normalizer2.h0000644000015700001700000005176512200324306025376 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * * Copyright (C) 2009-2010, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: normalizer2.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2009nov22 * created by: Markus W. Scherer */ #ifndef __NORMALIZER2_H__ #define __NORMALIZER2_H__ /** * \file * \brief C++ API: New API for Unicode Normalization. */ #include "unicode/utypes.h" #if !UCONFIG_NO_NORMALIZATION #include "unicode/uniset.h" #include "unicode/unistr.h" #include "unicode/unorm2.h" U_NAMESPACE_BEGIN /** * Unicode normalization functionality for standard Unicode normalization or * for using custom mapping tables. * All instances of this class are unmodifiable/immutable. * Instances returned by getInstance() are singletons that must not be deleted by the caller. * The Normalizer2 class is not intended for public subclassing. * * The primary functions are to produce a normalized string and to detect whether * a string is already normalized. * The most commonly used normalization forms are those defined in * http://www.unicode.org/unicode/reports/tr15/ * However, this API supports additional normalization forms for specialized purposes. * For example, NFKC_Casefold is provided via getInstance("nfkc_cf", COMPOSE) * and can be used in implementations of UTS #46. * * Not only are the standard compose and decompose modes supplied, * but additional modes are provided as documented in the Mode enum. * * Some of the functions in this class identify normalization boundaries. * At a normalization boundary, the portions of the string * before it and starting from it do not interact and can be handled independently. * * The spanQuickCheckYes() stops at a normalization boundary. * When the goal is a normalized string, then the text before the boundary * can be copied, and the remainder can be processed with normalizeSecondAndAppend(). * * The hasBoundaryBefore(), hasBoundaryAfter() and isInert() functions test whether * a character is guaranteed to be at a normalization boundary, * regardless of context. * This is used for moving from one normalization boundary to the next * or preceding boundary, and for performing iterative normalization. * * Iterative normalization is useful when only a small portion of a * longer string needs to be processed. * For example, in ICU, iterative normalization is used by the NormalizationTransliterator * (to avoid replacing already-normalized text) and ucol_nextSortKeyPart() * (to process only the substring for which sort key bytes are computed). * * The set of normalization boundaries returned by these functions may not be * complete: There may be more boundaries that could be returned. * Different functions may return different boundaries. * @stable ICU 4.4 */ class U_COMMON_API Normalizer2 : public UObject { public: /** * Returns a Normalizer2 instance which uses the specified data file * (packageName/name similar to ucnv_openPackage() and ures_open()/ResourceBundle) * and which composes or decomposes text according to the specified mode. * Returns an unmodifiable singleton instance. Do not delete it. * * Use packageName=NULL for data files that are part of ICU's own data. * Use name="nfc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFC/NFD. * Use name="nfkc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFKC/NFKD. * Use name="nfkc_cf" and UNORM2_COMPOSE for Unicode standard NFKC_CF=NFKC_Casefold. * * @param packageName NULL for ICU built-in data, otherwise application data package name * @param name "nfc" or "nfkc" or "nfkc_cf" or name of custom data file * @param mode normalization mode (compose or decompose etc.) * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return the requested Normalizer2, if successful * @stable ICU 4.4 */ static const Normalizer2 * getInstance(const char *packageName, const char *name, UNormalization2Mode mode, UErrorCode &errorCode); /** * Returns the normalized form of the source string. * @param src source string * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return normalized src * @stable ICU 4.4 */ UnicodeString normalize(const UnicodeString &src, UErrorCode &errorCode) const { UnicodeString result; normalize(src, result, errorCode); return result; } /** * Writes the normalized form of the source string to the destination string * (replacing its contents) and returns the destination string. * The source and destination strings must be different objects. * @param src source string * @param dest destination string; its contents is replaced with normalized src * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return dest * @stable ICU 4.4 */ virtual UnicodeString & normalize(const UnicodeString &src, UnicodeString &dest, UErrorCode &errorCode) const = 0; /** * Appends the normalized form of the second string to the first string * (merging them at the boundary) and returns the first string. * The result is normalized if the first string was normalized. * The first and second strings must be different objects. * @param first string, should be normalized * @param second string, will be normalized * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return first * @stable ICU 4.4 */ virtual UnicodeString & normalizeSecondAndAppend(UnicodeString &first, const UnicodeString &second, UErrorCode &errorCode) const = 0; /** * Appends the second string to the first string * (merging them at the boundary) and returns the first string. * The result is normalized if both the strings were normalized. * The first and second strings must be different objects. * @param first string, should be normalized * @param second string, should be normalized * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return first * @stable ICU 4.4 */ virtual UnicodeString & append(UnicodeString &first, const UnicodeString &second, UErrorCode &errorCode) const = 0; /** * Gets the decomposition mapping of c. Equivalent to normalize(UnicodeString(c)) * on a UNORM2_DECOMPOSE Normalizer2 instance, but much faster. * This function is independent of the mode of the Normalizer2. * @param c code point * @param decomposition String object which will be set to c's * decomposition mapping, if there is one. * @return TRUE if c has a decomposition, otherwise FALSE * @draft ICU 4.6 */ virtual UBool getDecomposition(UChar32 c, UnicodeString &decomposition) const = 0; /** * Tests if the string is normalized. * Internally, in cases where the quickCheck() method would return "maybe" * (which is only possible for the two COMPOSE modes) this method * resolves to "yes" or "no" to provide a definitive result, * at the cost of doing more work in those cases. * @param s input string * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return TRUE if s is normalized * @stable ICU 4.4 */ virtual UBool isNormalized(const UnicodeString &s, UErrorCode &errorCode) const = 0; /** * Tests if the string is normalized. * For the two COMPOSE modes, the result could be "maybe" in cases that * would take a little more work to resolve definitively. * Use spanQuickCheckYes() and normalizeSecondAndAppend() for a faster * combination of quick check + normalization, to avoid * re-checking the "yes" prefix. * @param s input string * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return UNormalizationCheckResult * @stable ICU 4.4 */ virtual UNormalizationCheckResult quickCheck(const UnicodeString &s, UErrorCode &errorCode) const = 0; /** * Returns the end of the normalized substring of the input string. * In other words, with end=spanQuickCheckYes(s, ec); * the substring UnicodeString(s, 0, end) * will pass the quick check with a "yes" result. * * The returned end index is usually one or more characters before the * "no" or "maybe" character: The end index is at a normalization boundary. * (See the class documentation for more about normalization boundaries.) * * When the goal is a normalized string and most input strings are expected * to be normalized already, then call this method, * and if it returns a prefix shorter than the input string, * copy that prefix and use normalizeSecondAndAppend() for the remainder. * @param s input string * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return "yes" span end index * @stable ICU 4.4 */ virtual int32_t spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const = 0; /** * Tests if the character always has a normalization boundary before it, * regardless of context. * If true, then the character does not normalization-interact with * preceding characters. * In other words, a string containing this character can be normalized * by processing portions before this character and starting from this * character independently. * This is used for iterative normalization. See the class documentation for details. * @param c character to test * @return TRUE if c has a normalization boundary before it * @stable ICU 4.4 */ virtual UBool hasBoundaryBefore(UChar32 c) const = 0; /** * Tests if the character always has a normalization boundary after it, * regardless of context. * If true, then the character does not normalization-interact with * following characters. * In other words, a string containing this character can be normalized * by processing portions up to this character and after this * character independently. * This is used for iterative normalization. See the class documentation for details. * Note that this operation may be significantly slower than hasBoundaryBefore(). * @param c character to test * @return TRUE if c has a normalization boundary after it * @stable ICU 4.4 */ virtual UBool hasBoundaryAfter(UChar32 c) const = 0; /** * Tests if the character is normalization-inert. * If true, then the character does not change, nor normalization-interact with * preceding or following characters. * In other words, a string containing this character can be normalized * by processing portions before this character and after this * character independently. * This is used for iterative normalization. See the class documentation for details. * Note that this operation may be significantly slower than hasBoundaryBefore(). * @param c character to test * @return TRUE if c is normalization-inert * @stable ICU 4.4 */ virtual UBool isInert(UChar32 c) const = 0; private: // No ICU "poor man's RTTI" for this class nor its subclasses. virtual UClassID getDynamicClassID() const; }; /** * Normalization filtered by a UnicodeSet. * Normalizes portions of the text contained in the filter set and leaves * portions not contained in the filter set unchanged. * Filtering is done via UnicodeSet::span(..., USET_SPAN_SIMPLE). * Not-in-the-filter text is treated as "is normalized" and "quick check yes". * This class implements all of (and only) the Normalizer2 API. * An instance of this class is unmodifiable/immutable but is constructed and * must be destructed by the owner. * @stable ICU 4.4 */ class U_COMMON_API FilteredNormalizer2 : public Normalizer2 { public: /** * Constructs a filtered normalizer wrapping any Normalizer2 instance * and a filter set. * Both are aliased and must not be modified or deleted while this object * is used. * The filter set should be frozen; otherwise the performance will suffer greatly. * @param n2 wrapped Normalizer2 instance * @param filterSet UnicodeSet which determines the characters to be normalized * @stable ICU 4.4 */ FilteredNormalizer2(const Normalizer2 &n2, const UnicodeSet &filterSet) : norm2(n2), set(filterSet) {} /** * Writes the normalized form of the source string to the destination string * (replacing its contents) and returns the destination string. * The source and destination strings must be different objects. * @param src source string * @param dest destination string; its contents is replaced with normalized src * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return dest * @stable ICU 4.4 */ virtual UnicodeString & normalize(const UnicodeString &src, UnicodeString &dest, UErrorCode &errorCode) const; /** * Appends the normalized form of the second string to the first string * (merging them at the boundary) and returns the first string. * The result is normalized if the first string was normalized. * The first and second strings must be different objects. * @param first string, should be normalized * @param second string, will be normalized * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return first * @stable ICU 4.4 */ virtual UnicodeString & normalizeSecondAndAppend(UnicodeString &first, const UnicodeString &second, UErrorCode &errorCode) const; /** * Appends the second string to the first string * (merging them at the boundary) and returns the first string. * The result is normalized if both the strings were normalized. * The first and second strings must be different objects. * @param first string, should be normalized * @param second string, should be normalized * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return first * @stable ICU 4.4 */ virtual UnicodeString & append(UnicodeString &first, const UnicodeString &second, UErrorCode &errorCode) const; /** * Gets the decomposition mapping of c. Equivalent to normalize(UnicodeString(c)) * on a UNORM2_DECOMPOSE Normalizer2 instance, but much faster. * This function is independent of the mode of the Normalizer2. * @param c code point * @param decomposition String object which will be set to c's * decomposition mapping, if there is one. * @return TRUE if c has a decomposition, otherwise FALSE * @draft ICU 4.6 */ virtual UBool getDecomposition(UChar32 c, UnicodeString &decomposition) const; /** * Tests if the string is normalized. * For details see the Normalizer2 base class documentation. * @param s input string * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return TRUE if s is normalized * @stable ICU 4.4 */ virtual UBool isNormalized(const UnicodeString &s, UErrorCode &errorCode) const; /** * Tests if the string is normalized. * For details see the Normalizer2 base class documentation. * @param s input string * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return UNormalizationCheckResult * @stable ICU 4.4 */ virtual UNormalizationCheckResult quickCheck(const UnicodeString &s, UErrorCode &errorCode) const; /** * Returns the end of the normalized substring of the input string. * For details see the Normalizer2 base class documentation. * @param s input string * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return "yes" span end index * @stable ICU 4.4 */ virtual int32_t spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const; /** * Tests if the character always has a normalization boundary before it, * regardless of context. * For details see the Normalizer2 base class documentation. * @param c character to test * @return TRUE if c has a normalization boundary before it * @stable ICU 4.4 */ virtual UBool hasBoundaryBefore(UChar32 c) const; /** * Tests if the character always has a normalization boundary after it, * regardless of context. * For details see the Normalizer2 base class documentation. * @param c character to test * @return TRUE if c has a normalization boundary after it * @stable ICU 4.4 */ virtual UBool hasBoundaryAfter(UChar32 c) const; /** * Tests if the character is normalization-inert. * For details see the Normalizer2 base class documentation. * @param c character to test * @return TRUE if c is normalization-inert * @stable ICU 4.4 */ virtual UBool isInert(UChar32 c) const; private: UnicodeString & normalize(const UnicodeString &src, UnicodeString &dest, USetSpanCondition spanCondition, UErrorCode &errorCode) const; UnicodeString & normalizeSecondAndAppend(UnicodeString &first, const UnicodeString &second, UBool doNormalize, UErrorCode &errorCode) const; const Normalizer2 &norm2; const UnicodeSet &set; }; U_NAMESPACE_END #endif // !UCONFIG_NO_NORMALIZATION #endif // __NORMALIZER2_H__ android-audiosystem-1.8+13.10.20130807/include/unicode/urep.h0000644000015700001700000001242212200324306024070 0ustar pbuserpbgroup00000000000000/* ****************************************************************************** * Copyright (C) 1997-2010, International Business Machines * Corporation and others. All Rights Reserved. ****************************************************************************** * Date Name Description * 06/23/00 aliu Creation. ****************************************************************************** */ #ifndef __UREP_H #define __UREP_H #include "unicode/utypes.h" U_CDECL_BEGIN /******************************************************************** * General Notes ******************************************************************** * TODO * Add usage scenario * Add test code * Talk about pinning * Talk about "can truncate result if out of memory" */ /******************************************************************** * Data Structures ********************************************************************/ /** * \file * \brief C API: Callbacks for UReplaceable */ /** * An opaque replaceable text object. This will be manipulated only * through the caller-supplied UReplaceableFunctor struct. Related * to the C++ class Replaceable. * This is currently only used in the Transliterator C API, see utrans.h . * @stable ICU 2.0 */ typedef void* UReplaceable; /** * A set of function pointers that transliterators use to manipulate a * UReplaceable. The caller should supply the required functions to * manipulate their text appropriately. Related to the C++ class * Replaceable. * @stable ICU 2.0 */ typedef struct UReplaceableCallbacks { /** * Function pointer that returns the number of UChar code units in * this text. * * @param rep A pointer to "this" UReplaceable object. * @return The length of the text. * @stable ICU 2.0 */ int32_t (*length)(const UReplaceable* rep); /** * Function pointer that returns a UChar code units at the given * offset into this text; 0 <= offset < n, where n is the value * returned by (*length)(rep). See unistr.h for a description of * charAt() vs. char32At(). * * @param rep A pointer to "this" UReplaceable object. * @param offset The index at which to fetch the UChar (code unit). * @return The UChar (code unit) at offset, or U+FFFF if the offset is out of bounds. * @stable ICU 2.0 */ UChar (*charAt)(const UReplaceable* rep, int32_t offset); /** * Function pointer that returns a UChar32 code point at the given * offset into this text. See unistr.h for a description of * charAt() vs. char32At(). * * @param rep A pointer to "this" UReplaceable object. * @param offset The index at which to fetch the UChar32 (code point). * @return The UChar32 (code point) at offset, or U+FFFF if the offset is out of bounds. * @stable ICU 2.0 */ UChar32 (*char32At)(const UReplaceable* rep, int32_t offset); /** * Function pointer that replaces text between start and limit in * this text with the given text. Attributes (out of band info) * should be retained. * * @param rep A pointer to "this" UReplaceable object. * @param start the starting index of the text to be replaced, * inclusive. * @param limit the ending index of the text to be replaced, * exclusive. * @param text the new text to replace the UChars from * start..limit-1. * @param textLength the number of UChars at text, or -1 if text * is null-terminated. * @stable ICU 2.0 */ void (*replace)(UReplaceable* rep, int32_t start, int32_t limit, const UChar* text, int32_t textLength); /** * Function pointer that copies the characters in the range * [start, limit) into the array dst. * * @param rep A pointer to "this" UReplaceable object. * @param start offset of first character which will be copied * into the array * @param limit offset immediately following the last character to * be copied * @param dst array in which to copy characters. The length of * dst must be at least (limit - start). * @stable ICU 2.1 */ void (*extract)(UReplaceable* rep, int32_t start, int32_t limit, UChar* dst); /** * Function pointer that copies text between start and limit in * this text to another index in the text. Attributes (out of * band info) should be retained. After this call, there will be * (at least) two copies of the characters originally located at * start..limit-1. * * @param rep A pointer to "this" UReplaceable object. * @param start the starting index of the text to be copied, * inclusive. * @param limit the ending index of the text to be copied, * exclusive. * @param dest the index at which the copy of the UChars should be * inserted. * @stable ICU 2.0 */ void (*copy)(UReplaceable* rep, int32_t start, int32_t limit, int32_t dest); } UReplaceableCallbacks; U_CDECL_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/uscript.h0000644000015700001700000003501612200324306024612 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (C) 1997-2010, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * * File USCRIPT.H * * Modification History: * * Date Name Description * 07/06/2001 Ram Creation. ****************************************************************************** */ #ifndef USCRIPT_H #define USCRIPT_H #include "unicode/utypes.h" /** * \file * \brief C API: Unicode Script Information */ /** * Constants for ISO 15924 script codes. * * Many of these script codes - those from Unicode's ScriptNames.txt - * are character property values for Unicode's Script property. * See UAX #24 Script Names (http://www.unicode.org/reports/tr24/). * * Starting with ICU 3.6, constants for most ISO 15924 script codes * are included (currently excluding private-use codes Qaaa..Qabx). * For scripts for which there are codes in ISO 15924 but which are not * used in the Unicode Character Database (UCD), there are no Unicode characters * associated with those scripts. * * For example, there are no characters that have a UCD script code of * Hans or Hant. All Han ideographs have the Hani script code. * The Hans and Hant script codes are used with CLDR data. * * ISO 15924 script codes are included for use with CLDR and similar. * * @stable ICU 2.2 */ typedef enum UScriptCode { USCRIPT_INVALID_CODE = -1, USCRIPT_COMMON = 0, /* Zyyy */ USCRIPT_INHERITED = 1, /* Zinh */ /* "Code for inherited script", for non-spacing combining marks; also Qaai */ USCRIPT_ARABIC = 2, /* Arab */ USCRIPT_ARMENIAN = 3, /* Armn */ USCRIPT_BENGALI = 4, /* Beng */ USCRIPT_BOPOMOFO = 5, /* Bopo */ USCRIPT_CHEROKEE = 6, /* Cher */ USCRIPT_COPTIC = 7, /* Copt */ USCRIPT_CYRILLIC = 8, /* Cyrl */ USCRIPT_DESERET = 9, /* Dsrt */ USCRIPT_DEVANAGARI = 10, /* Deva */ USCRIPT_ETHIOPIC = 11, /* Ethi */ USCRIPT_GEORGIAN = 12, /* Geor */ USCRIPT_GOTHIC = 13, /* Goth */ USCRIPT_GREEK = 14, /* Grek */ USCRIPT_GUJARATI = 15, /* Gujr */ USCRIPT_GURMUKHI = 16, /* Guru */ USCRIPT_HAN = 17, /* Hani */ USCRIPT_HANGUL = 18, /* Hang */ USCRIPT_HEBREW = 19, /* Hebr */ USCRIPT_HIRAGANA = 20, /* Hira */ USCRIPT_KANNADA = 21, /* Knda */ USCRIPT_KATAKANA = 22, /* Kana */ USCRIPT_KHMER = 23, /* Khmr */ USCRIPT_LAO = 24, /* Laoo */ USCRIPT_LATIN = 25, /* Latn */ USCRIPT_MALAYALAM = 26, /* Mlym */ USCRIPT_MONGOLIAN = 27, /* Mong */ USCRIPT_MYANMAR = 28, /* Mymr */ USCRIPT_OGHAM = 29, /* Ogam */ USCRIPT_OLD_ITALIC = 30, /* Ital */ USCRIPT_ORIYA = 31, /* Orya */ USCRIPT_RUNIC = 32, /* Runr */ USCRIPT_SINHALA = 33, /* Sinh */ USCRIPT_SYRIAC = 34, /* Syrc */ USCRIPT_TAMIL = 35, /* Taml */ USCRIPT_TELUGU = 36, /* Telu */ USCRIPT_THAANA = 37, /* Thaa */ USCRIPT_THAI = 38, /* Thai */ USCRIPT_TIBETAN = 39, /* Tibt */ /** Canadian_Aboriginal script. @stable ICU 2.6 */ USCRIPT_CANADIAN_ABORIGINAL = 40, /* Cans */ /** Canadian_Aboriginal script (alias). @stable ICU 2.2 */ USCRIPT_UCAS = USCRIPT_CANADIAN_ABORIGINAL, USCRIPT_YI = 41, /* Yiii */ USCRIPT_TAGALOG = 42, /* Tglg */ USCRIPT_HANUNOO = 43, /* Hano */ USCRIPT_BUHID = 44, /* Buhd */ USCRIPT_TAGBANWA = 45, /* Tagb */ /* New scripts in Unicode 4 @stable ICU 2.6 */ USCRIPT_BRAILLE = 46, /* Brai */ USCRIPT_CYPRIOT = 47, /* Cprt */ USCRIPT_LIMBU = 48, /* Limb */ USCRIPT_LINEAR_B = 49, /* Linb */ USCRIPT_OSMANYA = 50, /* Osma */ USCRIPT_SHAVIAN = 51, /* Shaw */ USCRIPT_TAI_LE = 52, /* Tale */ USCRIPT_UGARITIC = 53, /* Ugar */ /** New script code in Unicode 4.0.1 @stable ICU 3.0 */ USCRIPT_KATAKANA_OR_HIRAGANA = 54,/*Hrkt */ /* New scripts in Unicode 4.1 @stable ICU 3.4 */ USCRIPT_BUGINESE = 55, /* Bugi */ USCRIPT_GLAGOLITIC = 56, /* Glag */ USCRIPT_KHAROSHTHI = 57, /* Khar */ USCRIPT_SYLOTI_NAGRI = 58, /* Sylo */ USCRIPT_NEW_TAI_LUE = 59, /* Talu */ USCRIPT_TIFINAGH = 60, /* Tfng */ USCRIPT_OLD_PERSIAN = 61, /* Xpeo */ /* New script codes from ISO 15924 @stable ICU 3.6 */ USCRIPT_BALINESE = 62, /* Bali */ USCRIPT_BATAK = 63, /* Batk */ USCRIPT_BLISSYMBOLS = 64, /* Blis */ USCRIPT_BRAHMI = 65, /* Brah */ USCRIPT_CHAM = 66, /* Cham */ USCRIPT_CIRTH = 67, /* Cirt */ USCRIPT_OLD_CHURCH_SLAVONIC_CYRILLIC = 68, /* Cyrs */ USCRIPT_DEMOTIC_EGYPTIAN = 69, /* Egyd */ USCRIPT_HIERATIC_EGYPTIAN = 70, /* Egyh */ USCRIPT_EGYPTIAN_HIEROGLYPHS = 71, /* Egyp */ USCRIPT_KHUTSURI = 72, /* Geok */ USCRIPT_SIMPLIFIED_HAN = 73, /* Hans */ USCRIPT_TRADITIONAL_HAN = 74, /* Hant */ USCRIPT_PAHAWH_HMONG = 75, /* Hmng */ USCRIPT_OLD_HUNGARIAN = 76, /* Hung */ USCRIPT_HARAPPAN_INDUS = 77, /* Inds */ USCRIPT_JAVANESE = 78, /* Java */ USCRIPT_KAYAH_LI = 79, /* Kali */ USCRIPT_LATIN_FRAKTUR = 80, /* Latf */ USCRIPT_LATIN_GAELIC = 81, /* Latg */ USCRIPT_LEPCHA = 82, /* Lepc */ USCRIPT_LINEAR_A = 83, /* Lina */ /** @stable ICU 4.6 */ USCRIPT_MANDAIC = 84, /* Mand */ /** @stable ICU 3.6 */ USCRIPT_MANDAEAN = USCRIPT_MANDAIC, USCRIPT_MAYAN_HIEROGLYPHS = 85, /* Maya */ /** @stable ICU 4.6 */ USCRIPT_MEROITIC_HIEROGLYPHS = 86, /* Mero */ /** @stable ICU 3.6 */ USCRIPT_MEROITIC = USCRIPT_MEROITIC_HIEROGLYPHS, USCRIPT_NKO = 87, /* Nkoo */ USCRIPT_ORKHON = 88, /* Orkh */ USCRIPT_OLD_PERMIC = 89, /* Perm */ USCRIPT_PHAGS_PA = 90, /* Phag */ USCRIPT_PHOENICIAN = 91, /* Phnx */ USCRIPT_PHONETIC_POLLARD = 92, /* Plrd */ USCRIPT_RONGORONGO = 93, /* Roro */ USCRIPT_SARATI = 94, /* Sara */ USCRIPT_ESTRANGELO_SYRIAC = 95, /* Syre */ USCRIPT_WESTERN_SYRIAC = 96, /* Syrj */ USCRIPT_EASTERN_SYRIAC = 97, /* Syrn */ USCRIPT_TENGWAR = 98, /* Teng */ USCRIPT_VAI = 99, /* Vaii */ USCRIPT_VISIBLE_SPEECH = 100,/* Visp */ USCRIPT_CUNEIFORM = 101,/* Xsux */ USCRIPT_UNWRITTEN_LANGUAGES = 102,/* Zxxx */ USCRIPT_UNKNOWN = 103,/* Zzzz */ /* Unknown="Code for uncoded script", for unassigned code points */ /* New script codes from ISO 15924 @stable ICU 3.8 */ USCRIPT_CARIAN = 104,/* Cari */ USCRIPT_JAPANESE = 105,/* Jpan */ USCRIPT_LANNA = 106,/* Lana */ USCRIPT_LYCIAN = 107,/* Lyci */ USCRIPT_LYDIAN = 108,/* Lydi */ USCRIPT_OL_CHIKI = 109,/* Olck */ USCRIPT_REJANG = 110,/* Rjng */ USCRIPT_SAURASHTRA = 111,/* Saur */ USCRIPT_SIGN_WRITING = 112,/* Sgnw */ USCRIPT_SUNDANESE = 113,/* Sund */ USCRIPT_MOON = 114,/* Moon */ USCRIPT_MEITEI_MAYEK = 115,/* Mtei */ /* New script codes from ISO 15924 @stable ICU 4.0 */ USCRIPT_IMPERIAL_ARAMAIC = 116,/* Armi */ USCRIPT_AVESTAN = 117,/* Avst */ USCRIPT_CHAKMA = 118,/* Cakm */ USCRIPT_KOREAN = 119,/* Kore */ USCRIPT_KAITHI = 120,/* Kthi */ USCRIPT_MANICHAEAN = 121,/* Mani */ USCRIPT_INSCRIPTIONAL_PAHLAVI = 122,/* Phli */ USCRIPT_PSALTER_PAHLAVI = 123,/* Phlp */ USCRIPT_BOOK_PAHLAVI = 124,/* Phlv */ USCRIPT_INSCRIPTIONAL_PARTHIAN = 125,/* Prti */ USCRIPT_SAMARITAN = 126,/* Samr */ USCRIPT_TAI_VIET = 127,/* Tavt */ USCRIPT_MATHEMATICAL_NOTATION = 128,/* Zmth */ USCRIPT_SYMBOLS = 129,/* Zsym */ /* New script codes from ISO 15924 @stable ICU 4.4 */ USCRIPT_BAMUM = 130,/* Bamu */ USCRIPT_LISU = 131,/* Lisu */ USCRIPT_NAKHI_GEBA = 132,/* Nkgb */ USCRIPT_OLD_SOUTH_ARABIAN = 133,/* Sarb */ /* New script codes from ISO 15924 @stable ICU 4.6 */ USCRIPT_BASSA_VAH = 134,/* Bass */ USCRIPT_DUPLOYAN_SHORTAND = 135,/* Dupl */ USCRIPT_ELBASAN = 136,/* Elba */ USCRIPT_GRANTHA = 137,/* Gran */ USCRIPT_KPELLE = 138,/* Kpel */ USCRIPT_LOMA = 139,/* Loma */ USCRIPT_MENDE = 140,/* Mend */ USCRIPT_MEROITIC_CURSIVE = 141,/* Merc */ USCRIPT_OLD_NORTH_ARABIAN = 142,/* Narb */ USCRIPT_NABATAEAN = 143,/* Nbat */ USCRIPT_PALMYRENE = 144,/* Palm */ USCRIPT_SINDHI = 145,/* Sind */ USCRIPT_WARANG_CITI = 146,/* Wara */ /* Private use codes from Qaaa - Qabx are not supported */ USCRIPT_CODE_LIMIT = 147 } UScriptCode; /** * Gets script codes associated with the given locale or ISO 15924 abbreviation or name. * Fills in USCRIPT_MALAYALAM given "Malayam" OR "Mlym". * Fills in USCRIPT_LATIN given "en" OR "en_US" * If required capacity is greater than capacity of the destination buffer then the error code * is set to U_BUFFER_OVERFLOW_ERROR and the required capacity is returned * *

Note: To search by short or long script alias only, use * u_getPropertyValueEnum(UCHAR_SCRIPT, alias) instead. This does * a fast lookup with no access of the locale data. * @param nameOrAbbrOrLocale name of the script, as given in * PropertyValueAliases.txt, or ISO 15924 code or locale * @param fillIn the UScriptCode buffer to fill in the script code * @param capacity the capacity (size) fo UScriptCode buffer passed in. * @param err the error status code. * @return The number of script codes filled in the buffer passed in * @stable ICU 2.4 */ U_STABLE int32_t U_EXPORT2 uscript_getCode(const char* nameOrAbbrOrLocale,UScriptCode* fillIn,int32_t capacity,UErrorCode *err); /** * Gets a script name associated with the given script code. * Returns "Malayam" given USCRIPT_MALAYALAM * @param scriptCode UScriptCode enum * @return script long name as given in * PropertyValueAliases.txt, or NULL if scriptCode is invalid * @stable ICU 2.4 */ U_STABLE const char* U_EXPORT2 uscript_getName(UScriptCode scriptCode); /** * Gets a script name associated with the given script code. * Returns "Mlym" given USCRIPT_MALAYALAM * @param scriptCode UScriptCode enum * @return script abbreviated name as given in * PropertyValueAliases.txt, or NULL if scriptCode is invalid * @stable ICU 2.4 */ U_STABLE const char* U_EXPORT2 uscript_getShortName(UScriptCode scriptCode); /** * Gets the script code associated with the given codepoint. * Returns USCRIPT_MALAYALAM given 0x0D02 * @param codepoint UChar32 codepoint * @param err the error status code. * @return The UScriptCode, or 0 if codepoint is invalid * @stable ICU 2.4 */ U_STABLE UScriptCode U_EXPORT2 uscript_getScript(UChar32 codepoint, UErrorCode *err); /** * Is code point c used in script sc? * That is, does code point c have the Script property value sc, * or do code point c's Script_Extensions include script code sc? * * Some characters are commonly used in multiple scripts. * For more information, see UAX #24: http://www.unicode.org/reports/tr24/. * * The Script_Extensions property is provisional. It may be modified or removed * in future versions of the Unicode Standard, and thus in ICU. * @param c code point * @param sc script code * @return TRUE if Script(c)==sc or sc is in Script_Extensions(c) * @draft ICU 4.6 */ U_DRAFT UBool U_EXPORT2 uscript_hasScript(UChar32 c, UScriptCode sc); /** * Writes code point c's Script_Extensions as a list of UScriptCode values * to the output scripts array. * * Some characters are commonly used in multiple scripts. * For more information, see UAX #24: http://www.unicode.org/reports/tr24/. * * If there are more than capacity script codes to be written, then * U_BUFFER_OVERFLOW_ERROR is set and the number of Script_Extensions is returned. * (Usual ICU buffer handling behavior.) * * The Script_Extensions property is provisional. It may be modified or removed * in future versions of the Unicode Standard, and thus in ICU. * @param c code point * @param scripts output script code array * @param capacity capacity of the scripts array * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return number of script codes in c's Script_Extensions, * written to scripts unless U_BUFFER_OVERFLOW_ERROR indicates insufficient capacity * @draft ICU 4.6 */ U_DRAFT int32_t U_EXPORT2 uscript_getScriptExtensions(UChar32 c, UScriptCode *scripts, int32_t capacity, UErrorCode *pErrorCode); #endif android-audiosystem-1.8+13.10.20130807/include/unicode/caniter.h0000644000015700001700000001634312200324306024550 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * Copyright (C) 1996-2010, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* */ #ifndef CANITER_H #define CANITER_H #include "unicode/utypes.h" #if !UCONFIG_NO_NORMALIZATION #include "unicode/uobject.h" #include "unicode/unistr.h" /** * \file * \brief C++ API: Canonical Iterator */ /** Should permutation skip characters with combining class zero * Should be either TRUE or FALSE. This is a compile time option * @stable ICU 2.4 */ #ifndef CANITER_SKIP_ZEROES #define CANITER_SKIP_ZEROES TRUE #endif U_NAMESPACE_BEGIN class Hashtable; class Normalizer2; class Normalizer2Impl; /** * This class allows one to iterate through all the strings that are canonically equivalent to a given * string. For example, here are some sample results: Results for: {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA} 1: \\u0041\\u030A\\u0064\\u0307\\u0327 = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA} 2: \\u0041\\u030A\\u0064\\u0327\\u0307 = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D}{COMBINING CEDILLA}{COMBINING DOT ABOVE} 3: \\u0041\\u030A\\u1E0B\\u0327 = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D WITH DOT ABOVE}{COMBINING CEDILLA} 4: \\u0041\\u030A\\u1E11\\u0307 = {LATIN CAPITAL LETTER A}{COMBINING RING ABOVE}{LATIN SMALL LETTER D WITH CEDILLA}{COMBINING DOT ABOVE} 5: \\u00C5\\u0064\\u0307\\u0327 = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA} 6: \\u00C5\\u0064\\u0327\\u0307 = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMBINING CEDILLA}{COMBINING DOT ABOVE} 7: \\u00C5\\u1E0B\\u0327 = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D WITH DOT ABOVE}{COMBINING CEDILLA} 8: \\u00C5\\u1E11\\u0307 = {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D WITH CEDILLA}{COMBINING DOT ABOVE} 9: \\u212B\\u0064\\u0307\\u0327 = {ANGSTROM SIGN}{LATIN SMALL LETTER D}{COMBINING DOT ABOVE}{COMBINING CEDILLA} 10: \\u212B\\u0064\\u0327\\u0307 = {ANGSTROM SIGN}{LATIN SMALL LETTER D}{COMBINING CEDILLA}{COMBINING DOT ABOVE} 11: \\u212B\\u1E0B\\u0327 = {ANGSTROM SIGN}{LATIN SMALL LETTER D WITH DOT ABOVE}{COMBINING CEDILLA} 12: \\u212B\\u1E11\\u0307 = {ANGSTROM SIGN}{LATIN SMALL LETTER D WITH CEDILLA}{COMBINING DOT ABOVE} *
Note: the code is intended for use with small strings, and is not suitable for larger ones, * since it has not been optimized for that situation. * Note, CanonicalIterator is not intended to be subclassed. * @author M. Davis * @author C++ port by V. Weinstein * @stable ICU 2.4 */ class U_COMMON_API CanonicalIterator : public UObject { public: /** * Construct a CanonicalIterator object * @param source string to get results for * @param status Fill-in parameter which receives the status of this operation. * @stable ICU 2.4 */ CanonicalIterator(const UnicodeString &source, UErrorCode &status); /** Destructor * Cleans pieces * @stable ICU 2.4 */ virtual ~CanonicalIterator(); /** * Gets the NFD form of the current source we are iterating over. * @return gets the source: NOTE: it is the NFD form of source * @stable ICU 2.4 */ UnicodeString getSource(); /** * Resets the iterator so that one can start again from the beginning. * @stable ICU 2.4 */ void reset(); /** * Get the next canonically equivalent string. *
Warning: The strings are not guaranteed to be in any particular order. * @return the next string that is canonically equivalent. A bogus string is returned when * the iteration is done. * @stable ICU 2.4 */ UnicodeString next(); /** * Set a new source for this iterator. Allows object reuse. * @param newSource the source string to iterate against. This allows the same iterator to be used * while changing the source string, saving object creation. * @param status Fill-in parameter which receives the status of this operation. * @stable ICU 2.4 */ void setSource(const UnicodeString &newSource, UErrorCode &status); /** * Dumb recursive implementation of permutation. * TODO: optimize * @param source the string to find permutations for * @param skipZeros determine if skip zeros * @param result the results in a set. * @param status Fill-in parameter which receives the status of this operation. * @internal */ static void U_EXPORT2 permute(UnicodeString &source, UBool skipZeros, Hashtable *result, UErrorCode &status); /** * ICU "poor man's RTTI", returns a UClassID for this class. * * @stable ICU 2.2 */ static UClassID U_EXPORT2 getStaticClassID(); /** * ICU "poor man's RTTI", returns a UClassID for the actual class. * * @stable ICU 2.2 */ virtual UClassID getDynamicClassID() const; private: // ===================== PRIVATES ============================== // private default constructor CanonicalIterator(); /** * Copy constructor. Private for now. * @internal */ CanonicalIterator(const CanonicalIterator& other); /** * Assignment operator. Private for now. * @internal */ CanonicalIterator& operator=(const CanonicalIterator& other); // fields UnicodeString source; UBool done; // 2 dimensional array holds the pieces of the string with // their different canonically equivalent representations UnicodeString **pieces; int32_t pieces_length; int32_t *pieces_lengths; // current is used in iterating to combine pieces int32_t *current; int32_t current_length; // transient fields UnicodeString buffer; const Normalizer2 &nfd; const Normalizer2Impl &nfcImpl; // we have a segment, in NFD. Find all the strings that are canonically equivalent to it. UnicodeString *getEquivalents(const UnicodeString &segment, int32_t &result_len, UErrorCode &status); //private String[] getEquivalents(String segment) //Set getEquivalents2(String segment); Hashtable *getEquivalents2(Hashtable *fillinResult, const UChar *segment, int32_t segLen, UErrorCode &status); //Hashtable *getEquivalents2(const UnicodeString &segment, int32_t segLen, UErrorCode &status); /** * See if the decomposition of cp2 is at segment starting at segmentPos * (with canonical rearrangment!) * If so, take the remainder, and return the equivalents */ //Set extract(int comp, String segment, int segmentPos, StringBuffer buffer); Hashtable *extract(Hashtable *fillinResult, UChar32 comp, const UChar *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status); //Hashtable *extract(UChar32 comp, const UnicodeString &segment, int32_t segLen, int32_t segmentPos, UErrorCode &status); void cleanPieces(); }; U_NAMESPACE_END #endif /* #if !UCONFIG_NO_NORMALIZATION */ #endif android-audiosystem-1.8+13.10.20130807/include/unicode/rbbi.h0000644000015700001700000006456112200324306024046 0ustar pbuserpbgroup00000000000000/* *************************************************************************** * Copyright (C) 1999-2008 International Business Machines Corporation * * and others. All rights reserved. * *************************************************************************** ********************************************************************** * Date Name Description * 10/22/99 alan Creation. * 11/11/99 rgillam Complete port from Java. ********************************************************************** */ #ifndef RBBI_H #define RBBI_H #include "unicode/utypes.h" /** * \file * \brief C++ API: Rule Based Break Iterator */ #if !UCONFIG_NO_BREAK_ITERATION #include "unicode/brkiter.h" #include "unicode/udata.h" #include "unicode/parseerr.h" #include "unicode/schriter.h" #include "unicode/uchriter.h" struct UTrie; U_NAMESPACE_BEGIN /** @internal */ struct RBBIDataHeader; class RuleBasedBreakIteratorTables; class BreakIterator; class RBBIDataWrapper; class UStack; class LanguageBreakEngine; class UnhandledEngine; struct RBBIStateTable; /** * * A subclass of BreakIterator whose behavior is specified using a list of rules. *

Instances of this class are most commonly created by the factory methods of * BreakIterator::createWordInstance(), BreakIterator::createLineInstance(), etc., * and then used via the abstract API in class BreakIterator

* *

See the ICU User Guide for information on Break Iterator Rules.

* *

This class is not intended to be subclassed. (Class DictionaryBasedBreakIterator * is a subclass, but that relationship is effectively internal to the ICU * implementation. The subclassing interface to RulesBasedBreakIterator is * not part of the ICU API, and may not remain stable.

* */ class U_COMMON_API RuleBasedBreakIterator : public BreakIterator { protected: /** * The UText through which this BreakIterator accesses the text * @internal */ UText *fText; /** * A character iterator that refers to the same text as the UText, above. * Only included for compatibility with old API, which was based on CharacterIterators. * Value may be adopted from outside, or one of fSCharIter or fDCharIter, below. */ CharacterIterator *fCharIter; /** * When the input text is provided by a UnicodeString, this will point to * a characterIterator that wraps that data. Needed only for the * implementation of getText(), a backwards compatibility issue. */ StringCharacterIterator *fSCharIter; /** * When the input text is provided by a UText, this * dummy CharacterIterator over an empty string will * be returned from getText() */ UCharCharacterIterator *fDCharIter; /** * The rule data for this BreakIterator instance * @internal */ RBBIDataWrapper *fData; /** Index of the Rule {tag} values for the most recent match. * @internal */ int32_t fLastRuleStatusIndex; /** * Rule tag value valid flag. * Some iterator operations don't intrinsically set the correct tag value. * This flag lets us lazily compute the value if we are ever asked for it. * @internal */ UBool fLastStatusIndexValid; /** * Counter for the number of characters encountered with the "dictionary" * flag set. * @internal */ uint32_t fDictionaryCharCount; /** * When a range of characters is divided up using the dictionary, the break * positions that are discovered are stored here, preventing us from having * to use either the dictionary or the state table again until the iterator * leaves this range of text. Has the most impact for line breaking. * @internal */ int32_t* fCachedBreakPositions; /** * The number of elements in fCachedBreakPositions * @internal */ int32_t fNumCachedBreakPositions; /** * if fCachedBreakPositions is not null, this indicates which item in the * cache the current iteration position refers to * @internal */ int32_t fPositionInCache; /** * * If present, UStack of LanguageBreakEngine objects that might handle * dictionary characters. Searched from top to bottom to find an object to * handle a given character. * @internal */ UStack *fLanguageBreakEngines; /** * * If present, the special LanguageBreakEngine used for handling * characters that are in the dictionary set, but not handled by any * LangugageBreakEngine. * @internal */ UnhandledEngine *fUnhandledBreakEngine; /** * * The type of the break iterator, or -1 if it has not been set. * @internal */ int32_t fBreakType; protected: //======================================================================= // constructors //======================================================================= /** * Constant to be used in the constructor * RuleBasedBreakIterator(RBBIDataHeader*, EDontAdopt, UErrorCode &); * which does not adopt the memory indicated by the RBBIDataHeader* * parameter. * * @internal */ enum EDontAdopt { kDontAdopt }; /** * Constructor from a flattened set of RBBI data in malloced memory. * RulesBasedBreakIterators built from a custom set of rules * are created via this constructor; the rules are compiled * into memory, then the break iterator is constructed here. * * The break iterator adopts the memory, and will * free it when done. * @internal */ RuleBasedBreakIterator(RBBIDataHeader* data, UErrorCode &status); /** * Constructor from a flattened set of RBBI data in memory which need not * be malloced (e.g. it may be a memory-mapped file, etc.). * * This version does not adopt the memory, and does not * free it when done. * @internal */ RuleBasedBreakIterator(const RBBIDataHeader* data, enum EDontAdopt dontAdopt, UErrorCode &status); friend class RBBIRuleBuilder; /** @internal */ friend class BreakIterator; public: /** Default constructor. Creates an empty shell of an iterator, with no * rules or text to iterate over. Object can subsequently be assigned to. * @stable ICU 2.2 */ RuleBasedBreakIterator(); /** * Copy constructor. Will produce a break iterator with the same behavior, * and which iterates over the same text, as the one passed in. * @param that The RuleBasedBreakIterator passed to be copied * @stable ICU 2.0 */ RuleBasedBreakIterator(const RuleBasedBreakIterator& that); /** * Construct a RuleBasedBreakIterator from a set of rules supplied as a string. * @param rules The break rules to be used. * @param parseError In the event of a syntax error in the rules, provides the location * within the rules of the problem. * @param status Information on any errors encountered. * @stable ICU 2.2 */ RuleBasedBreakIterator( const UnicodeString &rules, UParseError &parseError, UErrorCode &status); /** * This constructor uses the udata interface to create a BreakIterator * whose internal tables live in a memory-mapped file. "image" is an * ICU UDataMemory handle for the pre-compiled break iterator tables. * @param image handle to the memory image for the break iterator data. * Ownership of the UDataMemory handle passes to the Break Iterator, * which will be responsible for closing it when it is no longer needed. * @param status Information on any errors encountered. * @see udata_open * @see #getBinaryRules * @stable ICU 2.8 */ RuleBasedBreakIterator(UDataMemory* image, UErrorCode &status); /** * Destructor * @stable ICU 2.0 */ virtual ~RuleBasedBreakIterator(); /** * Assignment operator. Sets this iterator to have the same behavior, * and iterate over the same text, as the one passed in. * @param that The RuleBasedBreakItertor passed in * @return the newly created RuleBasedBreakIterator * @stable ICU 2.0 */ RuleBasedBreakIterator& operator=(const RuleBasedBreakIterator& that); /** * Equality operator. Returns TRUE if both BreakIterators are of the * same class, have the same behavior, and iterate over the same text. * @param that The BreakIterator to be compared for equality * @return TRUE if both BreakIterators are of the * same class, have the same behavior, and iterate over the same text. * @stable ICU 2.0 */ virtual UBool operator==(const BreakIterator& that) const; /** * Not-equal operator. If operator== returns TRUE, this returns FALSE, * and vice versa. * @param that The BreakIterator to be compared for inequality * @return TRUE if both BreakIterators are not same. * @stable ICU 2.0 */ UBool operator!=(const BreakIterator& that) const; /** * Returns a newly-constructed RuleBasedBreakIterator with the same * behavior, and iterating over the same text, as this one. * Differs from the copy constructor in that it is polymorphic, and * will correctly clone (copy) a derived class. * clone() is thread safe. Multiple threads may simultaeneously * clone the same source break iterator. * @return a newly-constructed RuleBasedBreakIterator * @stable ICU 2.0 */ virtual BreakIterator* clone() const; /** * Compute a hash code for this BreakIterator * @return A hash code * @stable ICU 2.0 */ virtual int32_t hashCode(void) const; /** * Returns the description used to create this iterator * @return the description used to create this iterator * @stable ICU 2.0 */ virtual const UnicodeString& getRules(void) const; //======================================================================= // BreakIterator overrides //======================================================================= /** *

* Return a CharacterIterator over the text being analyzed. * The returned character iterator is owned by the break iterator, and must * not be deleted by the caller. Repeated calls to this function may * return the same CharacterIterator. *

*

* The returned character iterator must not be used concurrently with * the break iterator. If concurrent operation is needed, clone the * returned character iterator first and operate on the clone. *

*

* When the break iterator is operating on text supplied via a UText, * this function will fail. Lacking any way to signal failures, it * returns an CharacterIterator containing no text. * The function getUText() provides similar functionality, * is reliable, and is more efficient. *

* * TODO: deprecate this function? * * @return An iterator over the text being analyzed. * @stable ICU 2.0 */ virtual CharacterIterator& getText(void) const; /** * Get a UText for the text being analyzed. * The returned UText is a shallow clone of the UText used internally * by the break iterator implementation. It can safely be used to * access the text without impacting any break iterator operations, * but the underlying text itself must not be altered. * * @param fillIn A UText to be filled in. If NULL, a new UText will be * allocated to hold the result. * @param status receives any error codes. * @return The current UText for this break iterator. If an input * UText was provided, it will always be returned. * @stable ICU 3.4 */ virtual UText *getUText(UText *fillIn, UErrorCode &status) const; /** * Set the iterator to analyze a new piece of text. This function resets * the current iteration position to the beginning of the text. * @param newText An iterator over the text to analyze. The BreakIterator * takes ownership of the character iterator. The caller MUST NOT delete it! * @stable ICU 2.0 */ virtual void adoptText(CharacterIterator* newText); /** * Set the iterator to analyze a new piece of text. This function resets * the current iteration position to the beginning of the text. * @param newText The text to analyze. * @stable ICU 2.0 */ virtual void setText(const UnicodeString& newText); /** * Reset the break iterator to operate over the text represented by * the UText. The iterator position is reset to the start. * * This function makes a shallow clone of the supplied UText. This means * that the caller is free to immediately close or otherwise reuse the * Utext that was passed as a parameter, but that the underlying text itself * must not be altered while being referenced by the break iterator. * * @param text The UText used to change the text. * @param status Receives any error codes. * @stable ICU 3.4 */ virtual void setText(UText *text, UErrorCode &status); /** * Sets the current iteration position to the beginning of the text. * @return The offset of the beginning of the text. * @stable ICU 2.0 */ virtual int32_t first(void); /** * Sets the current iteration position to the end of the text. * @return The text's past-the-end offset. * @stable ICU 2.0 */ virtual int32_t last(void); /** * Advances the iterator either forward or backward the specified number of steps. * Negative values move backward, and positive values move forward. This is * equivalent to repeatedly calling next() or previous(). * @param n The number of steps to move. The sign indicates the direction * (negative is backwards, and positive is forwards). * @return The character offset of the boundary position n boundaries away from * the current one. * @stable ICU 2.0 */ virtual int32_t next(int32_t n); /** * Advances the iterator to the next boundary position. * @return The position of the first boundary after this one. * @stable ICU 2.0 */ virtual int32_t next(void); /** * Moves the iterator backwards, to the last boundary preceding this one. * @return The position of the last boundary position preceding this one. * @stable ICU 2.0 */ virtual int32_t previous(void); /** * Sets the iterator to refer to the first boundary position following * the specified position. * @param offset The position from which to begin searching for a break position. * @return The position of the first break after the current position. * @stable ICU 2.0 */ virtual int32_t following(int32_t offset); /** * Sets the iterator to refer to the last boundary position before the * specified position. * @param offset The position to begin searching for a break from. * @return The position of the last boundary before the starting position. * @stable ICU 2.0 */ virtual int32_t preceding(int32_t offset); /** * Returns true if the specfied position is a boundary position. As a side * effect, leaves the iterator pointing to the first boundary position at * or after "offset". * @param offset the offset to check. * @return True if "offset" is a boundary position. * @stable ICU 2.0 */ virtual UBool isBoundary(int32_t offset); /** * Returns the current iteration position. * @return The current iteration position. * @stable ICU 2.0 */ virtual int32_t current(void) const; /** * Return the status tag from the break rule that determined the most recently * returned break position. For break rules that do not specify a * status, a default value of 0 is returned. If more than one break rule * would cause a boundary to be located at some position in the text, * the numerically largest of the applicable status values is returned. *

* Of the standard types of ICU break iterators, only word break and * line break provide status values. The values are defined in * the header file ubrk.h. For Word breaks, the status allows distinguishing between words * that contain alphabetic letters, "words" that appear to be numbers, * punctuation and spaces, words containing ideographic characters, and * more. For Line Break, the status distinguishes between hard (mandatory) breaks * and soft (potential) break positions. *

* getRuleStatus() can be called after obtaining a boundary * position from next(), previous(), or * any other break iterator functions that returns a boundary position. *

* When creating custom break rules, one is free to define whatever * status values may be convenient for the application. *

* Note: this function is not thread safe. It should not have been * declared const, and the const remains only for compatibility * reasons. (The function is logically const, but not bit-wise const). *

* @return the status from the break rule that determined the most recently * returned break position. * * @see UWordBreak * @stable ICU 2.2 */ virtual int32_t getRuleStatus() const; /** * Get the status (tag) values from the break rule(s) that determined the most * recently returned break position. *

* The returned status value(s) are stored into an array provided by the caller. * The values are stored in sorted (ascending) order. * If the capacity of the output array is insufficient to hold the data, * the output will be truncated to the available length, and a * U_BUFFER_OVERFLOW_ERROR will be signaled. * * @param fillInVec an array to be filled in with the status values. * @param capacity the length of the supplied vector. A length of zero causes * the function to return the number of status values, in the * normal way, without attemtping to store any values. * @param status receives error codes. * @return The number of rule status values from rules that determined * the most recent boundary returned by the break iterator. * In the event of a U_BUFFER_OVERFLOW_ERROR, the return value * is the total number of status values that were available, * not the reduced number that were actually returned. * @see getRuleStatus * @stable ICU 3.0 */ virtual int32_t getRuleStatusVec(int32_t *fillInVec, int32_t capacity, UErrorCode &status); /** * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. * This method is to implement a simple version of RTTI, since not all * C++ compilers support genuine RTTI. Polymorphic operator==() and * clone() methods call this method. * * @return The class ID for this object. All objects of a * given class have the same class ID. Objects of * other classes have different class IDs. * @stable ICU 2.0 */ virtual UClassID getDynamicClassID(void) const; /** * Returns the class ID for this class. This is useful only for * comparing to a return value from getDynamicClassID(). For example: * * Base* polymorphic_pointer = createPolymorphicObject(); * if (polymorphic_pointer->getDynamicClassID() == * Derived::getStaticClassID()) ... * * @return The class ID for all objects of this class. * @stable ICU 2.0 */ static UClassID U_EXPORT2 getStaticClassID(void); /* * Create a clone (copy) of this break iterator in memory provided * by the caller. The idea is to increase performance by avoiding * a storage allocation. Use of this functoin is NOT RECOMMENDED. * Performance gains are minimal, and correct buffer management is * tricky. Use clone() instead. * * @param stackBuffer The pointer to the memory into which the cloned object * should be placed. If NULL, allocate heap memory * for the cloned object. * @param BufferSize The size of the buffer. If zero, return the required * buffer size, but do not clone the object. If the * size was too small (but not zero), allocate heap * storage for the cloned object. * * @param status Error status. U_SAFECLONE_ALLOCATED_WARNING will be * returned if the the provided buffer was too small, and * the clone was therefore put on the heap. * * @return Pointer to the clone object. This may differ from the stackBuffer * address if the byte alignment of the stack buffer was not suitable * or if the stackBuffer was too small to hold the clone. * @stable ICU 2.0 */ virtual BreakIterator * createBufferClone(void *stackBuffer, int32_t &BufferSize, UErrorCode &status); /** * Return the binary form of compiled break rules, * which can then be used to create a new break iterator at some * time in the future. Creating a break iterator from pre-compiled rules * is much faster than building one from the source form of the * break rules. * * The binary data can only be used with the same version of ICU * and on the same platform type (processor endian-ness) * * @param length Returns the length of the binary data. (Out paramter.) * * @return A pointer to the binary (compiled) rule data. The storage * belongs to the RulesBasedBreakIterator object, not the * caller, and must not be modified or deleted. * @internal */ virtual const uint8_t *getBinaryRules(uint32_t &length); protected: //======================================================================= // implementation //======================================================================= /** * Dumps caches and performs other actions associated with a complete change * in text or iteration position. * @internal */ virtual void reset(void); #if 0 /** * Return true if the category lookup for this char * indicates that it is in the set of dictionary lookup chars. * This function is intended for use by dictionary based break iterators. * @return true if the category lookup for this char * indicates that it is in the set of dictionary lookup chars. * @internal */ virtual UBool isDictionaryChar(UChar32); /** * Get the type of the break iterator. * @internal */ virtual int32_t getBreakType() const; #endif /** * Set the type of the break iterator. * @internal */ virtual void setBreakType(int32_t type); /** * Common initialization function, used by constructors and bufferClone. * (Also used by DictionaryBasedBreakIterator::createBufferClone().) * @internal */ void init(); private: /** * This method backs the iterator back up to a "safe position" in the text. * This is a position that we know, without any context, must be a break position. * The various calling methods then iterate forward from this safe position to * the appropriate position to return. (For more information, see the description * of buildBackwardsStateTable() in RuleBasedBreakIterator.Builder.) * @param statetable state table used of moving backwards * @internal */ int32_t handlePrevious(const RBBIStateTable *statetable); /** * This method is the actual implementation of the next() method. All iteration * vectors through here. This method initializes the state machine to state 1 * and advances through the text character by character until we reach the end * of the text or the state machine transitions to state 0. We update our return * value every time the state machine passes through a possible end state. * @param statetable state table used of moving forwards * @internal */ int32_t handleNext(const RBBIStateTable *statetable); protected: /** * This is the function that actually implements dictionary-based * breaking. Covering at least the range from startPos to endPos, * it checks for dictionary characters, and if it finds them determines * the appropriate object to deal with them. It may cache found breaks in * fCachedBreakPositions as it goes. It may well also look at text outside * the range startPos to endPos. * If going forward, endPos is the normal Unicode break result, and * if goind in reverse, startPos is the normal Unicode break result * @param startPos The start position of a range of text * @param endPos The end position of a range of text * @param reverse The call is for the reverse direction * @internal */ int32_t checkDictionary(int32_t startPos, int32_t endPos, UBool reverse); private: /** * This function returns the appropriate LanguageBreakEngine for a * given character c. * @param c A character in the dictionary set * @internal */ const LanguageBreakEngine *getLanguageBreakEngine(UChar32 c); /** * @internal */ void makeRuleStatusValid(); }; //------------------------------------------------------------------------------ // // Inline Functions Definitions ... // //------------------------------------------------------------------------------ inline UBool RuleBasedBreakIterator::operator!=(const BreakIterator& that) const { return !operator==(that); } U_NAMESPACE_END #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ #endif android-audiosystem-1.8+13.10.20130807/include/unicode/uobslete.h0000644000015700001700000000153612200324306024743 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * Copyright (C) 2004-2010, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* * * file name: uobslete.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * Created by: genheaders.pl, a perl script written by Ram Viswanadha * * Contains data for commenting out APIs. * Gets included by umachine.h * * THIS FILE IS MACHINE-GENERATED, DON'T PLAY WITH IT IF YOU DON'T KNOW WHAT * YOU ARE DOING, OTHERWISE VERY BAD THINGS WILL HAPPEN! */ #ifndef UOBSLETE_H #define UOBSLETE_H #ifdef U_HIDE_OBSOLETE_API # if U_DISABLE_RENAMING # else # endif /* U_DISABLE_RENAMING */ #endif /* U_HIDE_OBSOLETE_API */ #endif /* UOBSLETE_H */ android-audiosystem-1.8+13.10.20130807/include/unicode/usprep.h0000644000015700001700000002002712200324306024433 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * * Copyright (C) 2003-2010, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: usprep.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2003jul2 * created by: Ram Viswanadha */ #ifndef __USPREP_H__ #define __USPREP_H__ /** * \file * \brief C API: Implements the StringPrep algorithm. */ #include "unicode/utypes.h" #include "unicode/localpointer.h" /** * * StringPrep API implements the StingPrep framework as described by RFC 3454. * StringPrep prepares Unicode strings for use in network protocols. * Profiles of StingPrep are set of rules and data according to with the * Unicode Strings are prepared. Each profiles contains tables which describe * how a code point should be treated. The tables are broadly classied into *

    *
  • Unassinged Table: Contains code points that are unassigned * in the Unicode Version supported by StringPrep. Currently * RFC 3454 supports Unicode 3.2.
  • *
  • Prohibited Table: Contains code points that are prohibted from * the output of the StringPrep processing function.
  • *
  • Mapping Table: Contains code ponts that are deleted from the output or case mapped.
  • *
* * The procedure for preparing Unicode strings: *
    *
  1. Map: For each character in the input, check if it has a mapping * and, if so, replace it with its mapping.
  2. *
  3. Normalize: Possibly normalize the result of step 1 using Unicode * normalization.
  4. *
  5. Prohibit: Check for any characters that are not allowed in the * output. If any are found, return an error.
  6. *
  7. Check bidi: Possibly check for right-to-left characters, and if * any are found, make sure that the whole string satisfies the * requirements for bidirectional strings. If the string does not * satisfy the requirements for bidirectional strings, return an * error.
  8. *
* @author Ram Viswanadha */ #if !UCONFIG_NO_IDNA #include "unicode/parseerr.h" /** * The StringPrep profile * @stable ICU 2.8 */ typedef struct UStringPrepProfile UStringPrepProfile; /** * Option to prohibit processing of unassigned code points in the input * * @see usprep_prepare * @stable ICU 2.8 */ #define USPREP_DEFAULT 0x0000 /** * Option to allow processing of unassigned code points in the input * * @see usprep_prepare * @stable ICU 2.8 */ #define USPREP_ALLOW_UNASSIGNED 0x0001 /** * enums for the standard stringprep profile types * supported by usprep_openByType. * @see usprep_openByType * @stable ICU 4.2 */ typedef enum UStringPrepProfileType { /** * RFC3491 Nameprep * @stable ICU 4.2 */ USPREP_RFC3491_NAMEPREP, /** * RFC3530 nfs4_cs_prep * @stable ICU 4.2 */ USPREP_RFC3530_NFS4_CS_PREP, /** * RFC3530 nfs4_cs_prep with case insensitive option * @stable ICU 4.2 */ USPREP_RFC3530_NFS4_CS_PREP_CI, /** * RFC3530 nfs4_cis_prep * @stable ICU 4.2 */ USPREP_RFC3530_NFS4_CIS_PREP, /** * RFC3530 nfs4_mixed_prep for prefix * @stable ICU 4.2 */ USPREP_RFC3530_NFS4_MIXED_PREP_PREFIX, /** * RFC3530 nfs4_mixed_prep for suffix * @stable ICU 4.2 */ USPREP_RFC3530_NFS4_MIXED_PREP_SUFFIX, /** * RFC3722 iSCSI * @stable ICU 4.2 */ USPREP_RFC3722_ISCSI, /** * RFC3920 XMPP Nodeprep * @stable ICU 4.2 */ USPREP_RFC3920_NODEPREP, /** * RFC3920 XMPP Resourceprep * @stable ICU 4.2 */ USPREP_RFC3920_RESOURCEPREP, /** * RFC4011 Policy MIB Stringprep * @stable ICU 4.2 */ USPREP_RFC4011_MIB, /** * RFC4013 SASLprep * @stable ICU 4.2 */ USPREP_RFC4013_SASLPREP, /** * RFC4505 trace * @stable ICU 4.2 */ USPREP_RFC4505_TRACE, /** * RFC4518 LDAP * @stable ICU 4.2 */ USPREP_RFC4518_LDAP, /** * RFC4518 LDAP for case ignore, numeric and stored prefix * matching rules * @stable ICU 4.2 */ USPREP_RFC4518_LDAP_CI } UStringPrepProfileType; /** * Creates a StringPrep profile from the data file. * * @param path string containing the full path pointing to the directory * where the profile reside followed by the package name * e.g. "/usr/resource/my_app/profiles/mydata" on a Unix system. * if NULL, ICU default data files will be used. * @param fileName name of the profile file to be opened * @param status ICU error code in/out parameter. Must not be NULL. * Must fulfill U_SUCCESS before the function call. * @return Pointer to UStringPrepProfile that is opened. Should be closed by * calling usprep_close() * @see usprep_close() * @stable ICU 2.8 */ U_STABLE UStringPrepProfile* U_EXPORT2 usprep_open(const char* path, const char* fileName, UErrorCode* status); /** * Creates a StringPrep profile for the specified profile type. * * @param type The profile type * @param status ICU error code in/out parameter. Must not be NULL. * Must fulfill U_SUCCESS before the function call. * @return Pointer to UStringPrepProfile that is opened. Should be closed by * calling usprep_close() * @see usprep_close() * @stable ICU 4.2 */ U_STABLE UStringPrepProfile* U_EXPORT2 usprep_openByType(UStringPrepProfileType type, UErrorCode* status); /** * Closes the profile * @param profile The profile to close * @stable ICU 2.8 */ U_STABLE void U_EXPORT2 usprep_close(UStringPrepProfile* profile); #if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN /** * \class LocalUStringPrepProfilePointer * "Smart pointer" class, closes a UStringPrepProfile via usprep_close(). * For most methods see the LocalPointerBase base class. * * @see LocalPointerBase * @see LocalPointer * @stable ICU 4.4 */ U_DEFINE_LOCAL_OPEN_POINTER(LocalUStringPrepProfilePointer, UStringPrepProfile, usprep_close); U_NAMESPACE_END #endif /** * Prepare the input buffer for use in applications with the given profile. This operation maps, normalizes(NFKC), * checks for prohited and BiDi characters in the order defined by RFC 3454 * depending on the options specified in the profile. * * @param prep The profile to use * @param src Pointer to UChar buffer containing the string to prepare * @param srcLength Number of characters in the source string * @param dest Pointer to the destination buffer to receive the output * @param destCapacity The capacity of destination array * @param options A bit set of options: * * - USPREP_NONE Prohibit processing of unassigned code points in the input * * - USPREP_ALLOW_UNASSIGNED Treat the unassigned code points are in the input * as normal Unicode code points. * * @param parseError Pointer to UParseError struct to receive information on position * of error if an error is encountered. Can be NULL. * @param status ICU in/out error code parameter. * U_INVALID_CHAR_FOUND if src contains * unmatched single surrogates. * U_INDEX_OUTOFBOUNDS_ERROR if src contains * too many code points. * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough * @return The number of UChars in the destination buffer * @stable ICU 2.8 */ U_STABLE int32_t U_EXPORT2 usprep_prepare( const UStringPrepProfile* prep, const UChar* src, int32_t srcLength, UChar* dest, int32_t destCapacity, int32_t options, UParseError* parseError, UErrorCode* status ); #endif /* #if !UCONFIG_NO_IDNA */ #endif android-audiosystem-1.8+13.10.20130807/include/unicode/unifunct.h0000644000015700001700000000757612200324306024766 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (c) 2002-2005, International Business Machines Corporation * and others. All Rights Reserved. ********************************************************************** * Date Name Description * 01/14/2002 aliu Creation. ********************************************************************** */ #ifndef UNIFUNCT_H #define UNIFUNCT_H #include "unicode/utypes.h" #include "unicode/uobject.h" /** * \file * \brief C++ API: Unicode Functor */ U_NAMESPACE_BEGIN class UnicodeMatcher; class UnicodeReplacer; class TransliterationRuleData; /** * UnicodeFunctor is an abstract base class for objects * that perform match and/or replace operations on Unicode strings. * @author Alan Liu * @stable ICU 2.4 */ class U_COMMON_API UnicodeFunctor : public UObject { public: /** * Destructor * @stable ICU 2.4 */ virtual ~UnicodeFunctor(); /** * Return a copy of this object. All UnicodeFunctor objects * have to support cloning in order to allow classes using * UnicodeFunctor to implement cloning. * @stable ICU 2.4 */ virtual UnicodeFunctor* clone() const = 0; /** * Cast 'this' to a UnicodeMatcher* pointer and return the * pointer, or null if this is not a UnicodeMatcher*. Subclasses * that mix in UnicodeMatcher as a base class must override this. * This protocol is required because a pointer to a UnicodeFunctor * cannot be cast to a pointer to a UnicodeMatcher, since * UnicodeMatcher is a mixin that does not derive from * UnicodeFunctor. * @stable ICU 2.4 */ virtual UnicodeMatcher* toMatcher() const; /** * Cast 'this' to a UnicodeReplacer* pointer and return the * pointer, or null if this is not a UnicodeReplacer*. Subclasses * that mix in UnicodeReplacer as a base class must override this. * This protocol is required because a pointer to a UnicodeFunctor * cannot be cast to a pointer to a UnicodeReplacer, since * UnicodeReplacer is a mixin that does not derive from * UnicodeFunctor. * @stable ICU 2.4 */ virtual UnicodeReplacer* toReplacer() const; /** * Return the class ID for this class. This is useful only for * comparing to a return value from getDynamicClassID(). * @return The class ID for all objects of this class. * @stable ICU 2.0 */ static UClassID U_EXPORT2 getStaticClassID(void); /** * Returns a unique class ID polymorphically. This method * is to implement a simple version of RTTI, since not all C++ * compilers support genuine RTTI. Polymorphic operator==() and * clone() methods call this method. * *

Concrete subclasses of UnicodeFunctor should use the macro * UOBJECT_DEFINE_RTTI_IMPLEMENTATION from uobject.h to * provide definitios getStaticClassID and getDynamicClassID. * * @return The class ID for this object. All objects of a given * class have the same class ID. Objects of other classes have * different class IDs. * @stable ICU 2.4 */ virtual UClassID getDynamicClassID(void) const = 0; /** * Set the data object associated with this functor. The data * object provides context for functor-to-standin mapping. This * method is required when assigning a functor to a different data * object. This function MAY GO AWAY later if the architecture is * changed to pass data object pointers through the API. * @internal ICU 2.1 */ virtual void setData(const TransliterationRuleData*) = 0; protected: /** * Since this class has pure virtual functions, * a constructor can't be used. * @stable ICU 2.0 */ /*UnicodeFunctor();*/ }; /*inline UnicodeFunctor::UnicodeFunctor() {}*/ U_NAMESPACE_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/locid.h0000644000015700001700000007430312200324306024215 0ustar pbuserpbgroup00000000000000/* ****************************************************************************** * * Copyright (C) 1996-2010, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * * File locid.h * * Created by: Helena Shih * * Modification History: * * Date Name Description * 02/11/97 aliu Changed gLocPath to fgLocPath and added methods to * get and set it. * 04/02/97 aliu Made operator!= inline; fixed return value of getName(). * 04/15/97 aliu Cleanup for AIX/Win32. * 04/24/97 aliu Numerous changes per code review. * 08/18/98 stephen Added tokenizeString(),changed getDisplayName() * 09/08/98 stephen Moved definition of kEmptyString for Mac Port * 11/09/99 weiv Added const char * getName() const; * 04/12/00 srl removing unicodestring api's and cached hash code * 08/10/01 grhoten Change the static Locales to accessor functions ****************************************************************************** */ #ifndef LOCID_H #define LOCID_H #include "unicode/utypes.h" #include "unicode/uobject.h" #include "unicode/unistr.h" #include "unicode/putil.h" #include "unicode/uloc.h" #include "unicode/strenum.h" /** * \file * \brief C++ API: Locale ID object. */ /** * A Locale object represents a specific geographical, political, * or cultural region. An operation that requires a Locale to perform * its task is called locale-sensitive and uses the Locale * to tailor information for the user. For example, displaying a number * is a locale-sensitive operation--the number should be formatted * according to the customs/conventions of the user's native country, * region, or culture. * * The Locale class is not suitable for subclassing. * *

* You can create a Locale object using the constructor in * this class: * \htmlonly

\endhtmlonly *
 *       Locale( const   char*  language,
 *               const   char*  country,
 *               const   char*  variant);
 * 
* \htmlonly
\endhtmlonly * The first argument to the constructors is a valid ISO * Language Code. These codes are the lower-case two-letter * codes as defined by ISO-639. * You can find a full list of these codes at: *
* http://www.loc.gov/standards/iso639-2/ * *

* The second argument to the constructors is a valid ISO Country * Code. These codes are the upper-case two-letter codes * as defined by ISO-3166. * You can find a full list of these codes at a number of sites, such as: *
* http://www.iso.org/iso/en/prods-services/iso3166ma/index.html * *

* The third constructor requires a third argument--the Variant. * The Variant codes are vendor and browser-specific. * For example, use REVISED for a langauge's revised script orthography, and POSIX for POSIX. * Where there are two variants, separate them with an underscore, and * put the most important one first. For * example, a Traditional Spanish collation might be referenced, with * "ES", "ES", "Traditional_POSIX". * *

* Because a Locale object is just an identifier for a region, * no validity check is performed when you construct a Locale. * If you want to see whether particular resources are available for the * Locale you construct, you must query those resources. For * example, ask the NumberFormat for the locales it supports * using its getAvailableLocales method. *
Note: When you ask for a resource for a particular * locale, you get back the best available match, not necessarily * precisely what you asked for. For more information, look at * ResourceBundle. * *

* The Locale class provides a number of convenient constants * that you can use to create Locale objects for commonly used * locales. For example, the following refers to a Locale object * for the United States: * \htmlonly

\endhtmlonly *
 *       Locale::getUS()
 * 
* \htmlonly
\endhtmlonly * *

* Once you've created a Locale you can query it for information about * itself. Use getCountry to get the ISO Country Code and * getLanguage to get the ISO Language Code. You can * use getDisplayCountry to get the * name of the country suitable for displaying to the user. Similarly, * you can use getDisplayLanguage to get the name of * the language suitable for displaying to the user. Interestingly, * the getDisplayXXX methods are themselves locale-sensitive * and have two versions: one that uses the default locale and one * that takes a locale as an argument and displays the name or country in * a language appropriate to that locale. * *

* ICU provides a number of classes that perform locale-sensitive * operations. For example, the NumberFormat class formats * numbers, currency, or percentages in a locale-sensitive manner. Classes * such as NumberFormat have a number of convenience methods * for creating a default object of that type. For example, the * NumberFormat class provides these three convenience methods * for creating a default NumberFormat object: * \htmlonly

\endhtmlonly *
 *     UErrorCode success = U_ZERO_ERROR;
 *     Locale myLocale;
 *     NumberFormat *nf;
 *
 *     nf = NumberFormat::createInstance( success );          delete nf;
 *     nf = NumberFormat::createCurrencyInstance( success );  delete nf;
 *     nf = NumberFormat::createPercentInstance( success );   delete nf;
 * 
* \htmlonly
\endhtmlonly * Each of these methods has two variants; one with an explicit locale * and one without; the latter using the default locale. * \htmlonly
\endhtmlonly *
 *     nf = NumberFormat::createInstance( myLocale, success );          delete nf;
 *     nf = NumberFormat::createCurrencyInstance( myLocale, success );  delete nf;
 *     nf = NumberFormat::createPercentInstance( myLocale, success );   delete nf;
 * 
* \htmlonly
\endhtmlonly * A Locale is the mechanism for identifying the kind of object * (NumberFormat) that you would like to get. The locale is * just a mechanism for identifying objects, * not a container for the objects themselves. * *

* Each class that performs locale-sensitive operations allows you * to get all the available objects of that type. You can sift * through these objects by language, country, or variant, * and use the display names to present a menu to the user. * For example, you can create a menu of all the collation objects * suitable for a given language. Such classes implement these * three class methods: * \htmlonly

\endhtmlonly *
 *       static Locale* getAvailableLocales(int32_t& numLocales)
 *       static UnicodeString& getDisplayName(const Locale&  objectLocale,
 *                                            const Locale&  displayLocale,
 *                                            UnicodeString& displayName)
 *       static UnicodeString& getDisplayName(const Locale&  objectLocale,
 *                                            UnicodeString& displayName)
 * 
* \htmlonly
\endhtmlonly * * @stable ICU 2.0 * @see ResourceBundle */ U_NAMESPACE_BEGIN class U_COMMON_API Locale : public UObject { public: /** Useful constant for the Root locale. @stable ICU 4.4 */ static const Locale &U_EXPORT2 getRoot(void); /** Useful constant for this language. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getEnglish(void); /** Useful constant for this language. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getFrench(void); /** Useful constant for this language. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getGerman(void); /** Useful constant for this language. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getItalian(void); /** Useful constant for this language. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getJapanese(void); /** Useful constant for this language. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getKorean(void); /** Useful constant for this language. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getChinese(void); /** Useful constant for this language. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getSimplifiedChinese(void); /** Useful constant for this language. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getTraditionalChinese(void); /** Useful constant for this country/region. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getFrance(void); /** Useful constant for this country/region. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getGermany(void); /** Useful constant for this country/region. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getItaly(void); /** Useful constant for this country/region. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getJapan(void); /** Useful constant for this country/region. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getKorea(void); /** Useful constant for this country/region. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getChina(void); /** Useful constant for this country/region. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getPRC(void); /** Useful constant for this country/region. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getTaiwan(void); /** Useful constant for this country/region. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getUK(void); /** Useful constant for this country/region. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getUS(void); /** Useful constant for this country/region. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getCanada(void); /** Useful constant for this country/region. @stable ICU 2.0 */ static const Locale &U_EXPORT2 getCanadaFrench(void); /** * Construct a default locale object, a Locale for the default locale ID. * * @see getDefault * @see uloc_getDefault * @stable ICU 2.0 */ Locale(); /** * Construct a locale from language, country, variant. * If an error occurs, then the constructed object will be "bogus" * (isBogus() will return TRUE). * * @param language Lowercase two-letter or three-letter ISO-639 code. * This parameter can instead be an ICU style C locale (e.g. "en_US"), * but the other parameters must not be used. * This parameter can be NULL; if so, * the locale is initialized to match the current default locale. * (This is the same as using the default constructor.) * Please note: The Java Locale class does NOT accept the form * 'new Locale("en_US")' but only 'new Locale("en","US")' * * @param country Uppercase two-letter ISO-3166 code. (optional) * @param variant Uppercase vendor and browser specific code. See class * description. (optional) * @param keywordsAndValues A string consisting of keyword/values pairs, such as * "collation=phonebook;currency=euro" * * @see getDefault * @see uloc_getDefault * @stable ICU 2.0 */ Locale( const char * language, const char * country = 0, const char * variant = 0, const char * keywordsAndValues = 0); /** * Initializes a Locale object from another Locale object. * * @param other The Locale object being copied in. * @stable ICU 2.0 */ Locale(const Locale& other); /** * Destructor * @stable ICU 2.0 */ virtual ~Locale() ; /** * Replaces the entire contents of *this with the specified value. * * @param other The Locale object being copied in. * @return *this * @stable ICU 2.0 */ Locale& operator=(const Locale& other); /** * Checks if two locale keys are the same. * * @param other The locale key object to be compared with this. * @return True if the two locale keys are the same, false otherwise. * @stable ICU 2.0 */ UBool operator==(const Locale& other) const; /** * Checks if two locale keys are not the same. * * @param other The locale key object to be compared with this. * @return True if the two locale keys are not the same, false * otherwise. * @stable ICU 2.0 */ UBool operator!=(const Locale& other) const; /** * Clone this object. * Clones can be used concurrently in multiple threads. * If an error occurs, then NULL is returned. * The caller must delete the clone. * * @return a clone of this object * * @see getDynamicClassID * @stable ICU 2.8 */ Locale *clone() const; /** * Common methods of getting the current default Locale. Used for the * presentation: menus, dialogs, etc. Generally set once when your applet or * application is initialized, then never reset. (If you do reset the * default locale, you probably want to reload your GUI, so that the change * is reflected in your interface.) * * More advanced programs will allow users to use different locales for * different fields, e.g. in a spreadsheet. * * Note that the initial setting will match the host system. * @return a reference to the Locale object for the default locale ID * @system * @stable ICU 2.0 */ static const Locale& U_EXPORT2 getDefault(void); /** * Sets the default. Normally set once at the beginning of a process, * then never reset. * setDefault() only changes ICU's default locale ID, not * the default locale ID of the runtime environment. * * @param newLocale Locale to set to. If NULL, set to the value obtained * from the runtime environement. * @param success The error code. * @system * @stable ICU 2.0 */ static void U_EXPORT2 setDefault(const Locale& newLocale, UErrorCode& success); /** * Creates a locale which has had minimal canonicalization * as per uloc_getName(). * @param name The name to create from. If name is null, * the default Locale is used. * @return new locale object * @stable ICU 2.0 * @see uloc_getName */ static Locale U_EXPORT2 createFromName(const char *name); /** * Creates a locale from the given string after canonicalizing * the string by calling uloc_canonicalize(). * @param name the locale ID to create from. Must not be NULL. * @return a new locale object corresponding to the given name * @stable ICU 3.0 * @see uloc_canonicalize */ static Locale U_EXPORT2 createCanonical(const char* name); /** * Returns the locale's ISO-639 language code. * @return An alias to the code * @stable ICU 2.0 */ inline const char * getLanguage( ) const; /** * Returns the locale's ISO-15924 abbreviation script code. * @return An alias to the code * @see uscript_getShortName * @see uscript_getCode * @stable ICU 2.8 */ inline const char * getScript( ) const; /** * Returns the locale's ISO-3166 country code. * @return An alias to the code * @stable ICU 2.0 */ inline const char * getCountry( ) const; /** * Returns the locale's variant code. * @return An alias to the code * @stable ICU 2.0 */ inline const char * getVariant( ) const; /** * Returns the programmatic name of the entire locale, with the language, * country and variant separated by underbars. If a field is missing, up * to two leading underbars will occur. Example: "en", "de_DE", "en_US_WIN", * "de__POSIX", "fr__MAC", "__MAC", "_MT", "_FR_EURO" * @return A pointer to "name". * @stable ICU 2.0 */ inline const char * getName() const; /** * Returns the programmatic name of the entire locale as getName would return, * but without keywords. * @return A pointer to "name". * @see getName * @stable ICU 2.8 */ const char * getBaseName() const; /** * Gets the list of keywords for the specified locale. * * @param status the status code * @return pointer to StringEnumeration class, or NULL if there are no keywords. * Client must dispose of it by calling delete. * @stable ICU 2.8 */ StringEnumeration * createKeywords(UErrorCode &status) const; /** * Get the value for a keyword. * * @param keywordName name of the keyword for which we want the value. Case insensitive. * @param buffer The buffer to receive the keyword value. * @param bufferCapacity The capacity of receiving buffer * @param status Returns any error information while performing this operation. * @return the length of the keyword value * * @stable ICU 2.8 */ int32_t getKeywordValue(const char* keywordName, char *buffer, int32_t bufferCapacity, UErrorCode &status) const; /** * Set the value for a keyword. * * @param keywordName name of the keyword to be set. Case insensitive. * @param keywordValue value of the keyword to be set. If 0-length or * NULL, will result in the keyword being removed. No error is given if * that keyword does not exist. * @param status Returns any error information while performing this operation. * * @internal */ void setKeywordValue(const char* keywordName, const char* keywordValue, UErrorCode &status); /** * returns the locale's three-letter language code, as specified * in ISO draft standard ISO-639-2. * @return An alias to the code, or NULL * @stable ICU 2.0 */ const char * getISO3Language() const; /** * Fills in "name" with the locale's three-letter ISO-3166 country code. * @return An alias to the code, or NULL * @stable ICU 2.0 */ const char * getISO3Country() const; /** * Returns the Windows LCID value corresponding to this locale. * This value is stored in the resource data for the locale as a one-to-four-digit * hexadecimal number. If the resource is missing, in the wrong format, or * there is no Windows LCID value that corresponds to this locale, returns 0. * @stable ICU 2.0 */ uint32_t getLCID(void) const; /** * Fills in "dispLang" with the name of this locale's language in a format suitable for * user display in the default locale. For example, if the locale's language code is * "fr" and the default locale's language code is "en", this function would set * dispLang to "French". * @param dispLang Receives the language's display name. * @return A reference to "dispLang". * @stable ICU 2.0 */ UnicodeString& getDisplayLanguage(UnicodeString& dispLang) const; /** * Fills in "dispLang" with the name of this locale's language in a format suitable for * user display in the locale specified by "displayLocale". For example, if the locale's * language code is "en" and displayLocale's language code is "fr", this function would set * dispLang to "Anglais". * @param displayLocale Specifies the locale to be used to display the name. In other words, * if the locale's language code is "en", passing Locale::getFrench() for * displayLocale would result in "Anglais", while passing Locale::getGerman() * for displayLocale would result in "Englisch". * @param dispLang Receives the language's display name. * @return A reference to "dispLang". * @stable ICU 2.0 */ UnicodeString& getDisplayLanguage( const Locale& displayLocale, UnicodeString& dispLang) const; /** * Fills in "dispScript" with the name of this locale's script in a format suitable * for user display in the default locale. For example, if the locale's script code * is "LATN" and the default locale's language code is "en", this function would set * dispScript to "Latin". * @param dispScript Receives the scripts's display name. * @return A reference to "dispScript". * @stable ICU 2.8 */ UnicodeString& getDisplayScript( UnicodeString& dispScript) const; /** * Fills in "dispScript" with the name of this locale's country in a format suitable * for user display in the locale specified by "displayLocale". For example, if the locale's * script code is "LATN" and displayLocale's language code is "en", this function would set * dispScript to "Latin". * @param displayLocale Specifies the locale to be used to display the name. In other * words, if the locale's script code is "LATN", passing * Locale::getFrench() for displayLocale would result in "", while * passing Locale::getGerman() for displayLocale would result in * "". * @param dispScript Receives the scripts's display name. * @return A reference to "dispScript". * @stable ICU 2.8 */ UnicodeString& getDisplayScript( const Locale& displayLocale, UnicodeString& dispScript) const; /** * Fills in "dispCountry" with the name of this locale's country in a format suitable * for user display in the default locale. For example, if the locale's country code * is "FR" and the default locale's language code is "en", this function would set * dispCountry to "France". * @param dispCountry Receives the country's display name. * @return A reference to "dispCountry". * @stable ICU 2.0 */ UnicodeString& getDisplayCountry( UnicodeString& dispCountry) const; /** * Fills in "dispCountry" with the name of this locale's country in a format suitable * for user display in the locale specified by "displayLocale". For example, if the locale's * country code is "US" and displayLocale's language code is "fr", this function would set * dispCountry to "États-Unis". * @param displayLocale Specifies the locale to be used to display the name. In other * words, if the locale's country code is "US", passing * Locale::getFrench() for displayLocale would result in "États-Unis", while * passing Locale::getGerman() for displayLocale would result in * "Vereinigte Staaten". * @param dispCountry Receives the country's display name. * @return A reference to "dispCountry". * @stable ICU 2.0 */ UnicodeString& getDisplayCountry( const Locale& displayLocale, UnicodeString& dispCountry) const; /** * Fills in "dispVar" with the name of this locale's variant code in a format suitable * for user display in the default locale. * @param dispVar Receives the variant's name. * @return A reference to "dispVar". * @stable ICU 2.0 */ UnicodeString& getDisplayVariant( UnicodeString& dispVar) const; /** * Fills in "dispVar" with the name of this locale's variant code in a format * suitable for user display in the locale specified by "displayLocale". * @param displayLocale Specifies the locale to be used to display the name. * @param dispVar Receives the variant's display name. * @return A reference to "dispVar". * @stable ICU 2.0 */ UnicodeString& getDisplayVariant( const Locale& displayLocale, UnicodeString& dispVar) const; /** * Fills in "name" with the name of this locale in a format suitable for user display * in the default locale. This function uses getDisplayLanguage(), getDisplayCountry(), * and getDisplayVariant() to do its work, and outputs the display name in the format * "language (country[,variant])". For example, if the default locale is en_US, then * fr_FR's display name would be "French (France)", and es_MX_Traditional's display name * would be "Spanish (Mexico,Traditional)". * @param name Receives the locale's display name. * @return A reference to "name". * @stable ICU 2.0 */ UnicodeString& getDisplayName( UnicodeString& name) const; /** * Fills in "name" with the name of this locale in a format suitable for user display * in the locale specfied by "displayLocale". This function uses getDisplayLanguage(), * getDisplayCountry(), and getDisplayVariant() to do its work, and outputs the display * name in the format "language (country[,variant])". For example, if displayLocale is * fr_FR, then en_US's display name would be "Anglais (États-Unis)", and no_NO_NY's * display name would be "norvégien (Norvège,NY)". * @param displayLocale Specifies the locale to be used to display the name. * @param name Receives the locale's display name. * @return A reference to "name". * @stable ICU 2.0 */ UnicodeString& getDisplayName( const Locale& displayLocale, UnicodeString& name) const; /** * Generates a hash code for the locale. * @stable ICU 2.0 */ int32_t hashCode(void) const; /** * Sets the locale to bogus * A bogus locale represents a non-existing locale associated * with services that can be instantiated from non-locale data * in addition to locale (for example, collation can be * instantiated from a locale and from a rule set). * @stable ICU 2.1 */ void setToBogus(); /** * Gets the bogus state. Locale object can be bogus if it doesn't exist * @return FALSE if it is a real locale, TRUE if it is a bogus locale * @stable ICU 2.1 */ UBool isBogus(void) const; /** * Returns a list of all installed locales. * @param count Receives the number of locales in the list. * @return A pointer to an array of Locale objects. This array is the list * of all locales with installed resource files. The called does NOT * get ownership of this list, and must NOT delete it. * @stable ICU 2.0 */ static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count); /** * Gets a list of all available 2-letter country codes defined in ISO 3166. This is a * pointer to an array of pointers to arrays of char. All of these pointers are * owned by ICU-- do not delete them, and do not write through them. The array is * terminated with a null pointer. * @return a list of all available country codes * @stable ICU 2.0 */ static const char* const* U_EXPORT2 getISOCountries(); /** * Gets a list of all available language codes defined in ISO 639. This is a pointer * to an array of pointers to arrays of char. All of these pointers are owned * by ICU-- do not delete them, and do not write through them. The array is * terminated with a null pointer. * @return a list of all available language codes * @stable ICU 2.0 */ static const char* const* U_EXPORT2 getISOLanguages(); /** * ICU "poor man's RTTI", returns a UClassID for this class. * * @stable ICU 2.2 */ static UClassID U_EXPORT2 getStaticClassID(); /** * ICU "poor man's RTTI", returns a UClassID for the actual class. * * @stable ICU 2.2 */ virtual UClassID getDynamicClassID() const; protected: /* only protected for testing purposes. DO NOT USE. */ /** * Set this from a single POSIX style locale string. * @internal */ void setFromPOSIXID(const char *posixID); private: /** * Initialize the locale object with a new name. * Was deprecated - used in implementation - moved internal * * @param cLocaleID The new locale name. */ Locale& init(const char* cLocaleID, UBool canonicalize); /* * Internal constructor to allow construction of a locale object with * NO side effects. (Default constructor tries to get * the default locale.) */ enum ELocaleType { eBOGUS }; Locale(ELocaleType); /** * Initialize the locale cache for commonly used locales */ static Locale *getLocaleCache(void); char language[ULOC_LANG_CAPACITY]; char script[ULOC_SCRIPT_CAPACITY]; char country[ULOC_COUNTRY_CAPACITY]; int32_t variantBegin; char* fullName; char fullNameBuffer[ULOC_FULLNAME_CAPACITY]; // name without keywords char* baseName; char baseNameBuffer[ULOC_FULLNAME_CAPACITY]; UBool fIsBogus; static const Locale &getLocale(int locid); /** * A friend to allow the default locale to be set by either the C or C++ API. * @internal */ friend void locale_set_default_internal(const char *); }; inline UBool Locale::operator!=(const Locale& other) const { return !operator==(other); } inline const char * Locale::getCountry() const { return country; } inline const char * Locale::getLanguage() const { return language; } inline const char * Locale::getScript() const { return script; } inline const char * Locale::getVariant() const { getBaseName(); // lazy init return &baseName[variantBegin]; } inline const char * Locale::getName() const { return fullName; } inline UBool Locale::isBogus(void) const { return fIsBogus; } U_NAMESPACE_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/unorm2.h0000644000015700001700000003722112200324306024343 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * * Copyright (C) 2009-2010, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: unorm2.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2009dec15 * created by: Markus W. Scherer */ #ifndef __UNORM2_H__ #define __UNORM2_H__ /** * \file * \brief C API: New API for Unicode Normalization. * * Unicode normalization functionality for standard Unicode normalization or * for using custom mapping tables. * All instances of UNormalizer2 are unmodifiable/immutable. * Instances returned by unorm2_getInstance() are singletons that must not be deleted by the caller. * For more details see the Normalizer2 C++ class. */ #include "unicode/utypes.h" #include "unicode/localpointer.h" #include "unicode/uset.h" /** * Constants for normalization modes. * For details about standard Unicode normalization forms * and about the algorithms which are also used with custom mapping tables * see http://www.unicode.org/unicode/reports/tr15/ * @stable ICU 4.4 */ typedef enum { /** * Decomposition followed by composition. * Same as standard NFC when using an "nfc" instance. * Same as standard NFKC when using an "nfkc" instance. * For details about standard Unicode normalization forms * see http://www.unicode.org/unicode/reports/tr15/ * @stable ICU 4.4 */ UNORM2_COMPOSE, /** * Map, and reorder canonically. * Same as standard NFD when using an "nfc" instance. * Same as standard NFKD when using an "nfkc" instance. * For details about standard Unicode normalization forms * see http://www.unicode.org/unicode/reports/tr15/ * @stable ICU 4.4 */ UNORM2_DECOMPOSE, /** * "Fast C or D" form. * If a string is in this form, then further decomposition without reordering * would yield the same form as DECOMPOSE. * Text in "Fast C or D" form can be processed efficiently with data tables * that are "canonically closed", that is, that provide equivalent data for * equivalent text, without having to be fully normalized. * Not a standard Unicode normalization form. * Not a unique form: Different FCD strings can be canonically equivalent. * For details see http://www.unicode.org/notes/tn5/#FCD * @stable ICU 4.4 */ UNORM2_FCD, /** * Compose only contiguously. * Also known as "FCC" or "Fast C Contiguous". * The result will often but not always be in NFC. * The result will conform to FCD which is useful for processing. * Not a standard Unicode normalization form. * For details see http://www.unicode.org/notes/tn5/#FCC * @stable ICU 4.4 */ UNORM2_COMPOSE_CONTIGUOUS } UNormalization2Mode; /** * Result values for normalization quick check functions. * For details see http://www.unicode.org/reports/tr15/#Detecting_Normalization_Forms * @stable ICU 2.0 */ typedef enum UNormalizationCheckResult { /** * The input string is not in the normalization form. * @stable ICU 2.0 */ UNORM_NO, /** * The input string is in the normalization form. * @stable ICU 2.0 */ UNORM_YES, /** * The input string may or may not be in the normalization form. * This value is only returned for composition forms like NFC and FCC, * when a backward-combining character is found for which the surrounding text * would have to be analyzed further. * @stable ICU 2.0 */ UNORM_MAYBE } UNormalizationCheckResult; /** * Opaque C service object type for the new normalization API. * @stable ICU 4.4 */ struct UNormalizer2; typedef struct UNormalizer2 UNormalizer2; /**< C typedef for struct UNormalizer2. @stable ICU 4.4 */ #if !UCONFIG_NO_NORMALIZATION /** * Returns a UNormalizer2 instance which uses the specified data file * (packageName/name similar to ucnv_openPackage() and ures_open()/ResourceBundle) * and which composes or decomposes text according to the specified mode. * Returns an unmodifiable singleton instance. Do not delete it. * * Use packageName=NULL for data files that are part of ICU's own data. * Use name="nfc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFC/NFD. * Use name="nfkc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFKC/NFKD. * Use name="nfkc_cf" and UNORM2_COMPOSE for Unicode standard NFKC_CF=NFKC_Casefold. * * @param packageName NULL for ICU built-in data, otherwise application data package name * @param name "nfc" or "nfkc" or "nfkc_cf" or name of custom data file * @param mode normalization mode (compose or decompose etc.) * @param pErrorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return the requested UNormalizer2, if successful * @stable ICU 4.4 */ U_STABLE const UNormalizer2 * U_EXPORT2 unorm2_getInstance(const char *packageName, const char *name, UNormalization2Mode mode, UErrorCode *pErrorCode); /** * Constructs a filtered normalizer wrapping any UNormalizer2 instance * and a filter set. * Both are aliased and must not be modified or deleted while this object * is used. * The filter set should be frozen; otherwise the performance will suffer greatly. * @param norm2 wrapped UNormalizer2 instance * @param filterSet USet which determines the characters to be normalized * @param pErrorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return the requested UNormalizer2, if successful * @stable ICU 4.4 */ U_STABLE UNormalizer2 * U_EXPORT2 unorm2_openFiltered(const UNormalizer2 *norm2, const USet *filterSet, UErrorCode *pErrorCode); /** * Closes a UNormalizer2 instance from unorm2_openFiltered(). * Do not close instances from unorm2_getInstance()! * @param norm2 UNormalizer2 instance to be closed * @stable ICU 4.4 */ U_STABLE void U_EXPORT2 unorm2_close(UNormalizer2 *norm2); #if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN /** * \class LocalUNormalizer2Pointer * "Smart pointer" class, closes a UNormalizer2 via unorm2_close(). * For most methods see the LocalPointerBase base class. * * @see LocalPointerBase * @see LocalPointer * @stable ICU 4.4 */ U_DEFINE_LOCAL_OPEN_POINTER(LocalUNormalizer2Pointer, UNormalizer2, unorm2_close); U_NAMESPACE_END #endif /** * Writes the normalized form of the source string to the destination string * (replacing its contents) and returns the length of the destination string. * The source and destination strings must be different buffers. * @param norm2 UNormalizer2 instance * @param src source string * @param length length of the source string, or -1 if NUL-terminated * @param dest destination string; its contents is replaced with normalized src * @param capacity number of UChars that can be written to dest * @param pErrorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return dest * @stable ICU 4.4 */ U_STABLE int32_t U_EXPORT2 unorm2_normalize(const UNormalizer2 *norm2, const UChar *src, int32_t length, UChar *dest, int32_t capacity, UErrorCode *pErrorCode); /** * Appends the normalized form of the second string to the first string * (merging them at the boundary) and returns the length of the first string. * The result is normalized if the first string was normalized. * The first and second strings must be different buffers. * @param norm2 UNormalizer2 instance * @param first string, should be normalized * @param firstLength length of the first string, or -1 if NUL-terminated * @param firstCapacity number of UChars that can be written to first * @param second string, will be normalized * @param secondLength length of the source string, or -1 if NUL-terminated * @param pErrorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return first * @stable ICU 4.4 */ U_STABLE int32_t U_EXPORT2 unorm2_normalizeSecondAndAppend(const UNormalizer2 *norm2, UChar *first, int32_t firstLength, int32_t firstCapacity, const UChar *second, int32_t secondLength, UErrorCode *pErrorCode); /** * Appends the second string to the first string * (merging them at the boundary) and returns the length of the first string. * The result is normalized if both the strings were normalized. * The first and second strings must be different buffers. * @param norm2 UNormalizer2 instance * @param first string, should be normalized * @param firstLength length of the first string, or -1 if NUL-terminated * @param firstCapacity number of UChars that can be written to first * @param second string, should be normalized * @param secondLength length of the source string, or -1 if NUL-terminated * @param pErrorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return first * @stable ICU 4.4 */ U_STABLE int32_t U_EXPORT2 unorm2_append(const UNormalizer2 *norm2, UChar *first, int32_t firstLength, int32_t firstCapacity, const UChar *second, int32_t secondLength, UErrorCode *pErrorCode); /** * Gets the decomposition mapping of c. Equivalent to unorm2_normalize(string(c)) * on a UNORM2_DECOMPOSE UNormalizer2 instance, but much faster. * This function is independent of the mode of the UNormalizer2. * @param norm2 UNormalizer2 instance * @param c code point * @param decomposition String buffer which will be set to c's * decomposition mapping, if there is one. * @param capacity number of UChars that can be written to decomposition * @param pErrorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return the non-negative length of c's decomposition, if there is one; otherwise a negative value * @draft ICU 4.6 */ U_DRAFT int32_t U_EXPORT2 unorm2_getDecomposition(const UNormalizer2 *norm2, UChar32 c, UChar *decomposition, int32_t capacity, UErrorCode *pErrorCode); /** * Tests if the string is normalized. * Internally, in cases where the quickCheck() method would return "maybe" * (which is only possible for the two COMPOSE modes) this method * resolves to "yes" or "no" to provide a definitive result, * at the cost of doing more work in those cases. * @param norm2 UNormalizer2 instance * @param s input string * @param length length of the string, or -1 if NUL-terminated * @param pErrorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return TRUE if s is normalized * @stable ICU 4.4 */ U_STABLE UBool U_EXPORT2 unorm2_isNormalized(const UNormalizer2 *norm2, const UChar *s, int32_t length, UErrorCode *pErrorCode); /** * Tests if the string is normalized. * For the two COMPOSE modes, the result could be "maybe" in cases that * would take a little more work to resolve definitively. * Use spanQuickCheckYes() and normalizeSecondAndAppend() for a faster * combination of quick check + normalization, to avoid * re-checking the "yes" prefix. * @param norm2 UNormalizer2 instance * @param s input string * @param length length of the string, or -1 if NUL-terminated * @param pErrorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return UNormalizationCheckResult * @stable ICU 4.4 */ U_STABLE UNormalizationCheckResult U_EXPORT2 unorm2_quickCheck(const UNormalizer2 *norm2, const UChar *s, int32_t length, UErrorCode *pErrorCode); /** * Returns the end of the normalized substring of the input string. * In other words, with end=spanQuickCheckYes(s, ec); * the substring UnicodeString(s, 0, end) * will pass the quick check with a "yes" result. * * The returned end index is usually one or more characters before the * "no" or "maybe" character: The end index is at a normalization boundary. * (See the class documentation for more about normalization boundaries.) * * When the goal is a normalized string and most input strings are expected * to be normalized already, then call this method, * and if it returns a prefix shorter than the input string, * copy that prefix and use normalizeSecondAndAppend() for the remainder. * @param norm2 UNormalizer2 instance * @param s input string * @param length length of the string, or -1 if NUL-terminated * @param pErrorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return "yes" span end index * @stable ICU 4.4 */ U_STABLE int32_t U_EXPORT2 unorm2_spanQuickCheckYes(const UNormalizer2 *norm2, const UChar *s, int32_t length, UErrorCode *pErrorCode); /** * Tests if the character always has a normalization boundary before it, * regardless of context. * For details see the Normalizer2 base class documentation. * @param norm2 UNormalizer2 instance * @param c character to test * @return TRUE if c has a normalization boundary before it * @stable ICU 4.4 */ U_STABLE UBool U_EXPORT2 unorm2_hasBoundaryBefore(const UNormalizer2 *norm2, UChar32 c); /** * Tests if the character always has a normalization boundary after it, * regardless of context. * For details see the Normalizer2 base class documentation. * @param norm2 UNormalizer2 instance * @param c character to test * @return TRUE if c has a normalization boundary after it * @stable ICU 4.4 */ U_STABLE UBool U_EXPORT2 unorm2_hasBoundaryAfter(const UNormalizer2 *norm2, UChar32 c); /** * Tests if the character is normalization-inert. * For details see the Normalizer2 base class documentation. * @param norm2 UNormalizer2 instance * @param c character to test * @return TRUE if c is normalization-inert * @stable ICU 4.4 */ U_STABLE UBool U_EXPORT2 unorm2_isInert(const UNormalizer2 *norm2, UChar32 c); #endif /* !UCONFIG_NO_NORMALIZATION */ #endif /* __UNORM2_H__ */ android-audiosystem-1.8+13.10.20130807/include/unicode/ushape.h0000644000015700001700000004446712200324306024420 0ustar pbuserpbgroup00000000000000/* ****************************************************************************** * * Copyright (C) 2000-2010, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * file name: ushape.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2000jun29 * created by: Markus W. Scherer */ #ifndef __USHAPE_H__ #define __USHAPE_H__ #include "unicode/utypes.h" /** * \file * \brief C API: Arabic shaping * */ /** * Shape Arabic text on a character basis. * *

This function performs basic operations for "shaping" Arabic text. It is most * useful for use with legacy data formats and legacy display technology * (simple terminals). All operations are performed on Unicode characters.

* *

Text-based shaping means that some character code points in the text are * replaced by others depending on the context. It transforms one kind of text * into another. In comparison, modern displays for Arabic text select * appropriate, context-dependent font glyphs for each text element, which means * that they transform text into a glyph vector.

* *

Text transformations are necessary when modern display technology is not * available or when text needs to be transformed to or from legacy formats that * use "shaped" characters. Since the Arabic script is cursive, connecting * adjacent letters to each other, computers select images for each letter based * on the surrounding letters. This usually results in four images per Arabic * letter: initial, middle, final, and isolated forms. In Unicode, on the other * hand, letters are normally stored abstract, and a display system is expected * to select the necessary glyphs. (This makes searching and other text * processing easier because the same letter has only one code.) It is possible * to mimic this with text transformations because there are characters in * Unicode that are rendered as letters with a specific shape * (or cursive connectivity). They were included for interoperability with * legacy systems and codepages, and for unsophisticated display systems.

* *

A second kind of text transformations is supported for Arabic digits: * For compatibility with legacy codepages that only include European digits, * it is possible to replace one set of digits by another, changing the * character code points. These operations can be performed for either * Arabic-Indic Digits (U+0660...U+0669) or Eastern (Extended) Arabic-Indic * digits (U+06f0...U+06f9).

* *

Some replacements may result in more or fewer characters (code points). * By default, this means that the destination buffer may receive text with a * length different from the source length. Some legacy systems rely on the * length of the text to be constant. They expect extra spaces to be added * or consumed either next to the affected character or at the end of the * text.

* *

For details about the available operations, see the description of the * U_SHAPE_... options.

* * @param source The input text. * * @param sourceLength The number of UChars in source. * * @param dest The destination buffer that will receive the results of the * requested operations. It may be NULL only if * destSize is 0. The source and destination must not * overlap. * * @param destSize The size (capacity) of the destination buffer in UChars. * If destSize is 0, then no output is produced, * but the necessary buffer size is returned ("preflighting"). * * @param options This is a 32-bit set of flags that specify the operations * that are performed on the input text. If no error occurs, * then the result will always be written to the destination * buffer. * * @param pErrorCode must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * * @return The number of UChars written to the destination buffer. * If an error occured, then no output was written, or it may be * incomplete. If U_BUFFER_OVERFLOW_ERROR is set, then * the return value indicates the necessary destination buffer size. * @stable ICU 2.0 */ /* BEGIN android-changed */ U_STABLE int32_t U_EXPORT2 u_shapeArabic(const UChar *source, int32_t sourceLength, UChar *dest, int32_t destSize, uint64_t options, UErrorCode *pErrorCode); /* END android-changed */ /** * Memory option: allow the result to have a different length than the source. * Affects: LamAlef options * @stable ICU 2.0 */ #define U_SHAPE_LENGTH_GROW_SHRINK 0 /** * Memory option: allow the result to have a different length than the source. * Affects: LamAlef options * This option is an alias to U_SHAPE_LENGTH_GROW_SHRINK * @stable ICU 4.2 */ #define U_SHAPE_LAMALEF_RESIZE 0 /** * Memory option: the result must have the same length as the source. * If more room is necessary, then try to consume spaces next to modified characters. * @stable ICU 2.0 */ #define U_SHAPE_LENGTH_FIXED_SPACES_NEAR 1 /** * Memory option: the result must have the same length as the source. * If more room is necessary, then try to consume spaces next to modified characters. * Affects: LamAlef options * This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_NEAR * @stable ICU 4.2 */ #define U_SHAPE_LAMALEF_NEAR 1 /** * Memory option: the result must have the same length as the source. * If more room is necessary, then try to consume spaces at the end of the text. * @stable ICU 2.0 */ #define U_SHAPE_LENGTH_FIXED_SPACES_AT_END 2 /** * Memory option: the result must have the same length as the source. * If more room is necessary, then try to consume spaces at the end of the text. * Affects: LamAlef options * This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_AT_END * @stable ICU 4.2 */ #define U_SHAPE_LAMALEF_END 2 /** * Memory option: the result must have the same length as the source. * If more room is necessary, then try to consume spaces at the beginning of the text. * @stable ICU 2.0 */ #define U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING 3 /** * Memory option: the result must have the same length as the source. * If more room is necessary, then try to consume spaces at the beginning of the text. * Affects: LamAlef options * This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING * @stable ICU 4.2 */ #define U_SHAPE_LAMALEF_BEGIN 3 /** * Memory option: the result must have the same length as the source. * Shaping Mode: For each LAMALEF character found, expand LAMALEF using space at end. * If there is no space at end, use spaces at beginning of the buffer. If there * is no space at beginning of the buffer, use spaces at the near (i.e. the space * after the LAMALEF character). * If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h) * will be set in pErrorCode * * Deshaping Mode: Perform the same function as the flag equals U_SHAPE_LAMALEF_END. * Affects: LamAlef options * @stable ICU 4.2 */ #define U_SHAPE_LAMALEF_AUTO 0x10000 /** Bit mask for memory options. @stable ICU 2.0 */ #define U_SHAPE_LENGTH_MASK 0x10003 /* Changed old value 3 */ /** * Bit mask for LamAlef memory options. * @stable ICU 4.2 */ #define U_SHAPE_LAMALEF_MASK 0x10003 /* updated */ /** Direction indicator: the source is in logical (keyboard) order. @stable ICU 2.0 */ #define U_SHAPE_TEXT_DIRECTION_LOGICAL 0 /** * Direction indicator: * the source is in visual RTL order, * the rightmost displayed character stored first. * This option is an alias to U_SHAPE_TEXT_DIRECTION_LOGICAL * @stable ICU 4.2 */ #define U_SHAPE_TEXT_DIRECTION_VISUAL_RTL 0 /** * Direction indicator: * the source is in visual LTR order, * the leftmost displayed character stored first. * @stable ICU 2.0 */ #define U_SHAPE_TEXT_DIRECTION_VISUAL_LTR 4 /** Bit mask for direction indicators. @stable ICU 2.0 */ #define U_SHAPE_TEXT_DIRECTION_MASK 4 /** Letter shaping option: do not perform letter shaping. @stable ICU 2.0 */ #define U_SHAPE_LETTERS_NOOP 0 /** Letter shaping option: replace abstract letter characters by "shaped" ones. @stable ICU 2.0 */ #define U_SHAPE_LETTERS_SHAPE 8 /** Letter shaping option: replace "shaped" letter characters by abstract ones. @stable ICU 2.0 */ #define U_SHAPE_LETTERS_UNSHAPE 0x10 /** * Letter shaping option: replace abstract letter characters by "shaped" ones. * The only difference with U_SHAPE_LETTERS_SHAPE is that Tashkeel letters * are always "shaped" into the isolated form instead of the medial form * (selecting code points from the Arabic Presentation Forms-B block). * @stable ICU 2.0 */ #define U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED 0x18 /** Bit mask for letter shaping options. @stable ICU 2.0 */ #define U_SHAPE_LETTERS_MASK 0x18 /** Digit shaping option: do not perform digit shaping. @stable ICU 2.0 */ #define U_SHAPE_DIGITS_NOOP 0 /** * Digit shaping option: * Replace European digits (U+0030...) by Arabic-Indic digits. * @stable ICU 2.0 */ #define U_SHAPE_DIGITS_EN2AN 0x20 /** * Digit shaping option: * Replace Arabic-Indic digits by European digits (U+0030...). * @stable ICU 2.0 */ #define U_SHAPE_DIGITS_AN2EN 0x40 /** * Digit shaping option: * Replace European digits (U+0030...) by Arabic-Indic digits if the most recent * strongly directional character is an Arabic letter * (u_charDirection() result U_RIGHT_TO_LEFT_ARABIC [AL]).
* The direction of "preceding" depends on the direction indicator option. * For the first characters, the preceding strongly directional character * (initial state) is assumed to be not an Arabic letter * (it is U_LEFT_TO_RIGHT [L] or U_RIGHT_TO_LEFT [R]). * @stable ICU 2.0 */ #define U_SHAPE_DIGITS_ALEN2AN_INIT_LR 0x60 /** * Digit shaping option: * Replace European digits (U+0030...) by Arabic-Indic digits if the most recent * strongly directional character is an Arabic letter * (u_charDirection() result U_RIGHT_TO_LEFT_ARABIC [AL]).
* The direction of "preceding" depends on the direction indicator option. * For the first characters, the preceding strongly directional character * (initial state) is assumed to be an Arabic letter. * @stable ICU 2.0 */ #define U_SHAPE_DIGITS_ALEN2AN_INIT_AL 0x80 /** Not a valid option value. May be replaced by a new option. @stable ICU 2.0 */ #define U_SHAPE_DIGITS_RESERVED 0xa0 /** Bit mask for digit shaping options. @stable ICU 2.0 */ #define U_SHAPE_DIGITS_MASK 0xe0 /** Digit type option: Use Arabic-Indic digits (U+0660...U+0669). @stable ICU 2.0 */ #define U_SHAPE_DIGIT_TYPE_AN 0 /** Digit type option: Use Eastern (Extended) Arabic-Indic digits (U+06f0...U+06f9). @stable ICU 2.0 */ #define U_SHAPE_DIGIT_TYPE_AN_EXTENDED 0x100 /** Not a valid option value. May be replaced by a new option. @stable ICU 2.0 */ #define U_SHAPE_DIGIT_TYPE_RESERVED 0x200 /** Bit mask for digit type options. @stable ICU 2.0 */ #define U_SHAPE_DIGIT_TYPE_MASK 0x300 /* I need to change this from 0x3f00 to 0x300 */ /** * Tashkeel aggregation option: * Replaces any combination of U+0651 with one of * U+064C, U+064D, U+064E, U+064F, U+0650 with * U+FC5E, U+FC5F, U+FC60, U+FC61, U+FC62 consecutively. * @stable ICU 3.6 */ #define U_SHAPE_AGGREGATE_TASHKEEL 0x4000 /** Tashkeel aggregation option: do not aggregate tashkeels. @stable ICU 3.6 */ #define U_SHAPE_AGGREGATE_TASHKEEL_NOOP 0 /** Bit mask for tashkeel aggregation. @stable ICU 3.6 */ #define U_SHAPE_AGGREGATE_TASHKEEL_MASK 0x4000 /** * Presentation form option: * Don't replace Arabic Presentation Forms-A and Arabic Presentation Forms-B * characters with 0+06xx characters, before shaping. * @stable ICU 3.6 */ #define U_SHAPE_PRESERVE_PRESENTATION 0x8000 /** Presentation form option: * Replace Arabic Presentation Forms-A and Arabic Presentationo Forms-B with * their unshaped correspondants in range 0+06xx, before shaping. * @stable ICU 3.6 */ #define U_SHAPE_PRESERVE_PRESENTATION_NOOP 0 /** Bit mask for preserve presentation form. @stable ICU 3.6 */ #define U_SHAPE_PRESERVE_PRESENTATION_MASK 0x8000 /* Seen Tail option */ /** * Memory option: the result must have the same length as the source. * Shaping mode: The SEEN family character will expand into two characters using space near * the SEEN family character(i.e. the space after the character). * If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h) * will be set in pErrorCode * * De-shaping mode: Any Seen character followed by Tail character will be * replaced by one cell Seen and a space will replace the Tail. * Affects: Seen options * @stable ICU 4.2 */ #define U_SHAPE_SEEN_TWOCELL_NEAR 0x200000 /** * Bit mask for Seen memory options. * @stable ICU 4.2 */ #define U_SHAPE_SEEN_MASK 0x700000 /* YehHamza option */ /** * Memory option: the result must have the same length as the source. * Shaping mode: The YEHHAMZA character will expand into two characters using space near it * (i.e. the space after the character * If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h) * will be set in pErrorCode * * De-shaping mode: Any Yeh (final or isolated) character followed by Hamza character will be * replaced by one cell YehHamza and space will replace the Hamza. * Affects: YehHamza options * @stable ICU 4.2 */ #define U_SHAPE_YEHHAMZA_TWOCELL_NEAR 0x1000000 /** * Bit mask for YehHamza memory options. * @stable ICU 4.2 */ #define U_SHAPE_YEHHAMZA_MASK 0x3800000 /* New Tashkeel options */ /** * Memory option: the result must have the same length as the source. * Shaping mode: Tashkeel characters will be replaced by spaces. * Spaces will be placed at beginning of the buffer * * De-shaping mode: N/A * Affects: Tashkeel options * @stable ICU 4.2 */ #define U_SHAPE_TASHKEEL_BEGIN 0x40000 /** * Memory option: the result must have the same length as the source. * Shaping mode: Tashkeel characters will be replaced by spaces. * Spaces will be placed at end of the buffer * * De-shaping mode: N/A * Affects: Tashkeel options * @stable ICU 4.2 */ #define U_SHAPE_TASHKEEL_END 0x60000 /** * Memory option: allow the result to have a different length than the source. * Shaping mode: Tashkeel characters will be removed, buffer length will shrink. * De-shaping mode: N/A * * Affect: Tashkeel options * @stable ICU 4.2 */ #define U_SHAPE_TASHKEEL_RESIZE 0x80000 /** * Memory option: the result must have the same length as the source. * Shaping mode: Tashkeel characters will be replaced by Tatweel if it is connected to adjacent * characters (i.e. shaped on Tatweel) or replaced by space if it is not connected. * * De-shaping mode: N/A * Affects: YehHamza options * @stable ICU 4.2 */ #define U_SHAPE_TASHKEEL_REPLACE_BY_TATWEEL 0xC0000 /** * Bit mask for Tashkeel replacement with Space or Tatweel memory options. * @stable ICU 4.2 */ #define U_SHAPE_TASHKEEL_MASK 0xE0000 /* Space location Control options */ /** * This option affect the meaning of BEGIN and END options. if this option is not used the default * for BEGIN and END will be as following: * The Default (for both Visual LTR, Visual RTL and Logical Text) * 1. BEGIN always refers to the start address of physical memory. * 2. END always refers to the end address of physical memory. * * If this option is used it will swap the meaning of BEGIN and END only for Visual LTR text. * * The effect on BEGIN and END Memory Options will be as following: * A. BEGIN For Visual LTR text: This will be the beginning (right side) of the visual text( * corresponding to the physical memory address end for Visual LTR text, Same as END in * default behavior) * B. BEGIN For Logical text: Same as BEGIN in default behavior. * C. END For Visual LTR text: This will be the end (left side) of the visual text (corresponding * to the physical memory address beginning for Visual LTR text, Same as BEGIN in default behavior. * D. END For Logical text: Same as END in default behavior). * Affects: All LamAlef BEGIN, END and AUTO options. * @stable ICU 4.2 */ #define U_SHAPE_SPACES_RELATIVE_TO_TEXT_BEGIN_END 0x4000000 /** * Bit mask for swapping BEGIN and END for Visual LTR text * @stable ICU 4.2 */ #define U_SHAPE_SPACES_RELATIVE_TO_TEXT_MASK 0x4000000 /** * If this option is used, shaping will use the new Unicode code point for TAIL (i.e. 0xFE73). * If this option is not specified (Default), old unofficial Unicode TAIL code point is used (i.e. 0x200B) * De-shaping will not use this option as it will always search for both the new Unicode code point for the * TAIL (i.e. 0xFE73) or the old unofficial Unicode TAIL code point (i.e. 0x200B) and de-shape the * Seen-Family letter accordingly. * * Shaping Mode: Only shaping. * De-shaping Mode: N/A. * Affects: All Seen options * @draft ICU 4.2 */ #define SHAPE_TAIL_NEW_UNICODE 0x8000000 /** * Bit mask for new Unicode Tail option * @draft ICU 4.2 */ #define SHAPE_TAIL_TYPE_MASK 0x8000000 /* BEGIN Android-added */ /** * Option used when forming LamAlef ligatures and * U_SHAPE_LAMALEF_NEAR is set. When this option is selected, inserts * 0xffff instead of 0x0020 (space) after the ligature. Use this when * you need to identify these substitutions during later processing. */ /* END Android-added */ #define U_SHAPE_X_LAMALEF_SUB_ALTERNATE (0x1ULL << 32) #endif android-audiosystem-1.8+13.10.20130807/include/unicode/bytestream.h0000644000015700001700000002212212200324306025272 0ustar pbuserpbgroup00000000000000// Copyright (C) 2009-2010, International Business Machines // Corporation and others. All Rights Reserved. // // Copyright 2007 Google Inc. All Rights Reserved. // Author: sanjay@google.com (Sanjay Ghemawat) // // Abstract interface that consumes a sequence of bytes (ByteSink). // // Used so that we can write a single piece of code that can operate // on a variety of output string types. // // Various implementations of this interface are provided: // ByteSink: // CheckedArrayByteSink Write to a flat array, with bounds checking // StringByteSink Write to an STL string // This code is a contribution of Google code, and the style used here is // a compromise between the original Google code and the ICU coding guidelines. // For example, data types are ICU-ified (size_t,int->int32_t), // and API comments doxygen-ified, but function names and behavior are // as in the original, if possible. // Assertion-style error handling, not available in ICU, was changed to // parameter "pinning" similar to UnicodeString. // // In addition, this is only a partial port of the original Google code, // limited to what was needed so far. The (nearly) complete original code // is in the ICU svn repository at icuhtml/trunk/design/strings/contrib // (see ICU ticket 6765, r25517). #ifndef __BYTESTREAM_H__ #define __BYTESTREAM_H__ /** * \file * \brief C++ API: Interface for writing bytes, and implementation classes. */ #include "unicode/utypes.h" #include "unicode/uobject.h" #include "unicode/std_string.h" U_NAMESPACE_BEGIN /** * A ByteSink can be filled with bytes. * @stable ICU 4.2 */ class U_COMMON_API ByteSink : public UMemory { public: /** * Default constructor. * @stable ICU 4.2 */ ByteSink() { } /** * Virtual destructor. * @stable ICU 4.2 */ virtual ~ByteSink() { } /** * Append "bytes[0,n-1]" to this. * @param bytes the pointer to the bytes * @param n the number of bytes; must be non-negative * @stable ICU 4.2 */ virtual void Append(const char* bytes, int32_t n) = 0; /** * Returns a writable buffer for appending and writes the buffer's capacity to * *result_capacity. Guarantees *result_capacity>=min_capacity. * May return a pointer to the caller-owned scratch buffer which must have * scratch_capacity>=min_capacity. * The returned buffer is only valid until the next operation * on this ByteSink. * * After writing at most *result_capacity bytes, call Append() with the * pointer returned from this function and the number of bytes written. * Many Append() implementations will avoid copying bytes if this function * returned an internal buffer. * * Partial usage example: * int32_t capacity; * char* buffer = sink->GetAppendBuffer(..., &capacity); * ... Write n bytes into buffer, with n <= capacity. * sink->Append(buffer, n); * In many implementations, that call to Append will avoid copying bytes. * * If the ByteSink allocates or reallocates an internal buffer, it should use * the desired_capacity_hint if appropriate. * If a caller cannot provide a reasonable guess at the desired capacity, * it should pass desired_capacity_hint=0. * * If a non-scratch buffer is returned, the caller may only pass * a prefix to it to Append(). * That is, it is not correct to pass an interior pointer to Append(). * * The default implementation always returns the scratch buffer. * * @param min_capacity required minimum capacity of the returned buffer; * must be non-negative * @param desired_capacity_hint desired capacity of the returned buffer; * must be non-negative * @param scratch default caller-owned buffer * @param scratch_capacity capacity of the scratch buffer * @param result_capacity pointer to an integer which will be set to the * capacity of the returned buffer * @return a buffer with *result_capacity>=min_capacity * @stable ICU 4.2 */ virtual char* GetAppendBuffer(int32_t min_capacity, int32_t desired_capacity_hint, char* scratch, int32_t scratch_capacity, int32_t* result_capacity); /** * Flush internal buffers. * Some byte sinks use internal buffers or provide buffering * and require calling Flush() at the end of the stream. * The ByteSink should be ready for further Append() calls after Flush(). * The default implementation of Flush() does nothing. * @stable ICU 4.2 */ virtual void Flush(); private: ByteSink(const ByteSink &); // copy constructor not implemented ByteSink &operator=(const ByteSink &); // assignment operator not implemented }; // ------------------------------------------------------------- // Some standard implementations /** * Implementation of ByteSink that writes to a flat byte array, * with bounds-checking: * This sink will not write more than capacity bytes to outbuf. * If more than capacity bytes are Append()ed, then excess bytes are ignored, * and Overflowed() will return true. * Overflow does not cause a runtime error. * @stable ICU 4.2 */ class U_COMMON_API CheckedArrayByteSink : public ByteSink { public: /** * Constructs a ByteSink that will write to outbuf[0..capacity-1]. * @param outbuf buffer to write to * @param capacity size of the buffer * @stable ICU 4.2 */ CheckedArrayByteSink(char* outbuf, int32_t capacity); /** * Returns the sink to its original state, without modifying the buffer. * Useful for reusing both the buffer and the sink for multiple streams. * Resets the state to NumberOfBytesWritten()=NumberOfBytesAppended()=0 * and Overflowed()=FALSE. * @return *this * @draft ICU 4.6 */ virtual CheckedArrayByteSink& Reset(); /** * Append "bytes[0,n-1]" to this. * @param bytes the pointer to the bytes * @param n the number of bytes; must be non-negative * @stable ICU 4.2 */ virtual void Append(const char* bytes, int32_t n); /** * Returns a writable buffer for appending and writes the buffer's capacity to * *result_capacity. For details see the base class documentation. * @param min_capacity required minimum capacity of the returned buffer; * must be non-negative * @param desired_capacity_hint desired capacity of the returned buffer; * must be non-negative * @param scratch default caller-owned buffer * @param scratch_capacity capacity of the scratch buffer * @param result_capacity pointer to an integer which will be set to the * capacity of the returned buffer * @return a buffer with *result_capacity>=min_capacity * @stable ICU 4.2 */ virtual char* GetAppendBuffer(int32_t min_capacity, int32_t desired_capacity_hint, char* scratch, int32_t scratch_capacity, int32_t* result_capacity); /** * Returns the number of bytes actually written to the sink. * @return number of bytes written to the buffer * @stable ICU 4.2 */ int32_t NumberOfBytesWritten() const { return size_; } /** * Returns true if any bytes were discarded, i.e., if there was an * attempt to write more than 'capacity' bytes. * @return TRUE if more than 'capacity' bytes were Append()ed * @stable ICU 4.2 */ UBool Overflowed() const { return overflowed_; } /** * Returns the number of bytes appended to the sink. * If Overflowed() then NumberOfBytesAppended()>NumberOfBytesWritten() * else they return the same number. * @return number of bytes written to the buffer * @draft ICU 4.6 */ int32_t NumberOfBytesAppended() const { return appended_; } private: char* outbuf_; const int32_t capacity_; int32_t size_; int32_t appended_; UBool overflowed_; CheckedArrayByteSink(); ///< default constructor not implemented CheckedArrayByteSink(const CheckedArrayByteSink &); ///< copy constructor not implemented CheckedArrayByteSink &operator=(const CheckedArrayByteSink &); ///< assignment operator not implemented }; #if U_HAVE_STD_STRING /** * Implementation of ByteSink that writes to a "string". * The StringClass is usually instantiated with a std::string. * @stable ICU 4.2 */ template class StringByteSink : public ByteSink { public: /** * Constructs a ByteSink that will append bytes to the dest string. * @param dest pointer to string object to append to * @stable ICU 4.2 */ StringByteSink(StringClass* dest) : dest_(dest) { } /** * Append "bytes[0,n-1]" to this. * @param data the pointer to the bytes * @param n the number of bytes; must be non-negative * @stable ICU 4.2 */ virtual void Append(const char* data, int32_t n) { dest_->append(data, n); } private: StringClass* dest_; StringByteSink(); ///< default constructor not implemented StringByteSink(const StringByteSink &); ///< copy constructor not implemented StringByteSink &operator=(const StringByteSink &); ///< assignment operator not implemented }; #endif U_NAMESPACE_END #endif // __BYTESTREAM_H__ android-audiosystem-1.8+13.10.20130807/include/unicode/umisc.h0000644000015700001700000000234712200324306024242 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (C) 1999-2006, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * file name: umisc.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 1999oct15 * created by: Markus W. Scherer */ #ifndef UMISC_H #define UMISC_H #include "unicode/utypes.h" /** * \file * \brief C API:misc definitions * * This file contains miscellaneous definitions for the C APIs. */ U_CDECL_BEGIN /** A struct representing a range of text containing a specific field * @stable ICU 2.0 */ typedef struct UFieldPosition { /** * The field * @stable ICU 2.0 */ int32_t field; /** * The start of the text range containing field * @stable ICU 2.0 */ int32_t beginIndex; /** * The limit of the text range containing field * @stable ICU 2.0 */ int32_t endIndex; } UFieldPosition; #if !UCONFIG_NO_SERVICE /** * Opaque type returned by registerInstance, registerFactory and unregister for service registration. * @stable ICU 2.6 */ typedef const void* URegistryKey; #endif U_CDECL_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/putil.h0000644000015700001700000001503612200324306024256 0ustar pbuserpbgroup00000000000000/* ****************************************************************************** * * Copyright (C) 1997-2009, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * * FILE NAME : putil.h * * Date Name Description * 05/14/98 nos Creation (content moved here from utypes.h). * 06/17/99 erm Added IEEE_754 * 07/22/98 stephen Added IEEEremainder, max, min, trunc * 08/13/98 stephen Added isNegativeInfinity, isPositiveInfinity * 08/24/98 stephen Added longBitsFromDouble * 03/02/99 stephen Removed openFile(). Added AS400 support. * 04/15/99 stephen Converted to C * 11/15/99 helena Integrated S/390 changes for IEEE support. * 01/11/00 helena Added u_getVersion. ****************************************************************************** */ #ifndef PUTIL_H #define PUTIL_H #include "unicode/utypes.h" /** * \file * \brief C API: Platform Utilities */ /** Define this to 1 if your platform supports IEEE 754 floating point, to 0 if it does not. */ #ifndef IEEE_754 # define IEEE_754 1 #endif /*==========================================================================*/ /* Platform utilities */ /*==========================================================================*/ /** * Platform utilities isolates the platform dependencies of the * libarary. For each platform which this code is ported to, these * functions may have to be re-implemented. */ /** * Return the ICU data directory. * The data directory is where common format ICU data files (.dat files) * are loaded from. Note that normal use of the built-in ICU * facilities does not require loading of an external data file; * unless you are adding custom data to ICU, the data directory * does not need to be set. * * The data directory is determined as follows: * If u_setDataDirectory() has been called, that is it, otherwise * if the ICU_DATA environment variable is set, use that, otherwise * If a data directory was specifed at ICU build time * * \code * #define ICU_DATA_DIR "path" * \endcode * use that, * otherwise no data directory is available. * * @return the data directory, or an empty string ("") if no data directory has * been specified. * * @stable ICU 2.0 */ U_STABLE const char* U_EXPORT2 u_getDataDirectory(void); /** * Set the ICU data directory. * The data directory is where common format ICU data files (.dat files) * are loaded from. Note that normal use of the built-in ICU * facilities does not require loading of an external data file; * unless you are adding custom data to ICU, the data directory * does not need to be set. * * This function should be called at most once in a process, before the * first ICU operation (e.g., u_init()) that will require the loading of an * ICU data file. * This function is not thread-safe. Use it before calling ICU APIs from * multiple threads. * * @param directory The directory to be set. * * @see u_init * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory); #if !U_CHARSET_IS_UTF8 /** * Please use ucnv_getDefaultName() instead. * Return the default codepage for this platform and locale. * This function can call setlocale() on Unix platforms. Please read the * platform documentation on setlocale() before calling this function. * @return the default codepage for this platform * @internal */ U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage(void); #endif /** * Please use uloc_getDefault() instead. * Return the default locale ID string by querying ths system, or * zero if one cannot be found. * This function can call setlocale() on Unix platforms. Please read the * platform documentation on setlocale() before calling this function. * @return the default locale ID string * @internal */ U_INTERNAL const char* U_EXPORT2 uprv_getDefaultLocaleID(void); /** * @{ * Filesystem file and path separator characters. * Example: '/' and ':' on Unix, '\\' and ';' on Windows. * @stable ICU 2.0 */ #ifdef XP_MAC # define U_FILE_SEP_CHAR ':' # define U_FILE_ALT_SEP_CHAR ':' # define U_PATH_SEP_CHAR ';' # define U_FILE_SEP_STRING ":" # define U_FILE_ALT_SEP_STRING ":" # define U_PATH_SEP_STRING ";" #elif defined(U_WINDOWS) # define U_FILE_SEP_CHAR '\\' # define U_FILE_ALT_SEP_CHAR '/' # define U_PATH_SEP_CHAR ';' # define U_FILE_SEP_STRING "\\" # define U_FILE_ALT_SEP_STRING "/" # define U_PATH_SEP_STRING ";" #else # define U_FILE_SEP_CHAR '/' # define U_FILE_ALT_SEP_CHAR '/' # define U_PATH_SEP_CHAR ':' # define U_FILE_SEP_STRING "/" # define U_FILE_ALT_SEP_STRING "/" # define U_PATH_SEP_STRING ":" #endif /** @} */ /** * Convert char characters to UChar characters. * This utility function is useful only for "invariant characters" * that are encoded in the platform default encoding. * They are a small, constant subset of the encoding and include * just the latin letters, digits, and some punctuation. * For details, see U_CHARSET_FAMILY. * * @param cs Input string, points to length * character bytes from a subset of the platform encoding. * @param us Output string, points to memory for length * Unicode characters. * @param length The number of characters to convert; this may * include the terminating NUL. * * @see U_CHARSET_FAMILY * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 u_charsToUChars(const char *cs, UChar *us, int32_t length); /** * Convert UChar characters to char characters. * This utility function is useful only for "invariant characters" * that can be encoded in the platform default encoding. * They are a small, constant subset of the encoding and include * just the latin letters, digits, and some punctuation. * For details, see U_CHARSET_FAMILY. * * @param us Input string, points to length * Unicode characters that can be encoded with the * codepage-invariant subset of the platform encoding. * @param cs Output string, points to memory for length * character bytes. * @param length The number of characters to convert; this may * include the terminating NUL. * * @see U_CHARSET_FAMILY * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 u_UCharsToChars(const UChar *us, char *cs, int32_t length); #endif android-audiosystem-1.8+13.10.20130807/include/unicode/udeprctd.h0000644000015700001700000000436612200324306024737 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * Copyright (C) 2004-2010, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* * * file name: udeprctd.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * Created by: genheaders.pl, a perl script written by Ram Viswanadha * * Contains data for commenting out APIs. * Gets included by umachine.h * * THIS FILE IS MACHINE-GENERATED, DON'T PLAY WITH IT IF YOU DON'T KNOW WHAT * YOU ARE DOING, OTHERWISE VERY BAD THINGS WILL HAPPEN! */ #ifndef UDEPRCTD_H #define UDEPRCTD_H #ifdef U_HIDE_DEPRECATED_API # if U_DISABLE_RENAMING # define ucol_getContractions ucol_getContractions_DEPRECATED_API_DO_NOT_USE # define ucol_getLocale ucol_getLocale_DEPRECATED_API_DO_NOT_USE # define ures_countArrayItems ures_countArrayItems_DEPRECATED_API_DO_NOT_USE # define ures_getLocale ures_getLocale_DEPRECATED_API_DO_NOT_USE # define ures_getVersionNumber ures_getVersionNumber_DEPRECATED_API_DO_NOT_USE # define utrans_getAvailableID utrans_getAvailableID_DEPRECATED_API_DO_NOT_USE # define utrans_getID utrans_getID_DEPRECATED_API_DO_NOT_USE # define utrans_open utrans_open_DEPRECATED_API_DO_NOT_USE # define utrans_unregister utrans_unregister_DEPRECATED_API_DO_NOT_USE # else # define ucol_getContractions_4_6 ucol_getContractions_DEPRECATED_API_DO_NOT_USE # define ucol_getLocale_4_6 ucol_getLocale_DEPRECATED_API_DO_NOT_USE # define ures_countArrayItems_4_6 ures_countArrayItems_DEPRECATED_API_DO_NOT_USE # define ures_getLocale_4_6 ures_getLocale_DEPRECATED_API_DO_NOT_USE # define ures_getVersionNumber_4_6 ures_getVersionNumber_DEPRECATED_API_DO_NOT_USE # define utrans_getAvailableID_4_6 utrans_getAvailableID_DEPRECATED_API_DO_NOT_USE # define utrans_getID_4_6 utrans_getID_DEPRECATED_API_DO_NOT_USE # define utrans_open_4_6 utrans_open_DEPRECATED_API_DO_NOT_USE # define utrans_unregister_4_6 utrans_unregister_DEPRECATED_API_DO_NOT_USE # endif /* U_DISABLE_RENAMING */ #endif /* U_HIDE_DEPRECATED_API */ #endif /* UDEPRCTD_H */ android-audiosystem-1.8+13.10.20130807/include/unicode/parseerr.h0000644000015700001700000000574412200324306024751 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (C) 1999-2005, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Date Name Description * 03/14/00 aliu Creation. * 06/27/00 aliu Change from C++ class to C struct ********************************************************************** */ #ifndef PARSEERR_H #define PARSEERR_H #include "unicode/utypes.h" /** * \file * \brief C API: Parse Error Information */ /** * The capacity of the context strings in UParseError. * @stable ICU 2.0 */ enum { U_PARSE_CONTEXT_LEN = 16 }; /** * A UParseError struct is used to returned detailed information about * parsing errors. It is used by ICU parsing engines that parse long * rules, patterns, or programs, where the text being parsed is long * enough that more information than a UErrorCode is needed to * localize the error. * *

The line, offset, and context fields are optional; parsing * engines may choose not to use to use them. * *

The preContext and postContext strings include some part of the * context surrounding the error. If the source text is "let for=7" * and "for" is the error (e.g., because it is a reserved word), then * some examples of what a parser might produce are the following: * *

 * preContext   postContext
 * ""           ""            The parser does not support context
 * "let "       "=7"          Pre- and post-context only
 * "let "       "for=7"       Pre- and post-context and error text
 * ""           "for"         Error text only
 * 
* *

Examples of engines which use UParseError (or may use it in the * future) are Transliterator, RuleBasedBreakIterator, and * RegexPattern. * * @stable ICU 2.0 */ typedef struct UParseError { /** * The line on which the error occured. If the parser uses this * field, it sets it to the line number of the source text line on * which the error appears, which will be be a value >= 1. If the * parse does not support line numbers, the value will be <= 0. * @stable ICU 2.0 */ int32_t line; /** * The character offset to the error. If the line field is >= 1, * then this is the offset from the start of the line. Otherwise, * this is the offset from the start of the text. If the parser * does not support this field, it will have a value < 0. * @stable ICU 2.0 */ int32_t offset; /** * Textual context before the error. Null-terminated. The empty * string if not supported by parser. * @stable ICU 2.0 */ UChar preContext[U_PARSE_CONTEXT_LEN]; /** * The error itself and/or textual context after the error. * Null-terminated. The empty string if not supported by parser. * @stable ICU 2.0 */ UChar postContext[U_PARSE_CONTEXT_LEN]; } UParseError; #endif android-audiosystem-1.8+13.10.20130807/include/unicode/utrace.h0000644000015700001700000003205312200324306024402 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * * Copyright (C) 2003-2006, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: utrace.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2003aug06 * created by: Markus W. Scherer * * Definitions for ICU tracing/logging. * */ #ifndef __UTRACE_H__ #define __UTRACE_H__ #include #include "unicode/utypes.h" /** * \file * \brief C API: Definitions for ICU tracing/logging. * * This provides API for debugging the internals of ICU without the use of * a traditional debugger. * * By default, tracing is disabled in ICU. If you need to debug ICU with * tracing, please compile ICU with the --enable-tracing configure option. */ U_CDECL_BEGIN /** * Trace severity levels. Higher levels increase the verbosity of the trace output. * @see utrace_setLevel * @stable ICU 2.8 */ typedef enum UTraceLevel { /** Disable all tracing @stable ICU 2.8*/ UTRACE_OFF=-1, /** Trace error conditions only @stable ICU 2.8*/ UTRACE_ERROR=0, /** Trace errors and warnings @stable ICU 2.8*/ UTRACE_WARNING=3, /** Trace opens and closes of ICU services @stable ICU 2.8*/ UTRACE_OPEN_CLOSE=5, /** Trace an intermediate number of ICU operations @stable ICU 2.8*/ UTRACE_INFO=7, /** Trace the maximum number of ICU operations @stable ICU 2.8*/ UTRACE_VERBOSE=9 } UTraceLevel; /** * These are the ICU functions that will be traced when tracing is enabled. * @stable ICU 2.8 */ typedef enum UTraceFunctionNumber { UTRACE_FUNCTION_START=0, UTRACE_U_INIT=UTRACE_FUNCTION_START, UTRACE_U_CLEANUP, UTRACE_FUNCTION_LIMIT, UTRACE_CONVERSION_START=0x1000, UTRACE_UCNV_OPEN=UTRACE_CONVERSION_START, UTRACE_UCNV_OPEN_PACKAGE, UTRACE_UCNV_OPEN_ALGORITHMIC, UTRACE_UCNV_CLONE, UTRACE_UCNV_CLOSE, UTRACE_UCNV_FLUSH_CACHE, UTRACE_UCNV_LOAD, UTRACE_UCNV_UNLOAD, UTRACE_CONVERSION_LIMIT, UTRACE_COLLATION_START=0x2000, UTRACE_UCOL_OPEN=UTRACE_COLLATION_START, UTRACE_UCOL_CLOSE, UTRACE_UCOL_STRCOLL, UTRACE_UCOL_GET_SORTKEY, UTRACE_UCOL_GETLOCALE, UTRACE_UCOL_NEXTSORTKEYPART, UTRACE_UCOL_STRCOLLITER, UTRACE_UCOL_OPEN_FROM_SHORT_STRING, UTRACE_COLLATION_LIMIT } UTraceFunctionNumber; /** * Setter for the trace level. * @param traceLevel A UTraceLevel value. * @stable ICU 2.8 */ U_STABLE void U_EXPORT2 utrace_setLevel(int32_t traceLevel); /** * Getter for the trace level. * @return The UTraceLevel value being used by ICU. * @stable ICU 2.8 */ U_STABLE int32_t U_EXPORT2 utrace_getLevel(void); /* Trace function pointers types ----------------------------- */ /** * Type signature for the trace function to be called when entering a function. * @param context value supplied at the time the trace functions are set. * @param fnNumber Enum value indicating the ICU function being entered. * @stable ICU 2.8 */ typedef void U_CALLCONV UTraceEntry(const void *context, int32_t fnNumber); /** * Type signature for the trace function to be called when exiting from a function. * @param context value supplied at the time the trace functions are set. * @param fnNumber Enum value indicating the ICU function being exited. * @param fmt A formatting string that describes the number and types * of arguments included with the variable args. The fmt * string has the same form as the utrace_vformat format * string. * @param args A variable arguments list. Contents are described by * the fmt parameter. * @see utrace_vformat * @stable ICU 2.8 */ typedef void U_CALLCONV UTraceExit(const void *context, int32_t fnNumber, const char *fmt, va_list args); /** * Type signature for the trace function to be called from within an ICU function * to display data or messages. * @param context value supplied at the time the trace functions are set. * @param fnNumber Enum value indicating the ICU function being exited. * @param level The current tracing level * @param fmt A format string describing the tracing data that is supplied * as variable args * @param args The data being traced, passed as variable args. * @stable ICU 2.8 */ typedef void U_CALLCONV UTraceData(const void *context, int32_t fnNumber, int32_t level, const char *fmt, va_list args); /** * Set ICU Tracing functions. Installs application-provided tracing * functions into ICU. After doing this, subsequent ICU operations * will call back to the installed functions, providing a trace * of the use of ICU. Passing a NULL pointer for a tracing function * is allowed, and inhibits tracing action at points where that function * would be called. *

* Tracing and Threads: Tracing functions are global to a process, and * will be called in response to ICU operations performed by any * thread. If tracing of an individual thread is desired, the * tracing functions must themselves filter by checking that the * current thread is the desired thread. * * @param context an uninterpretted pointer. Whatever is passed in * here will in turn be passed to each of the tracing * functions UTraceEntry, UTraceExit and UTraceData. * ICU does not use or alter this pointer. * @param e Callback function to be called on entry to a * a traced ICU function. * @param x Callback function to be called on exit from a * traced ICU function. * @param d Callback function to be called from within a * traced ICU function, for the purpose of providing * data to the trace. * * @stable ICU 2.8 */ U_STABLE void U_EXPORT2 utrace_setFunctions(const void *context, UTraceEntry *e, UTraceExit *x, UTraceData *d); /** * Get the currently installed ICU tracing functions. Note that a null function * pointer will be returned if no trace function has been set. * * @param context The currently installed tracing context. * @param e The currently installed UTraceEntry function. * @param x The currently installed UTraceExit function. * @param d The currently installed UTraceData function. * @stable ICU 2.8 */ U_STABLE void U_EXPORT2 utrace_getFunctions(const void **context, UTraceEntry **e, UTraceExit **x, UTraceData **d); /* * * ICU trace format string syntax * * Format Strings are passed to UTraceData functions, and define the * number and types of the trace data being passed on each call. * * The UTraceData function, which is supplied by the application, * not by ICU, can either forward the trace data (passed via * varargs) and the format string back to ICU for formatting into * a displayable string, or it can interpret the format itself, * and do as it wishes with the trace data. * * * Goals for the format string * - basic data output * - easy to use for trace programmer * - sufficient provision for data types for trace output readability * - well-defined types and binary portable APIs * * Non-goals * - printf compatibility * - fancy formatting * - argument reordering and other internationalization features * * ICU trace format strings contain plain text with argument inserts, * much like standard printf format strings. * Each insert begins with a '%', then optionally contains a 'v', * then exactly one type character. * Two '%' in a row represent a '%' instead of an insert. * The trace format strings need not have \n at the end. * * * Types * ----- * * Type characters: * - c A char character in the default codepage. * - s A NUL-terminated char * string in the default codepage. * - S A UChar * string. Requires two params, (ptr, length). Length=-1 for nul term. * - b A byte (8-bit integer). * - h A 16-bit integer. Also a 16 bit Unicode code unit. * - d A 32-bit integer. Also a 20 bit Unicode code point value. * - l A 64-bit integer. * - p A data pointer. * * Vectors * ------- * * If the 'v' is not specified, then one item of the specified type * is passed in. * If the 'v' (for "vector") is specified, then a vector of items of the * specified type is passed in, via a pointer to the first item * and an int32_t value for the length of the vector. * Length==-1 means zero or NUL termination. Works for vectors of all types. * * Note: %vS is a vector of (UChar *) strings. The strings must * be nul terminated as there is no way to provide a * separate length parameter for each string. The length * parameter (required for all vectors) is the number of * strings, not the length of the strings. * * Examples * -------- * * These examples show the parameters that will be passed to an application's * UTraceData() function for various formats. * * - the precise formatting is up to the application! * - the examples use type casts for arguments only to _show_ the types of * arguments without needing variable declarations in the examples; * the type casts will not be necessary in actual code * * UTraceDataFunc(context, fnNumber, level, * "There is a character %c in the string %s.", // Format String * (char)c, (const char *)s); // varargs parameters * -> There is a character 0x42 'B' in the string "Bravo". * * UTraceDataFunc(context, fnNumber, level, * "Vector of bytes %vb vector of chars %vc", * (const uint8_t *)bytes, (int32_t)bytesLength, * (const char *)chars, (int32_t)charsLength); * -> Vector of bytes * 42 63 64 3f [4] * vector of chars * "Bcd?"[4] * * UTraceDataFunc(context, fnNumber, level, * "An int32_t %d and a whole bunch of them %vd", * (int32_t)-5, (const int32_t *)ints, (int32_t)intsLength); * -> An int32_t 0xfffffffb and a whole bunch of them * fffffffb 00000005 0000010a [3] * */ /** * Trace output Formatter. An application's UTraceData tracing functions may call * back to this function to format the trace output in a * human readable form. Note that a UTraceData function may choose * to not format the data; it could, for example, save it in * in the raw form it was received (more compact), leaving * formatting for a later trace analyis tool. * @param outBuf pointer to a buffer to receive the formatted output. Output * will be nul terminated if there is space in the buffer - * if the length of the requested output < the output buffer size. * @param capacity Length of the output buffer. * @param indent Number of spaces to indent the output. Intended to allow * data displayed from nested functions to be indented for readability. * @param fmt Format specification for the data to output * @param args Data to be formatted. * @return Length of formatted output, including the terminating NUL. * If buffer capacity is insufficient, the required capacity is returned. * @stable ICU 2.8 */ U_STABLE int32_t U_EXPORT2 utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt, va_list args); /** * Trace output Formatter. An application's UTraceData tracing functions may call * this function to format any additional trace data, beyond that * provided by default, in human readable form with the same * formatting conventions used by utrace_vformat(). * @param outBuf pointer to a buffer to receive the formatted output. Output * will be nul terminated if there is space in the buffer - * if the length of the requested output < the output buffer size. * @param capacity Length of the output buffer. * @param indent Number of spaces to indent the output. Intended to allow * data displayed from nested functions to be indented for readability. * @param fmt Format specification for the data to output * @param ... Data to be formatted. * @return Length of formatted output, including the terminating NUL. * If buffer capacity is insufficient, the required capacity is returned. * @stable ICU 2.8 */ U_STABLE int32_t U_EXPORT2 utrace_format(char *outBuf, int32_t capacity, int32_t indent, const char *fmt, ...); /* Trace function numbers --------------------------------------------------- */ /** * Get the name of a function from its trace function number. * * @param fnNumber The trace number for an ICU function. * @return The name string for the function. * * @see UTraceFunctionNumber * @stable ICU 2.8 */ U_STABLE const char * U_EXPORT2 utrace_functionName(int32_t fnNumber); U_CDECL_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/ucnv_cb.h0000644000015700001700000001475312200324306024545 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (C) 2000-2004, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * ucnv_cb.h: * External APIs for the ICU's codeset conversion library * Helena Shih * * Modification History: * * Date Name Description */ /** * \file * \brief C UConverter functions to aid the writers of callbacks * *

Callback API for UConverter

* * These functions are provided here for the convenience of the callback * writer. If you are just looking for callback functions to use, please * see ucnv_err.h. DO NOT call these functions directly when you are * working with converters, unless your code has been called as a callback * via ucnv_setFromUCallback or ucnv_setToUCallback !! * * A note about error codes and overflow. Unlike other ICU functions, * these functions do not expect the error status to be U_ZERO_ERROR. * Callbacks must be much more careful about their error codes. * The error codes used here are in/out parameters, which should be passed * back in the callback's error parameter. * * For example, if you call ucnv_cbfromUWriteBytes to write data out * to the output codepage, it may return U_BUFFER_OVERFLOW_ERROR if * the data did not fit in the target. But this isn't a failing error, * in fact, ucnv_cbfromUWriteBytes may be called AGAIN with the error * status still U_BUFFER_OVERFLOW_ERROR to attempt to write further bytes, * which will also go into the internal overflow buffers. * * Concerning offsets, the 'offset' parameters here are relative to the start * of SOURCE. For example, Suppose the string "ABCD" was being converted * from Unicode into a codepage which doesn't have a mapping for 'B'. * 'A' will be written out correctly, but * The FromU Callback will be called on an unassigned character for 'B'. * At this point, this is the state of the world: * Target: A [..] [points after A] * Source: A B [C] D [points to C - B has been consumed] * 0 1 2 3 * codePoint = "B" [the unassigned codepoint] * * Now, suppose a callback wants to write the substitution character '?' to * the target. It calls ucnv_cbFromUWriteBytes() to write the ?. * It should pass ZERO as the offset, because the offset as far as the * callback is concerned is relative to the SOURCE pointer [which points * before 'C'.] If the callback goes into the args and consumes 'C' also, * it would call FromUWriteBytes with an offset of 1 (and advance the source * pointer). * */ #ifndef UCNV_CB_H #define UCNV_CB_H #include "unicode/utypes.h" #if !UCONFIG_NO_CONVERSION #include "unicode/ucnv.h" #include "unicode/ucnv_err.h" /** * ONLY used by FromU callback functions. * Writes out the specified byte output bytes to the target byte buffer or to converter internal buffers. * * @param args callback fromUnicode arguments * @param source source bytes to write * @param length length of bytes to write * @param offsetIndex the relative offset index from callback. * @param err error status. If U_BUFFER_OVERFLOW is returned, then U_BUFFER_OVERFLOW must * be returned to the user, because it means that not all data could be written into the target buffer, and some is * in the converter error buffer. * @see ucnv_cbFromUWriteSub * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_cbFromUWriteBytes (UConverterFromUnicodeArgs *args, const char* source, int32_t length, int32_t offsetIndex, UErrorCode * err); /** * ONLY used by FromU callback functions. * This function will write out the correct substitution character sequence * to the target. * * @param args callback fromUnicode arguments * @param offsetIndex the relative offset index from the current source pointer to be used * @param err error status. If U_BUFFER_OVERFLOW is returned, then U_BUFFER_OVERFLOW must * be returned to the user, because it means that not all data could be written into the target buffer, and some is * in the converter error buffer. * @see ucnv_cbFromUWriteBytes * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_cbFromUWriteSub (UConverterFromUnicodeArgs *args, int32_t offsetIndex, UErrorCode * err); /** * ONLY used by fromU callback functions. * This function will write out the error character(s) to the target UChar buffer. * * @param args callback fromUnicode arguments * @param source pointer to pointer to first UChar to write [on exit: 1 after last UChar processed] * @param sourceLimit pointer after last UChar to write * @param offsetIndex the relative offset index from callback which will be set * @param err error status U_BUFFER_OVERFLOW * @see ucnv_cbToUWriteSub * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_cbFromUWriteUChars(UConverterFromUnicodeArgs *args, const UChar** source, const UChar* sourceLimit, int32_t offsetIndex, UErrorCode * err); /** * ONLY used by ToU callback functions. * This function will write out the specified characters to the target * UChar buffer. * * @param args callback toUnicode arguments * @param source source string to write * @param length the length of source string * @param offsetIndex the relative offset index which will be written. * @param err error status U_BUFFER_OVERFLOW * @see ucnv_cbToUWriteSub * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_cbToUWriteUChars (UConverterToUnicodeArgs *args, const UChar* source, int32_t length, int32_t offsetIndex, UErrorCode * err); /** * ONLY used by ToU callback functions. * This function will write out the Unicode substitution character (U+FFFD). * * @param args callback fromUnicode arguments * @param offsetIndex the relative offset index from callback. * @param err error status U_BUFFER_OVERFLOW * @see ucnv_cbToUWriteUChars * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_cbToUWriteSub (UConverterToUnicodeArgs *args, int32_t offsetIndex, UErrorCode * err); #endif #endif android-audiosystem-1.8+13.10.20130807/include/unicode/uniset.h0000644000015700001700000017475512200324306024446 0ustar pbuserpbgroup00000000000000/* *************************************************************************** * Copyright (C) 1999-2010, International Business Machines Corporation * and others. All Rights Reserved. *************************************************************************** * Date Name Description * 10/20/99 alan Creation. *************************************************************************** */ #ifndef UNICODESET_H #define UNICODESET_H #include "unicode/unifilt.h" #include "unicode/unistr.h" #include "unicode/uset.h" /** * \file * \brief C++ API: Unicode Set */ U_NAMESPACE_BEGIN class BMPSet; class ParsePosition; class SymbolTable; class UnicodeSetStringSpan; class UVector; class RuleCharacterIterator; /** * A mutable set of Unicode characters and multicharacter strings. Objects of this class * represent character classes used in regular expressions. * A character specifies a subset of Unicode code points. Legal * code points are U+0000 to U+10FFFF, inclusive. * *

The UnicodeSet class is not designed to be subclassed. * *

UnicodeSet supports two APIs. The first is the * operand API that allows the caller to modify the value of * a UnicodeSet object. It conforms to Java 2's * java.util.Set interface, although * UnicodeSet does not actually implement that * interface. All methods of Set are supported, with the * modification that they take a character range or single character * instead of an Object, and they take a * UnicodeSet instead of a Collection. The * operand API may be thought of in terms of boolean logic: a boolean * OR is implemented by add, a boolean AND is implemented * by retain, a boolean XOR is implemented by * complement taking an argument, and a boolean NOT is * implemented by complement with no argument. In terms * of traditional set theory function names, add is a * union, retain is an intersection, remove * is an asymmetric difference, and complement with no * argument is a set complement with respect to the superset range * MIN_VALUE-MAX_VALUE * *

The second API is the * applyPattern()/toPattern() API from the * java.text.Format-derived classes. Unlike the * methods that add characters, add categories, and control the logic * of the set, the method applyPattern() sets all * attributes of a UnicodeSet at once, based on a * string pattern. * *

Pattern syntax

* * Patterns are accepted by the constructors and the * applyPattern() methods and returned by the * toPattern() method. These patterns follow a syntax * similar to that employed by version 8 regular expression character * classes. Here are some simple examples: * * \htmlonly
\endhtmlonly * * * * * * * * * * * * * * * * * * * * * * * * * * * *
[]No characters
[a]The character 'a'
[ae]The characters 'a' and 'e'
[a-e]The characters 'a' through 'e' inclusive, in Unicode code * point order
[\\u4E01]The character U+4E01
[a{ab}{ac}]The character 'a' and the multicharacter strings "ab" and * "ac"
[\\p{Lu}]All characters in the general category Uppercase Letter
* \htmlonly
\endhtmlonly * * Any character may be preceded by a backslash in order to remove any special * meaning. White space characters, as defined by UCharacter.isWhitespace(), are * ignored, unless they are escaped. * *

Property patterns specify a set of characters having a certain * property as defined by the Unicode standard. Both the POSIX-like * "[:Lu:]" and the Perl-like syntax "\\p{Lu}" are recognized. For a * complete list of supported property patterns, see the User's Guide * for UnicodeSet at * * http://icu-project.org/userguide/unicodeSet.html. * Actual determination of property data is defined by the underlying * Unicode database as implemented by UCharacter. * *

Patterns specify individual characters, ranges of characters, and * Unicode property sets. When elements are concatenated, they * specify their union. To complement a set, place a '^' immediately * after the opening '['. Property patterns are inverted by modifying * their delimiters; "[:^foo]" and "\\P{foo}". In any other location, * '^' has no special meaning. * *

Ranges are indicated by placing two a '-' between two * characters, as in "a-z". This specifies the range of all * characters from the left to the right, in Unicode order. If the * left character is greater than or equal to the * right character it is a syntax error. If a '-' occurs as the first * character after the opening '[' or '[^', or if it occurs as the * last character before the closing ']', then it is taken as a * literal. Thus "[a\-b]", "[-ab]", and "[ab-]" all indicate the same * set of three characters, 'a', 'b', and '-'. * *

Sets may be intersected using the '&' operator or the asymmetric * set difference may be taken using the '-' operator, for example, * "[[:L:]&[\\u0000-\\u0FFF]]" indicates the set of all Unicode letters * with values less than 4096. Operators ('&' and '|') have equal * precedence and bind left-to-right. Thus * "[[:L:]-[a-z]-[\\u0100-\\u01FF]]" is equivalent to * "[[[:L:]-[a-z]]-[\\u0100-\\u01FF]]". This only really matters for * difference; intersection is commutative. * * *
[a]The set containing 'a' *
[a-z]The set containing 'a' * through 'z' and all letters in between, in Unicode order *
[^a-z]The set containing * all characters but 'a' through 'z', * that is, U+0000 through 'a'-1 and 'z'+1 through U+10FFFF *
[[pat1][pat2]] * The union of sets specified by pat1 and pat2 *
[[pat1]&[pat2]] * The intersection of sets specified by pat1 and pat2 *
[[pat1]-[pat2]] * The asymmetric difference of sets specified by pat1 and * pat2 *
[:Lu:] or \\p{Lu} * The set of characters having the specified * Unicode property; in * this case, Unicode uppercase letters *
[:^Lu:] or \\P{Lu} * The set of characters not having the given * Unicode property *
* *

Warning: you cannot add an empty string ("") to a UnicodeSet.

* *

Formal syntax

* * \htmlonly
\endhtmlonly * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
pattern :=  ('[' '^'? item* ']') | * property
item :=  char | (char '-' char) | pattern-expr
*
pattern-expr :=  pattern | pattern-expr pattern | * pattern-expr op pattern
*
op :=  '&' | '-'
*
special :=  '[' | ']' | '-'
*
char :=  any character that is not special
* | ('\'
any character)
* | ('\\u' hex hex hex hex)
*
hex :=  any character for which * Character.digit(c, 16) * returns a non-negative result
property :=  a Unicode property set pattern
*
* * * * *
Legend: * * * * * * * * * * * * * * * * * * * * * * * * * *
a := b  a may be replaced by b
a?zero or one instance of a
*
a*one or more instances of a
*
a | beither a or b
*
'a'the literal string between the quotes
*
* \htmlonly
\endhtmlonly * *

Note: * - Most UnicodeSet methods do not take a UErrorCode parameter because * there are usually very few opportunities for failure other than a shortage * of memory, error codes in low-level C++ string methods would be inconvenient, * and the error code as the last parameter (ICU convention) would prevent * the use of default parameter values. * Instead, such methods set the UnicodeSet into a "bogus" state * (see isBogus()) if an error occurs. * * @author Alan Liu * @stable ICU 2.0 */ class U_COMMON_API UnicodeSet : public UnicodeFilter { int32_t len; // length of list used; 0 <= len <= capacity int32_t capacity; // capacity of list UChar32* list; // MUST be terminated with HIGH BMPSet *bmpSet; // The set is frozen iff either bmpSet or stringSpan is not NULL. UChar32* buffer; // internal buffer, may be NULL int32_t bufferCapacity; // capacity of buffer int32_t patLen; /** * The pattern representation of this set. This may not be the * most economical pattern. It is the pattern supplied to * applyPattern(), with variables substituted and whitespace * removed. For sets constructed without applyPattern(), or * modified using the non-pattern API, this string will be empty, * indicating that toPattern() must generate a pattern * representation from the inversion list. */ UChar *pat; UVector* strings; // maintained in sorted order UnicodeSetStringSpan *stringSpan; private: enum { // constants kIsBogus = 1 // This set is bogus (i.e. not valid) }; uint8_t fFlags; // Bit flag (see constants above) public: /** * Determine if this object contains a valid set. * A bogus set has no value. It is different from an empty set. * It can be used to indicate that no set value is available. * * @return TRUE if the set is valid, FALSE otherwise * @see setToBogus() * @stable ICU 4.0 */ inline UBool isBogus(void) const; /** * Make this UnicodeSet object invalid. * The string will test TRUE with isBogus(). * * A bogus set has no value. It is different from an empty set. * It can be used to indicate that no set value is available. * * This utility function is used throughout the UnicodeSet * implementation to indicate that a UnicodeSet operation failed, * and may be used in other functions, * especially but not exclusively when such functions do not * take a UErrorCode for simplicity. * * @see isBogus() * @stable ICU 4.0 */ void setToBogus(); public: enum { /** * Minimum value that can be stored in a UnicodeSet. * @stable ICU 2.4 */ MIN_VALUE = 0, /** * Maximum value that can be stored in a UnicodeSet. * @stable ICU 2.4 */ MAX_VALUE = 0x10ffff }; //---------------------------------------------------------------- // Constructors &c //---------------------------------------------------------------- public: /** * Constructs an empty set. * @stable ICU 2.0 */ UnicodeSet(); /** * Constructs a set containing the given range. If end > * start then an empty set is created. * * @param start first character, inclusive, of range * @param end last character, inclusive, of range * @stable ICU 2.4 */ UnicodeSet(UChar32 start, UChar32 end); /** * Constructs a set from the given pattern. See the class * description for the syntax of the pattern language. * @param pattern a string specifying what characters are in the set * @param status returns U_ILLEGAL_ARGUMENT_ERROR if the pattern * contains a syntax error. * @stable ICU 2.0 */ UnicodeSet(const UnicodeString& pattern, UErrorCode& status); /** * Constructs a set from the given pattern. See the class * description for the syntax of the pattern language. * @param pattern a string specifying what characters are in the set * @param options bitmask for options to apply to the pattern. * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. * @param symbols a symbol table mapping variable names to values * and stand-in characters to UnicodeSets; may be NULL * @param status returns U_ILLEGAL_ARGUMENT_ERROR if the pattern * contains a syntax error. * @internal */ UnicodeSet(const UnicodeString& pattern, uint32_t options, const SymbolTable* symbols, UErrorCode& status); /** * Constructs a set from the given pattern. See the class description * for the syntax of the pattern language. * @param pattern a string specifying what characters are in the set * @param pos on input, the position in pattern at which to start parsing. * On output, the position after the last character parsed. * @param options bitmask for options to apply to the pattern. * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. * @param symbols a symbol table mapping variable names to values * and stand-in characters to UnicodeSets; may be NULL * @param status input-output error code * @stable ICU 2.8 */ UnicodeSet(const UnicodeString& pattern, ParsePosition& pos, uint32_t options, const SymbolTable* symbols, UErrorCode& status); /** * Constructs a set that is identical to the given UnicodeSet. * @stable ICU 2.0 */ UnicodeSet(const UnicodeSet& o); /** * Destructs the set. * @stable ICU 2.0 */ virtual ~UnicodeSet(); /** * Assigns this object to be a copy of another. * A frozen set will not be modified. * @stable ICU 2.0 */ UnicodeSet& operator=(const UnicodeSet& o); /** * Compares the specified object with this set for equality. Returns * true if the two sets * have the same size, and every member of the specified set is * contained in this set (or equivalently, every member of this set is * contained in the specified set). * * @param o set to be compared for equality with this set. * @return true if the specified set is equal to this set. * @stable ICU 2.0 */ virtual UBool operator==(const UnicodeSet& o) const; /** * Compares the specified object with this set for equality. Returns * true if the specified set is not equal to this set. * @stable ICU 2.0 */ UBool operator!=(const UnicodeSet& o) const; /** * Returns a copy of this object. All UnicodeFunctor objects have * to support cloning in order to allow classes using * UnicodeFunctors, such as Transliterator, to implement cloning. * If this set is frozen, then the clone will be frozen as well. * Use cloneAsThawed() for a mutable clone of a frozen set. * @see cloneAsThawed * @stable ICU 2.0 */ virtual UnicodeFunctor* clone() const; /** * Returns the hash code value for this set. * * @return the hash code value for this set. * @see Object#hashCode() * @stable ICU 2.0 */ virtual int32_t hashCode(void) const; /** * Get a UnicodeSet pointer from a USet * * @param uset a USet (the ICU plain C type for UnicodeSet) * @return the corresponding UnicodeSet pointer. * * @stable ICU 4.2 */ inline static UnicodeSet *fromUSet(USet *uset); /** * Get a UnicodeSet pointer from a const USet * * @param uset a const USet (the ICU plain C type for UnicodeSet) * @return the corresponding UnicodeSet pointer. * * @stable ICU 4.2 */ inline static const UnicodeSet *fromUSet(const USet *uset); /** * Produce a USet * pointer for this UnicodeSet. * USet is the plain C type for UnicodeSet * * @return a USet pointer for this UnicodeSet * @stable ICU 4.2 */ inline USet *toUSet(); /** * Produce a const USet * pointer for this UnicodeSet. * USet is the plain C type for UnicodeSet * * @return a const USet pointer for this UnicodeSet * @stable ICU 4.2 */ inline const USet * toUSet() const; //---------------------------------------------------------------- // Freezable API //---------------------------------------------------------------- /** * Determines whether the set has been frozen (made immutable) or not. * See the ICU4J Freezable interface for details. * @return TRUE/FALSE for whether the set has been frozen * @see freeze * @see cloneAsThawed * @stable ICU 3.8 */ inline UBool isFrozen() const; /** * Freeze the set (make it immutable). * Once frozen, it cannot be unfrozen and is therefore thread-safe * until it is deleted. * See the ICU4J Freezable interface for details. * Freezing the set may also make some operations faster, for example * contains() and span(). * A frozen set will not be modified. (It remains frozen.) * @return this set. * @see isFrozen * @see cloneAsThawed * @stable ICU 3.8 */ UnicodeFunctor *freeze(); /** * Clone the set and make the clone mutable. * See the ICU4J Freezable interface for details. * @return the mutable clone * @see freeze * @see isFrozen * @stable ICU 3.8 */ UnicodeFunctor *cloneAsThawed() const; //---------------------------------------------------------------- // Public API //---------------------------------------------------------------- /** * Make this object represent the range start - end. * If end > start then this object is set to an * an empty range. * A frozen set will not be modified. * * @param start first character in the set, inclusive * @param end last character in the set, inclusive * @stable ICU 2.4 */ UnicodeSet& set(UChar32 start, UChar32 end); /** * Return true if the given position, in the given pattern, appears * to be the start of a UnicodeSet pattern. * @stable ICU 2.4 */ static UBool resemblesPattern(const UnicodeString& pattern, int32_t pos); /** * Modifies this set to represent the set specified by the given * pattern, optionally ignoring white space. See the class * description for the syntax of the pattern language. * A frozen set will not be modified. * @param pattern a string specifying what characters are in the set * @param status returns U_ILLEGAL_ARGUMENT_ERROR if the pattern * contains a syntax error. * Empties the set passed before applying the pattern. * @return a reference to this * @stable ICU 2.0 */ UnicodeSet& applyPattern(const UnicodeString& pattern, UErrorCode& status); /** * Modifies this set to represent the set specified by the given * pattern, optionally ignoring white space. See the class * description for the syntax of the pattern language. * A frozen set will not be modified. * @param pattern a string specifying what characters are in the set * @param options bitmask for options to apply to the pattern. * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. * @param symbols a symbol table mapping variable names to * values and stand-ins to UnicodeSets; may be NULL * @param status returns U_ILLEGAL_ARGUMENT_ERROR if the pattern * contains a syntax error. * Empties the set passed before applying the pattern. * @return a reference to this * @internal */ UnicodeSet& applyPattern(const UnicodeString& pattern, uint32_t options, const SymbolTable* symbols, UErrorCode& status); /** * Parses the given pattern, starting at the given position. The * character at pattern.charAt(pos.getIndex()) must be '[', or the * parse fails. Parsing continues until the corresponding closing * ']'. If a syntax error is encountered between the opening and * closing brace, the parse fails. Upon return from a successful * parse, the ParsePosition is updated to point to the character * following the closing ']', and a StringBuffer containing a * pairs list for the parsed pattern is returned. This method calls * itself recursively to parse embedded subpatterns. * Empties the set passed before applying the pattern. * A frozen set will not be modified. * * @param pattern the string containing the pattern to be parsed. * The portion of the string from pos.getIndex(), which must be a * '[', to the corresponding closing ']', is parsed. * @param pos upon entry, the position at which to being parsing. * The character at pattern.charAt(pos.getIndex()) must be a '['. * Upon return from a successful parse, pos.getIndex() is either * the character after the closing ']' of the parsed pattern, or * pattern.length() if the closing ']' is the last character of * the pattern string. * @param options bitmask for options to apply to the pattern. * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. * @param symbols a symbol table mapping variable names to * values and stand-ins to UnicodeSets; may be NULL * @param status returns U_ILLEGAL_ARGUMENT_ERROR if the pattern * contains a syntax error. * @return a reference to this * @stable ICU 2.8 */ UnicodeSet& applyPattern(const UnicodeString& pattern, ParsePosition& pos, uint32_t options, const SymbolTable* symbols, UErrorCode& status); /** * Returns a string representation of this set. If the result of * calling this function is passed to a UnicodeSet constructor, it * will produce another set that is equal to this one. * A frozen set will not be modified. * @param result the string to receive the rules. Previous * contents will be deleted. * @param escapeUnprintable if TRUE then convert unprintable * character to their hex escape representations, \\uxxxx or * \\Uxxxxxxxx. Unprintable characters are those other than * U+000A, U+0020..U+007E. * @stable ICU 2.0 */ virtual UnicodeString& toPattern(UnicodeString& result, UBool escapeUnprintable = FALSE) const; /** * Modifies this set to contain those code points which have the given value * for the given binary or enumerated property, as returned by * u_getIntPropertyValue. Prior contents of this set are lost. * A frozen set will not be modified. * * @param prop a property in the range UCHAR_BIN_START..UCHAR_BIN_LIMIT-1 * or UCHAR_INT_START..UCHAR_INT_LIMIT-1 * or UCHAR_MASK_START..UCHAR_MASK_LIMIT-1. * * @param value a value in the range u_getIntPropertyMinValue(prop).. * u_getIntPropertyMaxValue(prop), with one exception. If prop is * UCHAR_GENERAL_CATEGORY_MASK, then value should not be a UCharCategory, but * rather a mask value produced by U_GET_GC_MASK(). This allows grouped * categories such as [:L:] to be represented. * * @param ec error code input/output parameter * * @return a reference to this set * * @stable ICU 2.4 */ UnicodeSet& applyIntPropertyValue(UProperty prop, int32_t value, UErrorCode& ec); /** * Modifies this set to contain those code points which have the * given value for the given property. Prior contents of this * set are lost. * A frozen set will not be modified. * * @param prop a property alias, either short or long. The name is matched * loosely. See PropertyAliases.txt for names and a description of loose * matching. If the value string is empty, then this string is interpreted * as either a General_Category value alias, a Script value alias, a binary * property alias, or a special ID. Special IDs are matched loosely and * correspond to the following sets: * * "ANY" = [\\u0000-\\U0010FFFF], * "ASCII" = [\\u0000-\\u007F], * "Assigned" = [:^Cn:]. * * @param value a value alias, either short or long. The name is matched * loosely. See PropertyValueAliases.txt for names and a description of * loose matching. In addition to aliases listed, numeric values and * canonical combining classes may be expressed numerically, e.g., ("nv", * "0.5") or ("ccc", "220"). The value string may also be empty. * * @param ec error code input/output parameter * * @return a reference to this set * * @stable ICU 2.4 */ UnicodeSet& applyPropertyAlias(const UnicodeString& prop, const UnicodeString& value, UErrorCode& ec); /** * Returns the number of elements in this set (its cardinality). * Note than the elements of a set may include both individual * codepoints and strings. * * @return the number of elements in this set (its cardinality). * @stable ICU 2.0 */ virtual int32_t size(void) const; /** * Returns true if this set contains no elements. * * @return true if this set contains no elements. * @stable ICU 2.0 */ virtual UBool isEmpty(void) const; /** * Returns true if this set contains the given character. * This function works faster with a frozen set. * @param c character to be checked for containment * @return true if the test condition is met * @stable ICU 2.0 */ virtual UBool contains(UChar32 c) const; /** * Returns true if this set contains every character * of the given range. * @param start first character, inclusive, of the range * @param end last character, inclusive, of the range * @return true if the test condition is met * @stable ICU 2.0 */ virtual UBool contains(UChar32 start, UChar32 end) const; /** * Returns true if this set contains the given * multicharacter string. * @param s string to be checked for containment * @return true if this set contains the specified string * @stable ICU 2.4 */ UBool contains(const UnicodeString& s) const; /** * Returns true if this set contains all the characters and strings * of the given set. * @param c set to be checked for containment * @return true if the test condition is met * @stable ICU 2.4 */ virtual UBool containsAll(const UnicodeSet& c) const; /** * Returns true if this set contains all the characters * of the given string. * @param s string containing characters to be checked for containment * @return true if the test condition is met * @stable ICU 2.4 */ UBool containsAll(const UnicodeString& s) const; /** * Returns true if this set contains none of the characters * of the given range. * @param start first character, inclusive, of the range * @param end last character, inclusive, of the range * @return true if the test condition is met * @stable ICU 2.4 */ UBool containsNone(UChar32 start, UChar32 end) const; /** * Returns true if this set contains none of the characters and strings * of the given set. * @param c set to be checked for containment * @return true if the test condition is met * @stable ICU 2.4 */ UBool containsNone(const UnicodeSet& c) const; /** * Returns true if this set contains none of the characters * of the given string. * @param s string containing characters to be checked for containment * @return true if the test condition is met * @stable ICU 2.4 */ UBool containsNone(const UnicodeString& s) const; /** * Returns true if this set contains one or more of the characters * in the given range. * @param start first character, inclusive, of the range * @param end last character, inclusive, of the range * @return true if the condition is met * @stable ICU 2.4 */ inline UBool containsSome(UChar32 start, UChar32 end) const; /** * Returns true if this set contains one or more of the characters * and strings of the given set. * @param s The set to be checked for containment * @return true if the condition is met * @stable ICU 2.4 */ inline UBool containsSome(const UnicodeSet& s) const; /** * Returns true if this set contains one or more of the characters * of the given string. * @param s string containing characters to be checked for containment * @return true if the condition is met * @stable ICU 2.4 */ inline UBool containsSome(const UnicodeString& s) const; /** * Returns the length of the initial substring of the input string which * consists only of characters and strings that are contained in this set * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), * or only of characters and strings that are not contained * in this set (USET_SPAN_NOT_CONTAINED). * See USetSpanCondition for details. * Similar to the strspn() C library function. * Unpaired surrogates are treated according to contains() of their surrogate code points. * This function works faster with a frozen set and with a non-negative string length argument. * @param s start of the string * @param length of the string; can be -1 for NUL-terminated * @param spanCondition specifies the containment condition * @return the length of the initial substring according to the spanCondition; * 0 if the start of the string does not fit the spanCondition * @stable ICU 3.8 * @see USetSpanCondition */ int32_t span(const UChar *s, int32_t length, USetSpanCondition spanCondition) const; /** * Returns the end of the substring of the input string according to the USetSpanCondition. * Same as start+span(s.getBuffer()+start, s.length()-start, spanCondition) * after pinning start to 0<=start<=s.length(). * @param s the string * @param start the start index in the string for the span operation * @param spanCondition specifies the containment condition * @return the exclusive end of the substring according to the spanCondition; * the substring s.tempSubStringBetween(start, end) fulfills the spanCondition * @stable ICU 4.4 * @see USetSpanCondition */ inline int32_t span(const UnicodeString &s, int32_t start, USetSpanCondition spanCondition) const; /** * Returns the start of the trailing substring of the input string which * consists only of characters and strings that are contained in this set * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), * or only of characters and strings that are not contained * in this set (USET_SPAN_NOT_CONTAINED). * See USetSpanCondition for details. * Unpaired surrogates are treated according to contains() of their surrogate code points. * This function works faster with a frozen set and with a non-negative string length argument. * @param s start of the string * @param length of the string; can be -1 for NUL-terminated * @param spanCondition specifies the containment condition * @return the start of the trailing substring according to the spanCondition; * the string length if the end of the string does not fit the spanCondition * @stable ICU 3.8 * @see USetSpanCondition */ int32_t spanBack(const UChar *s, int32_t length, USetSpanCondition spanCondition) const; /** * Returns the start of the substring of the input string according to the USetSpanCondition. * Same as spanBack(s.getBuffer(), limit, spanCondition) * after pinning limit to 0<=end<=s.length(). * @param s the string * @param limit the exclusive-end index in the string for the span operation * (use s.length() or INT32_MAX for spanning back from the end of the string) * @param spanCondition specifies the containment condition * @return the start of the substring according to the spanCondition; * the substring s.tempSubStringBetween(start, limit) fulfills the spanCondition * @stable ICU 4.4 * @see USetSpanCondition */ inline int32_t spanBack(const UnicodeString &s, int32_t limit, USetSpanCondition spanCondition) const; /** * Returns the length of the initial substring of the input string which * consists only of characters and strings that are contained in this set * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), * or only of characters and strings that are not contained * in this set (USET_SPAN_NOT_CONTAINED). * See USetSpanCondition for details. * Similar to the strspn() C library function. * Malformed byte sequences are treated according to contains(0xfffd). * This function works faster with a frozen set and with a non-negative string length argument. * @param s start of the string (UTF-8) * @param length of the string; can be -1 for NUL-terminated * @param spanCondition specifies the containment condition * @return the length of the initial substring according to the spanCondition; * 0 if the start of the string does not fit the spanCondition * @stable ICU 3.8 * @see USetSpanCondition */ int32_t spanUTF8(const char *s, int32_t length, USetSpanCondition spanCondition) const; /** * Returns the start of the trailing substring of the input string which * consists only of characters and strings that are contained in this set * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), * or only of characters and strings that are not contained * in this set (USET_SPAN_NOT_CONTAINED). * See USetSpanCondition for details. * Malformed byte sequences are treated according to contains(0xfffd). * This function works faster with a frozen set and with a non-negative string length argument. * @param s start of the string (UTF-8) * @param length of the string; can be -1 for NUL-terminated * @param spanCondition specifies the containment condition * @return the start of the trailing substring according to the spanCondition; * the string length if the end of the string does not fit the spanCondition * @stable ICU 3.8 * @see USetSpanCondition */ int32_t spanBackUTF8(const char *s, int32_t length, USetSpanCondition spanCondition) const; /** * Implement UnicodeMatcher::matches() * @stable ICU 2.4 */ virtual UMatchDegree matches(const Replaceable& text, int32_t& offset, int32_t limit, UBool incremental); private: /** * Returns the longest match for s in text at the given position. * If limit > start then match forward from start+1 to limit * matching all characters except s.charAt(0). If limit < start, * go backward starting from start-1 matching all characters * except s.charAt(s.length()-1). This method assumes that the * first character, text.charAt(start), matches s, so it does not * check it. * @param text the text to match * @param start the first character to match. In the forward * direction, text.charAt(start) is matched against s.charAt(0). * In the reverse direction, it is matched against * s.charAt(s.length()-1). * @param limit the limit offset for matching, either last+1 in * the forward direction, or last-1 in the reverse direction, * where last is the index of the last character to match. * @return If part of s matches up to the limit, return |limit - * start|. If all of s matches before reaching the limit, return * s.length(). If there is a mismatch between s and text, return * 0 */ static int32_t matchRest(const Replaceable& text, int32_t start, int32_t limit, const UnicodeString& s); /** * Returns the smallest value i such that c < list[i]. Caller * must ensure that c is a legal value or this method will enter * an infinite loop. This method performs a binary search. * @param c a character in the range MIN_VALUE..MAX_VALUE * inclusive * @return the smallest integer i in the range 0..len-1, * inclusive, such that c < list[i] */ int32_t findCodePoint(UChar32 c) const; public: /** * Implementation of UnicodeMatcher API. Union the set of all * characters that may be matched by this object into the given * set. * @param toUnionTo the set into which to union the source characters * @stable ICU 2.4 */ virtual void addMatchSetTo(UnicodeSet& toUnionTo) const; /** * Returns the index of the given character within this set, where * the set is ordered by ascending code point. If the character * is not in this set, return -1. The inverse of this method is * charAt(). * @return an index from 0..size()-1, or -1 * @stable ICU 2.4 */ int32_t indexOf(UChar32 c) const; /** * Returns the character at the given index within this set, where * the set is ordered by ascending code point. If the index is * out of range, return (UChar32)-1. The inverse of this method is * indexOf(). * @param index an index from 0..size()-1 * @return the character at the given index, or (UChar32)-1. * @stable ICU 2.4 */ UChar32 charAt(int32_t index) const; /** * Adds the specified range to this set if it is not already * present. If this set already contains the specified range, * the call leaves this set unchanged. If end > start * then an empty range is added, leaving the set unchanged. * This is equivalent to a boolean logic OR, or a set UNION. * A frozen set will not be modified. * * @param start first character, inclusive, of range to be added * to this set. * @param end last character, inclusive, of range to be added * to this set. * @stable ICU 2.0 */ virtual UnicodeSet& add(UChar32 start, UChar32 end); /** * Adds the specified character to this set if it is not already * present. If this set already contains the specified character, * the call leaves this set unchanged. * A frozen set will not be modified. * @stable ICU 2.0 */ UnicodeSet& add(UChar32 c); /** * Adds the specified multicharacter to this set if it is not already * present. If this set already contains the multicharacter, * the call leaves this set unchanged. * Thus "ch" => {"ch"} *
Warning: you cannot add an empty string ("") to a UnicodeSet. * A frozen set will not be modified. * @param s the source string * @return this object, for chaining * @stable ICU 2.4 */ UnicodeSet& add(const UnicodeString& s); private: /** * @return a code point IF the string consists of a single one. * otherwise returns -1. * @param s string to test */ static int32_t getSingleCP(const UnicodeString& s); void _add(const UnicodeString& s); public: /** * Adds each of the characters in this string to the set. Thus "ch" => {"c", "h"} * If this set already any particular character, it has no effect on that character. * A frozen set will not be modified. * @param s the source string * @return this object, for chaining * @stable ICU 2.4 */ UnicodeSet& addAll(const UnicodeString& s); /** * Retains EACH of the characters in this string. Note: "ch" == {"c", "h"} * If this set already any particular character, it has no effect on that character. * A frozen set will not be modified. * @param s the source string * @return this object, for chaining * @stable ICU 2.4 */ UnicodeSet& retainAll(const UnicodeString& s); /** * Complement EACH of the characters in this string. Note: "ch" == {"c", "h"} * If this set already any particular character, it has no effect on that character. * A frozen set will not be modified. * @param s the source string * @return this object, for chaining * @stable ICU 2.4 */ UnicodeSet& complementAll(const UnicodeString& s); /** * Remove EACH of the characters in this string. Note: "ch" == {"c", "h"} * If this set already any particular character, it has no effect on that character. * A frozen set will not be modified. * @param s the source string * @return this object, for chaining * @stable ICU 2.4 */ UnicodeSet& removeAll(const UnicodeString& s); /** * Makes a set from a multicharacter string. Thus "ch" => {"ch"} *
Warning: you cannot add an empty string ("") to a UnicodeSet. * @param s the source string * @return a newly created set containing the given string. * The caller owns the return object and is responsible for deleting it. * @stable ICU 2.4 */ static UnicodeSet* U_EXPORT2 createFrom(const UnicodeString& s); /** * Makes a set from each of the characters in the string. Thus "ch" => {"c", "h"} * @param s the source string * @return a newly created set containing the given characters * The caller owns the return object and is responsible for deleting it. * @stable ICU 2.4 */ static UnicodeSet* U_EXPORT2 createFromAll(const UnicodeString& s); /** * Retain only the elements in this set that are contained in the * specified range. If end > start then an empty range is * retained, leaving the set empty. This is equivalent to * a boolean logic AND, or a set INTERSECTION. * A frozen set will not be modified. * * @param start first character, inclusive, of range to be retained * to this set. * @param end last character, inclusive, of range to be retained * to this set. * @stable ICU 2.0 */ virtual UnicodeSet& retain(UChar32 start, UChar32 end); /** * Retain the specified character from this set if it is present. * A frozen set will not be modified. * @stable ICU 2.0 */ UnicodeSet& retain(UChar32 c); /** * Removes the specified range from this set if it is present. * The set will not contain the specified range once the call * returns. If end > start then an empty range is * removed, leaving the set unchanged. * A frozen set will not be modified. * * @param start first character, inclusive, of range to be removed * from this set. * @param end last character, inclusive, of range to be removed * from this set. * @stable ICU 2.0 */ virtual UnicodeSet& remove(UChar32 start, UChar32 end); /** * Removes the specified character from this set if it is present. * The set will not contain the specified range once the call * returns. * A frozen set will not be modified. * @stable ICU 2.0 */ UnicodeSet& remove(UChar32 c); /** * Removes the specified string from this set if it is present. * The set will not contain the specified character once the call * returns. * A frozen set will not be modified. * @param s the source string * @return this object, for chaining * @stable ICU 2.4 */ UnicodeSet& remove(const UnicodeString& s); /** * Inverts this set. This operation modifies this set so that * its value is its complement. This is equivalent to * complement(MIN_VALUE, MAX_VALUE). * A frozen set will not be modified. * @stable ICU 2.0 */ virtual UnicodeSet& complement(void); /** * Complements the specified range in this set. Any character in * the range will be removed if it is in this set, or will be * added if it is not in this set. If end > start * then an empty range is complemented, leaving the set unchanged. * This is equivalent to a boolean logic XOR. * A frozen set will not be modified. * * @param start first character, inclusive, of range to be removed * from this set. * @param end last character, inclusive, of range to be removed * from this set. * @stable ICU 2.0 */ virtual UnicodeSet& complement(UChar32 start, UChar32 end); /** * Complements the specified character in this set. The character * will be removed if it is in this set, or will be added if it is * not in this set. * A frozen set will not be modified. * @stable ICU 2.0 */ UnicodeSet& complement(UChar32 c); /** * Complement the specified string in this set. * The set will not contain the specified string once the call * returns. *
Warning: you cannot add an empty string ("") to a UnicodeSet. * A frozen set will not be modified. * @param s the string to complement * @return this object, for chaining * @stable ICU 2.4 */ UnicodeSet& complement(const UnicodeString& s); /** * Adds all of the elements in the specified set to this set if * they're not already present. This operation effectively * modifies this set so that its value is the union of the two * sets. The behavior of this operation is unspecified if the specified * collection is modified while the operation is in progress. * A frozen set will not be modified. * * @param c set whose elements are to be added to this set. * @see #add(UChar32, UChar32) * @stable ICU 2.0 */ virtual UnicodeSet& addAll(const UnicodeSet& c); /** * Retains only the elements in this set that are contained in the * specified set. In other words, removes from this set all of * its elements that are not contained in the specified set. This * operation effectively modifies this set so that its value is * the intersection of the two sets. * A frozen set will not be modified. * * @param c set that defines which elements this set will retain. * @stable ICU 2.0 */ virtual UnicodeSet& retainAll(const UnicodeSet& c); /** * Removes from this set all of its elements that are contained in the * specified set. This operation effectively modifies this * set so that its value is the asymmetric set difference of * the two sets. * A frozen set will not be modified. * * @param c set that defines which elements will be removed from * this set. * @stable ICU 2.0 */ virtual UnicodeSet& removeAll(const UnicodeSet& c); /** * Complements in this set all elements contained in the specified * set. Any character in the other set will be removed if it is * in this set, or will be added if it is not in this set. * A frozen set will not be modified. * * @param c set that defines which elements will be xor'ed from * this set. * @stable ICU 2.4 */ virtual UnicodeSet& complementAll(const UnicodeSet& c); /** * Removes all of the elements from this set. This set will be * empty after this call returns. * A frozen set will not be modified. * @stable ICU 2.0 */ virtual UnicodeSet& clear(void); /** * Close this set over the given attribute. For the attribute * USET_CASE, the result is to modify this set so that: * * 1. For each character or string 'a' in this set, all strings or * characters 'b' such that foldCase(a) == foldCase(b) are added * to this set. * * 2. For each string 'e' in the resulting set, if e != * foldCase(e), 'e' will be removed. * * Example: [aq\\u00DF{Bc}{bC}{Fi}] => [aAqQ\\u00DF\\uFB01{ss}{bc}{fi}] * * (Here foldCase(x) refers to the operation u_strFoldCase, and a * == b denotes that the contents are the same, not pointer * comparison.) * * A frozen set will not be modified. * * @param attribute bitmask for attributes to close over. * Currently only the USET_CASE bit is supported. Any undefined bits * are ignored. * @return a reference to this set. * @stable ICU 4.2 */ UnicodeSet& closeOver(int32_t attribute); /** * Remove all strings from this set. * * @return a reference to this set. * @stable ICU 4.2 */ virtual UnicodeSet &removeAllStrings(); /** * Iteration method that returns the number of ranges contained in * this set. * @see #getRangeStart * @see #getRangeEnd * @stable ICU 2.4 */ virtual int32_t getRangeCount(void) const; /** * Iteration method that returns the first character in the * specified range of this set. * @see #getRangeCount * @see #getRangeEnd * @stable ICU 2.4 */ virtual UChar32 getRangeStart(int32_t index) const; /** * Iteration method that returns the last character in the * specified range of this set. * @see #getRangeStart * @see #getRangeEnd * @stable ICU 2.4 */ virtual UChar32 getRangeEnd(int32_t index) const; /** * Serializes this set into an array of 16-bit integers. Serialization * (currently) only records the characters in the set; multicharacter * strings are ignored. * * The array has following format (each line is one 16-bit * integer): * * length = (n+2*m) | (m!=0?0x8000:0) * bmpLength = n; present if m!=0 * bmp[0] * bmp[1] * ... * bmp[n-1] * supp-high[0] * supp-low[0] * supp-high[1] * supp-low[1] * ... * supp-high[m-1] * supp-low[m-1] * * The array starts with a header. After the header are n bmp * code points, then m supplementary code points. Either n or m * or both may be zero. n+2*m is always <= 0x7FFF. * * If there are no supplementary characters (if m==0) then the * header is one 16-bit integer, 'length', with value n. * * If there are supplementary characters (if m!=0) then the header * is two 16-bit integers. The first, 'length', has value * (n+2*m)|0x8000. The second, 'bmpLength', has value n. * * After the header the code points are stored in ascending order. * Supplementary code points are stored as most significant 16 * bits followed by least significant 16 bits. * * @param dest pointer to buffer of destCapacity 16-bit integers. * May be NULL only if destCapacity is zero. * @param destCapacity size of dest, or zero. Must not be negative. * @param ec error code. Will be set to U_INDEX_OUTOFBOUNDS_ERROR * if n+2*m > 0x7FFF. Will be set to U_BUFFER_OVERFLOW_ERROR if * n+2*m+(m!=0?2:1) > destCapacity. * @return the total length of the serialized format, including * the header, that is, n+2*m+(m!=0?2:1), or 0 on error other * than U_BUFFER_OVERFLOW_ERROR. * @stable ICU 2.4 */ int32_t serialize(uint16_t *dest, int32_t destCapacity, UErrorCode& ec) const; /** * Reallocate this objects internal structures to take up the least * possible space, without changing this object's value. * A frozen set will not be modified. * @stable ICU 2.4 */ virtual UnicodeSet& compact(); /** * Return the class ID for this class. This is useful only for * comparing to a return value from getDynamicClassID(). For example: *

     * .      Base* polymorphic_pointer = createPolymorphicObject();
     * .      if (polymorphic_pointer->getDynamicClassID() ==
     * .          Derived::getStaticClassID()) ...
     * 
* @return The class ID for all objects of this class. * @stable ICU 2.0 */ static UClassID U_EXPORT2 getStaticClassID(void); /** * Implement UnicodeFunctor API. * * @return The class ID for this object. All objects of a given * class have the same class ID. Objects of other classes have * different class IDs. * @stable ICU 2.4 */ virtual UClassID getDynamicClassID(void) const; private: // Private API for the USet API friend class USetAccess; int32_t getStringCount() const; const UnicodeString* getString(int32_t index) const; //---------------------------------------------------------------- // RuleBasedTransliterator support //---------------------------------------------------------------- private: /** * Returns true if this set contains any character whose low byte * is the given value. This is used by RuleBasedTransliterator for * indexing. */ virtual UBool matchesIndexValue(uint8_t v) const; private: //---------------------------------------------------------------- // Implementation: Clone as thawed (see ICU4J Freezable) //---------------------------------------------------------------- UnicodeSet(const UnicodeSet& o, UBool /* asThawed */); //---------------------------------------------------------------- // Implementation: Pattern parsing //---------------------------------------------------------------- void applyPattern(RuleCharacterIterator& chars, const SymbolTable* symbols, UnicodeString& rebuiltPat, uint32_t options, UErrorCode& ec); //---------------------------------------------------------------- // Implementation: Utility methods //---------------------------------------------------------------- void ensureCapacity(int32_t newLen, UErrorCode& ec); void ensureBufferCapacity(int32_t newLen, UErrorCode& ec); void swapBuffers(void); UBool allocateStrings(UErrorCode &status); UnicodeString& _toPattern(UnicodeString& result, UBool escapeUnprintable) const; UnicodeString& _generatePattern(UnicodeString& result, UBool escapeUnprintable) const; static void _appendToPat(UnicodeString& buf, const UnicodeString& s, UBool escapeUnprintable); static void _appendToPat(UnicodeString& buf, UChar32 c, UBool escapeUnprintable); //---------------------------------------------------------------- // Implementation: Fundamental operators //---------------------------------------------------------------- void exclusiveOr(const UChar32* other, int32_t otherLen, int8_t polarity); void add(const UChar32* other, int32_t otherLen, int8_t polarity); void retain(const UChar32* other, int32_t otherLen, int8_t polarity); /** * Return true if the given position, in the given pattern, appears * to be the start of a property set pattern [:foo:], \\p{foo}, or * \\P{foo}, or \\N{name}. */ static UBool resemblesPropertyPattern(const UnicodeString& pattern, int32_t pos); static UBool resemblesPropertyPattern(RuleCharacterIterator& chars, int32_t iterOpts); /** * Parse the given property pattern at the given parse position * and set this UnicodeSet to the result. * * The original design document is out of date, but still useful. * Ignore the property and value names: * http://source.icu-project.org/repos/icu/icuhtml/trunk/design/unicodeset_properties.html * * Recognized syntax: * * [:foo:] [:^foo:] - white space not allowed within "[:" or ":]" * \\p{foo} \\P{foo} - white space not allowed within "\\p" or "\\P" * \\N{name} - white space not allowed within "\\N" * * Other than the above restrictions, white space is ignored. Case * is ignored except in "\\p" and "\\P" and "\\N". In 'name' leading * and trailing space is deleted, and internal runs of whitespace * are collapsed to a single space. * * We support binary properties, enumerated properties, and the * following non-enumerated properties: * * Numeric_Value * Name * Unicode_1_Name * * @param pattern the pattern string * @param ppos on entry, the position at which to begin parsing. * This should be one of the locations marked '^': * * [:blah:] \\p{blah} \\P{blah} \\N{name} * ^ % ^ % ^ % ^ % * * On return, the position after the last character parsed, that is, * the locations marked '%'. If the parse fails, ppos is returned * unchanged. * @return a reference to this. */ UnicodeSet& applyPropertyPattern(const UnicodeString& pattern, ParsePosition& ppos, UErrorCode &ec); void applyPropertyPattern(RuleCharacterIterator& chars, UnicodeString& rebuiltPat, UErrorCode& ec); static const UnicodeSet* getInclusions(int32_t src, UErrorCode &status); /** * A filter that returns TRUE if the given code point should be * included in the UnicodeSet being constructed. */ typedef UBool (*Filter)(UChar32 codePoint, void* context); /** * Given a filter, set this UnicodeSet to the code points * contained by that filter. The filter MUST be * property-conformant. That is, if it returns value v for one * code point, then it must return v for all affiliated code * points, as defined by the inclusions list. See * getInclusions(). * src is a UPropertySource value. */ void applyFilter(Filter filter, void* context, int32_t src, UErrorCode &status); /** * Set the new pattern to cache. */ void setPattern(const UnicodeString& newPat); /** * Release existing cached pattern. */ void releasePattern(); friend class UnicodeSetIterator; }; inline UBool UnicodeSet::operator!=(const UnicodeSet& o) const { return !operator==(o); } inline UBool UnicodeSet::isFrozen() const { return (UBool)(bmpSet!=NULL || stringSpan!=NULL); } inline UBool UnicodeSet::containsSome(UChar32 start, UChar32 end) const { return !containsNone(start, end); } inline UBool UnicodeSet::containsSome(const UnicodeSet& s) const { return !containsNone(s); } inline UBool UnicodeSet::containsSome(const UnicodeString& s) const { return !containsNone(s); } inline UBool UnicodeSet::isBogus() const { return (UBool)(fFlags & kIsBogus); } inline UnicodeSet *UnicodeSet::fromUSet(USet *uset) { return reinterpret_cast(uset); } inline const UnicodeSet *UnicodeSet::fromUSet(const USet *uset) { return reinterpret_cast(uset); } inline USet *UnicodeSet::toUSet() { return reinterpret_cast(this); } inline const USet *UnicodeSet::toUSet() const { return reinterpret_cast(this); } inline int32_t UnicodeSet::span(const UnicodeString &s, int32_t start, USetSpanCondition spanCondition) const { int32_t sLength=s.length(); if(start<0) { start=0; } else if(start>sLength) { start=sLength; } return start+span(s.getBuffer()+start, sLength-start, spanCondition); } inline int32_t UnicodeSet::spanBack(const UnicodeString &s, int32_t limit, USetSpanCondition spanCondition) const { int32_t sLength=s.length(); if(limit<0) { limit=0; } else if(limit>sLength) { limit=sLength; } return spanBack(s.getBuffer(), limit, spanCondition); } U_NAMESPACE_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/uchar.h0000644000015700001700000034117212200324306024226 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (C) 1997-2010, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * * File UCHAR.H * * Modification History: * * Date Name Description * 04/02/97 aliu Creation. * 03/29/99 helena Updated for C APIs. * 4/15/99 Madhu Updated for C Implementation and Javadoc * 5/20/99 Madhu Added the function u_getVersion() * 8/19/1999 srl Upgraded scripts to Unicode 3.0 * 8/27/1999 schererm UCharDirection constants: U_... * 11/11/1999 weiv added u_isalnum(), cleaned comments * 01/11/2000 helena Renamed u_getVersion to u_getUnicodeVersion(). ****************************************************************************** */ #ifndef UCHAR_H #define UCHAR_H #include "unicode/utypes.h" U_CDECL_BEGIN /*==========================================================================*/ /* Unicode version number */ /*==========================================================================*/ /** * Unicode version number, default for the current ICU version. * The actual Unicode Character Database (UCD) data is stored in uprops.dat * and may be generated from UCD files from a different Unicode version. * Call u_getUnicodeVersion to get the actual Unicode version of the data. * * @see u_getUnicodeVersion * @stable ICU 2.0 */ #define U_UNICODE_VERSION "6.0" /** * \file * \brief C API: Unicode Properties * * This C API provides low-level access to the Unicode Character Database. * In addition to raw property values, some convenience functions calculate * derived properties, for example for Java-style programming. * * Unicode assigns each code point (not just assigned character) values for * many properties. * Most of them are simple boolean flags, or constants from a small enumerated list. * For some properties, values are strings or other relatively more complex types. * * For more information see * "About the Unicode Character Database" (http://www.unicode.org/ucd/) * and the ICU User Guide chapter on Properties (http://icu-project.org/userguide/properties.html). * * Many functions are designed to match java.lang.Character functions. * See the individual function documentation, * and see the JDK 1.4 java.lang.Character documentation * at http://java.sun.com/j2se/1.4/docs/api/java/lang/Character.html * * There are also functions that provide easy migration from C/POSIX functions * like isblank(). Their use is generally discouraged because the C/POSIX * standards do not define their semantics beyond the ASCII range, which means * that different implementations exhibit very different behavior. * Instead, Unicode properties should be used directly. * * There are also only a few, broad C/POSIX character classes, and they tend * to be used for conflicting purposes. For example, the "isalpha()" class * is sometimes used to determine word boundaries, while a more sophisticated * approach would at least distinguish initial letters from continuation * characters (the latter including combining marks). * (In ICU, BreakIterator is the most sophisticated API for word boundaries.) * Another example: There is no "istitle()" class for titlecase characters. * * ICU 3.4 and later provides API access for all twelve C/POSIX character classes. * ICU implements them according to the Standard Recommendations in * Annex C: Compatibility Properties of UTS #18 Unicode Regular Expressions * (http://www.unicode.org/reports/tr18/#Compatibility_Properties). * * API access for C/POSIX character classes is as follows: * - alpha: u_isUAlphabetic(c) or u_hasBinaryProperty(c, UCHAR_ALPHABETIC) * - lower: u_isULowercase(c) or u_hasBinaryProperty(c, UCHAR_LOWERCASE) * - upper: u_isUUppercase(c) or u_hasBinaryProperty(c, UCHAR_UPPERCASE) * - punct: u_ispunct(c) * - digit: u_isdigit(c) or u_charType(c)==U_DECIMAL_DIGIT_NUMBER * - xdigit: u_isxdigit(c) or u_hasBinaryProperty(c, UCHAR_POSIX_XDIGIT) * - alnum: u_hasBinaryProperty(c, UCHAR_POSIX_ALNUM) * - space: u_isUWhiteSpace(c) or u_hasBinaryProperty(c, UCHAR_WHITE_SPACE) * - blank: u_isblank(c) or u_hasBinaryProperty(c, UCHAR_POSIX_BLANK) * - cntrl: u_charType(c)==U_CONTROL_CHAR * - graph: u_hasBinaryProperty(c, UCHAR_POSIX_GRAPH) * - print: u_hasBinaryProperty(c, UCHAR_POSIX_PRINT) * * Note: Some of the u_isxyz() functions in uchar.h predate, and do not match, * the Standard Recommendations in UTS #18. Instead, they match Java * functions according to their API documentation. * * \htmlonly * The C/POSIX character classes are also available in UnicodeSet patterns, * using patterns like [:graph:] or \p{graph}. * \endhtmlonly * * Note: There are several ICU whitespace functions. * Comparison: * - u_isUWhiteSpace=UCHAR_WHITE_SPACE: Unicode White_Space property; * most of general categories "Z" (separators) + most whitespace ISO controls * (including no-break spaces, but excluding IS1..IS4 and ZWSP) * - u_isWhitespace: Java isWhitespace; Z + whitespace ISO controls but excluding no-break spaces * - u_isJavaSpaceChar: Java isSpaceChar; just Z (including no-break spaces) * - u_isspace: Z + whitespace ISO controls (including no-break spaces) * - u_isblank: "horizontal spaces" = TAB + Zs - ZWSP */ /** * Constants. */ /** The lowest Unicode code point value. Code points are non-negative. @stable ICU 2.0 */ #define UCHAR_MIN_VALUE 0 /** * The highest Unicode code point value (scalar value) according to * The Unicode Standard. This is a 21-bit value (20.1 bits, rounded up). * For a single character, UChar32 is a simple type that can hold any code point value. * * @see UChar32 * @stable ICU 2.0 */ #define UCHAR_MAX_VALUE 0x10ffff /** * Get a single-bit bit set (a flag) from a bit number 0..31. * @stable ICU 2.1 */ #define U_MASK(x) ((uint32_t)1<<(x)) /* * !! Note: Several comments in this file are machine-read by the * genpname tool. These comments describe the correspondence between * icu enum constants and UCD entities. Do not delete them. Update * these comments as needed. * * Any comment of the form "/ *[name]* /" (spaces added) is such * a comment. * * The U_JG_* and U_GC_*_MASK constants are matched by their symbolic * name, which must match PropertyValueAliases.txt. */ /** * Selection constants for Unicode properties. * These constants are used in functions like u_hasBinaryProperty to select * one of the Unicode properties. * * The properties APIs are intended to reflect Unicode properties as defined * in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR). * For details about the properties see http://www.unicode.org/ucd/ . * For names of Unicode properties see the UCD file PropertyAliases.txt. * * Important: If ICU is built with UCD files from Unicode versions below, e.g., 3.2, * then properties marked with "new in Unicode 3.2" are not or not fully available. * Check u_getUnicodeVersion to be sure. * * @see u_hasBinaryProperty * @see u_getIntPropertyValue * @see u_getUnicodeVersion * @stable ICU 2.1 */ typedef enum UProperty { /* See note !!. Comments of the form "Binary property Dash", "Enumerated property Script", "Double property Numeric_Value", and "String property Age" are read by genpname. */ /* Note: Place UCHAR_ALPHABETIC before UCHAR_BINARY_START so that debuggers display UCHAR_ALPHABETIC as the symbolic name for 0, rather than UCHAR_BINARY_START. Likewise for other *_START identifiers. */ /** Binary property Alphabetic. Same as u_isUAlphabetic, different from u_isalpha. Lu+Ll+Lt+Lm+Lo+Nl+Other_Alphabetic @stable ICU 2.1 */ UCHAR_ALPHABETIC=0, /** First constant for binary Unicode properties. @stable ICU 2.1 */ UCHAR_BINARY_START=UCHAR_ALPHABETIC, /** Binary property ASCII_Hex_Digit. 0-9 A-F a-f @stable ICU 2.1 */ UCHAR_ASCII_HEX_DIGIT=1, /** Binary property Bidi_Control. Format controls which have specific functions in the Bidi Algorithm. @stable ICU 2.1 */ UCHAR_BIDI_CONTROL=2, /** Binary property Bidi_Mirrored. Characters that may change display in RTL text. Same as u_isMirrored. See Bidi Algorithm, UTR 9. @stable ICU 2.1 */ UCHAR_BIDI_MIRRORED=3, /** Binary property Dash. Variations of dashes. @stable ICU 2.1 */ UCHAR_DASH=4, /** Binary property Default_Ignorable_Code_Point (new in Unicode 3.2). Ignorable in most processing. <2060..206F, FFF0..FFFB, E0000..E0FFF>+Other_Default_Ignorable_Code_Point+(Cf+Cc+Cs-White_Space) @stable ICU 2.1 */ UCHAR_DEFAULT_IGNORABLE_CODE_POINT=5, /** Binary property Deprecated (new in Unicode 3.2). The usage of deprecated characters is strongly discouraged. @stable ICU 2.1 */ UCHAR_DEPRECATED=6, /** Binary property Diacritic. Characters that linguistically modify the meaning of another character to which they apply. @stable ICU 2.1 */ UCHAR_DIACRITIC=7, /** Binary property Extender. Extend the value or shape of a preceding alphabetic character, e.g., length and iteration marks. @stable ICU 2.1 */ UCHAR_EXTENDER=8, /** Binary property Full_Composition_Exclusion. CompositionExclusions.txt+Singleton Decompositions+ Non-Starter Decompositions. @stable ICU 2.1 */ UCHAR_FULL_COMPOSITION_EXCLUSION=9, /** Binary property Grapheme_Base (new in Unicode 3.2). For programmatic determination of grapheme cluster boundaries. [0..10FFFF]-Cc-Cf-Cs-Co-Cn-Zl-Zp-Grapheme_Link-Grapheme_Extend-CGJ @stable ICU 2.1 */ UCHAR_GRAPHEME_BASE=10, /** Binary property Grapheme_Extend (new in Unicode 3.2). For programmatic determination of grapheme cluster boundaries. Me+Mn+Mc+Other_Grapheme_Extend-Grapheme_Link-CGJ @stable ICU 2.1 */ UCHAR_GRAPHEME_EXTEND=11, /** Binary property Grapheme_Link (new in Unicode 3.2). For programmatic determination of grapheme cluster boundaries. @stable ICU 2.1 */ UCHAR_GRAPHEME_LINK=12, /** Binary property Hex_Digit. Characters commonly used for hexadecimal numbers. @stable ICU 2.1 */ UCHAR_HEX_DIGIT=13, /** Binary property Hyphen. Dashes used to mark connections between pieces of words, plus the Katakana middle dot. @stable ICU 2.1 */ UCHAR_HYPHEN=14, /** Binary property ID_Continue. Characters that can continue an identifier. DerivedCoreProperties.txt also says "NOTE: Cf characters should be filtered out." ID_Start+Mn+Mc+Nd+Pc @stable ICU 2.1 */ UCHAR_ID_CONTINUE=15, /** Binary property ID_Start. Characters that can start an identifier. Lu+Ll+Lt+Lm+Lo+Nl @stable ICU 2.1 */ UCHAR_ID_START=16, /** Binary property Ideographic. CJKV ideographs. @stable ICU 2.1 */ UCHAR_IDEOGRAPHIC=17, /** Binary property IDS_Binary_Operator (new in Unicode 3.2). For programmatic determination of Ideographic Description Sequences. @stable ICU 2.1 */ UCHAR_IDS_BINARY_OPERATOR=18, /** Binary property IDS_Trinary_Operator (new in Unicode 3.2). For programmatic determination of Ideographic Description Sequences. @stable ICU 2.1 */ UCHAR_IDS_TRINARY_OPERATOR=19, /** Binary property Join_Control. Format controls for cursive joining and ligation. @stable ICU 2.1 */ UCHAR_JOIN_CONTROL=20, /** Binary property Logical_Order_Exception (new in Unicode 3.2). Characters that do not use logical order and require special handling in most processing. @stable ICU 2.1 */ UCHAR_LOGICAL_ORDER_EXCEPTION=21, /** Binary property Lowercase. Same as u_isULowercase, different from u_islower. Ll+Other_Lowercase @stable ICU 2.1 */ UCHAR_LOWERCASE=22, /** Binary property Math. Sm+Other_Math @stable ICU 2.1 */ UCHAR_MATH=23, /** Binary property Noncharacter_Code_Point. Code points that are explicitly defined as illegal for the encoding of characters. @stable ICU 2.1 */ UCHAR_NONCHARACTER_CODE_POINT=24, /** Binary property Quotation_Mark. @stable ICU 2.1 */ UCHAR_QUOTATION_MARK=25, /** Binary property Radical (new in Unicode 3.2). For programmatic determination of Ideographic Description Sequences. @stable ICU 2.1 */ UCHAR_RADICAL=26, /** Binary property Soft_Dotted (new in Unicode 3.2). Characters with a "soft dot", like i or j. An accent placed on these characters causes the dot to disappear. @stable ICU 2.1 */ UCHAR_SOFT_DOTTED=27, /** Binary property Terminal_Punctuation. Punctuation characters that generally mark the end of textual units. @stable ICU 2.1 */ UCHAR_TERMINAL_PUNCTUATION=28, /** Binary property Unified_Ideograph (new in Unicode 3.2). For programmatic determination of Ideographic Description Sequences. @stable ICU 2.1 */ UCHAR_UNIFIED_IDEOGRAPH=29, /** Binary property Uppercase. Same as u_isUUppercase, different from u_isupper. Lu+Other_Uppercase @stable ICU 2.1 */ UCHAR_UPPERCASE=30, /** Binary property White_Space. Same as u_isUWhiteSpace, different from u_isspace and u_isWhitespace. Space characters+TAB+CR+LF-ZWSP-ZWNBSP @stable ICU 2.1 */ UCHAR_WHITE_SPACE=31, /** Binary property XID_Continue. ID_Continue modified to allow closure under normalization forms NFKC and NFKD. @stable ICU 2.1 */ UCHAR_XID_CONTINUE=32, /** Binary property XID_Start. ID_Start modified to allow closure under normalization forms NFKC and NFKD. @stable ICU 2.1 */ UCHAR_XID_START=33, /** Binary property Case_Sensitive. Either the source of a case mapping or _in_ the target of a case mapping. Not the same as the general category Cased_Letter. @stable ICU 2.6 */ UCHAR_CASE_SENSITIVE=34, /** Binary property STerm (new in Unicode 4.0.1). Sentence Terminal. Used in UAX #29: Text Boundaries (http://www.unicode.org/reports/tr29/) @stable ICU 3.0 */ UCHAR_S_TERM=35, /** Binary property Variation_Selector (new in Unicode 4.0.1). Indicates all those characters that qualify as Variation Selectors. For details on the behavior of these characters, see StandardizedVariants.html and 15.6 Variation Selectors. @stable ICU 3.0 */ UCHAR_VARIATION_SELECTOR=36, /** Binary property NFD_Inert. ICU-specific property for characters that are inert under NFD, i.e., they do not interact with adjacent characters. See the documentation for the Normalizer2 class and the Normalizer2::isInert() method. @stable ICU 3.0 */ UCHAR_NFD_INERT=37, /** Binary property NFKD_Inert. ICU-specific property for characters that are inert under NFKD, i.e., they do not interact with adjacent characters. See the documentation for the Normalizer2 class and the Normalizer2::isInert() method. @stable ICU 3.0 */ UCHAR_NFKD_INERT=38, /** Binary property NFC_Inert. ICU-specific property for characters that are inert under NFC, i.e., they do not interact with adjacent characters. See the documentation for the Normalizer2 class and the Normalizer2::isInert() method. @stable ICU 3.0 */ UCHAR_NFC_INERT=39, /** Binary property NFKC_Inert. ICU-specific property for characters that are inert under NFKC, i.e., they do not interact with adjacent characters. See the documentation for the Normalizer2 class and the Normalizer2::isInert() method. @stable ICU 3.0 */ UCHAR_NFKC_INERT=40, /** Binary Property Segment_Starter. ICU-specific property for characters that are starters in terms of Unicode normalization and combining character sequences. They have ccc=0 and do not occur in non-initial position of the canonical decomposition of any character (like a-umlaut in NFD and a Jamo T in an NFD(Hangul LVT)). ICU uses this property for segmenting a string for generating a set of canonically equivalent strings, e.g. for canonical closure while processing collation tailoring rules. @stable ICU 3.0 */ UCHAR_SEGMENT_STARTER=41, /** Binary property Pattern_Syntax (new in Unicode 4.1). See UAX #31 Identifier and Pattern Syntax (http://www.unicode.org/reports/tr31/) @stable ICU 3.4 */ UCHAR_PATTERN_SYNTAX=42, /** Binary property Pattern_White_Space (new in Unicode 4.1). See UAX #31 Identifier and Pattern Syntax (http://www.unicode.org/reports/tr31/) @stable ICU 3.4 */ UCHAR_PATTERN_WHITE_SPACE=43, /** Binary property alnum (a C/POSIX character class). Implemented according to the UTS #18 Annex C Standard Recommendation. See the uchar.h file documentation. @stable ICU 3.4 */ UCHAR_POSIX_ALNUM=44, /** Binary property blank (a C/POSIX character class). Implemented according to the UTS #18 Annex C Standard Recommendation. See the uchar.h file documentation. @stable ICU 3.4 */ UCHAR_POSIX_BLANK=45, /** Binary property graph (a C/POSIX character class). Implemented according to the UTS #18 Annex C Standard Recommendation. See the uchar.h file documentation. @stable ICU 3.4 */ UCHAR_POSIX_GRAPH=46, /** Binary property print (a C/POSIX character class). Implemented according to the UTS #18 Annex C Standard Recommendation. See the uchar.h file documentation. @stable ICU 3.4 */ UCHAR_POSIX_PRINT=47, /** Binary property xdigit (a C/POSIX character class). Implemented according to the UTS #18 Annex C Standard Recommendation. See the uchar.h file documentation. @stable ICU 3.4 */ UCHAR_POSIX_XDIGIT=48, /** Binary property Cased. For Lowercase, Uppercase and Titlecase characters. @stable ICU 4.4 */ UCHAR_CASED=49, /** Binary property Case_Ignorable. Used in context-sensitive case mappings. @stable ICU 4.4 */ UCHAR_CASE_IGNORABLE=50, /** Binary property Changes_When_Lowercased. @stable ICU 4.4 */ UCHAR_CHANGES_WHEN_LOWERCASED=51, /** Binary property Changes_When_Uppercased. @stable ICU 4.4 */ UCHAR_CHANGES_WHEN_UPPERCASED=52, /** Binary property Changes_When_Titlecased. @stable ICU 4.4 */ UCHAR_CHANGES_WHEN_TITLECASED=53, /** Binary property Changes_When_Casefolded. @stable ICU 4.4 */ UCHAR_CHANGES_WHEN_CASEFOLDED=54, /** Binary property Changes_When_Casemapped. @stable ICU 4.4 */ UCHAR_CHANGES_WHEN_CASEMAPPED=55, /** Binary property Changes_When_NFKC_Casefolded. @stable ICU 4.4 */ UCHAR_CHANGES_WHEN_NFKC_CASEFOLDED=56, /** One more than the last constant for binary Unicode properties. @stable ICU 2.1 */ UCHAR_BINARY_LIMIT=57, /** Enumerated property Bidi_Class. Same as u_charDirection, returns UCharDirection values. @stable ICU 2.2 */ UCHAR_BIDI_CLASS=0x1000, /** First constant for enumerated/integer Unicode properties. @stable ICU 2.2 */ UCHAR_INT_START=UCHAR_BIDI_CLASS, /** Enumerated property Block. Same as ublock_getCode, returns UBlockCode values. @stable ICU 2.2 */ UCHAR_BLOCK=0x1001, /** Enumerated property Canonical_Combining_Class. Same as u_getCombiningClass, returns 8-bit numeric values. @stable ICU 2.2 */ UCHAR_CANONICAL_COMBINING_CLASS=0x1002, /** Enumerated property Decomposition_Type. Returns UDecompositionType values. @stable ICU 2.2 */ UCHAR_DECOMPOSITION_TYPE=0x1003, /** Enumerated property East_Asian_Width. See http://www.unicode.org/reports/tr11/ Returns UEastAsianWidth values. @stable ICU 2.2 */ UCHAR_EAST_ASIAN_WIDTH=0x1004, /** Enumerated property General_Category. Same as u_charType, returns UCharCategory values. @stable ICU 2.2 */ UCHAR_GENERAL_CATEGORY=0x1005, /** Enumerated property Joining_Group. Returns UJoiningGroup values. @stable ICU 2.2 */ UCHAR_JOINING_GROUP=0x1006, /** Enumerated property Joining_Type. Returns UJoiningType values. @stable ICU 2.2 */ UCHAR_JOINING_TYPE=0x1007, /** Enumerated property Line_Break. Returns ULineBreak values. @stable ICU 2.2 */ UCHAR_LINE_BREAK=0x1008, /** Enumerated property Numeric_Type. Returns UNumericType values. @stable ICU 2.2 */ UCHAR_NUMERIC_TYPE=0x1009, /** Enumerated property Script. Same as uscript_getScript, returns UScriptCode values. @stable ICU 2.2 */ UCHAR_SCRIPT=0x100A, /** Enumerated property Hangul_Syllable_Type, new in Unicode 4. Returns UHangulSyllableType values. @stable ICU 2.6 */ UCHAR_HANGUL_SYLLABLE_TYPE=0x100B, /** Enumerated property NFD_Quick_Check. Returns UNormalizationCheckResult values. @stable ICU 3.0 */ UCHAR_NFD_QUICK_CHECK=0x100C, /** Enumerated property NFKD_Quick_Check. Returns UNormalizationCheckResult values. @stable ICU 3.0 */ UCHAR_NFKD_QUICK_CHECK=0x100D, /** Enumerated property NFC_Quick_Check. Returns UNormalizationCheckResult values. @stable ICU 3.0 */ UCHAR_NFC_QUICK_CHECK=0x100E, /** Enumerated property NFKC_Quick_Check. Returns UNormalizationCheckResult values. @stable ICU 3.0 */ UCHAR_NFKC_QUICK_CHECK=0x100F, /** Enumerated property Lead_Canonical_Combining_Class. ICU-specific property for the ccc of the first code point of the decomposition, or lccc(c)=ccc(NFD(c)[0]). Useful for checking for canonically ordered text; see UNORM_FCD and http://www.unicode.org/notes/tn5/#FCD . Returns 8-bit numeric values like UCHAR_CANONICAL_COMBINING_CLASS. @stable ICU 3.0 */ UCHAR_LEAD_CANONICAL_COMBINING_CLASS=0x1010, /** Enumerated property Trail_Canonical_Combining_Class. ICU-specific property for the ccc of the last code point of the decomposition, or tccc(c)=ccc(NFD(c)[last]). Useful for checking for canonically ordered text; see UNORM_FCD and http://www.unicode.org/notes/tn5/#FCD . Returns 8-bit numeric values like UCHAR_CANONICAL_COMBINING_CLASS. @stable ICU 3.0 */ UCHAR_TRAIL_CANONICAL_COMBINING_CLASS=0x1011, /** Enumerated property Grapheme_Cluster_Break (new in Unicode 4.1). Used in UAX #29: Text Boundaries (http://www.unicode.org/reports/tr29/) Returns UGraphemeClusterBreak values. @stable ICU 3.4 */ UCHAR_GRAPHEME_CLUSTER_BREAK=0x1012, /** Enumerated property Sentence_Break (new in Unicode 4.1). Used in UAX #29: Text Boundaries (http://www.unicode.org/reports/tr29/) Returns USentenceBreak values. @stable ICU 3.4 */ UCHAR_SENTENCE_BREAK=0x1013, /** Enumerated property Word_Break (new in Unicode 4.1). Used in UAX #29: Text Boundaries (http://www.unicode.org/reports/tr29/) Returns UWordBreakValues values. @stable ICU 3.4 */ UCHAR_WORD_BREAK=0x1014, /** One more than the last constant for enumerated/integer Unicode properties. @stable ICU 2.2 */ UCHAR_INT_LIMIT=0x1015, /** Bitmask property General_Category_Mask. This is the General_Category property returned as a bit mask. When used in u_getIntPropertyValue(c), same as U_MASK(u_charType(c)), returns bit masks for UCharCategory values where exactly one bit is set. When used with u_getPropertyValueName() and u_getPropertyValueEnum(), a multi-bit mask is used for sets of categories like "Letters". Mask values should be cast to uint32_t. @stable ICU 2.4 */ UCHAR_GENERAL_CATEGORY_MASK=0x2000, /** First constant for bit-mask Unicode properties. @stable ICU 2.4 */ UCHAR_MASK_START=UCHAR_GENERAL_CATEGORY_MASK, /** One more than the last constant for bit-mask Unicode properties. @stable ICU 2.4 */ UCHAR_MASK_LIMIT=0x2001, /** Double property Numeric_Value. Corresponds to u_getNumericValue. @stable ICU 2.4 */ UCHAR_NUMERIC_VALUE=0x3000, /** First constant for double Unicode properties. @stable ICU 2.4 */ UCHAR_DOUBLE_START=UCHAR_NUMERIC_VALUE, /** One more than the last constant for double Unicode properties. @stable ICU 2.4 */ UCHAR_DOUBLE_LIMIT=0x3001, /** String property Age. Corresponds to u_charAge. @stable ICU 2.4 */ UCHAR_AGE=0x4000, /** First constant for string Unicode properties. @stable ICU 2.4 */ UCHAR_STRING_START=UCHAR_AGE, /** String property Bidi_Mirroring_Glyph. Corresponds to u_charMirror. @stable ICU 2.4 */ UCHAR_BIDI_MIRRORING_GLYPH=0x4001, /** String property Case_Folding. Corresponds to u_strFoldCase in ustring.h. @stable ICU 2.4 */ UCHAR_CASE_FOLDING=0x4002, /** String property ISO_Comment. Corresponds to u_getISOComment. @stable ICU 2.4 */ UCHAR_ISO_COMMENT=0x4003, /** String property Lowercase_Mapping. Corresponds to u_strToLower in ustring.h. @stable ICU 2.4 */ UCHAR_LOWERCASE_MAPPING=0x4004, /** String property Name. Corresponds to u_charName. @stable ICU 2.4 */ UCHAR_NAME=0x4005, /** String property Simple_Case_Folding. Corresponds to u_foldCase. @stable ICU 2.4 */ UCHAR_SIMPLE_CASE_FOLDING=0x4006, /** String property Simple_Lowercase_Mapping. Corresponds to u_tolower. @stable ICU 2.4 */ UCHAR_SIMPLE_LOWERCASE_MAPPING=0x4007, /** String property Simple_Titlecase_Mapping. Corresponds to u_totitle. @stable ICU 2.4 */ UCHAR_SIMPLE_TITLECASE_MAPPING=0x4008, /** String property Simple_Uppercase_Mapping. Corresponds to u_toupper. @stable ICU 2.4 */ UCHAR_SIMPLE_UPPERCASE_MAPPING=0x4009, /** String property Titlecase_Mapping. Corresponds to u_strToTitle in ustring.h. @stable ICU 2.4 */ UCHAR_TITLECASE_MAPPING=0x400A, /** String property Unicode_1_Name. Corresponds to u_charName. @stable ICU 2.4 */ UCHAR_UNICODE_1_NAME=0x400B, /** String property Uppercase_Mapping. Corresponds to u_strToUpper in ustring.h. @stable ICU 2.4 */ UCHAR_UPPERCASE_MAPPING=0x400C, /** One more than the last constant for string Unicode properties. @stable ICU 2.4 */ UCHAR_STRING_LIMIT=0x400D, /** Provisional property Script_Extensions (new in Unicode 6.0). As a provisional property, it may be modified or removed in future versions of the Unicode Standard, and thus in ICU. Some characters are commonly used in multiple scripts. For more information, see UAX #24: http://www.unicode.org/reports/tr24/. Corresponds to uscript_hasScript and uscript_getScriptExtensions in uscript.h. @draft ICU 4.6 */ UCHAR_SCRIPT_EXTENSIONS=0x7000, /** First constant for Unicode properties with unusual value types. @draft ICU 4.6 */ UCHAR_OTHER_PROPERTY_START=UCHAR_SCRIPT_EXTENSIONS, /** One more than the last constant for Unicode properties with unusual value types. * @draft ICU 4.6 */ UCHAR_OTHER_PROPERTY_LIMIT=0x7001, /** Represents a nonexistent or invalid property or property value. @stable ICU 2.4 */ UCHAR_INVALID_CODE = -1 } UProperty; /** * Data for enumerated Unicode general category types. * See http://www.unicode.org/Public/UNIDATA/UnicodeData.html . * @stable ICU 2.0 */ typedef enum UCharCategory { /** See note !!. Comments of the form "Cn" are read by genpname. */ /** Non-category for unassigned and non-character code points. @stable ICU 2.0 */ U_UNASSIGNED = 0, /** Cn "Other, Not Assigned (no characters in [UnicodeData.txt] have this property)" (same as U_UNASSIGNED!) @stable ICU 2.0 */ U_GENERAL_OTHER_TYPES = 0, /** Lu @stable ICU 2.0 */ U_UPPERCASE_LETTER = 1, /** Ll @stable ICU 2.0 */ U_LOWERCASE_LETTER = 2, /** Lt @stable ICU 2.0 */ U_TITLECASE_LETTER = 3, /** Lm @stable ICU 2.0 */ U_MODIFIER_LETTER = 4, /** Lo @stable ICU 2.0 */ U_OTHER_LETTER = 5, /** Mn @stable ICU 2.0 */ U_NON_SPACING_MARK = 6, /** Me @stable ICU 2.0 */ U_ENCLOSING_MARK = 7, /** Mc @stable ICU 2.0 */ U_COMBINING_SPACING_MARK = 8, /** Nd @stable ICU 2.0 */ U_DECIMAL_DIGIT_NUMBER = 9, /** Nl @stable ICU 2.0 */ U_LETTER_NUMBER = 10, /** No @stable ICU 2.0 */ U_OTHER_NUMBER = 11, /** Zs @stable ICU 2.0 */ U_SPACE_SEPARATOR = 12, /** Zl @stable ICU 2.0 */ U_LINE_SEPARATOR = 13, /** Zp @stable ICU 2.0 */ U_PARAGRAPH_SEPARATOR = 14, /** Cc @stable ICU 2.0 */ U_CONTROL_CHAR = 15, /** Cf @stable ICU 2.0 */ U_FORMAT_CHAR = 16, /** Co @stable ICU 2.0 */ U_PRIVATE_USE_CHAR = 17, /** Cs @stable ICU 2.0 */ U_SURROGATE = 18, /** Pd @stable ICU 2.0 */ U_DASH_PUNCTUATION = 19, /** Ps @stable ICU 2.0 */ U_START_PUNCTUATION = 20, /** Pe @stable ICU 2.0 */ U_END_PUNCTUATION = 21, /** Pc @stable ICU 2.0 */ U_CONNECTOR_PUNCTUATION = 22, /** Po @stable ICU 2.0 */ U_OTHER_PUNCTUATION = 23, /** Sm @stable ICU 2.0 */ U_MATH_SYMBOL = 24, /** Sc @stable ICU 2.0 */ U_CURRENCY_SYMBOL = 25, /** Sk @stable ICU 2.0 */ U_MODIFIER_SYMBOL = 26, /** So @stable ICU 2.0 */ U_OTHER_SYMBOL = 27, /** Pi @stable ICU 2.0 */ U_INITIAL_PUNCTUATION = 28, /** Pf @stable ICU 2.0 */ U_FINAL_PUNCTUATION = 29, /** One higher than the last enum UCharCategory constant. @stable ICU 2.0 */ U_CHAR_CATEGORY_COUNT } UCharCategory; /** * U_GC_XX_MASK constants are bit flags corresponding to Unicode * general category values. * For each category, the nth bit is set if the numeric value of the * corresponding UCharCategory constant is n. * * There are also some U_GC_Y_MASK constants for groups of general categories * like L for all letter categories. * * @see u_charType * @see U_GET_GC_MASK * @see UCharCategory * @stable ICU 2.1 */ #define U_GC_CN_MASK U_MASK(U_GENERAL_OTHER_TYPES) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_LU_MASK U_MASK(U_UPPERCASE_LETTER) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_LL_MASK U_MASK(U_LOWERCASE_LETTER) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_LT_MASK U_MASK(U_TITLECASE_LETTER) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_LM_MASK U_MASK(U_MODIFIER_LETTER) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_LO_MASK U_MASK(U_OTHER_LETTER) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_MN_MASK U_MASK(U_NON_SPACING_MARK) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_ME_MASK U_MASK(U_ENCLOSING_MARK) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_MC_MASK U_MASK(U_COMBINING_SPACING_MARK) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_ND_MASK U_MASK(U_DECIMAL_DIGIT_NUMBER) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_NL_MASK U_MASK(U_LETTER_NUMBER) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_NO_MASK U_MASK(U_OTHER_NUMBER) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_ZS_MASK U_MASK(U_SPACE_SEPARATOR) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_ZL_MASK U_MASK(U_LINE_SEPARATOR) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_ZP_MASK U_MASK(U_PARAGRAPH_SEPARATOR) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_CC_MASK U_MASK(U_CONTROL_CHAR) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_CF_MASK U_MASK(U_FORMAT_CHAR) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_CO_MASK U_MASK(U_PRIVATE_USE_CHAR) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_CS_MASK U_MASK(U_SURROGATE) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_PD_MASK U_MASK(U_DASH_PUNCTUATION) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_PS_MASK U_MASK(U_START_PUNCTUATION) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_PE_MASK U_MASK(U_END_PUNCTUATION) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_PC_MASK U_MASK(U_CONNECTOR_PUNCTUATION) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_PO_MASK U_MASK(U_OTHER_PUNCTUATION) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_SM_MASK U_MASK(U_MATH_SYMBOL) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_SC_MASK U_MASK(U_CURRENCY_SYMBOL) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_SK_MASK U_MASK(U_MODIFIER_SYMBOL) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_SO_MASK U_MASK(U_OTHER_SYMBOL) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_PI_MASK U_MASK(U_INITIAL_PUNCTUATION) /** Mask constant for a UCharCategory. @stable ICU 2.1 */ #define U_GC_PF_MASK U_MASK(U_FINAL_PUNCTUATION) /** Mask constant for multiple UCharCategory bits (L Letters). @stable ICU 2.1 */ #define U_GC_L_MASK \ (U_GC_LU_MASK|U_GC_LL_MASK|U_GC_LT_MASK|U_GC_LM_MASK|U_GC_LO_MASK) /** Mask constant for multiple UCharCategory bits (LC Cased Letters). @stable ICU 2.1 */ #define U_GC_LC_MASK \ (U_GC_LU_MASK|U_GC_LL_MASK|U_GC_LT_MASK) /** Mask constant for multiple UCharCategory bits (M Marks). @stable ICU 2.1 */ #define U_GC_M_MASK (U_GC_MN_MASK|U_GC_ME_MASK|U_GC_MC_MASK) /** Mask constant for multiple UCharCategory bits (N Numbers). @stable ICU 2.1 */ #define U_GC_N_MASK (U_GC_ND_MASK|U_GC_NL_MASK|U_GC_NO_MASK) /** Mask constant for multiple UCharCategory bits (Z Separators). @stable ICU 2.1 */ #define U_GC_Z_MASK (U_GC_ZS_MASK|U_GC_ZL_MASK|U_GC_ZP_MASK) /** Mask constant for multiple UCharCategory bits (C Others). @stable ICU 2.1 */ #define U_GC_C_MASK \ (U_GC_CN_MASK|U_GC_CC_MASK|U_GC_CF_MASK|U_GC_CO_MASK|U_GC_CS_MASK) /** Mask constant for multiple UCharCategory bits (P Punctuation). @stable ICU 2.1 */ #define U_GC_P_MASK \ (U_GC_PD_MASK|U_GC_PS_MASK|U_GC_PE_MASK|U_GC_PC_MASK|U_GC_PO_MASK| \ U_GC_PI_MASK|U_GC_PF_MASK) /** Mask constant for multiple UCharCategory bits (S Symbols). @stable ICU 2.1 */ #define U_GC_S_MASK (U_GC_SM_MASK|U_GC_SC_MASK|U_GC_SK_MASK|U_GC_SO_MASK) /** * This specifies the language directional property of a character set. * @stable ICU 2.0 */ typedef enum UCharDirection { /** See note !!. Comments of the form "EN" are read by genpname. */ /** L @stable ICU 2.0 */ U_LEFT_TO_RIGHT = 0, /** R @stable ICU 2.0 */ U_RIGHT_TO_LEFT = 1, /** EN @stable ICU 2.0 */ U_EUROPEAN_NUMBER = 2, /** ES @stable ICU 2.0 */ U_EUROPEAN_NUMBER_SEPARATOR = 3, /** ET @stable ICU 2.0 */ U_EUROPEAN_NUMBER_TERMINATOR = 4, /** AN @stable ICU 2.0 */ U_ARABIC_NUMBER = 5, /** CS @stable ICU 2.0 */ U_COMMON_NUMBER_SEPARATOR = 6, /** B @stable ICU 2.0 */ U_BLOCK_SEPARATOR = 7, /** S @stable ICU 2.0 */ U_SEGMENT_SEPARATOR = 8, /** WS @stable ICU 2.0 */ U_WHITE_SPACE_NEUTRAL = 9, /** ON @stable ICU 2.0 */ U_OTHER_NEUTRAL = 10, /** LRE @stable ICU 2.0 */ U_LEFT_TO_RIGHT_EMBEDDING = 11, /** LRO @stable ICU 2.0 */ U_LEFT_TO_RIGHT_OVERRIDE = 12, /** AL @stable ICU 2.0 */ U_RIGHT_TO_LEFT_ARABIC = 13, /** RLE @stable ICU 2.0 */ U_RIGHT_TO_LEFT_EMBEDDING = 14, /** RLO @stable ICU 2.0 */ U_RIGHT_TO_LEFT_OVERRIDE = 15, /** PDF @stable ICU 2.0 */ U_POP_DIRECTIONAL_FORMAT = 16, /** NSM @stable ICU 2.0 */ U_DIR_NON_SPACING_MARK = 17, /** BN @stable ICU 2.0 */ U_BOUNDARY_NEUTRAL = 18, /** @stable ICU 2.0 */ U_CHAR_DIRECTION_COUNT } UCharDirection; /** * Constants for Unicode blocks, see the Unicode Data file Blocks.txt * @stable ICU 2.0 */ enum UBlockCode { /** New No_Block value in Unicode 4. @stable ICU 2.6 */ UBLOCK_NO_BLOCK = 0, /*[none]*/ /* Special range indicating No_Block */ /** @stable ICU 2.0 */ UBLOCK_BASIC_LATIN = 1, /*[0000]*/ /*See note !!*/ /** @stable ICU 2.0 */ UBLOCK_LATIN_1_SUPPLEMENT=2, /*[0080]*/ /** @stable ICU 2.0 */ UBLOCK_LATIN_EXTENDED_A =3, /*[0100]*/ /** @stable ICU 2.0 */ UBLOCK_LATIN_EXTENDED_B =4, /*[0180]*/ /** @stable ICU 2.0 */ UBLOCK_IPA_EXTENSIONS =5, /*[0250]*/ /** @stable ICU 2.0 */ UBLOCK_SPACING_MODIFIER_LETTERS =6, /*[02B0]*/ /** @stable ICU 2.0 */ UBLOCK_COMBINING_DIACRITICAL_MARKS =7, /*[0300]*/ /** * Unicode 3.2 renames this block to "Greek and Coptic". * @stable ICU 2.0 */ UBLOCK_GREEK =8, /*[0370]*/ /** @stable ICU 2.0 */ UBLOCK_CYRILLIC =9, /*[0400]*/ /** @stable ICU 2.0 */ UBLOCK_ARMENIAN =10, /*[0530]*/ /** @stable ICU 2.0 */ UBLOCK_HEBREW =11, /*[0590]*/ /** @stable ICU 2.0 */ UBLOCK_ARABIC =12, /*[0600]*/ /** @stable ICU 2.0 */ UBLOCK_SYRIAC =13, /*[0700]*/ /** @stable ICU 2.0 */ UBLOCK_THAANA =14, /*[0780]*/ /** @stable ICU 2.0 */ UBLOCK_DEVANAGARI =15, /*[0900]*/ /** @stable ICU 2.0 */ UBLOCK_BENGALI =16, /*[0980]*/ /** @stable ICU 2.0 */ UBLOCK_GURMUKHI =17, /*[0A00]*/ /** @stable ICU 2.0 */ UBLOCK_GUJARATI =18, /*[0A80]*/ /** @stable ICU 2.0 */ UBLOCK_ORIYA =19, /*[0B00]*/ /** @stable ICU 2.0 */ UBLOCK_TAMIL =20, /*[0B80]*/ /** @stable ICU 2.0 */ UBLOCK_TELUGU =21, /*[0C00]*/ /** @stable ICU 2.0 */ UBLOCK_KANNADA =22, /*[0C80]*/ /** @stable ICU 2.0 */ UBLOCK_MALAYALAM =23, /*[0D00]*/ /** @stable ICU 2.0 */ UBLOCK_SINHALA =24, /*[0D80]*/ /** @stable ICU 2.0 */ UBLOCK_THAI =25, /*[0E00]*/ /** @stable ICU 2.0 */ UBLOCK_LAO =26, /*[0E80]*/ /** @stable ICU 2.0 */ UBLOCK_TIBETAN =27, /*[0F00]*/ /** @stable ICU 2.0 */ UBLOCK_MYANMAR =28, /*[1000]*/ /** @stable ICU 2.0 */ UBLOCK_GEORGIAN =29, /*[10A0]*/ /** @stable ICU 2.0 */ UBLOCK_HANGUL_JAMO =30, /*[1100]*/ /** @stable ICU 2.0 */ UBLOCK_ETHIOPIC =31, /*[1200]*/ /** @stable ICU 2.0 */ UBLOCK_CHEROKEE =32, /*[13A0]*/ /** @stable ICU 2.0 */ UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS =33, /*[1400]*/ /** @stable ICU 2.0 */ UBLOCK_OGHAM =34, /*[1680]*/ /** @stable ICU 2.0 */ UBLOCK_RUNIC =35, /*[16A0]*/ /** @stable ICU 2.0 */ UBLOCK_KHMER =36, /*[1780]*/ /** @stable ICU 2.0 */ UBLOCK_MONGOLIAN =37, /*[1800]*/ /** @stable ICU 2.0 */ UBLOCK_LATIN_EXTENDED_ADDITIONAL =38, /*[1E00]*/ /** @stable ICU 2.0 */ UBLOCK_GREEK_EXTENDED =39, /*[1F00]*/ /** @stable ICU 2.0 */ UBLOCK_GENERAL_PUNCTUATION =40, /*[2000]*/ /** @stable ICU 2.0 */ UBLOCK_SUPERSCRIPTS_AND_SUBSCRIPTS =41, /*[2070]*/ /** @stable ICU 2.0 */ UBLOCK_CURRENCY_SYMBOLS =42, /*[20A0]*/ /** * Unicode 3.2 renames this block to "Combining Diacritical Marks for Symbols". * @stable ICU 2.0 */ UBLOCK_COMBINING_MARKS_FOR_SYMBOLS =43, /*[20D0]*/ /** @stable ICU 2.0 */ UBLOCK_LETTERLIKE_SYMBOLS =44, /*[2100]*/ /** @stable ICU 2.0 */ UBLOCK_NUMBER_FORMS =45, /*[2150]*/ /** @stable ICU 2.0 */ UBLOCK_ARROWS =46, /*[2190]*/ /** @stable ICU 2.0 */ UBLOCK_MATHEMATICAL_OPERATORS =47, /*[2200]*/ /** @stable ICU 2.0 */ UBLOCK_MISCELLANEOUS_TECHNICAL =48, /*[2300]*/ /** @stable ICU 2.0 */ UBLOCK_CONTROL_PICTURES =49, /*[2400]*/ /** @stable ICU 2.0 */ UBLOCK_OPTICAL_CHARACTER_RECOGNITION =50, /*[2440]*/ /** @stable ICU 2.0 */ UBLOCK_ENCLOSED_ALPHANUMERICS =51, /*[2460]*/ /** @stable ICU 2.0 */ UBLOCK_BOX_DRAWING =52, /*[2500]*/ /** @stable ICU 2.0 */ UBLOCK_BLOCK_ELEMENTS =53, /*[2580]*/ /** @stable ICU 2.0 */ UBLOCK_GEOMETRIC_SHAPES =54, /*[25A0]*/ /** @stable ICU 2.0 */ UBLOCK_MISCELLANEOUS_SYMBOLS =55, /*[2600]*/ /** @stable ICU 2.0 */ UBLOCK_DINGBATS =56, /*[2700]*/ /** @stable ICU 2.0 */ UBLOCK_BRAILLE_PATTERNS =57, /*[2800]*/ /** @stable ICU 2.0 */ UBLOCK_CJK_RADICALS_SUPPLEMENT =58, /*[2E80]*/ /** @stable ICU 2.0 */ UBLOCK_KANGXI_RADICALS =59, /*[2F00]*/ /** @stable ICU 2.0 */ UBLOCK_IDEOGRAPHIC_DESCRIPTION_CHARACTERS =60, /*[2FF0]*/ /** @stable ICU 2.0 */ UBLOCK_CJK_SYMBOLS_AND_PUNCTUATION =61, /*[3000]*/ /** @stable ICU 2.0 */ UBLOCK_HIRAGANA =62, /*[3040]*/ /** @stable ICU 2.0 */ UBLOCK_KATAKANA =63, /*[30A0]*/ /** @stable ICU 2.0 */ UBLOCK_BOPOMOFO =64, /*[3100]*/ /** @stable ICU 2.0 */ UBLOCK_HANGUL_COMPATIBILITY_JAMO =65, /*[3130]*/ /** @stable ICU 2.0 */ UBLOCK_KANBUN =66, /*[3190]*/ /** @stable ICU 2.0 */ UBLOCK_BOPOMOFO_EXTENDED =67, /*[31A0]*/ /** @stable ICU 2.0 */ UBLOCK_ENCLOSED_CJK_LETTERS_AND_MONTHS =68, /*[3200]*/ /** @stable ICU 2.0 */ UBLOCK_CJK_COMPATIBILITY =69, /*[3300]*/ /** @stable ICU 2.0 */ UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A =70, /*[3400]*/ /** @stable ICU 2.0 */ UBLOCK_CJK_UNIFIED_IDEOGRAPHS =71, /*[4E00]*/ /** @stable ICU 2.0 */ UBLOCK_YI_SYLLABLES =72, /*[A000]*/ /** @stable ICU 2.0 */ UBLOCK_YI_RADICALS =73, /*[A490]*/ /** @stable ICU 2.0 */ UBLOCK_HANGUL_SYLLABLES =74, /*[AC00]*/ /** @stable ICU 2.0 */ UBLOCK_HIGH_SURROGATES =75, /*[D800]*/ /** @stable ICU 2.0 */ UBLOCK_HIGH_PRIVATE_USE_SURROGATES =76, /*[DB80]*/ /** @stable ICU 2.0 */ UBLOCK_LOW_SURROGATES =77, /*[DC00]*/ /** * Same as UBLOCK_PRIVATE_USE_AREA. * Until Unicode 3.1.1, the corresponding block name was "Private Use", * and multiple code point ranges had this block. * Unicode 3.2 renames the block for the BMP PUA to "Private Use Area" and * adds separate blocks for the supplementary PUAs. * * @stable ICU 2.0 */ UBLOCK_PRIVATE_USE = 78, /** * Same as UBLOCK_PRIVATE_USE. * Until Unicode 3.1.1, the corresponding block name was "Private Use", * and multiple code point ranges had this block. * Unicode 3.2 renames the block for the BMP PUA to "Private Use Area" and * adds separate blocks for the supplementary PUAs. * * @stable ICU 2.0 */ UBLOCK_PRIVATE_USE_AREA =UBLOCK_PRIVATE_USE, /*[E000]*/ /** @stable ICU 2.0 */ UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS =79, /*[F900]*/ /** @stable ICU 2.0 */ UBLOCK_ALPHABETIC_PRESENTATION_FORMS =80, /*[FB00]*/ /** @stable ICU 2.0 */ UBLOCK_ARABIC_PRESENTATION_FORMS_A =81, /*[FB50]*/ /** @stable ICU 2.0 */ UBLOCK_COMBINING_HALF_MARKS =82, /*[FE20]*/ /** @stable ICU 2.0 */ UBLOCK_CJK_COMPATIBILITY_FORMS =83, /*[FE30]*/ /** @stable ICU 2.0 */ UBLOCK_SMALL_FORM_VARIANTS =84, /*[FE50]*/ /** @stable ICU 2.0 */ UBLOCK_ARABIC_PRESENTATION_FORMS_B =85, /*[FE70]*/ /** @stable ICU 2.0 */ UBLOCK_SPECIALS =86, /*[FFF0]*/ /** @stable ICU 2.0 */ UBLOCK_HALFWIDTH_AND_FULLWIDTH_FORMS =87, /*[FF00]*/ /* New blocks in Unicode 3.1 */ /** @stable ICU 2.0 */ UBLOCK_OLD_ITALIC = 88 , /*[10300]*/ /** @stable ICU 2.0 */ UBLOCK_GOTHIC = 89 , /*[10330]*/ /** @stable ICU 2.0 */ UBLOCK_DESERET = 90 , /*[10400]*/ /** @stable ICU 2.0 */ UBLOCK_BYZANTINE_MUSICAL_SYMBOLS = 91 , /*[1D000]*/ /** @stable ICU 2.0 */ UBLOCK_MUSICAL_SYMBOLS = 92 , /*[1D100]*/ /** @stable ICU 2.0 */ UBLOCK_MATHEMATICAL_ALPHANUMERIC_SYMBOLS = 93 , /*[1D400]*/ /** @stable ICU 2.0 */ UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B = 94 , /*[20000]*/ /** @stable ICU 2.0 */ UBLOCK_CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT = 95 , /*[2F800]*/ /** @stable ICU 2.0 */ UBLOCK_TAGS = 96, /*[E0000]*/ /* New blocks in Unicode 3.2 */ /** * Unicode 4.0.1 renames the "Cyrillic Supplementary" block to "Cyrillic Supplement". * @stable ICU 2.2 */ UBLOCK_CYRILLIC_SUPPLEMENTARY = 97, /** @stable ICU 3.0 */ UBLOCK_CYRILLIC_SUPPLEMENT = UBLOCK_CYRILLIC_SUPPLEMENTARY, /*[0500]*/ /** @stable ICU 2.2 */ UBLOCK_TAGALOG = 98, /*[1700]*/ /** @stable ICU 2.2 */ UBLOCK_HANUNOO = 99, /*[1720]*/ /** @stable ICU 2.2 */ UBLOCK_BUHID = 100, /*[1740]*/ /** @stable ICU 2.2 */ UBLOCK_TAGBANWA = 101, /*[1760]*/ /** @stable ICU 2.2 */ UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A = 102, /*[27C0]*/ /** @stable ICU 2.2 */ UBLOCK_SUPPLEMENTAL_ARROWS_A = 103, /*[27F0]*/ /** @stable ICU 2.2 */ UBLOCK_SUPPLEMENTAL_ARROWS_B = 104, /*[2900]*/ /** @stable ICU 2.2 */ UBLOCK_MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B = 105, /*[2980]*/ /** @stable ICU 2.2 */ UBLOCK_SUPPLEMENTAL_MATHEMATICAL_OPERATORS = 106, /*[2A00]*/ /** @stable ICU 2.2 */ UBLOCK_KATAKANA_PHONETIC_EXTENSIONS = 107, /*[31F0]*/ /** @stable ICU 2.2 */ UBLOCK_VARIATION_SELECTORS = 108, /*[FE00]*/ /** @stable ICU 2.2 */ UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_A = 109, /*[F0000]*/ /** @stable ICU 2.2 */ UBLOCK_SUPPLEMENTARY_PRIVATE_USE_AREA_B = 110, /*[100000]*/ /* New blocks in Unicode 4 */ /** @stable ICU 2.6 */ UBLOCK_LIMBU = 111, /*[1900]*/ /** @stable ICU 2.6 */ UBLOCK_TAI_LE = 112, /*[1950]*/ /** @stable ICU 2.6 */ UBLOCK_KHMER_SYMBOLS = 113, /*[19E0]*/ /** @stable ICU 2.6 */ UBLOCK_PHONETIC_EXTENSIONS = 114, /*[1D00]*/ /** @stable ICU 2.6 */ UBLOCK_MISCELLANEOUS_SYMBOLS_AND_ARROWS = 115, /*[2B00]*/ /** @stable ICU 2.6 */ UBLOCK_YIJING_HEXAGRAM_SYMBOLS = 116, /*[4DC0]*/ /** @stable ICU 2.6 */ UBLOCK_LINEAR_B_SYLLABARY = 117, /*[10000]*/ /** @stable ICU 2.6 */ UBLOCK_LINEAR_B_IDEOGRAMS = 118, /*[10080]*/ /** @stable ICU 2.6 */ UBLOCK_AEGEAN_NUMBERS = 119, /*[10100]*/ /** @stable ICU 2.6 */ UBLOCK_UGARITIC = 120, /*[10380]*/ /** @stable ICU 2.6 */ UBLOCK_SHAVIAN = 121, /*[10450]*/ /** @stable ICU 2.6 */ UBLOCK_OSMANYA = 122, /*[10480]*/ /** @stable ICU 2.6 */ UBLOCK_CYPRIOT_SYLLABARY = 123, /*[10800]*/ /** @stable ICU 2.6 */ UBLOCK_TAI_XUAN_JING_SYMBOLS = 124, /*[1D300]*/ /** @stable ICU 2.6 */ UBLOCK_VARIATION_SELECTORS_SUPPLEMENT = 125, /*[E0100]*/ /* New blocks in Unicode 4.1 */ /** @stable ICU 3.4 */ UBLOCK_ANCIENT_GREEK_MUSICAL_NOTATION = 126, /*[1D200]*/ /** @stable ICU 3.4 */ UBLOCK_ANCIENT_GREEK_NUMBERS = 127, /*[10140]*/ /** @stable ICU 3.4 */ UBLOCK_ARABIC_SUPPLEMENT = 128, /*[0750]*/ /** @stable ICU 3.4 */ UBLOCK_BUGINESE = 129, /*[1A00]*/ /** @stable ICU 3.4 */ UBLOCK_CJK_STROKES = 130, /*[31C0]*/ /** @stable ICU 3.4 */ UBLOCK_COMBINING_DIACRITICAL_MARKS_SUPPLEMENT = 131, /*[1DC0]*/ /** @stable ICU 3.4 */ UBLOCK_COPTIC = 132, /*[2C80]*/ /** @stable ICU 3.4 */ UBLOCK_ETHIOPIC_EXTENDED = 133, /*[2D80]*/ /** @stable ICU 3.4 */ UBLOCK_ETHIOPIC_SUPPLEMENT = 134, /*[1380]*/ /** @stable ICU 3.4 */ UBLOCK_GEORGIAN_SUPPLEMENT = 135, /*[2D00]*/ /** @stable ICU 3.4 */ UBLOCK_GLAGOLITIC = 136, /*[2C00]*/ /** @stable ICU 3.4 */ UBLOCK_KHAROSHTHI = 137, /*[10A00]*/ /** @stable ICU 3.4 */ UBLOCK_MODIFIER_TONE_LETTERS = 138, /*[A700]*/ /** @stable ICU 3.4 */ UBLOCK_NEW_TAI_LUE = 139, /*[1980]*/ /** @stable ICU 3.4 */ UBLOCK_OLD_PERSIAN = 140, /*[103A0]*/ /** @stable ICU 3.4 */ UBLOCK_PHONETIC_EXTENSIONS_SUPPLEMENT = 141, /*[1D80]*/ /** @stable ICU 3.4 */ UBLOCK_SUPPLEMENTAL_PUNCTUATION = 142, /*[2E00]*/ /** @stable ICU 3.4 */ UBLOCK_SYLOTI_NAGRI = 143, /*[A800]*/ /** @stable ICU 3.4 */ UBLOCK_TIFINAGH = 144, /*[2D30]*/ /** @stable ICU 3.4 */ UBLOCK_VERTICAL_FORMS = 145, /*[FE10]*/ /* New blocks in Unicode 5.0 */ /** @stable ICU 3.6 */ UBLOCK_NKO = 146, /*[07C0]*/ /** @stable ICU 3.6 */ UBLOCK_BALINESE = 147, /*[1B00]*/ /** @stable ICU 3.6 */ UBLOCK_LATIN_EXTENDED_C = 148, /*[2C60]*/ /** @stable ICU 3.6 */ UBLOCK_LATIN_EXTENDED_D = 149, /*[A720]*/ /** @stable ICU 3.6 */ UBLOCK_PHAGS_PA = 150, /*[A840]*/ /** @stable ICU 3.6 */ UBLOCK_PHOENICIAN = 151, /*[10900]*/ /** @stable ICU 3.6 */ UBLOCK_CUNEIFORM = 152, /*[12000]*/ /** @stable ICU 3.6 */ UBLOCK_CUNEIFORM_NUMBERS_AND_PUNCTUATION = 153, /*[12400]*/ /** @stable ICU 3.6 */ UBLOCK_COUNTING_ROD_NUMERALS = 154, /*[1D360]*/ /* New blocks in Unicode 5.1 */ /** @stable ICU 4.0 */ UBLOCK_SUNDANESE = 155, /*[1B80]*/ /** @stable ICU 4.0 */ UBLOCK_LEPCHA = 156, /*[1C00]*/ /** @stable ICU 4.0 */ UBLOCK_OL_CHIKI = 157, /*[1C50]*/ /** @stable ICU 4.0 */ UBLOCK_CYRILLIC_EXTENDED_A = 158, /*[2DE0]*/ /** @stable ICU 4.0 */ UBLOCK_VAI = 159, /*[A500]*/ /** @stable ICU 4.0 */ UBLOCK_CYRILLIC_EXTENDED_B = 160, /*[A640]*/ /** @stable ICU 4.0 */ UBLOCK_SAURASHTRA = 161, /*[A880]*/ /** @stable ICU 4.0 */ UBLOCK_KAYAH_LI = 162, /*[A900]*/ /** @stable ICU 4.0 */ UBLOCK_REJANG = 163, /*[A930]*/ /** @stable ICU 4.0 */ UBLOCK_CHAM = 164, /*[AA00]*/ /** @stable ICU 4.0 */ UBLOCK_ANCIENT_SYMBOLS = 165, /*[10190]*/ /** @stable ICU 4.0 */ UBLOCK_PHAISTOS_DISC = 166, /*[101D0]*/ /** @stable ICU 4.0 */ UBLOCK_LYCIAN = 167, /*[10280]*/ /** @stable ICU 4.0 */ UBLOCK_CARIAN = 168, /*[102A0]*/ /** @stable ICU 4.0 */ UBLOCK_LYDIAN = 169, /*[10920]*/ /** @stable ICU 4.0 */ UBLOCK_MAHJONG_TILES = 170, /*[1F000]*/ /** @stable ICU 4.0 */ UBLOCK_DOMINO_TILES = 171, /*[1F030]*/ /* New blocks in Unicode 5.2 */ /** @stable ICU 4.4 */ UBLOCK_SAMARITAN = 172, /*[0800]*/ /** @stable ICU 4.4 */ UBLOCK_UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED = 173, /*[18B0]*/ /** @stable ICU 4.4 */ UBLOCK_TAI_THAM = 174, /*[1A20]*/ /** @stable ICU 4.4 */ UBLOCK_VEDIC_EXTENSIONS = 175, /*[1CD0]*/ /** @stable ICU 4.4 */ UBLOCK_LISU = 176, /*[A4D0]*/ /** @stable ICU 4.4 */ UBLOCK_BAMUM = 177, /*[A6A0]*/ /** @stable ICU 4.4 */ UBLOCK_COMMON_INDIC_NUMBER_FORMS = 178, /*[A830]*/ /** @stable ICU 4.4 */ UBLOCK_DEVANAGARI_EXTENDED = 179, /*[A8E0]*/ /** @stable ICU 4.4 */ UBLOCK_HANGUL_JAMO_EXTENDED_A = 180, /*[A960]*/ /** @stable ICU 4.4 */ UBLOCK_JAVANESE = 181, /*[A980]*/ /** @stable ICU 4.4 */ UBLOCK_MYANMAR_EXTENDED_A = 182, /*[AA60]*/ /** @stable ICU 4.4 */ UBLOCK_TAI_VIET = 183, /*[AA80]*/ /** @stable ICU 4.4 */ UBLOCK_MEETEI_MAYEK = 184, /*[ABC0]*/ /** @stable ICU 4.4 */ UBLOCK_HANGUL_JAMO_EXTENDED_B = 185, /*[D7B0]*/ /** @stable ICU 4.4 */ UBLOCK_IMPERIAL_ARAMAIC = 186, /*[10840]*/ /** @stable ICU 4.4 */ UBLOCK_OLD_SOUTH_ARABIAN = 187, /*[10A60]*/ /** @stable ICU 4.4 */ UBLOCK_AVESTAN = 188, /*[10B00]*/ /** @stable ICU 4.4 */ UBLOCK_INSCRIPTIONAL_PARTHIAN = 189, /*[10B40]*/ /** @stable ICU 4.4 */ UBLOCK_INSCRIPTIONAL_PAHLAVI = 190, /*[10B60]*/ /** @stable ICU 4.4 */ UBLOCK_OLD_TURKIC = 191, /*[10C00]*/ /** @stable ICU 4.4 */ UBLOCK_RUMI_NUMERAL_SYMBOLS = 192, /*[10E60]*/ /** @stable ICU 4.4 */ UBLOCK_KAITHI = 193, /*[11080]*/ /** @stable ICU 4.4 */ UBLOCK_EGYPTIAN_HIEROGLYPHS = 194, /*[13000]*/ /** @stable ICU 4.4 */ UBLOCK_ENCLOSED_ALPHANUMERIC_SUPPLEMENT = 195, /*[1F100]*/ /** @stable ICU 4.4 */ UBLOCK_ENCLOSED_IDEOGRAPHIC_SUPPLEMENT = 196, /*[1F200]*/ /** @stable ICU 4.4 */ UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C = 197, /*[2A700]*/ /* New blocks in Unicode 6.0 */ /** @stable ICU 4.6 */ UBLOCK_MANDAIC = 198, /*[0840]*/ /** @stable ICU 4.6 */ UBLOCK_BATAK = 199, /*[1BC0]*/ /** @stable ICU 4.6 */ UBLOCK_ETHIOPIC_EXTENDED_A = 200, /*[AB00]*/ /** @stable ICU 4.6 */ UBLOCK_BRAHMI = 201, /*[11000]*/ /** @stable ICU 4.6 */ UBLOCK_BAMUM_SUPPLEMENT = 202, /*[16800]*/ /** @stable ICU 4.6 */ UBLOCK_KANA_SUPPLEMENT = 203, /*[1B000]*/ /** @stable ICU 4.6 */ UBLOCK_PLAYING_CARDS = 204, /*[1F0A0]*/ /** @stable ICU 4.6 */ UBLOCK_MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS = 205, /*[1F300]*/ /** @stable ICU 4.6 */ UBLOCK_EMOTICONS = 206, /*[1F600]*/ /** @stable ICU 4.6 */ UBLOCK_TRANSPORT_AND_MAP_SYMBOLS = 207, /*[1F680]*/ /** @stable ICU 4.6 */ UBLOCK_ALCHEMICAL_SYMBOLS = 208, /*[1F700]*/ /** @stable ICU 4.6 */ UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D = 209, /*[2B740]*/ /** @stable ICU 2.0 */ UBLOCK_COUNT = 210, /** @stable ICU 2.0 */ UBLOCK_INVALID_CODE=-1 }; /** @stable ICU 2.0 */ typedef enum UBlockCode UBlockCode; /** * East Asian Width constants. * * @see UCHAR_EAST_ASIAN_WIDTH * @see u_getIntPropertyValue * @stable ICU 2.2 */ typedef enum UEastAsianWidth { U_EA_NEUTRAL, /*[N]*/ /*See note !!*/ U_EA_AMBIGUOUS, /*[A]*/ U_EA_HALFWIDTH, /*[H]*/ U_EA_FULLWIDTH, /*[F]*/ U_EA_NARROW, /*[Na]*/ U_EA_WIDE, /*[W]*/ U_EA_COUNT } UEastAsianWidth; /* * Implementation note: * Keep UEastAsianWidth constant values in sync with names list in genprops/props2.c. */ /** * Selector constants for u_charName(). * u_charName() returns the "modern" name of a * Unicode character; or the name that was defined in * Unicode version 1.0, before the Unicode standard merged * with ISO-10646; or an "extended" name that gives each * Unicode code point a unique name. * * @see u_charName * @stable ICU 2.0 */ typedef enum UCharNameChoice { U_UNICODE_CHAR_NAME, U_UNICODE_10_CHAR_NAME, U_EXTENDED_CHAR_NAME, U_CHAR_NAME_ALIAS, /**< Corrected name from NameAliases.txt. @stable ICU 4.4 */ U_CHAR_NAME_CHOICE_COUNT } UCharNameChoice; /** * Selector constants for u_getPropertyName() and * u_getPropertyValueName(). These selectors are used to choose which * name is returned for a given property or value. All properties and * values have a long name. Most have a short name, but some do not. * Unicode allows for additional names, beyond the long and short * name, which would be indicated by U_LONG_PROPERTY_NAME + i, where * i=1, 2,... * * @see u_getPropertyName() * @see u_getPropertyValueName() * @stable ICU 2.4 */ typedef enum UPropertyNameChoice { U_SHORT_PROPERTY_NAME, U_LONG_PROPERTY_NAME, U_PROPERTY_NAME_CHOICE_COUNT } UPropertyNameChoice; /** * Decomposition Type constants. * * @see UCHAR_DECOMPOSITION_TYPE * @stable ICU 2.2 */ typedef enum UDecompositionType { U_DT_NONE, /*[none]*/ /*See note !!*/ U_DT_CANONICAL, /*[can]*/ U_DT_COMPAT, /*[com]*/ U_DT_CIRCLE, /*[enc]*/ U_DT_FINAL, /*[fin]*/ U_DT_FONT, /*[font]*/ U_DT_FRACTION, /*[fra]*/ U_DT_INITIAL, /*[init]*/ U_DT_ISOLATED, /*[iso]*/ U_DT_MEDIAL, /*[med]*/ U_DT_NARROW, /*[nar]*/ U_DT_NOBREAK, /*[nb]*/ U_DT_SMALL, /*[sml]*/ U_DT_SQUARE, /*[sqr]*/ U_DT_SUB, /*[sub]*/ U_DT_SUPER, /*[sup]*/ U_DT_VERTICAL, /*[vert]*/ U_DT_WIDE, /*[wide]*/ U_DT_COUNT /* 18 */ } UDecompositionType; /** * Joining Type constants. * * @see UCHAR_JOINING_TYPE * @stable ICU 2.2 */ typedef enum UJoiningType { U_JT_NON_JOINING, /*[U]*/ /*See note !!*/ U_JT_JOIN_CAUSING, /*[C]*/ U_JT_DUAL_JOINING, /*[D]*/ U_JT_LEFT_JOINING, /*[L]*/ U_JT_RIGHT_JOINING, /*[R]*/ U_JT_TRANSPARENT, /*[T]*/ U_JT_COUNT /* 6 */ } UJoiningType; /** * Joining Group constants. * * @see UCHAR_JOINING_GROUP * @stable ICU 2.2 */ typedef enum UJoiningGroup { U_JG_NO_JOINING_GROUP, U_JG_AIN, U_JG_ALAPH, U_JG_ALEF, U_JG_BEH, U_JG_BETH, U_JG_DAL, U_JG_DALATH_RISH, U_JG_E, U_JG_FEH, U_JG_FINAL_SEMKATH, U_JG_GAF, U_JG_GAMAL, U_JG_HAH, U_JG_TEH_MARBUTA_GOAL, /**< @stable ICU 4.6 */ U_JG_HAMZA_ON_HEH_GOAL=U_JG_TEH_MARBUTA_GOAL, U_JG_HE, U_JG_HEH, U_JG_HEH_GOAL, U_JG_HETH, U_JG_KAF, U_JG_KAPH, U_JG_KNOTTED_HEH, U_JG_LAM, U_JG_LAMADH, U_JG_MEEM, U_JG_MIM, U_JG_NOON, U_JG_NUN, U_JG_PE, U_JG_QAF, U_JG_QAPH, U_JG_REH, U_JG_REVERSED_PE, U_JG_SAD, U_JG_SADHE, U_JG_SEEN, U_JG_SEMKATH, U_JG_SHIN, U_JG_SWASH_KAF, U_JG_SYRIAC_WAW, U_JG_TAH, U_JG_TAW, U_JG_TEH_MARBUTA, U_JG_TETH, U_JG_WAW, U_JG_YEH, U_JG_YEH_BARREE, U_JG_YEH_WITH_TAIL, U_JG_YUDH, U_JG_YUDH_HE, U_JG_ZAIN, U_JG_FE, /**< @stable ICU 2.6 */ U_JG_KHAPH, /**< @stable ICU 2.6 */ U_JG_ZHAIN, /**< @stable ICU 2.6 */ U_JG_BURUSHASKI_YEH_BARREE, /**< @stable ICU 4.0 */ U_JG_FARSI_YEH, /**< @stable ICU 4.4 */ U_JG_NYA, /**< @stable ICU 4.4 */ U_JG_COUNT } UJoiningGroup; /** * Grapheme Cluster Break constants. * * @see UCHAR_GRAPHEME_CLUSTER_BREAK * @stable ICU 3.4 */ typedef enum UGraphemeClusterBreak { U_GCB_OTHER = 0, /*[XX]*/ /*See note !!*/ U_GCB_CONTROL = 1, /*[CN]*/ U_GCB_CR = 2, /*[CR]*/ U_GCB_EXTEND = 3, /*[EX]*/ U_GCB_L = 4, /*[L]*/ U_GCB_LF = 5, /*[LF]*/ U_GCB_LV = 6, /*[LV]*/ U_GCB_LVT = 7, /*[LVT]*/ U_GCB_T = 8, /*[T]*/ U_GCB_V = 9, /*[V]*/ U_GCB_SPACING_MARK = 10, /*[SM]*/ /* from here on: new in Unicode 5.1/ICU 4.0 */ U_GCB_PREPEND = 11, /*[PP]*/ U_GCB_COUNT = 12 } UGraphemeClusterBreak; /** * Word Break constants. * (UWordBreak is a pre-existing enum type in ubrk.h for word break status tags.) * * @see UCHAR_WORD_BREAK * @stable ICU 3.4 */ typedef enum UWordBreakValues { U_WB_OTHER = 0, /*[XX]*/ /*See note !!*/ U_WB_ALETTER = 1, /*[LE]*/ U_WB_FORMAT = 2, /*[FO]*/ U_WB_KATAKANA = 3, /*[KA]*/ U_WB_MIDLETTER = 4, /*[ML]*/ U_WB_MIDNUM = 5, /*[MN]*/ U_WB_NUMERIC = 6, /*[NU]*/ U_WB_EXTENDNUMLET = 7, /*[EX]*/ U_WB_CR = 8, /*[CR]*/ /* from here on: new in Unicode 5.1/ICU 4.0 */ U_WB_EXTEND = 9, /*[Extend]*/ U_WB_LF = 10, /*[LF]*/ U_WB_MIDNUMLET =11, /*[MB]*/ U_WB_NEWLINE =12, /*[NL]*/ U_WB_COUNT = 13 } UWordBreakValues; /** * Sentence Break constants. * * @see UCHAR_SENTENCE_BREAK * @stable ICU 3.4 */ typedef enum USentenceBreak { U_SB_OTHER = 0, /*[XX]*/ /*See note !!*/ U_SB_ATERM = 1, /*[AT]*/ U_SB_CLOSE = 2, /*[CL]*/ U_SB_FORMAT = 3, /*[FO]*/ U_SB_LOWER = 4, /*[LO]*/ U_SB_NUMERIC = 5, /*[NU]*/ U_SB_OLETTER = 6, /*[LE]*/ U_SB_SEP = 7, /*[SE]*/ U_SB_SP = 8, /*[SP]*/ U_SB_STERM = 9, /*[ST]*/ U_SB_UPPER = 10, /*[UP]*/ U_SB_CR = 11, /*[CR]*/ /* from here on: new in Unicode 5.1/ICU 4.0 */ U_SB_EXTEND = 12, /*[EX]*/ U_SB_LF = 13, /*[LF]*/ U_SB_SCONTINUE = 14, /*[SC]*/ U_SB_COUNT = 15 } USentenceBreak; /** * Line Break constants. * * @see UCHAR_LINE_BREAK * @stable ICU 2.2 */ typedef enum ULineBreak { U_LB_UNKNOWN = 0, /*[XX]*/ /*See note !!*/ U_LB_AMBIGUOUS = 1, /*[AI]*/ U_LB_ALPHABETIC = 2, /*[AL]*/ U_LB_BREAK_BOTH = 3, /*[B2]*/ U_LB_BREAK_AFTER = 4, /*[BA]*/ U_LB_BREAK_BEFORE = 5, /*[BB]*/ U_LB_MANDATORY_BREAK = 6, /*[BK]*/ U_LB_CONTINGENT_BREAK = 7, /*[CB]*/ U_LB_CLOSE_PUNCTUATION = 8, /*[CL]*/ U_LB_COMBINING_MARK = 9, /*[CM]*/ U_LB_CARRIAGE_RETURN = 10, /*[CR]*/ U_LB_EXCLAMATION = 11, /*[EX]*/ U_LB_GLUE = 12, /*[GL]*/ U_LB_HYPHEN = 13, /*[HY]*/ U_LB_IDEOGRAPHIC = 14, /*[ID]*/ U_LB_INSEPERABLE = 15, /** Renamed from the misspelled "inseperable" in Unicode 4.0.1/ICU 3.0 @stable ICU 3.0 */ U_LB_INSEPARABLE=U_LB_INSEPERABLE,/*[IN]*/ U_LB_INFIX_NUMERIC = 16, /*[IS]*/ U_LB_LINE_FEED = 17, /*[LF]*/ U_LB_NONSTARTER = 18, /*[NS]*/ U_LB_NUMERIC = 19, /*[NU]*/ U_LB_OPEN_PUNCTUATION = 20, /*[OP]*/ U_LB_POSTFIX_NUMERIC = 21, /*[PO]*/ U_LB_PREFIX_NUMERIC = 22, /*[PR]*/ U_LB_QUOTATION = 23, /*[QU]*/ U_LB_COMPLEX_CONTEXT = 24, /*[SA]*/ U_LB_SURROGATE = 25, /*[SG]*/ U_LB_SPACE = 26, /*[SP]*/ U_LB_BREAK_SYMBOLS = 27, /*[SY]*/ U_LB_ZWSPACE = 28, /*[ZW]*/ U_LB_NEXT_LINE = 29, /*[NL]*/ /* from here on: new in Unicode 4/ICU 2.6 */ U_LB_WORD_JOINER = 30, /*[WJ]*/ U_LB_H2 = 31, /*[H2]*/ /* from here on: new in Unicode 4.1/ICU 3.4 */ U_LB_H3 = 32, /*[H3]*/ U_LB_JL = 33, /*[JL]*/ U_LB_JT = 34, /*[JT]*/ U_LB_JV = 35, /*[JV]*/ U_LB_CLOSE_PARENTHESIS = 36, /*[CP]*/ /* new in Unicode 5.2/ICU 4.4 */ U_LB_COUNT = 37 } ULineBreak; /** * Numeric Type constants. * * @see UCHAR_NUMERIC_TYPE * @stable ICU 2.2 */ typedef enum UNumericType { U_NT_NONE, /*[None]*/ /*See note !!*/ U_NT_DECIMAL, /*[de]*/ U_NT_DIGIT, /*[di]*/ U_NT_NUMERIC, /*[nu]*/ U_NT_COUNT } UNumericType; /** * Hangul Syllable Type constants. * * @see UCHAR_HANGUL_SYLLABLE_TYPE * @stable ICU 2.6 */ typedef enum UHangulSyllableType { U_HST_NOT_APPLICABLE, /*[NA]*/ /*See note !!*/ U_HST_LEADING_JAMO, /*[L]*/ U_HST_VOWEL_JAMO, /*[V]*/ U_HST_TRAILING_JAMO, /*[T]*/ U_HST_LV_SYLLABLE, /*[LV]*/ U_HST_LVT_SYLLABLE, /*[LVT]*/ U_HST_COUNT } UHangulSyllableType; /** * Check a binary Unicode property for a code point. * * Unicode, especially in version 3.2, defines many more properties than the * original set in UnicodeData.txt. * * The properties APIs are intended to reflect Unicode properties as defined * in the Unicode Character Database (UCD) and Unicode Technical Reports (UTR). * For details about the properties see http://www.unicode.org/ucd/ . * For names of Unicode properties see the UCD file PropertyAliases.txt. * * Important: If ICU is built with UCD files from Unicode versions below 3.2, * then properties marked with "new in Unicode 3.2" are not or not fully available. * * @param c Code point to test. * @param which UProperty selector constant, identifies which binary property to check. * Must be UCHAR_BINARY_START<=which=0. * True for characters with general category "Nd" (decimal digit numbers) * as well as Latin letters a-f and A-F in both ASCII and Fullwidth ASCII. * (That is, for letters with code points * 0041..0046, 0061..0066, FF21..FF26, FF41..FF46.) * * In order to narrow the definition of hexadecimal digits to only ASCII * characters, use (c<=0x7f && u_isxdigit(c)). * * This is a C/POSIX migration function. * See the comments about C/POSIX character classification functions in the * documentation at the top of this header file. * * @param c the code point to be tested * @return TRUE if the code point is a hexadecimal digit * * @stable ICU 2.6 */ U_STABLE UBool U_EXPORT2 u_isxdigit(UChar32 c); /** * Determines whether the specified code point is a punctuation character. * True for characters with general categories "P" (punctuation). * * This is a C/POSIX migration function. * See the comments about C/POSIX character classification functions in the * documentation at the top of this header file. * * @param c the code point to be tested * @return TRUE if the code point is a punctuation character * * @stable ICU 2.6 */ U_STABLE UBool U_EXPORT2 u_ispunct(UChar32 c); /** * Determines whether the specified code point is a "graphic" character * (printable, excluding spaces). * TRUE for all characters except those with general categories * "Cc" (control codes), "Cf" (format controls), "Cs" (surrogates), * "Cn" (unassigned), and "Z" (separators). * * This is a C/POSIX migration function. * See the comments about C/POSIX character classification functions in the * documentation at the top of this header file. * * @param c the code point to be tested * @return TRUE if the code point is a "graphic" character * * @stable ICU 2.6 */ U_STABLE UBool U_EXPORT2 u_isgraph(UChar32 c); /** * Determines whether the specified code point is a "blank" or "horizontal space", * a character that visibly separates words on a line. * The following are equivalent definitions: * * TRUE for Unicode White_Space characters except for "vertical space controls" * where "vertical space controls" are the following characters: * U+000A (LF) U+000B (VT) U+000C (FF) U+000D (CR) U+0085 (NEL) U+2028 (LS) U+2029 (PS) * * same as * * TRUE for U+0009 (TAB) and characters with general category "Zs" (space separators) * except Zero Width Space (ZWSP, U+200B). * * Note: There are several ICU whitespace functions; please see the uchar.h * file documentation for a detailed comparison. * * This is a C/POSIX migration function. * See the comments about C/POSIX character classification functions in the * documentation at the top of this header file. * * @param c the code point to be tested * @return TRUE if the code point is a "blank" * * @stable ICU 2.6 */ U_STABLE UBool U_EXPORT2 u_isblank(UChar32 c); /** * Determines whether the specified code point is "defined", * which usually means that it is assigned a character. * True for general categories other than "Cn" (other, not assigned), * i.e., true for all code points mentioned in UnicodeData.txt. * * Note that non-character code points (e.g., U+FDD0) are not "defined" * (they are Cn), but surrogate code points are "defined" (Cs). * * Same as java.lang.Character.isDefined(). * * @param c the code point to be tested * @return TRUE if the code point is assigned a character * * @see u_isdigit * @see u_isalpha * @see u_isalnum * @see u_isupper * @see u_islower * @see u_istitle * @stable ICU 2.0 */ U_STABLE UBool U_EXPORT2 u_isdefined(UChar32 c); /** * Determines if the specified character is a space character or not. * * Note: There are several ICU whitespace functions; please see the uchar.h * file documentation for a detailed comparison. * * This is a C/POSIX migration function. * See the comments about C/POSIX character classification functions in the * documentation at the top of this header file. * * @param c the character to be tested * @return true if the character is a space character; false otherwise. * * @see u_isJavaSpaceChar * @see u_isWhitespace * @see u_isUWhiteSpace * @stable ICU 2.0 */ U_STABLE UBool U_EXPORT2 u_isspace(UChar32 c); /** * Determine if the specified code point is a space character according to Java. * True for characters with general categories "Z" (separators), * which does not include control codes (e.g., TAB or Line Feed). * * Same as java.lang.Character.isSpaceChar(). * * Note: There are several ICU whitespace functions; please see the uchar.h * file documentation for a detailed comparison. * * @param c the code point to be tested * @return TRUE if the code point is a space character according to Character.isSpaceChar() * * @see u_isspace * @see u_isWhitespace * @see u_isUWhiteSpace * @stable ICU 2.6 */ U_STABLE UBool U_EXPORT2 u_isJavaSpaceChar(UChar32 c); /** * Determines if the specified code point is a whitespace character according to Java/ICU. * A character is considered to be a Java whitespace character if and only * if it satisfies one of the following criteria: * * - It is a Unicode Separator character (categories "Z" = "Zs" or "Zl" or "Zp"), but is not * also a non-breaking space (U+00A0 NBSP or U+2007 Figure Space or U+202F Narrow NBSP). * - It is U+0009 HORIZONTAL TABULATION. * - It is U+000A LINE FEED. * - It is U+000B VERTICAL TABULATION. * - It is U+000C FORM FEED. * - It is U+000D CARRIAGE RETURN. * - It is U+001C FILE SEPARATOR. * - It is U+001D GROUP SEPARATOR. * - It is U+001E RECORD SEPARATOR. * - It is U+001F UNIT SEPARATOR. * * This API tries to sync with the semantics of Java's * java.lang.Character.isWhitespace(), but it may not return * the exact same results because of the Unicode version * difference. * * Note: Unicode 4.0.1 changed U+200B ZERO WIDTH SPACE from a Space Separator (Zs) * to a Format Control (Cf). Since then, isWhitespace(0x200b) returns false. * See http://www.unicode.org/versions/Unicode4.0.1/ * * Note: There are several ICU whitespace functions; please see the uchar.h * file documentation for a detailed comparison. * * @param c the code point to be tested * @return TRUE if the code point is a whitespace character according to Java/ICU * * @see u_isspace * @see u_isJavaSpaceChar * @see u_isUWhiteSpace * @stable ICU 2.0 */ U_STABLE UBool U_EXPORT2 u_isWhitespace(UChar32 c); /** * Determines whether the specified code point is a control character * (as defined by this function). * A control character is one of the following: * - ISO 8-bit control character (U+0000..U+001f and U+007f..U+009f) * - U_CONTROL_CHAR (Cc) * - U_FORMAT_CHAR (Cf) * - U_LINE_SEPARATOR (Zl) * - U_PARAGRAPH_SEPARATOR (Zp) * * This is a C/POSIX migration function. * See the comments about C/POSIX character classification functions in the * documentation at the top of this header file. * * @param c the code point to be tested * @return TRUE if the code point is a control character * * @see UCHAR_DEFAULT_IGNORABLE_CODE_POINT * @see u_isprint * @stable ICU 2.0 */ U_STABLE UBool U_EXPORT2 u_iscntrl(UChar32 c); /** * Determines whether the specified code point is an ISO control code. * True for U+0000..U+001f and U+007f..U+009f (general category "Cc"). * * Same as java.lang.Character.isISOControl(). * * @param c the code point to be tested * @return TRUE if the code point is an ISO control code * * @see u_iscntrl * @stable ICU 2.6 */ U_STABLE UBool U_EXPORT2 u_isISOControl(UChar32 c); /** * Determines whether the specified code point is a printable character. * True for general categories other than "C" (controls). * * This is a C/POSIX migration function. * See the comments about C/POSIX character classification functions in the * documentation at the top of this header file. * * @param c the code point to be tested * @return TRUE if the code point is a printable character * * @see UCHAR_DEFAULT_IGNORABLE_CODE_POINT * @see u_iscntrl * @stable ICU 2.0 */ U_STABLE UBool U_EXPORT2 u_isprint(UChar32 c); /** * Determines whether the specified code point is a base character. * True for general categories "L" (letters), "N" (numbers), * "Mc" (spacing combining marks), and "Me" (enclosing marks). * * Note that this is different from the Unicode definition in * chapter 3.5, conformance clause D13, * which defines base characters to be all characters (not Cn) * that do not graphically combine with preceding characters (M) * and that are neither control (Cc) or format (Cf) characters. * * @param c the code point to be tested * @return TRUE if the code point is a base character according to this function * * @see u_isalpha * @see u_isdigit * @stable ICU 2.0 */ U_STABLE UBool U_EXPORT2 u_isbase(UChar32 c); /** * Returns the bidirectional category value for the code point, * which is used in the Unicode bidirectional algorithm * (UAX #9 http://www.unicode.org/reports/tr9/). * Note that some unassigned code points have bidi values * of R or AL because they are in blocks that are reserved * for Right-To-Left scripts. * * Same as java.lang.Character.getDirectionality() * * @param c the code point to be tested * @return the bidirectional category (UCharDirection) value * * @see UCharDirection * @stable ICU 2.0 */ U_STABLE UCharDirection U_EXPORT2 u_charDirection(UChar32 c); /** * Determines whether the code point has the Bidi_Mirrored property. * This property is set for characters that are commonly used in * Right-To-Left contexts and need to be displayed with a "mirrored" * glyph. * * Same as java.lang.Character.isMirrored(). * Same as UCHAR_BIDI_MIRRORED * * @param c the code point to be tested * @return TRUE if the character has the Bidi_Mirrored property * * @see UCHAR_BIDI_MIRRORED * @stable ICU 2.0 */ U_STABLE UBool U_EXPORT2 u_isMirrored(UChar32 c); /** * Maps the specified character to a "mirror-image" character. * For characters with the Bidi_Mirrored property, implementations * sometimes need a "poor man's" mapping to another Unicode * character (code point) such that the default glyph may serve * as the mirror-image of the default glyph of the specified * character. This is useful for text conversion to and from * codepages with visual order, and for displays without glyph * selecetion capabilities. * * @param c the code point to be mapped * @return another Unicode code point that may serve as a mirror-image * substitute, or c itself if there is no such mapping or c * does not have the Bidi_Mirrored property * * @see UCHAR_BIDI_MIRRORED * @see u_isMirrored * @stable ICU 2.0 */ U_STABLE UChar32 U_EXPORT2 u_charMirror(UChar32 c); /** * Returns the general category value for the code point. * * Same as java.lang.Character.getType(). * * @param c the code point to be tested * @return the general category (UCharCategory) value * * @see UCharCategory * @stable ICU 2.0 */ U_STABLE int8_t U_EXPORT2 u_charType(UChar32 c); /** * Get a single-bit bit set for the general category of a character. * This bit set can be compared bitwise with U_GC_SM_MASK, U_GC_L_MASK, etc. * Same as U_MASK(u_charType(c)). * * @param c the code point to be tested * @return a single-bit mask corresponding to the general category (UCharCategory) value * * @see u_charType * @see UCharCategory * @see U_GC_CN_MASK * @stable ICU 2.1 */ #define U_GET_GC_MASK(c) U_MASK(u_charType(c)) /** * Callback from u_enumCharTypes(), is called for each contiguous range * of code points c (where start<=cnameChoice, the character name written * into the buffer is the "modern" name or the name that was defined * in Unicode version 1.0. * The name contains only "invariant" characters * like A-Z, 0-9, space, and '-'. * Unicode 1.0 names are only retrieved if they are different from the modern * names and if the data file contains the data for them. gennames may or may * not be called with a command line option to include 1.0 names in unames.dat. * * @param code The character (code point) for which to get the name. * It must be 0<=code<=0x10ffff. * @param nameChoice Selector for which name to get. * @param buffer Destination address for copying the name. * The name will always be zero-terminated. * If there is no name, then the buffer will be set to the empty string. * @param bufferLength ==sizeof(buffer) * @param pErrorCode Pointer to a UErrorCode variable; * check for U_SUCCESS() after u_charName() * returns. * @return The length of the name, or 0 if there is no name for this character. * If the bufferLength is less than or equal to the length, then the buffer * contains the truncated name and the returned length indicates the full * length of the name. * The length does not include the zero-termination. * * @see UCharNameChoice * @see u_charFromName * @see u_enumCharNames * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_charName(UChar32 code, UCharNameChoice nameChoice, char *buffer, int32_t bufferLength, UErrorCode *pErrorCode); /** * Get the ISO 10646 comment for a character. * The ISO 10646 comment is an informative field in the Unicode Character * Database (UnicodeData.txt field 11) and is from the ISO 10646 names list. * * Note: Unicode 5.2 removes all ISO comment data, resulting in empty strings * returned for all characters. * * @param c The character (code point) for which to get the ISO comment. * It must be 0<=c<=0x10ffff. * @param dest Destination address for copying the comment. * The comment will be zero-terminated if possible. * If there is no comment, then the buffer will be set to the empty string. * @param destCapacity ==sizeof(dest) * @param pErrorCode Pointer to a UErrorCode variable; * check for U_SUCCESS() after u_getISOComment() * returns. * @return The length of the comment, or 0 if there is no comment for this character. * If the destCapacity is less than or equal to the length, then the buffer * contains the truncated name and the returned length indicates the full * length of the name. * The length does not include the zero-termination. * * @stable ICU 2.2 */ U_STABLE int32_t U_EXPORT2 u_getISOComment(UChar32 c, char *dest, int32_t destCapacity, UErrorCode *pErrorCode); /** * Find a Unicode character by its name and return its code point value. * The name is matched exactly and completely. * If the name does not correspond to a code point, pErrorCode * is set to U_INVALID_CHAR_FOUND. * A Unicode 1.0 name is matched only if it differs from the modern name. * Unicode names are all uppercase. Extended names are lowercase followed * by an uppercase hexadecimal number, and within angle brackets. * * @param nameChoice Selector for which name to match. * @param name The name to match. * @param pErrorCode Pointer to a UErrorCode variable * @return The Unicode value of the code point with the given name, * or an undefined value if there is no such code point. * * @see UCharNameChoice * @see u_charName * @see u_enumCharNames * @stable ICU 1.7 */ U_STABLE UChar32 U_EXPORT2 u_charFromName(UCharNameChoice nameChoice, const char *name, UErrorCode *pErrorCode); /** * Type of a callback function for u_enumCharNames() that gets called * for each Unicode character with the code point value and * the character name. * If such a function returns FALSE, then the enumeration is stopped. * * @param context The context pointer that was passed to u_enumCharNames(). * @param code The Unicode code point for the character with this name. * @param nameChoice Selector for which kind of names is enumerated. * @param name The character's name, zero-terminated. * @param length The length of the name. * @return TRUE if the enumeration should continue, FALSE to stop it. * * @see UCharNameChoice * @see u_enumCharNames * @stable ICU 1.7 */ typedef UBool U_CALLCONV UEnumCharNamesFn(void *context, UChar32 code, UCharNameChoice nameChoice, const char *name, int32_t length); /** * Enumerate all assigned Unicode characters between the start and limit * code points (start inclusive, limit exclusive) and call a function * for each, passing the code point value and the character name. * For Unicode 1.0 names, only those are enumerated that differ from the * modern names. * * @param start The first code point in the enumeration range. * @param limit One more than the last code point in the enumeration range * (the first one after the range). * @param fn The function that is to be called for each character name. * @param context An arbitrary pointer that is passed to the function. * @param nameChoice Selector for which kind of names to enumerate. * @param pErrorCode Pointer to a UErrorCode variable * * @see UCharNameChoice * @see UEnumCharNamesFn * @see u_charName * @see u_charFromName * @stable ICU 1.7 */ U_STABLE void U_EXPORT2 u_enumCharNames(UChar32 start, UChar32 limit, UEnumCharNamesFn *fn, void *context, UCharNameChoice nameChoice, UErrorCode *pErrorCode); /** * Return the Unicode name for a given property, as given in the * Unicode database file PropertyAliases.txt. * * In addition, this function maps the property * UCHAR_GENERAL_CATEGORY_MASK to the synthetic names "gcm" / * "General_Category_Mask". These names are not in * PropertyAliases.txt. * * @param property UProperty selector other than UCHAR_INVALID_CODE. * If out of range, NULL is returned. * * @param nameChoice selector for which name to get. If out of range, * NULL is returned. All properties have a long name. Most * have a short name, but some do not. Unicode allows for * additional names; if present these will be returned by * U_LONG_PROPERTY_NAME + i, where i=1, 2,... * * @return a pointer to the name, or NULL if either the * property or the nameChoice is out of range. If a given * nameChoice returns NULL, then all larger values of * nameChoice will return NULL, with one exception: if NULL is * returned for U_SHORT_PROPERTY_NAME, then * U_LONG_PROPERTY_NAME (and higher) may still return a * non-NULL value. The returned pointer is valid until * u_cleanup() is called. * * @see UProperty * @see UPropertyNameChoice * @stable ICU 2.4 */ U_STABLE const char* U_EXPORT2 u_getPropertyName(UProperty property, UPropertyNameChoice nameChoice); /** * Return the UProperty enum for a given property name, as specified * in the Unicode database file PropertyAliases.txt. Short, long, and * any other variants are recognized. * * In addition, this function maps the synthetic names "gcm" / * "General_Category_Mask" to the property * UCHAR_GENERAL_CATEGORY_MASK. These names are not in * PropertyAliases.txt. * * @param alias the property name to be matched. The name is compared * using "loose matching" as described in PropertyAliases.txt. * * @return a UProperty enum, or UCHAR_INVALID_CODE if the given name * does not match any property. * * @see UProperty * @stable ICU 2.4 */ U_STABLE UProperty U_EXPORT2 u_getPropertyEnum(const char* alias); /** * Return the Unicode name for a given property value, as given in the * Unicode database file PropertyValueAliases.txt. * * Note: Some of the names in PropertyValueAliases.txt can only be * retrieved using UCHAR_GENERAL_CATEGORY_MASK, not * UCHAR_GENERAL_CATEGORY. These include: "C" / "Other", "L" / * "Letter", "LC" / "Cased_Letter", "M" / "Mark", "N" / "Number", "P" * / "Punctuation", "S" / "Symbol", and "Z" / "Separator". * * @param property UProperty selector constant. * Must be UCHAR_BINARY_START<=which2<=radix<=36 or if the * value of c is not a valid digit in the specified * radix, -1 is returned. A character is a valid digit * if at least one of the following is true: *
    *
  • The character has a decimal digit value. * Such characters have the general category "Nd" (decimal digit numbers) * and a Numeric_Type of Decimal. * In this case the value is the character's decimal digit value.
  • *
  • The character is one of the uppercase Latin letters * 'A' through 'Z'. * In this case the value is c-'A'+10.
  • *
  • The character is one of the lowercase Latin letters * 'a' through 'z'. * In this case the value is ch-'a'+10.
  • *
  • Latin letters from both the ASCII range (0061..007A, 0041..005A) * as well as from the Fullwidth ASCII range (FF41..FF5A, FF21..FF3A) * are recognized.
  • *
* * Same as java.lang.Character.digit(). * * @param ch the code point to be tested. * @param radix the radix. * @return the numeric value represented by the character in the * specified radix, * or -1 if there is no value or if the value exceeds the radix. * * @see UCHAR_NUMERIC_TYPE * @see u_forDigit * @see u_charDigitValue * @see u_isdigit * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_digit(UChar32 ch, int8_t radix); /** * Determines the character representation for a specific digit in * the specified radix. If the value of radix is not a * valid radix, or the value of digit is not a valid * digit in the specified radix, the null character * (U+0000) is returned. *

* The radix argument is valid if it is greater than or * equal to 2 and less than or equal to 36. * The digit argument is valid if * 0 <= digit < radix. *

* If the digit is less than 10, then * '0' + digit is returned. Otherwise, the value * 'a' + digit - 10 is returned. * * Same as java.lang.Character.forDigit(). * * @param digit the number to convert to a character. * @param radix the radix. * @return the char representation of the specified digit * in the specified radix. * * @see u_digit * @see u_charDigitValue * @see u_isdigit * @stable ICU 2.0 */ U_STABLE UChar32 U_EXPORT2 u_forDigit(int32_t digit, int8_t radix); /** * Get the "age" of the code point. * The "age" is the Unicode version when the code point was first * designated (as a non-character or for Private Use) * or assigned a character. * This can be useful to avoid emitting code points to receiving * processes that do not accept newer characters. * The data is from the UCD file DerivedAge.txt. * * @param c The code point. * @param versionArray The Unicode version number array, to be filled in. * * @stable ICU 2.1 */ U_STABLE void U_EXPORT2 u_charAge(UChar32 c, UVersionInfo versionArray); /** * Gets the Unicode version information. * The version array is filled in with the version information * for the Unicode standard that is currently used by ICU. * For example, Unicode version 3.1.1 is represented as an array with * the values { 3, 1, 1, 0 }. * * @param versionArray an output array that will be filled in with * the Unicode version number * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 u_getUnicodeVersion(UVersionInfo versionArray); #if !UCONFIG_NO_NORMALIZATION /** * Get the FC_NFKC_Closure property string for a character. * See Unicode Standard Annex #15 for details, search for "FC_NFKC_Closure" * or for "FNC": http://www.unicode.org/reports/tr15/ * * @param c The character (code point) for which to get the FC_NFKC_Closure string. * It must be 0<=c<=0x10ffff. * @param dest Destination address for copying the string. * The string will be zero-terminated if possible. * If there is no FC_NFKC_Closure string, * then the buffer will be set to the empty string. * @param destCapacity ==sizeof(dest) * @param pErrorCode Pointer to a UErrorCode variable. * @return The length of the string, or 0 if there is no FC_NFKC_Closure string for this character. * If the destCapacity is less than or equal to the length, then the buffer * contains the truncated name and the returned length indicates the full * length of the name. * The length does not include the zero-termination. * * @stable ICU 2.2 */ U_STABLE int32_t U_EXPORT2 u_getFC_NFKC_Closure(UChar32 c, UChar *dest, int32_t destCapacity, UErrorCode *pErrorCode); #endif U_CDECL_END #endif /*_UCHAR*/ /*eof*/ android-audiosystem-1.8+13.10.20130807/include/unicode/resbund.h0000644000015700001700000004332212200324306024562 0ustar pbuserpbgroup00000000000000/* ****************************************************************************** * * Copyright (C) 1996-2007, International Business Machines Corporation * and others. All Rights Reserved. * ****************************************************************************** * * File resbund.h * * CREATED BY * Richard Gillam * * Modification History: * * Date Name Description * 2/5/97 aliu Added scanForLocaleInFile. Added * constructor which attempts to read resource bundle * from a specific file, without searching other files. * 2/11/97 aliu Added UErrorCode return values to constructors. Fixed * infinite loops in scanForFile and scanForLocale. * Modified getRawResourceData to not delete storage * in localeData and resourceData which it doesn't own. * Added Mac compatibility #ifdefs for tellp() and * ios::nocreate. * 2/18/97 helena Updated with 100% documentation coverage. * 3/13/97 aliu Rewrote to load in entire resource bundle and store * it as a Hashtable of ResourceBundleData objects. * Added state table to govern parsing of files. * Modified to load locale index out of new file * distinct from default.txt. * 3/25/97 aliu Modified to support 2-d arrays, needed for timezone * data. Added support for custom file suffixes. Again, * needed to support timezone data. * 4/7/97 aliu Cleaned up. * 03/02/99 stephen Removed dependency on FILE*. * 03/29/99 helena Merged Bertrand and Stephen's changes. * 06/11/99 stephen Removed parsing of .txt files. * Reworked to use new binary format. * Cleaned up. * 06/14/99 stephen Removed methods taking a filename suffix. * 11/09/99 weiv Added getLocale(), fRealLocale, removed fRealLocaleID ****************************************************************************** */ #ifndef RESBUND_H #define RESBUND_H #include "unicode/utypes.h" #include "unicode/uobject.h" #include "unicode/ures.h" #include "unicode/unistr.h" #include "unicode/locid.h" /** * \file * \brief C++ API: Resource Bundle */ U_NAMESPACE_BEGIN /** * A class representing a collection of resource information pertaining to a given * locale. A resource bundle provides a way of accessing locale- specfic information in * a data file. You create a resource bundle that manages the resources for a given * locale and then ask it for individual resources. *

* Resource bundles in ICU4C are currently defined using text files which conform to the following * BNF definition. * More on resource bundle concepts and syntax can be found in the * Users Guide. *

* * The ResourceBundle class is not suitable for subclassing. * * @stable ICU 2.0 */ class U_COMMON_API ResourceBundle : public UObject { public: /** * Constructor * * @param packageName The packageName and locale together point to an ICU udata object, * as defined by udata_open( packageName, "res", locale, err) * or equivalent. Typically, packageName will refer to a (.dat) file, or to * a package registered with udata_setAppData(). Using a full file or directory * pathname for packageName is deprecated. * @param locale This is the locale this resource bundle is for. To get resources * for the French locale, for example, you would create a * ResourceBundle passing Locale::FRENCH for the "locale" parameter, * and all subsequent calls to that resource bundle will return * resources that pertain to the French locale. If the caller doesn't * pass a locale parameter, the default locale for the system (as * returned by Locale::getDefault()) will be used. * @param err The Error Code. * The UErrorCode& err parameter is used to return status information to the user. To * check whether the construction succeeded or not, you should check the value of * U_SUCCESS(err). If you wish more detailed information, you can check for * informational error results which still indicate success. U_USING_FALLBACK_WARNING * indicates that a fall back locale was used. For example, 'de_CH' was requested, * but nothing was found there, so 'de' was used. U_USING_DEFAULT_WARNING indicates that * the default locale data was used; neither the requested locale nor any of its * fall back locales could be found. * @stable ICU 2.0 */ ResourceBundle(const UnicodeString& packageName, const Locale& locale, UErrorCode& err); /** * Construct a resource bundle for the default bundle in the specified package. * * @param packageName The packageName and locale together point to an ICU udata object, * as defined by udata_open( packageName, "res", locale, err) * or equivalent. Typically, packageName will refer to a (.dat) file, or to * a package registered with udata_setAppData(). Using a full file or directory * pathname for packageName is deprecated. * @param err A UErrorCode value * @stable ICU 2.0 */ ResourceBundle(const UnicodeString& packageName, UErrorCode& err); /** * Construct a resource bundle for the ICU default bundle. * * @param err A UErrorCode value * @stable ICU 2.0 */ ResourceBundle(UErrorCode &err); /** * Standard constructor, onstructs a resource bundle for the locale-specific * bundle in the specified package. * * @param packageName The packageName and locale together point to an ICU udata object, * as defined by udata_open( packageName, "res", locale, err) * or equivalent. Typically, packageName will refer to a (.dat) file, or to * a package registered with udata_setAppData(). Using a full file or directory * pathname for packageName is deprecated. * NULL is used to refer to ICU data. * @param locale The locale for which to open a resource bundle. * @param err A UErrorCode value * @stable ICU 2.0 */ ResourceBundle(const char* packageName, const Locale& locale, UErrorCode& err); /** * Copy constructor. * * @param original The resource bundle to copy. * @stable ICU 2.0 */ ResourceBundle(const ResourceBundle &original); /** * Constructor from a C UResourceBundle. The resource bundle is * copied and not adopted. ures_close will still need to be used on the * original resource bundle. * * @param res A pointer to the C resource bundle. * @param status A UErrorCode value. * @stable ICU 2.0 */ ResourceBundle(UResourceBundle *res, UErrorCode &status); /** * Assignment operator. * * @param other The resource bundle to copy. * @stable ICU 2.0 */ ResourceBundle& operator=(const ResourceBundle& other); /** Destructor. * @stable ICU 2.0 */ virtual ~ResourceBundle(); /** * Clone this object. * Clones can be used concurrently in multiple threads. * If an error occurs, then NULL is returned. * The caller must delete the clone. * * @return a clone of this object * * @see getDynamicClassID * @stable ICU 2.8 */ ResourceBundle *clone() const; /** * Returns the size of a resource. Size for scalar types is always 1, and for vector/table types is * the number of child resources. * @warning Integer array is treated as a scalar type. There are no * APIs to access individual members of an integer array. It * is always returned as a whole. * * @return number of resources in a given resource. * @stable ICU 2.0 */ int32_t getSize(void) const; /** * returns a string from a string resource type * * @param status fills in the outgoing error code * could be U_MISSING_RESOURCE_ERROR if the key is not found * could be a warning * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. * @stable ICU 2.0 */ UnicodeString getString(UErrorCode& status) const; /** * returns a binary data from a resource. Can be used at most primitive resource types (binaries, * strings, ints) * * @param len fills in the length of resulting byte chunk * @param status fills in the outgoing error code * could be U_MISSING_RESOURCE_ERROR if the key is not found * could be a warning * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING * @return a pointer to a chunk of unsigned bytes which live in a memory mapped/DLL file. * @stable ICU 2.0 */ const uint8_t* getBinary(int32_t& len, UErrorCode& status) const; /** * returns an integer vector from a resource. * * @param len fills in the length of resulting integer vector * @param status fills in the outgoing error code * could be U_MISSING_RESOURCE_ERROR if the key is not found * could be a warning * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING * @return a pointer to a vector of integers that lives in a memory mapped/DLL file. * @stable ICU 2.0 */ const int32_t* getIntVector(int32_t& len, UErrorCode& status) const; /** * returns an unsigned integer from a resource. * This integer is originally 28 bits. * * @param status fills in the outgoing error code * could be U_MISSING_RESOURCE_ERROR if the key is not found * could be a warning * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING * @return an unsigned integer value * @stable ICU 2.0 */ uint32_t getUInt(UErrorCode& status) const; /** * returns a signed integer from a resource. * This integer is originally 28 bit and the sign gets propagated. * * @param status fills in the outgoing error code * could be U_MISSING_RESOURCE_ERROR if the key is not found * could be a warning * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING * @return a signed integer value * @stable ICU 2.0 */ int32_t getInt(UErrorCode& status) const; /** * Checks whether the resource has another element to iterate over. * * @return TRUE if there are more elements, FALSE if there is no more elements * @stable ICU 2.0 */ UBool hasNext(void) const; /** * Resets the internal context of a resource so that iteration starts from the first element. * * @stable ICU 2.0 */ void resetIterator(void); /** * Returns the key associated with this resource. Not all the resources have a key - only * those that are members of a table. * * @return a key associated to this resource, or NULL if it doesn't have a key * @stable ICU 2.0 */ const char* getKey(void) const; /** * Gets the locale ID of the resource bundle as a string. * Same as getLocale().getName() . * * @return the locale ID of the resource bundle as a string * @stable ICU 2.0 */ const char* getName(void) const; /** * Returns the type of a resource. Available types are defined in enum UResType * * @return type of the given resource. * @stable ICU 2.0 */ UResType getType(void) const; /** * Returns the next resource in a given resource or NULL if there are no more resources * * @param status fills in the outgoing error code * @return ResourceBundle object. * @stable ICU 2.0 */ ResourceBundle getNext(UErrorCode& status); /** * Returns the next string in a resource or NULL if there are no more resources * to iterate over. * * @param status fills in the outgoing error code * @return an UnicodeString object. * @stable ICU 2.0 */ UnicodeString getNextString(UErrorCode& status); /** * Returns the next string in a resource or NULL if there are no more resources * to iterate over. * * @param key fill in for key associated with this string * @param status fills in the outgoing error code * @return an UnicodeString object. * @stable ICU 2.0 */ UnicodeString getNextString(const char ** key, UErrorCode& status); /** * Returns the resource in a resource at the specified index. * * @param index an index to the wanted resource. * @param status fills in the outgoing error code * @return ResourceBundle object. If there is an error, resource is invalid. * @stable ICU 2.0 */ ResourceBundle get(int32_t index, UErrorCode& status) const; /** * Returns the string in a given resource at the specified index. * * @param index an index to the wanted string. * @param status fills in the outgoing error code * @return an UnicodeString object. If there is an error, string is bogus * @stable ICU 2.0 */ UnicodeString getStringEx(int32_t index, UErrorCode& status) const; /** * Returns a resource in a resource that has a given key. This procedure works only with table * resources. * * @param key a key associated with the wanted resource * @param status fills in the outgoing error code. * @return ResourceBundle object. If there is an error, resource is invalid. * @stable ICU 2.0 */ ResourceBundle get(const char* key, UErrorCode& status) const; /** * Returns a string in a resource that has a given key. This procedure works only with table * resources. * * @param key a key associated with the wanted string * @param status fills in the outgoing error code * @return an UnicodeString object. If there is an error, string is bogus * @stable ICU 2.0 */ UnicodeString getStringEx(const char* key, UErrorCode& status) const; /** * Return the version number associated with this ResourceBundle as a string. Please * use getVersion, as this method is going to be deprecated. * * @return A version number string as specified in the resource bundle or its parent. * The caller does not own this string. * @see getVersion * @deprecated ICU 2.8 Use getVersion instead. */ const char* getVersionNumber(void) const; /** * Return the version number associated with this ResourceBundle as a UVersionInfo array. * * @param versionInfo A UVersionInfo array that is filled with the version number * as specified in the resource bundle or its parent. * @stable ICU 2.0 */ void getVersion(UVersionInfo versionInfo) const; /** * Return the Locale associated with this ResourceBundle. * * @return a Locale object * @deprecated ICU 2.8 Use getLocale(ULocDataLocaleType type, UErrorCode &status) overload instead. */ const Locale& getLocale(void) const; /** * Return the Locale associated with this ResourceBundle. * @param type You can choose between requested, valid and actual * locale. For description see the definition of * ULocDataLocaleType in uloc.h * @param status just for catching illegal arguments * * @return a Locale object * @stable ICU 2.8 */ const Locale getLocale(ULocDataLocaleType type, UErrorCode &status) const; /** * This API implements multilevel fallback * @internal */ ResourceBundle getWithFallback(const char* key, UErrorCode& status); /** * ICU "poor man's RTTI", returns a UClassID for the actual class. * * @stable ICU 2.2 */ virtual UClassID getDynamicClassID() const; /** * ICU "poor man's RTTI", returns a UClassID for this class. * * @stable ICU 2.2 */ static UClassID U_EXPORT2 getStaticClassID(); private: ResourceBundle(); // default constructor not implemented UResourceBundle *fResource; void constructForLocale(const UnicodeString& path, const Locale& locale, UErrorCode& error); Locale *fLocale; }; U_NAMESPACE_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/udata.h0000644000015700001700000003525712200324306024226 0ustar pbuserpbgroup00000000000000/* ****************************************************************************** * * Copyright (C) 1999-2010, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * file name: udata.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 1999oct25 * created by: Markus W. Scherer */ #ifndef __UDATA_H__ #define __UDATA_H__ #include "unicode/utypes.h" #include "unicode/localpointer.h" U_CDECL_BEGIN /** * \file * \brief C API: Data loading interface * *

Information about data loading interface

* * This API is used to find and efficiently load data for ICU and applications * using ICU. It provides an abstract interface that specifies a data type and * name to find and load the data. Normally this API is used by other ICU APIs * to load required data out of the ICU data library, but it can be used to * load data out of other places. * * See the User Guide Data Management chapter. */ #ifndef U_HIDE_INTERNAL_API /** * Character used to separate package names from tree names * @internal ICU 3.0 */ #define U_TREE_SEPARATOR '-' /** * String used to separate package names from tree names * @internal ICU 3.0 */ #define U_TREE_SEPARATOR_STRING "-" /** * Character used to separate parts of entry names * @internal ICU 3.0 */ #define U_TREE_ENTRY_SEP_CHAR '/' /** * String used to separate parts of entry names * @internal ICU 3.0 */ #define U_TREE_ENTRY_SEP_STRING "/" /** * Alias for standard ICU data * @internal ICU 3.0 */ #define U_ICUDATA_ALIAS "ICUDATA" #endif /* U_HIDE_INTERNAL_API */ /** * UDataInfo contains the properties about the requested data. * This is meta data. * *

This structure may grow in the future, indicated by the * size field.

* *

The platform data property fields help determine if a data * file can be efficiently used on a given machine. * The particular fields are of importance only if the data * is affected by the properties - if there is integer data * with word sizes > 1 byte, char* text, or UChar* text.

* *

The implementation for the udata_open[Choice]() * functions may reject data based on the value in isBigEndian. * No other field is used by the udata API implementation.

* *

The dataFormat may be used to identify * the kind of data, e.g. a converter table.

* *

The formatVersion field should be used to * make sure that the format can be interpreted. * I may be a good idea to check only for the one or two highest * of the version elements to allow the data memory to * get more or somewhat rearranged contents, for as long * as the using code can still interpret the older contents.

* *

The dataVersion field is intended to be a * common place to store the source version of the data; * for data from the Unicode character database, this could * reflect the Unicode version.

* @stable ICU 2.0 */ typedef struct { /** sizeof(UDataInfo) * @stable ICU 2.0 */ uint16_t size; /** unused, set to 0 * @stable ICU 2.0*/ uint16_t reservedWord; /* platform data properties */ /** 0 for little-endian machine, 1 for big-endian * @stable ICU 2.0 */ uint8_t isBigEndian; /** see U_CHARSET_FAMILY values in utypes.h * @stable ICU 2.0*/ uint8_t charsetFamily; /** sizeof(UChar), one of { 1, 2, 4 } * @stable ICU 2.0*/ uint8_t sizeofUChar; /** unused, set to 0 * @stable ICU 2.0*/ uint8_t reservedByte; /** data format identifier * @stable ICU 2.0*/ uint8_t dataFormat[4]; /** versions: [0] major [1] minor [2] milli [3] micro * @stable ICU 2.0*/ uint8_t formatVersion[4]; /** versions: [0] major [1] minor [2] milli [3] micro * @stable ICU 2.0*/ uint8_t dataVersion[4]; } UDataInfo; /* API for reading data -----------------------------------------------------*/ /** * Forward declaration of the data memory type. * @stable ICU 2.0 */ typedef struct UDataMemory UDataMemory; /** * Callback function for udata_openChoice(). * @param context parameter passed into udata_openChoice(). * @param type The type of the data as passed into udata_openChoice(). * It may be NULL. * @param name The name of the data as passed into udata_openChoice(). * @param pInfo A pointer to the UDataInfo structure * of data that has been loaded and will be returned * by udata_openChoice() if this function * returns TRUE. * @return TRUE if the current data memory is acceptable * @stable ICU 2.0 */ typedef UBool U_CALLCONV UDataMemoryIsAcceptable(void *context, const char *type, const char *name, const UDataInfo *pInfo); /** * Convenience function. * This function works the same as udata_openChoice * except that any data that matches the type and name * is assumed to be acceptable. * @param path Specifies an absolute path and/or a basename for the * finding of the data in the file system. * NULL for ICU data. * @param type A string that specifies the type of data to be loaded. * For example, resource bundles are loaded with type "res", * conversion tables with type "cnv". * This may be NULL or empty. * @param name A string that specifies the name of the data. * @param pErrorCode An ICU UErrorCode parameter. It must not be NULL. * @return A pointer (handle) to a data memory object, or NULL * if an error occurs. Call udata_getMemory() * to get a pointer to the actual data. * * @see udata_openChoice * @stable ICU 2.0 */ U_STABLE UDataMemory * U_EXPORT2 udata_open(const char *path, const char *type, const char *name, UErrorCode *pErrorCode); /** * Data loading function. * This function is used to find and load efficiently data for * ICU and applications using ICU. * It provides an abstract interface that allows to specify a data * type and name to find and load the data. * *

The implementation depends on platform properties and user preferences * and may involve loading shared libraries (DLLs), mapping * files into memory, or fopen()/fread() files. * It may also involve using static memory or database queries etc. * Several or all data items may be combined into one entity * (DLL, memory-mappable file).

* *

The data is always preceded by a header that includes * a UDataInfo structure. * The caller's isAcceptable() function is called to make * sure that the data is useful. It may be called several times if it * rejects the data and there is more than one location with data * matching the type and name.

* *

If path==NULL, then ICU data is loaded. * Otherwise, it is separated into a basename and a basename-less directory string. * The basename is used as the data package name, and the directory is * logically prepended to the ICU data directory string.

* *

For details about ICU data loading see the User Guide * Data Management chapter. (http://icu-project.org/userguide/icudata.html)

* * @param path Specifies an absolute path and/or a basename for the * finding of the data in the file system. * NULL for ICU data. * @param type A string that specifies the type of data to be loaded. * For example, resource bundles are loaded with type "res", * conversion tables with type "cnv". * This may be NULL or empty. * @param name A string that specifies the name of the data. * @param isAcceptable This function is called to verify that loaded data * is useful for the client code. If it returns FALSE * for all data items, then udata_openChoice() * will return with an error. * @param context Arbitrary parameter to be passed into isAcceptable. * @param pErrorCode An ICU UErrorCode parameter. It must not be NULL. * @return A pointer (handle) to a data memory object, or NULL * if an error occurs. Call udata_getMemory() * to get a pointer to the actual data. * @stable ICU 2.0 */ U_STABLE UDataMemory * U_EXPORT2 udata_openChoice(const char *path, const char *type, const char *name, UDataMemoryIsAcceptable *isAcceptable, void *context, UErrorCode *pErrorCode); /** * Close the data memory. * This function must be called to allow the system to * release resources associated with this data memory. * @param pData The pointer to data memory object * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 udata_close(UDataMemory *pData); #if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN /** * \class LocalUDataMemoryPointer * "Smart pointer" class, closes a UDataMemory via udata_close(). * For most methods see the LocalPointerBase base class. * * @see LocalPointerBase * @see LocalPointer * @stable ICU 4.4 */ U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close); U_NAMESPACE_END #endif /** * Get the pointer to the actual data inside the data memory. * The data is read-only. * @param pData The pointer to data memory object * @stable ICU 2.0 */ U_STABLE const void * U_EXPORT2 udata_getMemory(UDataMemory *pData); /** * Get the information from the data memory header. * This allows to get access to the header containing * platform data properties etc. which is not part of * the data itself and can therefore not be accessed * via the pointer that udata_getMemory() returns. * * @param pData pointer to the data memory object * @param pInfo pointer to a UDataInfo object; * its size field must be set correctly, * typically to sizeof(UDataInfo). * * *pInfo will be filled with the UDataInfo structure * in the data memory object. If this structure is smaller than * pInfo->size, then the size will be * adjusted and only part of the structure will be filled. * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 udata_getInfo(UDataMemory *pData, UDataInfo *pInfo); /** * This function bypasses the normal ICU data loading process and * allows you to force ICU's system data to come out of a user-specified * area in memory. * * The format of this data is that of the icu common data file, as is * generated by the pkgdata tool with mode=common or mode=dll. * You can read in a whole common mode file and pass the address to the start of the * data, or (with the appropriate link options) pass in the pointer to * the data that has been loaded from a dll by the operating system, * as shown in this code: * * extern const char U_IMPORT U_ICUDATA_ENTRY_POINT []; * // U_ICUDATA_ENTRY_POINT is same as entry point specified to pkgdata tool * UErrorCode status = U_ZERO_ERROR; * * udata_setCommonData(&U_ICUDATA_ENTRY_POINT, &status); * * It is important that the declaration be as above. The entry point * must not be declared as an extern void*. * * Starting with ICU 4.4, it is possible to set several data packages, * one per call to this function. * udata_open() will look for data in the multiple data packages in the order * in which they were set. * The position of the linked-in or default-name ICU .data package in the * search list depends on when the first data item is loaded that is not contained * in the already explicitly set packages. * If data was loaded implicitly before the first call to this function * (for example, via opening a converter, constructing a UnicodeString * from default-codepage data, using formatting or collation APIs, etc.), * then the default data will be first in the list. * * This function has no effect on application (non ICU) data. See udata_setAppData() * for similar functionality for application data. * * @param data pointer to ICU common data * @param err outgoing error status U_USING_DEFAULT_WARNING, U_UNSUPPORTED_ERROR * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 udata_setCommonData(const void *data, UErrorCode *err); /** * This function bypasses the normal ICU data loading process for application-specific * data and allows you to force the it to come out of a user-specified * pointer. * * The format of this data is that of the icu common data file, like 'icudt26l.dat' * or the corresponding shared library (DLL) file. * The application must read in or otherwise construct an image of the data and then * pass the address of it to this function. * * * Warning: setAppData will set a U_USING_DEFAULT_WARNING code if * data with the specifed path that has already been opened, or * if setAppData with the same path has already been called. * Any such calls to setAppData will have no effect. * * * @param packageName the package name by which the application will refer * to (open) this data * @param data pointer to the data * @param err outgoing error status U_USING_DEFAULT_WARNING, U_UNSUPPORTED_ERROR * @see udata_setCommonData * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 udata_setAppData(const char *packageName, const void *data, UErrorCode *err); /** * Possible settings for udata_setFileAccess() * @see udata_setFileAccess * @stable ICU 3.4 */ typedef enum UDataFileAccess { /** ICU looks for data in single files first, then in packages. (default) */ UDATA_FILES_FIRST, /** ICU only loads data from packages, not from single files. */ UDATA_ONLY_PACKAGES, /** ICU loads data from packages first, and only from single files if the data cannot be found in a package. */ UDATA_PACKAGES_FIRST, /** ICU does not access the file system for data loading. */ UDATA_NO_FILES, /** An alias for the default access mode. */ UDATA_DEFAULT_ACCESS = UDATA_FILES_FIRST, UDATA_FILE_ACCESS_COUNT } UDataFileAccess; /** * This function may be called to control how ICU loads data. It must be called * before any ICU data is loaded, including application data loaded with * ures/ResourceBundle or udata APIs. This function is not multithread safe. * The results of calling it while other threads are loading data are undefined. * @param access The type of file access to be used * @param status Error code. * @see UDataFileAccess * @stable ICU 3.4 */ U_STABLE void U_EXPORT2 udata_setFileAccess(UDataFileAccess access, UErrorCode *status); U_CDECL_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/uidna.h0000644000015700001700000007653212200324306024231 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * * Copyright (C) 2003-2010, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: uidna.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2003feb1 * created by: Ram Viswanadha */ #ifndef __UIDNA_H__ #define __UIDNA_H__ #include "unicode/utypes.h" #if !UCONFIG_NO_IDNA #include "unicode/localpointer.h" #include "unicode/parseerr.h" /** * \file * \brief C API: Internationalizing Domain Names in Applications (IDNA) * * IDNA2008 is implemented according to UTS #46, see the IDNA C++ class in idna.h. * * The C API functions which do take a UIDNA * service object pointer * implement UTS #46 and IDNA2008. * The C API functions which do not take a service object pointer * implement IDNA2003. */ /* * IDNA option bit set values. */ enum { /** * Default options value: None of the other options are set. * @stable ICU 2.6 */ UIDNA_DEFAULT=0, /** * Option to allow unassigned code points in domain names and labels. * This option is ignored by the UTS46 implementation. * (UTS #46 disallows unassigned code points.) * @stable ICU 2.6 */ UIDNA_ALLOW_UNASSIGNED=1, /** * Option to check whether the input conforms to the STD3 ASCII rules, * for example the restriction of labels to LDH characters * (ASCII Letters, Digits and Hyphen-Minus). * @stable ICU 2.6 */ UIDNA_USE_STD3_RULES=2, /** * IDNA option to check for whether the input conforms to the BiDi rules. * This option is ignored by the IDNA2003 implementation. * (IDNA2003 always performs a BiDi check.) * @draft ICU 4.6 */ UIDNA_CHECK_BIDI=4, /** * IDNA option to check for whether the input conforms to the CONTEXTJ rules. * This option is ignored by the IDNA2003 implementation. * (The CONTEXTJ check is new in IDNA2008.) * @draft ICU 4.6 */ UIDNA_CHECK_CONTEXTJ=8, /** * IDNA option for nontransitional processing in ToASCII(). * By default, ToASCII() uses transitional processing. * This option is ignored by the IDNA2003 implementation. * (This is only relevant for compatibility of newer IDNA implementations with IDNA2003.) * @draft ICU 4.6 */ UIDNA_NONTRANSITIONAL_TO_ASCII=0x10, /** * IDNA option for nontransitional processing in ToUnicode(). * By default, ToUnicode() uses transitional processing. * This option is ignored by the IDNA2003 implementation. * (This is only relevant for compatibility of newer IDNA implementations with IDNA2003.) * @draft ICU 4.6 */ UIDNA_NONTRANSITIONAL_TO_UNICODE=0x20 }; /** * Opaque C service object type for the new IDNA API. * @draft ICU 4.6 */ struct UIDNA; typedef struct UIDNA UIDNA; /**< C typedef for struct UIDNA. @draft ICU 4.6 */ /** * Returns a UIDNA instance which implements UTS #46. * Returns an unmodifiable instance, owned by the caller. * Cache it for multiple operations, and uidna_close() it when done. * The instance is thread-safe, that is, it can be used concurrently. * * For details about the UTS #46 implementation see the IDNA C++ class in idna.h. * * @param options Bit set to modify the processing and error checking. * See option bit set values in uidna.h. * @param pErrorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return the UTS #46 UIDNA instance, if successful * @draft ICU 4.6 */ U_DRAFT UIDNA * U_EXPORT2 uidna_openUTS46(uint32_t options, UErrorCode *pErrorCode); /** * Closes a UIDNA instance. * @param idna UIDNA instance to be closed * @draft ICU 4.6 */ U_DRAFT void U_EXPORT2 uidna_close(UIDNA *idna); #if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN /** * \class LocalUIDNAPointer * "Smart pointer" class, closes a UIDNA via uidna_close(). * For most methods see the LocalPointerBase base class. * * @see LocalPointerBase * @see LocalPointer * @draft ICU 4.6 */ U_DEFINE_LOCAL_OPEN_POINTER(LocalUIDNAPointer, UIDNA, uidna_close); U_NAMESPACE_END #endif /** * Output container for IDNA processing errors. * Initialize with UIDNA_INFO_INITIALIZER: * \code * UIDNAInfo info = UIDNA_INFO_INITIALIZER; * int32_t length = uidna_nameToASCII(..., &info, &errorCode); * if(U_SUCCESS(errorCode) && info.errors!=0) { ... } * \endcode * @draft ICU 4.6 */ struct UIDNAInfo { /** sizeof(UIDNAInfo) @draft ICU 4.6 */ int16_t size; /** * Set to TRUE if transitional and nontransitional processing produce different results. * For details see C++ IDNAInfo::isTransitionalDifferent(). * @draft ICU 4.6 */ UBool isTransitionalDifferent; UBool reservedB3; /**< Reserved field, do not use. @internal */ /** * Bit set indicating IDNA processing errors. 0 if no errors. * See UIDNA_ERROR_... constants. * @draft ICU 4.6 */ uint32_t errors; int32_t reservedI2; /**< Reserved field, do not use. @internal */ int32_t reservedI3; /**< Reserved field, do not use. @internal */ }; typedef struct UIDNAInfo UIDNAInfo; /** * Static initializer for a UIDNAInfo struct. * @draft ICU 4.6 */ #define UIDNA_INFO_INITIALIZER { \ (int16_t)sizeof(UIDNAInfo), \ FALSE, FALSE, \ 0, 0, 0 } /** * Converts a single domain name label into its ASCII form for DNS lookup. * If any processing step fails, then pInfo->errors will be non-zero and * the result might not be an ASCII string. * The label might be modified according to the types of errors. * Labels with severe errors will be left in (or turned into) their Unicode form. * * The UErrorCode indicates an error only in exceptional cases, * such as a U_MEMORY_ALLOCATION_ERROR. * * @param idna UIDNA instance * @param label Input domain name label * @param length Label length, or -1 if NUL-terminated * @param dest Destination string buffer * @param capacity Destination buffer capacity * @param pInfo Output container of IDNA processing details. * @param pErrorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return destination string length * @draft ICU 4.6 */ U_DRAFT int32_t U_EXPORT2 uidna_labelToASCII(const UIDNA *idna, const UChar *label, int32_t length, UChar *dest, int32_t capacity, UIDNAInfo *pInfo, UErrorCode *pErrorCode); /** * Converts a single domain name label into its Unicode form for human-readable display. * If any processing step fails, then pInfo->errors will be non-zero. * The label might be modified according to the types of errors. * * The UErrorCode indicates an error only in exceptional cases, * such as a U_MEMORY_ALLOCATION_ERROR. * * @param idna UIDNA instance * @param label Input domain name label * @param length Label length, or -1 if NUL-terminated * @param dest Destination string buffer * @param capacity Destination buffer capacity * @param pInfo Output container of IDNA processing details. * @param pErrorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return destination string length * @draft ICU 4.6 */ U_DRAFT int32_t U_EXPORT2 uidna_labelToUnicode(const UIDNA *idna, const UChar *label, int32_t length, UChar *dest, int32_t capacity, UIDNAInfo *pInfo, UErrorCode *pErrorCode); /** * Converts a whole domain name into its ASCII form for DNS lookup. * If any processing step fails, then pInfo->errors will be non-zero and * the result might not be an ASCII string. * The domain name might be modified according to the types of errors. * Labels with severe errors will be left in (or turned into) their Unicode form. * * The UErrorCode indicates an error only in exceptional cases, * such as a U_MEMORY_ALLOCATION_ERROR. * * @param idna UIDNA instance * @param name Input domain name * @param length Domain name length, or -1 if NUL-terminated * @param dest Destination string buffer * @param capacity Destination buffer capacity * @param pInfo Output container of IDNA processing details. * @param pErrorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return destination string length * @draft ICU 4.6 */ U_DRAFT int32_t U_EXPORT2 uidna_nameToASCII(const UIDNA *idna, const UChar *name, int32_t length, UChar *dest, int32_t capacity, UIDNAInfo *pInfo, UErrorCode *pErrorCode); /** * Converts a whole domain name into its Unicode form for human-readable display. * If any processing step fails, then pInfo->errors will be non-zero. * The domain name might be modified according to the types of errors. * * The UErrorCode indicates an error only in exceptional cases, * such as a U_MEMORY_ALLOCATION_ERROR. * * @param idna UIDNA instance * @param name Input domain name * @param length Domain name length, or -1 if NUL-terminated * @param dest Destination string buffer * @param capacity Destination buffer capacity * @param pInfo Output container of IDNA processing details. * @param pErrorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return destination string length * @draft ICU 4.6 */ U_DRAFT int32_t U_EXPORT2 uidna_nameToUnicode(const UIDNA *idna, const UChar *name, int32_t length, UChar *dest, int32_t capacity, UIDNAInfo *pInfo, UErrorCode *pErrorCode); /* UTF-8 versions of the processing methods --------------------------------- */ /** * Converts a single domain name label into its ASCII form for DNS lookup. * UTF-8 version of uidna_labelToASCII(), same behavior. * * @param idna UIDNA instance * @param label Input domain name label * @param length Label length, or -1 if NUL-terminated * @param dest Destination string buffer * @param capacity Destination buffer capacity * @param pInfo Output container of IDNA processing details. * @param pErrorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return destination string length * @draft ICU 4.6 */ U_DRAFT int32_t U_EXPORT2 uidna_labelToASCII_UTF8(const UIDNA *idna, const char *label, int32_t length, char *dest, int32_t capacity, UIDNAInfo *pInfo, UErrorCode *pErrorCode); /** * Converts a single domain name label into its Unicode form for human-readable display. * UTF-8 version of uidna_labelToUnicode(), same behavior. * * @param idna UIDNA instance * @param label Input domain name label * @param length Label length, or -1 if NUL-terminated * @param dest Destination string buffer * @param capacity Destination buffer capacity * @param pInfo Output container of IDNA processing details. * @param pErrorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return destination string length * @draft ICU 4.6 */ U_DRAFT int32_t U_EXPORT2 uidna_labelToUnicodeUTF8(const UIDNA *idna, const char *label, int32_t length, char *dest, int32_t capacity, UIDNAInfo *pInfo, UErrorCode *pErrorCode); /** * Converts a whole domain name into its ASCII form for DNS lookup. * UTF-8 version of uidna_nameToASCII(), same behavior. * * @param idna UIDNA instance * @param name Input domain name * @param length Domain name length, or -1 if NUL-terminated * @param dest Destination string buffer * @param capacity Destination buffer capacity * @param pInfo Output container of IDNA processing details. * @param pErrorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return destination string length * @draft ICU 4.6 */ U_DRAFT int32_t U_EXPORT2 uidna_nameToASCII_UTF8(const UIDNA *idna, const char *name, int32_t length, char *dest, int32_t capacity, UIDNAInfo *pInfo, UErrorCode *pErrorCode); /** * Converts a whole domain name into its Unicode form for human-readable display. * UTF-8 version of uidna_nameToUnicode(), same behavior. * * @param idna UIDNA instance * @param name Input domain name * @param length Domain name length, or -1 if NUL-terminated * @param dest Destination string buffer * @param capacity Destination buffer capacity * @param pInfo Output container of IDNA processing details. * @param pErrorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return destination string length * @draft ICU 4.6 */ U_DRAFT int32_t U_EXPORT2 uidna_nameToUnicodeUTF8(const UIDNA *idna, const char *name, int32_t length, char *dest, int32_t capacity, UIDNAInfo *pInfo, UErrorCode *pErrorCode); /* * IDNA error bit set values. * When a domain name or label fails a processing step or does not meet the * validity criteria, then one or more of these error bits are set. */ enum { /** * A non-final domain name label (or the whole domain name) is empty. * @draft ICU 4.6 */ UIDNA_ERROR_EMPTY_LABEL=1, /** * A domain name label is longer than 63 bytes. * (See STD13/RFC1034 3.1. Name space specifications and terminology.) * This is only checked in ToASCII operations, and only if the output label is all-ASCII. * @draft ICU 4.6 */ UIDNA_ERROR_LABEL_TOO_LONG=2, /** * A domain name is longer than 255 bytes in its storage form. * (See STD13/RFC1034 3.1. Name space specifications and terminology.) * This is only checked in ToASCII operations, and only if the output domain name is all-ASCII. * @draft ICU 4.6 */ UIDNA_ERROR_DOMAIN_NAME_TOO_LONG=4, /** * A label starts with a hyphen-minus ('-'). * @draft ICU 4.6 */ UIDNA_ERROR_LEADING_HYPHEN=8, /** * A label ends with a hyphen-minus ('-'). * @draft ICU 4.6 */ UIDNA_ERROR_TRAILING_HYPHEN=0x10, /** * A label contains hyphen-minus ('-') in the third and fourth positions. * @draft ICU 4.6 */ UIDNA_ERROR_HYPHEN_3_4=0x20, /** * A label starts with a combining mark. * @draft ICU 4.6 */ UIDNA_ERROR_LEADING_COMBINING_MARK=0x40, /** * A label or domain name contains disallowed characters. * @draft ICU 4.6 */ UIDNA_ERROR_DISALLOWED=0x80, /** * A label starts with "xn--" but does not contain valid Punycode. * That is, an xn-- label failed Punycode decoding. * @draft ICU 4.6 */ UIDNA_ERROR_PUNYCODE=0x100, /** * A label contains a dot=full stop. * This can occur in an input string for a single-label function. * @draft ICU 4.6 */ UIDNA_ERROR_LABEL_HAS_DOT=0x200, /** * An ACE label does not contain a valid label string. * The label was successfully ACE (Punycode) decoded but the resulting * string had severe validation errors. For example, * it might contain characters that are not allowed in ACE labels, * or it might not be normalized. * @draft ICU 4.6 */ UIDNA_ERROR_INVALID_ACE_LABEL=0x400, /** * A label does not meet the IDNA BiDi requirements (for right-to-left characters). * @draft ICU 4.6 */ UIDNA_ERROR_BIDI=0x800, /** * A label does not meet the IDNA CONTEXTJ requirements. * @draft ICU 4.6 */ UIDNA_ERROR_CONTEXTJ=0x1000 }; /* IDNA2003 API ------------------------------------------------------------- */ /** * IDNA2003: This function implements the ToASCII operation as defined in the IDNA RFC. * This operation is done on single labels before sending it to something that expects * ASCII names. A label is an individual part of a domain name. Labels are usually * separated by dots; e.g. "www.example.com" is composed of 3 labels "www","example", and "com". * * IDNA2003 API Overview: * * The uidna_ API implements the IDNA protocol as defined in the IDNA RFC * (http://www.ietf.org/rfc/rfc3490.txt). * The RFC defines 2 operations: ToASCII and ToUnicode. Domain name labels * containing non-ASCII code points are processed by the * ToASCII operation before passing it to resolver libraries. Domain names * that are obtained from resolver libraries are processed by the * ToUnicode operation before displaying the domain name to the user. * IDNA requires that implementations process input strings with Nameprep * (http://www.ietf.org/rfc/rfc3491.txt), * which is a profile of Stringprep (http://www.ietf.org/rfc/rfc3454.txt), * and then with Punycode (http://www.ietf.org/rfc/rfc3492.txt). * Implementations of IDNA MUST fully implement Nameprep and Punycode; * neither Nameprep nor Punycode are optional. * The input and output of ToASCII and ToUnicode operations are Unicode * and are designed to be chainable, i.e., applying ToASCII or ToUnicode operations * multiple times to an input string will yield the same result as applying the operation * once. * ToUnicode(ToUnicode(ToUnicode...(ToUnicode(string)))) == ToUnicode(string) * ToASCII(ToASCII(ToASCII...(ToASCII(string))) == ToASCII(string). * * @param src Input UChar array containing label in Unicode. * @param srcLength Number of UChars in src, or -1 if NUL-terminated. * @param dest Output UChar array with ASCII (ACE encoded) label. * @param destCapacity Size of dest. * @param options A bit set of options: * * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points * and do not use STD3 ASCII rules * If unassigned code points are found the operation fails with * U_UNASSIGNED_ERROR error code. * * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations * If this option is set, the unassigned code points are in the input * are treated as normal Unicode code points. * * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions * If this option is set and the input does not satisfy STD3 rules, * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR * * @param parseError Pointer to UParseError struct to receive information on position * of error if an error is encountered. Can be NULL. * @param status ICU in/out error code parameter. * U_INVALID_CHAR_FOUND if src contains * unmatched single surrogates. * U_INDEX_OUTOFBOUNDS_ERROR if src contains * too many code points. * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough * @return The length of the result string, if successful - or in case of a buffer overflow, * in which case it will be greater than destCapacity. * @stable ICU 2.6 */ U_STABLE int32_t U_EXPORT2 uidna_toASCII(const UChar* src, int32_t srcLength, UChar* dest, int32_t destCapacity, int32_t options, UParseError* parseError, UErrorCode* status); /** * IDNA2003: This function implements the ToUnicode operation as defined in the IDNA RFC. * This operation is done on single labels before sending it to something that expects * Unicode names. A label is an individual part of a domain name. Labels are usually * separated by dots; for e.g. "www.example.com" is composed of 3 labels "www","example", and "com". * * @param src Input UChar array containing ASCII (ACE encoded) label. * @param srcLength Number of UChars in src, or -1 if NUL-terminated. * @param dest Output Converted UChar array containing Unicode equivalent of label. * @param destCapacity Size of dest. * @param options A bit set of options: * * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points * and do not use STD3 ASCII rules * If unassigned code points are found the operation fails with * U_UNASSIGNED_ERROR error code. * * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations * If this option is set, the unassigned code points are in the input * are treated as normal Unicode code points. Note: This option is * required on toUnicode operation because the RFC mandates * verification of decoded ACE input by applying toASCII and comparing * its output with source * * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions * If this option is set and the input does not satisfy STD3 rules, * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR * * @param parseError Pointer to UParseError struct to receive information on position * of error if an error is encountered. Can be NULL. * @param status ICU in/out error code parameter. * U_INVALID_CHAR_FOUND if src contains * unmatched single surrogates. * U_INDEX_OUTOFBOUNDS_ERROR if src contains * too many code points. * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough * @return The length of the result string, if successful - or in case of a buffer overflow, * in which case it will be greater than destCapacity. * @stable ICU 2.6 */ U_STABLE int32_t U_EXPORT2 uidna_toUnicode(const UChar* src, int32_t srcLength, UChar* dest, int32_t destCapacity, int32_t options, UParseError* parseError, UErrorCode* status); /** * IDNA2003: Convenience function that implements the IDNToASCII operation as defined in the IDNA RFC. * This operation is done on complete domain names, e.g: "www.example.com". * It is important to note that this operation can fail. If it fails, then the input * domain name cannot be used as an Internationalized Domain Name and the application * should have methods defined to deal with the failure. * * Note: IDNA RFC specifies that a conformant application should divide a domain name * into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each, * and then convert. This function does not offer that level of granularity. The options once * set will apply to all labels in the domain name * * @param src Input UChar array containing IDN in Unicode. * @param srcLength Number of UChars in src, or -1 if NUL-terminated. * @param dest Output UChar array with ASCII (ACE encoded) IDN. * @param destCapacity Size of dest. * @param options A bit set of options: * * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points * and do not use STD3 ASCII rules * If unassigned code points are found the operation fails with * U_UNASSIGNED_CODE_POINT_FOUND error code. * * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations * If this option is set, the unassigned code points are in the input * are treated as normal Unicode code points. * * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions * If this option is set and the input does not satisfy STD3 rules, * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR * * @param parseError Pointer to UParseError struct to receive information on position * of error if an error is encountered. Can be NULL. * @param status ICU in/out error code parameter. * U_INVALID_CHAR_FOUND if src contains * unmatched single surrogates. * U_INDEX_OUTOFBOUNDS_ERROR if src contains * too many code points. * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough * @return The length of the result string, if successful - or in case of a buffer overflow, * in which case it will be greater than destCapacity. * @stable ICU 2.6 */ U_STABLE int32_t U_EXPORT2 uidna_IDNToASCII( const UChar* src, int32_t srcLength, UChar* dest, int32_t destCapacity, int32_t options, UParseError* parseError, UErrorCode* status); /** * IDNA2003: Convenience function that implements the IDNToUnicode operation as defined in the IDNA RFC. * This operation is done on complete domain names, e.g: "www.example.com". * * Note: IDNA RFC specifies that a conformant application should divide a domain name * into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each, * and then convert. This function does not offer that level of granularity. The options once * set will apply to all labels in the domain name * * @param src Input UChar array containing IDN in ASCII (ACE encoded) form. * @param srcLength Number of UChars in src, or -1 if NUL-terminated. * @param dest Output UChar array containing Unicode equivalent of source IDN. * @param destCapacity Size of dest. * @param options A bit set of options: * * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points * and do not use STD3 ASCII rules * If unassigned code points are found the operation fails with * U_UNASSIGNED_CODE_POINT_FOUND error code. * * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations * If this option is set, the unassigned code points are in the input * are treated as normal Unicode code points. * * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions * If this option is set and the input does not satisfy STD3 rules, * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR * * @param parseError Pointer to UParseError struct to receive information on position * of error if an error is encountered. Can be NULL. * @param status ICU in/out error code parameter. * U_INVALID_CHAR_FOUND if src contains * unmatched single surrogates. * U_INDEX_OUTOFBOUNDS_ERROR if src contains * too many code points. * U_BUFFER_OVERFLOW_ERROR if destCapacity is not enough * @return The length of the result string, if successful - or in case of a buffer overflow, * in which case it will be greater than destCapacity. * @stable ICU 2.6 */ U_STABLE int32_t U_EXPORT2 uidna_IDNToUnicode( const UChar* src, int32_t srcLength, UChar* dest, int32_t destCapacity, int32_t options, UParseError* parseError, UErrorCode* status); /** * IDNA2003: Compare two IDN strings for equivalence. * This function splits the domain names into labels and compares them. * According to IDN RFC, whenever two labels are compared, they are * considered equal if and only if their ASCII forms (obtained by * applying toASCII) match using an case-insensitive ASCII comparison. * Two domain names are considered a match if and only if all labels * match regardless of whether label separators match. * * @param s1 First source string. * @param length1 Length of first source string, or -1 if NUL-terminated. * * @param s2 Second source string. * @param length2 Length of second source string, or -1 if NUL-terminated. * @param options A bit set of options: * * - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points * and do not use STD3 ASCII rules * If unassigned code points are found the operation fails with * U_UNASSIGNED_CODE_POINT_FOUND error code. * * - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations * If this option is set, the unassigned code points are in the input * are treated as normal Unicode code points. * * - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions * If this option is set and the input does not satisfy STD3 rules, * the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR * * @param status ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return <0 or 0 or >0 as usual for string comparisons * @stable ICU 2.6 */ U_STABLE int32_t U_EXPORT2 uidna_compare( const UChar *s1, int32_t length1, const UChar *s2, int32_t length2, int32_t options, UErrorCode* status); #endif /* #if !UCONFIG_NO_IDNA */ #endif android-audiosystem-1.8+13.10.20130807/include/unicode/ustring.h0000644000015700001700000022124412200324306024614 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (C) 1998-2010, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * * File ustring.h * * Modification History: * * Date Name Description * 12/07/98 bertrand Creation. ****************************************************************************** */ #ifndef USTRING_H #define USTRING_H #include "unicode/utypes.h" #include "unicode/putil.h" #include "unicode/uiter.h" /** Simple declaration for u_strToTitle() to avoid including unicode/ubrk.h. @stable ICU 2.1*/ #ifndef UBRK_TYPEDEF_UBREAK_ITERATOR # define UBRK_TYPEDEF_UBREAK_ITERATOR typedef struct UBreakIterator UBreakIterator; #endif /** * \file * \brief C API: Unicode string handling functions * * These C API functions provide general Unicode string handling. * * Some functions are equivalent in name, signature, and behavior to the ANSI C * functions. (For example, they do not check for bad arguments like NULL string pointers.) * In some cases, only the thread-safe variant of such a function is implemented here * (see u_strtok_r()). * * Other functions provide more Unicode-specific functionality like locale-specific * upper/lower-casing and string comparison in code point order. * * ICU uses 16-bit Unicode (UTF-16) in the form of arrays of UChar code units. * UTF-16 encodes each Unicode code point with either one or two UChar code units. * (This is the default form of Unicode, and a forward-compatible extension of the original, * fixed-width form that was known as UCS-2. UTF-16 superseded UCS-2 with Unicode 2.0 * in 1996.) * * Some APIs accept a 32-bit UChar32 value for a single code point. * * ICU also handles 16-bit Unicode text with unpaired surrogates. * Such text is not well-formed UTF-16. * Code-point-related functions treat unpaired surrogates as surrogate code points, * i.e., as separate units. * * Although UTF-16 is a variable-width encoding form (like some legacy multi-byte encodings), * it is much more efficient even for random access because the code unit values * for single-unit characters vs. lead units vs. trail units are completely disjoint. * This means that it is easy to determine character (code point) boundaries from * random offsets in the string. * * Unicode (UTF-16) string processing is optimized for the single-unit case. * Although it is important to support supplementary characters * (which use pairs of lead/trail code units called "surrogates"), * their occurrence is rare. Almost all characters in modern use require only * a single UChar code unit (i.e., their code point values are <=0xffff). * * For more details see the User Guide Strings chapter (http://icu-project.org/userguide/strings.html). * For a discussion of the handling of unpaired surrogates see also * Jitterbug 2145 and its icu mailing list proposal on 2002-sep-18. */ /** * \defgroup ustring_ustrlen String Length * \ingroup ustring_strlen */ /*@{*/ /** * Determine the length of an array of UChar. * * @param s The array of UChars, NULL (U+0000) terminated. * @return The number of UChars in chars, minus the terminator. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strlen(const UChar *s); /*@}*/ /** * Count Unicode code points in the length UChar code units of the string. * A code point may occupy either one or two UChar code units. * Counting code points involves reading all code units. * * This functions is basically the inverse of the U16_FWD_N() macro (see utf.h). * * @param s The input string. * @param length The number of UChar code units to be checked, or -1 to count all * code points before the first NUL (U+0000). * @return The number of code points in the specified code units. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_countChar32(const UChar *s, int32_t length); /** * Check if the string contains more Unicode code points than a certain number. * This is more efficient than counting all code points in the entire string * and comparing that number with a threshold. * This function may not need to scan the string at all if the length is known * (not -1 for NUL-termination) and falls within a certain range, and * never needs to count more than 'number+1' code points. * Logically equivalent to (u_countChar32(s, length)>number). * A Unicode code point may occupy either one or two UChar code units. * * @param s The input string. * @param length The length of the string, or -1 if it is NUL-terminated. * @param number The number of code points in the string is compared against * the 'number' parameter. * @return Boolean value for whether the string contains more Unicode code points * than 'number'. Same as (u_countChar32(s, length)>number). * @stable ICU 2.4 */ U_STABLE UBool U_EXPORT2 u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number); /** * Concatenate two ustrings. Appends a copy of src, * including the null terminator, to dst. The initial copied * character from src overwrites the null terminator in dst. * * @param dst The destination string. * @param src The source string. * @return A pointer to dst. * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_strcat(UChar *dst, const UChar *src); /** * Concatenate two ustrings. * Appends at most n characters from src to dst. * Adds a terminating NUL. * If src is too long, then only n-1 characters will be copied * before the terminating NUL. * If n<=0 then dst is not modified. * * @param dst The destination string. * @param src The source string. * @param n The maximum number of characters to append. * @return A pointer to dst. * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_strncat(UChar *dst, const UChar *src, int32_t n); /** * Find the first occurrence of a substring in a string. * The substring is found at code point boundaries. * That means that if the substring begins with * a trail surrogate or ends with a lead surrogate, * then it is found only if these surrogates stand alone in the text. * Otherwise, the substring edge units would be matched against * halves of surrogate pairs. * * @param s The string to search (NUL-terminated). * @param substring The substring to find (NUL-terminated). * @return A pointer to the first occurrence of substring in s, * or s itself if the substring is empty, * or NULL if substring is not in s. * @stable ICU 2.0 * * @see u_strrstr * @see u_strFindFirst * @see u_strFindLast */ U_STABLE UChar * U_EXPORT2 u_strstr(const UChar *s, const UChar *substring); /** * Find the first occurrence of a substring in a string. * The substring is found at code point boundaries. * That means that if the substring begins with * a trail surrogate or ends with a lead surrogate, * then it is found only if these surrogates stand alone in the text. * Otherwise, the substring edge units would be matched against * halves of surrogate pairs. * * @param s The string to search. * @param length The length of s (number of UChars), or -1 if it is NUL-terminated. * @param substring The substring to find (NUL-terminated). * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated. * @return A pointer to the first occurrence of substring in s, * or s itself if the substring is empty, * or NULL if substring is not in s. * @stable ICU 2.4 * * @see u_strstr * @see u_strFindLast */ U_STABLE UChar * U_EXPORT2 u_strFindFirst(const UChar *s, int32_t length, const UChar *substring, int32_t subLength); /** * Find the first occurrence of a BMP code point in a string. * A surrogate code point is found only if its match in the text is not * part of a surrogate pair. * A NUL character is found at the string terminator. * * @param s The string to search (NUL-terminated). * @param c The BMP code point to find. * @return A pointer to the first occurrence of c in s * or NULL if c is not in s. * @stable ICU 2.0 * * @see u_strchr32 * @see u_memchr * @see u_strstr * @see u_strFindFirst */ U_STABLE UChar * U_EXPORT2 u_strchr(const UChar *s, UChar c); /** * Find the first occurrence of a code point in a string. * A surrogate code point is found only if its match in the text is not * part of a surrogate pair. * A NUL character is found at the string terminator. * * @param s The string to search (NUL-terminated). * @param c The code point to find. * @return A pointer to the first occurrence of c in s * or NULL if c is not in s. * @stable ICU 2.0 * * @see u_strchr * @see u_memchr32 * @see u_strstr * @see u_strFindFirst */ U_STABLE UChar * U_EXPORT2 u_strchr32(const UChar *s, UChar32 c); /** * Find the last occurrence of a substring in a string. * The substring is found at code point boundaries. * That means that if the substring begins with * a trail surrogate or ends with a lead surrogate, * then it is found only if these surrogates stand alone in the text. * Otherwise, the substring edge units would be matched against * halves of surrogate pairs. * * @param s The string to search (NUL-terminated). * @param substring The substring to find (NUL-terminated). * @return A pointer to the last occurrence of substring in s, * or s itself if the substring is empty, * or NULL if substring is not in s. * @stable ICU 2.4 * * @see u_strstr * @see u_strFindFirst * @see u_strFindLast */ U_STABLE UChar * U_EXPORT2 u_strrstr(const UChar *s, const UChar *substring); /** * Find the last occurrence of a substring in a string. * The substring is found at code point boundaries. * That means that if the substring begins with * a trail surrogate or ends with a lead surrogate, * then it is found only if these surrogates stand alone in the text. * Otherwise, the substring edge units would be matched against * halves of surrogate pairs. * * @param s The string to search. * @param length The length of s (number of UChars), or -1 if it is NUL-terminated. * @param substring The substring to find (NUL-terminated). * @param subLength The length of substring (number of UChars), or -1 if it is NUL-terminated. * @return A pointer to the last occurrence of substring in s, * or s itself if the substring is empty, * or NULL if substring is not in s. * @stable ICU 2.4 * * @see u_strstr * @see u_strFindLast */ U_STABLE UChar * U_EXPORT2 u_strFindLast(const UChar *s, int32_t length, const UChar *substring, int32_t subLength); /** * Find the last occurrence of a BMP code point in a string. * A surrogate code point is found only if its match in the text is not * part of a surrogate pair. * A NUL character is found at the string terminator. * * @param s The string to search (NUL-terminated). * @param c The BMP code point to find. * @return A pointer to the last occurrence of c in s * or NULL if c is not in s. * @stable ICU 2.4 * * @see u_strrchr32 * @see u_memrchr * @see u_strrstr * @see u_strFindLast */ U_STABLE UChar * U_EXPORT2 u_strrchr(const UChar *s, UChar c); /** * Find the last occurrence of a code point in a string. * A surrogate code point is found only if its match in the text is not * part of a surrogate pair. * A NUL character is found at the string terminator. * * @param s The string to search (NUL-terminated). * @param c The code point to find. * @return A pointer to the last occurrence of c in s * or NULL if c is not in s. * @stable ICU 2.4 * * @see u_strrchr * @see u_memchr32 * @see u_strrstr * @see u_strFindLast */ U_STABLE UChar * U_EXPORT2 u_strrchr32(const UChar *s, UChar32 c); /** * Locates the first occurrence in the string string of any of the characters * in the string matchSet. * Works just like C's strpbrk but with Unicode. * * @param string The string in which to search, NUL-terminated. * @param matchSet A NUL-terminated string defining a set of code points * for which to search in the text string. * @return A pointer to the character in string that matches one of the * characters in matchSet, or NULL if no such character is found. * @stable ICU 2.0 */ U_STABLE UChar * U_EXPORT2 u_strpbrk(const UChar *string, const UChar *matchSet); /** * Returns the number of consecutive characters in string, * beginning with the first, that do not occur somewhere in matchSet. * Works just like C's strcspn but with Unicode. * * @param string The string in which to search, NUL-terminated. * @param matchSet A NUL-terminated string defining a set of code points * for which to search in the text string. * @return The number of initial characters in string that do not * occur in matchSet. * @see u_strspn * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strcspn(const UChar *string, const UChar *matchSet); /** * Returns the number of consecutive characters in string, * beginning with the first, that occur somewhere in matchSet. * Works just like C's strspn but with Unicode. * * @param string The string in which to search, NUL-terminated. * @param matchSet A NUL-terminated string defining a set of code points * for which to search in the text string. * @return The number of initial characters in string that do * occur in matchSet. * @see u_strcspn * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strspn(const UChar *string, const UChar *matchSet); /** * The string tokenizer API allows an application to break a string into * tokens. Unlike strtok(), the saveState (the current pointer within the * original string) is maintained in saveState. In the first call, the * argument src is a pointer to the string. In subsequent calls to * return successive tokens of that string, src must be specified as * NULL. The value saveState is set by this function to maintain the * function's position within the string, and on each subsequent call * you must give this argument the same variable. This function does * handle surrogate pairs. This function is similar to the strtok_r() * the POSIX Threads Extension (1003.1c-1995) version. * * @param src String containing token(s). This string will be modified. * After the first call to u_strtok_r(), this argument must * be NULL to get to the next token. * @param delim Set of delimiter characters (Unicode code points). * @param saveState The current pointer within the original string, * which is set by this function. The saveState * parameter should the address of a local variable of type * UChar *. (i.e. defined "Uhar *myLocalSaveState" and use * &myLocalSaveState for this parameter). * @return A pointer to the next token found in src, or NULL * when there are no more tokens. * @stable ICU 2.0 */ U_STABLE UChar * U_EXPORT2 u_strtok_r(UChar *src, const UChar *delim, UChar **saveState); /** * Compare two Unicode strings for bitwise equality (code unit order). * * @param s1 A string to compare. * @param s2 A string to compare. * @return 0 if s1 and s2 are bitwise equal; a negative * value if s1 is bitwise less than s2,; a positive * value if s1 is bitwise greater than s2. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strcmp(const UChar *s1, const UChar *s2); /** * Compare two Unicode strings in code point order. * See u_strCompare for details. * * @param s1 A string to compare. * @param s2 A string to compare. * @return a negative/zero/positive integer corresponding to whether * the first string is less than/equal to/greater than the second one * in code point order * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strcmpCodePointOrder(const UChar *s1, const UChar *s2); /** * Compare two Unicode strings (binary order). * * The comparison can be done in code unit order or in code point order. * They differ only in UTF-16 when * comparing supplementary code points (U+10000..U+10ffff) * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). * In code unit order, high BMP code points sort after supplementary code points * because they are stored as pairs of surrogates which are at U+d800..U+dfff. * * This functions works with strings of different explicitly specified lengths * unlike the ANSI C-like u_strcmp() and u_memcmp() etc. * NUL-terminated strings are possible with length arguments of -1. * * @param s1 First source string. * @param length1 Length of first source string, or -1 if NUL-terminated. * * @param s2 Second source string. * @param length2 Length of second source string, or -1 if NUL-terminated. * * @param codePointOrder Choose between code unit order (FALSE) * and code point order (TRUE). * * @return <0 or 0 or >0 as usual for string comparisons * * @stable ICU 2.2 */ U_STABLE int32_t U_EXPORT2 u_strCompare(const UChar *s1, int32_t length1, const UChar *s2, int32_t length2, UBool codePointOrder); /** * Compare two Unicode strings (binary order) * as presented by UCharIterator objects. * Works otherwise just like u_strCompare(). * * Both iterators are reset to their start positions. * When the function returns, it is undefined where the iterators * have stopped. * * @param iter1 First source string iterator. * @param iter2 Second source string iterator. * @param codePointOrder Choose between code unit order (FALSE) * and code point order (TRUE). * * @return <0 or 0 or >0 as usual for string comparisons * * @see u_strCompare * * @stable ICU 2.6 */ U_STABLE int32_t U_EXPORT2 u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrder); #ifndef U_COMPARE_CODE_POINT_ORDER /* see also unistr.h and unorm.h */ /** * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc: * Compare strings in code point order instead of code unit order. * @stable ICU 2.2 */ #define U_COMPARE_CODE_POINT_ORDER 0x8000 #endif /** * Compare two strings case-insensitively using full case folding. * This is equivalent to * u_strCompare(u_strFoldCase(s1, options), * u_strFoldCase(s2, options), * (options&U_COMPARE_CODE_POINT_ORDER)!=0). * * The comparison can be done in UTF-16 code unit order or in code point order. * They differ only when comparing supplementary code points (U+10000..U+10ffff) * to BMP code points near the end of the BMP (i.e., U+e000..U+ffff). * In code unit order, high BMP code points sort after supplementary code points * because they are stored as pairs of surrogates which are at U+d800..U+dfff. * * This functions works with strings of different explicitly specified lengths * unlike the ANSI C-like u_strcmp() and u_memcmp() etc. * NUL-terminated strings are possible with length arguments of -1. * * @param s1 First source string. * @param length1 Length of first source string, or -1 if NUL-terminated. * * @param s2 Second source string. * @param length2 Length of second source string, or -1 if NUL-terminated. * * @param options A bit set of options: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: * Comparison in code unit order with default case folding. * * - U_COMPARE_CODE_POINT_ORDER * Set to choose code point order instead of code unit order * (see u_strCompare for details). * * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * * @return <0 or 0 or >0 as usual for string comparisons * * @stable ICU 2.2 */ U_STABLE int32_t U_EXPORT2 u_strCaseCompare(const UChar *s1, int32_t length1, const UChar *s2, int32_t length2, uint32_t options, UErrorCode *pErrorCode); /** * Compare two ustrings for bitwise equality. * Compares at most n characters. * * @param ucs1 A string to compare. * @param ucs2 A string to compare. * @param n The maximum number of characters to compare. * @return 0 if s1 and s2 are bitwise equal; a negative * value if s1 is bitwise less than s2; a positive * value if s1 is bitwise greater than s2. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strncmp(const UChar *ucs1, const UChar *ucs2, int32_t n); /** * Compare two Unicode strings in code point order. * This is different in UTF-16 from u_strncmp() if supplementary characters are present. * For details, see u_strCompare(). * * @param s1 A string to compare. * @param s2 A string to compare. * @param n The maximum number of characters to compare. * @return a negative/zero/positive integer corresponding to whether * the first string is less than/equal to/greater than the second one * in code point order * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n); /** * Compare two strings case-insensitively using full case folding. * This is equivalent to u_strcmp(u_strFoldCase(s1, options), u_strFoldCase(s2, options)). * * @param s1 A string to compare. * @param s2 A string to compare. * @param options A bit set of options: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: * Comparison in code unit order with default case folding. * * - U_COMPARE_CODE_POINT_ORDER * Set to choose code point order instead of code unit order * (see u_strCompare for details). * * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options); /** * Compare two strings case-insensitively using full case folding. * This is equivalent to u_strcmp(u_strFoldCase(s1, at most n, options), * u_strFoldCase(s2, at most n, options)). * * @param s1 A string to compare. * @param s2 A string to compare. * @param n The maximum number of characters each string to case-fold and then compare. * @param options A bit set of options: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: * Comparison in code unit order with default case folding. * * - U_COMPARE_CODE_POINT_ORDER * Set to choose code point order instead of code unit order * (see u_strCompare for details). * * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options); /** * Compare two strings case-insensitively using full case folding. * This is equivalent to u_strcmp(u_strFoldCase(s1, n, options), * u_strFoldCase(s2, n, options)). * * @param s1 A string to compare. * @param s2 A string to compare. * @param length The number of characters in each string to case-fold and then compare. * @param options A bit set of options: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: * Comparison in code unit order with default case folding. * * - U_COMPARE_CODE_POINT_ORDER * Set to choose code point order instead of code unit order * (see u_strCompare for details). * * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options); /** * Copy a ustring. Adds a null terminator. * * @param dst The destination string. * @param src The source string. * @return A pointer to dst. * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_strcpy(UChar *dst, const UChar *src); /** * Copy a ustring. * Copies at most n characters. The result will be null terminated * if the length of src is less than n. * * @param dst The destination string. * @param src The source string. * @param n The maximum number of characters to copy. * @return A pointer to dst. * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_strncpy(UChar *dst, const UChar *src, int32_t n); #if !UCONFIG_NO_CONVERSION /** * Copy a byte string encoded in the default codepage to a ustring. * Adds a null terminator. * Performs a host byte to UChar conversion * * @param dst The destination string. * @param src The source string. * @return A pointer to dst. * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_uastrcpy(UChar *dst, const char *src ); /** * Copy a byte string encoded in the default codepage to a ustring. * Copies at most n characters. The result will be null terminated * if the length of src is less than n. * Performs a host byte to UChar conversion * * @param dst The destination string. * @param src The source string. * @param n The maximum number of characters to copy. * @return A pointer to dst. * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_uastrncpy(UChar *dst, const char *src, int32_t n); /** * Copy ustring to a byte string encoded in the default codepage. * Adds a null terminator. * Performs a UChar to host byte conversion * * @param dst The destination string. * @param src The source string. * @return A pointer to dst. * @stable ICU 2.0 */ U_STABLE char* U_EXPORT2 u_austrcpy(char *dst, const UChar *src ); /** * Copy ustring to a byte string encoded in the default codepage. * Copies at most n characters. The result will be null terminated * if the length of src is less than n. * Performs a UChar to host byte conversion * * @param dst The destination string. * @param src The source string. * @param n The maximum number of characters to copy. * @return A pointer to dst. * @stable ICU 2.0 */ U_STABLE char* U_EXPORT2 u_austrncpy(char *dst, const UChar *src, int32_t n ); #endif /** * Synonym for memcpy(), but with UChars only. * @param dest The destination string * @param src The source string * @param count The number of characters to copy * @return A pointer to dest * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_memcpy(UChar *dest, const UChar *src, int32_t count); /** * Synonym for memmove(), but with UChars only. * @param dest The destination string * @param src The source string * @param count The number of characters to move * @return A pointer to dest * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_memmove(UChar *dest, const UChar *src, int32_t count); /** * Initialize count characters of dest to c. * * @param dest The destination string. * @param c The character to initialize the string. * @param count The maximum number of characters to set. * @return A pointer to dest. * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_memset(UChar *dest, UChar c, int32_t count); /** * Compare the first count UChars of each buffer. * * @param buf1 The first string to compare. * @param buf2 The second string to compare. * @param count The maximum number of UChars to compare. * @return When buf1 < buf2, a negative number is returned. * When buf1 == buf2, 0 is returned. * When buf1 > buf2, a positive number is returned. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count); /** * Compare two Unicode strings in code point order. * This is different in UTF-16 from u_memcmp() if supplementary characters are present. * For details, see u_strCompare(). * * @param s1 A string to compare. * @param s2 A string to compare. * @param count The maximum number of characters to compare. * @return a negative/zero/positive integer corresponding to whether * the first string is less than/equal to/greater than the second one * in code point order * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count); /** * Find the first occurrence of a BMP code point in a string. * A surrogate code point is found only if its match in the text is not * part of a surrogate pair. * A NUL character is found at the string terminator. * * @param s The string to search (contains count UChars). * @param c The BMP code point to find. * @param count The length of the string. * @return A pointer to the first occurrence of c in s * or NULL if c is not in s. * @stable ICU 2.0 * * @see u_strchr * @see u_memchr32 * @see u_strFindFirst */ U_STABLE UChar* U_EXPORT2 u_memchr(const UChar *s, UChar c, int32_t count); /** * Find the first occurrence of a code point in a string. * A surrogate code point is found only if its match in the text is not * part of a surrogate pair. * A NUL character is found at the string terminator. * * @param s The string to search (contains count UChars). * @param c The code point to find. * @param count The length of the string. * @return A pointer to the first occurrence of c in s * or NULL if c is not in s. * @stable ICU 2.0 * * @see u_strchr32 * @see u_memchr * @see u_strFindFirst */ U_STABLE UChar* U_EXPORT2 u_memchr32(const UChar *s, UChar32 c, int32_t count); /** * Find the last occurrence of a BMP code point in a string. * A surrogate code point is found only if its match in the text is not * part of a surrogate pair. * A NUL character is found at the string terminator. * * @param s The string to search (contains count UChars). * @param c The BMP code point to find. * @param count The length of the string. * @return A pointer to the last occurrence of c in s * or NULL if c is not in s. * @stable ICU 2.4 * * @see u_strrchr * @see u_memrchr32 * @see u_strFindLast */ U_STABLE UChar* U_EXPORT2 u_memrchr(const UChar *s, UChar c, int32_t count); /** * Find the last occurrence of a code point in a string. * A surrogate code point is found only if its match in the text is not * part of a surrogate pair. * A NUL character is found at the string terminator. * * @param s The string to search (contains count UChars). * @param c The code point to find. * @param count The length of the string. * @return A pointer to the last occurrence of c in s * or NULL if c is not in s. * @stable ICU 2.4 * * @see u_strrchr32 * @see u_memrchr * @see u_strFindLast */ U_STABLE UChar* U_EXPORT2 u_memrchr32(const UChar *s, UChar32 c, int32_t count); /** * Unicode String literals in C. * We need one macro to declare a variable for the string * and to statically preinitialize it if possible, * and a second macro to dynamically intialize such a string variable if necessary. * * The macros are defined for maximum performance. * They work only for strings that contain "invariant characters", i.e., * only latin letters, digits, and some punctuation. * See utypes.h for details. * * A pair of macros for a single string must be used with the same * parameters. * The string parameter must be a C string literal. * The length of the string, not including the terminating * NUL, must be specified as a constant. * The U_STRING_DECL macro should be invoked exactly once for one * such string variable before it is used. * * Usage: *
 *    U_STRING_DECL(ustringVar1, "Quick-Fox 2", 11);
 *    U_STRING_DECL(ustringVar2, "jumps 5%", 8);
 *    static UBool didInit=FALSE;
 * 
 *    int32_t function() {
 *        if(!didInit) {
 *            U_STRING_INIT(ustringVar1, "Quick-Fox 2", 11);
 *            U_STRING_INIT(ustringVar2, "jumps 5%", 8);
 *            didInit=TRUE;
 *        }
 *        return u_strcmp(ustringVar1, ustringVar2);
 *    }
 * 
* * Note that the macros will NOT consistently work if their argument is another #define. * The following will not work on all platforms, don't use it. * *
 *     #define GLUCK "Mr. Gluck"
 *     U_STRING_DECL(var, GLUCK, 9)
 *     U_STRING_INIT(var, GLUCK, 9)
 * 
* * Instead, use the string literal "Mr. Gluck" as the argument to both macro * calls. * * * @stable ICU 2.0 */ #if defined(U_DECLARE_UTF16) # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=U_DECLARE_UTF16(cs) /**@stable ICU 2.0 */ # define U_STRING_INIT(var, cs, length) #elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16))) # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=L ## cs /**@stable ICU 2.0 */ # define U_STRING_INIT(var, cs, length) #elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY # define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=cs /**@stable ICU 2.0 */ # define U_STRING_INIT(var, cs, length) #else # define U_STRING_DECL(var, cs, length) static UChar var[(length)+1] /**@stable ICU 2.0 */ # define U_STRING_INIT(var, cs, length) u_charsToUChars(cs, var, length+1) #endif /** * Unescape a string of characters and write the resulting * Unicode characters to the destination buffer. The following escape * sequences are recognized: * * \\uhhhh 4 hex digits; h in [0-9A-Fa-f] * \\Uhhhhhhhh 8 hex digits * \\xhh 1-2 hex digits * \\x{h...} 1-8 hex digits * \\ooo 1-3 octal digits; o in [0-7] * \\cX control-X; X is masked with 0x1F * * as well as the standard ANSI C escapes: * * \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A, * \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B, * \\" => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C * * Anything else following a backslash is generically escaped. For * example, "[a\\-z]" returns "[a-z]". * * If an escape sequence is ill-formed, this method returns an empty * string. An example of an ill-formed sequence is "\\u" followed by * fewer than 4 hex digits. * * The above characters are recognized in the compiler's codepage, * that is, they are coded as 'u', '\\', etc. Characters that are * not parts of escape sequences are converted using u_charsToUChars(). * * This function is similar to UnicodeString::unescape() but not * identical to it. The latter takes a source UnicodeString, so it * does escape recognition but no conversion. * * @param src a zero-terminated string of invariant characters * @param dest pointer to buffer to receive converted and unescaped * text and, if there is room, a zero terminator. May be NULL for * preflighting, in which case no UChars will be written, but the * return value will still be valid. On error, an empty string is * stored here (if possible). * @param destCapacity the number of UChars that may be written at * dest. Ignored if dest == NULL. * @return the length of unescaped string. * @see u_unescapeAt * @see UnicodeString#unescape() * @see UnicodeString#unescapeAt() * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_unescape(const char *src, UChar *dest, int32_t destCapacity); U_CDECL_BEGIN /** * Callback function for u_unescapeAt() that returns a character of * the source text given an offset and a context pointer. The context * pointer will be whatever is passed into u_unescapeAt(). * * @param offset pointer to the offset that will be passed to u_unescapeAt(). * @param context an opaque pointer passed directly into u_unescapeAt() * @return the character represented by the escape sequence at * offset * @see u_unescapeAt * @stable ICU 2.0 */ typedef UChar (U_CALLCONV *UNESCAPE_CHAR_AT)(int32_t offset, void *context); U_CDECL_END /** * Unescape a single sequence. The character at offset-1 is assumed * (without checking) to be a backslash. This method takes a callback * pointer to a function that returns the UChar at a given offset. By * varying this callback, ICU functions are able to unescape char* * strings, UnicodeString objects, and UFILE pointers. * * If offset is out of range, or if the escape sequence is ill-formed, * (UChar32)0xFFFFFFFF is returned. See documentation of u_unescape() * for a list of recognized sequences. * * @param charAt callback function that returns a UChar of the source * text given an offset and a context pointer. * @param offset pointer to the offset that will be passed to charAt. * The offset value will be updated upon return to point after the * last parsed character of the escape sequence. On error the offset * is unchanged. * @param length the number of characters in the source text. The * last character of the source text is considered to be at offset * length-1. * @param context an opaque pointer passed directly into charAt. * @return the character represented by the escape sequence at * offset, or (UChar32)0xFFFFFFFF on error. * @see u_unescape() * @see UnicodeString#unescape() * @see UnicodeString#unescapeAt() * @stable ICU 2.0 */ U_STABLE UChar32 U_EXPORT2 u_unescapeAt(UNESCAPE_CHAR_AT charAt, int32_t *offset, int32_t length, void *context); /** * Uppercase the characters in a string. * Casing is locale-dependent and context-sensitive. * The result may be longer or shorter than the original. * The source string and the destination buffer are allowed to overlap. * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then * dest may be NULL and the function will only return the length of the result * without writing any of the result string. * @param src The original string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The length of the result string. It may be greater than destCapacity. In that case, * only some of the result was written to the destination buffer. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strToUpper(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, const char *locale, UErrorCode *pErrorCode); /** * Lowercase the characters in a string. * Casing is locale-dependent and context-sensitive. * The result may be longer or shorter than the original. * The source string and the destination buffer are allowed to overlap. * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then * dest may be NULL and the function will only return the length of the result * without writing any of the result string. * @param src The original string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The length of the result string. It may be greater than destCapacity. In that case, * only some of the result was written to the destination buffer. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strToLower(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, const char *locale, UErrorCode *pErrorCode); #if !UCONFIG_NO_BREAK_ITERATION /** * Titlecase a string. * Casing is locale-dependent and context-sensitive. * Titlecasing uses a break iterator to find the first characters of words * that are to be titlecased. It titlecases those characters and lowercases * all others. * * The titlecase break iterator can be provided to customize for arbitrary * styles, using rules and dictionaries beyond the standard iterators. * It may be more efficient to always provide an iterator to avoid * opening and closing one for each string. * The standard titlecase iterator for the root locale implements the * algorithm of Unicode TR 21. * * This function uses only the setText(), first() and next() methods of the * provided break iterator. * * The result may be longer or shorter than the original. * The source string and the destination buffer are allowed to overlap. * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then * dest may be NULL and the function will only return the length of the result * without writing any of the result string. * @param src The original string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param titleIter A break iterator to find the first characters of words * that are to be titlecased. * If none is provided (NULL), then a standard titlecase * break iterator is opened. * @param locale The locale to consider, or "" for the root locale or NULL for the default locale. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The length of the result string. It may be greater than destCapacity. In that case, * only some of the result was written to the destination buffer. * @stable ICU 2.1 */ U_STABLE int32_t U_EXPORT2 u_strToTitle(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, UBreakIterator *titleIter, const char *locale, UErrorCode *pErrorCode); #endif /** * Case-fold the characters in a string. * Case-folding is locale-independent and not context-sensitive, * but there is an option for whether to include or exclude mappings for dotted I * and dotless i that are marked with 'I' in CaseFolding.txt. * The result may be longer or shorter than the original. * The source string and the destination buffer are allowed to overlap. * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then * dest may be NULL and the function will only return the length of the result * without writing any of the result string. * @param src The original string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param options Either U_FOLD_CASE_DEFAULT or U_FOLD_CASE_EXCLUDE_SPECIAL_I * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The length of the result string. It may be greater than destCapacity. In that case, * only some of the result was written to the destination buffer. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 u_strFoldCase(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, uint32_t options, UErrorCode *pErrorCode); #if defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION /** * Convert a UTF-16 string to a wchar_t string. * If it is known at compile time that wchar_t strings are in UTF-16 or UTF-32, then * this function simply calls the fast, dedicated function for that. * Otherwise, two conversions UTF-16 -> default charset -> wchar_t* are performed. * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of wchar_t's). If it is 0, then * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). * @param pDestLength A pointer to receive the number of units written to the destination. If * pDestLength!=NULL then *pDestLength is always set to the * number of output units corresponding to the transformation of * all the input units, even in case of a buffer overflow. * @param src The original source string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The pointer to destination buffer. * @stable ICU 2.0 */ U_STABLE wchar_t* U_EXPORT2 u_strToWCS(wchar_t *dest, int32_t destCapacity, int32_t *pDestLength, const UChar *src, int32_t srcLength, UErrorCode *pErrorCode); /** * Convert a wchar_t string to UTF-16. * If it is known at compile time that wchar_t strings are in UTF-16 or UTF-32, then * this function simply calls the fast, dedicated function for that. * Otherwise, two conversions wchar_t* -> default charset -> UTF-16 are performed. * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). * @param pDestLength A pointer to receive the number of units written to the destination. If * pDestLength!=NULL then *pDestLength is always set to the * number of output units corresponding to the transformation of * all the input units, even in case of a buffer overflow. * @param src The original source string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The pointer to destination buffer. * @stable ICU 2.0 */ U_STABLE UChar* U_EXPORT2 u_strFromWCS(UChar *dest, int32_t destCapacity, int32_t *pDestLength, const wchar_t *src, int32_t srcLength, UErrorCode *pErrorCode); #endif /* defined(U_WCHAR_IS_UTF16) || defined(U_WCHAR_IS_UTF32) || !UCONFIG_NO_CONVERSION */ /** * Convert a UTF-16 string to UTF-8. * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of chars). If it is 0, then * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). * @param pDestLength A pointer to receive the number of units written to the destination. If * pDestLength!=NULL then *pDestLength is always set to the * number of output units corresponding to the transformation of * all the input units, even in case of a buffer overflow. * @param src The original source string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The pointer to destination buffer. * @stable ICU 2.0 * @see u_strToUTF8WithSub * @see u_strFromUTF8 */ U_STABLE char* U_EXPORT2 u_strToUTF8(char *dest, int32_t destCapacity, int32_t *pDestLength, const UChar *src, int32_t srcLength, UErrorCode *pErrorCode); /** * Convert a UTF-8 string to UTF-16. * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). * @param pDestLength A pointer to receive the number of units written to the destination. If * pDestLength!=NULL then *pDestLength is always set to the * number of output units corresponding to the transformation of * all the input units, even in case of a buffer overflow. * @param src The original source string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The pointer to destination buffer. * @stable ICU 2.0 * @see u_strFromUTF8WithSub * @see u_strFromUTF8Lenient */ U_STABLE UChar* U_EXPORT2 u_strFromUTF8(UChar *dest, int32_t destCapacity, int32_t *pDestLength, const char *src, int32_t srcLength, UErrorCode *pErrorCode); /** * Convert a UTF-16 string to UTF-8. * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. * * Same as u_strToUTF8() except for the additional subchar which is output for * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code. * With subchar==U_SENTINEL, this function behaves exactly like u_strToUTF8(). * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of chars). If it is 0, then * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). * @param pDestLength A pointer to receive the number of units written to the destination. If * pDestLength!=NULL then *pDestLength is always set to the * number of output units corresponding to the transformation of * all the input units, even in case of a buffer overflow. * @param src The original source string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param subchar The substitution character to use in place of an illegal input sequence, * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. * A substitution character can be any valid Unicode code point (up to U+10FFFF) * except for surrogate code points (U+D800..U+DFFF). * The recommended value is U+FFFD "REPLACEMENT CHARACTER". * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. * Set to 0 if no substitutions occur or subchar<0. * pNumSubstitutions can be NULL. * @param pErrorCode Pointer to a standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return The pointer to destination buffer. * @see u_strToUTF8 * @see u_strFromUTF8WithSub * @stable ICU 3.6 */ U_STABLE char* U_EXPORT2 u_strToUTF8WithSub(char *dest, int32_t destCapacity, int32_t *pDestLength, const UChar *src, int32_t srcLength, UChar32 subchar, int32_t *pNumSubstitutions, UErrorCode *pErrorCode); /** * Convert a UTF-8 string to UTF-16. * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. * * Same as u_strFromUTF8() except for the additional subchar which is output for * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code. * With subchar==U_SENTINEL, this function behaves exactly like u_strFromUTF8(). * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). * @param pDestLength A pointer to receive the number of units written to the destination. If * pDestLength!=NULL then *pDestLength is always set to the * number of output units corresponding to the transformation of * all the input units, even in case of a buffer overflow. * @param src The original source string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param subchar The substitution character to use in place of an illegal input sequence, * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. * A substitution character can be any valid Unicode code point (up to U+10FFFF) * except for surrogate code points (U+D800..U+DFFF). * The recommended value is U+FFFD "REPLACEMENT CHARACTER". * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. * Set to 0 if no substitutions occur or subchar<0. * pNumSubstitutions can be NULL. * @param pErrorCode Pointer to a standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return The pointer to destination buffer. * @see u_strFromUTF8 * @see u_strFromUTF8Lenient * @see u_strToUTF8WithSub * @stable ICU 3.6 */ U_STABLE UChar* U_EXPORT2 u_strFromUTF8WithSub(UChar *dest, int32_t destCapacity, int32_t *pDestLength, const char *src, int32_t srcLength, UChar32 subchar, int32_t *pNumSubstitutions, UErrorCode *pErrorCode); /** * Convert a UTF-8 string to UTF-16. * * Same as u_strFromUTF8() except that this function is designed to be very fast, * which it achieves by being lenient about malformed UTF-8 sequences. * This function is intended for use in environments where UTF-8 text is * expected to be well-formed. * * Its semantics are: * - Well-formed UTF-8 text is correctly converted to well-formed UTF-16 text. * - The function will not read beyond the input string, nor write beyond * the destCapacity. * - Malformed UTF-8 results in "garbage" 16-bit Unicode strings which may not * be well-formed UTF-16. * The function will resynchronize to valid code point boundaries * within a small number of code points after an illegal sequence. * - Non-shortest forms are not detected and will result in "spoofing" output. * * For further performance improvement, if srcLength is given (>=0), * then it must be destCapacity>=srcLength. * * There is no inverse u_strToUTF8Lenient() function because there is practically * no performance gain from not checking that a UTF-16 string is well-formed. * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). * Unlike for other ICU functions, if srcLength>=0 then it * must be destCapacity>=srcLength. * @param pDestLength A pointer to receive the number of units written to the destination. If * pDestLength!=NULL then *pDestLength is always set to the * number of output units corresponding to the transformation of * all the input units, even in case of a buffer overflow. * Unlike for other ICU functions, if srcLength>=0 but * destCapacity=0. * Set to 0 if no substitutions occur or subchar<0. * pNumSubstitutions can be NULL. * @param pErrorCode Pointer to a standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return The pointer to destination buffer. * @see u_strToUTF32 * @see u_strFromUTF32WithSub * @stable ICU 4.2 */ U_STABLE UChar32* U_EXPORT2 u_strToUTF32WithSub(UChar32 *dest, int32_t destCapacity, int32_t *pDestLength, const UChar *src, int32_t srcLength, UChar32 subchar, int32_t *pNumSubstitutions, UErrorCode *pErrorCode); /** * Convert a UTF-32 string to UTF-16. * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. * * Same as u_strFromUTF32() except for the additional subchar which is output for * illegal input sequences, instead of stopping with the U_INVALID_CHAR_FOUND error code. * With subchar==U_SENTINEL, this function behaves exactly like u_strFromUTF32(). * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). * @param pDestLength A pointer to receive the number of units written to the destination. If * pDestLength!=NULL then *pDestLength is always set to the * number of output units corresponding to the transformation of * all the input units, even in case of a buffer overflow. * @param src The original source string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param subchar The substitution character to use in place of an illegal input sequence, * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. * A substitution character can be any valid Unicode code point (up to U+10FFFF) * except for surrogate code points (U+D800..U+DFFF). * The recommended value is U+FFFD "REPLACEMENT CHARACTER". * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. * Set to 0 if no substitutions occur or subchar<0. * pNumSubstitutions can be NULL. * @param pErrorCode Pointer to a standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return The pointer to destination buffer. * @see u_strFromUTF32 * @see u_strToUTF32WithSub * @stable ICU 4.2 */ U_STABLE UChar* U_EXPORT2 u_strFromUTF32WithSub(UChar *dest, int32_t destCapacity, int32_t *pDestLength, const UChar32 *src, int32_t srcLength, UChar32 subchar, int32_t *pNumSubstitutions, UErrorCode *pErrorCode); /** * Convert a 16-bit Unicode string to Java Modified UTF-8. * See http://java.sun.com/javase/6/docs/api/java/io/DataInput.html#modified-utf-8 * * This function behaves according to the documentation for Java DataOutput.writeUTF() * except that it does not encode the output length in the destination buffer * and does not have an output length restriction. * See http://java.sun.com/javase/6/docs/api/java/io/DataOutput.html#writeUTF(java.lang.String) * * The input string need not be well-formed UTF-16. * (Therefore there is no subchar parameter.) * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of chars). If it is 0, then * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). * @param pDestLength A pointer to receive the number of units written to the destination. If * pDestLength!=NULL then *pDestLength is always set to the * number of output units corresponding to the transformation of * all the input units, even in case of a buffer overflow. * @param src The original source string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param pErrorCode Pointer to a standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return The pointer to destination buffer. * @stable ICU 4.4 * @see u_strToUTF8WithSub * @see u_strFromJavaModifiedUTF8WithSub */ U_STABLE char* U_EXPORT2 u_strToJavaModifiedUTF8( char *dest, int32_t destCapacity, int32_t *pDestLength, const UChar *src, int32_t srcLength, UErrorCode *pErrorCode); /** * Convert a Java Modified UTF-8 string to a 16-bit Unicode string. * If the input string is not well-formed, then the U_INVALID_CHAR_FOUND error code is set. * * This function behaves according to the documentation for Java DataInput.readUTF() * except that it takes a length parameter rather than * interpreting the first two input bytes as the length. * See http://java.sun.com/javase/6/docs/api/java/io/DataInput.html#readUTF() * * The output string may not be well-formed UTF-16. * * @param dest A buffer for the result string. The result will be zero-terminated if * the buffer is large enough. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). * @param pDestLength A pointer to receive the number of units written to the destination. If * pDestLength!=NULL then *pDestLength is always set to the * number of output units corresponding to the transformation of * all the input units, even in case of a buffer overflow. * @param src The original source string * @param srcLength The length of the original string. If -1, then src must be zero-terminated. * @param subchar The substitution character to use in place of an illegal input sequence, * or U_SENTINEL if the function is to return with U_INVALID_CHAR_FOUND instead. * A substitution character can be any valid Unicode code point (up to U+10FFFF) * except for surrogate code points (U+D800..U+DFFF). * The recommended value is U+FFFD "REPLACEMENT CHARACTER". * @param pNumSubstitutions Output parameter receiving the number of substitutions if subchar>=0. * Set to 0 if no substitutions occur or subchar<0. * pNumSubstitutions can be NULL. * @param pErrorCode Pointer to a standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return The pointer to destination buffer. * @see u_strFromUTF8WithSub * @see u_strFromUTF8Lenient * @see u_strToJavaModifiedUTF8 * @stable ICU 4.4 */ U_STABLE UChar* U_EXPORT2 u_strFromJavaModifiedUTF8WithSub( UChar *dest, int32_t destCapacity, int32_t *pDestLength, const char *src, int32_t srcLength, UChar32 subchar, int32_t *pNumSubstitutions, UErrorCode *pErrorCode); #endif android-audiosystem-1.8+13.10.20130807/include/unicode/ppalmos.h0000644000015700001700000001552012200324306024572 0ustar pbuserpbgroup00000000000000/* ****************************************************************************** * * Copyright (C) 1997-2006, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * * FILE NAME : ppalmos.h * * Date Name Description * 05/10/04 Ken Krugler Creation (copied from pwin32.h & modified). ****************************************************************************** */ #ifndef U_PPALMOS_H #define U_PPALMOS_H /** * \file * \brief Configuration constants for the Palm OS platform */ /* Define the platform we're on. */ #ifndef U_PALMOS #define U_PALMOS #endif /* _MSC_VER is used to detect the Microsoft compiler. */ #if defined(_MSC_VER) #define U_INT64_IS_LONG_LONG 0 #else #define U_INT64_IS_LONG_LONG 1 #endif /* Define whether inttypes.h is available */ #ifndef U_HAVE_INTTYPES_H #define U_HAVE_INTTYPES_H 1 #endif /* * Define what support for C++ streams is available. * If U_IOSTREAM_SOURCE is set to 199711, then is available * (1997711 is the date the ISO/IEC C++ FDIS was published), and then * one should qualify streams using the std namespace in ICU header * files. * If U_IOSTREAM_SOURCE is set to 198506, then is * available instead (198506 is the date when Stroustrup published * "An Extensible I/O Facility for C++" at the summer USENIX conference). * If U_IOSTREAM_SOURCE is 0, then C++ streams are not available and * support for them will be silently suppressed in ICU. * */ #ifndef U_IOSTREAM_SOURCE #define U_IOSTREAM_SOURCE 199711 #endif /* Determines whether specific types are available */ #ifndef U_HAVE_INT8_T #define U_HAVE_INT8_T U_HAVE_INTTYPES_H #endif #ifndef U_HAVE_UINT8_T #define U_HAVE_UINT8_T U_HAVE_INTTYPES_H #endif #ifndef U_HAVE_INT16_T #define U_HAVE_INT16_T U_HAVE_INTTYPES_H #endif #ifndef U_HAVE_UINT16_T #define U_HAVE_UINT16_T U_HAVE_INTTYPES_H #endif #ifndef U_HAVE_INT32_T #define U_HAVE_INT32_T U_HAVE_INTTYPES_H #endif #ifndef U_HAVE_UINT32_T #define U_HAVE_UINT32_T U_HAVE_INTTYPES_H #endif #ifndef U_HAVE_INT64_T #define U_HAVE_INT64_T U_HAVE_INTTYPES_H #endif #ifndef U_HAVE_UINT64_T #define U_HAVE_UINT64_T U_HAVE_INTTYPES_H #endif /*===========================================================================*/ /* Generic data types */ /*===========================================================================*/ /* If your platform does not have the header, you may need to edit the typedefs below. */ #if U_HAVE_INTTYPES_H #include #else /* U_HAVE_INTTYPES_H */ #if ! U_HAVE_INT8_T typedef signed char int8_t; #endif #if ! U_HAVE_UINT8_T typedef unsigned char uint8_t; #endif #if ! U_HAVE_INT16_T typedef signed short int16_t; #endif #if ! U_HAVE_UINT16_T typedef unsigned short uint16_t; #endif #if ! U_HAVE_INT32_T typedef signed int int32_t; #endif #if ! U_HAVE_UINT32_T typedef unsigned int uint32_t; #endif #if ! U_HAVE_INT64_T #if U_INT64_IS_LONG_LONG typedef signed long long int64_t; #else typedef signed __int64 int64_t; #endif #endif #if ! U_HAVE_UINT64_T #if U_INT64_IS_LONG_LONG typedef unsigned long long uint64_t; #else typedef unsigned __int64 uint64_t; #endif #endif #endif /*===========================================================================*/ /* Compiler and environment features */ /*===========================================================================*/ /* Define whether namespace is supported */ #ifndef U_HAVE_NAMESPACE #define U_HAVE_NAMESPACE 1 #endif /* Determines the endianness of the platform */ #define U_IS_BIG_ENDIAN 0 /* 1 or 0 to enable or disable threads. If undefined, default is: enable threads. */ #define ICU_USE_THREADS 1 #ifndef U_DEBUG #ifdef _DEBUG #define U_DEBUG 1 #else #define U_DEBUG 0 #endif #endif #ifndef U_RELEASE #ifdef NDEBUG #define U_RELEASE 1 #else #define U_RELEASE 0 #endif #endif /* Determine whether to disable renaming or not. This overrides the setting in umachine.h which is for all platforms. */ #ifndef U_DISABLE_RENAMING #define U_DISABLE_RENAMING 0 #endif /* Determine whether to override new and delete. */ #ifndef U_OVERRIDE_CXX_ALLOCATION #define U_OVERRIDE_CXX_ALLOCATION 1 #endif /* Determine whether to override placement new and delete for STL. */ #ifndef U_HAVE_PLACEMENT_NEW #define U_HAVE_PLACEMENT_NEW 0 #endif /* Determine whether to override new and delete for MFC. */ #if !defined(U_HAVE_DEBUG_LOCATION_NEW) && defined(_MSC_VER) #define U_HAVE_DEBUG_LOCATION_NEW 0 #endif /* Determine whether to enable tracing. */ #ifndef U_ENABLE_TRACING #define U_ENABLE_TRACING 1 #endif /* Do we allow ICU users to use the draft APIs by default? */ #ifndef U_DEFAULT_SHOW_DRAFT #define U_DEFAULT_SHOW_DRAFT 1 #endif /* Define the library suffix in a C syntax. */ #define U_HAVE_LIB_SUFFIX 0 #define U_LIB_SUFFIX_C_NAME #define U_LIB_SUFFIX_C_NAME_STRING "" /*===========================================================================*/ /* Information about wchar support */ /*===========================================================================*/ #define U_HAVE_WCHAR_H 1 #define U_SIZEOF_WCHAR_T 2 #define U_HAVE_WCSCPY 0 /*===========================================================================*/ /* Information about POSIX support */ /*===========================================================================*/ /* TODO: Fix Palm OS's determination of a timezone */ #if 0 #define U_TZSET _tzset #endif #if 0 #define U_TIMEZONE _timezone #endif #if 0 #define U_TZNAME _tzname #endif #define U_HAVE_MMAP 0 #define U_HAVE_POPEN 0 /*===========================================================================*/ /* Symbol import-export control */ /*===========================================================================*/ #define U_EXPORT #define U_EXPORT2 #define U_IMPORT /*===========================================================================*/ /* Code alignment and C function inlining */ /*===========================================================================*/ #ifndef U_INLINE # ifdef __cplusplus # define U_INLINE inline # else # define U_INLINE __inline # endif #endif #if defined(_MSC_VER) && defined(_M_IX86) #define U_ALIGN_CODE(val) __asm align val #else #define U_ALIGN_CODE(val) #endif /*===========================================================================*/ /* Programs used by ICU code */ /*===========================================================================*/ #ifndef U_MAKE #define U_MAKE "nmake" #define U_MAKE_IS_NMAKE 1 #endif #endif android-audiosystem-1.8+13.10.20130807/include/unicode/pwin32.h0000644000015700001700000002164112200324306024242 0ustar pbuserpbgroup00000000000000/* ****************************************************************************** * * Copyright (C) 1997-2010, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * * FILE NAME : platform.h * * Date Name Description * 05/13/98 nos Creation (content moved here from ptypes.h). * 03/02/99 stephen Added AS400 support. * 03/30/99 stephen Added Linux support. * 04/13/99 stephen Reworked for autoconf. ****************************************************************************** */ /** * \file * \brief Configuration constants for the Windows platform */ /** Define the platform we're on. */ #ifndef U_WINDOWS #define U_WINDOWS #endif #if defined(__BORLANDC__) #define U_HAVE_PLACEMENT_NEW 0 #define __STDC_CONSTANT_MACROS #endif /** _MSC_VER is used to detect the Microsoft compiler. */ #if defined(_MSC_VER) #define U_INT64_IS_LONG_LONG 0 #else #define U_INT64_IS_LONG_LONG 1 #endif /** Define whether inttypes.h is available */ #ifndef U_HAVE_INTTYPES_H # if defined(__BORLANDC__) || defined(__MINGW32__) # define U_HAVE_INTTYPES_H 1 # else # define U_HAVE_INTTYPES_H 0 # endif #endif /** * Define what support for C++ streams is available. * If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available * (1997711 is the date the ISO/IEC C++ FDIS was published), and then * one should qualify streams using the std namespace in ICU header * files. * If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is * available instead (198506 is the date when Stroustrup published * "An Extensible I/O Facility for C++" at the summer USENIX conference). * If U_IOSTREAM_SOURCE is 0, then C++ streams are not available and * support for them will be silently suppressed in ICU. * */ #ifndef U_IOSTREAM_SOURCE #define U_IOSTREAM_SOURCE 199711 #endif /** @{ * Determines whether specific types are available */ #ifndef U_HAVE_INT8_T #define U_HAVE_INT8_T U_HAVE_INTTYPES_H #endif #ifndef U_HAVE_UINT8_T #define U_HAVE_UINT8_T U_HAVE_INTTYPES_H #endif #ifndef U_HAVE_INT16_T #define U_HAVE_INT16_T U_HAVE_INTTYPES_H #endif #ifndef U_HAVE_UINT16_T #define U_HAVE_UINT16_T U_HAVE_INTTYPES_H #endif #ifndef U_HAVE_INT32_T #define U_HAVE_INT32_T U_HAVE_INTTYPES_H #endif #ifndef U_HAVE_UINT32_T #define U_HAVE_UINT32_T U_HAVE_INTTYPES_H #endif #ifndef U_HAVE_INT64_T #define U_HAVE_INT64_T U_HAVE_INTTYPES_H #endif #ifndef U_HAVE_UINT64_T #define U_HAVE_UINT64_T U_HAVE_INTTYPES_H #endif /** @} */ /** Define 64 bit limits */ #if !U_INT64_IS_LONG_LONG # ifndef INT64_C # define INT64_C(x) ((int64_t)x) # endif # ifndef UINT64_C # define UINT64_C(x) ((uint64_t)x) # endif /** else use the umachine.h definition */ #endif /*===========================================================================*/ /** @{ * Generic data types */ /*===========================================================================*/ /** If your platform does not have the header, you may need to edit the typedefs below. */ #if U_HAVE_INTTYPES_H #include #else /* U_HAVE_INTTYPES_H */ #if ! U_HAVE_INT8_T typedef signed char int8_t; #endif #if ! U_HAVE_UINT8_T typedef unsigned char uint8_t; #endif #if ! U_HAVE_INT16_T typedef signed short int16_t; #endif #if ! U_HAVE_UINT16_T typedef unsigned short uint16_t; #endif #if ! U_HAVE_INT32_T typedef signed int int32_t; #endif #if ! U_HAVE_UINT32_T typedef unsigned int uint32_t; #endif #if ! U_HAVE_INT64_T #if U_INT64_IS_LONG_LONG typedef signed long long int64_t; #else typedef signed __int64 int64_t; #endif #endif #if ! U_HAVE_UINT64_T #if U_INT64_IS_LONG_LONG typedef unsigned long long uint64_t; #else typedef unsigned __int64 uint64_t; #endif #endif #endif /** * @} */ /*===========================================================================*/ /** Compiler and environment features */ /*===========================================================================*/ /** Define whether namespace is supported */ #ifndef U_HAVE_NAMESPACE #define U_HAVE_NAMESPACE 1 #endif /** Determines the endianness of the platform */ #define U_IS_BIG_ENDIAN 0 /** 1 or 0 to enable or disable threads. If undefined, default is: enable threads. */ #ifndef ICU_USE_THREADS #define ICU_USE_THREADS 1 #endif /** 0 or 1 to enable or disable auto cleanup of libraries. If undefined, default is: disabled. */ #ifndef UCLN_NO_AUTO_CLEANUP #define UCLN_NO_AUTO_CLEANUP 1 #endif /* On strong memory model CPUs (e.g. x86 CPUs), we use a safe & quick double check mutex lock. */ /** Microsoft can define _M_IX86, _M_AMD64 (before Visual Studio 8) or _M_X64 (starting in Visual Studio 8). Intel can define _M_IX86 or _M_X64 */ #if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) #define UMTX_STRONG_MEMORY_MODEL 1 #endif /** Enable or disable debugging options **/ #ifndef U_DEBUG #ifdef _DEBUG #define U_DEBUG 1 #else #define U_DEBUG 0 #endif #endif /** Enable or disable release options **/ #ifndef U_RELEASE #ifdef NDEBUG #define U_RELEASE 1 #else #define U_RELEASE 0 #endif #endif /** Determine whether to disable renaming or not. This overrides the setting in umachine.h which is for all platforms. */ #ifndef U_DISABLE_RENAMING #define U_DISABLE_RENAMING 0 #endif /** Determine whether to override new and delete. */ #ifndef U_OVERRIDE_CXX_ALLOCATION #define U_OVERRIDE_CXX_ALLOCATION 1 #endif /** Determine whether to override placement new and delete for STL. */ #ifndef U_HAVE_PLACEMENT_NEW #define U_HAVE_PLACEMENT_NEW 1 #endif /** Determine whether to override new and delete for MFC. */ #if !defined(U_HAVE_DEBUG_LOCATION_NEW) && defined(_MSC_VER) #define U_HAVE_DEBUG_LOCATION_NEW 1 #endif /** Determine whether to enable tracing. */ #ifndef U_ENABLE_TRACING #define U_ENABLE_TRACING 0 #endif /** Do we allow ICU users to use the draft APIs by default? */ #ifndef U_DEFAULT_SHOW_DRAFT #define U_DEFAULT_SHOW_DRAFT 1 #endif /** @{ Define the library suffix in a C syntax. */ #ifndef U_HAVE_LIB_SUFFIX #define U_HAVE_LIB_SUFFIX 0 #endif #ifndef U_LIB_SUFFIX_C_NAME #define U_LIB_SUFFIX_C_NAME #endif #ifndef U_LIB_SUFFIX_C_NAME_STRING #define U_LIB_SUFFIX_C_NAME_STRING "" #endif /** @} */ /*===========================================================================*/ /** @{ Information about wchar support */ /*===========================================================================*/ #define U_HAVE_WCHAR_H 1 #define U_SIZEOF_WCHAR_T 2 #define U_HAVE_WCSCPY 1 /** @} */ /** * \def U_DECLARE_UTF16 * Do not use this macro. Use the UNICODE_STRING or U_STRING_DECL macros * instead. * @internal */ #if 1 #define U_DECLARE_UTF16(string) L ## string #endif /*===========================================================================*/ /** @{ Information about POSIX support */ /*===========================================================================*/ /** * @internal */ #if 1 #define U_TZSET _tzset #endif /** * @internal */ #if 1 #define U_TIMEZONE _timezone #endif /** * @internal */ #if 1 #define U_TZNAME _tzname #endif /** * @internal */ #if 1 #define U_DAYLIGHT _daylight #endif #define U_HAVE_MMAP 0 #define U_HAVE_POPEN 0 #ifndef U_ENABLE_DYLOAD #define U_ENABLE_DYLOAD 1 #endif /** @} */ /*===========================================================================*/ /** @{ Symbol import-export control */ /*===========================================================================*/ #ifdef U_STATIC_IMPLEMENTATION #define U_EXPORT #else #define U_EXPORT __declspec(dllexport) #endif #define U_EXPORT2 __cdecl #define U_IMPORT __declspec(dllimport) /** @} */ /*===========================================================================*/ /** @{ Code alignment and C function inlining */ /*===========================================================================*/ #ifndef U_INLINE # ifdef __cplusplus # define U_INLINE inline # else # define U_INLINE __inline # endif #endif #if defined(_MSC_VER) && defined(_M_IX86) && !defined(_MANAGED) #define U_ALIGN_CODE(val) __asm align val #else #define U_ALIGN_CODE(val) #endif /** * Flag for workaround of MSVC 2003 optimization bugs */ #if defined(_MSC_VER) && (_MSC_VER < 1400) #define U_HAVE_MSVC_2003_OR_EARLIER #endif /** @} */ /*===========================================================================*/ /** @{ Programs used by ICU code */ /*===========================================================================*/ #ifndef U_MAKE #define U_MAKE "nmake" #define U_MAKE_IS_NMAKE 1 #endif /** @} */ android-audiosystem-1.8+13.10.20130807/include/unicode/unistr.h0000644000015700001700000050242412200324306024447 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (C) 1998-2010, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * * File unistr.h * * Modification History: * * Date Name Description * 09/25/98 stephen Creation. * 11/11/98 stephen Changed per 11/9 code review. * 04/20/99 stephen Overhauled per 4/16 code review. * 11/18/99 aliu Made to inherit from Replaceable. Added method * handleReplaceBetween(); other methods unchanged. * 06/25/01 grhoten Remove dependency on iostream. ****************************************************************************** */ #ifndef UNISTR_H #define UNISTR_H /** * \file * \brief C++ API: Unicode String */ #include "unicode/utypes.h" #include "unicode/rep.h" #include "unicode/std_string.h" #include "unicode/stringpiece.h" #include "unicode/bytestream.h" struct UConverter; // unicode/ucnv.h class StringThreadTest; #ifndef U_COMPARE_CODE_POINT_ORDER /* see also ustring.h and unorm.h */ /** * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc: * Compare strings in code point order instead of code unit order. * @stable ICU 2.2 */ #define U_COMPARE_CODE_POINT_ORDER 0x8000 #endif #ifndef USTRING_H /** * \ingroup ustring_ustrlen */ U_STABLE int32_t U_EXPORT2 u_strlen(const UChar *s); #endif U_NAMESPACE_BEGIN class Locale; // unicode/locid.h class StringCharacterIterator; class BreakIterator; // unicode/brkiter.h /* The include has been moved to unicode/ustream.h */ /** * Constant to be used in the UnicodeString(char *, int32_t, EInvariant) constructor * which constructs a Unicode string from an invariant-character char * string. * About invariant characters see utypes.h. * This constructor has no runtime dependency on conversion code and is * therefore recommended over ones taking a charset name string * (where the empty string "" indicates invariant-character conversion). * * @stable ICU 3.2 */ #define US_INV U_NAMESPACE_QUALIFIER UnicodeString::kInvariant /** * Unicode String literals in C++. * Dependent on the platform properties, different UnicodeString * constructors should be used to create a UnicodeString object from * a string literal. * The macros are defined for maximum performance. * They work only for strings that contain "invariant characters", i.e., * only latin letters, digits, and some punctuation. * See utypes.h for details. * * The string parameter must be a C string literal. * The length of the string, not including the terminating * NUL, must be specified as a constant. * The U_STRING_DECL macro should be invoked exactly once for one * such string variable before it is used. * @stable ICU 2.0 */ #if defined(U_DECLARE_UTF16) # define UNICODE_STRING(cs, _length) U_NAMESPACE_QUALIFIER UnicodeString(TRUE, (const UChar *)U_DECLARE_UTF16(cs), _length) #elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16))) # define UNICODE_STRING(cs, _length) U_NAMESPACE_QUALIFIER UnicodeString(TRUE, (const UChar *)L ## cs, _length) #elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY # define UNICODE_STRING(cs, _length) U_NAMESPACE_QUALIFIER UnicodeString(TRUE, (const UChar *)cs, _length) #else # define UNICODE_STRING(cs, _length) U_NAMESPACE_QUALIFIER UnicodeString(cs, _length, US_INV) #endif /** * Unicode String literals in C++. * Dependent on the platform properties, different UnicodeString * constructors should be used to create a UnicodeString object from * a string literal. * The macros are defined for improved performance. * They work only for strings that contain "invariant characters", i.e., * only latin letters, digits, and some punctuation. * See utypes.h for details. * * The string parameter must be a C string literal. * @stable ICU 2.0 */ #define UNICODE_STRING_SIMPLE(cs) UNICODE_STRING(cs, -1) /** * UnicodeString is a string class that stores Unicode characters directly and provides * similar functionality as the Java String and StringBuffer classes. * It is a concrete implementation of the abstract class Replaceable (for transliteration). * * The UnicodeString class is not suitable for subclassing. * *

For an overview of Unicode strings in C and C++ see the * User Guide Strings chapter.

* *

In ICU, a Unicode string consists of 16-bit Unicode code units. * A Unicode character may be stored with either one code unit * (the most common case) or with a matched pair of special code units * ("surrogates"). The data type for code units is UChar. * For single-character handling, a Unicode character code point is a value * in the range 0..0x10ffff. ICU uses the UChar32 type for code points.

* *

Indexes and offsets into and lengths of strings always count code units, not code points. * This is the same as with multi-byte char* strings in traditional string handling. * Operations on partial strings typically do not test for code point boundaries. * If necessary, the user needs to take care of such boundaries by testing for the code unit * values or by using functions like * UnicodeString::getChar32Start() and UnicodeString::getChar32Limit() * (or, in C, the equivalent macros U16_SET_CP_START() and U16_SET_CP_LIMIT(), see utf.h).

* * UnicodeString methods are more lenient with regard to input parameter values * than other ICU APIs. In particular: * - If indexes are out of bounds for a UnicodeString object * (<0 or >length()) then they are "pinned" to the nearest boundary. * - If primitive string pointer values (e.g., const UChar * or char *) * for input strings are NULL, then those input string parameters are treated * as if they pointed to an empty string. * However, this is not the case for char * parameters for charset names * or other IDs. * - Most UnicodeString methods do not take a UErrorCode parameter because * there are usually very few opportunities for failure other than a shortage * of memory, error codes in low-level C++ string methods would be inconvenient, * and the error code as the last parameter (ICU convention) would prevent * the use of default parameter values. * Instead, such methods set the UnicodeString into a "bogus" state * (see isBogus()) if an error occurs. * * In string comparisons, two UnicodeString objects that are both "bogus" * compare equal (to be transitive and prevent endless loops in sorting), * and a "bogus" string compares less than any non-"bogus" one. * * Const UnicodeString methods are thread-safe. Multiple threads can use * const methods on the same UnicodeString object simultaneously, * but non-const methods must not be called concurrently (in multiple threads) * with any other (const or non-const) methods. * * Similarly, const UnicodeString & parameters are thread-safe. * One object may be passed in as such a parameter concurrently in multiple threads. * This includes the const UnicodeString & parameters for * copy construction, assignment, and cloning. * *

UnicodeString uses several storage methods. * String contents can be stored inside the UnicodeString object itself, * in an allocated and shared buffer, or in an outside buffer that is "aliased". * Most of this is done transparently, but careful aliasing in particular provides * significant performance improvements. * Also, the internal buffer is accessible via special functions. * For details see the * User Guide Strings chapter.

* * @see utf.h * @see CharacterIterator * @stable ICU 2.0 */ class U_COMMON_API UnicodeString : public Replaceable { public: /** * Constant to be used in the UnicodeString(char *, int32_t, EInvariant) constructor * which constructs a Unicode string from an invariant-character char * string. * Use the macro US_INV instead of the full qualification for this value. * * @see US_INV * @stable ICU 3.2 */ enum EInvariant { /** * @see EInvariant * @stable ICU 3.2 */ kInvariant }; //======================================== // Read-only operations //======================================== /* Comparison - bitwise only - for international comparison use collation */ /** * Equality operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. * @return TRUE if text contains the same characters as this one, * FALSE otherwise. * @stable ICU 2.0 */ inline UBool operator== (const UnicodeString& text) const; /** * Inequality operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. * @return FALSE if text contains the same characters as this one, * TRUE otherwise. * @stable ICU 2.0 */ inline UBool operator!= (const UnicodeString& text) const; /** * Greater than operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. * @return TRUE if the characters in this are bitwise * greater than the characters in text, FALSE otherwise * @stable ICU 2.0 */ inline UBool operator> (const UnicodeString& text) const; /** * Less than operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. * @return TRUE if the characters in this are bitwise * less than the characters in text, FALSE otherwise * @stable ICU 2.0 */ inline UBool operator< (const UnicodeString& text) const; /** * Greater than or equal operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. * @return TRUE if the characters in this are bitwise * greater than or equal to the characters in text, FALSE otherwise * @stable ICU 2.0 */ inline UBool operator>= (const UnicodeString& text) const; /** * Less than or equal operator. Performs only bitwise comparison. * @param text The UnicodeString to compare to this one. * @return TRUE if the characters in this are bitwise * less than or equal to the characters in text, FALSE otherwise * @stable ICU 2.0 */ inline UBool operator<= (const UnicodeString& text) const; /** * Compare the characters bitwise in this UnicodeString to * the characters in text. * @param text The UnicodeString to compare to this one. * @return The result of bitwise character comparison: 0 if this * contains the same characters as text, -1 if the characters in * this are bitwise less than the characters in text, +1 if the * characters in this are bitwise greater than the characters * in text. * @stable ICU 2.0 */ inline int8_t compare(const UnicodeString& text) const; /** * Compare the characters bitwise in the range * [start, start + length) with the characters * in text * @param start the offset at which the compare operation begins * @param length the number of characters of text to compare. * @param text the other text to be compared against this string. * @return The result of bitwise character comparison: 0 if this * contains the same characters as text, -1 if the characters in * this are bitwise less than the characters in text, +1 if the * characters in this are bitwise greater than the characters * in text. * @stable ICU 2.0 */ inline int8_t compare(int32_t start, int32_t length, const UnicodeString& text) const; /** * Compare the characters bitwise in the range * [start, start + length) with the characters * in srcText in the range * [srcStart, srcStart + srcLength). * @param start the offset at which the compare operation begins * @param length the number of characters in this to compare. * @param srcText the text to be compared * @param srcStart the offset into srcText to start comparison * @param srcLength the number of characters in src to compare * @return The result of bitwise character comparison: 0 if this * contains the same characters as srcText, -1 if the characters in * this are bitwise less than the characters in srcText, +1 if the * characters in this are bitwise greater than the characters * in srcText. * @stable ICU 2.0 */ inline int8_t compare(int32_t start, int32_t length, const UnicodeString& srcText, int32_t srcStart, int32_t srcLength) const; /** * Compare the characters bitwise in this UnicodeString with the first * srcLength characters in srcChars. * @param srcChars The characters to compare to this UnicodeString. * @param srcLength the number of characters in srcChars to compare * @return The result of bitwise character comparison: 0 if this * contains the same characters as srcChars, -1 if the characters in * this are bitwise less than the characters in srcChars, +1 if the * characters in this are bitwise greater than the characters * in srcChars. * @stable ICU 2.0 */ inline int8_t compare(const UChar *srcChars, int32_t srcLength) const; /** * Compare the characters bitwise in the range * [start, start + length) with the first * length characters in srcChars * @param start the offset at which the compare operation begins * @param length the number of characters to compare. * @param srcChars the characters to be compared * @return The result of bitwise character comparison: 0 if this * contains the same characters as srcChars, -1 if the characters in * this are bitwise less than the characters in srcChars, +1 if the * characters in this are bitwise greater than the characters * in srcChars. * @stable ICU 2.0 */ inline int8_t compare(int32_t start, int32_t length, const UChar *srcChars) const; /** * Compare the characters bitwise in the range * [start, start + length) with the characters * in srcChars in the range * [srcStart, srcStart + srcLength). * @param start the offset at which the compare operation begins * @param length the number of characters in this to compare * @param srcChars the characters to be compared * @param srcStart the offset into srcChars to start comparison * @param srcLength the number of characters in srcChars to compare * @return The result of bitwise character comparison: 0 if this * contains the same characters as srcChars, -1 if the characters in * this are bitwise less than the characters in srcChars, +1 if the * characters in this are bitwise greater than the characters * in srcChars. * @stable ICU 2.0 */ inline int8_t compare(int32_t start, int32_t length, const UChar *srcChars, int32_t srcStart, int32_t srcLength) const; /** * Compare the characters bitwise in the range * [start, limit) with the characters * in srcText in the range * [srcStart, srcLimit). * @param start the offset at which the compare operation begins * @param limit the offset immediately following the compare operation * @param srcText the text to be compared * @param srcStart the offset into srcText to start comparison * @param srcLimit the offset into srcText to limit comparison * @return The result of bitwise character comparison: 0 if this * contains the same characters as srcText, -1 if the characters in * this are bitwise less than the characters in srcText, +1 if the * characters in this are bitwise greater than the characters * in srcText. * @stable ICU 2.0 */ inline int8_t compareBetween(int32_t start, int32_t limit, const UnicodeString& srcText, int32_t srcStart, int32_t srcLimit) const; /** * Compare two Unicode strings in code point order. * The result may be different from the results of compare(), operator<, etc. * if supplementary characters are present: * * In UTF-16, supplementary characters (with code points U+10000 and above) are * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, * which means that they compare as less than some other BMP characters like U+feff. * This function compares Unicode strings in code point order. * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. * * @param text Another string to compare this one to. * @return a negative/zero/positive integer corresponding to whether * this string is less than/equal to/greater than the second one * in code point order * @stable ICU 2.0 */ inline int8_t compareCodePointOrder(const UnicodeString& text) const; /** * Compare two Unicode strings in code point order. * The result may be different from the results of compare(), operator<, etc. * if supplementary characters are present: * * In UTF-16, supplementary characters (with code points U+10000 and above) are * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, * which means that they compare as less than some other BMP characters like U+feff. * This function compares Unicode strings in code point order. * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. * * @param start The start offset in this string at which the compare operation begins. * @param length The number of code units from this string to compare. * @param srcText Another string to compare this one to. * @return a negative/zero/positive integer corresponding to whether * this string is less than/equal to/greater than the second one * in code point order * @stable ICU 2.0 */ inline int8_t compareCodePointOrder(int32_t start, int32_t length, const UnicodeString& srcText) const; /** * Compare two Unicode strings in code point order. * The result may be different from the results of compare(), operator<, etc. * if supplementary characters are present: * * In UTF-16, supplementary characters (with code points U+10000 and above) are * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, * which means that they compare as less than some other BMP characters like U+feff. * This function compares Unicode strings in code point order. * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. * * @param start The start offset in this string at which the compare operation begins. * @param length The number of code units from this string to compare. * @param srcText Another string to compare this one to. * @param srcStart The start offset in that string at which the compare operation begins. * @param srcLength The number of code units from that string to compare. * @return a negative/zero/positive integer corresponding to whether * this string is less than/equal to/greater than the second one * in code point order * @stable ICU 2.0 */ inline int8_t compareCodePointOrder(int32_t start, int32_t length, const UnicodeString& srcText, int32_t srcStart, int32_t srcLength) const; /** * Compare two Unicode strings in code point order. * The result may be different from the results of compare(), operator<, etc. * if supplementary characters are present: * * In UTF-16, supplementary characters (with code points U+10000 and above) are * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, * which means that they compare as less than some other BMP characters like U+feff. * This function compares Unicode strings in code point order. * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. * * @param srcChars A pointer to another string to compare this one to. * @param srcLength The number of code units from that string to compare. * @return a negative/zero/positive integer corresponding to whether * this string is less than/equal to/greater than the second one * in code point order * @stable ICU 2.0 */ inline int8_t compareCodePointOrder(const UChar *srcChars, int32_t srcLength) const; /** * Compare two Unicode strings in code point order. * The result may be different from the results of compare(), operator<, etc. * if supplementary characters are present: * * In UTF-16, supplementary characters (with code points U+10000 and above) are * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, * which means that they compare as less than some other BMP characters like U+feff. * This function compares Unicode strings in code point order. * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. * * @param start The start offset in this string at which the compare operation begins. * @param length The number of code units from this string to compare. * @param srcChars A pointer to another string to compare this one to. * @return a negative/zero/positive integer corresponding to whether * this string is less than/equal to/greater than the second one * in code point order * @stable ICU 2.0 */ inline int8_t compareCodePointOrder(int32_t start, int32_t length, const UChar *srcChars) const; /** * Compare two Unicode strings in code point order. * The result may be different from the results of compare(), operator<, etc. * if supplementary characters are present: * * In UTF-16, supplementary characters (with code points U+10000 and above) are * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, * which means that they compare as less than some other BMP characters like U+feff. * This function compares Unicode strings in code point order. * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. * * @param start The start offset in this string at which the compare operation begins. * @param length The number of code units from this string to compare. * @param srcChars A pointer to another string to compare this one to. * @param srcStart The start offset in that string at which the compare operation begins. * @param srcLength The number of code units from that string to compare. * @return a negative/zero/positive integer corresponding to whether * this string is less than/equal to/greater than the second one * in code point order * @stable ICU 2.0 */ inline int8_t compareCodePointOrder(int32_t start, int32_t length, const UChar *srcChars, int32_t srcStart, int32_t srcLength) const; /** * Compare two Unicode strings in code point order. * The result may be different from the results of compare(), operator<, etc. * if supplementary characters are present: * * In UTF-16, supplementary characters (with code points U+10000 and above) are * stored with pairs of surrogate code units. These have values from 0xd800 to 0xdfff, * which means that they compare as less than some other BMP characters like U+feff. * This function compares Unicode strings in code point order. * If either of the UTF-16 strings is malformed (i.e., it contains unpaired surrogates), then the result is not defined. * * @param start The start offset in this string at which the compare operation begins. * @param limit The offset after the last code unit from this string to compare. * @param srcText Another string to compare this one to. * @param srcStart The start offset in that string at which the compare operation begins. * @param srcLimit The offset after the last code unit from that string to compare. * @return a negative/zero/positive integer corresponding to whether * this string is less than/equal to/greater than the second one * in code point order * @stable ICU 2.0 */ inline int8_t compareCodePointOrderBetween(int32_t start, int32_t limit, const UnicodeString& srcText, int32_t srcStart, int32_t srcLimit) const; /** * Compare two strings case-insensitively using full case folding. * This is equivalent to this->foldCase(options).compare(text.foldCase(options)). * * @param text Another string to compare this one to. * @param options A bit set of options: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: * Comparison in code unit order with default case folding. * * - U_COMPARE_CODE_POINT_ORDER * Set to choose code point order instead of code unit order * (see u_strCompare for details). * * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ inline int8_t caseCompare(const UnicodeString& text, uint32_t options) const; /** * Compare two strings case-insensitively using full case folding. * This is equivalent to this->foldCase(options).compare(srcText.foldCase(options)). * * @param start The start offset in this string at which the compare operation begins. * @param length The number of code units from this string to compare. * @param srcText Another string to compare this one to. * @param options A bit set of options: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: * Comparison in code unit order with default case folding. * * - U_COMPARE_CODE_POINT_ORDER * Set to choose code point order instead of code unit order * (see u_strCompare for details). * * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ inline int8_t caseCompare(int32_t start, int32_t length, const UnicodeString& srcText, uint32_t options) const; /** * Compare two strings case-insensitively using full case folding. * This is equivalent to this->foldCase(options).compare(srcText.foldCase(options)). * * @param start The start offset in this string at which the compare operation begins. * @param length The number of code units from this string to compare. * @param srcText Another string to compare this one to. * @param srcStart The start offset in that string at which the compare operation begins. * @param srcLength The number of code units from that string to compare. * @param options A bit set of options: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: * Comparison in code unit order with default case folding. * * - U_COMPARE_CODE_POINT_ORDER * Set to choose code point order instead of code unit order * (see u_strCompare for details). * * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ inline int8_t caseCompare(int32_t start, int32_t length, const UnicodeString& srcText, int32_t srcStart, int32_t srcLength, uint32_t options) const; /** * Compare two strings case-insensitively using full case folding. * This is equivalent to this->foldCase(options).compare(srcChars.foldCase(options)). * * @param srcChars A pointer to another string to compare this one to. * @param srcLength The number of code units from that string to compare. * @param options A bit set of options: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: * Comparison in code unit order with default case folding. * * - U_COMPARE_CODE_POINT_ORDER * Set to choose code point order instead of code unit order * (see u_strCompare for details). * * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ inline int8_t caseCompare(const UChar *srcChars, int32_t srcLength, uint32_t options) const; /** * Compare two strings case-insensitively using full case folding. * This is equivalent to this->foldCase(options).compare(srcChars.foldCase(options)). * * @param start The start offset in this string at which the compare operation begins. * @param length The number of code units from this string to compare. * @param srcChars A pointer to another string to compare this one to. * @param options A bit set of options: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: * Comparison in code unit order with default case folding. * * - U_COMPARE_CODE_POINT_ORDER * Set to choose code point order instead of code unit order * (see u_strCompare for details). * * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ inline int8_t caseCompare(int32_t start, int32_t length, const UChar *srcChars, uint32_t options) const; /** * Compare two strings case-insensitively using full case folding. * This is equivalent to this->foldCase(options).compare(srcChars.foldCase(options)). * * @param start The start offset in this string at which the compare operation begins. * @param length The number of code units from this string to compare. * @param srcChars A pointer to another string to compare this one to. * @param srcStart The start offset in that string at which the compare operation begins. * @param srcLength The number of code units from that string to compare. * @param options A bit set of options: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: * Comparison in code unit order with default case folding. * * - U_COMPARE_CODE_POINT_ORDER * Set to choose code point order instead of code unit order * (see u_strCompare for details). * * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ inline int8_t caseCompare(int32_t start, int32_t length, const UChar *srcChars, int32_t srcStart, int32_t srcLength, uint32_t options) const; /** * Compare two strings case-insensitively using full case folding. * This is equivalent to this->foldCase(options).compareBetween(text.foldCase(options)). * * @param start The start offset in this string at which the compare operation begins. * @param limit The offset after the last code unit from this string to compare. * @param srcText Another string to compare this one to. * @param srcStart The start offset in that string at which the compare operation begins. * @param srcLimit The offset after the last code unit from that string to compare. * @param options A bit set of options: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: * Comparison in code unit order with default case folding. * * - U_COMPARE_CODE_POINT_ORDER * Set to choose code point order instead of code unit order * (see u_strCompare for details). * * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * * @return A negative, zero, or positive integer indicating the comparison result. * @stable ICU 2.0 */ inline int8_t caseCompareBetween(int32_t start, int32_t limit, const UnicodeString& srcText, int32_t srcStart, int32_t srcLimit, uint32_t options) const; /** * Determine if this starts with the characters in text * @param text The text to match. * @return TRUE if this starts with the characters in text, * FALSE otherwise * @stable ICU 2.0 */ inline UBool startsWith(const UnicodeString& text) const; /** * Determine if this starts with the characters in srcText * in the range [srcStart, srcStart + srcLength). * @param srcText The text to match. * @param srcStart the offset into srcText to start matching * @param srcLength the number of characters in srcText to match * @return TRUE if this starts with the characters in text, * FALSE otherwise * @stable ICU 2.0 */ inline UBool startsWith(const UnicodeString& srcText, int32_t srcStart, int32_t srcLength) const; /** * Determine if this starts with the characters in srcChars * @param srcChars The characters to match. * @param srcLength the number of characters in srcChars * @return TRUE if this starts with the characters in srcChars, * FALSE otherwise * @stable ICU 2.0 */ inline UBool startsWith(const UChar *srcChars, int32_t srcLength) const; /** * Determine if this ends with the characters in srcChars * in the range [srcStart, srcStart + srcLength). * @param srcChars The characters to match. * @param srcStart the offset into srcText to start matching * @param srcLength the number of characters in srcChars to match * @return TRUE if this ends with the characters in srcChars, FALSE otherwise * @stable ICU 2.0 */ inline UBool startsWith(const UChar *srcChars, int32_t srcStart, int32_t srcLength) const; /** * Determine if this ends with the characters in text * @param text The text to match. * @return TRUE if this ends with the characters in text, * FALSE otherwise * @stable ICU 2.0 */ inline UBool endsWith(const UnicodeString& text) const; /** * Determine if this ends with the characters in srcText * in the range [srcStart, srcStart + srcLength). * @param srcText The text to match. * @param srcStart the offset into srcText to start matching * @param srcLength the number of characters in srcText to match * @return TRUE if this ends with the characters in text, * FALSE otherwise * @stable ICU 2.0 */ inline UBool endsWith(const UnicodeString& srcText, int32_t srcStart, int32_t srcLength) const; /** * Determine if this ends with the characters in srcChars * @param srcChars The characters to match. * @param srcLength the number of characters in srcChars * @return TRUE if this ends with the characters in srcChars, * FALSE otherwise * @stable ICU 2.0 */ inline UBool endsWith(const UChar *srcChars, int32_t srcLength) const; /** * Determine if this ends with the characters in srcChars * in the range [srcStart, srcStart + srcLength). * @param srcChars The characters to match. * @param srcStart the offset into srcText to start matching * @param srcLength the number of characters in srcChars to match * @return TRUE if this ends with the characters in srcChars, * FALSE otherwise * @stable ICU 2.0 */ inline UBool endsWith(const UChar *srcChars, int32_t srcStart, int32_t srcLength) const; /* Searching - bitwise only */ /** * Locate in this the first occurrence of the characters in text, * using bitwise comparison. * @param text The text to search for. * @return The offset into this of the start of text, * or -1 if not found. * @stable ICU 2.0 */ inline int32_t indexOf(const UnicodeString& text) const; /** * Locate in this the first occurrence of the characters in text * starting at offset start, using bitwise comparison. * @param text The text to search for. * @param start The offset at which searching will start. * @return The offset into this of the start of text, * or -1 if not found. * @stable ICU 2.0 */ inline int32_t indexOf(const UnicodeString& text, int32_t start) const; /** * Locate in this the first occurrence in the range * [start, start + length) of the characters * in text, using bitwise comparison. * @param text The text to search for. * @param start The offset at which searching will start. * @param length The number of characters to search * @return The offset into this of the start of text, * or -1 if not found. * @stable ICU 2.0 */ inline int32_t indexOf(const UnicodeString& text, int32_t start, int32_t length) const; /** * Locate in this the first occurrence in the range * [start, start + length) of the characters * in srcText in the range * [srcStart, srcStart + srcLength), * using bitwise comparison. * @param srcText The text to search for. * @param srcStart the offset into srcText at which * to start matching * @param srcLength the number of characters in srcText to match * @param start the offset into this at which to start matching * @param length the number of characters in this to search * @return The offset into this of the start of text, * or -1 if not found. * @stable ICU 2.0 */ inline int32_t indexOf(const UnicodeString& srcText, int32_t srcStart, int32_t srcLength, int32_t start, int32_t length) const; /** * Locate in this the first occurrence of the characters in * srcChars * starting at offset start, using bitwise comparison. * @param srcChars The text to search for. * @param srcLength the number of characters in srcChars to match * @param start the offset into this at which to start matching * @return The offset into this of the start of text, * or -1 if not found. * @stable ICU 2.0 */ inline int32_t indexOf(const UChar *srcChars, int32_t srcLength, int32_t start) const; /** * Locate in this the first occurrence in the range * [start, start + length) of the characters * in srcChars, using bitwise comparison. * @param srcChars The text to search for. * @param srcLength the number of characters in srcChars * @param start The offset at which searching will start. * @param length The number of characters to search * @return The offset into this of the start of srcChars, * or -1 if not found. * @stable ICU 2.0 */ inline int32_t indexOf(const UChar *srcChars, int32_t srcLength, int32_t start, int32_t length) const; /** * Locate in this the first occurrence in the range * [start, start + length) of the characters * in srcChars in the range * [srcStart, srcStart + srcLength), * using bitwise comparison. * @param srcChars The text to search for. * @param srcStart the offset into srcChars at which * to start matching * @param srcLength the number of characters in srcChars to match * @param start the offset into this at which to start matching * @param length the number of characters in this to search * @return The offset into this of the start of text, * or -1 if not found. * @stable ICU 2.0 */ int32_t indexOf(const UChar *srcChars, int32_t srcStart, int32_t srcLength, int32_t start, int32_t length) const; /** * Locate in this the first occurrence of the BMP code point c, * using bitwise comparison. * @param c The code unit to search for. * @return The offset into this of c, or -1 if not found. * @stable ICU 2.0 */ inline int32_t indexOf(UChar c) const; /** * Locate in this the first occurrence of the code point c, * using bitwise comparison. * * @param c The code point to search for. * @return The offset into this of c, or -1 if not found. * @stable ICU 2.0 */ inline int32_t indexOf(UChar32 c) const; /** * Locate in this the first occurrence of the BMP code point c, * starting at offset start, using bitwise comparison. * @param c The code unit to search for. * @param start The offset at which searching will start. * @return The offset into this of c, or -1 if not found. * @stable ICU 2.0 */ inline int32_t indexOf(UChar c, int32_t start) const; /** * Locate in this the first occurrence of the code point c * starting at offset start, using bitwise comparison. * * @param c The code point to search for. * @param start The offset at which searching will start. * @return The offset into this of c, or -1 if not found. * @stable ICU 2.0 */ inline int32_t indexOf(UChar32 c, int32_t start) const; /** * Locate in this the first occurrence of the BMP code point c * in the range [start, start + length), * using bitwise comparison. * @param c The code unit to search for. * @param start the offset into this at which to start matching * @param length the number of characters in this to search * @return The offset into this of c, or -1 if not found. * @stable ICU 2.0 */ inline int32_t indexOf(UChar c, int32_t start, int32_t length) const; /** * Locate in this the first occurrence of the code point c * in the range [start, start + length), * using bitwise comparison. * * @param c The code point to search for. * @param start the offset into this at which to start matching * @param length the number of characters in this to search * @return The offset into this of c, or -1 if not found. * @stable ICU 2.0 */ inline int32_t indexOf(UChar32 c, int32_t start, int32_t length) const; /** * Locate in this the last occurrence of the characters in text, * using bitwise comparison. * @param text The text to search for. * @return The offset into this of the start of text, * or -1 if not found. * @stable ICU 2.0 */ inline int32_t lastIndexOf(const UnicodeString& text) const; /** * Locate in this the last occurrence of the characters in text * starting at offset start, using bitwise comparison. * @param text The text to search for. * @param start The offset at which searching will start. * @return The offset into this of the start of text, * or -1 if not found. * @stable ICU 2.0 */ inline int32_t lastIndexOf(const UnicodeString& text, int32_t start) const; /** * Locate in this the last occurrence in the range * [start, start + length) of the characters * in text, using bitwise comparison. * @param text The text to search for. * @param start The offset at which searching will start. * @param length The number of characters to search * @return The offset into this of the start of text, * or -1 if not found. * @stable ICU 2.0 */ inline int32_t lastIndexOf(const UnicodeString& text, int32_t start, int32_t length) const; /** * Locate in this the last occurrence in the range * [start, start + length) of the characters * in srcText in the range * [srcStart, srcStart + srcLength), * using bitwise comparison. * @param srcText The text to search for. * @param srcStart the offset into srcText at which * to start matching * @param srcLength the number of characters in srcText to match * @param start the offset into this at which to start matching * @param length the number of characters in this to search * @return The offset into this of the start of text, * or -1 if not found. * @stable ICU 2.0 */ inline int32_t lastIndexOf(const UnicodeString& srcText, int32_t srcStart, int32_t srcLength, int32_t start, int32_t length) const; /** * Locate in this the last occurrence of the characters in srcChars * starting at offset start, using bitwise comparison. * @param srcChars The text to search for. * @param srcLength the number of characters in srcChars to match * @param start the offset into this at which to start matching * @return The offset into this of the start of text, * or -1 if not found. * @stable ICU 2.0 */ inline int32_t lastIndexOf(const UChar *srcChars, int32_t srcLength, int32_t start) const; /** * Locate in this the last occurrence in the range * [start, start + length) of the characters * in srcChars, using bitwise comparison. * @param srcChars The text to search for. * @param srcLength the number of characters in srcChars * @param start The offset at which searching will start. * @param length The number of characters to search * @return The offset into this of the start of srcChars, * or -1 if not found. * @stable ICU 2.0 */ inline int32_t lastIndexOf(const UChar *srcChars, int32_t srcLength, int32_t start, int32_t length) const; /** * Locate in this the last occurrence in the range * [start, start + length) of the characters * in srcChars in the range * [srcStart, srcStart + srcLength), * using bitwise comparison. * @param srcChars The text to search for. * @param srcStart the offset into srcChars at which * to start matching * @param srcLength the number of characters in srcChars to match * @param start the offset into this at which to start matching * @param length the number of characters in this to search * @return The offset into this of the start of text, * or -1 if not found. * @stable ICU 2.0 */ int32_t lastIndexOf(const UChar *srcChars, int32_t srcStart, int32_t srcLength, int32_t start, int32_t length) const; /** * Locate in this the last occurrence of the BMP code point c, * using bitwise comparison. * @param c The code unit to search for. * @return The offset into this of c, or -1 if not found. * @stable ICU 2.0 */ inline int32_t lastIndexOf(UChar c) const; /** * Locate in this the last occurrence of the code point c, * using bitwise comparison. * * @param c The code point to search for. * @return The offset into this of c, or -1 if not found. * @stable ICU 2.0 */ inline int32_t lastIndexOf(UChar32 c) const; /** * Locate in this the last occurrence of the BMP code point c * starting at offset start, using bitwise comparison. * @param c The code unit to search for. * @param start The offset at which searching will start. * @return The offset into this of c, or -1 if not found. * @stable ICU 2.0 */ inline int32_t lastIndexOf(UChar c, int32_t start) const; /** * Locate in this the last occurrence of the code point c * starting at offset start, using bitwise comparison. * * @param c The code point to search for. * @param start The offset at which searching will start. * @return The offset into this of c, or -1 if not found. * @stable ICU 2.0 */ inline int32_t lastIndexOf(UChar32 c, int32_t start) const; /** * Locate in this the last occurrence of the BMP code point c * in the range [start, start + length), * using bitwise comparison. * @param c The code unit to search for. * @param start the offset into this at which to start matching * @param length the number of characters in this to search * @return The offset into this of c, or -1 if not found. * @stable ICU 2.0 */ inline int32_t lastIndexOf(UChar c, int32_t start, int32_t length) const; /** * Locate in this the last occurrence of the code point c * in the range [start, start + length), * using bitwise comparison. * * @param c The code point to search for. * @param start the offset into this at which to start matching * @param length the number of characters in this to search * @return The offset into this of c, or -1 if not found. * @stable ICU 2.0 */ inline int32_t lastIndexOf(UChar32 c, int32_t start, int32_t length) const; /* Character access */ /** * Return the code unit at offset offset. * If the offset is not valid (0..length()-1) then U+ffff is returned. * @param offset a valid offset into the text * @return the code unit at offset offset * or 0xffff if the offset is not valid for this string * @stable ICU 2.0 */ inline UChar charAt(int32_t offset) const; /** * Return the code unit at offset offset. * If the offset is not valid (0..length()-1) then U+ffff is returned. * @param offset a valid offset into the text * @return the code unit at offset offset * @stable ICU 2.0 */ inline UChar operator[] (int32_t offset) const; /** * Return the code point that contains the code unit * at offset offset. * If the offset is not valid (0..length()-1) then U+ffff is returned. * @param offset a valid offset into the text * that indicates the text offset of any of the code units * that will be assembled into a code point (21-bit value) and returned * @return the code point of text at offset * or 0xffff if the offset is not valid for this string * @stable ICU 2.0 */ inline UChar32 char32At(int32_t offset) const; /** * Adjust a random-access offset so that * it points to the beginning of a Unicode character. * The offset that is passed in points to * any code unit of a code point, * while the returned offset will point to the first code unit * of the same code point. * In UTF-16, if the input offset points to a second surrogate * of a surrogate pair, then the returned offset will point * to the first surrogate. * @param offset a valid offset into one code point of the text * @return offset of the first code unit of the same code point * @see U16_SET_CP_START * @stable ICU 2.0 */ inline int32_t getChar32Start(int32_t offset) const; /** * Adjust a random-access offset so that * it points behind a Unicode character. * The offset that is passed in points behind * any code unit of a code point, * while the returned offset will point behind the last code unit * of the same code point. * In UTF-16, if the input offset points behind the first surrogate * (i.e., to the second surrogate) * of a surrogate pair, then the returned offset will point * behind the second surrogate (i.e., to the first surrogate). * @param offset a valid offset after any code unit of a code point of the text * @return offset of the first code unit after the same code point * @see U16_SET_CP_LIMIT * @stable ICU 2.0 */ inline int32_t getChar32Limit(int32_t offset) const; /** * Move the code unit index along the string by delta code points. * Interpret the input index as a code unit-based offset into the string, * move the index forward or backward by delta code points, and * return the resulting index. * The input index should point to the first code unit of a code point, * if there is more than one. * * Both input and output indexes are code unit-based as for all * string indexes/offsets in ICU (and other libraries, like MBCS char*). * If delta<0 then the index is moved backward (toward the start of the string). * If delta>0 then the index is moved forward (toward the end of the string). * * This behaves like CharacterIterator::move32(delta, kCurrent). * * Behavior for out-of-bounds indexes: * moveIndex32 pins the input index to 0..length(), i.e., * if the input index<0 then it is pinned to 0; * if it is index>length() then it is pinned to length(). * Afterwards, the index is moved by delta code points * forward or backward, * but no further backward than to 0 and no further forward than to length(). * The resulting index return value will be in between 0 and length(), inclusively. * * Examples: *
   * // s has code points 'a' U+10000 'b' U+10ffff U+2029
   * UnicodeString s=UNICODE_STRING("a\\U00010000b\\U0010ffff\\u2029", 31).unescape();
   *
   * // initial index: position of U+10000
   * int32_t index=1;
   *
   * // the following examples will all result in index==4, position of U+10ffff
   *
   * // skip 2 code points from some position in the string
   * index=s.moveIndex32(index, 2); // skips U+10000 and 'b'
   *
   * // go to the 3rd code point from the start of s (0-based)
   * index=s.moveIndex32(0, 3); // skips 'a', U+10000, and 'b'
   *
   * // go to the next-to-last code point of s
   * index=s.moveIndex32(s.length(), -2); // backward-skips U+2029 and U+10ffff
   * 
* * @param index input code unit index * @param delta (signed) code point count to move the index forward or backward * in the string * @return the resulting code unit index * @stable ICU 2.0 */ int32_t moveIndex32(int32_t index, int32_t delta) const; /* Substring extraction */ /** * Copy the characters in the range * [start, start + length) into the array dst, * beginning at dstStart. * If the string aliases to dst itself as an external buffer, * then extract() will not copy the contents. * * @param start offset of first character which will be copied into the array * @param length the number of characters to extract * @param dst array in which to copy characters. The length of dst * must be at least (dstStart + length). * @param dstStart the offset in dst where the first character * will be extracted * @stable ICU 2.0 */ inline void extract(int32_t start, int32_t length, UChar *dst, int32_t dstStart = 0) const; /** * Copy the contents of the string into dest. * This is a convenience function that * checks if there is enough space in dest, * extracts the entire string if possible, * and NUL-terminates dest if possible. * * If the string fits into dest but cannot be NUL-terminated * (length()==destCapacity) then the error code is set to U_STRING_NOT_TERMINATED_WARNING. * If the string itself does not fit into dest * (length()>destCapacity) then the error code is set to U_BUFFER_OVERFLOW_ERROR. * * If the string aliases to dest itself as an external buffer, * then extract() will not copy the contents. * * @param dest Destination string buffer. * @param destCapacity Number of UChars available at dest. * @param errorCode ICU error code. * @return length() * @stable ICU 2.0 */ int32_t extract(UChar *dest, int32_t destCapacity, UErrorCode &errorCode) const; /** * Copy the characters in the range * [start, start + length) into the UnicodeString * target. * @param start offset of first character which will be copied * @param length the number of characters to extract * @param target UnicodeString into which to copy characters. * @return A reference to target * @stable ICU 2.0 */ inline void extract(int32_t start, int32_t length, UnicodeString& target) const; /** * Copy the characters in the range [start, limit) * into the array dst, beginning at dstStart. * @param start offset of first character which will be copied into the array * @param limit offset immediately following the last character to be copied * @param dst array in which to copy characters. The length of dst * must be at least (dstStart + (limit - start)). * @param dstStart the offset in dst where the first character * will be extracted * @stable ICU 2.0 */ inline void extractBetween(int32_t start, int32_t limit, UChar *dst, int32_t dstStart = 0) const; /** * Copy the characters in the range [start, limit) * into the UnicodeString target. Replaceable API. * @param start offset of first character which will be copied * @param limit offset immediately following the last character to be copied * @param target UnicodeString into which to copy characters. * @return A reference to target * @stable ICU 2.0 */ virtual void extractBetween(int32_t start, int32_t limit, UnicodeString& target) const; /** * Copy the characters in the range * [start, start + length) into an array of characters. * All characters must be invariant (see utypes.h). * Use US_INV as the last, signature-distinguishing parameter. * * This function does not write any more than targetLength * characters but returns the length of the entire output string * so that one can allocate a larger buffer and call the function again * if necessary. * The output string is NUL-terminated if possible. * * @param start offset of first character which will be copied * @param startLength the number of characters to extract * @param target the target buffer for extraction, can be NULL * if targetLength is 0 * @param targetCapacity the length of the target buffer * @param inv Signature-distinguishing paramater, use US_INV. * @return the output string length, not including the terminating NUL * @stable ICU 3.2 */ int32_t extract(int32_t start, int32_t startLength, char *target, int32_t targetCapacity, enum EInvariant inv) const; #if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION /** * Copy the characters in the range * [start, start + length) into an array of characters * in the platform's default codepage. * This function does not write any more than targetLength * characters but returns the length of the entire output string * so that one can allocate a larger buffer and call the function again * if necessary. * The output string is NUL-terminated if possible. * * @param start offset of first character which will be copied * @param startLength the number of characters to extract * @param target the target buffer for extraction * @param targetLength the length of the target buffer * If target is NULL, then the number of bytes required for * target is returned. * @return the output string length, not including the terminating NUL * @stable ICU 2.0 */ int32_t extract(int32_t start, int32_t startLength, char *target, uint32_t targetLength) const; #endif #if !UCONFIG_NO_CONVERSION /** * Copy the characters in the range * [start, start + length) into an array of characters * in a specified codepage. * The output string is NUL-terminated. * * Recommendation: For invariant-character strings use * extract(int32_t start, int32_t length, char *target, int32_t targetCapacity, enum EInvariant inv) const * because it avoids object code dependencies of UnicodeString on * the conversion code. * * @param start offset of first character which will be copied * @param startLength the number of characters to extract * @param target the target buffer for extraction * @param codepage the desired codepage for the characters. 0 has * the special meaning of the default codepage * If codepage is an empty string (""), * then a simple conversion is performed on the codepage-invariant * subset ("invariant characters") of the platform encoding. See utypes.h. * If target is NULL, then the number of bytes required for * target is returned. It is assumed that the target is big enough * to fit all of the characters. * @return the output string length, not including the terminating NUL * @stable ICU 2.0 */ inline int32_t extract(int32_t start, int32_t startLength, char *target, const char *codepage = 0) const; /** * Copy the characters in the range * [start, start + length) into an array of characters * in a specified codepage. * This function does not write any more than targetLength * characters but returns the length of the entire output string * so that one can allocate a larger buffer and call the function again * if necessary. * The output string is NUL-terminated if possible. * * Recommendation: For invariant-character strings use * extract(int32_t start, int32_t length, char *target, int32_t targetCapacity, enum EInvariant inv) const * because it avoids object code dependencies of UnicodeString on * the conversion code. * * @param start offset of first character which will be copied * @param startLength the number of characters to extract * @param target the target buffer for extraction * @param targetLength the length of the target buffer * @param codepage the desired codepage for the characters. 0 has * the special meaning of the default codepage * If codepage is an empty string (""), * then a simple conversion is performed on the codepage-invariant * subset ("invariant characters") of the platform encoding. See utypes.h. * If target is NULL, then the number of bytes required for * target is returned. * @return the output string length, not including the terminating NUL * @stable ICU 2.0 */ int32_t extract(int32_t start, int32_t startLength, char *target, uint32_t targetLength, const char *codepage) const; /** * Convert the UnicodeString into a codepage string using an existing UConverter. * The output string is NUL-terminated if possible. * * This function avoids the overhead of opening and closing a converter if * multiple strings are extracted. * * @param dest destination string buffer, can be NULL if destCapacity==0 * @param destCapacity the number of chars available at dest * @param cnv the converter object to be used (ucnv_resetFromUnicode() will be called), * or NULL for the default converter * @param errorCode normal ICU error code * @return the length of the output string, not counting the terminating NUL; * if the length is greater than destCapacity, then the string will not fit * and a buffer of the indicated length would need to be passed in * @stable ICU 2.0 */ int32_t extract(char *dest, int32_t destCapacity, UConverter *cnv, UErrorCode &errorCode) const; #endif /** * Create a temporary substring for the specified range. * Unlike the substring constructor and setTo() functions, * the object returned here will be a read-only alias (using getBuffer()) * rather than copying the text. * As a result, this substring operation is much faster but requires * that the original string not be modified or deleted during the lifetime * of the returned substring object. * @param start offset of the first character visible in the substring * @param length length of the substring * @return a read-only alias UnicodeString object for the substring * @stable ICU 4.4 */ UnicodeString tempSubString(int32_t start=0, int32_t length=INT32_MAX) const; /** * Create a temporary substring for the specified range. * Same as tempSubString(start, length) except that the substring range * is specified as a (start, limit) pair (with an exclusive limit index) * rather than a (start, length) pair. * @param start offset of the first character visible in the substring * @param limit offset immediately following the last character visible in the substring * @return a read-only alias UnicodeString object for the substring * @stable ICU 4.4 */ inline UnicodeString tempSubStringBetween(int32_t start, int32_t limit=INT32_MAX) const; /** * Convert the UnicodeString to UTF-8 and write the result * to a ByteSink. This is called by toUTF8String(). * Unpaired surrogates are replaced with U+FFFD. * Calls u_strToUTF8WithSub(). * * @param sink A ByteSink to which the UTF-8 version of the string is written. * sink.Flush() is called at the end. * @stable ICU 4.2 * @see toUTF8String */ void toUTF8(ByteSink &sink) const; #if U_HAVE_STD_STRING /** * Convert the UnicodeString to UTF-8 and append the result * to a standard string. * Unpaired surrogates are replaced with U+FFFD. * Calls toUTF8(). * * @param result A standard string (or a compatible object) * to which the UTF-8 version of the string is appended. * @return The string object. * @stable ICU 4.2 * @see toUTF8 */ template StringClass &toUTF8String(StringClass &result) const { StringByteSink sbs(&result); toUTF8(sbs); return result; } #endif /** * Convert the UnicodeString to UTF-32. * Unpaired surrogates are replaced with U+FFFD. * Calls u_strToUTF32WithSub(). * * @param utf32 destination string buffer, can be NULL if capacity==0 * @param capacity the number of UChar32s available at utf32 * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return The length of the UTF-32 string. * @see fromUTF32 * @stable ICU 4.2 */ int32_t toUTF32(UChar32 *utf32, int32_t capacity, UErrorCode &errorCode) const; /* Length operations */ /** * Return the length of the UnicodeString object. * The length is the number of UChar code units are in the UnicodeString. * If you want the number of code points, please use countChar32(). * @return the length of the UnicodeString object * @see countChar32 * @stable ICU 2.0 */ inline int32_t length(void) const; /** * Count Unicode code points in the length UChar code units of the string. * A code point may occupy either one or two UChar code units. * Counting code points involves reading all code units. * * This functions is basically the inverse of moveIndex32(). * * @param start the index of the first code unit to check * @param length the number of UChar code units to check * @return the number of code points in the specified code units * @see length * @stable ICU 2.0 */ int32_t countChar32(int32_t start=0, int32_t length=INT32_MAX) const; /** * Check if the length UChar code units of the string * contain more Unicode code points than a certain number. * This is more efficient than counting all code points in this part of the string * and comparing that number with a threshold. * This function may not need to scan the string at all if the length * falls within a certain range, and * never needs to count more than 'number+1' code points. * Logically equivalent to (countChar32(start, length)>number). * A Unicode code point may occupy either one or two UChar code units. * * @param start the index of the first code unit to check (0 for the entire string) * @param length the number of UChar code units to check * (use INT32_MAX for the entire string; remember that start/length * values are pinned) * @param number The number of code points in the (sub)string is compared against * the 'number' parameter. * @return Boolean value for whether the string contains more Unicode code points * than 'number'. Same as (u_countChar32(s, length)>number). * @see countChar32 * @see u_strHasMoreChar32Than * @stable ICU 2.4 */ UBool hasMoreChar32Than(int32_t start, int32_t length, int32_t number) const; /** * Determine if this string is empty. * @return TRUE if this string contains 0 characters, FALSE otherwise. * @stable ICU 2.0 */ inline UBool isEmpty(void) const; /** * Return the capacity of the internal buffer of the UnicodeString object. * This is useful together with the getBuffer functions. * See there for details. * * @return the number of UChars available in the internal buffer * @see getBuffer * @stable ICU 2.0 */ inline int32_t getCapacity(void) const; /* Other operations */ /** * Generate a hash code for this object. * @return The hash code of this UnicodeString. * @stable ICU 2.0 */ inline int32_t hashCode(void) const; /** * Determine if this object contains a valid string. * A bogus string has no value. It is different from an empty string, * although in both cases isEmpty() returns TRUE and length() returns 0. * setToBogus() and isBogus() can be used to indicate that no string value is available. * For a bogus string, getBuffer() and getTerminatedBuffer() return NULL, and * length() returns 0. * * @return TRUE if the string is valid, FALSE otherwise * @see setToBogus() * @stable ICU 2.0 */ inline UBool isBogus(void) const; //======================================== // Write operations //======================================== /* Assignment operations */ /** * Assignment operator. Replace the characters in this UnicodeString * with the characters from srcText. * @param srcText The text containing the characters to replace * @return a reference to this * @stable ICU 2.0 */ UnicodeString &operator=(const UnicodeString &srcText); /** * Almost the same as the assignment operator. * Replace the characters in this UnicodeString * with the characters from srcText. * * This function works the same for all strings except for ones that * are readonly aliases. * Starting with ICU 2.4, the assignment operator and the copy constructor * allocate a new buffer and copy the buffer contents even for readonly aliases. * This function implements the old, more efficient but less safe behavior * of making this string also a readonly alias to the same buffer. * The fastCopyFrom function must be used only if it is known that the lifetime of * this UnicodeString is at least as long as the lifetime of the aliased buffer * including its contents, for example for strings from resource bundles * or aliases to string contents. * * @param src The text containing the characters to replace. * @return a reference to this * @stable ICU 2.4 */ UnicodeString &fastCopyFrom(const UnicodeString &src); /** * Assignment operator. Replace the characters in this UnicodeString * with the code unit ch. * @param ch the code unit to replace * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& operator= (UChar ch); /** * Assignment operator. Replace the characters in this UnicodeString * with the code point ch. * @param ch the code point to replace * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& operator= (UChar32 ch); /** * Set the text in the UnicodeString object to the characters * in srcText in the range * [srcStart, srcText.length()). * srcText is not modified. * @param srcText the source for the new characters * @param srcStart the offset into srcText where new characters * will be obtained * @return a reference to this * @stable ICU 2.2 */ inline UnicodeString& setTo(const UnicodeString& srcText, int32_t srcStart); /** * Set the text in the UnicodeString object to the characters * in srcText in the range * [srcStart, srcStart + srcLength). * srcText is not modified. * @param srcText the source for the new characters * @param srcStart the offset into srcText where new characters * will be obtained * @param srcLength the number of characters in srcText in the * replace string. * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& setTo(const UnicodeString& srcText, int32_t srcStart, int32_t srcLength); /** * Set the text in the UnicodeString object to the characters in * srcText. * srcText is not modified. * @param srcText the source for the new characters * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& setTo(const UnicodeString& srcText); /** * Set the characters in the UnicodeString object to the characters * in srcChars. srcChars is not modified. * @param srcChars the source for the new characters * @param srcLength the number of Unicode characters in srcChars. * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& setTo(const UChar *srcChars, int32_t srcLength); /** * Set the characters in the UnicodeString object to the code unit * srcChar. * @param srcChar the code unit which becomes the UnicodeString's character * content * @return a reference to this * @stable ICU 2.0 */ UnicodeString& setTo(UChar srcChar); /** * Set the characters in the UnicodeString object to the code point * srcChar. * @param srcChar the code point which becomes the UnicodeString's character * content * @return a reference to this * @stable ICU 2.0 */ UnicodeString& setTo(UChar32 srcChar); /** * Aliasing setTo() function, analogous to the readonly-aliasing UChar* constructor. * The text will be used for the UnicodeString object, but * it will not be released when the UnicodeString is destroyed. * This has copy-on-write semantics: * When the string is modified, then the buffer is first copied into * newly allocated memory. * The aliased buffer is never modified. * In an assignment to another UnicodeString, the text will be aliased again, * so that both strings then alias the same readonly-text. * * @param isTerminated specifies if text is NUL-terminated. * This must be true if textLength==-1. * @param text The characters to alias for the UnicodeString. * @param textLength The number of Unicode characters in text to alias. * If -1, then this constructor will determine the length * by calling u_strlen(). * @return a reference to this * @stable ICU 2.0 */ UnicodeString &setTo(UBool isTerminated, const UChar *text, int32_t textLength); /** * Aliasing setTo() function, analogous to the writable-aliasing UChar* constructor. * The text will be used for the UnicodeString object, but * it will not be released when the UnicodeString is destroyed. * This has write-through semantics: * For as long as the capacity of the buffer is sufficient, write operations * will directly affect the buffer. When more capacity is necessary, then * a new buffer will be allocated and the contents copied as with regularly * constructed strings. * In an assignment to another UnicodeString, the buffer will be copied. * The extract(UChar *dst) function detects whether the dst pointer is the same * as the string buffer itself and will in this case not copy the contents. * * @param buffer The characters to alias for the UnicodeString. * @param buffLength The number of Unicode characters in buffer to alias. * @param buffCapacity The size of buffer in UChars. * @return a reference to this * @stable ICU 2.0 */ UnicodeString &setTo(UChar *buffer, int32_t buffLength, int32_t buffCapacity); /** * Make this UnicodeString object invalid. * The string will test TRUE with isBogus(). * * A bogus string has no value. It is different from an empty string. * It can be used to indicate that no string value is available. * getBuffer() and getTerminatedBuffer() return NULL, and * length() returns 0. * * This utility function is used throughout the UnicodeString * implementation to indicate that a UnicodeString operation failed, * and may be used in other functions, * especially but not exclusively when such functions do not * take a UErrorCode for simplicity. * * The following methods, and no others, will clear a string object's bogus flag: * - remove() * - remove(0, INT32_MAX) * - truncate(0) * - operator=() (assignment operator) * - setTo(...) * * The simplest ways to turn a bogus string into an empty one * is to use the remove() function. * Examples for other functions that are equivalent to "set to empty string": * \code * if(s.isBogus()) { * s.remove(); // set to an empty string (remove all), or * s.remove(0, INT32_MAX); // set to an empty string (remove all), or * s.truncate(0); // set to an empty string (complete truncation), or * s=UnicodeString(); // assign an empty string, or * s.setTo((UChar32)-1); // set to a pseudo code point that is out of range, or * static const UChar nul=0; * s.setTo(&nul, 0); // set to an empty C Unicode string * } * \endcode * * @see isBogus() * @stable ICU 2.0 */ void setToBogus(); /** * Set the character at the specified offset to the specified character. * @param offset A valid offset into the text of the character to set * @param ch The new character * @return A reference to this * @stable ICU 2.0 */ UnicodeString& setCharAt(int32_t offset, UChar ch); /* Append operations */ /** * Append operator. Append the code unit ch to the UnicodeString * object. * @param ch the code unit to be appended * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& operator+= (UChar ch); /** * Append operator. Append the code point ch to the UnicodeString * object. * @param ch the code point to be appended * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& operator+= (UChar32 ch); /** * Append operator. Append the characters in srcText to the * UnicodeString object at offset start. srcText is * not modified. * @param srcText the source for the new characters * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& operator+= (const UnicodeString& srcText); /** * Append the characters * in srcText in the range * [srcStart, srcStart + srcLength) to the * UnicodeString object at offset start. srcText * is not modified. * @param srcText the source for the new characters * @param srcStart the offset into srcText where new characters * will be obtained * @param srcLength the number of characters in srcText in * the append string * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& append(const UnicodeString& srcText, int32_t srcStart, int32_t srcLength); /** * Append the characters in srcText to the UnicodeString object at * offset start. srcText is not modified. * @param srcText the source for the new characters * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& append(const UnicodeString& srcText); /** * Append the characters in srcChars in the range * [srcStart, srcStart + srcLength) to the UnicodeString * object at offset * start. srcChars is not modified. * @param srcChars the source for the new characters * @param srcStart the offset into srcChars where new characters * will be obtained * @param srcLength the number of characters in srcChars in * the append string * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& append(const UChar *srcChars, int32_t srcStart, int32_t srcLength); /** * Append the characters in srcChars to the UnicodeString object * at offset start. srcChars is not modified. * @param srcChars the source for the new characters * @param srcLength the number of Unicode characters in srcChars * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& append(const UChar *srcChars, int32_t srcLength); /** * Append the code unit srcChar to the UnicodeString object. * @param srcChar the code unit to append * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& append(UChar srcChar); /** * Append the code point srcChar to the UnicodeString object. * @param srcChar the code point to append * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& append(UChar32 srcChar); /* Insert operations */ /** * Insert the characters in srcText in the range * [srcStart, srcStart + srcLength) into the UnicodeString * object at offset start. srcText is not modified. * @param start the offset where the insertion begins * @param srcText the source for the new characters * @param srcStart the offset into srcText where new characters * will be obtained * @param srcLength the number of characters in srcText in * the insert string * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& insert(int32_t start, const UnicodeString& srcText, int32_t srcStart, int32_t srcLength); /** * Insert the characters in srcText into the UnicodeString object * at offset start. srcText is not modified. * @param start the offset where the insertion begins * @param srcText the source for the new characters * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& insert(int32_t start, const UnicodeString& srcText); /** * Insert the characters in srcChars in the range * [srcStart, srcStart + srcLength) into the UnicodeString * object at offset start. srcChars is not modified. * @param start the offset at which the insertion begins * @param srcChars the source for the new characters * @param srcStart the offset into srcChars where new characters * will be obtained * @param srcLength the number of characters in srcChars * in the insert string * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& insert(int32_t start, const UChar *srcChars, int32_t srcStart, int32_t srcLength); /** * Insert the characters in srcChars into the UnicodeString object * at offset start. srcChars is not modified. * @param start the offset where the insertion begins * @param srcChars the source for the new characters * @param srcLength the number of Unicode characters in srcChars. * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& insert(int32_t start, const UChar *srcChars, int32_t srcLength); /** * Insert the code unit srcChar into the UnicodeString object at * offset start. * @param start the offset at which the insertion occurs * @param srcChar the code unit to insert * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& insert(int32_t start, UChar srcChar); /** * Insert the code point srcChar into the UnicodeString object at * offset start. * @param start the offset at which the insertion occurs * @param srcChar the code point to insert * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& insert(int32_t start, UChar32 srcChar); /* Replace operations */ /** * Replace the characters in the range * [start, start + length) with the characters in * srcText in the range * [srcStart, srcStart + srcLength). * srcText is not modified. * @param start the offset at which the replace operation begins * @param length the number of characters to replace. The character at * start + length is not modified. * @param srcText the source for the new characters * @param srcStart the offset into srcText where new characters * will be obtained * @param srcLength the number of characters in srcText in * the replace string * @return a reference to this * @stable ICU 2.0 */ UnicodeString& replace(int32_t start, int32_t length, const UnicodeString& srcText, int32_t srcStart, int32_t srcLength); /** * Replace the characters in the range * [start, start + length) * with the characters in srcText. srcText is * not modified. * @param start the offset at which the replace operation begins * @param length the number of characters to replace. The character at * start + length is not modified. * @param srcText the source for the new characters * @return a reference to this * @stable ICU 2.0 */ UnicodeString& replace(int32_t start, int32_t length, const UnicodeString& srcText); /** * Replace the characters in the range * [start, start + length) with the characters in * srcChars in the range * [srcStart, srcStart + srcLength). srcChars * is not modified. * @param start the offset at which the replace operation begins * @param length the number of characters to replace. The character at * start + length is not modified. * @param srcChars the source for the new characters * @param srcStart the offset into srcChars where new characters * will be obtained * @param srcLength the number of characters in srcChars * in the replace string * @return a reference to this * @stable ICU 2.0 */ UnicodeString& replace(int32_t start, int32_t length, const UChar *srcChars, int32_t srcStart, int32_t srcLength); /** * Replace the characters in the range * [start, start + length) with the characters in * srcChars. srcChars is not modified. * @param start the offset at which the replace operation begins * @param length number of characters to replace. The character at * start + length is not modified. * @param srcChars the source for the new characters * @param srcLength the number of Unicode characters in srcChars * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& replace(int32_t start, int32_t length, const UChar *srcChars, int32_t srcLength); /** * Replace the characters in the range * [start, start + length) with the code unit * srcChar. * @param start the offset at which the replace operation begins * @param length the number of characters to replace. The character at * start + length is not modified. * @param srcChar the new code unit * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& replace(int32_t start, int32_t length, UChar srcChar); /** * Replace the characters in the range * [start, start + length) with the code point * srcChar. * @param start the offset at which the replace operation begins * @param length the number of characters to replace. The character at * start + length is not modified. * @param srcChar the new code point * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& replace(int32_t start, int32_t length, UChar32 srcChar); /** * Replace the characters in the range [start, limit) * with the characters in srcText. srcText is not modified. * @param start the offset at which the replace operation begins * @param limit the offset immediately following the replace range * @param srcText the source for the new characters * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& replaceBetween(int32_t start, int32_t limit, const UnicodeString& srcText); /** * Replace the characters in the range [start, limit) * with the characters in srcText in the range * [srcStart, srcLimit). srcText is not modified. * @param start the offset at which the replace operation begins * @param limit the offset immediately following the replace range * @param srcText the source for the new characters * @param srcStart the offset into srcChars where new characters * will be obtained * @param srcLimit the offset immediately following the range to copy * in srcText * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& replaceBetween(int32_t start, int32_t limit, const UnicodeString& srcText, int32_t srcStart, int32_t srcLimit); /** * Replace a substring of this object with the given text. * @param start the beginning index, inclusive; 0 <= start * <= limit. * @param limit the ending index, exclusive; start <= limit * <= length(). * @param text the text to replace characters start * to limit - 1 * @stable ICU 2.0 */ virtual void handleReplaceBetween(int32_t start, int32_t limit, const UnicodeString& text); /** * Replaceable API * @return TRUE if it has MetaData * @stable ICU 2.4 */ virtual UBool hasMetaData() const; /** * Copy a substring of this object, retaining attribute (out-of-band) * information. This method is used to duplicate or reorder substrings. * The destination index must not overlap the source range. * * @param start the beginning index, inclusive; 0 <= start <= * limit. * @param limit the ending index, exclusive; start <= limit <= * length(). * @param dest the destination index. The characters from * start..limit-1 will be copied to dest. * Implementations of this method may assume that dest <= start || * dest >= limit. * @stable ICU 2.0 */ virtual void copy(int32_t start, int32_t limit, int32_t dest); /* Search and replace operations */ /** * Replace all occurrences of characters in oldText with the characters * in newText * @param oldText the text containing the search text * @param newText the text containing the replacement text * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& findAndReplace(const UnicodeString& oldText, const UnicodeString& newText); /** * Replace all occurrences of characters in oldText with characters * in newText * in the range [start, start + length). * @param start the start of the range in which replace will performed * @param length the length of the range in which replace will be performed * @param oldText the text containing the search text * @param newText the text containing the replacement text * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& findAndReplace(int32_t start, int32_t length, const UnicodeString& oldText, const UnicodeString& newText); /** * Replace all occurrences of characters in oldText in the range * [oldStart, oldStart + oldLength) with the characters * in newText in the range * [newStart, newStart + newLength) * in the range [start, start + length). * @param start the start of the range in which replace will performed * @param length the length of the range in which replace will be performed * @param oldText the text containing the search text * @param oldStart the start of the search range in oldText * @param oldLength the length of the search range in oldText * @param newText the text containing the replacement text * @param newStart the start of the replacement range in newText * @param newLength the length of the replacement range in newText * @return a reference to this * @stable ICU 2.0 */ UnicodeString& findAndReplace(int32_t start, int32_t length, const UnicodeString& oldText, int32_t oldStart, int32_t oldLength, const UnicodeString& newText, int32_t newStart, int32_t newLength); /* Remove operations */ /** * Remove all characters from the UnicodeString object. * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& remove(void); /** * Remove the characters in the range * [start, start + length) from the UnicodeString object. * @param start the offset of the first character to remove * @param length the number of characters to remove * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& remove(int32_t start, int32_t length = (int32_t)INT32_MAX); /** * Remove the characters in the range * [start, limit) from the UnicodeString object. * @param start the offset of the first character to remove * @param limit the offset immediately following the range to remove * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& removeBetween(int32_t start, int32_t limit = (int32_t)INT32_MAX); /** * Retain only the characters in the range * [start, limit) from the UnicodeString object. * Removes characters before start and at and after limit. * @param start the offset of the first character to retain * @param limit the offset immediately following the range to retain * @return a reference to this * @stable ICU 4.4 */ inline UnicodeString &retainBetween(int32_t start, int32_t limit = INT32_MAX); /* Length operations */ /** * Pad the start of this UnicodeString with the character padChar. * If the length of this UnicodeString is less than targetLength, * length() - targetLength copies of padChar will be added to the * beginning of this UnicodeString. * @param targetLength the desired length of the string * @param padChar the character to use for padding. Defaults to * space (U+0020) * @return TRUE if the text was padded, FALSE otherwise. * @stable ICU 2.0 */ UBool padLeading(int32_t targetLength, UChar padChar = 0x0020); /** * Pad the end of this UnicodeString with the character padChar. * If the length of this UnicodeString is less than targetLength, * length() - targetLength copies of padChar will be added to the * end of this UnicodeString. * @param targetLength the desired length of the string * @param padChar the character to use for padding. Defaults to * space (U+0020) * @return TRUE if the text was padded, FALSE otherwise. * @stable ICU 2.0 */ UBool padTrailing(int32_t targetLength, UChar padChar = 0x0020); /** * Truncate this UnicodeString to the targetLength. * @param targetLength the desired length of this UnicodeString. * @return TRUE if the text was truncated, FALSE otherwise * @stable ICU 2.0 */ inline UBool truncate(int32_t targetLength); /** * Trims leading and trailing whitespace from this UnicodeString. * @return a reference to this * @stable ICU 2.0 */ UnicodeString& trim(void); /* Miscellaneous operations */ /** * Reverse this UnicodeString in place. * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& reverse(void); /** * Reverse the range [start, start + length) in * this UnicodeString. * @param start the start of the range to reverse * @param length the number of characters to to reverse * @return a reference to this * @stable ICU 2.0 */ inline UnicodeString& reverse(int32_t start, int32_t length); /** * Convert the characters in this to UPPER CASE following the conventions of * the default locale. * @return A reference to this. * @stable ICU 2.0 */ UnicodeString& toUpper(void); /** * Convert the characters in this to UPPER CASE following the conventions of * a specific locale. * @param locale The locale containing the conventions to use. * @return A reference to this. * @stable ICU 2.0 */ UnicodeString& toUpper(const Locale& locale); /** * Convert the characters in this to lower case following the conventions of * the default locale. * @return A reference to this. * @stable ICU 2.0 */ UnicodeString& toLower(void); /** * Convert the characters in this to lower case following the conventions of * a specific locale. * @param locale The locale containing the conventions to use. * @return A reference to this. * @stable ICU 2.0 */ UnicodeString& toLower(const Locale& locale); #if !UCONFIG_NO_BREAK_ITERATION /** * Titlecase this string, convenience function using the default locale. * * Casing is locale-dependent and context-sensitive. * Titlecasing uses a break iterator to find the first characters of words * that are to be titlecased. It titlecases those characters and lowercases * all others. * * The titlecase break iterator can be provided to customize for arbitrary * styles, using rules and dictionaries beyond the standard iterators. * It may be more efficient to always provide an iterator to avoid * opening and closing one for each string. * The standard titlecase iterator for the root locale implements the * algorithm of Unicode TR 21. * * This function uses only the setText(), first() and next() methods of the * provided break iterator. * * @param titleIter A break iterator to find the first characters of words * that are to be titlecased. * If none is provided (0), then a standard titlecase * break iterator is opened. * Otherwise the provided iterator is set to the string's text. * @return A reference to this. * @stable ICU 2.1 */ UnicodeString &toTitle(BreakIterator *titleIter); /** * Titlecase this string. * * Casing is locale-dependent and context-sensitive. * Titlecasing uses a break iterator to find the first characters of words * that are to be titlecased. It titlecases those characters and lowercases * all others. * * The titlecase break iterator can be provided to customize for arbitrary * styles, using rules and dictionaries beyond the standard iterators. * It may be more efficient to always provide an iterator to avoid * opening and closing one for each string. * The standard titlecase iterator for the root locale implements the * algorithm of Unicode TR 21. * * This function uses only the setText(), first() and next() methods of the * provided break iterator. * * @param titleIter A break iterator to find the first characters of words * that are to be titlecased. * If none is provided (0), then a standard titlecase * break iterator is opened. * Otherwise the provided iterator is set to the string's text. * @param locale The locale to consider. * @return A reference to this. * @stable ICU 2.1 */ UnicodeString &toTitle(BreakIterator *titleIter, const Locale &locale); /** * Titlecase this string, with options. * * Casing is locale-dependent and context-sensitive. * Titlecasing uses a break iterator to find the first characters of words * that are to be titlecased. It titlecases those characters and lowercases * all others. (This can be modified with options.) * * The titlecase break iterator can be provided to customize for arbitrary * styles, using rules and dictionaries beyond the standard iterators. * It may be more efficient to always provide an iterator to avoid * opening and closing one for each string. * The standard titlecase iterator for the root locale implements the * algorithm of Unicode TR 21. * * This function uses only the setText(), first() and next() methods of the * provided break iterator. * * @param titleIter A break iterator to find the first characters of words * that are to be titlecased. * If none is provided (0), then a standard titlecase * break iterator is opened. * Otherwise the provided iterator is set to the string's text. * @param locale The locale to consider. * @param options Options bit set, see ucasemap_open(). * @return A reference to this. * @see U_TITLECASE_NO_LOWERCASE * @see U_TITLECASE_NO_BREAK_ADJUSTMENT * @see ucasemap_open * @stable ICU 3.8 */ UnicodeString &toTitle(BreakIterator *titleIter, const Locale &locale, uint32_t options); #endif /** * Case-fold the characters in this string. * Case-folding is locale-independent and not context-sensitive, * but there is an option for whether to include or exclude mappings for dotted I * and dotless i that are marked with 'I' in CaseFolding.txt. * The result may be longer or shorter than the original. * * @param options Either U_FOLD_CASE_DEFAULT or U_FOLD_CASE_EXCLUDE_SPECIAL_I * @return A reference to this. * @stable ICU 2.0 */ UnicodeString &foldCase(uint32_t options=0 /*U_FOLD_CASE_DEFAULT*/); //======================================== // Access to the internal buffer //======================================== /** * Get a read/write pointer to the internal buffer. * The buffer is guaranteed to be large enough for at least minCapacity UChars, * writable, and is still owned by the UnicodeString object. * Calls to getBuffer(minCapacity) must not be nested, and * must be matched with calls to releaseBuffer(newLength). * If the string buffer was read-only or shared, * then it will be reallocated and copied. * * An attempted nested call will return 0, and will not further modify the * state of the UnicodeString object. * It also returns 0 if the string is bogus. * * The actual capacity of the string buffer may be larger than minCapacity. * getCapacity() returns the actual capacity. * For many operations, the full capacity should be used to avoid reallocations. * * While the buffer is "open" between getBuffer(minCapacity) * and releaseBuffer(newLength), the following applies: * - The string length is set to 0. * - Any read API call on the UnicodeString object will behave like on a 0-length string. * - Any write API call on the UnicodeString object is disallowed and will have no effect. * - You can read from and write to the returned buffer. * - The previous string contents will still be in the buffer; * if you want to use it, then you need to call length() before getBuffer(minCapacity). * If the length() was greater than minCapacity, then any contents after minCapacity * may be lost. * The buffer contents is not NUL-terminated by getBuffer(). * If length()(s.length(). * (See getTerminatedBuffer().) * * The buffer may reside in read-only memory. Its contents must not * be modified. * * @return a read-only pointer to the internal string buffer, * or 0 if the string is empty or bogus * * @see getBuffer(int32_t minCapacity) * @see getTerminatedBuffer() * @stable ICU 2.0 */ inline const UChar *getBuffer() const; /** * Get a read-only pointer to the internal buffer, * making sure that it is NUL-terminated. * This can be called at any time on a valid UnicodeString. * * It returns 0 if the string is bogus, or * during an "open" getBuffer(minCapacity), or if the buffer cannot * be NUL-terminated (because memory allocation failed). * * It can be called as many times as desired. * The pointer that it returns will remain valid until the UnicodeString object is modified, * at which time the pointer is semantically invalidated and must not be used any more. * * The capacity of the buffer can be determined with getCapacity(). * The part after length()+1 may or may not be initialized and valid, * depending on the history of the UnicodeString object. * * The buffer contents is guaranteed to be NUL-terminated. * getTerminatedBuffer() may reallocate the buffer if a terminating NUL * is written. * For this reason, this function is not const, unlike getBuffer(). * Note that a UnicodeString may also contain NUL characters as part of its contents. * * The buffer may reside in read-only memory. Its contents must not * be modified. * * @return a read-only pointer to the internal string buffer, * or 0 if the string is empty or bogus * * @see getBuffer(int32_t minCapacity) * @see getBuffer() * @stable ICU 2.2 */ inline const UChar *getTerminatedBuffer(); //======================================== // Constructors //======================================== /** Construct an empty UnicodeString. * @stable ICU 2.0 */ UnicodeString(); /** * Construct a UnicodeString with capacity to hold capacity UChars * @param capacity the number of UChars this UnicodeString should hold * before a resize is necessary; if count is greater than 0 and count * code points c take up more space than capacity, then capacity is adjusted * accordingly. * @param c is used to initially fill the string * @param count specifies how many code points c are to be written in the * string * @stable ICU 2.0 */ UnicodeString(int32_t capacity, UChar32 c, int32_t count); /** * Single UChar (code unit) constructor. * @param ch the character to place in the UnicodeString * @stable ICU 2.0 */ UnicodeString(UChar ch); /** * Single UChar32 (code point) constructor. * @param ch the character to place in the UnicodeString * @stable ICU 2.0 */ UnicodeString(UChar32 ch); /** * UChar* constructor. * @param text The characters to place in the UnicodeString. text * must be NULL (U+0000) terminated. * @stable ICU 2.0 */ UnicodeString(const UChar *text); /** * UChar* constructor. * @param text The characters to place in the UnicodeString. * @param textLength The number of Unicode characters in text * to copy. * @stable ICU 2.0 */ UnicodeString(const UChar *text, int32_t textLength); /** * Readonly-aliasing UChar* constructor. * The text will be used for the UnicodeString object, but * it will not be released when the UnicodeString is destroyed. * This has copy-on-write semantics: * When the string is modified, then the buffer is first copied into * newly allocated memory. * The aliased buffer is never modified. * In an assignment to another UnicodeString, the text will be aliased again, * so that both strings then alias the same readonly-text. * * @param isTerminated specifies if text is NUL-terminated. * This must be true if textLength==-1. * @param text The characters to alias for the UnicodeString. * @param textLength The number of Unicode characters in text to alias. * If -1, then this constructor will determine the length * by calling u_strlen(). * @stable ICU 2.0 */ UnicodeString(UBool isTerminated, const UChar *text, int32_t textLength); /** * Writable-aliasing UChar* constructor. * The text will be used for the UnicodeString object, but * it will not be released when the UnicodeString is destroyed. * This has write-through semantics: * For as long as the capacity of the buffer is sufficient, write operations * will directly affect the buffer. When more capacity is necessary, then * a new buffer will be allocated and the contents copied as with regularly * constructed strings. * In an assignment to another UnicodeString, the buffer will be copied. * The extract(UChar *dst) function detects whether the dst pointer is the same * as the string buffer itself and will in this case not copy the contents. * * @param buffer The characters to alias for the UnicodeString. * @param buffLength The number of Unicode characters in buffer to alias. * @param buffCapacity The size of buffer in UChars. * @stable ICU 2.0 */ UnicodeString(UChar *buffer, int32_t buffLength, int32_t buffCapacity); #if U_CHARSET_IS_UTF8 || !UCONFIG_NO_CONVERSION /** * char* constructor. * @param codepageData an array of bytes, null-terminated, * in the platform's default codepage. * @stable ICU 2.0 */ UnicodeString(const char *codepageData); /** * char* constructor. * @param codepageData an array of bytes in the platform's default codepage. * @param dataLength The number of bytes in codepageData. * @stable ICU 2.0 */ UnicodeString(const char *codepageData, int32_t dataLength); #endif #if !UCONFIG_NO_CONVERSION /** * char* constructor. * @param codepageData an array of bytes, null-terminated * @param codepage the encoding of codepageData. The special * value 0 for codepage indicates that the text is in the * platform's default codepage. * * If codepage is an empty string (""), * then a simple conversion is performed on the codepage-invariant * subset ("invariant characters") of the platform encoding. See utypes.h. * Recommendation: For invariant-character strings use the constructor * UnicodeString(const char *src, int32_t length, enum EInvariant inv) * because it avoids object code dependencies of UnicodeString on * the conversion code. * * @stable ICU 2.0 */ UnicodeString(const char *codepageData, const char *codepage); /** * char* constructor. * @param codepageData an array of bytes. * @param dataLength The number of bytes in codepageData. * @param codepage the encoding of codepageData. The special * value 0 for codepage indicates that the text is in the * platform's default codepage. * If codepage is an empty string (""), * then a simple conversion is performed on the codepage-invariant * subset ("invariant characters") of the platform encoding. See utypes.h. * Recommendation: For invariant-character strings use the constructor * UnicodeString(const char *src, int32_t length, enum EInvariant inv) * because it avoids object code dependencies of UnicodeString on * the conversion code. * * @stable ICU 2.0 */ UnicodeString(const char *codepageData, int32_t dataLength, const char *codepage); /** * char * / UConverter constructor. * This constructor uses an existing UConverter object to * convert the codepage string to Unicode and construct a UnicodeString * from that. * * The converter is reset at first. * If the error code indicates a failure before this constructor is called, * or if an error occurs during conversion or construction, * then the string will be bogus. * * This function avoids the overhead of opening and closing a converter if * multiple strings are constructed. * * @param src input codepage string * @param srcLength length of the input string, can be -1 for NUL-terminated strings * @param cnv converter object (ucnv_resetToUnicode() will be called), * can be NULL for the default converter * @param errorCode normal ICU error code * @stable ICU 2.0 */ UnicodeString( const char *src, int32_t srcLength, UConverter *cnv, UErrorCode &errorCode); #endif /** * Constructs a Unicode string from an invariant-character char * string. * About invariant characters see utypes.h. * This constructor has no runtime dependency on conversion code and is * therefore recommended over ones taking a charset name string * (where the empty string "" indicates invariant-character conversion). * * Use the macro US_INV as the third, signature-distinguishing parameter. * * For example: * \code * void fn(const char *s) { * UnicodeString ustr(s, -1, US_INV); * // use ustr ... * } * \endcode * * @param src String using only invariant characters. * @param length Length of src, or -1 if NUL-terminated. * @param inv Signature-distinguishing paramater, use US_INV. * * @see US_INV * @stable ICU 3.2 */ UnicodeString(const char *src, int32_t length, enum EInvariant inv); /** * Copy constructor. * @param that The UnicodeString object to copy. * @stable ICU 2.0 */ UnicodeString(const UnicodeString& that); /** * 'Substring' constructor from tail of source string. * @param src The UnicodeString object to copy. * @param srcStart The offset into src at which to start copying. * @stable ICU 2.2 */ UnicodeString(const UnicodeString& src, int32_t srcStart); /** * 'Substring' constructor from subrange of source string. * @param src The UnicodeString object to copy. * @param srcStart The offset into src at which to start copying. * @param srcLength The number of characters from src to copy. * @stable ICU 2.2 */ UnicodeString(const UnicodeString& src, int32_t srcStart, int32_t srcLength); /** * Clone this object, an instance of a subclass of Replaceable. * Clones can be used concurrently in multiple threads. * If a subclass does not implement clone(), or if an error occurs, * then NULL is returned. * The clone functions in all subclasses return a pointer to a Replaceable * because some compilers do not support covariant (same-as-this) * return types; cast to the appropriate subclass if necessary. * The caller must delete the clone. * * @return a clone of this object * * @see Replaceable::clone * @see getDynamicClassID * @stable ICU 2.6 */ virtual Replaceable *clone() const; /** Destructor. * @stable ICU 2.0 */ virtual ~UnicodeString(); /** * Create a UnicodeString from a UTF-8 string. * Illegal input is replaced with U+FFFD. Otherwise, errors result in a bogus string. * Calls u_strFromUTF8WithSub(). * * @param utf8 UTF-8 input string. * Note that a StringPiece can be implicitly constructed * from a std::string or a NUL-terminated const char * string. * @return A UnicodeString with equivalent UTF-16 contents. * @see toUTF8 * @see toUTF8String * @stable ICU 4.2 */ static UnicodeString fromUTF8(const StringPiece &utf8); /** * Create a UnicodeString from a UTF-32 string. * Illegal input is replaced with U+FFFD. Otherwise, errors result in a bogus string. * Calls u_strFromUTF32WithSub(). * * @param utf32 UTF-32 input string. Must not be NULL. * @param length Length of the input string, or -1 if NUL-terminated. * @return A UnicodeString with equivalent UTF-16 contents. * @see toUTF32 * @stable ICU 4.2 */ static UnicodeString fromUTF32(const UChar32 *utf32, int32_t length); /* Miscellaneous operations */ /** * Unescape a string of characters and return a string containing * the result. The following escape sequences are recognized: * * \\uhhhh 4 hex digits; h in [0-9A-Fa-f] * \\Uhhhhhhhh 8 hex digits * \\xhh 1-2 hex digits * \\ooo 1-3 octal digits; o in [0-7] * \\cX control-X; X is masked with 0x1F * * as well as the standard ANSI C escapes: * * \\a => U+0007, \\b => U+0008, \\t => U+0009, \\n => U+000A, * \\v => U+000B, \\f => U+000C, \\r => U+000D, \\e => U+001B, * \\" => U+0022, \\' => U+0027, \\? => U+003F, \\\\ => U+005C * * Anything else following a backslash is generically escaped. For * example, "[a\\-z]" returns "[a-z]". * * If an escape sequence is ill-formed, this method returns an empty * string. An example of an ill-formed sequence is "\\u" followed by * fewer than 4 hex digits. * * This function is similar to u_unescape() but not identical to it. * The latter takes a source char*, so it does escape recognition * and also invariant conversion. * * @return a string with backslash escapes interpreted, or an * empty string on error. * @see UnicodeString#unescapeAt() * @see u_unescape() * @see u_unescapeAt() * @stable ICU 2.0 */ UnicodeString unescape() const; /** * Unescape a single escape sequence and return the represented * character. See unescape() for a listing of the recognized escape * sequences. The character at offset-1 is assumed (without * checking) to be a backslash. If the escape sequence is * ill-formed, or the offset is out of range, (UChar32)0xFFFFFFFF is * returned. * * @param offset an input output parameter. On input, it is the * offset into this string where the escape sequence is located, * after the initial backslash. On output, it is advanced after the * last character parsed. On error, it is not advanced at all. * @return the character represented by the escape sequence at * offset, or (UChar32)0xFFFFFFFF on error. * @see UnicodeString#unescape() * @see u_unescape() * @see u_unescapeAt() * @stable ICU 2.0 */ UChar32 unescapeAt(int32_t &offset) const; /** * ICU "poor man's RTTI", returns a UClassID for this class. * * @stable ICU 2.2 */ static UClassID U_EXPORT2 getStaticClassID(); /** * ICU "poor man's RTTI", returns a UClassID for the actual class. * * @stable ICU 2.2 */ virtual UClassID getDynamicClassID() const; //======================================== // Implementation methods //======================================== protected: /** * Implement Replaceable::getLength() (see jitterbug 1027). * @stable ICU 2.4 */ virtual int32_t getLength() const; /** * The change in Replaceable to use virtual getCharAt() allows * UnicodeString::charAt() to be inline again (see jitterbug 709). * @stable ICU 2.4 */ virtual UChar getCharAt(int32_t offset) const; /** * The change in Replaceable to use virtual getChar32At() allows * UnicodeString::char32At() to be inline again (see jitterbug 709). * @stable ICU 2.4 */ virtual UChar32 getChar32At(int32_t offset) const; private: // For char* constructors. Could be made public. UnicodeString &setToUTF8(const StringPiece &utf8); // For extract(char*). // We could make a toUTF8(target, capacity, errorCode) public but not // this version: New API will be cleaner if we make callers create substrings // rather than having start+length on every method, // and it should take a UErrorCode&. int32_t toUTF8(int32_t start, int32_t len, char *target, int32_t capacity) const; inline int8_t doCompare(int32_t start, int32_t length, const UnicodeString& srcText, int32_t srcStart, int32_t srcLength) const; int8_t doCompare(int32_t start, int32_t length, const UChar *srcChars, int32_t srcStart, int32_t srcLength) const; inline int8_t doCompareCodePointOrder(int32_t start, int32_t length, const UnicodeString& srcText, int32_t srcStart, int32_t srcLength) const; int8_t doCompareCodePointOrder(int32_t start, int32_t length, const UChar *srcChars, int32_t srcStart, int32_t srcLength) const; inline int8_t doCaseCompare(int32_t start, int32_t length, const UnicodeString &srcText, int32_t srcStart, int32_t srcLength, uint32_t options) const; int8_t doCaseCompare(int32_t start, int32_t length, const UChar *srcChars, int32_t srcStart, int32_t srcLength, uint32_t options) const; int32_t doIndexOf(UChar c, int32_t start, int32_t length) const; int32_t doIndexOf(UChar32 c, int32_t start, int32_t length) const; int32_t doLastIndexOf(UChar c, int32_t start, int32_t length) const; int32_t doLastIndexOf(UChar32 c, int32_t start, int32_t length) const; void doExtract(int32_t start, int32_t length, UChar *dst, int32_t dstStart) const; inline void doExtract(int32_t start, int32_t length, UnicodeString& target) const; inline UChar doCharAt(int32_t offset) const; UnicodeString& doReplace(int32_t start, int32_t length, const UnicodeString& srcText, int32_t srcStart, int32_t srcLength); UnicodeString& doReplace(int32_t start, int32_t length, const UChar *srcChars, int32_t srcStart, int32_t srcLength); UnicodeString& doReverse(int32_t start, int32_t length); // calculate hash code int32_t doHashCode(void) const; // get pointer to start of array // these do not check for kOpenGetBuffer, unlike the public getBuffer() function inline UChar* getArrayStart(void); inline const UChar* getArrayStart(void) const; // A UnicodeString object (not necessarily its current buffer) // is writable unless it isBogus() or it has an "open" getBuffer(minCapacity). inline UBool isWritable() const; // Is the current buffer writable? inline UBool isBufferWritable() const; // None of the following does releaseArray(). inline void setLength(int32_t len); // sets only fShortLength and fLength inline void setToEmpty(); // sets fFlags=kShortString inline void setArray(UChar *array, int32_t len, int32_t capacity); // does not set fFlags // allocate the array; result may be fStackBuffer // sets refCount to 1 if appropriate // sets fArray, fCapacity, and fFlags // returns boolean for success or failure UBool allocate(int32_t capacity); // release the array if owned void releaseArray(void); // turn a bogus string into an empty one void unBogus(); // implements assigment operator, copy constructor, and fastCopyFrom() UnicodeString ©From(const UnicodeString &src, UBool fastCopy=FALSE); // Pin start and limit to acceptable values. inline void pinIndex(int32_t& start) const; inline void pinIndices(int32_t& start, int32_t& length) const; #if !UCONFIG_NO_CONVERSION /* Internal extract() using UConverter. */ int32_t doExtract(int32_t start, int32_t length, char *dest, int32_t destCapacity, UConverter *cnv, UErrorCode &errorCode) const; /* * Real constructor for converting from codepage data. * It assumes that it is called with !fRefCounted. * * If codepage==0, then the default converter * is used for the platform encoding. * If codepage is an empty string (""), * then a simple conversion is performed on the codepage-invariant * subset ("invariant characters") of the platform encoding. See utypes.h. */ void doCodepageCreate(const char *codepageData, int32_t dataLength, const char *codepage); /* * Worker function for creating a UnicodeString from * a codepage string using a UConverter. */ void doCodepageCreate(const char *codepageData, int32_t dataLength, UConverter *converter, UErrorCode &status); #endif /* * This function is called when write access to the array * is necessary. * * We need to make a copy of the array if * the buffer is read-only, or * the buffer is refCounted (shared), and refCount>1, or * the buffer is too small. * * Return FALSE if memory could not be allocated. */ UBool cloneArrayIfNeeded(int32_t newCapacity = -1, int32_t growCapacity = -1, UBool doCopyArray = TRUE, int32_t **pBufferToDelete = 0, UBool forceClone = FALSE); // common function for case mappings UnicodeString & caseMap(BreakIterator *titleIter, const char *locale, uint32_t options, int32_t toWhichCase); // ref counting void addRef(void); int32_t removeRef(void); int32_t refCount(void) const; // constants enum { // Set the stack buffer size so that sizeof(UnicodeString) is a multiple of sizeof(pointer): // 32-bit pointers: 4+1+1+13*2 = 32 bytes // 64-bit pointers: 8+1+1+15*2 = 40 bytes US_STACKBUF_SIZE= sizeof(void *)==4 ? 13 : 15, // Size of stack buffer for small strings kInvalidUChar=0xffff, // invalid UChar index kGrowSize=128, // grow size for this buffer kInvalidHashCode=0, // invalid hash code kEmptyHashCode=1, // hash code for empty string // bit flag values for fFlags kIsBogus=1, // this string is bogus, i.e., not valid or NULL kUsingStackBuffer=2,// fArray==fStackBuffer kRefCounted=4, // there is a refCount field before the characters in fArray kBufferIsReadonly=8,// do not write to this buffer kOpenGetBuffer=16, // getBuffer(minCapacity) was called (is "open"), // and releaseBuffer(newLength) must be called // combined values for convenience kShortString=kUsingStackBuffer, kLongString=kRefCounted, kReadonlyAlias=kBufferIsReadonly, kWritableAlias=0 }; friend class StringThreadTest; union StackBufferOrFields; // forward declaration necessary before friend declaration friend union StackBufferOrFields; // make US_STACKBUF_SIZE visible inside fUnion /* * The following are all the class fields that are stored * in each UnicodeString object. * Note that UnicodeString has virtual functions, * therefore there is an implicit vtable pointer * as the first real field. * The fields should be aligned such that no padding is * necessary, mostly by having larger types first. * On 32-bit machines, the size should be 32 bytes, * on 64-bit machines (8-byte pointers), it should be 40 bytes. */ // (implicit) *vtable; int8_t fShortLength; // 0..127: length <0: real length is in fUnion.fFields.fLength uint8_t fFlags; // bit flags: see constants above union StackBufferOrFields { // fStackBuffer is used iff (fFlags&kUsingStackBuffer) // else fFields is used UChar fStackBuffer [US_STACKBUF_SIZE]; // buffer for small strings struct { uint16_t fPadding; // align the following field at 8B (32b pointers) or 12B (64b) int32_t fLength; // number of characters in fArray if >127; else undefined UChar *fArray; // the Unicode data (aligned at 12B (32b pointers) or 16B (64b)) int32_t fCapacity; // sizeof fArray } fFields; } fUnion; }; /** * Create a new UnicodeString with the concatenation of two others. * * @param s1 The first string to be copied to the new one. * @param s2 The second string to be copied to the new one, after s1. * @return UnicodeString(s1).append(s2) * @stable ICU 2.8 */ U_COMMON_API UnicodeString U_EXPORT2 operator+ (const UnicodeString &s1, const UnicodeString &s2); //======================================== // Inline members //======================================== //======================================== // Privates //======================================== inline void UnicodeString::pinIndex(int32_t& start) const { // pin index if(start < 0) { start = 0; } else if(start > length()) { start = length(); } } inline void UnicodeString::pinIndices(int32_t& start, int32_t& _length) const { // pin indices int32_t len = length(); if(start < 0) { start = 0; } else if(start > len) { start = len; } if(_length < 0) { _length = 0; } else if(_length > (len - start)) { _length = (len - start); } } inline UChar* UnicodeString::getArrayStart() { return (fFlags&kUsingStackBuffer) ? fUnion.fStackBuffer : fUnion.fFields.fArray; } inline const UChar* UnicodeString::getArrayStart() const { return (fFlags&kUsingStackBuffer) ? fUnion.fStackBuffer : fUnion.fFields.fArray; } //======================================== // Read-only implementation methods //======================================== inline int32_t UnicodeString::length() const { return fShortLength>=0 ? fShortLength : fUnion.fFields.fLength; } inline int32_t UnicodeString::getCapacity() const { return (fFlags&kUsingStackBuffer) ? US_STACKBUF_SIZE : fUnion.fFields.fCapacity; } inline int32_t UnicodeString::hashCode() const { return doHashCode(); } inline UBool UnicodeString::isBogus() const { return (UBool)(fFlags & kIsBogus); } inline UBool UnicodeString::isWritable() const { return (UBool)!(fFlags&(kOpenGetBuffer|kIsBogus)); } inline UBool UnicodeString::isBufferWritable() const { return (UBool)( !(fFlags&(kOpenGetBuffer|kIsBogus|kBufferIsReadonly)) && (!(fFlags&kRefCounted) || refCount()==1)); } inline const UChar * UnicodeString::getBuffer() const { if(fFlags&(kIsBogus|kOpenGetBuffer)) { return 0; } else if(fFlags&kUsingStackBuffer) { return fUnion.fStackBuffer; } else { return fUnion.fFields.fArray; } } //======================================== // Read-only alias methods //======================================== inline int8_t UnicodeString::doCompare(int32_t start, int32_t thisLength, const UnicodeString& srcText, int32_t srcStart, int32_t srcLength) const { if(srcText.isBogus()) { return (int8_t)!isBogus(); // 0 if both are bogus, 1 otherwise } else { srcText.pinIndices(srcStart, srcLength); return doCompare(start, thisLength, srcText.getArrayStart(), srcStart, srcLength); } } inline UBool UnicodeString::operator== (const UnicodeString& text) const { if(isBogus()) { return text.isBogus(); } else { int32_t len = length(), textLength = text.length(); return !text.isBogus() && len == textLength && doCompare(0, len, text, 0, textLength) == 0; } } inline UBool UnicodeString::operator!= (const UnicodeString& text) const { return (! operator==(text)); } inline UBool UnicodeString::operator> (const UnicodeString& text) const { return doCompare(0, length(), text, 0, text.length()) == 1; } inline UBool UnicodeString::operator< (const UnicodeString& text) const { return doCompare(0, length(), text, 0, text.length()) == -1; } inline UBool UnicodeString::operator>= (const UnicodeString& text) const { return doCompare(0, length(), text, 0, text.length()) != -1; } inline UBool UnicodeString::operator<= (const UnicodeString& text) const { return doCompare(0, length(), text, 0, text.length()) != 1; } inline int8_t UnicodeString::compare(const UnicodeString& text) const { return doCompare(0, length(), text, 0, text.length()); } inline int8_t UnicodeString::compare(int32_t start, int32_t _length, const UnicodeString& srcText) const { return doCompare(start, _length, srcText, 0, srcText.length()); } inline int8_t UnicodeString::compare(const UChar *srcChars, int32_t srcLength) const { return doCompare(0, length(), srcChars, 0, srcLength); } inline int8_t UnicodeString::compare(int32_t start, int32_t _length, const UnicodeString& srcText, int32_t srcStart, int32_t srcLength) const { return doCompare(start, _length, srcText, srcStart, srcLength); } inline int8_t UnicodeString::compare(int32_t start, int32_t _length, const UChar *srcChars) const { return doCompare(start, _length, srcChars, 0, _length); } inline int8_t UnicodeString::compare(int32_t start, int32_t _length, const UChar *srcChars, int32_t srcStart, int32_t srcLength) const { return doCompare(start, _length, srcChars, srcStart, srcLength); } inline int8_t UnicodeString::compareBetween(int32_t start, int32_t limit, const UnicodeString& srcText, int32_t srcStart, int32_t srcLimit) const { return doCompare(start, limit - start, srcText, srcStart, srcLimit - srcStart); } inline int8_t UnicodeString::doCompareCodePointOrder(int32_t start, int32_t thisLength, const UnicodeString& srcText, int32_t srcStart, int32_t srcLength) const { if(srcText.isBogus()) { return (int8_t)!isBogus(); // 0 if both are bogus, 1 otherwise } else { srcText.pinIndices(srcStart, srcLength); return doCompareCodePointOrder(start, thisLength, srcText.getArrayStart(), srcStart, srcLength); } } inline int8_t UnicodeString::compareCodePointOrder(const UnicodeString& text) const { return doCompareCodePointOrder(0, length(), text, 0, text.length()); } inline int8_t UnicodeString::compareCodePointOrder(int32_t start, int32_t _length, const UnicodeString& srcText) const { return doCompareCodePointOrder(start, _length, srcText, 0, srcText.length()); } inline int8_t UnicodeString::compareCodePointOrder(const UChar *srcChars, int32_t srcLength) const { return doCompareCodePointOrder(0, length(), srcChars, 0, srcLength); } inline int8_t UnicodeString::compareCodePointOrder(int32_t start, int32_t _length, const UnicodeString& srcText, int32_t srcStart, int32_t srcLength) const { return doCompareCodePointOrder(start, _length, srcText, srcStart, srcLength); } inline int8_t UnicodeString::compareCodePointOrder(int32_t start, int32_t _length, const UChar *srcChars) const { return doCompareCodePointOrder(start, _length, srcChars, 0, _length); } inline int8_t UnicodeString::compareCodePointOrder(int32_t start, int32_t _length, const UChar *srcChars, int32_t srcStart, int32_t srcLength) const { return doCompareCodePointOrder(start, _length, srcChars, srcStart, srcLength); } inline int8_t UnicodeString::compareCodePointOrderBetween(int32_t start, int32_t limit, const UnicodeString& srcText, int32_t srcStart, int32_t srcLimit) const { return doCompareCodePointOrder(start, limit - start, srcText, srcStart, srcLimit - srcStart); } inline int8_t UnicodeString::doCaseCompare(int32_t start, int32_t thisLength, const UnicodeString &srcText, int32_t srcStart, int32_t srcLength, uint32_t options) const { if(srcText.isBogus()) { return (int8_t)!isBogus(); // 0 if both are bogus, 1 otherwise } else { srcText.pinIndices(srcStart, srcLength); return doCaseCompare(start, thisLength, srcText.getArrayStart(), srcStart, srcLength, options); } } inline int8_t UnicodeString::caseCompare(const UnicodeString &text, uint32_t options) const { return doCaseCompare(0, length(), text, 0, text.length(), options); } inline int8_t UnicodeString::caseCompare(int32_t start, int32_t _length, const UnicodeString &srcText, uint32_t options) const { return doCaseCompare(start, _length, srcText, 0, srcText.length(), options); } inline int8_t UnicodeString::caseCompare(const UChar *srcChars, int32_t srcLength, uint32_t options) const { return doCaseCompare(0, length(), srcChars, 0, srcLength, options); } inline int8_t UnicodeString::caseCompare(int32_t start, int32_t _length, const UnicodeString &srcText, int32_t srcStart, int32_t srcLength, uint32_t options) const { return doCaseCompare(start, _length, srcText, srcStart, srcLength, options); } inline int8_t UnicodeString::caseCompare(int32_t start, int32_t _length, const UChar *srcChars, uint32_t options) const { return doCaseCompare(start, _length, srcChars, 0, _length, options); } inline int8_t UnicodeString::caseCompare(int32_t start, int32_t _length, const UChar *srcChars, int32_t srcStart, int32_t srcLength, uint32_t options) const { return doCaseCompare(start, _length, srcChars, srcStart, srcLength, options); } inline int8_t UnicodeString::caseCompareBetween(int32_t start, int32_t limit, const UnicodeString &srcText, int32_t srcStart, int32_t srcLimit, uint32_t options) const { return doCaseCompare(start, limit - start, srcText, srcStart, srcLimit - srcStart, options); } inline int32_t UnicodeString::indexOf(const UnicodeString& srcText, int32_t srcStart, int32_t srcLength, int32_t start, int32_t _length) const { if(!srcText.isBogus()) { srcText.pinIndices(srcStart, srcLength); if(srcLength > 0) { return indexOf(srcText.getArrayStart(), srcStart, srcLength, start, _length); } } return -1; } inline int32_t UnicodeString::indexOf(const UnicodeString& text) const { return indexOf(text, 0, text.length(), 0, length()); } inline int32_t UnicodeString::indexOf(const UnicodeString& text, int32_t start) const { pinIndex(start); return indexOf(text, 0, text.length(), start, length() - start); } inline int32_t UnicodeString::indexOf(const UnicodeString& text, int32_t start, int32_t _length) const { return indexOf(text, 0, text.length(), start, _length); } inline int32_t UnicodeString::indexOf(const UChar *srcChars, int32_t srcLength, int32_t start) const { pinIndex(start); return indexOf(srcChars, 0, srcLength, start, length() - start); } inline int32_t UnicodeString::indexOf(const UChar *srcChars, int32_t srcLength, int32_t start, int32_t _length) const { return indexOf(srcChars, 0, srcLength, start, _length); } inline int32_t UnicodeString::indexOf(UChar c, int32_t start, int32_t _length) const { return doIndexOf(c, start, _length); } inline int32_t UnicodeString::indexOf(UChar32 c, int32_t start, int32_t _length) const { return doIndexOf(c, start, _length); } inline int32_t UnicodeString::indexOf(UChar c) const { return doIndexOf(c, 0, length()); } inline int32_t UnicodeString::indexOf(UChar32 c) const { return indexOf(c, 0, length()); } inline int32_t UnicodeString::indexOf(UChar c, int32_t start) const { pinIndex(start); return doIndexOf(c, start, length() - start); } inline int32_t UnicodeString::indexOf(UChar32 c, int32_t start) const { pinIndex(start); return indexOf(c, start, length() - start); } inline int32_t UnicodeString::lastIndexOf(const UChar *srcChars, int32_t srcLength, int32_t start, int32_t _length) const { return lastIndexOf(srcChars, 0, srcLength, start, _length); } inline int32_t UnicodeString::lastIndexOf(const UChar *srcChars, int32_t srcLength, int32_t start) const { pinIndex(start); return lastIndexOf(srcChars, 0, srcLength, start, length() - start); } inline int32_t UnicodeString::lastIndexOf(const UnicodeString& srcText, int32_t srcStart, int32_t srcLength, int32_t start, int32_t _length) const { if(!srcText.isBogus()) { srcText.pinIndices(srcStart, srcLength); if(srcLength > 0) { return lastIndexOf(srcText.getArrayStart(), srcStart, srcLength, start, _length); } } return -1; } inline int32_t UnicodeString::lastIndexOf(const UnicodeString& text, int32_t start, int32_t _length) const { return lastIndexOf(text, 0, text.length(), start, _length); } inline int32_t UnicodeString::lastIndexOf(const UnicodeString& text, int32_t start) const { pinIndex(start); return lastIndexOf(text, 0, text.length(), start, length() - start); } inline int32_t UnicodeString::lastIndexOf(const UnicodeString& text) const { return lastIndexOf(text, 0, text.length(), 0, length()); } inline int32_t UnicodeString::lastIndexOf(UChar c, int32_t start, int32_t _length) const { return doLastIndexOf(c, start, _length); } inline int32_t UnicodeString::lastIndexOf(UChar32 c, int32_t start, int32_t _length) const { return doLastIndexOf(c, start, _length); } inline int32_t UnicodeString::lastIndexOf(UChar c) const { return doLastIndexOf(c, 0, length()); } inline int32_t UnicodeString::lastIndexOf(UChar32 c) const { return lastIndexOf(c, 0, length()); } inline int32_t UnicodeString::lastIndexOf(UChar c, int32_t start) const { pinIndex(start); return doLastIndexOf(c, start, length() - start); } inline int32_t UnicodeString::lastIndexOf(UChar32 c, int32_t start) const { pinIndex(start); return lastIndexOf(c, start, length() - start); } inline UBool UnicodeString::startsWith(const UnicodeString& text) const { return compare(0, text.length(), text, 0, text.length()) == 0; } inline UBool UnicodeString::startsWith(const UnicodeString& srcText, int32_t srcStart, int32_t srcLength) const { return doCompare(0, srcLength, srcText, srcStart, srcLength) == 0; } inline UBool UnicodeString::startsWith(const UChar *srcChars, int32_t srcLength) const { return doCompare(0, srcLength, srcChars, 0, srcLength) == 0; } inline UBool UnicodeString::startsWith(const UChar *srcChars, int32_t srcStart, int32_t srcLength) const { return doCompare(0, srcLength, srcChars, srcStart, srcLength) == 0;} inline UBool UnicodeString::endsWith(const UnicodeString& text) const { return doCompare(length() - text.length(), text.length(), text, 0, text.length()) == 0; } inline UBool UnicodeString::endsWith(const UnicodeString& srcText, int32_t srcStart, int32_t srcLength) const { srcText.pinIndices(srcStart, srcLength); return doCompare(length() - srcLength, srcLength, srcText, srcStart, srcLength) == 0; } inline UBool UnicodeString::endsWith(const UChar *srcChars, int32_t srcLength) const { if(srcLength < 0) { srcLength = u_strlen(srcChars); } return doCompare(length() - srcLength, srcLength, srcChars, 0, srcLength) == 0; } inline UBool UnicodeString::endsWith(const UChar *srcChars, int32_t srcStart, int32_t srcLength) const { if(srcLength < 0) { srcLength = u_strlen(srcChars + srcStart); } return doCompare(length() - srcLength, srcLength, srcChars, srcStart, srcLength) == 0; } //======================================== // replace //======================================== inline UnicodeString& UnicodeString::replace(int32_t start, int32_t _length, const UnicodeString& srcText) { return doReplace(start, _length, srcText, 0, srcText.length()); } inline UnicodeString& UnicodeString::replace(int32_t start, int32_t _length, const UnicodeString& srcText, int32_t srcStart, int32_t srcLength) { return doReplace(start, _length, srcText, srcStart, srcLength); } inline UnicodeString& UnicodeString::replace(int32_t start, int32_t _length, const UChar *srcChars, int32_t srcLength) { return doReplace(start, _length, srcChars, 0, srcLength); } inline UnicodeString& UnicodeString::replace(int32_t start, int32_t _length, const UChar *srcChars, int32_t srcStart, int32_t srcLength) { return doReplace(start, _length, srcChars, srcStart, srcLength); } inline UnicodeString& UnicodeString::replace(int32_t start, int32_t _length, UChar srcChar) { return doReplace(start, _length, &srcChar, 0, 1); } inline UnicodeString& UnicodeString::replace(int32_t start, int32_t _length, UChar32 srcChar) { UChar buffer[U16_MAX_LENGTH]; int32_t count = 0; UBool isError = FALSE; U16_APPEND(buffer, count, U16_MAX_LENGTH, srcChar, isError); return doReplace(start, _length, buffer, 0, count); } inline UnicodeString& UnicodeString::replaceBetween(int32_t start, int32_t limit, const UnicodeString& srcText) { return doReplace(start, limit - start, srcText, 0, srcText.length()); } inline UnicodeString& UnicodeString::replaceBetween(int32_t start, int32_t limit, const UnicodeString& srcText, int32_t srcStart, int32_t srcLimit) { return doReplace(start, limit - start, srcText, srcStart, srcLimit - srcStart); } inline UnicodeString& UnicodeString::findAndReplace(const UnicodeString& oldText, const UnicodeString& newText) { return findAndReplace(0, length(), oldText, 0, oldText.length(), newText, 0, newText.length()); } inline UnicodeString& UnicodeString::findAndReplace(int32_t start, int32_t _length, const UnicodeString& oldText, const UnicodeString& newText) { return findAndReplace(start, _length, oldText, 0, oldText.length(), newText, 0, newText.length()); } // ============================ // extract // ============================ inline void UnicodeString::doExtract(int32_t start, int32_t _length, UnicodeString& target) const { target.replace(0, target.length(), *this, start, _length); } inline void UnicodeString::extract(int32_t start, int32_t _length, UChar *target, int32_t targetStart) const { doExtract(start, _length, target, targetStart); } inline void UnicodeString::extract(int32_t start, int32_t _length, UnicodeString& target) const { doExtract(start, _length, target); } #if !UCONFIG_NO_CONVERSION inline int32_t UnicodeString::extract(int32_t start, int32_t _length, char *dst, const char *codepage) const { // This dstSize value will be checked explicitly #if defined(__GNUC__) // Ticket #7039: Clip length to the maximum valid length to the end of addressable memory given the starting address // This is only an issue when using GCC and certain optimizations are turned on. return extract(start, _length, dst, dst!=0 ? ((dst >= (char*)((size_t)-1) - UINT32_MAX) ? (((char*)UINT32_MAX) - dst) : UINT32_MAX) : 0, codepage); #else return extract(start, _length, dst, dst!=0 ? 0xffffffff : 0, codepage); #endif } #endif inline void UnicodeString::extractBetween(int32_t start, int32_t limit, UChar *dst, int32_t dstStart) const { pinIndex(start); pinIndex(limit); doExtract(start, limit - start, dst, dstStart); } inline UnicodeString UnicodeString::tempSubStringBetween(int32_t start, int32_t limit) const { return tempSubString(start, limit - start); } inline UChar UnicodeString::doCharAt(int32_t offset) const { if((uint32_t)offset < (uint32_t)length()) { return getArrayStart()[offset]; } else { return kInvalidUChar; } } inline UChar UnicodeString::charAt(int32_t offset) const { return doCharAt(offset); } inline UChar UnicodeString::operator[] (int32_t offset) const { return doCharAt(offset); } inline UChar32 UnicodeString::char32At(int32_t offset) const { int32_t len = length(); if((uint32_t)offset < (uint32_t)len) { const UChar *array = getArrayStart(); UChar32 c; U16_GET(array, 0, offset, len, c); return c; } else { return kInvalidUChar; } } inline int32_t UnicodeString::getChar32Start(int32_t offset) const { if((uint32_t)offset < (uint32_t)length()) { const UChar *array = getArrayStart(); U16_SET_CP_START(array, 0, offset); return offset; } else { return 0; } } inline int32_t UnicodeString::getChar32Limit(int32_t offset) const { int32_t len = length(); if((uint32_t)offset < (uint32_t)len) { const UChar *array = getArrayStart(); U16_SET_CP_LIMIT(array, 0, offset, len); return offset; } else { return len; } } inline UBool UnicodeString::isEmpty() const { return fShortLength == 0; } //======================================== // Write implementation methods //======================================== inline void UnicodeString::setLength(int32_t len) { if(len <= 127) { fShortLength = (int8_t)len; } else { fShortLength = (int8_t)-1; fUnion.fFields.fLength = len; } } inline void UnicodeString::setToEmpty() { fShortLength = 0; fFlags = kShortString; } inline void UnicodeString::setArray(UChar *array, int32_t len, int32_t capacity) { setLength(len); fUnion.fFields.fArray = array; fUnion.fFields.fCapacity = capacity; } inline const UChar * UnicodeString::getTerminatedBuffer() { if(!isWritable()) { return 0; } else { UChar *array = getArrayStart(); int32_t len = length(); if(len < getCapacity() && ((fFlags&kRefCounted) == 0 || refCount() == 1)) { /* * kRefCounted: Do not write the NUL if the buffer is shared. * That is mostly safe, except when the length of one copy was modified * without copy-on-write, e.g., via truncate(newLength) or remove(void). * Then the NUL would be written into the middle of another copy's string. */ if(!(fFlags&kBufferIsReadonly)) { /* * We must not write to a readonly buffer, but it is known to be * NUL-terminated if len1) must not have its contents * modified, but the NUL at [len] is beyond the string contents, * and multiple string objects and threads writing the same NUL into the * same location is harmless. * In all other cases, the buffer is fully writable and it is anyway safe * to write the NUL. * * Note: An earlier version of this code tested whether there is a NUL * at [len] already, but, while safe, it generated lots of warnings from * tools like valgrind and Purify. */ array[len] = 0; } return array; } else if(cloneArrayIfNeeded(len+1)) { array = getArrayStart(); array[len] = 0; return array; } else { return 0; } } } inline UnicodeString& UnicodeString::operator= (UChar ch) { return doReplace(0, length(), &ch, 0, 1); } inline UnicodeString& UnicodeString::operator= (UChar32 ch) { return replace(0, length(), ch); } inline UnicodeString& UnicodeString::setTo(const UnicodeString& srcText, int32_t srcStart, int32_t srcLength) { unBogus(); return doReplace(0, length(), srcText, srcStart, srcLength); } inline UnicodeString& UnicodeString::setTo(const UnicodeString& srcText, int32_t srcStart) { unBogus(); srcText.pinIndex(srcStart); return doReplace(0, length(), srcText, srcStart, srcText.length() - srcStart); } inline UnicodeString& UnicodeString::setTo(const UnicodeString& srcText) { unBogus(); return doReplace(0, length(), srcText, 0, srcText.length()); } inline UnicodeString& UnicodeString::setTo(const UChar *srcChars, int32_t srcLength) { unBogus(); return doReplace(0, length(), srcChars, 0, srcLength); } inline UnicodeString& UnicodeString::setTo(UChar srcChar) { unBogus(); return doReplace(0, length(), &srcChar, 0, 1); } inline UnicodeString& UnicodeString::setTo(UChar32 srcChar) { unBogus(); return replace(0, length(), srcChar); } inline UnicodeString& UnicodeString::append(const UnicodeString& srcText, int32_t srcStart, int32_t srcLength) { return doReplace(length(), 0, srcText, srcStart, srcLength); } inline UnicodeString& UnicodeString::append(const UnicodeString& srcText) { return doReplace(length(), 0, srcText, 0, srcText.length()); } inline UnicodeString& UnicodeString::append(const UChar *srcChars, int32_t srcStart, int32_t srcLength) { return doReplace(length(), 0, srcChars, srcStart, srcLength); } inline UnicodeString& UnicodeString::append(const UChar *srcChars, int32_t srcLength) { return doReplace(length(), 0, srcChars, 0, srcLength); } inline UnicodeString& UnicodeString::append(UChar srcChar) { return doReplace(length(), 0, &srcChar, 0, 1); } inline UnicodeString& UnicodeString::append(UChar32 srcChar) { UChar buffer[U16_MAX_LENGTH]; int32_t _length = 0; UBool isError = FALSE; U16_APPEND(buffer, _length, U16_MAX_LENGTH, srcChar, isError); return doReplace(length(), 0, buffer, 0, _length); } inline UnicodeString& UnicodeString::operator+= (UChar ch) { return doReplace(length(), 0, &ch, 0, 1); } inline UnicodeString& UnicodeString::operator+= (UChar32 ch) { return append(ch); } inline UnicodeString& UnicodeString::operator+= (const UnicodeString& srcText) { return doReplace(length(), 0, srcText, 0, srcText.length()); } inline UnicodeString& UnicodeString::insert(int32_t start, const UnicodeString& srcText, int32_t srcStart, int32_t srcLength) { return doReplace(start, 0, srcText, srcStart, srcLength); } inline UnicodeString& UnicodeString::insert(int32_t start, const UnicodeString& srcText) { return doReplace(start, 0, srcText, 0, srcText.length()); } inline UnicodeString& UnicodeString::insert(int32_t start, const UChar *srcChars, int32_t srcStart, int32_t srcLength) { return doReplace(start, 0, srcChars, srcStart, srcLength); } inline UnicodeString& UnicodeString::insert(int32_t start, const UChar *srcChars, int32_t srcLength) { return doReplace(start, 0, srcChars, 0, srcLength); } inline UnicodeString& UnicodeString::insert(int32_t start, UChar srcChar) { return doReplace(start, 0, &srcChar, 0, 1); } inline UnicodeString& UnicodeString::insert(int32_t start, UChar32 srcChar) { return replace(start, 0, srcChar); } inline UnicodeString& UnicodeString::remove() { // remove() of a bogus string makes the string empty and non-bogus // we also un-alias a read-only alias to deal with NUL-termination // issues with getTerminatedBuffer() if(fFlags & (kIsBogus|kBufferIsReadonly)) { setToEmpty(); } else { fShortLength = 0; } return *this; } inline UnicodeString& UnicodeString::remove(int32_t start, int32_t _length) { if(start <= 0 && _length == INT32_MAX) { // remove(guaranteed everything) of a bogus string makes the string empty and non-bogus return remove(); } return doReplace(start, _length, NULL, 0, 0); } inline UnicodeString& UnicodeString::removeBetween(int32_t start, int32_t limit) { return doReplace(start, limit - start, NULL, 0, 0); } inline UnicodeString & UnicodeString::retainBetween(int32_t start, int32_t limit) { truncate(limit); return doReplace(0, start, NULL, 0, 0); } inline UBool UnicodeString::truncate(int32_t targetLength) { if(isBogus() && targetLength == 0) { // truncate(0) of a bogus string makes the string empty and non-bogus unBogus(); return FALSE; } else if((uint32_t)targetLength < (uint32_t)length()) { setLength(targetLength); if(fFlags&kBufferIsReadonly) { fUnion.fFields.fCapacity = targetLength; // not NUL-terminated any more } return TRUE; } else { return FALSE; } } inline UnicodeString& UnicodeString::reverse() { return doReverse(0, length()); } inline UnicodeString& UnicodeString::reverse(int32_t start, int32_t _length) { return doReverse(start, _length); } U_NAMESPACE_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/rep.h0000644000015700001700000002252712200324306023712 0ustar pbuserpbgroup00000000000000/* ************************************************************************** * Copyright (C) 1999-2005, International Business Machines Corporation and * others. All Rights Reserved. ************************************************************************** * Date Name Description * 11/17/99 aliu Creation. Ported from java. Modified to * match current UnicodeString API. Forced * to use name "handleReplaceBetween" because * of existing methods in UnicodeString. ************************************************************************** */ #ifndef REP_H #define REP_H #include "unicode/uobject.h" /** * \file * \brief C++ API: Replaceable String */ U_NAMESPACE_BEGIN class UnicodeString; /** * Replaceable is an abstract base class representing a * string of characters that supports the replacement of a range of * itself with a new string of characters. It is used by APIs that * change a piece of text while retaining metadata. Metadata is data * other than the Unicode characters returned by char32At(). One * example of metadata is style attributes; another is an edit * history, marking each character with an author and revision number. * *

An implicit aspect of the Replaceable API is that * during a replace operation, new characters take on the metadata of * the old characters. For example, if the string "the bold * font" has range (4, 8) replaced with "strong", then it becomes "the * strong font". * *

Replaceable specifies ranges using a start * offset and a limit offset. The range of characters thus specified * includes the characters at offset start..limit-1. That is, the * start offset is inclusive, and the limit offset is exclusive. * *

Replaceable also includes API to access characters * in the string: length(), charAt(), * char32At(), and extractBetween(). * *

For a subclass to support metadata, typical behavior of * replace() is the following: *

    *
  • Set the metadata of the new text to the metadata of the first * character replaced
  • *
  • If no characters are replaced, use the metadata of the * previous character
  • *
  • If there is no previous character (i.e. start == 0), use the * following character
  • *
  • If there is no following character (i.e. the replaceable was * empty), use default metadata.
    *
  • If the code point U+FFFF is seen, it should be interpreted as * a special marker having no metadata
  • *
  • *
* If this is not the behavior, the subclass should document any differences. * @author Alan Liu * @stable ICU 2.0 */ class U_COMMON_API Replaceable : public UObject { public: /** * Destructor. * @stable ICU 2.0 */ virtual ~Replaceable(); /** * Returns the number of 16-bit code units in the text. * @return number of 16-bit code units in text * @stable ICU 1.8 */ inline int32_t length() const; /** * Returns the 16-bit code unit at the given offset into the text. * @param offset an integer between 0 and length()-1 * inclusive * @return 16-bit code unit of text at given offset * @stable ICU 1.8 */ inline UChar charAt(int32_t offset) const; /** * Returns the 32-bit code point at the given 16-bit offset into * the text. This assumes the text is stored as 16-bit code units * with surrogate pairs intermixed. If the offset of a leading or * trailing code unit of a surrogate pair is given, return the * code point of the surrogate pair. * * @param offset an integer between 0 and length()-1 * inclusive * @return 32-bit code point of text at given offset * @stable ICU 1.8 */ inline UChar32 char32At(int32_t offset) const; /** * Copies characters in the range [start, limit) * into the UnicodeString target. * @param start offset of first character which will be copied * @param limit offset immediately following the last character to * be copied * @param target UnicodeString into which to copy characters. * @return A reference to target * @stable ICU 2.1 */ virtual void extractBetween(int32_t start, int32_t limit, UnicodeString& target) const = 0; /** * Replaces a substring of this object with the given text. If the * characters being replaced have metadata, the new characters * that replace them should be given the same metadata. * *

Subclasses must ensure that if the text between start and * limit is equal to the replacement text, that replace has no * effect. That is, any metadata * should be unaffected. In addition, subclasses are encouraged to * check for initial and trailing identical characters, and make a * smaller replacement if possible. This will preserve as much * metadata as possible. * @param start the beginning index, inclusive; 0 <= start * <= limit. * @param limit the ending index, exclusive; start <= limit * <= length(). * @param text the text to replace characters start * to limit - 1 * @stable ICU 2.0 */ virtual void handleReplaceBetween(int32_t start, int32_t limit, const UnicodeString& text) = 0; // Note: All other methods in this class take the names of // existing UnicodeString methods. This method is the exception. // It is named differently because all replace methods of // UnicodeString return a UnicodeString&. The 'between' is // required in order to conform to the UnicodeString naming // convention; API taking start/length are named , and // those taking start/limit are named . The // 'handle' is added because 'replaceBetween' and // 'doReplaceBetween' are already taken. /** * Copies a substring of this object, retaining metadata. * This method is used to duplicate or reorder substrings. * The destination index must not overlap the source range. * * @param start the beginning index, inclusive; 0 <= start <= * limit. * @param limit the ending index, exclusive; start <= limit <= * length(). * @param dest the destination index. The characters from * start..limit-1 will be copied to dest. * Implementations of this method may assume that dest <= start || * dest >= limit. * @stable ICU 2.0 */ virtual void copy(int32_t start, int32_t limit, int32_t dest) = 0; /** * Returns true if this object contains metadata. If a * Replaceable object has metadata, calls to the Replaceable API * must be made so as to preserve metadata. If it does not, calls * to the Replaceable API may be optimized to improve performance. * The default implementation returns true. * @return true if this object contains metadata * @stable ICU 2.2 */ virtual UBool hasMetaData() const; /** * Clone this object, an instance of a subclass of Replaceable. * Clones can be used concurrently in multiple threads. * If a subclass does not implement clone(), or if an error occurs, * then NULL is returned. * The clone functions in all subclasses return a pointer to a Replaceable * because some compilers do not support covariant (same-as-this) * return types; cast to the appropriate subclass if necessary. * The caller must delete the clone. * * @return a clone of this object * * @see getDynamicClassID * @stable ICU 2.6 */ virtual Replaceable *clone() const; protected: /** * Default constructor. * @stable ICU 2.4 */ Replaceable(); /* * Assignment operator not declared. The compiler will provide one * which does nothing since this class does not contain any data members. * API/code coverage may show the assignment operator as present and * untested - ignore. * Subclasses need this assignment operator if they use compiler-provided * assignment operators of their own. An alternative to not declaring one * here would be to declare and empty-implement a protected or public one. Replaceable &Replaceable::operator=(const Replaceable &); */ /** * Virtual version of length(). * @stable ICU 2.4 */ virtual int32_t getLength() const = 0; /** * Virtual version of charAt(). * @stable ICU 2.4 */ virtual UChar getCharAt(int32_t offset) const = 0; /** * Virtual version of char32At(). * @stable ICU 2.4 */ virtual UChar32 getChar32At(int32_t offset) const = 0; }; inline int32_t Replaceable::length() const { return getLength(); } inline UChar Replaceable::charAt(int32_t offset) const { return getCharAt(offset); } inline UChar32 Replaceable::char32At(int32_t offset) const { return getChar32At(offset); } // There is no rep.cpp, see unistr.cpp for Replaceable function implementations. U_NAMESPACE_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/dtintrv.h0000644000015700001700000000722612200324306024615 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * Copyright (C) 2008-2009, International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************************* * * File DTINTRV.H * ******************************************************************************* */ #ifndef __DTINTRV_H__ #define __DTINTRV_H__ #include "unicode/utypes.h" #include "unicode/uobject.h" /** * \file * \brief C++ API: Date Interval data type */ U_NAMESPACE_BEGIN /** * This class represents a date interval. * It is a pair of UDate representing from UDate 1 to UDate 2. * @stable ICU 4.0 **/ class U_COMMON_API DateInterval : public UObject { public: /** * Construct a DateInterval given a from date and a to date. * @param fromDate The from date in date interval. * @param toDate The to date in date interval. * @stable ICU 4.0 */ DateInterval(UDate fromDate, UDate toDate); /** * destructor * @stable ICU 4.0 */ virtual ~DateInterval(); /** * Get the from date. * @return the from date in dateInterval. * @stable ICU 4.0 */ UDate getFromDate() const; /** * Get the to date. * @return the to date in dateInterval. * @stable ICU 4.0 */ UDate getToDate() const; /** * Return the class ID for this class. This is useful only for comparing to * a return value from getDynamicClassID(). For example: *

     * .   Base* polymorphic_pointer = createPolymorphicObject();
     * .   if (polymorphic_pointer->getDynamicClassID() ==
     * .       erived::getStaticClassID()) ...
     * 
* @return The class ID for all objects of this class. * @stable ICU 4.0 */ static UClassID U_EXPORT2 getStaticClassID(void); /** * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This * method is to implement a simple version of RTTI, since not all C++ * compilers support genuine RTTI. Polymorphic operator==() and clone() * methods call this method. * * @return The class ID for this object. All objects of a * given class have the same class ID. Objects of * other classes have different class IDs. * @stable ICU 4.0 */ virtual UClassID getDynamicClassID(void) const; /** * Copy constructor. * @stable ICU 4.0 */ DateInterval(const DateInterval& other); /** * Default assignment operator * @stable ICU 4.0 */ DateInterval& operator=(const DateInterval&); /** * Equality operator. * @return TRUE if the two DateIntervals are the same * @stable ICU 4.0 */ virtual UBool operator==(const DateInterval& other) const; /** * Non-equality operator * @return TRUE if the two DateIntervals are not the same * @stable ICU 4.0 */ UBool operator!=(const DateInterval& other) const; /** * clone this object. * The caller owns the result and should delete it when done. * @return a cloned DateInterval * @stable ICU 4.0 */ virtual DateInterval* clone() const; private: /** * Default constructor, not implemented. */ DateInterval(); UDate fromDate; UDate toDate; } ;// end class DateInterval inline UDate DateInterval::getFromDate() const { return fromDate; } inline UDate DateInterval::getToDate() const { return toDate; } inline UBool DateInterval::operator!=(const DateInterval& other) const { return ( !operator==(other) ); } U_NAMESPACE_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/uobject.h0000644000015700001700000002726212200324306024560 0ustar pbuserpbgroup00000000000000/* ****************************************************************************** * * Copyright (C) 2002-2010, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * file name: uobject.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2002jun26 * created by: Markus W. Scherer */ #ifndef __UOBJECT_H__ #define __UOBJECT_H__ #include "unicode/utypes.h" U_NAMESPACE_BEGIN /** * \file * \brief C++ API: Common ICU base class UObject. */ /** U_OVERRIDE_CXX_ALLOCATION - Define this to override operator new and * delete in UMemory. Enabled by default for ICU. * * Enabling forces all allocation of ICU object types to use ICU's * memory allocation. On Windows, this allows the ICU DLL to be used by * applications that statically link the C Runtime library, meaning that * the app and ICU will be using different heaps. * * @stable ICU 2.2 */ #ifndef U_OVERRIDE_CXX_ALLOCATION #define U_OVERRIDE_CXX_ALLOCATION 1 #endif /** * \def U_HAVE_PLACEMENT_NEW * Define this to define the placement new and * delete in UMemory for STL. * * @stable ICU 2.6 */ #ifndef U_HAVE_PLACEMENT_NEW #define U_HAVE_PLACEMENT_NEW 1 #endif /** * \def U_HAVE_DEBUG_LOCATION_NEW * Define this to define the MFC debug * version of the operator new. * * @stable ICU 3.4 */ #ifndef U_HAVE_DEBUG_LOCATION_NEW #define U_HAVE_DEBUG_LOCATION_NEW 0 #endif /** * @{ * \def U_NO_THROW * Define this to define the throw() specification so * certain functions do not throw any exceptions * * UMemory operator new methods should have the throw() specification * appended to them, so that the compiler adds the additional NULL check * before calling constructors. Without, if operator new returns NULL the * constructor is still called, and if the constructor references member * data, (which it typically does), the result is a segmentation violation. * * @draft ICU 4.2 */ #ifndef U_NO_THROW #define U_NO_THROW throw() #endif /** @} */ /** * UMemory is the common ICU base class. * All other ICU C++ classes are derived from UMemory (starting with ICU 2.4). * * This is primarily to make it possible and simple to override the * C++ memory management by adding new/delete operators to this base class. * * To override ALL ICU memory management, including that from plain C code, * replace the allocation functions declared in cmemory.h * * UMemory does not contain any virtual functions. * Common "boilerplate" functions are defined in UObject. * * @stable ICU 2.4 */ class U_COMMON_API UMemory { public: /* test versions for debugging shaper heap memory problems */ #ifdef SHAPER_MEMORY_DEBUG static void * NewArray(int size, int count); static void * GrowArray(void * array, int newSize ); static void FreeArray(void * array ); #endif #if U_OVERRIDE_CXX_ALLOCATION /** * Override for ICU4C C++ memory management. * simple, non-class types are allocated using the macros in common/cmemory.h * (uprv_malloc(), uprv_free(), uprv_realloc()); * they or something else could be used here to implement C++ new/delete * for ICU4C C++ classes * @stable ICU 2.4 */ static void * U_EXPORT2 operator new(size_t size) U_NO_THROW; /** * Override for ICU4C C++ memory management. * See new(). * @stable ICU 2.4 */ static void * U_EXPORT2 operator new[](size_t size) U_NO_THROW; /** * Override for ICU4C C++ memory management. * simple, non-class types are allocated using the macros in common/cmemory.h * (uprv_malloc(), uprv_free(), uprv_realloc()); * they or something else could be used here to implement C++ new/delete * for ICU4C C++ classes * @stable ICU 2.4 */ static void U_EXPORT2 operator delete(void *p) U_NO_THROW; /** * Override for ICU4C C++ memory management. * See delete(). * @stable ICU 2.4 */ static void U_EXPORT2 operator delete[](void *p) U_NO_THROW; #if U_HAVE_PLACEMENT_NEW /** * Override for ICU4C C++ memory management for STL. * See new(). * @stable ICU 2.6 */ static inline void * U_EXPORT2 operator new(size_t, void *ptr) U_NO_THROW { return ptr; } /** * Override for ICU4C C++ memory management for STL. * See delete(). * @stable ICU 2.6 */ static inline void U_EXPORT2 operator delete(void *, void *) U_NO_THROW {} #endif /* U_HAVE_PLACEMENT_NEW */ #if U_HAVE_DEBUG_LOCATION_NEW /** * This method overrides the MFC debug version of the operator new * * @param size The requested memory size * @param file The file where the allocation was requested * @param line The line where the allocation was requested */ static void * U_EXPORT2 operator new(size_t size, const char* file, int line) U_NO_THROW; /** * This method provides a matching delete for the MFC debug new * * @param p The pointer to the allocated memory * @param file The file where the allocation was requested * @param line The line where the allocation was requested */ static void U_EXPORT2 operator delete(void* p, const char* file, int line) U_NO_THROW; #endif /* U_HAVE_DEBUG_LOCATION_NEW */ #endif /* U_OVERRIDE_CXX_ALLOCATION */ /* * Assignment operator not declared. The compiler will provide one * which does nothing since this class does not contain any data members. * API/code coverage may show the assignment operator as present and * untested - ignore. * Subclasses need this assignment operator if they use compiler-provided * assignment operators of their own. An alternative to not declaring one * here would be to declare and empty-implement a protected or public one. UMemory &UMemory::operator=(const UMemory &); */ }; /** * UObject is the common ICU "boilerplate" class. * UObject inherits UMemory (starting with ICU 2.4), * and all other public ICU C++ classes * are derived from UObject (starting with ICU 2.2). * * UObject contains common virtual functions like for ICU's "poor man's RTTI". * It does not contain default implementations of virtual methods * like getDynamicClassID to allow derived classes such as Format * to declare these as pure virtual. * * The clone() function is not available in UObject because it is not * implemented by all ICU classes. * Many ICU services provide a clone() function for their class trees, * defined on the service's C++ base class, and all subclasses within that * service class tree return a pointer to the service base class * (which itself is a subclass of UObject). * This is because some compilers do not support covariant (same-as-this) * return types; cast to the appropriate subclass if necessary. * * @stable ICU 2.2 */ class U_COMMON_API UObject : public UMemory { public: /** * Destructor. * * @stable ICU 2.2 */ virtual ~UObject(); /** * ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class. * * @stable ICU 2.2 */ virtual UClassID getDynamicClassID() const = 0; protected: // the following functions are protected to prevent instantiation and // direct use of UObject itself // default constructor // commented out because UObject is abstract (see getDynamicClassID) // inline UObject() {} // copy constructor // commented out because UObject is abstract (see getDynamicClassID) // inline UObject(const UObject &other) {} #if 0 // TODO Sometime in the future. Implement operator==(). // (This comment inserted in 2.2) // some or all of the following "boilerplate" functions may be made public // in a future ICU4C release when all subclasses implement them // assignment operator // (not virtual, see "Taligent's Guide to Designing Programs" pp.73..74) // commented out because the implementation is the same as a compiler's default // UObject &operator=(const UObject &other) { return *this; } // comparison operators virtual inline UBool operator==(const UObject &other) const { return this==&other; } inline UBool operator!=(const UObject &other) const { return !operator==(other); } // clone() commented out from the base class: // some compilers do not support co-variant return types // (i.e., subclasses would have to return UObject * as well, instead of SubClass *) // see also UObject class documentation. // virtual UObject *clone() const; #endif /* * Assignment operator not declared. The compiler will provide one * which does nothing since this class does not contain any data members. * API/code coverage may show the assignment operator as present and * untested - ignore. * Subclasses need this assignment operator if they use compiler-provided * assignment operators of their own. An alternative to not declaring one * here would be to declare and empty-implement a protected or public one. UObject &UObject::operator=(const UObject &); */ // Future implementation for RTTI that support subtyping. [alan] // // public: // /** // * @internal // */ // static UClassID getStaticClassID(); // // /** // * @internal // */ // UBool instanceOf(UClassID type) const; }; /** * This is a simple macro to add ICU RTTI to an ICU object implementation. * This does not go into the header. This should only be used in *.cpp files. * * @param myClass The name of the class that needs RTTI defined. * @internal */ #define UOBJECT_DEFINE_RTTI_IMPLEMENTATION(myClass) \ UClassID U_EXPORT2 myClass::getStaticClassID() { \ static char classID = 0; \ return (UClassID)&classID; \ } \ UClassID myClass::getDynamicClassID() const \ { return myClass::getStaticClassID(); } /** * This macro adds ICU RTTI to an ICU abstract class implementation. * This macro should be invoked in *.cpp files. The corresponding * header should declare getStaticClassID. * * @param myClass The name of the class that needs RTTI defined. * @internal */ #define UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(myClass) \ UClassID U_EXPORT2 myClass::getStaticClassID() { \ static char classID = 0; \ return (UClassID)&classID; \ } /** * This is a simple macro to express that a class and its subclasses do not offer * ICU's "poor man's RTTI". * Beginning with ICU 4.6, ICU requires C++ compiler RTTI. * This does not go into the header. This should only be used in *.cpp files. * Use this with a private getDynamicClassID() in an immediate subclass of UObject. * * @param myClass The name of the class that needs RTTI defined. * @internal */ #define UOBJECT_DEFINE_NO_RTTI_IMPLEMENTATION(myClass) \ UClassID myClass::getDynamicClassID() const { return NULL; } // /** // * This macro adds ICU RTTI to an ICU concrete class implementation. // * This macro should be invoked in *.cpp files. The corresponding // * header should declare getDynamicClassID and getStaticClassID. // * // * @param myClass The name of the class that needs RTTI defined. // * @param myParent The name of the myClass's parent. // * @internal // */ /*#define UOBJECT_DEFINE_RTTI_IMPLEMENTATION(myClass, myParent) \ UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(myClass, myParent) \ UClassID myClass::getDynamicClassID() const { \ return myClass::getStaticClassID(); \ } */ U_NAMESPACE_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/symtable.h0000644000015700001700000001014712200324306024737 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (c) 2000-2005, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Date Name Description * 02/04/00 aliu Creation. ********************************************************************** */ #ifndef SYMTABLE_H #define SYMTABLE_H #include "unicode/utypes.h" #include "unicode/uobject.h" /** * \file * \brief C++ API: An interface that defines both lookup protocol and parsing of * symbolic names. */ U_NAMESPACE_BEGIN class ParsePosition; class UnicodeFunctor; class UnicodeSet; class UnicodeString; /** * An interface that defines both lookup protocol and parsing of * symbolic names. * *

A symbol table maintains two kinds of mappings. The first is * between symbolic names and their values. For example, if the * variable with the name "start" is set to the value "alpha" * (perhaps, though not necessarily, through an expression such as * "$start=alpha"), then the call lookup("start") will return the * char[] array ['a', 'l', 'p', 'h', 'a']. * *

The second kind of mapping is between character values and * UnicodeMatcher objects. This is used by RuleBasedTransliterator, * which uses characters in the private use area to represent objects * such as UnicodeSets. If U+E015 is mapped to the UnicodeSet [a-z], * then lookupMatcher(0xE015) will return the UnicodeSet [a-z]. * *

Finally, a symbol table defines parsing behavior for symbolic * names. All symbolic names start with the SYMBOL_REF character. * When a parser encounters this character, it calls parseReference() * with the position immediately following the SYMBOL_REF. The symbol * table parses the name, if there is one, and returns it. * * @stable ICU 2.8 */ class U_COMMON_API SymbolTable /* not : public UObject because this is an interface/mixin class */ { public: /** * The character preceding a symbol reference name. * @stable ICU 2.8 */ enum { SYMBOL_REF = 0x0024 /*$*/ }; /** * Destructor. * @stable ICU 2.8 */ virtual ~SymbolTable(); /** * Lookup the characters associated with this string and return it. * Return NULL if no such name exists. The resultant * string may have length zero. * @param s the symbolic name to lookup * @return a string containing the name's value, or NULL if * there is no mapping for s. * @stable ICU 2.8 */ virtual const UnicodeString* lookup(const UnicodeString& s) const = 0; /** * Lookup the UnicodeMatcher associated with the given character, and * return it. Return NULL if not found. * @param ch a 32-bit code point from 0 to 0x10FFFF inclusive. * @return the UnicodeMatcher object represented by the given * character, or NULL if there is no mapping for ch. * @stable ICU 2.8 */ virtual const UnicodeFunctor* lookupMatcher(UChar32 ch) const = 0; /** * Parse a symbol reference name from the given string, starting * at the given position. If no valid symbol reference name is * found, return the empty string and leave pos unchanged. That is, if the * character at pos cannot start a name, or if pos is at or after * text.length(), then return an empty string. This indicates an * isolated SYMBOL_REF character. * @param text the text to parse for the name * @param pos on entry, the index of the first character to parse. * This is the character following the SYMBOL_REF character. On * exit, the index after the last parsed character. If the parse * failed, pos is unchanged on exit. * @param limit the index after the last character to be parsed. * @return the parsed name, or an empty string if there is no * valid symbolic name at the given position. * @stable ICU 2.8 */ virtual UnicodeString parseReference(const UnicodeString& text, ParsePosition& pos, int32_t limit) const = 0; }; U_NAMESPACE_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/uconfig.h0000644000015700001700000001362312200324306024553 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (C) 2002-2009, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * file name: uconfig.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2002sep19 * created by: Markus W. Scherer */ #ifndef __UCONFIG_H__ #define __UCONFIG_H__ /*! * \file * \brief Switches for excluding parts of ICU library code modules. * * Allows to build partial, smaller libraries for special purposes. * By default, all modules are built. * The switches are fairly coarse, controlling large modules. * Basic services cannot be turned off. * * Building with any of these options does not guarantee that the * ICU build process will completely work. It is recommended that * the ICU libraries and data be built using the normal build. * At that time you should remove the data used by those services. * After building the ICU data library, you should rebuild the ICU * libraries with these switches customized to your needs. * * @stable ICU 2.4 */ /** * If this switch is defined, ICU will attempt to load a header file named "uconfig_local.h" * prior to determining default settings for uconfig variables. * * @internal ICU 4.0 * */ #if defined(UCONFIG_USE_LOCAL) #include "uconfig_local.h" #endif /** * \def UCONFIG_ONLY_COLLATION * This switch turns off modules that are not needed for collation. * * It does not turn off legacy conversion because that is necessary * for ICU to work on EBCDIC platforms (for the default converter). * If you want "only collation" and do not build for EBCDIC, * then you can define UCONFIG_NO_LEGACY_CONVERSION 1 as well. * * @stable ICU 2.4 */ #ifndef UCONFIG_ONLY_COLLATION # define UCONFIG_ONLY_COLLATION 0 #endif #if UCONFIG_ONLY_COLLATION /* common library */ # define UCONFIG_NO_BREAK_ITERATION 1 # define UCONFIG_NO_IDNA 1 /* i18n library */ # if UCONFIG_NO_COLLATION # error Contradictory collation switches in uconfig.h. # endif # define UCONFIG_NO_FORMATTING 1 # define UCONFIG_NO_TRANSLITERATION 1 # define UCONFIG_NO_REGULAR_EXPRESSIONS 1 #endif /* common library switches -------------------------------------------------- */ /** * \def UCONFIG_NO_FILE_IO * This switch turns off all file access in the common library * where file access is only used for data loading. * ICU data must then be provided in the form of a data DLL (or with an * equivalent way to link to the data residing in an executable, * as in building a combined library with both the common library's code and * the data), or via udata_setCommonData(). * Application data must be provided via udata_setAppData() or by using * "open" functions that take pointers to data, for example ucol_openBinary(). * * File access is not used at all in the i18n library. * * File access cannot be turned off for the icuio library or for the ICU * test suites and ICU tools. * * @stable ICU 3.6 */ #ifndef UCONFIG_NO_FILE_IO # define UCONFIG_NO_FILE_IO 0 #endif /** * \def UCONFIG_NO_CONVERSION * ICU will not completely build with this switch turned on. * This switch turns off all converters. * * You may want to use this together with U_CHARSET_IS_UTF8 defined to 1 * in utypes.h if char* strings in your environment are always in UTF-8. * * @stable ICU 3.2 * @see U_CHARSET_IS_UTF8 */ #ifndef UCONFIG_NO_CONVERSION # define UCONFIG_NO_CONVERSION 0 #endif #if UCONFIG_NO_CONVERSION # define UCONFIG_NO_LEGACY_CONVERSION 1 #endif /** * \def UCONFIG_NO_LEGACY_CONVERSION * This switch turns off all converters except for * - Unicode charsets (UTF-7/8/16/32, CESU-8, SCSU, BOCU-1) * - US-ASCII * - ISO-8859-1 * * Turning off legacy conversion is not possible on EBCDIC platforms * because they need ibm-37 or ibm-1047 default converters. * * @stable ICU 2.4 */ #ifndef UCONFIG_NO_LEGACY_CONVERSION # define UCONFIG_NO_LEGACY_CONVERSION 0 #endif /** * \def UCONFIG_NO_NORMALIZATION * This switch turns off normalization. * It implies turning off several other services as well, for example * collation and IDNA. * * @stable ICU 2.6 */ #ifndef UCONFIG_NO_NORMALIZATION # define UCONFIG_NO_NORMALIZATION 0 #elif UCONFIG_NO_NORMALIZATION /* common library */ # define UCONFIG_NO_IDNA 1 /* i18n library */ # if UCONFIG_ONLY_COLLATION # error Contradictory collation switches in uconfig.h. # endif # define UCONFIG_NO_COLLATION 1 # define UCONFIG_NO_TRANSLITERATION 1 #endif /** * \def UCONFIG_NO_BREAK_ITERATION * This switch turns off break iteration. * * @stable ICU 2.4 */ #ifndef UCONFIG_NO_BREAK_ITERATION # define UCONFIG_NO_BREAK_ITERATION 0 #endif /** * \def UCONFIG_NO_IDNA * This switch turns off IDNA. * * @stable ICU 2.6 */ #ifndef UCONFIG_NO_IDNA # define UCONFIG_NO_IDNA 0 #endif /* i18n library switches ---------------------------------------------------- */ /** * \def UCONFIG_NO_COLLATION * This switch turns off collation and collation-based string search. * * @stable ICU 2.4 */ #ifndef UCONFIG_NO_COLLATION # define UCONFIG_NO_COLLATION 0 #endif /** * \def UCONFIG_NO_FORMATTING * This switch turns off formatting and calendar/timezone services. * * @stable ICU 2.4 */ #ifndef UCONFIG_NO_FORMATTING # define UCONFIG_NO_FORMATTING 0 #endif /** * \def UCONFIG_NO_TRANSLITERATION * This switch turns off transliteration. * * @stable ICU 2.4 */ #ifndef UCONFIG_NO_TRANSLITERATION # define UCONFIG_NO_TRANSLITERATION 0 #endif /** * \def UCONFIG_NO_REGULAR_EXPRESSIONS * This switch turns off regular expressions. * * @stable ICU 2.4 */ #ifndef UCONFIG_NO_REGULAR_EXPRESSIONS # define UCONFIG_NO_REGULAR_EXPRESSIONS 0 #endif /** * \def UCONFIG_NO_SERVICE * This switch turns off service registration. * * @stable ICU 3.2 */ #ifndef UCONFIG_NO_SERVICE # define UCONFIG_NO_SERVICE 0 #endif #endif android-audiosystem-1.8+13.10.20130807/include/unicode/idna.h0000644000015700001700000003114612200324306024034 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * Copyright (C) 2010, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: idna.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2010mar05 * created by: Markus W. Scherer */ #ifndef __IDNA_H__ #define __IDNA_H__ /** * \file * \brief C++ API: Internationalizing Domain Names in Applications (IDNA) */ #include "unicode/utypes.h" #if !UCONFIG_NO_IDNA #include "unicode/bytestream.h" #include "unicode/stringpiece.h" #include "unicode/uidna.h" #include "unicode/unistr.h" U_NAMESPACE_BEGIN class U_COMMON_API IDNAInfo; /** * Abstract base class for IDNA processing. * See http://www.unicode.org/reports/tr46/ * and http://www.ietf.org/rfc/rfc3490.txt * * The IDNA class is not intended for public subclassing. * * This C++ API currently only implements UTS #46. * The uidna.h C API implements both UTS #46 (functions using UIDNA service object) * and IDNA2003 (functions that do not use a service object). * @draft ICU 4.6 */ class U_COMMON_API IDNA : public UObject { public: /** * Returns an IDNA instance which implements UTS #46. * Returns an unmodifiable instance, owned by the caller. * Cache it for multiple operations, and delete it when done. * The instance is thread-safe, that is, it can be used concurrently. * * UTS #46 defines Unicode IDNA Compatibility Processing, * updated to the latest version of Unicode and compatible with both * IDNA2003 and IDNA2008. * * The worker functions use transitional processing, including deviation mappings, * unless UIDNA_NONTRANSITIONAL_TO_ASCII or UIDNA_NONTRANSITIONAL_TO_UNICODE * is used in which case the deviation characters are passed through without change. * * Disallowed characters are mapped to U+FFFD. * * For available options see the uidna.h header. * Operations with the UTS #46 instance do not support the * UIDNA_ALLOW_UNASSIGNED option. * * By default, the UTS #46 implementation allows all ASCII characters (as valid or mapped). * When the UIDNA_USE_STD3_RULES option is used, ASCII characters other than * letters, digits, hyphen (LDH) and dot/full stop are disallowed and mapped to U+FFFD. * * @param options Bit set to modify the processing and error checking. * See option bit set values in uidna.h. * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return the UTS #46 IDNA instance, if successful * @draft ICU 4.6 */ static IDNA * createUTS46Instance(uint32_t options, UErrorCode &errorCode); /** * Converts a single domain name label into its ASCII form for DNS lookup. * If any processing step fails, then info.hasErrors() will be TRUE and * the result might not be an ASCII string. * The label might be modified according to the types of errors. * Labels with severe errors will be left in (or turned into) their Unicode form. * * The UErrorCode indicates an error only in exceptional cases, * such as a U_MEMORY_ALLOCATION_ERROR. * * @param label Input domain name label * @param dest Destination string object * @param info Output container of IDNA processing details. * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return dest * @draft ICU 4.6 */ virtual UnicodeString & labelToASCII(const UnicodeString &label, UnicodeString &dest, IDNAInfo &info, UErrorCode &errorCode) const = 0; /** * Converts a single domain name label into its Unicode form for human-readable display. * If any processing step fails, then info.hasErrors() will be TRUE. * The label might be modified according to the types of errors. * * The UErrorCode indicates an error only in exceptional cases, * such as a U_MEMORY_ALLOCATION_ERROR. * * @param label Input domain name label * @param dest Destination string object * @param info Output container of IDNA processing details. * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return dest * @draft ICU 4.6 */ virtual UnicodeString & labelToUnicode(const UnicodeString &label, UnicodeString &dest, IDNAInfo &info, UErrorCode &errorCode) const = 0; /** * Converts a whole domain name into its ASCII form for DNS lookup. * If any processing step fails, then info.hasErrors() will be TRUE and * the result might not be an ASCII string. * The domain name might be modified according to the types of errors. * Labels with severe errors will be left in (or turned into) their Unicode form. * * The UErrorCode indicates an error only in exceptional cases, * such as a U_MEMORY_ALLOCATION_ERROR. * * @param name Input domain name * @param dest Destination string object * @param info Output container of IDNA processing details. * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return dest * @draft ICU 4.6 */ virtual UnicodeString & nameToASCII(const UnicodeString &name, UnicodeString &dest, IDNAInfo &info, UErrorCode &errorCode) const = 0; /** * Converts a whole domain name into its Unicode form for human-readable display. * If any processing step fails, then info.hasErrors() will be TRUE. * The domain name might be modified according to the types of errors. * * The UErrorCode indicates an error only in exceptional cases, * such as a U_MEMORY_ALLOCATION_ERROR. * * @param name Input domain name * @param dest Destination string object * @param info Output container of IDNA processing details. * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return dest * @draft ICU 4.6 */ virtual UnicodeString & nameToUnicode(const UnicodeString &name, UnicodeString &dest, IDNAInfo &info, UErrorCode &errorCode) const = 0; // UTF-8 versions of the processing methods ---------------------------- *** /** * Converts a single domain name label into its ASCII form for DNS lookup. * UTF-8 version of labelToASCII(), same behavior. * * @param label Input domain name label * @param dest Destination byte sink; Flush()ed if successful * @param info Output container of IDNA processing details. * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return dest * @draft ICU 4.6 */ virtual void labelToASCII_UTF8(const StringPiece &label, ByteSink &dest, IDNAInfo &info, UErrorCode &errorCode) const; /** * Converts a single domain name label into its Unicode form for human-readable display. * UTF-8 version of labelToUnicode(), same behavior. * * @param label Input domain name label * @param dest Destination byte sink; Flush()ed if successful * @param info Output container of IDNA processing details. * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return dest * @draft ICU 4.6 */ virtual void labelToUnicodeUTF8(const StringPiece &label, ByteSink &dest, IDNAInfo &info, UErrorCode &errorCode) const; /** * Converts a whole domain name into its ASCII form for DNS lookup. * UTF-8 version of nameToASCII(), same behavior. * * @param name Input domain name * @param dest Destination byte sink; Flush()ed if successful * @param info Output container of IDNA processing details. * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return dest * @draft ICU 4.6 */ virtual void nameToASCII_UTF8(const StringPiece &name, ByteSink &dest, IDNAInfo &info, UErrorCode &errorCode) const; /** * Converts a whole domain name into its Unicode form for human-readable display. * UTF-8 version of nameToUnicode(), same behavior. * * @param name Input domain name * @param dest Destination byte sink; Flush()ed if successful * @param info Output container of IDNA processing details. * @param errorCode Standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return dest * @draft ICU 4.6 */ virtual void nameToUnicodeUTF8(const StringPiece &name, ByteSink &dest, IDNAInfo &info, UErrorCode &errorCode) const; private: // No ICU "poor man's RTTI" for this class nor its subclasses. virtual UClassID getDynamicClassID() const; }; class UTS46; /** * Output container for IDNA processing errors. * The IDNAInfo class is not suitable for subclassing. * @draft ICU 4.6 */ class U_COMMON_API IDNAInfo : public UMemory { public: /** * Constructor for stack allocation. * @draft ICU 4.6 */ IDNAInfo() : errors(0), labelErrors(0), isTransDiff(FALSE), isBiDi(FALSE), isOkBiDi(TRUE) {} /** * Were there IDNA processing errors? * @return TRUE if there were processing errors * @draft ICU 4.6 */ UBool hasErrors() const { return errors!=0; } /** * Returns a bit set indicating IDNA processing errors. * See UIDNA_ERROR_... constants in uidna.h. * @return bit set of processing errors * @draft ICU 4.6 */ uint32_t getErrors() const { return errors; } /** * Returns TRUE if transitional and nontransitional processing produce different results. * This is the case when the input label or domain name contains * one or more deviation characters outside a Punycode label (see UTS #46). *

    *
  • With nontransitional processing, such characters are * copied to the destination string. *
  • With transitional processing, such characters are * mapped (sharp s/sigma) or removed (joiner/nonjoiner). *
* @return TRUE if transitional and nontransitional processing produce different results * @draft ICU 4.6 */ UBool isTransitionalDifferent() const { return isTransDiff; } private: friend class UTS46; IDNAInfo(const IDNAInfo &other); // no copying IDNAInfo &operator=(const IDNAInfo &other); // no copying void reset() { errors=labelErrors=0; isTransDiff=FALSE; isBiDi=FALSE; isOkBiDi=TRUE; } uint32_t errors, labelErrors; UBool isTransDiff; UBool isBiDi; UBool isOkBiDi; }; U_NAMESPACE_END #endif // UCONFIG_NO_IDNA #endif // __IDNA_H__ android-audiosystem-1.8+13.10.20130807/include/unicode/utext.h0000644000015700001700000017767412200324306024313 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * * Copyright (C) 2004-2010, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: utext.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2004oct06 * created by: Markus W. Scherer */ #ifndef __UTEXT_H__ #define __UTEXT_H__ /** * \file * \brief C API: Abstract Unicode Text API * * The Text Access API provides a means to allow text that is stored in alternative * formats to work with ICU services. ICU normally operates on text that is * stored in UTF-16 format, in (UChar *) arrays for the C APIs or as type * UnicodeString for C++ APIs. * * ICU Text Access allows other formats, such as UTF-8 or non-contiguous * UTF-16 strings, to be placed in a UText wrapper and then passed to ICU services. * * There are three general classes of usage for UText: * * Application Level Use. This is the simplest usage - applications would * use one of the utext_open() functions on their input text, and pass * the resulting UText to the desired ICU service. * * Second is usage in ICU Services, such as break iteration, that will need to * operate on input presented to them as a UText. These implementations * will need to use the iteration and related UText functions to gain * access to the actual text. * * The third class of UText users are "text providers." These are the * UText implementations for the various text storage formats. An application * or system with a unique text storage format can implement a set of * UText provider functions for that format, which will then allow * ICU services to operate on that format. * * * Iterating over text * * Here is sample code for a forward iteration over the contents of a UText * * \code * UChar32 c; * UText *ut = whatever(); * * for (c=utext_next32From(ut, 0); c>=0; c=utext_next32(ut)) { * // do whatever with the codepoint c here. * } * \endcode * * And here is similar code to iterate in the reverse direction, from the end * of the text towards the beginning. * * \code * UChar32 c; * UText *ut = whatever(); * int textLength = utext_nativeLength(ut); * for (c=utext_previous32From(ut, textLength); c>=0; c=utext_previous32(ut)) { * // do whatever with the codepoint c here. * } * \endcode * * Characters and Indexing * * Indexing into text by UText functions is nearly always in terms of the native * indexing of the underlying text storage. The storage format could be UTF-8 * or UTF-32, for example. When coding to the UText access API, no assumptions * can be made regarding the size of characters, or how far an index * may move when iterating between characters. * * All indices supplied to UText functions are pinned to the length of the * text. An out-of-bounds index is not considered to be an error, but is * adjusted to be in the range 0 <= index <= length of input text. * * * When an index position is returned from a UText function, it will be * a native index to the underlying text. In the case of multi-unit characters, * it will always refer to the first position of the character, * never to the interior. This is essentially the same thing as saying that * a returned index will always point to a boundary between characters. * * When a native index is supplied to a UText function, all indices that * refer to any part of a multi-unit character representation are considered * to be equivalent. In the case of multi-unit characters, an incoming index * will be logically normalized to refer to the start of the character. * * It is possible to test whether a native index is on a code point boundary * by doing a utext_setNativeIndex() followed by a utext_getNativeIndex(). * If the index is returned unchanged, it was on a code point boundary. If * an adjusted index is returned, the original index referred to the * interior of a character. * * Conventions for calling UText functions * * Most UText access functions have as their first parameter a (UText *) pointer, * which specifies the UText to be used. Unless otherwise noted, the * pointer must refer to a valid, open UText. Attempting to * use a closed UText or passing a NULL pointer is a programming error and * will produce undefined results or NULL pointer exceptions. * * The UText_Open family of functions can either open an existing (closed) * UText, or heap allocate a new UText. Here is sample code for creating * a stack-allocated UText. * * \code * char *s = whatever(); // A utf-8 string * U_ErrorCode status = U_ZERO_ERROR; * UText ut = UTEXT_INITIALIZER; * utext_openUTF8(ut, s, -1, &status); * if (U_FAILURE(status)) { * // error handling * } else { * // work with the UText * } * \endcode * * Any existing UText passed to an open function _must_ have been initialized, * either by the UTEXT_INITIALIZER, or by having been originally heap-allocated * by an open function. Passing NULL will cause the open function to * heap-allocate and fully initialize a new UText. * */ #include "unicode/utypes.h" #include "unicode/uchar.h" #if U_SHOW_CPLUSPLUS_API #include "unicode/localpointer.h" #include "unicode/rep.h" #include "unicode/unistr.h" #include "unicode/chariter.h" #endif U_CDECL_BEGIN struct UText; typedef struct UText UText; /**< C typedef for struct UText. @stable ICU 3.6 */ /*************************************************************************************** * * C Functions for creating UText wrappers around various kinds of text strings. * ****************************************************************************************/ /** * Close function for UText instances. * Cleans up, releases any resources being held by an open UText. *

* If the UText was originally allocated by one of the utext_open functions, * the storage associated with the utext will also be freed. * If the UText storage originated with the application, as it would with * a local or static instance, the storage will not be deleted. * * An open UText can be reset to refer to new string by using one of the utext_open() * functions without first closing the UText. * * @param ut The UText to be closed. * @return NULL if the UText struct was deleted by the close. If the UText struct * was originally provided by the caller to the open function, it is * returned by this function, and may be safely used again in * a subsequent utext_open. * * @stable ICU 3.4 */ U_STABLE UText * U_EXPORT2 utext_close(UText *ut); #if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN /** * \class LocalUTextPointer * "Smart pointer" class, closes a UText via utext_close(). * For most methods see the LocalPointerBase base class. * * @see LocalPointerBase * @see LocalPointer * @stable ICU 4.4 */ U_DEFINE_LOCAL_OPEN_POINTER(LocalUTextPointer, UText, utext_close); U_NAMESPACE_END #endif /** * Open a read-only UText implementation for UTF-8 strings. * * \htmlonly * Any invalid UTF-8 in the input will be handled in this way: * a sequence of bytes that has the form of a truncated, but otherwise valid, * UTF-8 sequence will be replaced by a single unicode replacement character, \uFFFD. * Any other illegal bytes will each be replaced by a \uFFFD. * \endhtmlonly * * @param ut Pointer to a UText struct. If NULL, a new UText will be created. * If non-NULL, must refer to an initialized UText struct, which will then * be reset to reference the specified UTF-8 string. * @param s A UTF-8 string. Must not be NULL. * @param length The length of the UTF-8 string in bytes, or -1 if the string is * zero terminated. * @param status Errors are returned here. * @return A pointer to the UText. If a pre-allocated UText was provided, it * will always be used and returned. * @stable ICU 3.4 */ U_STABLE UText * U_EXPORT2 utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status); /** * Open a read-only UText for UChar * string. * * @param ut Pointer to a UText struct. If NULL, a new UText will be created. * If non-NULL, must refer to an initialized UText struct, which will then * be reset to reference the specified UChar string. * @param s A UChar (UTF-16) string * @param length The number of UChars in the input string, or -1 if the string is * zero terminated. * @param status Errors are returned here. * @return A pointer to the UText. If a pre-allocated UText was provided, it * will always be used and returned. * @stable ICU 3.4 */ U_STABLE UText * U_EXPORT2 utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status); #if U_SHOW_CPLUSPLUS_API /** * Open a writable UText for a non-const UnicodeString. * * @param ut Pointer to a UText struct. If NULL, a new UText will be created. * If non-NULL, must refer to an initialized UText struct, which will then * be reset to reference the specified input string. * @param s A UnicodeString. * @param status Errors are returned here. * @return Pointer to the UText. If a UText was supplied as input, this * will always be used and returned. * @stable ICU 3.4 */ U_STABLE UText * U_EXPORT2 utext_openUnicodeString(UText *ut, U_NAMESPACE_QUALIFIER UnicodeString *s, UErrorCode *status); /** * Open a UText for a const UnicodeString. The resulting UText will not be writable. * * @param ut Pointer to a UText struct. If NULL, a new UText will be created. * If non-NULL, must refer to an initialized UText struct, which will then * be reset to reference the specified input string. * @param s A const UnicodeString to be wrapped. * @param status Errors are returned here. * @return Pointer to the UText. If a UText was supplied as input, this * will always be used and returned. * @stable ICU 3.4 */ U_STABLE UText * U_EXPORT2 utext_openConstUnicodeString(UText *ut, const U_NAMESPACE_QUALIFIER UnicodeString *s, UErrorCode *status); /** * Open a writable UText implementation for an ICU Replaceable object. * @param ut Pointer to a UText struct. If NULL, a new UText will be created. * If non-NULL, must refer to an already existing UText, which will then * be reset to reference the specified replaceable text. * @param rep A Replaceable text object. * @param status Errors are returned here. * @return Pointer to the UText. If a UText was supplied as input, this * will always be used and returned. * @see Replaceable * @stable ICU 3.4 */ U_STABLE UText * U_EXPORT2 utext_openReplaceable(UText *ut, U_NAMESPACE_QUALIFIER Replaceable *rep, UErrorCode *status); /** * Open a UText implementation over an ICU CharacterIterator. * @param ut Pointer to a UText struct. If NULL, a new UText will be created. * If non-NULL, must refer to an already existing UText, which will then * be reset to reference the specified replaceable text. * @param ci A Character Iterator. * @param status Errors are returned here. * @return Pointer to the UText. If a UText was supplied as input, this * will always be used and returned. * @see Replaceable * @stable ICU 3.4 */ U_STABLE UText * U_EXPORT2 utext_openCharacterIterator(UText *ut, U_NAMESPACE_QUALIFIER CharacterIterator *ic, UErrorCode *status); #endif /** * Clone a UText. This is much like opening a UText where the source text is itself * another UText. * * A deep clone will copy both the UText data structures and the underlying text. * The original and cloned UText will operate completely independently; modifications * made to the text in one will not affect the other. Text providers are not * required to support deep clones. The user of clone() must check the status return * and be prepared to handle failures. * * The standard UText implementations for UTF8, UChar *, UnicodeString and * Replaceable all support deep cloning. * * The UText returned from a deep clone will be writable, assuming that the text * provider is able to support writing, even if the source UText had been made * non-writable by means of UText_freeze(). * * A shallow clone replicates only the UText data structures; it does not make * a copy of the underlying text. Shallow clones can be used as an efficient way to * have multiple iterators active in a single text string that is not being * modified. * * A shallow clone operation will not fail, barring truly exceptional conditions such * as memory allocation failures. * * Shallow UText clones should be avoided if the UText functions that modify the * text are expected to be used, either on the original or the cloned UText. * Any such modifications can cause unpredictable behavior. Read Only * shallow clones provide some protection against errors of this type by * disabling text modification via the cloned UText. * * A shallow clone made with the readOnly parameter == FALSE will preserve the * utext_isWritable() state of the source object. Note, however, that * write operations must be avoided while more than one UText exists that refer * to the same underlying text. * * A UText and its clone may be safely concurrently accessed by separate threads. * This is true for read access only with shallow clones, and for both read and * write access with deep clones. * It is the responsibility of the Text Provider to ensure that this thread safety * constraint is met. * * @param dest A UText struct to be filled in with the result of the clone operation, * or NULL if the clone function should heap-allocate a new UText struct. * If non-NULL, must refer to an already existing UText, which will then * be reset to become the clone. * @param src The UText to be cloned. * @param deep TRUE to request a deep clone, FALSE for a shallow clone. * @param readOnly TRUE to request that the cloned UText have read only access to the * underlying text. * @param status Errors are returned here. For deep clones, U_UNSUPPORTED_ERROR * will be returned if the text provider is unable to clone the * original text. * @return The newly created clone, or NULL if the clone operation failed. * @stable ICU 3.4 */ U_STABLE UText * U_EXPORT2 utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCode *status); /** * Compare two UText objects for equality. * UTexts are equal if they are iterating over the same text, and * have the same iteration position within the text. * If either or both of the parameters are NULL, the comparison is FALSE. * * @param a The first of the two UTexts to compare. * @param b The other UText to be compared. * @return TRUE if the two UTexts are equal. * @stable ICU 3.6 */ U_STABLE UBool U_EXPORT2 utext_equals(const UText *a, const UText *b); /***************************************************************************** * * Functions to work with the text represeted by a UText wrapper * *****************************************************************************/ /** * Get the length of the text. Depending on the characteristics * of the underlying text representation, this may be expensive. * @see utext_isLengthExpensive() * * * @param ut the text to be accessed. * @return the length of the text, expressed in native units. * * @stable ICU 3.4 */ U_STABLE int64_t U_EXPORT2 utext_nativeLength(UText *ut); /** * Return TRUE if calculating the length of the text could be expensive. * Finding the length of NUL terminated strings is considered to be expensive. * * Note that the value of this function may change * as the result of other operations on a UText. * Once the length of a string has been discovered, it will no longer * be expensive to report it. * * @param ut the text to be accessed. * @return TRUE if determining the length of the text could be time consuming. * @stable ICU 3.4 */ U_STABLE UBool U_EXPORT2 utext_isLengthExpensive(const UText *ut); /** * Returns the code point at the requested index, * or U_SENTINEL (-1) if it is out of bounds. * * If the specified index points to the interior of a multi-unit * character - one of the trail bytes of a UTF-8 sequence, for example - * the complete code point will be returned. * * The iteration position will be set to the start of the returned code point. * * This function is roughly equivalent to the the sequence * utext_setNativeIndex(index); * utext_current32(); * (There is a subtle difference if the index is out of bounds by being less than zero - * utext_setNativeIndex(negative value) sets the index to zero, after which utext_current() * will return the char at zero. utext_char32At(negative index), on the other hand, will * return the U_SENTINEL value of -1.) * * @param ut the text to be accessed * @param nativeIndex the native index of the character to be accessed. If the index points * to other than the first unit of a multi-unit character, it will be adjusted * to the start of the character. * @return the code point at the specified index. * @stable ICU 3.4 */ U_STABLE UChar32 U_EXPORT2 utext_char32At(UText *ut, int64_t nativeIndex); /** * * Get the code point at the current iteration position, * or U_SENTINEL (-1) if the iteration has reached the end of * the input text. * * @param ut the text to be accessed. * @return the Unicode code point at the current iterator position. * @stable ICU 3.4 */ U_STABLE UChar32 U_EXPORT2 utext_current32(UText *ut); /** * Get the code point at the current iteration position of the UText, and * advance the position to the first index following the character. * * If the position is at the end of the text (the index following * the last character, which is also the length of the text), * return U_SENTINEL (-1) and do not advance the index. * * This is a post-increment operation. * * An inline macro version of this function, UTEXT_NEXT32(), * is available for performance critical use. * * @param ut the text to be accessed. * @return the Unicode code point at the iteration position. * @see UTEXT_NEXT32 * @stable ICU 3.4 */ U_STABLE UChar32 U_EXPORT2 utext_next32(UText *ut); /** * Move the iterator position to the character (code point) whose * index precedes the current position, and return that character. * This is a pre-decrement operation. * * If the initial position is at the start of the text (index of 0) * return U_SENTINEL (-1), and leave the position unchanged. * * An inline macro version of this function, UTEXT_PREVIOUS32(), * is available for performance critical use. * * @param ut the text to be accessed. * @return the previous UChar32 code point, or U_SENTINEL (-1) * if the iteration has reached the start of the text. * @see UTEXT_PREVIOUS32 * @stable ICU 3.4 */ U_STABLE UChar32 U_EXPORT2 utext_previous32(UText *ut); /** * Set the iteration index and return the code point at that index. * Leave the iteration index at the start of the following code point. * * This function is the most efficient and convenient way to * begin a forward iteration. The results are identical to the those * from the sequence * \code * utext_setIndex(); * utext_next32(); * \endcode * * @param ut the text to be accessed. * @param nativeIndex Iteration index, in the native units of the text provider. * @return Code point which starts at or before index, * or U_SENTINEL (-1) if it is out of bounds. * @stable ICU 3.4 */ U_STABLE UChar32 U_EXPORT2 utext_next32From(UText *ut, int64_t nativeIndex); /** * Set the iteration index, and return the code point preceding the * one specified by the initial index. Leave the iteration position * at the start of the returned code point. * * This function is the most efficient and convenient way to * begin a backwards iteration. * * @param ut the text to be accessed. * @param nativeIndex Iteration index in the native units of the text provider. * @return Code point preceding the one at the initial index, * or U_SENTINEL (-1) if it is out of bounds. * * @stable ICU 3.4 */ U_STABLE UChar32 U_EXPORT2 utext_previous32From(UText *ut, int64_t nativeIndex); /** * Get the current iterator position, which can range from 0 to * the length of the text. * The position is a native index into the input text, in whatever format it * may have (possibly UTF-8 for example), and may not always be the same as * the corresponding UChar (UTF-16) index. * The returned position will always be aligned to a code point boundary. * * @param ut the text to be accessed. * @return the current index position, in the native units of the text provider. * @stable ICU 3.4 */ U_STABLE int64_t U_EXPORT2 utext_getNativeIndex(const UText *ut); /** * Set the current iteration position to the nearest code point * boundary at or preceding the specified index. * The index is in the native units of the original input text. * If the index is out of range, it will be pinned to be within * the range of the input text. *

* It will usually be more efficient to begin an iteration * using the functions utext_next32From() or utext_previous32From() * rather than setIndex(). *

* Moving the index position to an adjacent character is best done * with utext_next32(), utext_previous32() or utext_moveIndex32(). * Attempting to do direct arithmetic on the index position is * complicated by the fact that the size (in native units) of a * character depends on the underlying representation of the character * (UTF-8, UTF-16, UTF-32, arbitrary codepage), and is not * easily knowable. * * @param ut the text to be accessed. * @param nativeIndex the native unit index of the new iteration position. * @stable ICU 3.4 */ U_STABLE void U_EXPORT2 utext_setNativeIndex(UText *ut, int64_t nativeIndex); /** * Move the iterator postion by delta code points. The number of code points * is a signed number; a negative delta will move the iterator backwards, * towards the start of the text. *

* The index is moved by delta code points * forward or backward, but no further backward than to 0 and * no further forward than to utext_nativeLength(). * The resulting index value will be in between 0 and length, inclusive. * * @param ut the text to be accessed. * @param delta the signed number of code points to move the iteration position. * @return TRUE if the position could be moved the requested number of positions while * staying within the range [0 - text length]. * @stable ICU 3.4 */ U_STABLE UBool U_EXPORT2 utext_moveIndex32(UText *ut, int32_t delta); /** * Get the native index of the character preceeding the current position. * If the iteration position is already at the start of the text, zero * is returned. * The value returned is the same as that obtained from the following sequence, * but without the side effect of changing the iteration position. * * \code * UText *ut = whatever; * ... * utext_previous(ut) * utext_getNativeIndex(ut); * \endcode * * This function is most useful during forwards iteration, where it will get the * native index of the character most recently returned from utext_next(). * * @param ut the text to be accessed * @return the native index of the character preceeding the current index position, * or zero if the current position is at the start of the text. * @stable ICU 3.6 */ U_STABLE int64_t U_EXPORT2 utext_getPreviousNativeIndex(UText *ut); /** * * Extract text from a UText into a UChar buffer. The range of text to be extracted * is specified in the native indices of the UText provider. These may not necessarily * be UTF-16 indices. *

* The size (number of 16 bit UChars) of the data to be extracted is returned. The * full number of UChars is returned, even when the extracted text is truncated * because the specified buffer size is too small. *

* The extracted string will (if you are a user) / must (if you are a text provider) * be NUL-terminated if there is sufficient space in the destination buffer. This * terminating NUL is not included in the returned length. *

* The iteration index is left at the position following the last extracted character. * * @param ut the UText from which to extract data. * @param nativeStart the native index of the first character to extract.\ * If the specified index is out of range, * it will be pinned to to be within 0 <= index <= textLength * @param nativeLimit the native string index of the position following the last * character to extract. If the specified index is out of range, * it will be pinned to to be within 0 <= index <= textLength. * nativeLimit must be >= nativeStart. * @param dest the UChar (UTF-16) buffer into which the extracted text is placed * @param destCapacity The size, in UChars, of the destination buffer. May be zero * for precomputing the required size. * @param status receives any error status. * U_BUFFER_OVERFLOW_ERROR: the extracted text was truncated because the * buffer was too small. Returns number of UChars for preflighting. * @return Number of UChars in the data to be extracted. Does not include a trailing NUL. * * @stable ICU 3.4 */ U_STABLE int32_t U_EXPORT2 utext_extract(UText *ut, int64_t nativeStart, int64_t nativeLimit, UChar *dest, int32_t destCapacity, UErrorCode *status); /** * Compare two UTexts (binary order). The comparison begins at each source text's * iteration position. The iteration position of each UText will be left following * the last character compared. * * The comparison is done in code point order; unlike u_strCompare, you * cannot choose to use code unit order. This is because the characters * in a UText are accessed one code point at a time, and may not be from a UTF-16 * context. * * This functions works with strings of different explicitly specified lengths * unlike the ANSI C-like u_strcmp() and u_memcmp() etc. * A length argument of -1 signifies that as much of the string should be used as * is necessary to compare with the other string. If both length arguments are -1, * the entire remaining portionss of both strings are used. * * @param s1 First source string. * @param length1 Length of first source string in UTF-32 code points. * * @param s2 Second source string. * @param length2 Length of second source string in UTF-32 code points. * * @return <0 or 0 or >0 as usual for string comparisons * * @internal ICU 4.4 technology preview */ U_INTERNAL int32_t U_EXPORT2 utext_compare(UText *s1, int32_t length1, UText *s2, int32_t length2); /** * Compare two UTexts (binary order). The comparison begins at each source text's * iteration position. The iteration position of each UText will be left following * the last character compared. This method differs from utext_compare in that * it accepts native limits rather than lengths for each string. * * The comparison is done in code point order; unlike u_strCompare, you * cannot choose to use code unit order. This is because the characters * in a UText are accessed one code point at a time, and may not be from a UTF-16 * context. * * This functions works with strings of different explicitly specified lengths * unlike the ANSI C-like u_strcmp() and u_memcmp() etc. * A limit argument of -1 signifies that as much of the string should be used as * is necessary to compare with the other string. If both limit arguments are -1, * the entire remaining portionss of both strings are used. * * @param s1 First source string. * @param limit1 Native index of the last character in the first source string to be considered. * * @param s2 Second source string. * @param limit2 Native index of the last character in the second source string to be considered. * * @return <0 or 0 or >0 as usual for string comparisons * * @internal ICU 4.4 technology preview */ U_INTERNAL int32_t U_EXPORT2 utext_compareNativeLimit(UText *s1, int64_t limit1, UText *s2, int64_t limit2); /** * Compare two UTexts case-insensitively using full case folding. The comparison * begins at each source text's iteration position. The iteration position of each * UText will be left following the last character compared. * * The comparison is done in code point order; this is because the characters * in a UText are accessed one code point at a time, and may not be from a UTF-16 * context. * * This functions works with strings of different explicitly specified lengths * unlike the ANSI C-like u_strcmp() and u_memcmp() etc. * A length argument of -1 signifies that as much of the string should be used as * is necessary to compare with the other string. If both length arguments are -1, * the entire remaining portionss of both strings are used. * * @param s1 First source string. * @param length1 Length of first source string in UTF-32 code points. * * @param s2 Second source string. * @param length2 Length of second source string in UTF-32 code points. * * @param options A bit set of options: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: * Comparison in code point order with default case folding. * * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * * @return <0 or 0 or >0 as usual for string comparisons * * @internal ICU 4.4 technology preview */ U_INTERNAL int32_t U_EXPORT2 utext_caseCompare(UText *s1, int32_t length1, UText *s2, int32_t length2, uint32_t options, UErrorCode *pErrorCode); /** * Compare two UTexts case-insensitively using full case folding. The comparison * begins at each source text's iteration position. The iteration position of each * UText will be left following the last character compared. This method differs from * utext_caseCompare in that it accepts native limits rather than lengths for each * string. * * The comparison is done in code point order; this is because the characters * in a UText are accessed one code point at a time, and may not be from a UTF-16 * context. * * This functions works with strings of different explicitly specified lengths * unlike the ANSI C-like u_strcmp() and u_memcmp() etc. * A limit argument of -1 signifies that as much of the string should be used as * is necessary to compare with the other string. If both length arguments are -1, * the entire remaining portionss of both strings are used. * * @param s1 First source string. * @param limit1 Native index of the last character in the first source string to be considered. * * @param s2 Second source string. * @param limit2 Native index of the last character in the second source string to be considered. * * @param options A bit set of options: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: * Comparison in code point order with default case folding. * * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * * @return <0 or 0 or >0 as usual for string comparisons * * @internal ICU 4.4 technology preview */ U_INTERNAL int32_t U_EXPORT2 utext_caseCompareNativeLimit(UText *s1, int64_t limit1, UText *s2, int64_t limit2, uint32_t options, UErrorCode *pErrorCode); /************************************************************************************ * * #define inline versions of selected performance-critical text access functions * Caution: do not use auto increment++ or decrement-- expressions * as parameters to these macros. * * For most use, where there is no extreme performance constraint, the * normal, non-inline functions are a better choice. The resulting code * will be smaller, and, if the need ever arises, easier to debug. * * These are implemented as #defines rather than real functions * because there is no fully portable way to do inline functions in plain C. * ************************************************************************************/ /** * inline version of utext_current32(), for performance-critical situations. * * Get the code point at the current iteration position of the UText. * Returns U_SENTINEL (-1) if the position is at the end of the * text. * * @internal ICU 4.4 technology preview */ #define UTEXT_CURRENT32(ut) \ ((ut)->chunkOffset < (ut)->chunkLength && ((ut)->chunkContents)[(ut)->chunkOffset]<0xd800 ? \ ((ut)->chunkContents)[((ut)->chunkOffset)] : utext_current32(ut)) /** * inline version of utext_next32(), for performance-critical situations. * * Get the code point at the current iteration position of the UText, and * advance the position to the first index following the character. * This is a post-increment operation. * Returns U_SENTINEL (-1) if the position is at the end of the * text. * * @stable ICU 3.4 */ #define UTEXT_NEXT32(ut) \ ((ut)->chunkOffset < (ut)->chunkLength && ((ut)->chunkContents)[(ut)->chunkOffset]<0xd800 ? \ ((ut)->chunkContents)[((ut)->chunkOffset)++] : utext_next32(ut)) /** * inline version of utext_previous32(), for performance-critical situations. * * Move the iterator position to the character (code point) whose * index precedes the current position, and return that character. * This is a pre-decrement operation. * Returns U_SENTINEL (-1) if the position is at the start of the text. * * @stable ICU 3.4 */ #define UTEXT_PREVIOUS32(ut) \ ((ut)->chunkOffset > 0 && \ (ut)->chunkContents[(ut)->chunkOffset-1] < 0xd800 ? \ (ut)->chunkContents[--((ut)->chunkOffset)] : utext_previous32(ut)) /** * inline version of utext_getNativeIndex(), for performance-critical situations. * * Get the current iterator position, which can range from 0 to * the length of the text. * The position is a native index into the input text, in whatever format it * may have (possibly UTF-8 for example), and may not always be the same as * the corresponding UChar (UTF-16) index. * The returned position will always be aligned to a code point boundary. * * @stable ICU 3.6 */ #define UTEXT_GETNATIVEINDEX(ut) \ ((ut)->chunkOffset <= (ut)->nativeIndexingLimit? \ (ut)->chunkNativeStart+(ut)->chunkOffset : \ (ut)->pFuncs->mapOffsetToNative(ut)) /** * inline version of utext_setNativeIndex(), for performance-critical situations. * * Set the current iteration position to the nearest code point * boundary at or preceding the specified index. * The index is in the native units of the original input text. * If the index is out of range, it will be pinned to be within * the range of the input text. * * @stable ICU 3.8 */ #define UTEXT_SETNATIVEINDEX(ut, ix) \ { int64_t __offset = (ix) - (ut)->chunkNativeStart; \ if (__offset>=0 && __offset<=(int64_t)(ut)->nativeIndexingLimit) { \ (ut)->chunkOffset=(int32_t)__offset; \ } else { \ utext_setNativeIndex((ut), (ix)); } } /************************************************************************************ * * Functions related to writing or modifying the text. * These will work only with modifiable UTexts. Attempting to * modify a read-only UText will return an error status. * ************************************************************************************/ /** * Return TRUE if the text can be written (modified) with utext_replace() or * utext_copy(). For the text to be writable, the text provider must * be of a type that supports writing and the UText must not be frozen. * * Attempting to modify text when utext_isWriteable() is FALSE will fail - * the text will not be modified, and an error will be returned from the function * that attempted the modification. * * @param ut the UText to be tested. * @return TRUE if the text is modifiable. * * @see utext_freeze() * @see utext_replace() * @see utext_copy() * @stable ICU 3.4 * */ U_STABLE UBool U_EXPORT2 utext_isWritable(const UText *ut); /** * Test whether there is meta data associated with the text. * @see Replaceable::hasMetaData() * * @param ut The UText to be tested * @return TRUE if the underlying text includes meta data. * @stable ICU 3.4 */ U_STABLE UBool U_EXPORT2 utext_hasMetaData(const UText *ut); /** * Replace a range of the original text with a replacement text. * * Leaves the current iteration position at the position following the * newly inserted replacement text. * * This function is only available on UText types that support writing, * that is, ones where utext_isWritable() returns TRUE. * * When using this function, there should be only a single UText opened onto the * underlying native text string. Behavior after a replace operation * on a UText is undefined for any other additional UTexts that refer to the * modified string. * * @param ut the UText representing the text to be operated on. * @param nativeStart the native index of the start of the region to be replaced * @param nativeLimit the native index of the character following the region to be replaced. * @param replacementText pointer to the replacement text * @param replacementLength length of the replacement text, or -1 if the text is NUL terminated. * @param status receives any error status. Possible errors include * U_NO_WRITE_PERMISSION * * @return The signed number of (native) storage units by which * the length of the text expanded or contracted. * * @stable ICU 3.4 */ U_STABLE int32_t U_EXPORT2 utext_replace(UText *ut, int64_t nativeStart, int64_t nativeLimit, const UChar *replacementText, int32_t replacementLength, UErrorCode *status); /** * * Copy or move a substring from one position to another within the text, * while retaining any metadata associated with the text. * This function is used to duplicate or reorder substrings. * The destination index must not overlap the source range. * * The text to be copied or moved is inserted at destIndex; * it does not replace or overwrite any existing text. * * The iteration position is left following the newly inserted text * at the destination position. * * This function is only available on UText types that support writing, * that is, ones where utext_isWritable() returns TRUE. * * When using this function, there should be only a single UText opened onto the * underlying native text string. Behavior after a copy operation * on a UText is undefined in any other additional UTexts that refer to the * modified string. * * @param ut The UText representing the text to be operated on. * @param nativeStart The native index of the start of the region to be copied or moved * @param nativeLimit The native index of the character position following the region * to be copied. * @param destIndex The native destination index to which the source substring is * copied or moved. * @param move If TRUE, then the substring is moved, not copied/duplicated. * @param status receives any error status. Possible errors include U_NO_WRITE_PERMISSION * * @stable ICU 3.4 */ U_STABLE void U_EXPORT2 utext_copy(UText *ut, int64_t nativeStart, int64_t nativeLimit, int64_t destIndex, UBool move, UErrorCode *status); /** *

* Freeze a UText. This prevents any modification to the underlying text itself * by means of functions operating on this UText. *

*

* Once frozen, a UText can not be unfrozen. The intent is to ensure * that a the text underlying a frozen UText wrapper cannot be modified via that UText. *

*

* Caution: freezing a UText will disable changes made via the specific * frozen UText wrapper only; it will not have any effect on the ability to * directly modify the text by bypassing the UText. Any such backdoor modifications * are always an error while UText access is occuring because the underlying * text can get out of sync with UText's buffering. *

* * @param ut The UText to be frozen. * @see utext_isWritable() * @stable ICU 3.6 */ U_STABLE void U_EXPORT2 utext_freeze(UText *ut); /** * UText provider properties (bit field indexes). * * @see UText * @stable ICU 3.4 */ enum { /** * It is potentially time consuming for the provider to determine the length of the text. * @stable ICU 3.4 */ UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE = 1, /** * Text chunks remain valid and usable until the text object is modified or * deleted, not just until the next time the access() function is called * (which is the default). * @stable ICU 3.4 */ UTEXT_PROVIDER_STABLE_CHUNKS = 2, /** * The provider supports modifying the text via the replace() and copy() * functions. * @see Replaceable * @stable ICU 3.4 */ UTEXT_PROVIDER_WRITABLE = 3, /** * There is meta data associated with the text. * @see Replaceable::hasMetaData() * @stable ICU 3.4 */ UTEXT_PROVIDER_HAS_META_DATA = 4, /** * Text provider owns the text storage. * Generally occurs as the result of a deep clone of the UText. * When closing the UText, the associated text must * also be closed/deleted/freed/ whatever is appropriate. * @stable ICU 3.6 */ UTEXT_PROVIDER_OWNS_TEXT = 5 }; /** * Function type declaration for UText.clone(). * * clone a UText. Much like opening a UText where the source text is itself * another UText. * * A deep clone will copy both the UText data structures and the underlying text. * The original and cloned UText will operate completely independently; modifications * made to the text in one will not effect the other. Text providers are not * required to support deep clones. The user of clone() must check the status return * and be prepared to handle failures. * * A shallow clone replicates only the UText data structures; it does not make * a copy of the underlying text. Shallow clones can be used as an efficient way to * have multiple iterators active in a single text string that is not being * modified. * * A shallow clone operation must not fail except for truly exceptional conditions such * as memory allocation failures. * * A UText and its clone may be safely concurrently accessed by separate threads. * This is true for both shallow and deep clones. * It is the responsibility of the Text Provider to ensure that this thread safety * constraint is met. * * @param dest A UText struct to be filled in with the result of the clone operation, * or NULL if the clone function should heap-allocate a new UText struct. * @param src The UText to be cloned. * @param deep TRUE to request a deep clone, FALSE for a shallow clone. * @param status Errors are returned here. For deep clones, U_UNSUPPORTED_ERROR * should be returned if the text provider is unable to clone the * original text. * @return The newly created clone, or NULL if the clone operation failed. * * @stable ICU 3.4 */ typedef UText * U_CALLCONV UTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status); /** * Function type declaration for UText.nativeLength(). * * @param ut the UText to get the length of. * @return the length, in the native units of the original text string. * @see UText * @stable ICU 3.4 */ typedef int64_t U_CALLCONV UTextNativeLength(UText *ut); /** * Function type declaration for UText.access(). Get the description of the text chunk * containing the text at a requested native index. The UText's iteration * position will be left at the requested index. If the index is out * of bounds, the iteration position will be left at the start or end * of the string, as appropriate. * * Chunks must begin and end on code point boundaries. A single code point * comprised of multiple storage units must never span a chunk boundary. * * * @param ut the UText being accessed. * @param nativeIndex Requested index of the text to be accessed. * @param forward If TRUE, then the returned chunk must contain text * starting from the index, so that start<=index * The size (number of 16 bit UChars) in the data to be extracted is returned. The * full amount is returned, even when the specified buffer size is smaller. *

* The extracted string will (if you are a user) / must (if you are a text provider) * be NUL-terminated if there is sufficient space in the destination buffer. * * @param ut the UText from which to extract data. * @param nativeStart the native index of the first characer to extract. * @param nativeLimit the native string index of the position following the last * character to extract. * @param dest the UChar (UTF-16) buffer into which the extracted text is placed * @param destCapacity The size, in UChars, of the destination buffer. May be zero * for precomputing the required size. * @param status receives any error status. * If U_BUFFER_OVERFLOW_ERROR: Returns number of UChars for * preflighting. * @return Number of UChars in the data. Does not include a trailing NUL. * * @stable ICU 3.4 */ typedef int32_t U_CALLCONV UTextExtract(UText *ut, int64_t nativeStart, int64_t nativeLimit, UChar *dest, int32_t destCapacity, UErrorCode *status); /** * Function type declaration for UText.replace(). * * Replace a range of the original text with a replacement text. * * Leaves the current iteration position at the position following the * newly inserted replacement text. * * This function need only be implemented on UText types that support writing. * * When using this function, there should be only a single UText opened onto the * underlying native text string. The function is responsible for updating the * text chunk within the UText to reflect the updated iteration position, * taking into account any changes to the underlying string's structure caused * by the replace operation. * * @param ut the UText representing the text to be operated on. * @param nativeStart the index of the start of the region to be replaced * @param nativeLimit the index of the character following the region to be replaced. * @param replacementText pointer to the replacement text * @param replacmentLength length of the replacement text in UChars, or -1 if the text is NUL terminated. * @param status receives any error status. Possible errors include * U_NO_WRITE_PERMISSION * * @return The signed number of (native) storage units by which * the length of the text expanded or contracted. * * @stable ICU 3.4 */ typedef int32_t U_CALLCONV UTextReplace(UText *ut, int64_t nativeStart, int64_t nativeLimit, const UChar *replacementText, int32_t replacmentLength, UErrorCode *status); /** * Function type declaration for UText.copy(). * * Copy or move a substring from one position to another within the text, * while retaining any metadata associated with the text. * This function is used to duplicate or reorder substrings. * The destination index must not overlap the source range. * * The text to be copied or moved is inserted at destIndex; * it does not replace or overwrite any existing text. * * This function need only be implemented for UText types that support writing. * * When using this function, there should be only a single UText opened onto the * underlying native text string. The function is responsible for updating the * text chunk within the UText to reflect the updated iteration position, * taking into account any changes to the underlying string's structure caused * by the replace operation. * * @param ut The UText representing the text to be operated on. * @param nativeStart The index of the start of the region to be copied or moved * @param nativeLimit The index of the character following the region to be replaced. * @param nativeDest The destination index to which the source substring is copied or moved. * @param move If TRUE, then the substring is moved, not copied/duplicated. * @param status receives any error status. Possible errors include U_NO_WRITE_PERMISSION * * @stable ICU 3.4 */ typedef void U_CALLCONV UTextCopy(UText *ut, int64_t nativeStart, int64_t nativeLimit, int64_t nativeDest, UBool move, UErrorCode *status); /** * Function type declaration for UText.mapOffsetToNative(). * Map from the current UChar offset within the current text chunk to * the corresponding native index in the original source text. * * This is required only for text providers that do not use native UTF-16 indexes. * * @param ut the UText. * @return Absolute (native) index corresponding to chunkOffset in the current chunk. * The returned native index should always be to a code point boundary. * * @stable ICU 3.4 */ typedef int64_t U_CALLCONV UTextMapOffsetToNative(const UText *ut); /** * Function type declaration for UText.mapIndexToUTF16(). * Map from a native index to a UChar offset within a text chunk. * Behavior is undefined if the native index does not fall within the * current chunk. * * This function is required only for text providers that do not use native UTF-16 indexes. * * @param ut The UText containing the text chunk. * @param nativeIndex Absolute (native) text index, chunk->start<=index<=chunk->limit. * @return Chunk-relative UTF-16 offset corresponding to the specified native * index. * * @stable ICU 3.4 */ typedef int32_t U_CALLCONV UTextMapNativeIndexToUTF16(const UText *ut, int64_t nativeIndex); /** * Function type declaration for UText.utextClose(). * * A Text Provider close function is only required for provider types that make * allocations in their open function (or other functions) that must be * cleaned when the UText is closed. * * The allocation of the UText struct itself and any "extra" storage * associated with the UText is handled by the common UText implementation * and does not require provider specific cleanup in a close function. * * Most UText provider implementations do not need to implement this function. * * @param ut A UText object to be closed. * * @stable ICU 3.4 */ typedef void U_CALLCONV UTextClose(UText *ut); /** * (public) Function dispatch table for UText. * Conceptually very much like a C++ Virtual Function Table. * This struct defines the organization of the table. * Each text provider implementation must provide an * actual table that is initialized with the appropriate functions * for the type of text being handled. * @stable ICU 3.6 */ struct UTextFuncs { /** * (public) Function table size, sizeof(UTextFuncs) * Intended for use should the table grow to accomodate added * functions in the future, to allow tests for older format * function tables that do not contain the extensions. * * Fields are placed for optimal alignment on * 32/64/128-bit-pointer machines, by normally grouping together * 4 32-bit fields, * 4 pointers, * 2 64-bit fields * in sequence. * @stable ICU 3.6 */ int32_t tableSize; /** * (private) Alignment padding. * Do not use, reserved for use by the UText framework only. * @internal */ int32_t reserved1, /** @internal */ reserved2, /** @internal */ reserved3; /** * (public) Function pointer for UTextClone * * @see UTextClone * @stable ICU 3.6 */ UTextClone *clone; /** * (public) function pointer for UTextLength * May be expensive to compute! * * @see UTextLength * @stable ICU 3.6 */ UTextNativeLength *nativeLength; /** * (public) Function pointer for UTextAccess. * * @see UTextAccess * @stable ICU 3.6 */ UTextAccess *access; /** * (public) Function pointer for UTextExtract. * * @see UTextExtract * @stable ICU 3.6 */ UTextExtract *extract; /** * (public) Function pointer for UTextReplace. * * @see UTextReplace * @stable ICU 3.6 */ UTextReplace *replace; /** * (public) Function pointer for UTextCopy. * * @see UTextCopy * @stable ICU 3.6 */ UTextCopy *copy; /** * (public) Function pointer for UTextMapOffsetToNative. * * @see UTextMapOffsetToNative * @stable ICU 3.6 */ UTextMapOffsetToNative *mapOffsetToNative; /** * (public) Function pointer for UTextMapNativeIndexToUTF16. * * @see UTextMapNativeIndexToUTF16 * @stable ICU 3.6 */ UTextMapNativeIndexToUTF16 *mapNativeIndexToUTF16; /** * (public) Function pointer for UTextClose. * * @see UTextClose * @stable ICU 3.6 */ UTextClose *close; /** * (private) Spare function pointer * @internal */ UTextClose *spare1; /** * (private) Spare function pointer * @internal */ UTextClose *spare2; /** * (private) Spare function pointer * @internal */ UTextClose *spare3; }; /** * Function dispatch table for UText * @see UTextFuncs */ typedef struct UTextFuncs UTextFuncs; /** * UText struct. Provides the interface between the generic UText access code * and the UText provider code that works on specific kinds of * text (UTF-8, noncontiguous UTF-16, whatever.) * * Applications that are using predefined types of text providers * to pass text data to ICU services will have no need to view the * internals of the UText structs that they open. * * @stable ICU 3.6 */ struct UText { /** * (private) Magic. Used to help detect when UText functions are handed * invalid or unitialized UText structs. * utext_openXYZ() functions take an initialized, * but not necessarily open, UText struct as an * optional fill-in parameter. This magic field * is used to check for that initialization. * Text provider close functions must NOT clear * the magic field because that would prevent * reuse of the UText struct. * @internal */ uint32_t magic; /** * (private) Flags for managing the allocation and freeing of * memory associated with this UText. * @internal */ int32_t flags; /** * Text provider properties. This set of flags is maintainted by the * text provider implementation. * @stable ICU 3.4 */ int32_t providerProperties; /** * (public) sizeOfStruct=sizeof(UText) * Allows possible backward compatible extension. * * @stable ICU 3.4 */ int32_t sizeOfStruct; /* ------ 16 byte alignment boundary ----------- */ /** * (protected) Native index of the first character position following * the current chunk. * @stable ICU 3.6 */ int64_t chunkNativeLimit; /** * (protected) Size in bytes of the extra space (pExtra). * @stable ICU 3.4 */ int32_t extraSize; /** * (protected) The highest chunk offset where native indexing and * chunk (UTF-16) indexing correspond. For UTF-16 sources, value * will be equal to chunkLength. * * @stable ICU 3.6 */ int32_t nativeIndexingLimit; /* ---- 16 byte alignment boundary------ */ /** * (protected) Native index of the first character in the text chunk. * @stable ICU 3.6 */ int64_t chunkNativeStart; /** * (protected) Current iteration position within the text chunk (UTF-16 buffer). * This is the index to the character that will be returned by utext_next32(). * @stable ICU 3.6 */ int32_t chunkOffset; /** * (protected) Length the text chunk (UTF-16 buffer), in UChars. * @stable ICU 3.6 */ int32_t chunkLength; /* ---- 16 byte alignment boundary-- */ /** * (protected) pointer to a chunk of text in UTF-16 format. * May refer either to original storage of the source of the text, or * if conversion was required, to a buffer owned by the UText. * @stable ICU 3.6 */ const UChar *chunkContents; /** * (public) Pointer to Dispatch table for accessing functions for this UText. * @stable ICU 3.6 */ const UTextFuncs *pFuncs; /** * (protected) Pointer to additional space requested by the * text provider during the utext_open operation. * @stable ICU 3.4 */ void *pExtra; /** * (protected) Pointer to string or text-containin object or similar. * This is the source of the text that this UText is wrapping, in a format * that is known to the text provider functions. * @stable ICU 3.4 */ const void *context; /* --- 16 byte alignment boundary--- */ /** * (protected) Pointer fields available for use by the text provider. * Not used by UText common code. * @stable ICU 3.6 */ const void *p; /** * (protected) Pointer fields available for use by the text provider. * Not used by UText common code. * @stable ICU 3.6 */ const void *q; /** * (protected) Pointer fields available for use by the text provider. * Not used by UText common code. * @stable ICU 3.6 */ const void *r; /** * Private field reserved for future use by the UText framework * itself. This is not to be touched by the text providers. * @internal ICU 3.4 */ void *privP; /* --- 16 byte alignment boundary--- */ /** * (protected) Integer field reserved for use by the text provider. * Not used by the UText framework, or by the client (user) of the UText. * @stable ICU 3.4 */ int64_t a; /** * (protected) Integer field reserved for use by the text provider. * Not used by the UText framework, or by the client (user) of the UText. * @stable ICU 3.4 */ int32_t b; /** * (protected) Integer field reserved for use by the text provider. * Not used by the UText framework, or by the client (user) of the UText. * @stable ICU 3.4 */ int32_t c; /* ---- 16 byte alignment boundary---- */ /** * Private field reserved for future use by the UText framework * itself. This is not to be touched by the text providers. * @internal ICU 3.4 */ int64_t privA; /** * Private field reserved for future use by the UText framework * itself. This is not to be touched by the text providers. * @internal ICU 3.4 */ int32_t privB; /** * Private field reserved for future use by the UText framework * itself. This is not to be touched by the text providers. * @internal ICU 3.4 */ int32_t privC; }; /** * Common function for use by Text Provider implementations to allocate and/or initialize * a new UText struct. To be called in the implementation of utext_open() functions. * If the supplied UText parameter is null, a new UText struct will be allocated on the heap. * If the supplied UText is already open, the provider's close function will be called * so that the struct can be reused by the open that is in progress. * * @param ut pointer to a UText struct to be re-used, or null if a new UText * should be allocated. * @param extraSpace The amount of additional space to be allocated as part * of this UText, for use by types of providers that require * additional storage. * @param status Errors are returned here. * @return pointer to the UText, allocated if necessary, with extra space set up if requested. * @stable ICU 3.4 */ U_STABLE UText * U_EXPORT2 utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status); /** * @internal * Value used to help identify correctly initialized UText structs. * Note: must be publicly visible so that UTEXT_INITIALIZER can access it. */ enum { UTEXT_MAGIC = 0x345ad82c }; /** * initializer to be used with local (stack) instances of a UText * struct. UText structs must be initialized before passing * them to one of the utext_open functions. * * @stable ICU 3.6 */ #define UTEXT_INITIALIZER { \ UTEXT_MAGIC, /* magic */ \ 0, /* flags */ \ 0, /* providerProps */ \ sizeof(UText), /* sizeOfStruct */ \ 0, /* chunkNativeLimit */ \ 0, /* extraSize */ \ 0, /* nativeIndexingLimit */ \ 0, /* chunkNativeStart */ \ 0, /* chunkOffset */ \ 0, /* chunkLength */ \ NULL, /* chunkContents */ \ NULL, /* pFuncs */ \ NULL, /* pExtra */ \ NULL, /* context */ \ NULL, NULL, NULL, /* p, q, r */ \ NULL, /* privP */ \ 0, 0, 0, /* a, b, c */ \ 0, 0, 0 /* privA,B,C, */ \ } U_CDECL_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/utf16.h0000644000015700001700000004452612200324306024074 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * * Copyright (C) 1999-2010, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: utf16.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 1999sep09 * created by: Markus W. Scherer */ /** * \file * \brief C API: 16-bit Unicode handling macros * * This file defines macros to deal with 16-bit Unicode (UTF-16) code units and strings. * utf16.h is included by utf.h after unicode/umachine.h * and some common definitions. * * For more information see utf.h and the ICU User Guide Strings chapter * (http://icu-project.org/userguide/strings.html). * * Usage: * ICU coding guidelines for if() statements should be followed when using these macros. * Compound statements (curly braces {}) must be used for if-else-while... * bodies and all macro statements should be terminated with semicolon. */ #ifndef __UTF16_H__ #define __UTF16_H__ /* utf.h must be included first. */ #ifndef __UTF_H__ # include "unicode/utf.h" #endif /* single-code point definitions -------------------------------------------- */ /** * Does this code unit alone encode a code point (BMP, not a surrogate)? * @param c 16-bit code unit * @return TRUE or FALSE * @stable ICU 2.4 */ #define U16_IS_SINGLE(c) !U_IS_SURROGATE(c) /** * Is this code unit a lead surrogate (U+d800..U+dbff)? * @param c 16-bit code unit * @return TRUE or FALSE * @stable ICU 2.4 */ #define U16_IS_LEAD(c) (((c)&0xfffffc00)==0xd800) /** * Is this code unit a trail surrogate (U+dc00..U+dfff)? * @param c 16-bit code unit * @return TRUE or FALSE * @stable ICU 2.4 */ #define U16_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00) /** * Is this code unit a surrogate (U+d800..U+dfff)? * @param c 16-bit code unit * @return TRUE or FALSE * @stable ICU 2.4 */ #define U16_IS_SURROGATE(c) U_IS_SURROGATE(c) /** * Assuming c is a surrogate code point (U16_IS_SURROGATE(c)), * is it a lead surrogate? * @param c 16-bit code unit * @return TRUE or FALSE * @stable ICU 2.4 */ #define U16_IS_SURROGATE_LEAD(c) (((c)&0x400)==0) /** * Assuming c is a surrogate code point (U16_IS_SURROGATE(c)), * is it a trail surrogate? * @param c 16-bit code unit * @return TRUE or FALSE * @stable ICU 4.2 */ #define U16_IS_SURROGATE_TRAIL(c) (((c)&0x400)!=0) /** * Helper constant for U16_GET_SUPPLEMENTARY. * @internal */ #define U16_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000) /** * Get a supplementary code point value (U+10000..U+10ffff) * from its lead and trail surrogates. * The result is undefined if the input values are not * lead and trail surrogates. * * @param lead lead surrogate (U+d800..U+dbff) * @param trail trail surrogate (U+dc00..U+dfff) * @return supplementary code point (U+10000..U+10ffff) * @stable ICU 2.4 */ #define U16_GET_SUPPLEMENTARY(lead, trail) \ (((UChar32)(lead)<<10UL)+(UChar32)(trail)-U16_SURROGATE_OFFSET) /** * Get the lead surrogate (0xd800..0xdbff) for a * supplementary code point (0x10000..0x10ffff). * @param supplementary 32-bit code point (U+10000..U+10ffff) * @return lead surrogate (U+d800..U+dbff) for supplementary * @stable ICU 2.4 */ #define U16_LEAD(supplementary) (UChar)(((supplementary)>>10)+0xd7c0) /** * Get the trail surrogate (0xdc00..0xdfff) for a * supplementary code point (0x10000..0x10ffff). * @param supplementary 32-bit code point (U+10000..U+10ffff) * @return trail surrogate (U+dc00..U+dfff) for supplementary * @stable ICU 2.4 */ #define U16_TRAIL(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00) /** * How many 16-bit code units are used to encode this Unicode code point? (1 or 2) * The result is not defined if c is not a Unicode code point (U+0000..U+10ffff). * @param c 32-bit code point * @return 1 or 2 * @stable ICU 2.4 */ #define U16_LENGTH(c) ((uint32_t)(c)<=0xffff ? 1 : 2) /** * The maximum number of 16-bit code units per Unicode code point (U+0000..U+10ffff). * @return 2 * @stable ICU 2.4 */ #define U16_MAX_LENGTH 2 /** * Get a code point from a string at a random-access offset, * without changing the offset. * "Unsafe" macro, assumes well-formed UTF-16. * * The offset may point to either the lead or trail surrogate unit * for a supplementary code point, in which case the macro will read * the adjacent matching surrogate as well. * The result is undefined if the offset points to a single, unpaired surrogate. * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT. * * @param s const UChar * string * @param i string offset * @param c output UChar32 variable * @see U16_GET * @stable ICU 2.4 */ #define U16_GET_UNSAFE(s, i, c) { \ (c)=(s)[i]; \ if(U16_IS_SURROGATE(c)) { \ if(U16_IS_SURROGATE_LEAD(c)) { \ (c)=U16_GET_SUPPLEMENTARY((c), (s)[(i)+1]); \ } else { \ (c)=U16_GET_SUPPLEMENTARY((s)[(i)-1], (c)); \ } \ } \ } /** * Get a code point from a string at a random-access offset, * without changing the offset. * "Safe" macro, handles unpaired surrogates and checks for string boundaries. * * The offset may point to either the lead or trail surrogate unit * for a supplementary code point, in which case the macro will read * the adjacent matching surrogate as well. * If the offset points to a single, unpaired surrogate, then that itself * will be returned as the code point. * Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT. * * @param s const UChar * string * @param start starting string offset (usually 0) * @param i string offset, must be start<=i(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \ (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \ } \ } \ } \ } /* definitions with forward iteration --------------------------------------- */ /** * Get a code point from a string at a code point boundary offset, * and advance the offset to the next code point boundary. * (Post-incrementing forward iteration.) * "Unsafe" macro, assumes well-formed UTF-16. * * The offset may point to the lead surrogate unit * for a supplementary code point, in which case the macro will read * the following trail surrogate as well. * If the offset points to a trail surrogate, then that itself * will be returned as the code point. * The result is undefined if the offset points to a single, unpaired lead surrogate. * * @param s const UChar * string * @param i string offset * @param c output UChar32 variable * @see U16_NEXT * @stable ICU 2.4 */ #define U16_NEXT_UNSAFE(s, i, c) { \ (c)=(s)[(i)++]; \ if(U16_IS_LEAD(c)) { \ (c)=U16_GET_SUPPLEMENTARY((c), (s)[(i)++]); \ } \ } /** * Get a code point from a string at a code point boundary offset, * and advance the offset to the next code point boundary. * (Post-incrementing forward iteration.) * "Safe" macro, handles unpaired surrogates and checks for string boundaries. * * The offset may point to the lead surrogate unit * for a supplementary code point, in which case the macro will read * the following trail surrogate as well. * If the offset points to a trail surrogate or * to a single, unpaired lead surrogate, then that itself * will be returned as the code point. * * @param s const UChar * string * @param i string offset, must be i>10)+0xd7c0); \ (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \ } \ } /** * Append a code point to a string, overwriting 1 or 2 code units. * The offset points to the current end of the string contents * and is advanced (post-increment). * "Safe" macro, checks for a valid code point. * If a surrogate pair is written, checks for sufficient space in the string. * If the code point is not valid or a trail surrogate does not fit, * then isError is set to TRUE. * * @param s const UChar * string buffer * @param i string offset, must be i>10)+0xd7c0); \ (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \ } else /* c>0x10ffff or not enough space */ { \ (isError)=TRUE; \ } \ } /** * Advance the string offset from one code point boundary to the next. * (Post-incrementing iteration.) * "Unsafe" macro, assumes well-formed UTF-16. * * @param s const UChar * string * @param i string offset * @see U16_FWD_1 * @stable ICU 2.4 */ #define U16_FWD_1_UNSAFE(s, i) { \ if(U16_IS_LEAD((s)[(i)++])) { \ ++(i); \ } \ } /** * Advance the string offset from one code point boundary to the next. * (Post-incrementing iteration.) * "Safe" macro, handles unpaired surrogates and checks for string boundaries. * * @param s const UChar * string * @param i string offset, must be i0) { \ U16_FWD_1_UNSAFE(s, i); \ --__N; \ } \ } /** * Advance the string offset from one code point boundary to the n-th next one, * i.e., move forward by n code points. * (Post-incrementing iteration.) * "Safe" macro, handles unpaired surrogates and checks for string boundaries. * * @param s const UChar * string * @param i string offset, must be i0 && (i)<(length)) { \ U16_FWD_1(s, i, length); \ --__N; \ } \ } /** * Adjust a random-access offset to a code point boundary * at the start of a code point. * If the offset points to the trail surrogate of a surrogate pair, * then the offset is decremented. * Otherwise, it is not modified. * "Unsafe" macro, assumes well-formed UTF-16. * * @param s const UChar * string * @param i string offset * @see U16_SET_CP_START * @stable ICU 2.4 */ #define U16_SET_CP_START_UNSAFE(s, i) { \ if(U16_IS_TRAIL((s)[i])) { \ --(i); \ } \ } /** * Adjust a random-access offset to a code point boundary * at the start of a code point. * If the offset points to the trail surrogate of a surrogate pair, * then the offset is decremented. * Otherwise, it is not modified. * "Safe" macro, handles unpaired surrogates and checks for string boundaries. * * @param s const UChar * string * @param start starting string offset (usually 0) * @param i string offset, must be start<=i * @see U16_SET_CP_START_UNSAFE * @stable ICU 2.4 */ #define U16_SET_CP_START(s, start, i) { \ if(U16_IS_TRAIL((s)[i]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \ --(i); \ } \ } /* definitions with backward iteration -------------------------------------- */ /** * Move the string offset from one code point boundary to the previous one * and get the code point between them. * (Pre-decrementing backward iteration.) * "Unsafe" macro, assumes well-formed UTF-16. * * The input offset may be the same as the string length. * If the offset is behind a trail surrogate unit * for a supplementary code point, then the macro will read * the preceding lead surrogate as well. * If the offset is behind a lead surrogate, then that itself * will be returned as the code point. * The result is undefined if the offset is behind a single, unpaired trail surrogate. * * @param s const UChar * string * @param i string offset * @param c output UChar32 variable * @see U16_PREV * @stable ICU 2.4 */ #define U16_PREV_UNSAFE(s, i, c) { \ (c)=(s)[--(i)]; \ if(U16_IS_TRAIL(c)) { \ (c)=U16_GET_SUPPLEMENTARY((s)[--(i)], (c)); \ } \ } /** * Move the string offset from one code point boundary to the previous one * and get the code point between them. * (Pre-decrementing backward iteration.) * "Safe" macro, handles unpaired surrogates and checks for string boundaries. * * The input offset may be the same as the string length. * If the offset is behind a trail surrogate unit * for a supplementary code point, then the macro will read * the preceding lead surrogate as well. * If the offset is behind a lead surrogate or behind a single, unpaired * trail surrogate, then that itself * will be returned as the code point. * * @param s const UChar * string * @param start starting string offset (usually 0) * @param i string offset, must be start(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \ --(i); \ (c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \ } \ } \ } /** * Move the string offset from one code point boundary to the previous one. * (Pre-decrementing backward iteration.) * The input offset may be the same as the string length. * "Unsafe" macro, assumes well-formed UTF-16. * * @param s const UChar * string * @param i string offset * @see U16_BACK_1 * @stable ICU 2.4 */ #define U16_BACK_1_UNSAFE(s, i) { \ if(U16_IS_TRAIL((s)[--(i)])) { \ --(i); \ } \ } /** * Move the string offset from one code point boundary to the previous one. * (Pre-decrementing backward iteration.) * The input offset may be the same as the string length. * "Safe" macro, handles unpaired surrogates and checks for string boundaries. * * @param s const UChar * string * @param start starting string offset (usually 0) * @param i string offset, must be start(start) && U16_IS_LEAD((s)[(i)-1])) { \ --(i); \ } \ } /** * Move the string offset from one code point boundary to the n-th one before it, * i.e., move backward by n code points. * (Pre-decrementing backward iteration.) * The input offset may be the same as the string length. * "Unsafe" macro, assumes well-formed UTF-16. * * @param s const UChar * string * @param i string offset * @param n number of code points to skip * @see U16_BACK_N * @stable ICU 2.4 */ #define U16_BACK_N_UNSAFE(s, i, n) { \ int32_t __N=(n); \ while(__N>0) { \ U16_BACK_1_UNSAFE(s, i); \ --__N; \ } \ } /** * Move the string offset from one code point boundary to the n-th one before it, * i.e., move backward by n code points. * (Pre-decrementing backward iteration.) * The input offset may be the same as the string length. * "Safe" macro, handles unpaired surrogates and checks for string boundaries. * * @param s const UChar * string * @param start start of string * @param i string offset, must be start0 && (i)>(start)) { \ U16_BACK_1(s, start, i); \ --__N; \ } \ } /** * Adjust a random-access offset to a code point boundary after a code point. * If the offset is behind the lead surrogate of a surrogate pair, * then the offset is incremented. * Otherwise, it is not modified. * The input offset may be the same as the string length. * "Unsafe" macro, assumes well-formed UTF-16. * * @param s const UChar * string * @param i string offset * @see U16_SET_CP_LIMIT * @stable ICU 2.4 */ #define U16_SET_CP_LIMIT_UNSAFE(s, i) { \ if(U16_IS_LEAD((s)[(i)-1])) { \ ++(i); \ } \ } /** * Adjust a random-access offset to a code point boundary after a code point. * If the offset is behind the lead surrogate of a surrogate pair, * then the offset is incremented. * Otherwise, it is not modified. * The input offset may be the same as the string length. * "Safe" macro, handles unpaired surrogates and checks for string boundaries. * * @param s const UChar * string * @param start starting string offset (usually 0) * @param i string offset, start<=i<=length * @param length string length * @see U16_SET_CP_LIMIT_UNSAFE * @stable ICU 2.4 */ #define U16_SET_CP_LIMIT(s, start, i, length) { \ if((start)<(i) && (i)<(length) && U16_IS_LEAD((s)[(i)-1]) && U16_IS_TRAIL((s)[i])) { \ ++(i); \ } \ } #endif android-audiosystem-1.8+13.10.20130807/include/unicode/uloc.h0000644000015700001700000013001112200324306024052 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (C) 1997-2010, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * * File ULOC.H * * Modification History: * * Date Name Description * 04/01/97 aliu Creation. * 08/22/98 stephen JDK 1.2 sync. * 12/08/98 rtg New C API for Locale * 03/30/99 damiba overhaul * 03/31/99 helena Javadoc for uloc functions. * 04/15/99 Madhu Updated Javadoc ******************************************************************************** */ #ifndef ULOC_H #define ULOC_H #include "unicode/utypes.h" #include "unicode/uenum.h" /** * \file * \brief C API: Locale * *

ULoc C API for Locale

* A Locale represents a specific geographical, political, * or cultural region. An operation that requires a Locale to perform * its task is called locale-sensitive and uses the Locale * to tailor information for the user. For example, displaying a number * is a locale-sensitive operation--the number should be formatted * according to the customs/conventions of the user's native country, * region, or culture. In the C APIs, a locales is simply a const char string. * *

* You create a Locale with one of the three options listed below. * Each of the component is separated by '_' in the locale string. * \htmlonly

\endhtmlonly *
 * \code
 *       newLanguage
 * 
 *       newLanguage + newCountry
 * 
 *       newLanguage + newCountry + newVariant
 * \endcode
 * 
* \htmlonly
\endhtmlonly * The first option is a valid ISO * Language Code. These codes are the lower-case two-letter * codes as defined by ISO-639. * You can find a full list of these codes at a number of sites, such as: *
* http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt * *

* The second option includes an additonal ISO Country * Code. These codes are the upper-case two-letter codes * as defined by ISO-3166. * You can find a full list of these codes at a number of sites, such as: *
* http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html * *

* The third option requires another additonal information--the * Variant. * The Variant codes are vendor and browser-specific. * For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX. * Where there are two variants, separate them with an underscore, and * put the most important one first. For * example, a Traditional Spanish collation might be referenced, with * "ES", "ES", "Traditional_WIN". * *

* Because a Locale is just an identifier for a region, * no validity check is performed when you specify a Locale. * If you want to see whether particular resources are available for the * Locale you asked for, you must query those resources. For * example, ask the UNumberFormat for the locales it supports * using its getAvailable method. *
Note: When you ask for a resource for a particular * locale, you get back the best available match, not necessarily * precisely what you asked for. For more information, look at * UResourceBundle. * *

* The Locale provides a number of convenient constants * that you can use to specify the commonly used * locales. For example, the following refers to a locale * for the United States: * \htmlonly

\endhtmlonly *
 * \code
 *       ULOC_US
 * \endcode
 * 
* \htmlonly
\endhtmlonly * *

* Once you've specified a locale you can query it for information about * itself. Use uloc_getCountry to get the ISO Country Code and * uloc_getLanguage to get the ISO Language Code. You can * use uloc_getDisplayCountry to get the * name of the country suitable for displaying to the user. Similarly, * you can use uloc_getDisplayLanguage to get the name of * the language suitable for displaying to the user. Interestingly, * the uloc_getDisplayXXX methods are themselves locale-sensitive * and have two versions: one that uses the default locale and one * that takes a locale as an argument and displays the name or country in * a language appropriate to that locale. * *

* The ICU provides a number of services that perform locale-sensitive * operations. For example, the unum_xxx functions format * numbers, currency, or percentages in a locale-sensitive manner. *

* \htmlonly
\endhtmlonly *
 * \code
 *     UErrorCode success = U_ZERO_ERROR;
 *     UNumberFormat *nf;
 *     const char* myLocale = "fr_FR";
 * 
 *     nf = unum_open( UNUM_DEFAULT, NULL, success );          
 *     unum_close(nf);
 *     nf = unum_open( UNUM_CURRENCY, NULL, success );
 *     unum_close(nf);
 *     nf = unum_open( UNUM_PERCENT, NULL, success );   
 *     unum_close(nf);
 * \endcode
 * 
* \htmlonly
\endhtmlonly * Each of these methods has two variants; one with an explicit locale * and one without; the latter using the default locale. * \htmlonly
\endhtmlonly *
 * \code 
 * 
 *     nf = unum_open( UNUM_DEFAULT, myLocale, success );          
 *     unum_close(nf);
 *     nf = unum_open( UNUM_CURRENCY, myLocale, success );
 *     unum_close(nf);
 *     nf = unum_open( UNUM_PERCENT, myLocale, success );   
 *     unum_close(nf);
 * \endcode
 * 
* \htmlonly
\endhtmlonly * A Locale is the mechanism for identifying the kind of services * (UNumberFormat) that you would like to get. The locale is * just a mechanism for identifying these services. * *

* Each international serivce that performs locale-sensitive operations * allows you * to get all the available objects of that type. You can sift * through these objects by language, country, or variant, * and use the display names to present a menu to the user. * For example, you can create a menu of all the collation objects * suitable for a given language. Such classes implement these * three class methods: * \htmlonly

\endhtmlonly *
 * \code
 *       const char* uloc_getAvailable(int32_t index);
 *       int32_t uloc_countAvailable();
 *       int32_t
 *       uloc_getDisplayName(const char* localeID,
 *                 const char* inLocaleID, 
 *                 UChar* result,
 *                 int32_t maxResultSize,
 *                  UErrorCode* err);
 * 
 * \endcode
 * 
* \htmlonly
\endhtmlonly *

* Concerning POSIX/RFC1766 Locale IDs, * the getLanguage/getCountry/getVariant/getName functions do understand * the POSIX type form of language_COUNTRY.ENCODING\@VARIANT * and if there is not an ICU-stype variant, uloc_getVariant() for example * will return the one listed after the \@at sign. As well, the hyphen * "-" is recognized as a country/variant separator similarly to RFC1766. * So for example, "en-us" will be interpreted as en_US. * As a result, uloc_getName() is far from a no-op, and will have the * effect of converting POSIX/RFC1766 IDs into ICU form, although it does * NOT map any of the actual codes (i.e. russian->ru) in any way. * Applications should call uloc_getName() at the point where a locale ID * is coming from an external source (user entry, OS, web browser) * and pass the resulting string to other ICU functions. For example, * don't use de-de\@EURO as an argument to resourcebundle. * * @see UResourceBundle */ /** Useful constant for this language. @stable ICU 2.0 */ #define ULOC_CHINESE "zh" /** Useful constant for this language. @stable ICU 2.0 */ #define ULOC_ENGLISH "en" /** Useful constant for this language. @stable ICU 2.0 */ #define ULOC_FRENCH "fr" /** Useful constant for this language. @stable ICU 2.0 */ #define ULOC_GERMAN "de" /** Useful constant for this language. @stable ICU 2.0 */ #define ULOC_ITALIAN "it" /** Useful constant for this language. @stable ICU 2.0 */ #define ULOC_JAPANESE "ja" /** Useful constant for this language. @stable ICU 2.0 */ #define ULOC_KOREAN "ko" /** Useful constant for this language. @stable ICU 2.0 */ #define ULOC_SIMPLIFIED_CHINESE "zh_CN" /** Useful constant for this language. @stable ICU 2.0 */ #define ULOC_TRADITIONAL_CHINESE "zh_TW" /** Useful constant for this country/region. @stable ICU 2.0 */ #define ULOC_CANADA "en_CA" /** Useful constant for this country/region. @stable ICU 2.0 */ #define ULOC_CANADA_FRENCH "fr_CA" /** Useful constant for this country/region. @stable ICU 2.0 */ #define ULOC_CHINA "zh_CN" /** Useful constant for this country/region. @stable ICU 2.0 */ #define ULOC_PRC "zh_CN" /** Useful constant for this country/region. @stable ICU 2.0 */ #define ULOC_FRANCE "fr_FR" /** Useful constant for this country/region. @stable ICU 2.0 */ #define ULOC_GERMANY "de_DE" /** Useful constant for this country/region. @stable ICU 2.0 */ #define ULOC_ITALY "it_IT" /** Useful constant for this country/region. @stable ICU 2.0 */ #define ULOC_JAPAN "ja_JP" /** Useful constant for this country/region. @stable ICU 2.0 */ #define ULOC_KOREA "ko_KR" /** Useful constant for this country/region. @stable ICU 2.0 */ #define ULOC_TAIWAN "zh_TW" /** Useful constant for this country/region. @stable ICU 2.0 */ #define ULOC_UK "en_GB" /** Useful constant for this country/region. @stable ICU 2.0 */ #define ULOC_US "en_US" /** * Useful constant for the maximum size of the language part of a locale ID. * (including the terminating NULL). * @stable ICU 2.0 */ #define ULOC_LANG_CAPACITY 12 /** * Useful constant for the maximum size of the country part of a locale ID * (including the terminating NULL). * @stable ICU 2.0 */ #define ULOC_COUNTRY_CAPACITY 4 /** * Useful constant for the maximum size of the whole locale ID * (including the terminating NULL and all keywords). * @stable ICU 2.0 */ #define ULOC_FULLNAME_CAPACITY 157 /** * Useful constant for the maximum size of the script part of a locale ID * (including the terminating NULL). * @stable ICU 2.8 */ #define ULOC_SCRIPT_CAPACITY 6 /** * Useful constant for the maximum size of keywords in a locale * @stable ICU 2.8 */ #define ULOC_KEYWORDS_CAPACITY 50 /** * Useful constant for the maximum total size of keywords and their values in a locale * @stable ICU 2.8 */ #define ULOC_KEYWORD_AND_VALUES_CAPACITY 100 /** * Invariant character separating keywords from the locale string * @stable ICU 2.8 */ #define ULOC_KEYWORD_SEPARATOR '@' /** * Unicode code point for '@' separating keywords from the locale string. * @see ULOC_KEYWORD_SEPARATOR * @draft ICU 4.6 */ #define ULOC_KEYWORD_SEPARATOR_UNICODE 0x40 /** * Invariant character for assigning value to a keyword * @stable ICU 2.8 */ #define ULOC_KEYWORD_ASSIGN '=' /** * Unicode code point for '=' for assigning value to a keyword. * @see ULOC_KEYWORD_ASSIGN * @draft ICU 4.6 */ #define ULOC_KEYWORD_ASSIGN_UNICODE 0x3D /** * Invariant character separating keywords * @stable ICU 2.8 */ #define ULOC_KEYWORD_ITEM_SEPARATOR ';' /** * Unicode code point for ';' separating keywords * @see ULOC_KEYWORD_ITEM_SEPARATOR * @draft ICU 4.6 */ #define ULOC_KEYWORD_ITEM_SEPARATOR_UNICODE 0x3B /** * Constants for *_getLocale() * Allow user to select whether she wants information on * requested, valid or actual locale. * For example, a collator for "en_US_CALIFORNIA" was * requested. In the current state of ICU (2.0), * the requested locale is "en_US_CALIFORNIA", * the valid locale is "en_US" (most specific locale supported by ICU) * and the actual locale is "root" (the collation data comes unmodified * from the UCA) * The locale is considered supported by ICU if there is a core ICU bundle * for that locale (although it may be empty). * @stable ICU 2.1 */ typedef enum { /** This is locale the data actually comes from * @stable ICU 2.1 */ ULOC_ACTUAL_LOCALE = 0, /** This is the most specific locale supported by ICU * @stable ICU 2.1 */ ULOC_VALID_LOCALE = 1, #ifndef U_HIDE_DEPRECATED_API /** This is the requested locale * @deprecated ICU 2.8 */ ULOC_REQUESTED_LOCALE = 2, #endif /* U_HIDE_DEPRECATED_API */ ULOC_DATA_LOCALE_TYPE_LIMIT = 3 } ULocDataLocaleType ; /** * Gets ICU's default locale. * The returned string is a snapshot in time, and will remain valid * and unchanged even when uloc_setDefault() is called. * The returned storage is owned by ICU, and must not be altered or deleted * by the caller. * * @return the ICU default locale * @system * @stable ICU 2.0 */ U_STABLE const char* U_EXPORT2 uloc_getDefault(void); /** * Sets ICU's default locale. * By default (without calling this function), ICU's default locale will be based * on information obtained from the underlying system environment. *

* Changes to ICU's default locale do not propagate back to the * system environment. *

* Changes to ICU's default locale to not affect any ICU services that * may already be open based on the previous default locale value. * * @param localeID the new ICU default locale. A value of NULL will try to get * the system's default locale. * @param status the error information if the setting of default locale fails * @system * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 uloc_setDefault(const char* localeID, UErrorCode* status); /** * Gets the language code for the specified locale. * * @param localeID the locale to get the ISO language code with * @param language the language code for localeID * @param languageCapacity the size of the language buffer to store the * language code with * @param err error information if retrieving the language code failed * @return the actual buffer size needed for the language code. If it's greater * than languageCapacity, the returned language code will be truncated. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 uloc_getLanguage(const char* localeID, char* language, int32_t languageCapacity, UErrorCode* err); /** * Gets the script code for the specified locale. * * @param localeID the locale to get the ISO language code with * @param script the language code for localeID * @param scriptCapacity the size of the language buffer to store the * language code with * @param err error information if retrieving the language code failed * @return the actual buffer size needed for the language code. If it's greater * than scriptCapacity, the returned language code will be truncated. * @stable ICU 2.8 */ U_STABLE int32_t U_EXPORT2 uloc_getScript(const char* localeID, char* script, int32_t scriptCapacity, UErrorCode* err); /** * Gets the country code for the specified locale. * * @param localeID the locale to get the country code with * @param country the country code for localeID * @param countryCapacity the size of the country buffer to store the * country code with * @param err error information if retrieving the country code failed * @return the actual buffer size needed for the country code. If it's greater * than countryCapacity, the returned country code will be truncated. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 uloc_getCountry(const char* localeID, char* country, int32_t countryCapacity, UErrorCode* err); /** * Gets the variant code for the specified locale. * * @param localeID the locale to get the variant code with * @param variant the variant code for localeID * @param variantCapacity the size of the variant buffer to store the * variant code with * @param err error information if retrieving the variant code failed * @return the actual buffer size needed for the variant code. If it's greater * than variantCapacity, the returned variant code will be truncated. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 uloc_getVariant(const char* localeID, char* variant, int32_t variantCapacity, UErrorCode* err); /** * Gets the full name for the specified locale. * Note: This has the effect of 'canonicalizing' the ICU locale ID to * a certain extent. Upper and lower case are set as needed. * It does NOT map aliased names in any way. * See the top of this header file. * This API supports preflighting. * * @param localeID the locale to get the full name with * @param name fill in buffer for the name without keywords. * @param nameCapacity capacity of the fill in buffer. * @param err error information if retrieving the full name failed * @return the actual buffer size needed for the full name. If it's greater * than nameCapacity, the returned full name will be truncated. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 uloc_getName(const char* localeID, char* name, int32_t nameCapacity, UErrorCode* err); /** * Gets the full name for the specified locale. * Note: This has the effect of 'canonicalizing' the string to * a certain extent. Upper and lower case are set as needed, * and if the components were in 'POSIX' format they are changed to * ICU format. It does NOT map aliased names in any way. * See the top of this header file. * * @param localeID the locale to get the full name with * @param name the full name for localeID * @param nameCapacity the size of the name buffer to store the * full name with * @param err error information if retrieving the full name failed * @return the actual buffer size needed for the full name. If it's greater * than nameCapacity, the returned full name will be truncated. * @stable ICU 2.8 */ U_STABLE int32_t U_EXPORT2 uloc_canonicalize(const char* localeID, char* name, int32_t nameCapacity, UErrorCode* err); /** * Gets the ISO language code for the specified locale. * * @param localeID the locale to get the ISO language code with * @return language the ISO language code for localeID * @stable ICU 2.0 */ U_STABLE const char* U_EXPORT2 uloc_getISO3Language(const char* localeID); /** * Gets the ISO country code for the specified locale. * * @param localeID the locale to get the ISO country code with * @return country the ISO country code for localeID * @stable ICU 2.0 */ U_STABLE const char* U_EXPORT2 uloc_getISO3Country(const char* localeID); /** * Gets the Win32 LCID value for the specified locale. * If the ICU locale is not recognized by Windows, 0 will be returned. * * @param localeID the locale to get the Win32 LCID value with * @return country the Win32 LCID for localeID * @stable ICU 2.0 */ U_STABLE uint32_t U_EXPORT2 uloc_getLCID(const char* localeID); /** * Gets the language name suitable for display for the specified locale. * * @param locale the locale to get the ISO language code with * @param displayLocale Specifies the locale to be used to display the name. In other words, * if the locale's language code is "en", passing Locale::getFrench() for * inLocale would result in "Anglais", while passing Locale::getGerman() * for inLocale would result in "Englisch". * @param language the displayable language code for localeID * @param languageCapacity the size of the language buffer to store the * displayable language code with * @param status error information if retrieving the displayable language code failed * @return the actual buffer size needed for the displayable language code. If it's greater * than languageCapacity, the returned language code will be truncated. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 uloc_getDisplayLanguage(const char* locale, const char* displayLocale, UChar* language, int32_t languageCapacity, UErrorCode* status); /** * Gets the script name suitable for display for the specified locale. * * @param locale the locale to get the displayable script code with. NULL may be used to specify the default. * @param displayLocale Specifies the locale to be used to display the name. In other words, * if the locale's language code is "en", passing Locale::getFrench() for * inLocale would result in "", while passing Locale::getGerman() * for inLocale would result in "". NULL may be used to specify the default. * @param script the displayable country code for localeID * @param scriptCapacity the size of the script buffer to store the * displayable script code with * @param status error information if retrieving the displayable script code failed * @return the actual buffer size needed for the displayable script code. If it's greater * than scriptCapacity, the returned displayable script code will be truncated. * @stable ICU 2.8 */ U_STABLE int32_t U_EXPORT2 uloc_getDisplayScript(const char* locale, const char* displayLocale, UChar* script, int32_t scriptCapacity, UErrorCode* status); /** * Gets the country name suitable for display for the specified locale. * * @param locale the locale to get the displayable country code with. NULL may be used to specify the default. * @param displayLocale Specifies the locale to be used to display the name. In other words, * if the locale's language code is "en", passing Locale::getFrench() for * inLocale would result in "Anglais", while passing Locale::getGerman() * for inLocale would result in "Englisch". NULL may be used to specify the default. * @param country the displayable country code for localeID * @param countryCapacity the size of the country buffer to store the * displayable country code with * @param status error information if retrieving the displayable country code failed * @return the actual buffer size needed for the displayable country code. If it's greater * than countryCapacity, the returned displayable country code will be truncated. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 uloc_getDisplayCountry(const char* locale, const char* displayLocale, UChar* country, int32_t countryCapacity, UErrorCode* status); /** * Gets the variant name suitable for display for the specified locale. * * @param locale the locale to get the displayable variant code with. NULL may be used to specify the default. * @param displayLocale Specifies the locale to be used to display the name. In other words, * if the locale's language code is "en", passing Locale::getFrench() for * inLocale would result in "Anglais", while passing Locale::getGerman() * for inLocale would result in "Englisch". NULL may be used to specify the default. * @param variant the displayable variant code for localeID * @param variantCapacity the size of the variant buffer to store the * displayable variant code with * @param status error information if retrieving the displayable variant code failed * @return the actual buffer size needed for the displayable variant code. If it's greater * than variantCapacity, the returned displayable variant code will be truncated. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 uloc_getDisplayVariant(const char* locale, const char* displayLocale, UChar* variant, int32_t variantCapacity, UErrorCode* status); /** * Gets the keyword name suitable for display for the specified locale. * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display * string for the keyword collation. * Usage: * * UErrorCode status = U_ZERO_ERROR; * const char* keyword =NULL; * int32_t keywordLen = 0; * int32_t keywordCount = 0; * UChar displayKeyword[256]; * int32_t displayKeywordLen = 0; * UEnumeration* keywordEnum = uloc_openKeywords("de_DE@collation=PHONEBOOK;calendar=TRADITIONAL", &status); * for(keywordCount = uenum_count(keywordEnum, &status); keywordCount > 0 ; keywordCount--){ * if(U_FAILURE(status)){ * ...something went wrong so handle the error... * break; * } * // the uenum_next returns NUL terminated string * keyword = uenum_next(keywordEnum, &keywordLen, &status); * displayKeywordLen = uloc_getDisplayKeyword(keyword, "en_US", displayKeyword, 256); * ... do something interesting ..... * } * uenum_close(keywordEnum); * * @param keyword The keyword whose display string needs to be returned. * @param displayLocale Specifies the locale to be used to display the name. In other words, * if the locale's language code is "en", passing Locale::getFrench() for * inLocale would result in "Anglais", while passing Locale::getGerman() * for inLocale would result in "Englisch". NULL may be used to specify the default. * @param dest the buffer to which the displayable keyword should be written. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). * @param status error information if retrieving the displayable string failed. * Should not be NULL and should not indicate failure on entry. * @return the actual buffer size needed for the displayable variant code. * @see #uloc_openKeywords * @stable ICU 2.8 */ U_STABLE int32_t U_EXPORT2 uloc_getDisplayKeyword(const char* keyword, const char* displayLocale, UChar* dest, int32_t destCapacity, UErrorCode* status); /** * Gets the value of the keyword suitable for display for the specified locale. * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display * string for PHONEBOOK, in the display locale, when "collation" is specified as the keyword. * * @param locale The locale to get the displayable variant code with. NULL may be used to specify the default. * @param keyword The keyword for whose value should be used. * @param displayLocale Specifies the locale to be used to display the name. In other words, * if the locale's language code is "en", passing Locale::getFrench() for * inLocale would result in "Anglais", while passing Locale::getGerman() * for inLocale would result in "Englisch". NULL may be used to specify the default. * @param dest the buffer to which the displayable keyword should be written. * @param destCapacity The size of the buffer (number of UChars). If it is 0, then * dest may be NULL and the function will only return the length of the * result without writing any of the result string (pre-flighting). * @param status error information if retrieving the displayable string failed. * Should not be NULL and must not indicate failure on entry. * @return the actual buffer size needed for the displayable variant code. * @stable ICU 2.8 */ U_STABLE int32_t U_EXPORT2 uloc_getDisplayKeywordValue( const char* locale, const char* keyword, const char* displayLocale, UChar* dest, int32_t destCapacity, UErrorCode* status); /** * Gets the full name suitable for display for the specified locale. * * @param localeID the locale to get the displayable name with. NULL may be used to specify the default. * @param inLocaleID Specifies the locale to be used to display the name. In other words, * if the locale's language code is "en", passing Locale::getFrench() for * inLocale would result in "Anglais", while passing Locale::getGerman() * for inLocale would result in "Englisch". NULL may be used to specify the default. * @param result the displayable name for localeID * @param maxResultSize the size of the name buffer to store the * displayable full name with * @param err error information if retrieving the displayable name failed * @return the actual buffer size needed for the displayable name. If it's greater * than maxResultSize, the returned displayable name will be truncated. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 uloc_getDisplayName(const char* localeID, const char* inLocaleID, UChar* result, int32_t maxResultSize, UErrorCode* err); /** * Gets the specified locale from a list of all available locales. * The return value is a pointer to an item of * a locale name array. Both this array and the pointers * it contains are owned by ICU and should not be deleted or written through * by the caller. The locale name is terminated by a null pointer. * @param n the specific locale name index of the available locale list * @return a specified locale name of all available locales * @stable ICU 2.0 */ U_STABLE const char* U_EXPORT2 uloc_getAvailable(int32_t n); /** * Gets the size of the all available locale list. * * @return the size of the locale list * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 uloc_countAvailable(void); /** * * Gets a list of all available language codes defined in ISO 639. This is a pointer * to an array of pointers to arrays of char. All of these pointers are owned * by ICU-- do not delete them, and do not write through them. The array is * terminated with a null pointer. * @return a list of all available language codes * @stable ICU 2.0 */ U_STABLE const char* const* U_EXPORT2 uloc_getISOLanguages(void); /** * * Gets a list of all available 2-letter country codes defined in ISO 639. This is a * pointer to an array of pointers to arrays of char. All of these pointers are * owned by ICU-- do not delete them, and do not write through them. The array is * terminated with a null pointer. * @return a list of all available country codes * @stable ICU 2.0 */ U_STABLE const char* const* U_EXPORT2 uloc_getISOCountries(void); /** * Truncate the locale ID string to get the parent locale ID. * Copies the part of the string before the last underscore. * The parent locale ID will be an empty string if there is no * underscore, or if there is only one underscore at localeID[0]. * * @param localeID Input locale ID string. * @param parent Output string buffer for the parent locale ID. * @param parentCapacity Size of the output buffer. * @param err A UErrorCode value. * @return The length of the parent locale ID. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 uloc_getParent(const char* localeID, char* parent, int32_t parentCapacity, UErrorCode* err); /** * Gets the full name for the specified locale. * Note: This has the effect of 'canonicalizing' the string to * a certain extent. Upper and lower case are set as needed, * and if the components were in 'POSIX' format they are changed to * ICU format. It does NOT map aliased names in any way. * See the top of this header file. * This API strips off the keyword part, so "de_DE\@collation=phonebook" * will become "de_DE". * This API supports preflighting. * * @param localeID the locale to get the full name with * @param name fill in buffer for the name without keywords. * @param nameCapacity capacity of the fill in buffer. * @param err error information if retrieving the full name failed * @return the actual buffer size needed for the full name. If it's greater * than nameCapacity, the returned full name will be truncated. * @stable ICU 2.8 */ U_STABLE int32_t U_EXPORT2 uloc_getBaseName(const char* localeID, char* name, int32_t nameCapacity, UErrorCode* err); /** * Gets an enumeration of keywords for the specified locale. Enumeration * must get disposed of by the client using uenum_close function. * * @param localeID the locale to get the variant code with * @param status error information if retrieving the keywords failed * @return enumeration of keywords or NULL if there are no keywords. * @stable ICU 2.8 */ U_STABLE UEnumeration* U_EXPORT2 uloc_openKeywords(const char* localeID, UErrorCode* status); /** * Get the value for a keyword. Locale name does not need to be normalized. * * @param localeID locale name containing the keyword ("de_DE@currency=EURO;collation=PHONEBOOK") * @param keywordName name of the keyword for which we want the value. Case insensitive. * @param buffer receiving buffer * @param bufferCapacity capacity of receiving buffer * @param status containing error code - buffer not big enough. * @return the length of keyword value * @stable ICU 2.8 */ U_STABLE int32_t U_EXPORT2 uloc_getKeywordValue(const char* localeID, const char* keywordName, char* buffer, int32_t bufferCapacity, UErrorCode* status); /** * Set the value of the specified keyword. * NOTE: Unlike almost every other ICU function which takes a * buffer, this function will NOT truncate the output text. If a * BUFFER_OVERFLOW_ERROR is received, it means that the original * buffer is untouched. This is done to prevent incorrect or possibly * even malformed locales from being generated and used. * * @param keywordName name of the keyword to be set. Case insensitive. * @param keywordValue value of the keyword to be set. If 0-length or * NULL, will result in the keyword being removed. No error is given if * that keyword does not exist. * @param buffer input buffer containing locale to be modified. * @param bufferCapacity capacity of receiving buffer * @param status containing error code - buffer not big enough. * @return the length needed for the buffer * @see uloc_getKeywordValue * @stable ICU 3.2 */ U_STABLE int32_t U_EXPORT2 uloc_setKeywordValue(const char* keywordName, const char* keywordValue, char* buffer, int32_t bufferCapacity, UErrorCode* status); /** * enums for the return value for the character and line orientation * functions. * @stable ICU 4.0 */ typedef enum { ULOC_LAYOUT_LTR = 0, /* left-to-right. */ ULOC_LAYOUT_RTL = 1, /* right-to-left. */ ULOC_LAYOUT_TTB = 2, /* top-to-bottom. */ ULOC_LAYOUT_BTT = 3, /* bottom-to-top. */ ULOC_LAYOUT_UNKNOWN } ULayoutType; /** * Get the layout character orientation for the specified locale. * * @param localeId locale name * @param status Error status * @return an enum indicating the layout orientation for characters. * @stable ICU 4.0 */ U_STABLE ULayoutType U_EXPORT2 uloc_getCharacterOrientation(const char* localeId, UErrorCode *status); /** * Get the layout line orientation for the specified locale. * * @param localeId locale name * @param status Error status * @return an enum indicating the layout orientation for lines. * @stable ICU 4.0 */ U_STABLE ULayoutType U_EXPORT2 uloc_getLineOrientation(const char* localeId, UErrorCode *status); /** * enums for the 'outResult' parameter return value * @see uloc_acceptLanguageFromHTTP * @see uloc_acceptLanguage * @stable ICU 3.2 */ typedef enum { ULOC_ACCEPT_FAILED = 0, /* No exact match was found. */ ULOC_ACCEPT_VALID = 1, /* An exact match was found. */ ULOC_ACCEPT_FALLBACK = 2 /* A fallback was found, for example, Accept list contained 'ja_JP' which matched available locale 'ja'. */ } UAcceptResult; /** * Based on a HTTP header from a web browser and a list of available locales, * determine an acceptable locale for the user. * @param result - buffer to accept the result locale * @param resultAvailable the size of the result buffer. * @param outResult - An out parameter that contains the fallback status * @param httpAcceptLanguage - "Accept-Language:" header as per HTTP. * @param availableLocales - list of available locales to match * @param status Error status, may be BUFFER_OVERFLOW_ERROR * @return length needed for the locale. * @stable ICU 3.2 */ U_STABLE int32_t U_EXPORT2 uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, UAcceptResult *outResult, const char *httpAcceptLanguage, UEnumeration* availableLocales, UErrorCode *status); /** * Based on a list of available locales, * determine an acceptable locale for the user. * @param result - buffer to accept the result locale * @param resultAvailable the size of the result buffer. * @param outResult - An out parameter that contains the fallback status * @param acceptList - list of acceptable languages * @param acceptListCount - count of acceptList items * @param availableLocales - list of available locales to match * @param status Error status, may be BUFFER_OVERFLOW_ERROR * @return length needed for the locale. * @stable ICU 3.2 */ U_STABLE int32_t U_EXPORT2 uloc_acceptLanguage(char *result, int32_t resultAvailable, UAcceptResult *outResult, const char **acceptList, int32_t acceptListCount, UEnumeration* availableLocales, UErrorCode *status); /** * Gets the ICU locale ID for the specified Win32 LCID value. * * @param hostID the Win32 LCID to translate * @param locale the output buffer for the ICU locale ID, which will be NUL-terminated * if there is room. * @param localeCapacity the size of the output buffer * @param status an error is returned if the LCID is unrecognized or the output buffer * is too small * @return actual the actual size of the locale ID, not including NUL-termination * @stable ICU 3.8 */ U_STABLE int32_t U_EXPORT2 uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity, UErrorCode *status); /** * Add the likely subtags for a provided locale ID, per the algorithm described * in the following CLDR technical report: * * http://www.unicode.org/reports/tr35/#Likely_Subtags * * If localeID is already in the maximal form, or there is no data available * for maximization, it will be copied to the output buffer. For example, * "und-Zzzz" cannot be maximized, since there is no reasonable maximization. * * Examples: * * "en" maximizes to "en_Latn_US" * * "de" maximizes to "de_Latn_US" * * "sr" maximizes to "sr_Cyrl_RS" * * "sh" maximizes to "sr_Latn_RS" (Note this will not reverse.) * * "zh_Hani" maximizes to "zh_Hans_CN" (Note this will not reverse.) * * @param localeID The locale to maximize * @param maximizedLocaleID The maximized locale * @param maximizedLocaleIDCapacity The capacity of the maximizedLocaleID buffer * @param err Error information if maximizing the locale failed. If the length * of the localeID and the null-terminator is greater than the maximum allowed size, * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR. * @return The actual buffer size needed for the maximized locale. If it's * greater than maximizedLocaleIDCapacity, the returned ID will be truncated. * On error, the return value is -1. * @stable ICU 4.0 */ U_STABLE int32_t U_EXPORT2 uloc_addLikelySubtags(const char* localeID, char* maximizedLocaleID, int32_t maximizedLocaleIDCapacity, UErrorCode* err); /** * Minimize the subtags for a provided locale ID, per the algorithm described * in the following CLDR technical report: * * http://www.unicode.org/reports/tr35/#Likely_Subtags * * If localeID is already in the minimal form, or there is no data available * for minimization, it will be copied to the output buffer. Since the * minimization algorithm relies on proper maximization, see the comments * for uloc_addLikelySubtags for reasons why there might not be any data. * * Examples: * * "en_Latn_US" minimizes to "en" * * "de_Latn_US" minimizes to "de" * * "sr_Cyrl_RS" minimizes to "sr" * * "zh_Hant_TW" minimizes to "zh_TW" (The region is preferred to the * script, and minimizing to "zh" would imply "zh_Hans_CN".) * * @param localeID The locale to minimize * @param minimizedLocaleID The minimized locale * @param minimizedLocaleIDCapacity The capacity of the minimizedLocaleID buffer * @param err Error information if minimizing the locale failed. If the length * of the localeID and the null-terminator is greater than the maximum allowed size, * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR. * @return The actual buffer size needed for the minimized locale. If it's * greater than minimizedLocaleIDCapacity, the returned ID will be truncated. * On error, the return value is -1. * @stable ICU 4.0 */ U_STABLE int32_t U_EXPORT2 uloc_minimizeSubtags(const char* localeID, char* minimizedLocaleID, int32_t minimizedLocaleIDCapacity, UErrorCode* err); /** * Returns a locale ID for the specified BCP47 language tag string. * If the specified language tag contains any ill-formed subtags, * the first such subtag and all following subtags are ignored. *

* This implements the 'Language-Tag' production of BCP47, and so * supports grandfathered (regular and irregular) as well as private * use language tags. Private use tags are represented as 'x-whatever', * and grandfathered tags are converted to their canonical replacements * where they exist. Note that a few grandfathered tags have no modern * replacement, these will be converted using the fallback described in * the first paragraph, so some information might be lost. * @param langtag the input BCP47 language tag. * @param localeID the output buffer receiving a locale ID for the * specified BCP47 language tag. * @param localeIDCapacity the size of the locale ID output buffer. * @param parsedLength if not NULL, succsessfully parsed length * for the input language tag is set. * @param err error information if receiving the locald ID * failed. * @return the length of the locale ID. * @draft ICU 4.2 */ U_DRAFT int32_t U_EXPORT2 uloc_forLanguageTag(const char* langtag, char* localeID, int32_t localeIDCapacity, int32_t* parsedLength, UErrorCode* err); /** * Returns a well-formed language tag for this locale ID. *

* Note: When strict is FALSE, any locale * fields which do not satisfy the BCP47 syntax requirement will * be omitted from the result. When strict is * TRUE, this function sets U_ILLEGAL_ARGUMENT_ERROR to the * err if any locale fields do not satisfy the * BCP47 syntax requirement. * @param localeID the input lcoale ID * @param langtag the output buffer receiving BCP47 language * tag for the locale ID. * @param langtagCapacity the size of the BCP47 language tag * output buffer. * @param strict boolean value indicating if the function returns * an error for an ill-formed input locale ID. * @param err error information if receiving the language * tag failed. * @return The length of the BCP47 language tag. * @draft ICU 4.2 */ U_DRAFT int32_t U_EXPORT2 uloc_toLanguageTag(const char* localeID, char* langtag, int32_t langtagCapacity, UBool strict, UErrorCode* err); #endif /*_ULOC*/ android-audiosystem-1.8+13.10.20130807/include/unicode/utf_old.h0000644000015700001700000012517612200324306024564 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * * Copyright (C) 2002-2008, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: utf.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2002sep21 * created by: Markus W. Scherer */ /** * \file * \brief C API: Deprecated macros for Unicode string handling */ /** * * The macros in utf_old.h are all deprecated and their use discouraged. * Some of the design principles behind the set of UTF macros * have changed or proved impractical. * Almost all of the old "UTF macros" are at least renamed. * If you are looking for a new equivalent to an old macro, please see the * comment at the old one. * * utf_old.h is included by utf.h after unicode/umachine.h * and some common definitions, to not break old code. * * Brief summary of reasons for deprecation: * - Switch on UTF_SIZE (selection of UTF-8/16/32 default string processing) * was impractical. * - Switch on UTF_SAFE etc. (selection of unsafe/safe/strict default string processing) * was of little use and impractical. * - Whole classes of macros became obsolete outside of the UTF_SIZE/UTF_SAFE * selection framework: UTF32_ macros (all trivial) * and UTF_ default and intermediate macros (all aliases). * - The selection framework also caused many macro aliases. * - Change in Unicode standard: "irregular" sequences (3.0) became illegal (3.2). * - Change of language in Unicode standard: * Growing distinction between internal x-bit Unicode strings and external UTF-x * forms, with the former more lenient. * Suggests renaming of UTF16_ macros to U16_. * - The prefix "UTF_" without a width number confused some users. * - "Safe" append macros needed the addition of an error indicator output. * - "Safe" UTF-8 macros used legitimate (if rarely used) code point values * to indicate error conditions. * - The use of the "_CHAR" infix for code point operations confused some users. * * More details: * * Until ICU 2.2, utf.h theoretically allowed to choose among UTF-8/16/32 * for string processing, and among unsafe/safe/strict default macros for that. * * It proved nearly impossible to write non-trivial, high-performance code * that is UTF-generic. * Unsafe default macros would be dangerous for default string processing, * and the main reason for the "strict" versions disappeared: * Between Unicode 3.0 and 3.2 all "irregular" UTF-8 sequences became illegal. * The only other conditions that "strict" checked for were non-characters, * which are valid during processing. Only during text input/output should they * be checked, and at that time other well-formedness checks may be * necessary or useful as well. * This can still be done by using U16_NEXT and U_IS_UNICODE_NONCHAR * or U_IS_UNICODE_CHAR. * * The old UTF8_..._SAFE macros also used some normal Unicode code points * to indicate malformed sequences. * The new UTF8_ macros without suffix use negative values instead. * * The entire contents of utf32.h was moved here without replacement * because all those macros were trivial and * were meaningful only in the framework of choosing the UTF size. * * See Jitterbug 2150 and its discussion on the ICU mailing list * in September 2002. * *


* * Obsolete part of pre-ICU 2.4 utf.h file documentation: * *

The original concept for these files was for ICU to allow * in principle to set which UTF (UTF-8/16/32) is used internally * by defining UTF_SIZE to either 8, 16, or 32. utf.h would then define the UChar type * accordingly. UTF-16 was the default.

* *

This concept has been abandoned. * A lot of the ICU source code assumes UChar strings are in UTF-16. * This is especially true for low-level code like * conversion, normalization, and collation. * The utf.h header enforces the default of UTF-16. * The UTF-8 and UTF-32 macros remain for now for completeness and backward compatibility.

* *

Accordingly, utf.h defines UChar to be an unsigned 16-bit integer. If this matches wchar_t, then * UChar is defined to be exactly wchar_t, otherwise uint16_t.

* *

UChar32 is defined to be a signed 32-bit integer (int32_t), large enough for a 21-bit * Unicode code point (Unicode scalar value, 0..0x10ffff). * Before ICU 2.4, the definition of UChar32 was similarly platform-dependent as * the definition of UChar. For details see the documentation for UChar32 itself.

* *

utf.h also defines a number of C macros for handling single Unicode code points and * for using UTF Unicode strings. It includes utf8.h, utf16.h, and utf32.h for the actual * implementations of those macros and then aliases one set of them (for UTF-16) for general use. * The UTF-specific macros have the UTF size in the macro name prefixes (UTF16_...), while * the general alias macros always begin with UTF_...

* *

Many string operations can be done with or without error checking. * Where such a distinction is useful, there are two versions of the macros, "unsafe" and "safe" * ones with ..._UNSAFE and ..._SAFE suffixes. The unsafe macros are fast but may cause * program failures if the strings are not well-formed. The safe macros have an additional, boolean * parameter "strict". If strict is FALSE, then only illegal sequences are detected. * Otherwise, irregular sequences and non-characters are detected as well (like single surrogates). * Safe macros return special error code points for illegal/irregular sequences: * Typically, U+ffff, or values that would result in a code unit sequence of the same length * as the erroneous input sequence.
* Note that _UNSAFE macros have fewer parameters: They do not have the strictness parameter, and * they do not have start/length parameters for boundary checking.

* *

Here, the macros are aliased in two steps: * In the first step, the UTF-specific macros with UTF16_ prefix and _UNSAFE and _SAFE suffixes are * aliased according to the UTF_SIZE to macros with UTF_ prefix and the same suffixes and signatures. * Then, in a second step, the default, general alias macros are set to use either the unsafe or * the safe/not strict (default) or the safe/strict macro; * these general macros do not have a strictness parameter.

* *

It is possible to change the default choice for the general alias macros to be unsafe, safe/not strict or safe/strict. * The default is safe/not strict. It is not recommended to select the unsafe macros as the basis for * Unicode string handling in ICU! To select this, define UTF_SAFE, UTF_STRICT, or UTF_UNSAFE.

* *

For general use, one should use the default, general macros with UTF_ prefix and no _SAFE/_UNSAFE suffix. * Only in some cases it may be necessary to control the choice of macro directly and use a less generic alias. * For example, if it can be assumed that a string is well-formed and the index will stay within the bounds, * then the _UNSAFE version may be used. * If a UTF-8 string is to be processed, then the macros with UTF8_ prefixes need to be used.

* *
* * @deprecated ICU 2.4. Use the macros in utf.h, utf16.h, utf8.h instead. */ #ifndef __UTF_OLD_H__ #define __UTF_OLD_H__ #ifndef U_HIDE_DEPRECATED_API /* utf.h must be included first. */ #ifndef __UTF_H__ # include "unicode/utf.h" #endif /* Formerly utf.h, part 1 --------------------------------------------------- */ #ifdef U_USE_UTF_DEPRECATES /** * Unicode string and array offset and index type. * ICU always counts Unicode code units (UChars) for * string offsets, indexes, and lengths, not Unicode code points. * * @obsolete ICU 2.6. Use int32_t directly instead since this API will be removed in that release. */ typedef int32_t UTextOffset; #endif /** Number of bits in a Unicode string code unit - ICU uses 16-bit Unicode. @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF_SIZE 16 /** * The default choice for general Unicode string macros is to use the ..._SAFE macro implementations * with strict=FALSE. * * @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF_SAFE /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #undef UTF_UNSAFE /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #undef UTF_STRICT /** * UTF8_ERROR_VALUE_1 and UTF8_ERROR_VALUE_2 are special error values for UTF-8, * which need 1 or 2 bytes in UTF-8: * \code * U+0015 = NAK = Negative Acknowledge, C0 control character * U+009f = highest C1 control character * \endcode * * These are used by UTF8_..._SAFE macros so that they can return an error value * that needs the same number of code units (bytes) as were seen by * a macro. They should be tested with UTF_IS_ERROR() or UTF_IS_VALID(). * * @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF8_ERROR_VALUE_1 0x15 /** * See documentation on UTF8_ERROR_VALUE_1 for details. * * @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF8_ERROR_VALUE_2 0x9f /** * Error value for all UTFs. This code point value will be set by macros with error * checking if an error is detected. * * @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF_ERROR_VALUE 0xffff /** * Is a given 32-bit code an error value * as returned by one of the macros for any UTF? * * @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF_IS_ERROR(c) \ (((c)&0xfffe)==0xfffe || (c)==UTF8_ERROR_VALUE_1 || (c)==UTF8_ERROR_VALUE_2) /** * This is a combined macro: Is c a valid Unicode value _and_ not an error code? * * @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF_IS_VALID(c) \ (UTF_IS_UNICODE_CHAR(c) && \ (c)!=UTF8_ERROR_VALUE_1 && (c)!=UTF8_ERROR_VALUE_2) /** * Is this code unit or code point a surrogate (U+d800..U+dfff)? * @deprecated ICU 2.4. Renamed to U_IS_SURROGATE and U16_IS_SURROGATE, see utf_old.h. */ #define UTF_IS_SURROGATE(uchar) (((uchar)&0xfffff800)==0xd800) /** * Is a given 32-bit code point a Unicode noncharacter? * * @deprecated ICU 2.4. Renamed to U_IS_UNICODE_NONCHAR, see utf_old.h. */ #define UTF_IS_UNICODE_NONCHAR(c) \ ((c)>=0xfdd0 && \ ((uint32_t)(c)<=0xfdef || ((c)&0xfffe)==0xfffe) && \ (uint32_t)(c)<=0x10ffff) /** * Is a given 32-bit value a Unicode code point value (0..U+10ffff) * that can be assigned a character? * * Code points that are not characters include: * - single surrogate code points (U+d800..U+dfff, 2048 code points) * - the last two code points on each plane (U+__fffe and U+__ffff, 34 code points) * - U+fdd0..U+fdef (new with Unicode 3.1, 32 code points) * - the highest Unicode code point value is U+10ffff * * This means that all code points below U+d800 are character code points, * and that boundary is tested first for performance. * * @deprecated ICU 2.4. Renamed to U_IS_UNICODE_CHAR, see utf_old.h. */ #define UTF_IS_UNICODE_CHAR(c) \ ((uint32_t)(c)<0xd800 || \ ((uint32_t)(c)>0xdfff && \ (uint32_t)(c)<=0x10ffff && \ !UTF_IS_UNICODE_NONCHAR(c))) /* Formerly utf8.h ---------------------------------------------------------- */ /** * Count the trail bytes for a UTF-8 lead byte. * @deprecated ICU 2.4. Renamed to U8_COUNT_TRAIL_BYTES, see utf_old.h. */ #define UTF8_COUNT_TRAIL_BYTES(leadByte) (utf8_countTrailBytes[(uint8_t)leadByte]) /** * Mask a UTF-8 lead byte, leave only the lower bits that form part of the code point value. * @deprecated ICU 2.4. Renamed to U8_MASK_LEAD_BYTE, see utf_old.h. */ #define UTF8_MASK_LEAD_BYTE(leadByte, countTrailBytes) ((leadByte)&=(1<<(6-(countTrailBytes)))-1) /** Is this this code point a single code unit (byte)? @deprecated ICU 2.4. Renamed to U8_IS_SINGLE, see utf_old.h. */ #define UTF8_IS_SINGLE(uchar) (((uchar)&0x80)==0) /** Is this this code unit the lead code unit (byte) of a code point? @deprecated ICU 2.4. Renamed to U8_IS_LEAD, see utf_old.h. */ #define UTF8_IS_LEAD(uchar) ((uint8_t)((uchar)-0xc0)<0x3e) /** Is this this code unit a trailing code unit (byte) of a code point? @deprecated ICU 2.4. Renamed to U8_IS_TRAIL, see utf_old.h. */ #define UTF8_IS_TRAIL(uchar) (((uchar)&0xc0)==0x80) /** Does this scalar Unicode value need multiple code units for storage? @deprecated ICU 2.4. Use U8_LENGTH or test ((uint32_t)(c)>0x7f) instead, see utf_old.h. */ #define UTF8_NEED_MULTIPLE_UCHAR(c) ((uint32_t)(c)>0x7f) /** * Given the lead character, how many bytes are taken by this code point. * ICU does not deal with code points >0x10ffff * unless necessary for advancing in the byte stream. * * These length macros take into account that for values >0x10ffff * the UTF8_APPEND_CHAR_SAFE macros would write the error code point 0xffff * with 3 bytes. * Code point comparisons need to be in uint32_t because UChar32 * may be a signed type, and negative values must be recognized. * * @deprecated ICU 2.4. Use U8_LENGTH instead, see utf_old.h. */ #if 1 # define UTF8_CHAR_LENGTH(c) \ ((uint32_t)(c)<=0x7f ? 1 : \ ((uint32_t)(c)<=0x7ff ? 2 : \ ((uint32_t)((c)-0x10000)>0xfffff ? 3 : 4) \ ) \ ) #else # define UTF8_CHAR_LENGTH(c) \ ((uint32_t)(c)<=0x7f ? 1 : \ ((uint32_t)(c)<=0x7ff ? 2 : \ ((uint32_t)(c)<=0xffff ? 3 : \ ((uint32_t)(c)<=0x10ffff ? 4 : \ ((uint32_t)(c)<=0x3ffffff ? 5 : \ ((uint32_t)(c)<=0x7fffffff ? 6 : 3) \ ) \ ) \ ) \ ) \ ) #endif /** The maximum number of bytes per code point. @deprecated ICU 2.4. Renamed to U8_MAX_LENGTH, see utf_old.h. */ #define UTF8_MAX_CHAR_LENGTH 4 /** Average number of code units compared to UTF-16. @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF8_ARRAY_SIZE(size) ((5*(size))/2) /** @deprecated ICU 2.4. Renamed to U8_GET_UNSAFE, see utf_old.h. */ #define UTF8_GET_CHAR_UNSAFE(s, i, c) { \ int32_t _utf8_get_char_unsafe_index=(int32_t)(i); \ UTF8_SET_CHAR_START_UNSAFE(s, _utf8_get_char_unsafe_index); \ UTF8_NEXT_CHAR_UNSAFE(s, _utf8_get_char_unsafe_index, c); \ } /** @deprecated ICU 2.4. Use U8_GET instead, see utf_old.h. */ #define UTF8_GET_CHAR_SAFE(s, start, i, length, c, strict) { \ int32_t _utf8_get_char_safe_index=(int32_t)(i); \ UTF8_SET_CHAR_START_SAFE(s, start, _utf8_get_char_safe_index); \ UTF8_NEXT_CHAR_SAFE(s, _utf8_get_char_safe_index, length, c, strict); \ } /** @deprecated ICU 2.4. Renamed to U8_NEXT_UNSAFE, see utf_old.h. */ #define UTF8_NEXT_CHAR_UNSAFE(s, i, c) { \ (c)=(s)[(i)++]; \ if((uint8_t)((c)-0xc0)<0x35) { \ uint8_t __count=UTF8_COUNT_TRAIL_BYTES(c); \ UTF8_MASK_LEAD_BYTE(c, __count); \ switch(__count) { \ /* each following branch falls through to the next one */ \ case 3: \ (c)=((c)<<6)|((s)[(i)++]&0x3f); \ case 2: \ (c)=((c)<<6)|((s)[(i)++]&0x3f); \ case 1: \ (c)=((c)<<6)|((s)[(i)++]&0x3f); \ /* no other branches to optimize switch() */ \ break; \ } \ } \ } /** @deprecated ICU 2.4. Renamed to U8_APPEND_UNSAFE, see utf_old.h. */ #define UTF8_APPEND_CHAR_UNSAFE(s, i, c) { \ if((uint32_t)(c)<=0x7f) { \ (s)[(i)++]=(uint8_t)(c); \ } else { \ if((uint32_t)(c)<=0x7ff) { \ (s)[(i)++]=(uint8_t)(((c)>>6)|0xc0); \ } else { \ if((uint32_t)(c)<=0xffff) { \ (s)[(i)++]=(uint8_t)(((c)>>12)|0xe0); \ } else { \ (s)[(i)++]=(uint8_t)(((c)>>18)|0xf0); \ (s)[(i)++]=(uint8_t)((((c)>>12)&0x3f)|0x80); \ } \ (s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80); \ } \ (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \ } \ } /** @deprecated ICU 2.4. Renamed to U8_FWD_1_UNSAFE, see utf_old.h. */ #define UTF8_FWD_1_UNSAFE(s, i) { \ (i)+=1+UTF8_COUNT_TRAIL_BYTES((s)[i]); \ } /** @deprecated ICU 2.4. Renamed to U8_FWD_N_UNSAFE, see utf_old.h. */ #define UTF8_FWD_N_UNSAFE(s, i, n) { \ int32_t __N=(n); \ while(__N>0) { \ UTF8_FWD_1_UNSAFE(s, i); \ --__N; \ } \ } /** @deprecated ICU 2.4. Renamed to U8_SET_CP_START_UNSAFE, see utf_old.h. */ #define UTF8_SET_CHAR_START_UNSAFE(s, i) { \ while(UTF8_IS_TRAIL((s)[i])) { --(i); } \ } /** @deprecated ICU 2.4. Use U8_NEXT instead, see utf_old.h. */ #define UTF8_NEXT_CHAR_SAFE(s, i, length, c, strict) { \ (c)=(s)[(i)++]; \ if((c)>=0x80) { \ if(UTF8_IS_LEAD(c)) { \ (c)=utf8_nextCharSafeBody(s, &(i), (int32_t)(length), c, strict); \ } else { \ (c)=UTF8_ERROR_VALUE_1; \ } \ } \ } /** @deprecated ICU 2.4. Use U8_APPEND instead, see utf_old.h. */ #define UTF8_APPEND_CHAR_SAFE(s, i, length, c) { \ if((uint32_t)(c)<=0x7f) { \ (s)[(i)++]=(uint8_t)(c); \ } else { \ (i)=utf8_appendCharSafeBody(s, (int32_t)(i), (int32_t)(length), c, NULL); \ } \ } /** @deprecated ICU 2.4. Renamed to U8_FWD_1, see utf_old.h. */ #define UTF8_FWD_1_SAFE(s, i, length) U8_FWD_1(s, i, length) /** @deprecated ICU 2.4. Renamed to U8_FWD_N, see utf_old.h. */ #define UTF8_FWD_N_SAFE(s, i, length, n) U8_FWD_N(s, i, length, n) /** @deprecated ICU 2.4. Renamed to U8_SET_CP_START, see utf_old.h. */ #define UTF8_SET_CHAR_START_SAFE(s, start, i) U8_SET_CP_START(s, start, i) /** @deprecated ICU 2.4. Renamed to U8_PREV_UNSAFE, see utf_old.h. */ #define UTF8_PREV_CHAR_UNSAFE(s, i, c) { \ (c)=(s)[--(i)]; \ if(UTF8_IS_TRAIL(c)) { \ uint8_t __b, __count=1, __shift=6; \ \ /* c is a trail byte */ \ (c)&=0x3f; \ for(;;) { \ __b=(s)[--(i)]; \ if(__b>=0xc0) { \ UTF8_MASK_LEAD_BYTE(__b, __count); \ (c)|=(UChar32)__b<<__shift; \ break; \ } else { \ (c)|=(UChar32)(__b&0x3f)<<__shift; \ ++__count; \ __shift+=6; \ } \ } \ } \ } /** @deprecated ICU 2.4. Renamed to U8_BACK_1_UNSAFE, see utf_old.h. */ #define UTF8_BACK_1_UNSAFE(s, i) { \ while(UTF8_IS_TRAIL((s)[--(i)])) {} \ } /** @deprecated ICU 2.4. Renamed to U8_BACK_N_UNSAFE, see utf_old.h. */ #define UTF8_BACK_N_UNSAFE(s, i, n) { \ int32_t __N=(n); \ while(__N>0) { \ UTF8_BACK_1_UNSAFE(s, i); \ --__N; \ } \ } /** @deprecated ICU 2.4. Renamed to U8_SET_CP_LIMIT_UNSAFE, see utf_old.h. */ #define UTF8_SET_CHAR_LIMIT_UNSAFE(s, i) { \ UTF8_BACK_1_UNSAFE(s, i); \ UTF8_FWD_1_UNSAFE(s, i); \ } /** @deprecated ICU 2.4. Use U8_PREV instead, see utf_old.h. */ #define UTF8_PREV_CHAR_SAFE(s, start, i, c, strict) { \ (c)=(s)[--(i)]; \ if((c)>=0x80) { \ if((c)<=0xbf) { \ (c)=utf8_prevCharSafeBody(s, start, &(i), c, strict); \ } else { \ (c)=UTF8_ERROR_VALUE_1; \ } \ } \ } /** @deprecated ICU 2.4. Renamed to U8_BACK_1, see utf_old.h. */ #define UTF8_BACK_1_SAFE(s, start, i) U8_BACK_1(s, start, i) /** @deprecated ICU 2.4. Renamed to U8_BACK_N, see utf_old.h. */ #define UTF8_BACK_N_SAFE(s, start, i, n) U8_BACK_N(s, start, i, n) /** @deprecated ICU 2.4. Renamed to U8_SET_CP_LIMIT, see utf_old.h. */ #define UTF8_SET_CHAR_LIMIT_SAFE(s, start, i, length) U8_SET_CP_LIMIT(s, start, i, length) /* Formerly utf16.h --------------------------------------------------------- */ /** Is uchar a first/lead surrogate? @deprecated ICU 2.4. Renamed to U_IS_LEAD and U16_IS_LEAD, see utf_old.h. */ #define UTF_IS_FIRST_SURROGATE(uchar) (((uchar)&0xfffffc00)==0xd800) /** Is uchar a second/trail surrogate? @deprecated ICU 2.4. Renamed to U_IS_TRAIL and U16_IS_TRAIL, see utf_old.h. */ #define UTF_IS_SECOND_SURROGATE(uchar) (((uchar)&0xfffffc00)==0xdc00) /** Assuming c is a surrogate, is it a first/lead surrogate? @deprecated ICU 2.4. Renamed to U_IS_SURROGATE_LEAD and U16_IS_SURROGATE_LEAD, see utf_old.h. */ #define UTF_IS_SURROGATE_FIRST(c) (((c)&0x400)==0) /** Helper constant for UTF16_GET_PAIR_VALUE. @deprecated ICU 2.4. Renamed to U16_SURROGATE_OFFSET, see utf_old.h. */ #define UTF_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000) /** Get the UTF-32 value from the surrogate code units. @deprecated ICU 2.4. Renamed to U16_GET_SUPPLEMENTARY, see utf_old.h. */ #define UTF16_GET_PAIR_VALUE(first, second) \ (((first)<<10UL)+(second)-UTF_SURROGATE_OFFSET) /** @deprecated ICU 2.4. Renamed to U16_LEAD, see utf_old.h. */ #define UTF_FIRST_SURROGATE(supplementary) (UChar)(((supplementary)>>10)+0xd7c0) /** @deprecated ICU 2.4. Renamed to U16_TRAIL, see utf_old.h. */ #define UTF_SECOND_SURROGATE(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00) /** @deprecated ICU 2.4. Renamed to U16_LEAD, see utf_old.h. */ #define UTF16_LEAD(supplementary) UTF_FIRST_SURROGATE(supplementary) /** @deprecated ICU 2.4. Renamed to U16_TRAIL, see utf_old.h. */ #define UTF16_TRAIL(supplementary) UTF_SECOND_SURROGATE(supplementary) /** @deprecated ICU 2.4. Renamed to U16_IS_SINGLE, see utf_old.h. */ #define UTF16_IS_SINGLE(uchar) !UTF_IS_SURROGATE(uchar) /** @deprecated ICU 2.4. Renamed to U16_IS_LEAD, see utf_old.h. */ #define UTF16_IS_LEAD(uchar) UTF_IS_FIRST_SURROGATE(uchar) /** @deprecated ICU 2.4. Renamed to U16_IS_TRAIL, see utf_old.h. */ #define UTF16_IS_TRAIL(uchar) UTF_IS_SECOND_SURROGATE(uchar) /** Does this scalar Unicode value need multiple code units for storage? @deprecated ICU 2.4. Use U16_LENGTH or test ((uint32_t)(c)>0xffff) instead, see utf_old.h. */ #define UTF16_NEED_MULTIPLE_UCHAR(c) ((uint32_t)(c)>0xffff) /** @deprecated ICU 2.4. Renamed to U16_LENGTH, see utf_old.h. */ #define UTF16_CHAR_LENGTH(c) ((uint32_t)(c)<=0xffff ? 1 : 2) /** @deprecated ICU 2.4. Renamed to U16_MAX_LENGTH, see utf_old.h. */ #define UTF16_MAX_CHAR_LENGTH 2 /** Average number of code units compared to UTF-16. @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF16_ARRAY_SIZE(size) (size) /** * Get a single code point from an offset that points to any * of the code units that belong to that code point. * Assume 0<=i=(start) && UTF_IS_FIRST_SURROGATE(__c2=(s)[(i)-1])) { \ (c)=UTF16_GET_PAIR_VALUE(__c2, (c)); \ /* strict: ((c)&0xfffe)==0xfffe is caught by UTF_IS_ERROR() and UTF_IS_UNICODE_CHAR() */ \ } else if(strict) {\ /* unmatched second surrogate */ \ (c)=UTF_ERROR_VALUE; \ } \ } \ } else if((strict) && !UTF_IS_UNICODE_CHAR(c)) { \ (c)=UTF_ERROR_VALUE; \ } \ } /** @deprecated ICU 2.4. Renamed to U16_NEXT_UNSAFE, see utf_old.h. */ #define UTF16_NEXT_CHAR_UNSAFE(s, i, c) { \ (c)=(s)[(i)++]; \ if(UTF_IS_FIRST_SURROGATE(c)) { \ (c)=UTF16_GET_PAIR_VALUE((c), (s)[(i)++]); \ } \ } /** @deprecated ICU 2.4. Renamed to U16_APPEND_UNSAFE, see utf_old.h. */ #define UTF16_APPEND_CHAR_UNSAFE(s, i, c) { \ if((uint32_t)(c)<=0xffff) { \ (s)[(i)++]=(uint16_t)(c); \ } else { \ (s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \ (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \ } \ } /** @deprecated ICU 2.4. Renamed to U16_FWD_1_UNSAFE, see utf_old.h. */ #define UTF16_FWD_1_UNSAFE(s, i) { \ if(UTF_IS_FIRST_SURROGATE((s)[(i)++])) { \ ++(i); \ } \ } /** @deprecated ICU 2.4. Renamed to U16_FWD_N_UNSAFE, see utf_old.h. */ #define UTF16_FWD_N_UNSAFE(s, i, n) { \ int32_t __N=(n); \ while(__N>0) { \ UTF16_FWD_1_UNSAFE(s, i); \ --__N; \ } \ } /** @deprecated ICU 2.4. Renamed to U16_SET_CP_START_UNSAFE, see utf_old.h. */ #define UTF16_SET_CHAR_START_UNSAFE(s, i) { \ if(UTF_IS_SECOND_SURROGATE((s)[i])) { \ --(i); \ } \ } /** @deprecated ICU 2.4. Use U16_NEXT instead, see utf_old.h. */ #define UTF16_NEXT_CHAR_SAFE(s, i, length, c, strict) { \ (c)=(s)[(i)++]; \ if(UTF_IS_FIRST_SURROGATE(c)) { \ uint16_t __c2; \ if((i)<(length) && UTF_IS_SECOND_SURROGATE(__c2=(s)[(i)])) { \ ++(i); \ (c)=UTF16_GET_PAIR_VALUE((c), __c2); \ /* strict: ((c)&0xfffe)==0xfffe is caught by UTF_IS_ERROR() and UTF_IS_UNICODE_CHAR() */ \ } else if(strict) {\ /* unmatched first surrogate */ \ (c)=UTF_ERROR_VALUE; \ } \ } else if((strict) && !UTF_IS_UNICODE_CHAR(c)) { \ /* unmatched second surrogate or other non-character */ \ (c)=UTF_ERROR_VALUE; \ } \ } /** @deprecated ICU 2.4. Use U16_APPEND instead, see utf_old.h. */ #define UTF16_APPEND_CHAR_SAFE(s, i, length, c) { \ if((uint32_t)(c)<=0xffff) { \ (s)[(i)++]=(uint16_t)(c); \ } else if((uint32_t)(c)<=0x10ffff) { \ if((i)+1<(length)) { \ (s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \ (s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \ } else /* not enough space */ { \ (s)[(i)++]=UTF_ERROR_VALUE; \ } \ } else /* c>0x10ffff, write error value */ { \ (s)[(i)++]=UTF_ERROR_VALUE; \ } \ } /** @deprecated ICU 2.4. Renamed to U16_FWD_1, see utf_old.h. */ #define UTF16_FWD_1_SAFE(s, i, length) U16_FWD_1(s, i, length) /** @deprecated ICU 2.4. Renamed to U16_FWD_N, see utf_old.h. */ #define UTF16_FWD_N_SAFE(s, i, length, n) U16_FWD_N(s, i, length, n) /** @deprecated ICU 2.4. Renamed to U16_SET_CP_START, see utf_old.h. */ #define UTF16_SET_CHAR_START_SAFE(s, start, i) U16_SET_CP_START(s, start, i) /** @deprecated ICU 2.4. Renamed to U16_PREV_UNSAFE, see utf_old.h. */ #define UTF16_PREV_CHAR_UNSAFE(s, i, c) { \ (c)=(s)[--(i)]; \ if(UTF_IS_SECOND_SURROGATE(c)) { \ (c)=UTF16_GET_PAIR_VALUE((s)[--(i)], (c)); \ } \ } /** @deprecated ICU 2.4. Renamed to U16_BACK_1_UNSAFE, see utf_old.h. */ #define UTF16_BACK_1_UNSAFE(s, i) { \ if(UTF_IS_SECOND_SURROGATE((s)[--(i)])) { \ --(i); \ } \ } /** @deprecated ICU 2.4. Renamed to U16_BACK_N_UNSAFE, see utf_old.h. */ #define UTF16_BACK_N_UNSAFE(s, i, n) { \ int32_t __N=(n); \ while(__N>0) { \ UTF16_BACK_1_UNSAFE(s, i); \ --__N; \ } \ } /** @deprecated ICU 2.4. Renamed to U16_SET_CP_LIMIT_UNSAFE, see utf_old.h. */ #define UTF16_SET_CHAR_LIMIT_UNSAFE(s, i) { \ if(UTF_IS_FIRST_SURROGATE((s)[(i)-1])) { \ ++(i); \ } \ } /** @deprecated ICU 2.4. Use U16_PREV instead, see utf_old.h. */ #define UTF16_PREV_CHAR_SAFE(s, start, i, c, strict) { \ (c)=(s)[--(i)]; \ if(UTF_IS_SECOND_SURROGATE(c)) { \ uint16_t __c2; \ if((i)>(start) && UTF_IS_FIRST_SURROGATE(__c2=(s)[(i)-1])) { \ --(i); \ (c)=UTF16_GET_PAIR_VALUE(__c2, (c)); \ /* strict: ((c)&0xfffe)==0xfffe is caught by UTF_IS_ERROR() and UTF_IS_UNICODE_CHAR() */ \ } else if(strict) {\ /* unmatched second surrogate */ \ (c)=UTF_ERROR_VALUE; \ } \ } else if((strict) && !UTF_IS_UNICODE_CHAR(c)) { \ /* unmatched first surrogate or other non-character */ \ (c)=UTF_ERROR_VALUE; \ } \ } /** @deprecated ICU 2.4. Renamed to U16_BACK_1, see utf_old.h. */ #define UTF16_BACK_1_SAFE(s, start, i) U16_BACK_1(s, start, i) /** @deprecated ICU 2.4. Renamed to U16_BACK_N, see utf_old.h. */ #define UTF16_BACK_N_SAFE(s, start, i, n) U16_BACK_N(s, start, i, n) /** @deprecated ICU 2.4. Renamed to U16_SET_CP_LIMIT, see utf_old.h. */ #define UTF16_SET_CHAR_LIMIT_SAFE(s, start, i, length) U16_SET_CP_LIMIT(s, start, i, length) /* Formerly utf32.h --------------------------------------------------------- */ /* * Old documentation: * * This file defines macros to deal with UTF-32 code units and code points. * Signatures and semantics are the same as for the similarly named macros * in utf16.h. * utf32.h is included by utf.h after unicode/umachine.h

* and some common definitions. *

Usage: ICU coding guidelines for if() statements should be followed when using these macros. * Compound statements (curly braces {}) must be used for if-else-while... * bodies and all macro statements should be terminated with semicolon.

*/ /* internal definitions ----------------------------------------------------- */ /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_IS_SAFE(c, strict) \ (!(strict) ? \ (uint32_t)(c)<=0x10ffff : \ UTF_IS_UNICODE_CHAR(c)) /* * For the semantics of all of these macros, see utf16.h. * The UTF-32 versions are trivial because any code point is * encoded using exactly one code unit. */ /* single-code point definitions -------------------------------------------- */ /* classes of code unit values */ /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_IS_SINGLE(uchar) 1 /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_IS_LEAD(uchar) 0 /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_IS_TRAIL(uchar) 0 /* number of code units per code point */ /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_NEED_MULTIPLE_UCHAR(c) 0 /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_CHAR_LENGTH(c) 1 /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_MAX_CHAR_LENGTH 1 /* average number of code units compared to UTF-16 */ /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_ARRAY_SIZE(size) (size) /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_GET_CHAR_UNSAFE(s, i, c) { \ (c)=(s)[i]; \ } /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_GET_CHAR_SAFE(s, start, i, length, c, strict) { \ (c)=(s)[i]; \ if(!UTF32_IS_SAFE(c, strict)) { \ (c)=UTF_ERROR_VALUE; \ } \ } /* definitions with forward iteration --------------------------------------- */ /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_NEXT_CHAR_UNSAFE(s, i, c) { \ (c)=(s)[(i)++]; \ } /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_APPEND_CHAR_UNSAFE(s, i, c) { \ (s)[(i)++]=(c); \ } /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_FWD_1_UNSAFE(s, i) { \ ++(i); \ } /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_FWD_N_UNSAFE(s, i, n) { \ (i)+=(n); \ } /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_SET_CHAR_START_UNSAFE(s, i) { \ } /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_NEXT_CHAR_SAFE(s, i, length, c, strict) { \ (c)=(s)[(i)++]; \ if(!UTF32_IS_SAFE(c, strict)) { \ (c)=UTF_ERROR_VALUE; \ } \ } /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_APPEND_CHAR_SAFE(s, i, length, c) { \ if((uint32_t)(c)<=0x10ffff) { \ (s)[(i)++]=(c); \ } else /* c>0x10ffff, write 0xfffd */ { \ (s)[(i)++]=0xfffd; \ } \ } /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_FWD_1_SAFE(s, i, length) { \ ++(i); \ } /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_FWD_N_SAFE(s, i, length, n) { \ if(((i)+=(n))>(length)) { \ (i)=(length); \ } \ } /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_SET_CHAR_START_SAFE(s, start, i) { \ } /* definitions with backward iteration -------------------------------------- */ /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_PREV_CHAR_UNSAFE(s, i, c) { \ (c)=(s)[--(i)]; \ } /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_BACK_1_UNSAFE(s, i) { \ --(i); \ } /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_BACK_N_UNSAFE(s, i, n) { \ (i)-=(n); \ } /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_SET_CHAR_LIMIT_UNSAFE(s, i) { \ } /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_PREV_CHAR_SAFE(s, start, i, c, strict) { \ (c)=(s)[--(i)]; \ if(!UTF32_IS_SAFE(c, strict)) { \ (c)=UTF_ERROR_VALUE; \ } \ } /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_BACK_1_SAFE(s, start, i) { \ --(i); \ } /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_BACK_N_SAFE(s, start, i, n) { \ (i)-=(n); \ if((i)<(start)) { \ (i)=(start); \ } \ } /** @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF32_SET_CHAR_LIMIT_SAFE(s, i, length) { \ } /* Formerly utf.h, part 2 --------------------------------------------------- */ /** * Estimate the number of code units for a string based on the number of UTF-16 code units. * * @deprecated ICU 2.4. Obsolete, see utf_old.h. */ #define UTF_ARRAY_SIZE(size) UTF16_ARRAY_SIZE(size) /** @deprecated ICU 2.4. Renamed to U16_GET_UNSAFE, see utf_old.h. */ #define UTF_GET_CHAR_UNSAFE(s, i, c) UTF16_GET_CHAR_UNSAFE(s, i, c) /** @deprecated ICU 2.4. Use U16_GET instead, see utf_old.h. */ #define UTF_GET_CHAR_SAFE(s, start, i, length, c, strict) UTF16_GET_CHAR_SAFE(s, start, i, length, c, strict) /** @deprecated ICU 2.4. Renamed to U16_NEXT_UNSAFE, see utf_old.h. */ #define UTF_NEXT_CHAR_UNSAFE(s, i, c) UTF16_NEXT_CHAR_UNSAFE(s, i, c) /** @deprecated ICU 2.4. Use U16_NEXT instead, see utf_old.h. */ #define UTF_NEXT_CHAR_SAFE(s, i, length, c, strict) UTF16_NEXT_CHAR_SAFE(s, i, length, c, strict) /** @deprecated ICU 2.4. Renamed to U16_APPEND_UNSAFE, see utf_old.h. */ #define UTF_APPEND_CHAR_UNSAFE(s, i, c) UTF16_APPEND_CHAR_UNSAFE(s, i, c) /** @deprecated ICU 2.4. Use U16_APPEND instead, see utf_old.h. */ #define UTF_APPEND_CHAR_SAFE(s, i, length, c) UTF16_APPEND_CHAR_SAFE(s, i, length, c) /** @deprecated ICU 2.4. Renamed to U16_FWD_1_UNSAFE, see utf_old.h. */ #define UTF_FWD_1_UNSAFE(s, i) UTF16_FWD_1_UNSAFE(s, i) /** @deprecated ICU 2.4. Renamed to U16_FWD_1, see utf_old.h. */ #define UTF_FWD_1_SAFE(s, i, length) UTF16_FWD_1_SAFE(s, i, length) /** @deprecated ICU 2.4. Renamed to U16_FWD_N_UNSAFE, see utf_old.h. */ #define UTF_FWD_N_UNSAFE(s, i, n) UTF16_FWD_N_UNSAFE(s, i, n) /** @deprecated ICU 2.4. Renamed to U16_FWD_N, see utf_old.h. */ #define UTF_FWD_N_SAFE(s, i, length, n) UTF16_FWD_N_SAFE(s, i, length, n) /** @deprecated ICU 2.4. Renamed to U16_SET_CP_START_UNSAFE, see utf_old.h. */ #define UTF_SET_CHAR_START_UNSAFE(s, i) UTF16_SET_CHAR_START_UNSAFE(s, i) /** @deprecated ICU 2.4. Renamed to U16_SET_CP_START, see utf_old.h. */ #define UTF_SET_CHAR_START_SAFE(s, start, i) UTF16_SET_CHAR_START_SAFE(s, start, i) /** @deprecated ICU 2.4. Renamed to U16_PREV_UNSAFE, see utf_old.h. */ #define UTF_PREV_CHAR_UNSAFE(s, i, c) UTF16_PREV_CHAR_UNSAFE(s, i, c) /** @deprecated ICU 2.4. Use U16_PREV instead, see utf_old.h. */ #define UTF_PREV_CHAR_SAFE(s, start, i, c, strict) UTF16_PREV_CHAR_SAFE(s, start, i, c, strict) /** @deprecated ICU 2.4. Renamed to U16_BACK_1_UNSAFE, see utf_old.h. */ #define UTF_BACK_1_UNSAFE(s, i) UTF16_BACK_1_UNSAFE(s, i) /** @deprecated ICU 2.4. Renamed to U16_BACK_1, see utf_old.h. */ #define UTF_BACK_1_SAFE(s, start, i) UTF16_BACK_1_SAFE(s, start, i) /** @deprecated ICU 2.4. Renamed to U16_BACK_N_UNSAFE, see utf_old.h. */ #define UTF_BACK_N_UNSAFE(s, i, n) UTF16_BACK_N_UNSAFE(s, i, n) /** @deprecated ICU 2.4. Renamed to U16_BACK_N, see utf_old.h. */ #define UTF_BACK_N_SAFE(s, start, i, n) UTF16_BACK_N_SAFE(s, start, i, n) /** @deprecated ICU 2.4. Renamed to U16_SET_CP_LIMIT_UNSAFE, see utf_old.h. */ #define UTF_SET_CHAR_LIMIT_UNSAFE(s, i) UTF16_SET_CHAR_LIMIT_UNSAFE(s, i) /** @deprecated ICU 2.4. Renamed to U16_SET_CP_LIMIT, see utf_old.h. */ #define UTF_SET_CHAR_LIMIT_SAFE(s, start, i, length) UTF16_SET_CHAR_LIMIT_SAFE(s, start, i, length) /* Define default macros (UTF-16 "safe") ------------------------------------ */ /** * Does this code unit alone encode a code point (BMP, not a surrogate)? * Same as UTF16_IS_SINGLE. * @deprecated ICU 2.4. Renamed to U_IS_SINGLE and U16_IS_SINGLE, see utf_old.h. */ #define UTF_IS_SINGLE(uchar) U16_IS_SINGLE(uchar) /** * Is this code unit the first one of several (a lead surrogate)? * Same as UTF16_IS_LEAD. * @deprecated ICU 2.4. Renamed to U_IS_LEAD and U16_IS_LEAD, see utf_old.h. */ #define UTF_IS_LEAD(uchar) U16_IS_LEAD(uchar) /** * Is this code unit one of several but not the first one (a trail surrogate)? * Same as UTF16_IS_TRAIL. * @deprecated ICU 2.4. Renamed to U_IS_TRAIL and U16_IS_TRAIL, see utf_old.h. */ #define UTF_IS_TRAIL(uchar) U16_IS_TRAIL(uchar) /** * Does this code point require multiple code units (is it a supplementary code point)? * Same as UTF16_NEED_MULTIPLE_UCHAR. * @deprecated ICU 2.4. Use U16_LENGTH or test ((uint32_t)(c)>0xffff) instead. */ #define UTF_NEED_MULTIPLE_UCHAR(c) UTF16_NEED_MULTIPLE_UCHAR(c) /** * How many code units are used to encode this code point (1 or 2)? * Same as UTF16_CHAR_LENGTH. * @deprecated ICU 2.4. Renamed to U16_LENGTH, see utf_old.h. */ #define UTF_CHAR_LENGTH(c) U16_LENGTH(c) /** * How many code units are used at most for any Unicode code point (2)? * Same as UTF16_MAX_CHAR_LENGTH. * @deprecated ICU 2.4. Renamed to U16_MAX_LENGTH, see utf_old.h. */ #define UTF_MAX_CHAR_LENGTH U16_MAX_LENGTH /** * Set c to the code point that contains the code unit i. * i could point to the lead or the trail surrogate for the code point. * i is not modified. * Same as UTF16_GET_CHAR. * \pre 0<=iThe model is that the enumeration is over strings maintained by * a 'service.' At any point, the service might change, invalidating * the enumerator (though this is expected to be rare). The iterator * returns an error if this has occurred. Lack of the error is no * guarantee that the service didn't change immediately after the * call, so the returned string still might not be 'valid' on * subsequent use.

* *

Strings may take the form of const char*, const UChar*, or const * UnicodeString*. The type you get is determine by the variant of * 'next' that you call. In general the StringEnumeration is * optimized for one of these types, but all StringEnumerations can * return all types. Returned strings are each terminated with a NUL. * Depending on the service data, they might also include embedded NUL * characters, so API is provided to optionally return the true * length, counting the embedded NULs but not counting the terminating * NUL.

* *

The pointers returned by next, unext, and snext become invalid * upon any subsequent call to the enumeration's destructor, next, * unext, snext, or reset.

* * ICU 2.8 adds some default implementations and helper functions * for subclasses. * * @stable ICU 2.4 */ class U_COMMON_API StringEnumeration : public UObject { public: /** * Destructor. * @stable ICU 2.4 */ virtual ~StringEnumeration(); /** * Clone this object, an instance of a subclass of StringEnumeration. * Clones can be used concurrently in multiple threads. * If a subclass does not implement clone(), or if an error occurs, * then NULL is returned. * The clone functions in all subclasses return a base class pointer * because some compilers do not support covariant (same-as-this) * return types; cast to the appropriate subclass if necessary. * The caller must delete the clone. * * @return a clone of this object * * @see getDynamicClassID * @stable ICU 2.8 */ virtual StringEnumeration *clone() const; /** *

Return the number of elements that the iterator traverses. If * the iterator is out of sync with its service, status is set to * U_ENUM_OUT_OF_SYNC_ERROR, and the return value is zero.

* *

The return value will not change except possibly as a result of * a subsequent call to reset, or if the iterator becomes out of sync.

* *

This is a convenience function. It can end up being very * expensive as all the items might have to be pre-fetched * (depending on the storage format of the data being * traversed).

* * @param status the error code. * @return number of elements in the iterator. * * @stable ICU 2.4 */ virtual int32_t count(UErrorCode& status) const = 0; /** *

Returns the next element as a NUL-terminated char*. If there * are no more elements, returns NULL. If the resultLength pointer * is not NULL, the length of the string (not counting the * terminating NUL) is returned at that address. If an error * status is returned, the value at resultLength is undefined.

* *

The returned pointer is owned by this iterator and must not be * deleted by the caller. The pointer is valid until the next call * to next, unext, snext, reset, or the enumerator's destructor.

* *

If the iterator is out of sync with its service, status is set * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.

* *

If the native service string is a UChar* string, it is * converted to char* with the invariant converter. If the * conversion fails (because a character cannot be converted) then * status is set to U_INVARIANT_CONVERSION_ERROR and the return * value is undefined (though not NULL).

* * Starting with ICU 2.8, the default implementation calls snext() * and handles the conversion. * * @param status the error code. * @param resultLength a pointer to receive the length, can be NULL. * @return a pointer to the string, or NULL. * * @stable ICU 2.4 */ virtual const char* next(int32_t *resultLength, UErrorCode& status); /** *

Returns the next element as a NUL-terminated UChar*. If there * are no more elements, returns NULL. If the resultLength pointer * is not NULL, the length of the string (not counting the * terminating NUL) is returned at that address. If an error * status is returned, the value at resultLength is undefined.

* *

The returned pointer is owned by this iterator and must not be * deleted by the caller. The pointer is valid until the next call * to next, unext, snext, reset, or the enumerator's destructor.

* *

If the iterator is out of sync with its service, status is set * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.

* * Starting with ICU 2.8, the default implementation calls snext() * and handles the conversion. * * @param status the error code. * @param resultLength a ponter to receive the length, can be NULL. * @return a pointer to the string, or NULL. * * @stable ICU 2.4 */ virtual const UChar* unext(int32_t *resultLength, UErrorCode& status); /** *

Returns the next element a UnicodeString*. If there are no * more elements, returns NULL.

* *

The returned pointer is owned by this iterator and must not be * deleted by the caller. The pointer is valid until the next call * to next, unext, snext, reset, or the enumerator's destructor.

* *

If the iterator is out of sync with its service, status is set * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.

* * @param status the error code. * @return a pointer to the string, or NULL. * * @stable ICU 2.4 */ virtual const UnicodeString* snext(UErrorCode& status) = 0; /** *

Resets the iterator. This re-establishes sync with the * service and rewinds the iterator to start at the first * element.

* *

Previous pointers returned by next, unext, or snext become * invalid, and the value returned by count might change.

* * @param status the error code. * * @stable ICU 2.4 */ virtual void reset(UErrorCode& status) = 0; /** * Compares this enumeration to other to check if both are equal * * @param that The other string enumeration to compare this object to * @return TRUE if the enumerations are equal. FALSE if not. * @stable ICU 3.6 */ virtual UBool operator==(const StringEnumeration& that)const; /** * Compares this enumeration to other to check if both are not equal * * @param that The other string enumeration to compare this object to * @return TRUE if the enumerations are equal. FALSE if not. * @stable ICU 3.6 */ virtual UBool operator!=(const StringEnumeration& that)const; protected: /** * UnicodeString field for use with default implementations and subclasses. * @stable ICU 2.8 */ UnicodeString unistr; /** * char * default buffer for use with default implementations and subclasses. * @stable ICU 2.8 */ char charsBuffer[32]; /** * char * buffer for use with default implementations and subclasses. * Allocated in constructor and in ensureCharsCapacity(). * @stable ICU 2.8 */ char *chars; /** * Capacity of chars, for use with default implementations and subclasses. * @stable ICU 2.8 */ int32_t charsCapacity; /** * Default constructor for use with default implementations and subclasses. * @stable ICU 2.8 */ StringEnumeration(); /** * Ensures that chars is at least as large as the requested capacity. * For use with default implementations and subclasses. * * @param capacity Requested capacity. * @param status ICU in/out error code. * @stable ICU 2.8 */ void ensureCharsCapacity(int32_t capacity, UErrorCode &status); /** * Converts s to Unicode and sets unistr to the result. * For use with default implementations and subclasses, * especially for implementations of snext() in terms of next(). * This is provided with a helper function instead of a default implementation * of snext() to avoid potential infinite loops between next() and snext(). * * For example: * \code * const UnicodeString* snext(UErrorCode& status) { * int32_t resultLength=0; * const char *s=next(&resultLength, status); * return setChars(s, resultLength, status); * } * \endcode * * @param s String to be converted to Unicode. * @param length Length of the string. * @param status ICU in/out error code. * @return A pointer to unistr. * @stable ICU 2.8 */ UnicodeString *setChars(const char *s, int32_t length, UErrorCode &status); }; U_NAMESPACE_END /* STRENUM_H */ #endif android-audiosystem-1.8+13.10.20130807/include/unicode/ucnv.h0000644000015700001700000024310312200324306024072 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (C) 1999-2010, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * ucnv.h: * External APIs for the ICU's codeset conversion library * Bertrand A. Damiba * * Modification History: * * Date Name Description * 04/04/99 helena Fixed internal header inclusion. * 05/11/00 helena Added setFallback and usesFallback APIs. * 06/29/2000 helena Major rewrite of the callback APIs. * 12/07/2000 srl Update of documentation */ /** * \file * \brief C API: Character conversion * *

Character Conversion C API

* *

This API is used to convert codepage or character encoded data to and * from UTF-16. You can open a converter with {@link ucnv_open() }. With that * converter, you can get its properties, set options, convert your data and * close the converter.

* *

Since many software programs recogize different converter names for * different types of converters, there are other functions in this API to * iterate over the converter aliases. The functions {@link ucnv_getAvailableName() }, * {@link ucnv_getAlias() } and {@link ucnv_getStandardName() } are some of the * more frequently used alias functions to get this information.

* *

When a converter encounters an illegal, irregular, invalid or unmappable character * its default behavior is to use a substitution character to replace the * bad byte sequence. This behavior can be changed by using {@link ucnv_setFromUCallBack() } * or {@link ucnv_setToUCallBack() } on the converter. The header ucnv_err.h defines * many other callback actions that can be used instead of a character substitution.

* *

More information about this API can be found in our * User's * Guide.

*/ #ifndef UCNV_H #define UCNV_H #include "unicode/ucnv_err.h" #include "unicode/uenum.h" #include "unicode/localpointer.h" #ifndef __USET_H__ /** * USet is the C API type for Unicode sets. * It is forward-declared here to avoid including the header file if related * conversion APIs are not used. * See unicode/uset.h * * @see ucnv_getUnicodeSet * @stable ICU 2.6 */ struct USet; /** @stable ICU 2.6 */ typedef struct USet USet; #endif #if !UCONFIG_NO_CONVERSION U_CDECL_BEGIN /** Maximum length of a converter name including the terminating NULL @stable ICU 2.0 */ #define UCNV_MAX_CONVERTER_NAME_LENGTH 60 /** Maximum length of a converter name including path and terminating NULL @stable ICU 2.0 */ #define UCNV_MAX_FULL_FILE_NAME_LENGTH (600+UCNV_MAX_CONVERTER_NAME_LENGTH) /** Shift in for EBDCDIC_STATEFUL and iso2022 states @stable ICU 2.0 */ #define UCNV_SI 0x0F /** Shift out for EBDCDIC_STATEFUL and iso2022 states @stable ICU 2.0 */ #define UCNV_SO 0x0E /** * Enum for specifying basic types of converters * @see ucnv_getType * @stable ICU 2.0 */ typedef enum { UCNV_UNSUPPORTED_CONVERTER = -1, UCNV_SBCS = 0, UCNV_DBCS = 1, UCNV_MBCS = 2, UCNV_LATIN_1 = 3, UCNV_UTF8 = 4, UCNV_UTF16_BigEndian = 5, UCNV_UTF16_LittleEndian = 6, UCNV_UTF32_BigEndian = 7, UCNV_UTF32_LittleEndian = 8, UCNV_EBCDIC_STATEFUL = 9, UCNV_ISO_2022 = 10, UCNV_LMBCS_1 = 11, UCNV_LMBCS_2, UCNV_LMBCS_3, UCNV_LMBCS_4, UCNV_LMBCS_5, UCNV_LMBCS_6, UCNV_LMBCS_8, UCNV_LMBCS_11, UCNV_LMBCS_16, UCNV_LMBCS_17, UCNV_LMBCS_18, UCNV_LMBCS_19, UCNV_LMBCS_LAST = UCNV_LMBCS_19, UCNV_HZ, UCNV_SCSU, UCNV_ISCII, UCNV_US_ASCII, UCNV_UTF7, UCNV_BOCU1, UCNV_UTF16, UCNV_UTF32, UCNV_CESU8, UCNV_IMAP_MAILBOX, /* Number of converter types for which we have conversion routines. */ UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES } UConverterType; /** * Enum for specifying which platform a converter ID refers to. * The use of platform/CCSID is not recommended. See ucnv_openCCSID(). * * @see ucnv_getPlatform * @see ucnv_openCCSID * @see ucnv_getCCSID * @stable ICU 2.0 */ typedef enum { UCNV_UNKNOWN = -1, UCNV_IBM = 0 } UConverterPlatform; /** * Function pointer for error callback in the codepage to unicode direction. * Called when an error has occured in conversion to unicode, or on open/close of the callback (see reason). * @param context Pointer to the callback's private data * @param args Information about the conversion in progress * @param codeUnits Points to 'length' bytes of the concerned codepage sequence * @param length Size (in bytes) of the concerned codepage sequence * @param reason Defines the reason the callback was invoked * @param pErrorCode ICU error code in/out parameter. * For converter callback functions, set to a conversion error * before the call, and the callback may reset it to U_ZERO_ERROR. * @see ucnv_setToUCallBack * @see UConverterToUnicodeArgs * @stable ICU 2.0 */ typedef void (U_EXPORT2 *UConverterToUCallback) ( const void* context, UConverterToUnicodeArgs *args, const char *codeUnits, int32_t length, UConverterCallbackReason reason, UErrorCode *pErrorCode); /** * Function pointer for error callback in the unicode to codepage direction. * Called when an error has occured in conversion from unicode, or on open/close of the callback (see reason). * @param context Pointer to the callback's private data * @param args Information about the conversion in progress * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence * @param length Size (in bytes) of the concerned codepage sequence * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. * @param reason Defines the reason the callback was invoked * @param pErrorCode ICU error code in/out parameter. * For converter callback functions, set to a conversion error * before the call, and the callback may reset it to U_ZERO_ERROR. * @see ucnv_setFromUCallBack * @stable ICU 2.0 */ typedef void (U_EXPORT2 *UConverterFromUCallback) ( const void* context, UConverterFromUnicodeArgs *args, const UChar* codeUnits, int32_t length, UChar32 codePoint, UConverterCallbackReason reason, UErrorCode *pErrorCode); U_CDECL_END /** * Character that separates converter names from options and options from each other. * @see ucnv_open * @stable ICU 2.0 */ #define UCNV_OPTION_SEP_CHAR ',' /** * String version of UCNV_OPTION_SEP_CHAR. * @see ucnv_open * @stable ICU 2.0 */ #define UCNV_OPTION_SEP_STRING "," /** * Character that separates a converter option from its value. * @see ucnv_open * @stable ICU 2.0 */ #define UCNV_VALUE_SEP_CHAR '=' /** * String version of UCNV_VALUE_SEP_CHAR. * @see ucnv_open * @stable ICU 2.0 */ #define UCNV_VALUE_SEP_STRING "=" /** * Converter option for specifying a locale. * For example, ucnv_open("SCSU,locale=ja", &errorCode); * See convrtrs.txt. * * @see ucnv_open * @stable ICU 2.0 */ #define UCNV_LOCALE_OPTION_STRING ",locale=" /** * Converter option for specifying a version selector (0..9) for some converters. * For example, * \code * ucnv_open("UTF-7,version=1", &errorCode); * \endcode * See convrtrs.txt. * * @see ucnv_open * @stable ICU 2.4 */ #define UCNV_VERSION_OPTION_STRING ",version=" /** * Converter option for EBCDIC SBCS or mixed-SBCS/DBCS (stateful) codepages. * Swaps Unicode mappings for EBCDIC LF and NL codes, as used on * S/390 (z/OS) Unix System Services (Open Edition). * For example, ucnv_open("ibm-1047,swaplfnl", &errorCode); * See convrtrs.txt. * * @see ucnv_open * @stable ICU 2.4 */ #define UCNV_SWAP_LFNL_OPTION_STRING ",swaplfnl" /** * Do a fuzzy compare of two converter/alias names. * The comparison is case-insensitive, ignores leading zeroes if they are not * followed by further digits, and ignores all but letters and digits. * Thus the strings "UTF-8", "utf_8", "u*T@f08" and "Utf 8" are exactly equivalent. * See section 1.4, Charset Alias Matching in Unicode Technical Standard #22 * at http://www.unicode.org/reports/tr22/ * * @param name1 a converter name or alias, zero-terminated * @param name2 a converter name or alias, zero-terminated * @return 0 if the names match, or a negative value if the name1 * lexically precedes name2, or a positive value if the name1 * lexically follows name2. * @stable ICU 2.0 */ U_STABLE int U_EXPORT2 ucnv_compareNames(const char *name1, const char *name2); /** * Creates a UConverter object with the name of a coded character set specified as a C string. * The actual name will be resolved with the alias file * using a case-insensitive string comparison that ignores * leading zeroes and all non-alphanumeric characters. * E.g., the names "UTF8", "utf-8", "u*T@f08" and "Utf 8" are all equivalent. * (See also ucnv_compareNames().) * If NULL is passed for the converter name, it will create one with the * getDefaultName return value. * *

A converter name for ICU 1.5 and above may contain options * like a locale specification to control the specific behavior of * the newly instantiated converter. * The meaning of the options depends on the particular converter. * If an option is not defined for or recognized by a given converter, then it is ignored.

* *

Options are appended to the converter name string, with a * UCNV_OPTION_SEP_CHAR between the name and the first option and * also between adjacent options.

* *

If the alias is ambiguous, then the preferred converter is used * and the status is set to U_AMBIGUOUS_ALIAS_WARNING.

* *

The conversion behavior and names can vary between platforms. ICU may * convert some characters differently from other platforms. Details on this topic * are in the User's * Guide. Aliases starting with a "cp" prefix have no specific meaning * other than its an alias starting with the letters "cp". Please do not * associate any meaning to these aliases.

* * @param converterName Name of the coded character set table. * This may have options appended to the string. * IANA alias character set names, IBM CCSIDs starting with "ibm-", * Windows codepage numbers starting with "windows-" are frequently * used for this parameter. See ucnv_getAvailableName and * ucnv_getAlias for a complete list that is available. * If this parameter is NULL, the default converter will be used. * @param err outgoing error status U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR * @return the created Unicode converter object, or NULL if an error occured * @see ucnv_openU * @see ucnv_openCCSID * @see ucnv_getAvailableName * @see ucnv_getAlias * @see ucnv_getDefaultName * @see ucnv_close * @see ucnv_compareNames * @stable ICU 2.0 */ U_STABLE UConverter* U_EXPORT2 ucnv_open(const char *converterName, UErrorCode *err); /** * Creates a Unicode converter with the names specified as unicode string. * The name should be limited to the ASCII-7 alphanumerics range. * The actual name will be resolved with the alias file * using a case-insensitive string comparison that ignores * leading zeroes and all non-alphanumeric characters. * E.g., the names "UTF8", "utf-8", "u*T@f08" and "Utf 8" are all equivalent. * (See also ucnv_compareNames().) * If NULL is passed for the converter name, it will create * one with the ucnv_getDefaultName() return value. * If the alias is ambiguous, then the preferred converter is used * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. * *

See ucnv_open for the complete details

* @param name Name of the UConverter table in a zero terminated * Unicode string * @param err outgoing error status U_MEMORY_ALLOCATION_ERROR, * U_FILE_ACCESS_ERROR * @return the created Unicode converter object, or NULL if an * error occured * @see ucnv_open * @see ucnv_openCCSID * @see ucnv_close * @see ucnv_compareNames * @stable ICU 2.0 */ U_STABLE UConverter* U_EXPORT2 ucnv_openU(const UChar *name, UErrorCode *err); /** * Creates a UConverter object from a CCSID number and platform pair. * Note that the usefulness of this function is limited to platforms with numeric * encoding IDs. Only IBM and Microsoft platforms use numeric (16-bit) identifiers for * encodings. * * In addition, IBM CCSIDs and Unicode conversion tables are not 1:1 related. * For many IBM CCSIDs there are multiple (up to six) Unicode conversion tables, and * for some Unicode conversion tables there are multiple CCSIDs. * Some "alternate" Unicode conversion tables are provided by the * IBM CDRA conversion table registry. * The most prominent example of a systematic modification of conversion tables that is * not provided in the form of conversion table files in the repository is * that S/390 Unix System Services swaps the codes for Line Feed and New Line in all * EBCDIC codepages, which requires such a swap in the Unicode conversion tables as well. * * Only IBM default conversion tables are accessible with ucnv_openCCSID(). * ucnv_getCCSID() will return the same CCSID for all conversion tables that are associated * with that CCSID. * * Currently, the only "platform" supported in the ICU converter API is UCNV_IBM. * * In summary, the use of CCSIDs and the associated API functions is not recommended. * * In order to open a converter with the default IBM CDRA Unicode conversion table, * you can use this function or use the prefix "ibm-": * \code * char name[20]; * sprintf(name, "ibm-%hu", ccsid); * cnv=ucnv_open(name, &errorCode); * \endcode * * In order to open a converter with the IBM S/390 Unix System Services variant * of a Unicode/EBCDIC conversion table, * you can use the prefix "ibm-" together with the option string UCNV_SWAP_LFNL_OPTION_STRING: * \code * char name[20]; * sprintf(name, "ibm-%hu" UCNV_SWAP_LFNL_OPTION_STRING, ccsid); * cnv=ucnv_open(name, &errorCode); * \endcode * * In order to open a converter from a Microsoft codepage number, use the prefix "cp": * \code * char name[20]; * sprintf(name, "cp%hu", codepageID); * cnv=ucnv_open(name, &errorCode); * \endcode * * If the alias is ambiguous, then the preferred converter is used * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. * * @param codepage codepage number to create * @param platform the platform in which the codepage number exists * @param err error status U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR * @return the created Unicode converter object, or NULL if an error * occured. * @see ucnv_open * @see ucnv_openU * @see ucnv_close * @see ucnv_getCCSID * @see ucnv_getPlatform * @see UConverterPlatform * @stable ICU 2.0 */ U_STABLE UConverter* U_EXPORT2 ucnv_openCCSID(int32_t codepage, UConverterPlatform platform, UErrorCode * err); /** *

Creates a UConverter object specified from a packageName and a converterName.

* *

The packageName and converterName must point to an ICU udata object, as defined by * udata_open( packageName, "cnv", converterName, err) or equivalent. * Typically, packageName will refer to a (.dat) file, or to a package registered with * udata_setAppData(). Using a full file or directory pathname for packageName is deprecated.

* *

The name will NOT be looked up in the alias mechanism, nor will the converter be * stored in the converter cache or the alias table. The only way to open further converters * is call this function multiple times, or use the ucnv_safeClone() function to clone a * 'master' converter.

* *

A future version of ICU may add alias table lookups and/or caching * to this function.

* *

Example Use: * cnv = ucnv_openPackage("myapp", "myconverter", &err); *

* * @param packageName name of the package (equivalent to 'path' in udata_open() call) * @param converterName name of the data item to be used, without suffix. * @param err outgoing error status U_MEMORY_ALLOCATION_ERROR, U_FILE_ACCESS_ERROR * @return the created Unicode converter object, or NULL if an error occured * @see udata_open * @see ucnv_open * @see ucnv_safeClone * @see ucnv_close * @stable ICU 2.2 */ U_STABLE UConverter* U_EXPORT2 ucnv_openPackage(const char *packageName, const char *converterName, UErrorCode *err); /** * Thread safe converter cloning operation. * For most efficient operation, pass in a stackBuffer (and a *pBufferSize) * with at least U_CNV_SAFECLONE_BUFFERSIZE bytes of space. * If the buffer size is sufficient, then the clone will use the stack buffer; * otherwise, it will be allocated, and *pBufferSize will indicate * the actual size. (This should not occur with U_CNV_SAFECLONE_BUFFERSIZE.) * * You must ucnv_close() the clone in any case. * * If *pBufferSize==0, (regardless of whether stackBuffer==NULL or not) * then *pBufferSize will be changed to a sufficient size * for cloning this converter, * without actually cloning the converter ("pure pre-flighting"). * * If *pBufferSize is greater than zero but not large enough for a stack-based * clone, then the converter is cloned using newly allocated memory * and *pBufferSize is changed to the necessary size. * * If the converter clone fits into the stack buffer but the stack buffer is not * sufficiently aligned for the clone, then the clone will use an * adjusted pointer and use an accordingly smaller buffer size. * * @param cnv converter to be cloned * @param stackBuffer user allocated space for the new clone. If NULL new memory will be allocated. * If buffer is not large enough, new memory will be allocated. * Clients can use the U_CNV_SAFECLONE_BUFFERSIZE. This will probably be enough to avoid memory allocations. * @param pBufferSize pointer to size of allocated space. pBufferSize must not be NULL. * @param status to indicate whether the operation went on smoothly or there were errors * An informational status value, U_SAFECLONE_ALLOCATED_WARNING, * is used if any allocations were necessary. * However, it is better to check if *pBufferSize grew for checking for * allocations because warning codes can be overridden by subsequent * function calls. * @return pointer to the new clone * @stable ICU 2.0 */ U_STABLE UConverter * U_EXPORT2 ucnv_safeClone(const UConverter *cnv, void *stackBuffer, int32_t *pBufferSize, UErrorCode *status); /** * \def U_CNV_SAFECLONE_BUFFERSIZE * Definition of a buffer size that is designed to be large enough for * converters to be cloned with ucnv_safeClone(). * @stable ICU 2.0 */ #define U_CNV_SAFECLONE_BUFFERSIZE 1024 /** * Deletes the unicode converter and releases resources associated * with just this instance. * Does not free up shared converter tables. * * @param converter the converter object to be deleted * @see ucnv_open * @see ucnv_openU * @see ucnv_openCCSID * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_close(UConverter * converter); #if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN /** * \class LocalUConverterPointer * "Smart pointer" class, closes a UConverter via ucnv_close(). * For most methods see the LocalPointerBase base class. * * @see LocalPointerBase * @see LocalPointer * @stable ICU 4.4 */ U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterPointer, UConverter, ucnv_close); U_NAMESPACE_END #endif /** * Fills in the output parameter, subChars, with the substitution characters * as multiple bytes. * If ucnv_setSubstString() set a Unicode string because the converter is * stateful, then subChars will be an empty string. * * @param converter the Unicode converter * @param subChars the subsitution characters * @param len on input the capacity of subChars, on output the number * of bytes copied to it * @param err the outgoing error status code. * If the substitution character array is too small, an * U_INDEX_OUTOFBOUNDS_ERROR will be returned. * @see ucnv_setSubstString * @see ucnv_setSubstChars * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_getSubstChars(const UConverter *converter, char *subChars, int8_t *len, UErrorCode *err); /** * Sets the substitution chars when converting from unicode to a codepage. The * substitution is specified as a string of 1-4 bytes, and may contain * NULL bytes. * The subChars must represent a single character. The caller needs to know the * byte sequence of a valid character in the converter's charset. * For some converters, for example some ISO 2022 variants, only single-byte * substitution characters may be supported. * The newer ucnv_setSubstString() function relaxes these limitations. * * @param converter the Unicode converter * @param subChars the substitution character byte sequence we want set * @param len the number of bytes in subChars * @param err the error status code. U_INDEX_OUTOFBOUNDS_ERROR if * len is bigger than the maximum number of bytes allowed in subchars * @see ucnv_setSubstString * @see ucnv_getSubstChars * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_setSubstChars(UConverter *converter, const char *subChars, int8_t len, UErrorCode *err); /** * Set a substitution string for converting from Unicode to a charset. * The caller need not know the charset byte sequence for each charset. * * Unlike ucnv_setSubstChars() which is designed to set a charset byte sequence * for a single character, this function takes a Unicode string with * zero, one or more characters, and immediately verifies that the string can be * converted to the charset. * If not, or if the result is too long (more than 32 bytes as of ICU 3.6), * then the function returns with an error accordingly. * * Also unlike ucnv_setSubstChars(), this function works for stateful charsets * by converting on the fly at the point of substitution rather than setting * a fixed byte sequence. * * @param cnv The UConverter object. * @param s The Unicode string. * @param length The number of UChars in s, or -1 for a NUL-terminated string. * @param err Pointer to a standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * * @see ucnv_setSubstChars * @see ucnv_getSubstChars * @stable ICU 3.6 */ U_STABLE void U_EXPORT2 ucnv_setSubstString(UConverter *cnv, const UChar *s, int32_t length, UErrorCode *err); /** * Fills in the output parameter, errBytes, with the error characters from the * last failing conversion. * * @param converter the Unicode converter * @param errBytes the codepage bytes which were in error * @param len on input the capacity of errBytes, on output the number of * bytes which were copied to it * @param err the error status code. * If the substitution character array is too small, an * U_INDEX_OUTOFBOUNDS_ERROR will be returned. * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_getInvalidChars(const UConverter *converter, char *errBytes, int8_t *len, UErrorCode *err); /** * Fills in the output parameter, errChars, with the error characters from the * last failing conversion. * * @param converter the Unicode converter * @param errUChars the UChars which were in error * @param len on input the capacity of errUChars, on output the number of * UChars which were copied to it * @param err the error status code. * If the substitution character array is too small, an * U_INDEX_OUTOFBOUNDS_ERROR will be returned. * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_getInvalidUChars(const UConverter *converter, UChar *errUChars, int8_t *len, UErrorCode *err); /** * Resets the state of a converter to the default state. This is used * in the case of an error, to restart a conversion from a known default state. * It will also empty the internal output buffers. * @param converter the Unicode converter * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_reset(UConverter *converter); /** * Resets the to-Unicode part of a converter state to the default state. * This is used in the case of an error to restart a conversion to * Unicode to a known default state. It will also empty the internal * output buffers used for the conversion to Unicode codepoints. * @param converter the Unicode converter * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_resetToUnicode(UConverter *converter); /** * Resets the from-Unicode part of a converter state to the default state. * This is used in the case of an error to restart a conversion from * Unicode to a known default state. It will also empty the internal output * buffers used for the conversion from Unicode codepoints. * @param converter the Unicode converter * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_resetFromUnicode(UConverter *converter); /** * Returns the maximum number of bytes that are output per UChar in conversion * from Unicode using this converter. * The returned number can be used with UCNV_GET_MAX_BYTES_FOR_STRING * to calculate the size of a target buffer for conversion from Unicode. * * Note: Before ICU 2.8, this function did not return reliable numbers for * some stateful converters (EBCDIC_STATEFUL, ISO-2022) and LMBCS. * * This number may not be the same as the maximum number of bytes per * "conversion unit". In other words, it may not be the intuitively expected * number of bytes per character that would be published for a charset, * and may not fulfill any other purpose than the allocation of an output * buffer of guaranteed sufficient size for a given input length and converter. * * Examples for special cases that are taken into account: * - Supplementary code points may convert to more bytes than BMP code points. * This function returns bytes per UChar (UTF-16 code unit), not per * Unicode code point, for efficient buffer allocation. * - State-shifting output (SI/SO, escapes, etc.) from stateful converters. * - When m input UChars are converted to n output bytes, then the maximum m/n * is taken into account. * * The number returned here does not take into account * (see UCNV_GET_MAX_BYTES_FOR_STRING): * - callbacks which output more than one charset character sequence per call, * like escape callbacks * - initial and final non-character bytes that are output by some converters * (automatic BOMs, initial escape sequence, final SI, etc.) * * Examples for returned values: * - SBCS charsets: 1 * - Shift-JIS: 2 * - UTF-16: 2 (2 per BMP, 4 per surrogate _pair_, BOM not counted) * - UTF-8: 3 (3 per BMP, 4 per surrogate _pair_) * - EBCDIC_STATEFUL (EBCDIC mixed SBCS/DBCS): 3 (SO + DBCS) * - ISO-2022: 3 (always outputs UTF-8) * - ISO-2022-JP: 6 (4-byte escape sequences + DBCS) * - ISO-2022-CN: 8 (4-byte designator sequences + 2-byte SS2/SS3 + DBCS) * * @param converter The Unicode converter. * @return The maximum number of bytes per UChar that are output by ucnv_fromUnicode(), * to be used together with UCNV_GET_MAX_BYTES_FOR_STRING for buffer allocation. * * @see UCNV_GET_MAX_BYTES_FOR_STRING * @see ucnv_getMinCharSize * @stable ICU 2.0 */ U_STABLE int8_t U_EXPORT2 ucnv_getMaxCharSize(const UConverter *converter); /** * Calculates the size of a buffer for conversion from Unicode to a charset. * The calculated size is guaranteed to be sufficient for this conversion. * * It takes into account initial and final non-character bytes that are output * by some converters. * It does not take into account callbacks which output more than one charset * character sequence per call, like escape callbacks. * The default (substitution) callback only outputs one charset character sequence. * * @param length Number of UChars to be converted. * @param maxCharSize Return value from ucnv_getMaxCharSize() for the converter * that will be used. * @return Size of a buffer that will be large enough to hold the output bytes of * converting length UChars with the converter that returned the maxCharSize. * * @see ucnv_getMaxCharSize * @stable ICU 2.8 */ #define UCNV_GET_MAX_BYTES_FOR_STRING(length, maxCharSize) \ (((int32_t)(length)+10)*(int32_t)(maxCharSize)) /** * Returns the minimum byte length for characters in this codepage. * This is usually either 1 or 2. * @param converter the Unicode converter * @return the minimum number of bytes allowed by this particular converter * @see ucnv_getMaxCharSize * @stable ICU 2.0 */ U_STABLE int8_t U_EXPORT2 ucnv_getMinCharSize(const UConverter *converter); /** * Returns the display name of the converter passed in based on the Locale * passed in. If the locale contains no display name, the internal ASCII * name will be filled in. * * @param converter the Unicode converter. * @param displayLocale is the specific Locale we want to localised for * @param displayName user provided buffer to be filled in * @param displayNameCapacity size of displayName Buffer * @param err error status code * @return displayNameLength number of UChar needed in displayName * @see ucnv_getName * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ucnv_getDisplayName(const UConverter *converter, const char *displayLocale, UChar *displayName, int32_t displayNameCapacity, UErrorCode *err); /** * Gets the internal, canonical name of the converter (zero-terminated). * The lifetime of the returned string will be that of the converter * passed to this function. * @param converter the Unicode converter * @param err UErrorCode status * @return the internal name of the converter * @see ucnv_getDisplayName * @stable ICU 2.0 */ U_STABLE const char * U_EXPORT2 ucnv_getName(const UConverter *converter, UErrorCode *err); /** * Gets a codepage number associated with the converter. This is not guaranteed * to be the one used to create the converter. Some converters do not represent * platform registered codepages and return zero for the codepage number. * The error code fill-in parameter indicates if the codepage number * is available. * Does not check if the converter is NULL or if converter's data * table is NULL. * * Important: The use of CCSIDs is not recommended because it is limited * to only two platforms in principle and only one (UCNV_IBM) in the current * ICU converter API. * Also, CCSIDs are insufficient to identify IBM Unicode conversion tables precisely. * For more details see ucnv_openCCSID(). * * @param converter the Unicode converter * @param err the error status code. * @return If any error occurrs, -1 will be returned otherwise, the codepage number * will be returned * @see ucnv_openCCSID * @see ucnv_getPlatform * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ucnv_getCCSID(const UConverter *converter, UErrorCode *err); /** * Gets a codepage platform associated with the converter. Currently, * only UCNV_IBM will be returned. * Does not test if the converter is NULL or if converter's data * table is NULL. * @param converter the Unicode converter * @param err the error status code. * @return The codepage platform * @stable ICU 2.0 */ U_STABLE UConverterPlatform U_EXPORT2 ucnv_getPlatform(const UConverter *converter, UErrorCode *err); /** * Gets the type of the converter * e.g. SBCS, MBCS, DBCS, UTF8, UTF16_BE, UTF16_LE, ISO_2022, * EBCDIC_STATEFUL, LATIN_1 * @param converter a valid, opened converter * @return the type of the converter * @stable ICU 2.0 */ U_STABLE UConverterType U_EXPORT2 ucnv_getType(const UConverter * converter); /** * Gets the "starter" (lead) bytes for converters of type MBCS. * Will fill in an U_ILLEGAL_ARGUMENT_ERROR if converter passed in * is not MBCS. Fills in an array of type UBool, with the value of the byte * as offset to the array. For example, if (starters[0x20] == TRUE) at return, * it means that the byte 0x20 is a starter byte in this converter. * Context pointers are always owned by the caller. * * @param converter a valid, opened converter of type MBCS * @param starters an array of size 256 to be filled in * @param err error status, U_ILLEGAL_ARGUMENT_ERROR if the * converter is not a type which can return starters. * @see ucnv_getType * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_getStarters(const UConverter* converter, UBool starters[256], UErrorCode* err); /** * Selectors for Unicode sets that can be returned by ucnv_getUnicodeSet(). * @see ucnv_getUnicodeSet * @stable ICU 2.6 */ typedef enum UConverterUnicodeSet { /** Select the set of roundtrippable Unicode code points. @stable ICU 2.6 */ UCNV_ROUNDTRIP_SET, /** Select the set of Unicode code points with roundtrip or fallback mappings. @stable ICU 4.0 */ UCNV_ROUNDTRIP_AND_FALLBACK_SET, /** Number of UConverterUnicodeSet selectors. @stable ICU 2.6 */ UCNV_SET_COUNT } UConverterUnicodeSet; /** * Returns the set of Unicode code points that can be converted by an ICU converter. * * Returns one of several kinds of set: * * 1. UCNV_ROUNDTRIP_SET * * The set of all Unicode code points that can be roundtrip-converted * (converted without any data loss) with the converter (ucnv_fromUnicode()). * This set will not include code points that have fallback mappings * or are only the result of reverse fallback mappings. * This set will also not include PUA code points with fallbacks, although * ucnv_fromUnicode() will always uses those mappings despite ucnv_setFallback(). * See UTR #22 "Character Mapping Markup Language" * at http://www.unicode.org/reports/tr22/ * * This is useful for example for * - checking that a string or document can be roundtrip-converted with a converter, * without/before actually performing the conversion * - testing if a converter can be used for text for typical text for a certain locale, * by comparing its roundtrip set with the set of ExemplarCharacters from * ICU's locale data or other sources * * 2. UCNV_ROUNDTRIP_AND_FALLBACK_SET * * The set of all Unicode code points that can be converted with the converter (ucnv_fromUnicode()) * when fallbacks are turned on (see ucnv_setFallback()). * This set includes all code points with roundtrips and fallbacks (but not reverse fallbacks). * * In the future, there may be more UConverterUnicodeSet choices to select * sets with different properties. * * @param cnv The converter for which a set is requested. * @param setFillIn A valid USet *. It will be cleared by this function before * the converter's specific set is filled into the USet. * @param whichSet A UConverterUnicodeSet selector; * currently UCNV_ROUNDTRIP_SET is the only supported value. * @param pErrorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * * @see UConverterUnicodeSet * @see uset_open * @see uset_close * @stable ICU 2.6 */ U_STABLE void U_EXPORT2 ucnv_getUnicodeSet(const UConverter *cnv, USet *setFillIn, UConverterUnicodeSet whichSet, UErrorCode *pErrorCode); /** * Gets the current calback function used by the converter when an illegal * or invalid codepage sequence is found. * Context pointers are always owned by the caller. * * @param converter the unicode converter * @param action fillin: returns the callback function pointer * @param context fillin: returns the callback's private void* context * @see ucnv_setToUCallBack * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_getToUCallBack (const UConverter * converter, UConverterToUCallback *action, const void **context); /** * Gets the current callback function used by the converter when illegal * or invalid Unicode sequence is found. * Context pointers are always owned by the caller. * * @param converter the unicode converter * @param action fillin: returns the callback function pointer * @param context fillin: returns the callback's private void* context * @see ucnv_setFromUCallBack * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_getFromUCallBack (const UConverter * converter, UConverterFromUCallback *action, const void **context); /** * Changes the callback function used by the converter when * an illegal or invalid sequence is found. * Context pointers are always owned by the caller. * Predefined actions and contexts can be found in the ucnv_err.h header. * * @param converter the unicode converter * @param newAction the new callback function * @param newContext the new toUnicode callback context pointer. This can be NULL. * @param oldAction fillin: returns the old callback function pointer. This can be NULL. * @param oldContext fillin: returns the old callback's private void* context. This can be NULL. * @param err The error code status * @see ucnv_getToUCallBack * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_setToUCallBack (UConverter * converter, UConverterToUCallback newAction, const void* newContext, UConverterToUCallback *oldAction, const void** oldContext, UErrorCode * err); /** * Changes the current callback function used by the converter when * an illegal or invalid sequence is found. * Context pointers are always owned by the caller. * Predefined actions and contexts can be found in the ucnv_err.h header. * * @param converter the unicode converter * @param newAction the new callback function * @param newContext the new fromUnicode callback context pointer. This can be NULL. * @param oldAction fillin: returns the old callback function pointer. This can be NULL. * @param oldContext fillin: returns the old callback's private void* context. This can be NULL. * @param err The error code status * @see ucnv_getFromUCallBack * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_setFromUCallBack (UConverter * converter, UConverterFromUCallback newAction, const void *newContext, UConverterFromUCallback *oldAction, const void **oldContext, UErrorCode * err); /** * Converts an array of unicode characters to an array of codepage * characters. This function is optimized for converting a continuous * stream of data in buffer-sized chunks, where the entire source and * target does not fit in available buffers. * * The source pointer is an in/out parameter. It starts out pointing where the * conversion is to begin, and ends up pointing after the last UChar consumed. * * Target similarly starts out pointer at the first available byte in the output * buffer, and ends up pointing after the last byte written to the output. * * The converter always attempts to consume the entire source buffer, unless * (1.) the target buffer is full, or (2.) a failing error is returned from the * current callback function. When a successful error status has been * returned, it means that all of the source buffer has been * consumed. At that point, the caller should reset the source and * sourceLimit pointers to point to the next chunk. * * At the end of the stream (flush==TRUE), the input is completely consumed * when *source==sourceLimit and no error code is set. * The converter object is then automatically reset by this function. * (This means that a converter need not be reset explicitly between data * streams if it finishes the previous stream without errors.) * * This is a stateful conversion. Additionally, even when all source data has * been consumed, some data may be in the converters' internal state. * Call this function repeatedly, updating the target pointers with * the next empty chunk of target in case of a * U_BUFFER_OVERFLOW_ERROR, and updating the source pointers * with the next chunk of source when a successful error status is * returned, until there are no more chunks of source data. * @param converter the Unicode converter * @param target I/O parameter. Input : Points to the beginning of the buffer to copy * codepage characters to. Output : points to after the last codepage character copied * to target. * @param targetLimit the pointer just after last of the target buffer * @param source I/O parameter, pointer to pointer to the source Unicode character buffer. * @param sourceLimit the pointer just after the last of the source buffer * @param offsets if NULL is passed, nothing will happen to it, otherwise it needs to have the same number * of allocated cells as target. Will fill in offsets from target to source pointer * e.g: offsets[3] is equal to 6, it means that the target[3] was a result of transcoding source[6] * For output data carried across calls, and other data without a specific source character * (such as from escape sequences or callbacks) -1 will be placed for offsets. * @param flush set to TRUE if the current source buffer is the last available * chunk of the source, FALSE otherwise. Note that if a failing status is returned, * this function may have to be called multiple times with flush set to TRUE until * the source buffer is consumed. * @param err the error status. U_ILLEGAL_ARGUMENT_ERROR will be set if the * converter is NULL. * U_BUFFER_OVERFLOW_ERROR will be set if the target is full and there is * still data to be written to the target. * @see ucnv_fromUChars * @see ucnv_convert * @see ucnv_getMinCharSize * @see ucnv_setToUCallBack * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_fromUnicode (UConverter * converter, char **target, const char *targetLimit, const UChar ** source, const UChar * sourceLimit, int32_t* offsets, UBool flush, UErrorCode * err); /** * Converts a buffer of codepage bytes into an array of unicode UChars * characters. This function is optimized for converting a continuous * stream of data in buffer-sized chunks, where the entire source and * target does not fit in available buffers. * * The source pointer is an in/out parameter. It starts out pointing where the * conversion is to begin, and ends up pointing after the last byte of source consumed. * * Target similarly starts out pointer at the first available UChar in the output * buffer, and ends up pointing after the last UChar written to the output. * It does NOT necessarily keep UChar sequences together. * * The converter always attempts to consume the entire source buffer, unless * (1.) the target buffer is full, or (2.) a failing error is returned from the * current callback function. When a successful error status has been * returned, it means that all of the source buffer has been * consumed. At that point, the caller should reset the source and * sourceLimit pointers to point to the next chunk. * * At the end of the stream (flush==TRUE), the input is completely consumed * when *source==sourceLimit and no error code is set * The converter object is then automatically reset by this function. * (This means that a converter need not be reset explicitly between data * streams if it finishes the previous stream without errors.) * * This is a stateful conversion. Additionally, even when all source data has * been consumed, some data may be in the converters' internal state. * Call this function repeatedly, updating the target pointers with * the next empty chunk of target in case of a * U_BUFFER_OVERFLOW_ERROR, and updating the source pointers * with the next chunk of source when a successful error status is * returned, until there are no more chunks of source data. * @param converter the Unicode converter * @param target I/O parameter. Input : Points to the beginning of the buffer to copy * UChars into. Output : points to after the last UChar copied. * @param targetLimit the pointer just after the end of the target buffer * @param source I/O parameter, pointer to pointer to the source codepage buffer. * @param sourceLimit the pointer to the byte after the end of the source buffer * @param offsets if NULL is passed, nothing will happen to it, otherwise it needs to have the same number * of allocated cells as target. Will fill in offsets from target to source pointer * e.g: offsets[3] is equal to 6, it means that the target[3] was a result of transcoding source[6] * For output data carried across calls, and other data without a specific source character * (such as from escape sequences or callbacks) -1 will be placed for offsets. * @param flush set to TRUE if the current source buffer is the last available * chunk of the source, FALSE otherwise. Note that if a failing status is returned, * this function may have to be called multiple times with flush set to TRUE until * the source buffer is consumed. * @param err the error status. U_ILLEGAL_ARGUMENT_ERROR will be set if the * converter is NULL. * U_BUFFER_OVERFLOW_ERROR will be set if the target is full and there is * still data to be written to the target. * @see ucnv_fromUChars * @see ucnv_convert * @see ucnv_getMinCharSize * @see ucnv_setFromUCallBack * @see ucnv_getNextUChar * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_toUnicode(UConverter *converter, UChar **target, const UChar *targetLimit, const char **source, const char *sourceLimit, int32_t *offsets, UBool flush, UErrorCode *err); /** * Convert the Unicode string into a codepage string using an existing UConverter. * The output string is NUL-terminated if possible. * * This function is a more convenient but less powerful version of ucnv_fromUnicode(). * It is only useful for whole strings, not for streaming conversion. * * The maximum output buffer capacity required (barring output from callbacks) will be * UCNV_GET_MAX_BYTES_FOR_STRING(srcLength, ucnv_getMaxCharSize(cnv)). * * @param cnv the converter object to be used (ucnv_resetFromUnicode() will be called) * @param src the input Unicode string * @param srcLength the input string length, or -1 if NUL-terminated * @param dest destination string buffer, can be NULL if destCapacity==0 * @param destCapacity the number of chars available at dest * @param pErrorCode normal ICU error code; * common error codes that may be set by this function include * U_BUFFER_OVERFLOW_ERROR, U_STRING_NOT_TERMINATED_WARNING, * U_ILLEGAL_ARGUMENT_ERROR, and conversion errors * @return the length of the output string, not counting the terminating NUL; * if the length is greater than destCapacity, then the string will not fit * and a buffer of the indicated length would need to be passed in * @see ucnv_fromUnicode * @see ucnv_convert * @see UCNV_GET_MAX_BYTES_FOR_STRING * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ucnv_fromUChars(UConverter *cnv, char *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, UErrorCode *pErrorCode); /** * Convert the codepage string into a Unicode string using an existing UConverter. * The output string is NUL-terminated if possible. * * This function is a more convenient but less powerful version of ucnv_toUnicode(). * It is only useful for whole strings, not for streaming conversion. * * The maximum output buffer capacity required (barring output from callbacks) will be * 2*srcLength (each char may be converted into a surrogate pair). * * @param cnv the converter object to be used (ucnv_resetToUnicode() will be called) * @param src the input codepage string * @param srcLength the input string length, or -1 if NUL-terminated * @param dest destination string buffer, can be NULL if destCapacity==0 * @param destCapacity the number of UChars available at dest * @param pErrorCode normal ICU error code; * common error codes that may be set by this function include * U_BUFFER_OVERFLOW_ERROR, U_STRING_NOT_TERMINATED_WARNING, * U_ILLEGAL_ARGUMENT_ERROR, and conversion errors * @return the length of the output string, not counting the terminating NUL; * if the length is greater than destCapacity, then the string will not fit * and a buffer of the indicated length would need to be passed in * @see ucnv_toUnicode * @see ucnv_convert * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ucnv_toUChars(UConverter *cnv, UChar *dest, int32_t destCapacity, const char *src, int32_t srcLength, UErrorCode *pErrorCode); /** * Convert a codepage buffer into Unicode one character at a time. * The input is completely consumed when the U_INDEX_OUTOFBOUNDS_ERROR is set. * * Advantage compared to ucnv_toUnicode() or ucnv_toUChars(): * - Faster for small amounts of data, for most converters, e.g., * US-ASCII, ISO-8859-1, UTF-8/16/32, and most "normal" charsets. * (For complex converters, e.g., SCSU, UTF-7 and ISO 2022 variants, * it uses ucnv_toUnicode() internally.) * - Convenient. * * Limitations compared to ucnv_toUnicode(): * - Always assumes flush=TRUE. * This makes ucnv_getNextUChar() unsuitable for "streaming" conversion, * that is, for where the input is supplied in multiple buffers, * because ucnv_getNextUChar() will assume the end of the input at the end * of the first buffer. * - Does not provide offset output. * * It is possible to "mix" ucnv_getNextUChar() and ucnv_toUnicode() because * ucnv_getNextUChar() uses the current state of the converter * (unlike ucnv_toUChars() which always resets first). * However, if ucnv_getNextUChar() is called after ucnv_toUnicode() * stopped in the middle of a character sequence (with flush=FALSE), * then ucnv_getNextUChar() will always use the slower ucnv_toUnicode() * internally until the next character boundary. * (This is new in ICU 2.6. In earlier releases, ucnv_getNextUChar() had to * start at a character boundary.) * * Instead of using ucnv_getNextUChar(), it is recommended * to convert using ucnv_toUnicode() or ucnv_toUChars() * and then iterate over the text using U16_NEXT() or a UCharIterator (uiter.h) * or a C++ CharacterIterator or similar. * This allows streaming conversion and offset output, for example. * *

Handling of surrogate pairs and supplementary-plane code points:
* There are two different kinds of codepages that provide mappings for surrogate characters: *

    *
  • Codepages like UTF-8, UTF-32, and GB 18030 provide direct representations for Unicode * code points U+10000-U+10ffff as well as for single surrogates U+d800-U+dfff. * Each valid sequence will result in exactly one returned code point. * If a sequence results in a single surrogate, then that will be returned * by itself, even if a neighboring sequence encodes the matching surrogate.
  • *
  • Codepages like SCSU and LMBCS (and UTF-16) provide direct representations only for BMP code points * including surrogates. Code points in supplementary planes are represented with * two sequences, each encoding a surrogate. * For these codepages, matching pairs of surrogates will be combined into single * code points for returning from this function. * (Note that SCSU is actually a mix of these codepage types.)
  • *

* * @param converter an open UConverter * @param source the address of a pointer to the codepage buffer, will be * updated to point after the bytes consumed in the conversion call. * @param sourceLimit points to the end of the input buffer * @param err fills in error status (see ucnv_toUnicode) * U_INDEX_OUTOFBOUNDS_ERROR will be set if the input * is empty or does not convert to any output (e.g.: pure state-change * codes SI/SO, escape sequences for ISO 2022, * or if the callback did not output anything, ...). * This function will not set a U_BUFFER_OVERFLOW_ERROR because * the "buffer" is the return code. However, there might be subsequent output * stored in the converter object * that will be returned in following calls to this function. * @return a UChar32 resulting from the partial conversion of source * @see ucnv_toUnicode * @see ucnv_toUChars * @see ucnv_convert * @stable ICU 2.0 */ U_STABLE UChar32 U_EXPORT2 ucnv_getNextUChar(UConverter * converter, const char **source, const char * sourceLimit, UErrorCode * err); /** * Convert from one external charset to another using two existing UConverters. * Internally, two conversions - ucnv_toUnicode() and ucnv_fromUnicode() - * are used, "pivoting" through 16-bit Unicode. * * Important: For streaming conversion (multiple function calls for successive * parts of a text stream), the caller must provide a pivot buffer explicitly, * and must preserve the pivot buffer and associated pointers from one * call to another. (The buffer may be moved if its contents and the relative * pointer positions are preserved.) * * There is a similar function, ucnv_convert(), * which has the following limitations: * - it takes charset names, not converter objects, so that * - two converters are opened for each call * - only single-string conversion is possible, not streaming operation * - it does not provide enough information to find out, * in case of failure, whether the toUnicode or * the fromUnicode conversion failed * * By contrast, ucnv_convertEx() * - takes UConverter parameters instead of charset names * - fully exposes the pivot buffer for streaming conversion and complete error handling * * ucnv_convertEx() also provides further convenience: * - an option to reset the converters at the beginning * (if reset==TRUE, see parameters; * also sets *pivotTarget=*pivotSource=pivotStart) * - allow NUL-terminated input * (only a single NUL byte, will not work for charsets with multi-byte NULs) * (if sourceLimit==NULL, see parameters) * - terminate with a NUL on output * (only a single NUL byte, not useful for charsets with multi-byte NULs), * or set U_STRING_NOT_TERMINATED_WARNING if the output exactly fills * the target buffer * - the pivot buffer can be provided internally; * possible only for whole-string conversion, not streaming conversion; * in this case, the caller will not be able to get details about where an * error occurred * (if pivotStart==NULL, see below) * * The function returns when one of the following is true: * - the entire source text has been converted successfully to the target buffer * - a target buffer overflow occurred (U_BUFFER_OVERFLOW_ERROR) * - a conversion error occurred * (other U_FAILURE(), see description of pErrorCode) * * Limitation compared to the direct use of * ucnv_fromUnicode() and ucnv_toUnicode(): * ucnv_convertEx() does not provide offset information. * * Limitation compared to ucnv_fromUChars() and ucnv_toUChars(): * ucnv_convertEx() does not support preflighting directly. * * Sample code for converting a single string from * one external charset to UTF-8, ignoring the location of errors: * * \code * int32_t * myToUTF8(UConverter *cnv, * const char *s, int32_t length, * char *u8, int32_t capacity, * UErrorCode *pErrorCode) { * UConverter *utf8Cnv; * char *target; * * if(U_FAILURE(*pErrorCode)) { * return 0; * } * * utf8Cnv=myGetCachedUTF8Converter(pErrorCode); * if(U_FAILURE(*pErrorCode)) { * return 0; * } * * if(length<0) { * length=strlen(s); * } * target=u8; * ucnv_convertEx(utf8Cnv, cnv, * &target, u8+capacity, * &s, s+length, * NULL, NULL, NULL, NULL, * TRUE, TRUE, * pErrorCode); * * myReleaseCachedUTF8Converter(utf8Cnv); * * // return the output string length, but without preflighting * return (int32_t)(target-u8); * } * \endcode * * @param targetCnv Output converter, used to convert from the UTF-16 pivot * to the target using ucnv_fromUnicode(). * @param sourceCnv Input converter, used to convert from the source to * the UTF-16 pivot using ucnv_toUnicode(). * @param target I/O parameter, same as for ucnv_fromUChars(). * Input: *target points to the beginning of the target buffer. * Output: *target points to the first unit after the last char written. * @param targetLimit Pointer to the first unit after the target buffer. * @param source I/O parameter, same as for ucnv_toUChars(). * Input: *source points to the beginning of the source buffer. * Output: *source points to the first unit after the last char read. * @param sourceLimit Pointer to the first unit after the source buffer. * @param pivotStart Pointer to the UTF-16 pivot buffer. If pivotStart==NULL, * then an internal buffer is used and the other pivot * arguments are ignored and can be NULL as well. * @param pivotSource I/O parameter, same as source in ucnv_fromUChars() for * conversion from the pivot buffer to the target buffer. * @param pivotTarget I/O parameter, same as target in ucnv_toUChars() for * conversion from the source buffer to the pivot buffer. * It must be pivotStart<=*pivotSource<=*pivotTarget<=pivotLimit * and pivotStart[0..ucnv_countAvaiable()]) * @return a pointer a string (library owned), or NULL if the index is out of bounds. * @see ucnv_countAvailable * @stable ICU 2.0 */ U_STABLE const char* U_EXPORT2 ucnv_getAvailableName(int32_t n); /** * Returns a UEnumeration to enumerate all of the canonical converter * names, as per the alias file, regardless of the ability to open each * converter. * * @return A UEnumeration object for getting all the recognized canonical * converter names. * @see ucnv_getAvailableName * @see uenum_close * @see uenum_next * @stable ICU 2.4 */ U_STABLE UEnumeration * U_EXPORT2 ucnv_openAllNames(UErrorCode *pErrorCode); /** * Gives the number of aliases for a given converter or alias name. * If the alias is ambiguous, then the preferred converter is used * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. * This method only enumerates the listed entries in the alias file. * @param alias alias name * @param pErrorCode error status * @return number of names on alias list for given alias * @stable ICU 2.0 */ U_STABLE uint16_t U_EXPORT2 ucnv_countAliases(const char *alias, UErrorCode *pErrorCode); /** * Gives the name of the alias at given index of alias list. * This method only enumerates the listed entries in the alias file. * If the alias is ambiguous, then the preferred converter is used * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. * @param alias alias name * @param n index in alias list * @param pErrorCode result of operation * @return returns the name of the alias at given index * @see ucnv_countAliases * @stable ICU 2.0 */ U_STABLE const char * U_EXPORT2 ucnv_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode); /** * Fill-up the list of alias names for the given alias. * This method only enumerates the listed entries in the alias file. * If the alias is ambiguous, then the preferred converter is used * and the status is set to U_AMBIGUOUS_ALIAS_WARNING. * @param alias alias name * @param aliases fill-in list, aliases is a pointer to an array of * ucnv_countAliases() string-pointers * (const char *) that will be filled in. * The strings themselves are owned by the library. * @param pErrorCode result of operation * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode); /** * Return a new UEnumeration object for enumerating all the * alias names for a given converter that are recognized by a standard. * This method only enumerates the listed entries in the alias file. * The convrtrs.txt file can be modified to change the results of * this function. * The first result in this list is the same result given by * ucnv_getStandardName, which is the default alias for * the specified standard name. The returned object must be closed with * uenum_close when you are done with the object. * * @param convName original converter name * @param standard name of the standard governing the names; MIME and IANA * are such standards * @param pErrorCode The error code * @return A UEnumeration object for getting all aliases that are recognized * by a standard. If any of the parameters are invalid, NULL * is returned. * @see ucnv_getStandardName * @see uenum_close * @see uenum_next * @stable ICU 2.2 */ U_STABLE UEnumeration * U_EXPORT2 ucnv_openStandardNames(const char *convName, const char *standard, UErrorCode *pErrorCode); /** * Gives the number of standards associated to converter names. * @return number of standards * @stable ICU 2.0 */ U_STABLE uint16_t U_EXPORT2 ucnv_countStandards(void); /** * Gives the name of the standard at given index of standard list. * @param n index in standard list * @param pErrorCode result of operation * @return returns the name of the standard at given index. Owned by the library. * @stable ICU 2.0 */ U_STABLE const char * U_EXPORT2 ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode); /** * Returns a standard name for a given converter name. *

* Example alias table:
* conv alias1 { STANDARD1 } alias2 { STANDARD1* } *

* Result of ucnv_getStandardName("conv", "STANDARD1") from example * alias table:
* "alias2" * * @param name original converter name * @param standard name of the standard governing the names; MIME and IANA * are such standards * @param pErrorCode result of operation * @return returns the standard converter name; * if a standard converter name cannot be determined, * then NULL is returned. Owned by the library. * @stable ICU 2.0 */ U_STABLE const char * U_EXPORT2 ucnv_getStandardName(const char *name, const char *standard, UErrorCode *pErrorCode); /** * This function will return the internal canonical converter name of the * tagged alias. This is the opposite of ucnv_openStandardNames, which * returns the tagged alias given the canonical name. *

* Example alias table:
* conv alias1 { STANDARD1 } alias2 { STANDARD1* } *

* Result of ucnv_getStandardName("alias1", "STANDARD1") from example * alias table:
* "conv" * * @return returns the canonical converter name; * if a standard or alias name cannot be determined, * then NULL is returned. The returned string is * owned by the library. * @see ucnv_getStandardName * @stable ICU 2.4 */ U_STABLE const char * U_EXPORT2 ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErrorCode); /** * Returns the current default converter name. If you want to open * a default converter, you do not need to use this function. * It is faster if you pass a NULL argument to ucnv_open the * default converter. * * If U_CHARSET_IS_UTF8 is defined to 1 in utypes.h then this function * always returns "UTF-8". * * @return returns the current default converter name. * Storage owned by the library * @see ucnv_setDefaultName * @stable ICU 2.0 */ U_STABLE const char * U_EXPORT2 ucnv_getDefaultName(void); /** * This function is not thread safe. DO NOT call this function when ANY ICU * function is being used from more than one thread! This function sets the * current default converter name. If this function needs to be called, it * should be called during application initialization. Most of the time, the * results from ucnv_getDefaultName() or ucnv_open with a NULL string argument * is sufficient for your application. * * If U_CHARSET_IS_UTF8 is defined to 1 in utypes.h then this function * does nothing. * * @param name the converter name to be the default (must be known by ICU). * @see ucnv_getDefaultName * @system * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_setDefaultName(const char *name); /** * Fixes the backslash character mismapping. For example, in SJIS, the backslash * character in the ASCII portion is also used to represent the yen currency sign. * When mapping from Unicode character 0x005C, it's unclear whether to map the * character back to yen or backslash in SJIS. This function will take the input * buffer and replace all the yen sign characters with backslash. This is necessary * when the user tries to open a file with the input buffer on Windows. * This function will test the converter to see whether such mapping is * required. You can sometimes avoid using this function by using the correct version * of Shift-JIS. * * @param cnv The converter representing the target codepage. * @param source the input buffer to be fixed * @param sourceLen the length of the input buffer * @see ucnv_isAmbiguous * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ucnv_fixFileSeparator(const UConverter *cnv, UChar *source, int32_t sourceLen); /** * Determines if the converter contains ambiguous mappings of the same * character or not. * @param cnv the converter to be tested * @return TRUE if the converter contains ambiguous mapping of the same * character, FALSE otherwise. * @stable ICU 2.0 */ U_STABLE UBool U_EXPORT2 ucnv_isAmbiguous(const UConverter *cnv); /** * Sets the converter to use fallback mappings or not. * Regardless of this flag, the converter will always use * fallbacks from Unicode Private Use code points, as well as * reverse fallbacks (to Unicode). * For details see ".ucm File Format" * in the Conversion Data chapter of the ICU User Guide: * http://www.icu-project.org/userguide/conversion-data.html#ucmformat * * @param cnv The converter to set the fallback mapping usage on. * @param usesFallback TRUE if the user wants the converter to take advantage of the fallback * mapping, FALSE otherwise. * @stable ICU 2.0 * @see ucnv_usesFallback */ U_STABLE void U_EXPORT2 ucnv_setFallback(UConverter *cnv, UBool usesFallback); /** * Determines if the converter uses fallback mappings or not. * This flag has restrictions, see ucnv_setFallback(). * * @param cnv The converter to be tested * @return TRUE if the converter uses fallback, FALSE otherwise. * @stable ICU 2.0 * @see ucnv_setFallback */ U_STABLE UBool U_EXPORT2 ucnv_usesFallback(const UConverter *cnv); /** * Detects Unicode signature byte sequences at the start of the byte stream * and returns the charset name of the indicated Unicode charset. * NULL is returned when no Unicode signature is recognized. * The number of bytes in the signature is output as well. * * The caller can ucnv_open() a converter using the charset name. * The first code unit (UChar) from the start of the stream will be U+FEFF * (the Unicode BOM/signature character) and can usually be ignored. * * For most Unicode charsets it is also possible to ignore the indicated * number of initial stream bytes and start converting after them. * However, there are stateful Unicode charsets (UTF-7 and BOCU-1) for which * this will not work. Therefore, it is best to ignore the first output UChar * instead of the input signature bytes. *

* Usage: * @code * UErrorCode err = U_ZERO_ERROR; * char input[] = { '\xEF','\xBB', '\xBF','\x41','\x42','\x43' }; * int32_t signatureLength = 0; * char *encoding = ucnv_detectUnicodeSignature(input,sizeof(input),&signatureLength,&err); * UConverter *conv = NULL; * UChar output[100]; * UChar *target = output, *out; * char *source = input; * if(encoding!=NULL && U_SUCCESS(err)){ * // should signature be discarded ? * conv = ucnv_open(encoding, &err); * // do the conversion * ucnv_toUnicode(conv, * target, output + sizeof(output)/U_SIZEOF_UCHAR, * source, input + sizeof(input), * NULL, TRUE, &err); * out = output; * if (discardSignature){ * ++out; // ignore initial U+FEFF * } * while(out != target) { * printf("%04x ", *out++); * } * puts(""); * } * * @endcode * * @param source The source string in which the signature should be detected. * @param sourceLength Length of the input string, or -1 if terminated with a NUL byte. * @param signatureLength A pointer to int32_t to receive the number of bytes that make up the signature * of the detected UTF. 0 if not detected. * Can be a NULL pointer. * @param pErrorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return The name of the encoding detected. NULL if encoding is not detected. * @stable ICU 2.4 */ U_STABLE const char* U_EXPORT2 ucnv_detectUnicodeSignature(const char* source, int32_t sourceLength, int32_t *signatureLength, UErrorCode *pErrorCode); /** * Returns the number of UChars held in the converter's internal state * because more input is needed for completing the conversion. This function is * useful for mapping semantics of ICU's converter interface to those of iconv, * and this information is not needed for normal conversion. * @param cnv The converter in which the input is held * @param status ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return The number of UChars in the state. -1 if an error is encountered. * @stable ICU 3.4 */ U_STABLE int32_t U_EXPORT2 ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status); /** * Returns the number of chars held in the converter's internal state * because more input is needed for completing the conversion. This function is * useful for mapping semantics of ICU's converter interface to those of iconv, * and this information is not needed for normal conversion. * @param cnv The converter in which the input is held as internal state * @param status ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return The number of chars in the state. -1 if an error is encountered. * @stable ICU 3.4 */ U_STABLE int32_t U_EXPORT2 ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status); #endif #endif /*_UCNV*/ android-audiosystem-1.8+13.10.20130807/include/unicode/dbbi.h0000644000015700001700000000170612200324306024020 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (C) 1999-2006 IBM Corp. All rights reserved. ********************************************************************** * Date Name Description * 12/1/99 rgillam Complete port from Java. * 01/13/2000 helena Added UErrorCode to ctors. ********************************************************************** */ #ifndef DBBI_H #define DBBI_H #include "unicode/rbbi.h" #if !UCONFIG_NO_BREAK_ITERATION /** * \file * \brief C++ API: Dictionary Based Break Iterator */ U_NAMESPACE_BEGIN /** * An obsolete subclass of RuleBasedBreakIterator. Handling of dictionary- * based break iteration has been folded into the base class. This class * is deprecated as of ICU 3.6. */ #ifndef U_HIDE_DEPRECATED_API typedef RuleBasedBreakIterator DictionaryBasedBreakIterator; #endif U_NAMESPACE_END #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ #endif android-audiosystem-1.8+13.10.20130807/include/unicode/brkiter.h0000644000015700001700000005473012200324306024567 0ustar pbuserpbgroup00000000000000/* ******************************************************************************** * Copyright (C) 1997-2010, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************** * * File brkiter.h * * Modification History: * * Date Name Description * 02/18/97 aliu Added typedef for TextCount. Made DONE const. * 05/07/97 aliu Fixed DLL declaration. * 07/09/97 jfitz Renamed BreakIterator and interface synced with JDK * 08/11/98 helena Sync-up JDK1.2. * 01/13/2000 helena Added UErrorCode parameter to createXXXInstance methods. ******************************************************************************** */ #ifndef BRKITER_H #define BRKITER_H #include "unicode/utypes.h" /** * \file * \brief C++ API: Break Iterator. */ #if UCONFIG_NO_BREAK_ITERATION U_NAMESPACE_BEGIN /* * Allow the declaration of APIs with pointers to BreakIterator * even when break iteration is removed from the build. */ class BreakIterator; U_NAMESPACE_END #else #include "unicode/uobject.h" #include "unicode/unistr.h" #include "unicode/chariter.h" #include "unicode/locid.h" #include "unicode/ubrk.h" #include "unicode/strenum.h" #include "unicode/utext.h" #include "unicode/umisc.h" U_NAMESPACE_BEGIN /** * The BreakIterator class implements methods for finding the location * of boundaries in text. BreakIterator is an abstract base class. * Instances of BreakIterator maintain a current position and scan over * text returning the index of characters where boundaries occur. *

* Line boundary analysis determines where a text string can be broken * when line-wrapping. The mechanism correctly handles punctuation and * hyphenated words. *

* Sentence boundary analysis allows selection with correct * interpretation of periods within numbers and abbreviations, and * trailing punctuation marks such as quotation marks and parentheses. *

* Word boundary analysis is used by search and replace functions, as * well as within text editing applications that allow the user to * select words with a double click. Word selection provides correct * interpretation of punctuation marks within and following * words. Characters that are not part of a word, such as symbols or * punctuation marks, have word-breaks on both sides. *

* Character boundary analysis allows users to interact with * characters as they expect to, for example, when moving the cursor * through a text string. Character boundary analysis provides correct * navigation of through character strings, regardless of how the * character is stored. For example, an accented character might be * stored as a base character and a diacritical mark. What users * consider to be a character can differ between languages. *

* The text boundary positions are found according to the rules * described in Unicode Standard Annex #29, Text Boundaries, and * Unicode Standard Annex #14, Line Breaking Properties. These * are available at http://www.unicode.org/reports/tr14/ and * http://www.unicode.org/reports/tr29/. *

* In addition to the C++ API defined in this header file, a * plain C API with equivalent functionality is defined in the * file ubrk.h *

* Code snippets illustrating the use of the Break Iterator APIs * are available in the ICU User Guide, * http://icu-project.org/userguide/boundaryAnalysis.html * and in the sample program icu/source/samples/break/break.cpp * */ class U_COMMON_API BreakIterator : public UObject { public: /** * destructor * @stable ICU 2.0 */ virtual ~BreakIterator(); /** * Return true if another object is semantically equal to this * one. The other object should be an instance of the same subclass of * BreakIterator. Objects of different subclasses are considered * unequal. *

* Return true if this BreakIterator is at the same position in the * same text, and is the same class and type (word, line, etc.) of * BreakIterator, as the argument. Text is considered the same if * it contains the same characters, it need not be the same * object, and styles are not considered. * @stable ICU 2.0 */ virtual UBool operator==(const BreakIterator&) const = 0; /** * Returns the complement of the result of operator== * @param rhs The BreakIterator to be compared for inequality * @return the complement of the result of operator== * @stable ICU 2.0 */ UBool operator!=(const BreakIterator& rhs) const { return !operator==(rhs); } /** * Return a polymorphic copy of this object. This is an abstract * method which subclasses implement. * @stable ICU 2.0 */ virtual BreakIterator* clone(void) const = 0; /** * Return a polymorphic class ID for this object. Different subclasses * will return distinct unequal values. * @stable ICU 2.0 */ virtual UClassID getDynamicClassID(void) const = 0; /** * Return a CharacterIterator over the text being analyzed. * @stable ICU 2.0 */ virtual CharacterIterator& getText(void) const = 0; /** * Get a UText for the text being analyzed. * The returned UText is a shallow clone of the UText used internally * by the break iterator implementation. It can safely be used to * access the text without impacting any break iterator operations, * but the underlying text itself must not be altered. * * @param fillIn A UText to be filled in. If NULL, a new UText will be * allocated to hold the result. * @param status receives any error codes. * @return The current UText for this break iterator. If an input * UText was provided, it will always be returned. * @stable ICU 3.4 */ virtual UText *getUText(UText *fillIn, UErrorCode &status) const = 0; /** * Change the text over which this operates. The text boundary is * reset to the start. * @param text The UnicodeString used to change the text. * @stable ICU 2.0 */ virtual void setText(const UnicodeString &text) = 0; /** * Reset the break iterator to operate over the text represented by * the UText. The iterator position is reset to the start. * * This function makes a shallow clone of the supplied UText. This means * that the caller is free to immediately close or otherwise reuse the * Utext that was passed as a parameter, but that the underlying text itself * must not be altered while being referenced by the break iterator. * * @param text The UText used to change the text. * @param status receives any error codes. * @stable ICU 3.4 */ virtual void setText(UText *text, UErrorCode &status) = 0; /** * Change the text over which this operates. The text boundary is * reset to the start. * Note that setText(UText *) provides similar functionality to this function, * and is more efficient. * @param it The CharacterIterator used to change the text. * @stable ICU 2.0 */ virtual void adoptText(CharacterIterator* it) = 0; enum { /** * DONE is returned by previous() and next() after all valid * boundaries have been returned. * @stable ICU 2.0 */ DONE = (int32_t)-1 }; /** * Return the index of the first character in the text being scanned. * @stable ICU 2.0 */ virtual int32_t first(void) = 0; /** * Return the index immediately BEYOND the last character in the text being scanned. * @stable ICU 2.0 */ virtual int32_t last(void) = 0; /** * Return the boundary preceding the current boundary. * @return The character index of the previous text boundary or DONE if all * boundaries have been returned. * @stable ICU 2.0 */ virtual int32_t previous(void) = 0; /** * Return the boundary following the current boundary. * @return The character index of the next text boundary or DONE if all * boundaries have been returned. * @stable ICU 2.0 */ virtual int32_t next(void) = 0; /** * Return character index of the current interator position within the text. * @return The boundary most recently returned. * @stable ICU 2.0 */ virtual int32_t current(void) const = 0; /** * Return the first boundary following the specified offset. * The value returned is always greater than the offset or * the value BreakIterator.DONE * @param offset the offset to begin scanning. * @return The first boundary after the specified offset. * @stable ICU 2.0 */ virtual int32_t following(int32_t offset) = 0; /** * Return the first boundary preceding the specified offset. * The value returned is always smaller than the offset or * the value BreakIterator.DONE * @param offset the offset to begin scanning. * @return The first boundary before the specified offset. * @stable ICU 2.0 */ virtual int32_t preceding(int32_t offset) = 0; /** * Return true if the specfied position is a boundary position. * As a side effect, the current position of the iterator is set * to the first boundary position at or following the specified offset. * @param offset the offset to check. * @return True if "offset" is a boundary position. * @stable ICU 2.0 */ virtual UBool isBoundary(int32_t offset) = 0; /** * Return the nth boundary from the current boundary * @param n which boundary to return. A value of 0 * does nothing. Negative values move to previous boundaries * and positive values move to later boundaries. * @return The index of the nth boundary from the current position, or * DONE if there are fewer than |n| boundaries in the specfied direction. * @stable ICU 2.0 */ virtual int32_t next(int32_t n) = 0; /** * Create BreakIterator for word-breaks using the given locale. * Returns an instance of a BreakIterator implementing word breaks. * WordBreak is useful for word selection (ex. double click) * @param where the locale. * @param status the error code * @return A BreakIterator for word-breaks. The UErrorCode& status * parameter is used to return status information to the user. * To check whether the construction succeeded or not, you should check * the value of U_SUCCESS(err). If you wish more detailed information, you * can check for informational error results which still indicate success. * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For * example, 'de_CH' was requested, but nothing was found there, so 'de' was * used. U_USING_DEFAULT_WARNING indicates that the default locale data was * used; neither the requested locale nor any of its fall back locales * could be found. * The caller owns the returned object and is responsible for deleting it. * @stable ICU 2.0 */ static BreakIterator* U_EXPORT2 createWordInstance(const Locale& where, UErrorCode& status); /** * Create BreakIterator for line-breaks using specified locale. * Returns an instance of a BreakIterator implementing line breaks. Line * breaks are logically possible line breaks, actual line breaks are * usually determined based on display width. * LineBreak is useful for word wrapping text. * @param where the locale. * @param status The error code. * @return A BreakIterator for line-breaks. The UErrorCode& status * parameter is used to return status information to the user. * To check whether the construction succeeded or not, you should check * the value of U_SUCCESS(err). If you wish more detailed information, you * can check for informational error results which still indicate success. * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For * example, 'de_CH' was requested, but nothing was found there, so 'de' was * used. U_USING_DEFAULT_WARNING indicates that the default locale data was * used; neither the requested locale nor any of its fall back locales * could be found. * The caller owns the returned object and is responsible for deleting it. * @stable ICU 2.0 */ static BreakIterator* U_EXPORT2 createLineInstance(const Locale& where, UErrorCode& status); /** * Create BreakIterator for character-breaks using specified locale * Returns an instance of a BreakIterator implementing character breaks. * Character breaks are boundaries of combining character sequences. * @param where the locale. * @param status The error code. * @return A BreakIterator for character-breaks. The UErrorCode& status * parameter is used to return status information to the user. * To check whether the construction succeeded or not, you should check * the value of U_SUCCESS(err). If you wish more detailed information, you * can check for informational error results which still indicate success. * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For * example, 'de_CH' was requested, but nothing was found there, so 'de' was * used. U_USING_DEFAULT_WARNING indicates that the default locale data was * used; neither the requested locale nor any of its fall back locales * could be found. * The caller owns the returned object and is responsible for deleting it. * @stable ICU 2.0 */ static BreakIterator* U_EXPORT2 createCharacterInstance(const Locale& where, UErrorCode& status); /** * Create BreakIterator for sentence-breaks using specified locale * Returns an instance of a BreakIterator implementing sentence breaks. * @param where the locale. * @param status The error code. * @return A BreakIterator for sentence-breaks. The UErrorCode& status * parameter is used to return status information to the user. * To check whether the construction succeeded or not, you should check * the value of U_SUCCESS(err). If you wish more detailed information, you * can check for informational error results which still indicate success. * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For * example, 'de_CH' was requested, but nothing was found there, so 'de' was * used. U_USING_DEFAULT_WARNING indicates that the default locale data was * used; neither the requested locale nor any of its fall back locales * could be found. * The caller owns the returned object and is responsible for deleting it. * @stable ICU 2.0 */ static BreakIterator* U_EXPORT2 createSentenceInstance(const Locale& where, UErrorCode& status); /** * Create BreakIterator for title-casing breaks using the specified locale * Returns an instance of a BreakIterator implementing title breaks. * The iterator returned locates title boundaries as described for * Unicode 3.2 only. For Unicode 4.0 and above title boundary iteration, * please use Word Boundary iterator.{@link #createWordInstance } * * @param where the locale. * @param status The error code. * @return A BreakIterator for title-breaks. The UErrorCode& status * parameter is used to return status information to the user. * To check whether the construction succeeded or not, you should check * the value of U_SUCCESS(err). If you wish more detailed information, you * can check for informational error results which still indicate success. * U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For * example, 'de_CH' was requested, but nothing was found there, so 'de' was * used. U_USING_DEFAULT_WARNING indicates that the default locale data was * used; neither the requested locale nor any of its fall back locales * could be found. * The caller owns the returned object and is responsible for deleting it. * @stable ICU 2.1 */ static BreakIterator* U_EXPORT2 createTitleInstance(const Locale& where, UErrorCode& status); /** * Get the set of Locales for which TextBoundaries are installed. *

Note: this will not return locales added through the register * call. To see the registered locales too, use the getAvailableLocales * function that returns a StringEnumeration object

* @param count the output parameter of number of elements in the locale list * @return available locales * @stable ICU 2.0 */ static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count); /** * Get name of the object for the desired Locale, in the desired langauge. * @param objectLocale must be from getAvailableLocales. * @param displayLocale specifies the desired locale for output. * @param name the fill-in parameter of the return value * Uses best match. * @return user-displayable name * @stable ICU 2.0 */ static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale, const Locale& displayLocale, UnicodeString& name); /** * Get name of the object for the desired Locale, in the langauge of the * default locale. * @param objectLocale must be from getMatchingLocales * @param name the fill-in parameter of the return value * @return user-displayable name * @stable ICU 2.0 */ static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale, UnicodeString& name); /** * Thread safe client-buffer-based cloning operation * Do NOT call delete on a safeclone, since 'new' is not used to create it. * @param stackBuffer user allocated space for the new clone. If NULL new memory will be allocated. * If buffer is not large enough, new memory will be allocated. * @param BufferSize reference to size of allocated space. * If BufferSize == 0, a sufficient size for use in cloning will * be returned ('pre-flighting') * If BufferSize is not enough for a stack-based safe clone, * new memory will be allocated. * @param status to indicate whether the operation went on smoothly or there were errors * An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any allocations were * necessary. * @return pointer to the new clone * * @stable ICU 2.0 */ virtual BreakIterator * createBufferClone(void *stackBuffer, int32_t &BufferSize, UErrorCode &status) = 0; /** * Determine whether the BreakIterator was created in user memory by * createBufferClone(), and thus should not be deleted. Such objects * must be closed by an explicit call to the destructor (not delete). * @stable ICU 2.0 */ inline UBool isBufferClone(void); #if !UCONFIG_NO_SERVICE /** * Register a new break iterator of the indicated kind, to use in the given locale. * The break iterator will be adopted. Clones of the iterator will be returned * if a request for a break iterator of the given kind matches or falls back to * this locale. * @param toAdopt the BreakIterator instance to be adopted * @param locale the Locale for which this instance is to be registered * @param kind the type of iterator for which this instance is to be registered * @param status the in/out status code, no special meanings are assigned * @return a registry key that can be used to unregister this instance * @stable ICU 2.4 */ static URegistryKey U_EXPORT2 registerInstance(BreakIterator* toAdopt, const Locale& locale, UBreakIteratorType kind, UErrorCode& status); /** * Unregister a previously-registered BreakIterator using the key returned from the * register call. Key becomes invalid after a successful call and should not be used again. * The BreakIterator corresponding to the key will be deleted. * @param key the registry key returned by a previous call to registerInstance * @param status the in/out status code, no special meanings are assigned * @return TRUE if the iterator for the key was successfully unregistered * @stable ICU 2.4 */ static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status); /** * Return a StringEnumeration over the locales available at the time of the call, * including registered locales. * @return a StringEnumeration over the locales available at the time of the call * @stable ICU 2.4 */ static StringEnumeration* U_EXPORT2 getAvailableLocales(void); #endif /** * Returns the locale for this break iterator. Two flavors are available: valid and * actual locale. * @stable ICU 2.8 */ Locale getLocale(ULocDataLocaleType type, UErrorCode& status) const; /** Get the locale for this break iterator object. You can choose between valid and actual locale. * @param type type of the locale we're looking for (valid or actual) * @param status error code for the operation * @return the locale * @internal */ const char *getLocaleID(ULocDataLocaleType type, UErrorCode& status) const; private: static BreakIterator* buildInstance(const Locale& loc, const char *type, int32_t kind, UErrorCode& status); static BreakIterator* createInstance(const Locale& loc, int32_t kind, UErrorCode& status); static BreakIterator* makeInstance(const Locale& loc, int32_t kind, UErrorCode& status); friend class ICUBreakIteratorFactory; friend class ICUBreakIteratorService; protected: /** @internal */ BreakIterator(); /** @internal */ UBool fBufferClone; /** @internal */ BreakIterator (const BreakIterator &other) : UObject(other), fBufferClone(FALSE) {} private: /** @internal */ char actualLocale[ULOC_FULLNAME_CAPACITY]; char validLocale[ULOC_FULLNAME_CAPACITY]; /** * The assignment operator has no real implementation. * It's provided to make the compiler happy. Do not call. */ BreakIterator& operator=(const BreakIterator&); }; inline UBool BreakIterator::isBufferClone() { return fBufferClone; } U_NAMESPACE_END #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ #endif // _BRKITER //eof android-audiosystem-1.8+13.10.20130807/include/unicode/ures.h0000644000015700001700000010725212200324306024101 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (C) 1997-2010, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * * File URES.H (formerly CRESBUND.H) * * Modification History: * * Date Name Description * 04/01/97 aliu Creation. * 02/22/99 damiba overhaul. * 04/04/99 helena Fixed internal header inclusion. * 04/15/99 Madhu Updated Javadoc * 06/14/99 stephen Removed functions taking a filename suffix. * 07/20/99 stephen Language-independent ypedef to void* * 11/09/99 weiv Added ures_getLocale() * 06/24/02 weiv Added support for resource sharing ****************************************************************************** */ #ifndef URES_H #define URES_H #include "unicode/utypes.h" #include "unicode/uloc.h" #include "unicode/localpointer.h" /** * \file * \brief C API: Resource Bundle * *

C API: Resource Bundle

* * C API representing a collection of resource information pertaining to a given * locale. A resource bundle provides a way of accessing locale- specific information in * a data file. You create a resource bundle that manages the resources for a given * locale and then ask it for individual resources. *

* Resource bundles in ICU4C are currently defined using text files which conform to the following * BNF definition. * More on resource bundle concepts and syntax can be found in the * Users Guide. *

*/ /** * UResourceBundle is an opaque type for handles for resource bundles in C APIs. * @stable ICU 2.0 */ struct UResourceBundle; /** * @stable ICU 2.0 */ typedef struct UResourceBundle UResourceBundle; /** * Numeric constants for types of resource items. * @see ures_getType * @stable ICU 2.0 */ typedef enum { /** Resource type constant for "no resource". @stable ICU 2.6 */ URES_NONE=-1, /** Resource type constant for 16-bit Unicode strings. @stable ICU 2.6 */ URES_STRING=0, /** Resource type constant for binary data. @stable ICU 2.6 */ URES_BINARY=1, /** Resource type constant for tables of key-value pairs. @stable ICU 2.6 */ URES_TABLE=2, /** * Resource type constant for aliases; * internally stores a string which identifies the actual resource * storing the data (can be in a different resource bundle). * Resolved internally before delivering the actual resource through the API. * @stable ICU 2.6 */ URES_ALIAS=3, /** * Resource type constant for a single 28-bit integer, interpreted as * signed or unsigned by the ures_getInt() or ures_getUInt() function. * @see ures_getInt * @see ures_getUInt * @stable ICU 2.6 */ URES_INT=7, /** Resource type constant for arrays of resources. @stable ICU 2.6 */ URES_ARRAY=8, /** * Resource type constant for vectors of 32-bit integers. * @see ures_getIntVector * @stable ICU 2.6 */ URES_INT_VECTOR = 14, #ifndef U_HIDE_DEPRECATED_API /** @deprecated ICU 2.6 Use the URES_ constant instead. */ RES_NONE=URES_NONE, /** @deprecated ICU 2.6 Use the URES_ constant instead. */ RES_STRING=URES_STRING, /** @deprecated ICU 2.6 Use the URES_ constant instead. */ RES_BINARY=URES_BINARY, /** @deprecated ICU 2.6 Use the URES_ constant instead. */ RES_TABLE=URES_TABLE, /** @deprecated ICU 2.6 Use the URES_ constant instead. */ RES_ALIAS=URES_ALIAS, /** @deprecated ICU 2.6 Use the URES_ constant instead. */ RES_INT=URES_INT, /** @deprecated ICU 2.6 Use the URES_ constant instead. */ RES_ARRAY=URES_ARRAY, /** @deprecated ICU 2.6 Use the URES_ constant instead. */ RES_INT_VECTOR=URES_INT_VECTOR, /** @deprecated ICU 2.6 Not used. */ RES_RESERVED=15, #endif /* U_HIDE_DEPRECATED_API */ URES_LIMIT = 16 } UResType; /* * Functions to create and destroy resource bundles. */ /** * Opens a UResourceBundle, from which users can extract strings by using * their corresponding keys. * Note that the caller is responsible of calling ures_close on each succesfully * opened resource bundle. * @param packageName The packageName and locale together point to an ICU udata object, * as defined by udata_open( packageName, "res", locale, err) * or equivalent. Typically, packageName will refer to a (.dat) file, or to * a package registered with udata_setAppData(). Using a full file or directory * pathname for packageName is deprecated. If NULL, ICU data will be used. * @param locale specifies the locale for which we want to open the resource * if NULL, the default locale will be used. If strlen(locale) == 0 * root locale will be used. * * @param status fills in the outgoing error code. * The UErrorCode err parameter is used to return status information to the user. To * check whether the construction succeeded or not, you should check the value of * U_SUCCESS(err). If you wish more detailed information, you can check for * informational status results which still indicate success. U_USING_FALLBACK_WARNING * indicates that a fall back locale was used. For example, 'de_CH' was requested, * but nothing was found there, so 'de' was used. U_USING_DEFAULT_WARNING indicates that * the default locale data or root locale data was used; neither the requested locale * nor any of its fall back locales could be found. Please see the users guide for more * information on this topic. * @return a newly allocated resource bundle. * @see ures_close * @stable ICU 2.0 */ U_STABLE UResourceBundle* U_EXPORT2 ures_open(const char* packageName, const char* locale, UErrorCode* status); /** This function does not care what kind of localeID is passed in. It simply opens a bundle with * that name. Fallback mechanism is disabled for the new bundle. If the requested bundle contains * an %%ALIAS directive, the results are undefined. * @param packageName The packageName and locale together point to an ICU udata object, * as defined by udata_open( packageName, "res", locale, err) * or equivalent. Typically, packageName will refer to a (.dat) file, or to * a package registered with udata_setAppData(). Using a full file or directory * pathname for packageName is deprecated. If NULL, ICU data will be used. * @param locale specifies the locale for which we want to open the resource * if NULL, the default locale will be used. If strlen(locale) == 0 * root locale will be used. * * @param status fills in the outgoing error code. Either U_ZERO_ERROR or U_MISSING_RESOURCE_ERROR * @return a newly allocated resource bundle or NULL if it doesn't exist. * @see ures_close * @stable ICU 2.0 */ U_STABLE UResourceBundle* U_EXPORT2 ures_openDirect(const char* packageName, const char* locale, UErrorCode* status); /** * Same as ures_open() but takes a const UChar *path. * This path will be converted to char * using the default converter, * then ures_open() is called. * * @param packageName The packageName and locale together point to an ICU udata object, * as defined by udata_open( packageName, "res", locale, err) * or equivalent. Typically, packageName will refer to a (.dat) file, or to * a package registered with udata_setAppData(). Using a full file or directory * pathname for packageName is deprecated. If NULL, ICU data will be used. * @param locale specifies the locale for which we want to open the resource * if NULL, the default locale will be used. If strlen(locale) == 0 * root locale will be used. * @param status fills in the outgoing error code. * @return a newly allocated resource bundle. * @see ures_open * @stable ICU 2.0 */ U_STABLE UResourceBundle* U_EXPORT2 ures_openU(const UChar* packageName, const char* locale, UErrorCode* status); /** * Returns the number of strings/arrays in resource bundles. * Better to use ures_getSize, as this function will be deprecated. * *@param resourceBundle resource bundle containing the desired strings *@param resourceKey key tagging the resource *@param err fills in the outgoing error code * could be U_MISSING_RESOURCE_ERROR if the key is not found * could be a non-failing error * e.g.: U_USING_FALLBACK_WARNING,U_USING_FALLBACK_WARNING *@return: for Arrays: returns the number of resources in the array * Tables: returns the number of resources in the table * single string: returns 1 *@see ures_getSize * @deprecated ICU 2.8 User ures_getSize instead */ U_DEPRECATED int32_t U_EXPORT2 ures_countArrayItems(const UResourceBundle* resourceBundle, const char* resourceKey, UErrorCode* err); /** * Close a resource bundle, all pointers returned from the various ures_getXXX calls * on this particular bundle should be considered invalid henceforth. * * @param resourceBundle a pointer to a resourceBundle struct. Can be NULL. * @see ures_open * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ures_close(UResourceBundle* resourceBundle); #if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN /** * \class LocalUResourceBundlePointer * "Smart pointer" class, closes a UResourceBundle via ures_close(). * For most methods see the LocalPointerBase base class. * * @see LocalPointerBase * @see LocalPointer * @stable ICU 4.4 */ U_DEFINE_LOCAL_OPEN_POINTER(LocalUResourceBundlePointer, UResourceBundle, ures_close); U_NAMESPACE_END #endif /** * Return the version number associated with this ResourceBundle as a string. Please * use ures_getVersion as this function is going to be deprecated. * * @param resourceBundle The resource bundle for which the version is checked. * @return A version number string as specified in the resource bundle or its parent. * The caller does not own this string. * @see ures_getVersion * @deprecated ICU 2.8 Use ures_getVersion instead. */ U_DEPRECATED const char* U_EXPORT2 ures_getVersionNumber(const UResourceBundle* resourceBundle); /** * Return the version number associated with this ResourceBundle as an * UVersionInfo array. * * @param resB The resource bundle for which the version is checked. * @param versionInfo A UVersionInfo array that is filled with the version number * as specified in the resource bundle or its parent. * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ures_getVersion(const UResourceBundle* resB, UVersionInfo versionInfo); /** * Return the name of the Locale associated with this ResourceBundle. This API allows * you to query for the real locale of the resource. For example, if you requested * "en_US_CALIFORNIA" and only "en_US" bundle exists, "en_US" will be returned. * For subresources, the locale where this resource comes from will be returned. * If fallback has occured, getLocale will reflect this. * * @param resourceBundle resource bundle in question * @param status just for catching illegal arguments * @return A Locale name * @deprecated ICU 2.8 Use ures_getLocaleByType instead. */ U_DEPRECATED const char* U_EXPORT2 ures_getLocale(const UResourceBundle* resourceBundle, UErrorCode* status); /** * Return the name of the Locale associated with this ResourceBundle. * You can choose between requested, valid and real locale. * * @param resourceBundle resource bundle in question * @param type You can choose between requested, valid and actual * locale. For description see the definition of * ULocDataLocaleType in uloc.h * @param status just for catching illegal arguments * @return A Locale name * @stable ICU 2.8 */ U_STABLE const char* U_EXPORT2 ures_getLocaleByType(const UResourceBundle* resourceBundle, ULocDataLocaleType type, UErrorCode* status); /** * Same as ures_open() but uses the fill-in parameter instead of allocating * a bundle, if r!=NULL. * TODO need to revisit usefulness of this function * and usage model for fillIn parameters without knowing sizeof(UResourceBundle) * @param r The resourcebundle to open * @param packageName The packageName and locale together point to an ICU udata object, * as defined by udata_open( packageName, "res", locale, err) * or equivalent. Typically, packageName will refer to a (.dat) file, or to * a package registered with udata_setAppData(). Using a full file or directory * pathname for packageName is deprecated. If NULL, ICU data will be used. * @param localeID specifies the locale for which we want to open the resource * @param status The error code * @return a newly allocated resource bundle or NULL if it doesn't exist. * @internal */ U_INTERNAL void U_EXPORT2 ures_openFillIn(UResourceBundle *r, const char* packageName, const char* localeID, UErrorCode* status); /** * Returns a string from a string resource type * * @param resourceBundle a string resource * @param len fills in the length of resulting string * @param status fills in the outgoing error code * could be U_MISSING_RESOURCE_ERROR if the key is not found * Always check the value of status. Don't count on returning NULL. * could be a non-failing error * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. * @see ures_getBinary * @see ures_getIntVector * @see ures_getInt * @see ures_getUInt * @stable ICU 2.0 */ U_STABLE const UChar* U_EXPORT2 ures_getString(const UResourceBundle* resourceBundle, int32_t* len, UErrorCode* status); /** * Returns a UTF-8 string from a string resource. * The UTF-8 string may be returnable directly as a pointer, or * it may need to be copied, or transformed from UTF-16 using u_strToUTF8() * or equivalent. * * If forceCopy==TRUE, then the string is always written to the dest buffer * and dest is returned. * * If forceCopy==FALSE, then the string is returned as a pointer if possible, * without needing a dest buffer (it can be NULL). If the string needs to be * copied or transformed, then it may be placed into dest at an arbitrary offset. * * If the string is to be written to dest, then U_BUFFER_OVERFLOW_ERROR and * U_STRING_NOT_TERMINATED_WARNING are set if appropriate, as usual. * * If the string is transformed from UTF-16, then a conversion error may occur * if an unpaired surrogate is encountered. If the function is successful, then * the output UTF-8 string is always well-formed. * * @param resB Resource bundle. * @param dest Destination buffer. Can be NULL only if capacity=*length==0. * @param length Input: Capacity of destination buffer. * Output: Actual length of the UTF-8 string, not counting the * terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. * Can be NULL, meaning capacity=0 and the string length is not * returned to the caller. * @param forceCopy If TRUE, then the output string will always be written to * dest, with U_BUFFER_OVERFLOW_ERROR and * U_STRING_NOT_TERMINATED_WARNING set if appropriate. * If FALSE, then the dest buffer may or may not contain a * copy of the string. dest may or may not be modified. * If a copy needs to be written, then the UErrorCode parameter * indicates overflow etc. as usual. * @param status Pointer to a standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return The pointer to the UTF-8 string. It may be dest, or at some offset * from dest (only if !forceCopy), or in unrelated memory. * Always NUL-terminated unless the string was written to dest and * length==capacity (in which case U_STRING_NOT_TERMINATED_WARNING is set). * * @see ures_getString * @see u_strToUTF8 * @stable ICU 3.6 */ U_STABLE const char * U_EXPORT2 ures_getUTF8String(const UResourceBundle *resB, char *dest, int32_t *length, UBool forceCopy, UErrorCode *status); /** * Returns a binary data from a binary resource. * * @param resourceBundle a string resource * @param len fills in the length of resulting byte chunk * @param status fills in the outgoing error code * could be U_MISSING_RESOURCE_ERROR if the key is not found * Always check the value of status. Don't count on returning NULL. * could be a non-failing error * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING * @return a pointer to a chunk of unsigned bytes which live in a memory mapped/DLL file. * @see ures_getString * @see ures_getIntVector * @see ures_getInt * @see ures_getUInt * @stable ICU 2.0 */ U_STABLE const uint8_t* U_EXPORT2 ures_getBinary(const UResourceBundle* resourceBundle, int32_t* len, UErrorCode* status); /** * Returns a 32 bit integer array from a resource. * * @param resourceBundle an int vector resource * @param len fills in the length of resulting byte chunk * @param status fills in the outgoing error code * could be U_MISSING_RESOURCE_ERROR if the key is not found * Always check the value of status. Don't count on returning NULL. * could be a non-failing error * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING * @return a pointer to a chunk of integers which live in a memory mapped/DLL file. * @see ures_getBinary * @see ures_getString * @see ures_getInt * @see ures_getUInt * @stable ICU 2.0 */ U_STABLE const int32_t* U_EXPORT2 ures_getIntVector(const UResourceBundle* resourceBundle, int32_t* len, UErrorCode* status); /** * Returns an unsigned integer from a resource. * This integer is originally 28 bits. * * @param resourceBundle a string resource * @param status fills in the outgoing error code * could be U_MISSING_RESOURCE_ERROR if the key is not found * could be a non-failing error * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING * @return an integer value * @see ures_getInt * @see ures_getIntVector * @see ures_getBinary * @see ures_getString * @stable ICU 2.0 */ U_STABLE uint32_t U_EXPORT2 ures_getUInt(const UResourceBundle* resourceBundle, UErrorCode *status); /** * Returns a signed integer from a resource. * This integer is originally 28 bit and the sign gets propagated. * * @param resourceBundle a string resource * @param status fills in the outgoing error code * could be U_MISSING_RESOURCE_ERROR if the key is not found * could be a non-failing error * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING * @return an integer value * @see ures_getUInt * @see ures_getIntVector * @see ures_getBinary * @see ures_getString * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ures_getInt(const UResourceBundle* resourceBundle, UErrorCode *status); /** * Returns the size of a resource. Size for scalar types is always 1, * and for vector/table types is the number of child resources. * @warning Integer array is treated as a scalar type. There are no * APIs to access individual members of an integer array. It * is always returned as a whole. * @param resourceBundle a resource * @return number of resources in a given resource. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ures_getSize(const UResourceBundle *resourceBundle); /** * Returns the type of a resource. Available types are defined in enum UResType * * @param resourceBundle a resource * @return type of the given resource. * @see UResType * @stable ICU 2.0 */ U_STABLE UResType U_EXPORT2 ures_getType(const UResourceBundle *resourceBundle); /** * Returns the key associated with a given resource. Not all the resources have a key - only * those that are members of a table. * * @param resourceBundle a resource * @return a key associated to this resource, or NULL if it doesn't have a key * @stable ICU 2.0 */ U_STABLE const char * U_EXPORT2 ures_getKey(const UResourceBundle *resourceBundle); /* ITERATION API This API provides means for iterating through a resource */ /** * Resets the internal context of a resource so that iteration starts from the first element. * * @param resourceBundle a resource * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ures_resetIterator(UResourceBundle *resourceBundle); /** * Checks whether the given resource has another element to iterate over. * * @param resourceBundle a resource * @return TRUE if there are more elements, FALSE if there is no more elements * @stable ICU 2.0 */ U_STABLE UBool U_EXPORT2 ures_hasNext(const UResourceBundle *resourceBundle); /** * Returns the next resource in a given resource or NULL if there are no more resources * to iterate over. Features a fill-in parameter. * * @param resourceBundle a resource * @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller. * Alternatively, you can supply a struct to be filled by this function. * @param status fills in the outgoing error code. You may still get a non NULL result even if an * error occured. Check status instead. * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it * @stable ICU 2.0 */ U_STABLE UResourceBundle* U_EXPORT2 ures_getNextResource(UResourceBundle *resourceBundle, UResourceBundle *fillIn, UErrorCode *status); /** * Returns the next string in a given resource or NULL if there are no more resources * to iterate over. * * @param resourceBundle a resource * @param len fill in length of the string * @param key fill in for key associated with this string. NULL if no key * @param status fills in the outgoing error code. If an error occured, we may return NULL, but don't * count on it. Check status instead! * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. * @stable ICU 2.0 */ U_STABLE const UChar* U_EXPORT2 ures_getNextString(UResourceBundle *resourceBundle, int32_t* len, const char ** key, UErrorCode *status); /** * Returns the resource in a given resource at the specified index. Features a fill-in parameter. * * @param resourceBundle the resource bundle from which to get a sub-resource * @param indexR an index to the wanted resource. * @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller. * Alternatively, you can supply a struct to be filled by this function. * @param status fills in the outgoing error code. Don't count on NULL being returned if an error has * occured. Check status instead. * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it * @stable ICU 2.0 */ U_STABLE UResourceBundle* U_EXPORT2 ures_getByIndex(const UResourceBundle *resourceBundle, int32_t indexR, UResourceBundle *fillIn, UErrorCode *status); /** * Returns the string in a given resource at the specified index. * * @param resourceBundle a resource * @param indexS an index to the wanted string. * @param len fill in length of the string * @param status fills in the outgoing error code. If an error occured, we may return NULL, but don't * count on it. Check status instead! * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. * @stable ICU 2.0 */ U_STABLE const UChar* U_EXPORT2 ures_getStringByIndex(const UResourceBundle *resourceBundle, int32_t indexS, int32_t* len, UErrorCode *status); /** * Returns a UTF-8 string from a resource at the specified index. * The UTF-8 string may be returnable directly as a pointer, or * it may need to be copied, or transformed from UTF-16 using u_strToUTF8() * or equivalent. * * If forceCopy==TRUE, then the string is always written to the dest buffer * and dest is returned. * * If forceCopy==FALSE, then the string is returned as a pointer if possible, * without needing a dest buffer (it can be NULL). If the string needs to be * copied or transformed, then it may be placed into dest at an arbitrary offset. * * If the string is to be written to dest, then U_BUFFER_OVERFLOW_ERROR and * U_STRING_NOT_TERMINATED_WARNING are set if appropriate, as usual. * * If the string is transformed from UTF-16, then a conversion error may occur * if an unpaired surrogate is encountered. If the function is successful, then * the output UTF-8 string is always well-formed. * * @param resB Resource bundle. * @param stringIndex An index to the wanted string. * @param dest Destination buffer. Can be NULL only if capacity=*length==0. * @param pLength Input: Capacity of destination buffer. * Output: Actual length of the UTF-8 string, not counting the * terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. * Can be NULL, meaning capacity=0 and the string length is not * returned to the caller. * @param forceCopy If TRUE, then the output string will always be written to * dest, with U_BUFFER_OVERFLOW_ERROR and * U_STRING_NOT_TERMINATED_WARNING set if appropriate. * If FALSE, then the dest buffer may or may not contain a * copy of the string. dest may or may not be modified. * If a copy needs to be written, then the UErrorCode parameter * indicates overflow etc. as usual. * @param status Pointer to a standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return The pointer to the UTF-8 string. It may be dest, or at some offset * from dest (only if !forceCopy), or in unrelated memory. * Always NUL-terminated unless the string was written to dest and * length==capacity (in which case U_STRING_NOT_TERMINATED_WARNING is set). * * @see ures_getStringByIndex * @see u_strToUTF8 * @stable ICU 3.6 */ U_STABLE const char * U_EXPORT2 ures_getUTF8StringByIndex(const UResourceBundle *resB, int32_t stringIndex, char *dest, int32_t *pLength, UBool forceCopy, UErrorCode *status); /** * Returns a resource in a given resource that has a given key. This procedure works only with table * resources. Features a fill-in parameter. * * @param resourceBundle a resource * @param key a key associated with the wanted resource * @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller. * Alternatively, you can supply a struct to be filled by this function. * @param status fills in the outgoing error code. * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it * @stable ICU 2.0 */ U_STABLE UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resourceBundle, const char* key, UResourceBundle *fillIn, UErrorCode *status); /** * Returns a string in a given resource that has a given key. This procedure works only with table * resources. * * @param resB a resource * @param key a key associated with the wanted string * @param len fill in length of the string * @param status fills in the outgoing error code. If an error occured, we may return NULL, but don't * count on it. Check status instead! * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. * @stable ICU 2.0 */ U_STABLE const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, const char* key, int32_t* len, UErrorCode *status); /** * Returns a UTF-8 string from a resource and a key. * This function works only with table resources. * * The UTF-8 string may be returnable directly as a pointer, or * it may need to be copied, or transformed from UTF-16 using u_strToUTF8() * or equivalent. * * If forceCopy==TRUE, then the string is always written to the dest buffer * and dest is returned. * * If forceCopy==FALSE, then the string is returned as a pointer if possible, * without needing a dest buffer (it can be NULL). If the string needs to be * copied or transformed, then it may be placed into dest at an arbitrary offset. * * If the string is to be written to dest, then U_BUFFER_OVERFLOW_ERROR and * U_STRING_NOT_TERMINATED_WARNING are set if appropriate, as usual. * * If the string is transformed from UTF-16, then a conversion error may occur * if an unpaired surrogate is encountered. If the function is successful, then * the output UTF-8 string is always well-formed. * * @param resB Resource bundle. * @param key A key associated with the wanted resource * @param dest Destination buffer. Can be NULL only if capacity=*length==0. * @param pLength Input: Capacity of destination buffer. * Output: Actual length of the UTF-8 string, not counting the * terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. * Can be NULL, meaning capacity=0 and the string length is not * returned to the caller. * @param forceCopy If TRUE, then the output string will always be written to * dest, with U_BUFFER_OVERFLOW_ERROR and * U_STRING_NOT_TERMINATED_WARNING set if appropriate. * If FALSE, then the dest buffer may or may not contain a * copy of the string. dest may or may not be modified. * If a copy needs to be written, then the UErrorCode parameter * indicates overflow etc. as usual. * @param status Pointer to a standard ICU error code. Its input value must * pass the U_SUCCESS() test, or else the function returns * immediately. Check for U_FAILURE() on output or use with * function chaining. (See User Guide for details.) * @return The pointer to the UTF-8 string. It may be dest, or at some offset * from dest (only if !forceCopy), or in unrelated memory. * Always NUL-terminated unless the string was written to dest and * length==capacity (in which case U_STRING_NOT_TERMINATED_WARNING is set). * * @see ures_getStringByKey * @see u_strToUTF8 * @stable ICU 3.6 */ U_STABLE const char * U_EXPORT2 ures_getUTF8StringByKey(const UResourceBundle *resB, const char *key, char *dest, int32_t *pLength, UBool forceCopy, UErrorCode *status); #if U_SHOW_CPLUSPLUS_API #include "unicode/unistr.h" U_NAMESPACE_BEGIN /** * returns a string from a string resource type * * @param resB a resource * @param status: fills in the outgoing error code * could be U_MISSING_RESOURCE_ERROR if the key is not found * could be a non-failing error * e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING * @return a UnicodeString object. If there is an error, string is bogus * @stable ICU 2.0 */ inline UnicodeString ures_getUnicodeString(const UResourceBundle *resB, UErrorCode* status) { int32_t len = 0; const UChar *r = ures_getString(resB, &len, status); return UnicodeString(TRUE, r, len); } /** * Returns the next string in a resource or NULL if there are no more resources * to iterate over. * * @param resB a resource * @param key fill in for key associated with this string * @param status fills in the outgoing error code * @return an UnicodeString object. * @stable ICU 2.0 */ inline UnicodeString ures_getNextUnicodeString(UResourceBundle *resB, const char ** key, UErrorCode* status) { int32_t len = 0; const UChar* r = ures_getNextString(resB, &len, key, status); return UnicodeString(TRUE, r, len); } /** * Returns the string in a given resource at the specified index. * * @param resB a resource * @param index an index to the wanted string. * @param status fills in the outgoing error code * @return an UnicodeString object. If there is an error, string is bogus * @stable ICU 2.0 */ inline UnicodeString ures_getUnicodeStringByIndex(const UResourceBundle *resB, int32_t indexS, UErrorCode* status) { int32_t len = 0; const UChar* r = ures_getStringByIndex(resB, indexS, &len, status); return UnicodeString(TRUE, r, len); } /** * Returns a string in a resource that has a given key. This procedure works only with table * resources. * * @param resB a resource * @param key a key associated with the wanted string * @param status fills in the outgoing error code * @return an UnicodeString object. If there is an error, string is bogus * @stable ICU 2.0 */ inline UnicodeString ures_getUnicodeStringByKey(const UResourceBundle *resB, const char* key, UErrorCode* status) { int32_t len = 0; const UChar* r = ures_getStringByKey(resB, key, &len, status); return UnicodeString(TRUE, r, len); } U_NAMESPACE_END #endif /** * Create a string enumerator, owned by the caller, of all locales located within * the specified resource tree. * @param packageName name of the tree, such as (NULL) or U_ICUDATA_ALIAS or or "ICUDATA-coll" * This call is similar to uloc_getAvailable(). * @param status error code * @stable ICU 3.2 */ U_STABLE UEnumeration* U_EXPORT2 ures_openAvailableLocales(const char *packageName, UErrorCode *status); #endif /*_URES*/ /*eof*/ android-audiosystem-1.8+13.10.20130807/include/unicode/ubidi.h0000644000015700001700000025000112200324306024206 0ustar pbuserpbgroup00000000000000/* ****************************************************************************** * * Copyright (C) 1999-2010, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * file name: ubidi.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 1999jul27 * created by: Markus W. Scherer, updated by Matitiahu Allouche */ #ifndef UBIDI_H #define UBIDI_H #include "unicode/utypes.h" #include "unicode/uchar.h" #include "unicode/localpointer.h" /** *\file * \brief C API: Bidi algorithm * *

Bidi algorithm for ICU

* * This is an implementation of the Unicode Bidirectional Algorithm. * The algorithm is defined in the * Unicode Standard Annex #9.

* * Note: Libraries that perform a bidirectional algorithm and * reorder strings accordingly are sometimes called "Storage Layout Engines". * ICU's Bidi and shaping (u_shapeArabic()) APIs can be used at the core of such * "Storage Layout Engines". * *

General remarks about the API:

* * In functions with an error code parameter, * the pErrorCode pointer must be valid * and the value that it points to must not indicate a failure before * the function call. Otherwise, the function returns immediately. * After the function call, the value indicates success or failure.

* * The "limit" of a sequence of characters is the position just after their * last character, i.e., one more than that position.

* * Some of the API functions provide access to "runs". * Such a "run" is defined as a sequence of characters * that are at the same embedding level * after performing the Bidi algorithm.

* * @author Markus W. Scherer * @version 1.0 * * *

Sample code for the ICU Bidi API

* *
Rendering a paragraph with the ICU Bidi API
* * This is (hypothetical) sample code that illustrates * how the ICU Bidi API could be used to render a paragraph of text. * Rendering code depends highly on the graphics system, * therefore this sample code must make a lot of assumptions, * which may or may not match any existing graphics system's properties. * *

The basic assumptions are:

*
    *
  • Rendering is done from left to right on a horizontal line.
  • *
  • A run of single-style, unidirectional text can be rendered at once.
  • *
  • Such a run of text is passed to the graphics system with * characters (code units) in logical order.
  • *
  • The line-breaking algorithm is very complicated * and Locale-dependent - * and therefore its implementation omitted from this sample code.
  • *
* *
 * \code
 *#include "unicode/ubidi.h"
 *
 *typedef enum {
 *     styleNormal=0, styleSelected=1,
 *     styleBold=2, styleItalics=4,
 *     styleSuper=8, styleSub=16
 *} Style;
 *
 *typedef struct { int32_t limit; Style style; } StyleRun;
 *
 *int getTextWidth(const UChar *text, int32_t start, int32_t limit,
 *                  const StyleRun *styleRuns, int styleRunCount);
 *
 * // set *pLimit and *pStyleRunLimit for a line
 * // from text[start] and from styleRuns[styleRunStart]
 * // using ubidi_getLogicalRun(para, ...)
 *void getLineBreak(const UChar *text, int32_t start, int32_t *pLimit,
 *                  UBiDi *para,
 *                  const StyleRun *styleRuns, int styleRunStart, int *pStyleRunLimit,
 *                  int *pLineWidth);
 *
 * // render runs on a line sequentially, always from left to right
 *
 * // prepare rendering a new line
 * void startLine(UBiDiDirection textDirection, int lineWidth);
 *
 * // render a run of text and advance to the right by the run width
 * // the text[start..limit-1] is always in logical order
 * void renderRun(const UChar *text, int32_t start, int32_t limit,
 *               UBiDiDirection textDirection, Style style);
 *
 * // We could compute a cross-product
 * // from the style runs with the directional runs
 * // and then reorder it.
 * // Instead, here we iterate over each run type
 * // and render the intersections -
 * // with shortcuts in simple (and common) cases.
 * // renderParagraph() is the main function.
 *
 * // render a directional run with
 * // (possibly) multiple style runs intersecting with it
 * void renderDirectionalRun(const UChar *text,
 *                           int32_t start, int32_t limit,
 *                           UBiDiDirection direction,
 *                           const StyleRun *styleRuns, int styleRunCount) {
 *     int i;
 *
 *     // iterate over style runs
 *     if(direction==UBIDI_LTR) {
 *         int styleLimit;
 *
 *         for(i=0; ilimit) { styleLimit=limit; }
 *                 renderRun(text, start, styleLimit,
 *                           direction, styleRun[i].style);
 *                 if(styleLimit==limit) { break; }
 *                 start=styleLimit;
 *             }
 *         }
 *     } else {
 *         int styleStart;
 *
 *         for(i=styleRunCount-1; i>=0; --i) {
 *             if(i>0) {
 *                 styleStart=styleRun[i-1].limit;
 *             } else {
 *                 styleStart=0;
 *             }
 *             if(limit>=styleStart) {
 *                 if(styleStart=length
 *
 *         width=getTextWidth(text, 0, length, styleRuns, styleRunCount);
 *         if(width<=lineWidth) {
 *             // everything fits onto one line
 *
 *            // prepare rendering a new line from either left or right
 *             startLine(paraLevel, width);
 *
 *             renderLine(para, text, 0, length,
 *                        styleRuns, styleRunCount);
 *         } else {
 *             UBiDi *line;
 *
 *             // we need to render several lines
 *             line=ubidi_openSized(length, 0, pErrorCode);
 *             if(line!=NULL) {
 *                 int32_t start=0, limit;
 *                 int styleRunStart=0, styleRunLimit;
 *
 *                 for(;;) {
 *                     limit=length;
 *                     styleRunLimit=styleRunCount;
 *                     getLineBreak(text, start, &limit, para,
 *                                  styleRuns, styleRunStart, &styleRunLimit,
 *                                 &width);
 *                     ubidi_setLine(para, start, limit, line, pErrorCode);
 *                     if(U_SUCCESS(*pErrorCode)) {
 *                         // prepare rendering a new line
 *                         // from either left or right
 *                         startLine(paraLevel, width);
 *
 *                         renderLine(line, text, start, limit,
 *                                    styleRuns+styleRunStart,
 *                                    styleRunLimit-styleRunStart);
 *                     }
 *                     if(limit==length) { break; }
 *                     start=limit;
 *                     styleRunStart=styleRunLimit-1;
 *                     if(start>=styleRuns[styleRunStart].limit) {
 *                         ++styleRunStart;
 *                     }
 *                 }
 *
 *                 ubidi_close(line);
 *             }
 *        }
 *    }
 *
 *     ubidi_close(para);
 *}
 *\endcode
 * 
*/ /*DOCXX_TAG*/ /*@{*/ /** * UBiDiLevel is the type of the level values in this * Bidi implementation. * It holds an embedding level and indicates the visual direction * by its bit 0 (even/odd value).

* * It can also hold non-level values for the * paraLevel and embeddingLevels * arguments of ubidi_setPara(); there: *

    *
  • bit 7 of an embeddingLevels[] * value indicates whether the using application is * specifying the level of a character to override whatever the * Bidi implementation would resolve it to.
  • *
  • paraLevel can be set to the * pseudo-level values UBIDI_DEFAULT_LTR * and UBIDI_DEFAULT_RTL.
  • *
* * @see ubidi_setPara * *

The related constants are not real, valid level values. * UBIDI_DEFAULT_XXX can be used to specify * a default for the paragraph level for * when the ubidi_setPara() function * shall determine it but there is no * strongly typed character in the input.

* * Note that the value for UBIDI_DEFAULT_LTR is even * and the one for UBIDI_DEFAULT_RTL is odd, * just like with normal LTR and RTL level values - * these special values are designed that way. Also, the implementation * assumes that UBIDI_MAX_EXPLICIT_LEVEL is odd. * * @see UBIDI_DEFAULT_LTR * @see UBIDI_DEFAULT_RTL * @see UBIDI_LEVEL_OVERRIDE * @see UBIDI_MAX_EXPLICIT_LEVEL * @stable ICU 2.0 */ typedef uint8_t UBiDiLevel; /** Paragraph level setting.

* * Constant indicating that the base direction depends on the first strong * directional character in the text according to the Unicode Bidirectional * Algorithm. If no strong directional character is present, * then set the paragraph level to 0 (left-to-right).

* * If this value is used in conjunction with reordering modes * UBIDI_REORDER_INVERSE_LIKE_DIRECT or * UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL, the text to reorder * is assumed to be visual LTR, and the text after reordering is required * to be the corresponding logical string with appropriate contextual * direction. The direction of the result string will be RTL if either * the righmost or leftmost strong character of the source text is RTL * or Arabic Letter, the direction will be LTR otherwise.

* * If reordering option UBIDI_OPTION_INSERT_MARKS is set, an RLM may * be added at the beginning of the result string to ensure round trip * (that the result string, when reordered back to visual, will produce * the original source text). * @see UBIDI_REORDER_INVERSE_LIKE_DIRECT * @see UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL * @stable ICU 2.0 */ #define UBIDI_DEFAULT_LTR 0xfe /** Paragraph level setting.

* * Constant indicating that the base direction depends on the first strong * directional character in the text according to the Unicode Bidirectional * Algorithm. If no strong directional character is present, * then set the paragraph level to 1 (right-to-left).

* * If this value is used in conjunction with reordering modes * UBIDI_REORDER_INVERSE_LIKE_DIRECT or * UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL, the text to reorder * is assumed to be visual LTR, and the text after reordering is required * to be the corresponding logical string with appropriate contextual * direction. The direction of the result string will be RTL if either * the righmost or leftmost strong character of the source text is RTL * or Arabic Letter, or if the text contains no strong character; * the direction will be LTR otherwise.

* * If reordering option UBIDI_OPTION_INSERT_MARKS is set, an RLM may * be added at the beginning of the result string to ensure round trip * (that the result string, when reordered back to visual, will produce * the original source text). * @see UBIDI_REORDER_INVERSE_LIKE_DIRECT * @see UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL * @stable ICU 2.0 */ #define UBIDI_DEFAULT_RTL 0xff /** * Maximum explicit embedding level. * (The maximum resolved level can be up to UBIDI_MAX_EXPLICIT_LEVEL+1). * @stable ICU 2.0 */ #define UBIDI_MAX_EXPLICIT_LEVEL 61 /** Bit flag for level input. * Overrides directional properties. * @stable ICU 2.0 */ #define UBIDI_LEVEL_OVERRIDE 0x80 /** * Special value which can be returned by the mapping functions when a logical * index has no corresponding visual index or vice-versa. This may happen * for the logical-to-visual mapping of a Bidi control when option * #UBIDI_OPTION_REMOVE_CONTROLS is specified. This can also happen * for the visual-to-logical mapping of a Bidi mark (LRM or RLM) inserted * by option #UBIDI_OPTION_INSERT_MARKS. * @see ubidi_getVisualIndex * @see ubidi_getVisualMap * @see ubidi_getLogicalIndex * @see ubidi_getLogicalMap * @stable ICU 3.6 */ #define UBIDI_MAP_NOWHERE (-1) /** * UBiDiDirection values indicate the text direction. * @stable ICU 2.0 */ enum UBiDiDirection { /** Left-to-right text. This is a 0 value. *

    *
  • As return value for ubidi_getDirection(), it means * that the source string contains no right-to-left characters, or * that the source string is empty and the paragraph level is even. *
  • As return value for ubidi_getBaseDirection(), it * means that the first strong character of the source string has * a left-to-right direction. *
* @stable ICU 2.0 */ UBIDI_LTR, /** Right-to-left text. This is a 1 value. *
    *
  • As return value for ubidi_getDirection(), it means * that the source string contains no left-to-right characters, or * that the source string is empty and the paragraph level is odd. *
  • As return value for ubidi_getBaseDirection(), it * means that the first strong character of the source string has * a right-to-left direction. *
* @stable ICU 2.0 */ UBIDI_RTL, /** Mixed-directional text. *

As return value for ubidi_getDirection(), it means * that the source string contains both left-to-right and * right-to-left characters. * @stable ICU 2.0 */ UBIDI_MIXED, /** No strongly directional text. *

As return value for ubidi_getBaseDirection(), it means * that the source string is missing or empty, or contains neither left-to-right * nor right-to-left characters. * @draft ICU 4.6 */ UBIDI_NEUTRAL }; /** @stable ICU 2.0 */ typedef enum UBiDiDirection UBiDiDirection; /** * Forward declaration of the UBiDi structure for the declaration of * the API functions. Its fields are implementation-specific.

* This structure holds information about a paragraph (or multiple paragraphs) * of text with Bidi-algorithm-related details, or about one line of * such a paragraph.

* Reordering can be done on a line, or on one or more paragraphs which are * then interpreted each as one single line. * @stable ICU 2.0 */ struct UBiDi; /** @stable ICU 2.0 */ typedef struct UBiDi UBiDi; /** * Allocate a UBiDi structure. * Such an object is initially empty. It is assigned * the Bidi properties of a piece of text containing one or more paragraphs * by ubidi_setPara() * or the Bidi properties of a line within a paragraph by * ubidi_setLine().

* This object can be reused for as long as it is not deallocated * by calling ubidi_close().

* ubidi_setPara() and ubidi_setLine() will allocate * additional memory for internal structures as necessary. * * @return An empty UBiDi object. * @stable ICU 2.0 */ U_STABLE UBiDi * U_EXPORT2 ubidi_open(void); /** * Allocate a UBiDi structure with preallocated memory * for internal structures. * This function provides a UBiDi object like ubidi_open() * with no arguments, but it also preallocates memory for internal structures * according to the sizings supplied by the caller.

* Subsequent functions will not allocate any more memory, and are thus * guaranteed not to fail because of lack of memory.

* The preallocation can be limited to some of the internal memory * by setting some values to 0 here. That means that if, e.g., * maxRunCount cannot be reasonably predetermined and should not * be set to maxLength (the only failproof value) to avoid * wasting memory, then maxRunCount could be set to 0 here * and the internal structures that are associated with it will be allocated * on demand, just like with ubidi_open(). * * @param maxLength is the maximum text or line length that internal memory * will be preallocated for. An attempt to associate this object with a * longer text will fail, unless this value is 0, which leaves the allocation * up to the implementation. * * @param maxRunCount is the maximum anticipated number of same-level runs * that internal memory will be preallocated for. An attempt to access * visual runs on an object that was not preallocated for as many runs * as the text was actually resolved to will fail, * unless this value is 0, which leaves the allocation up to the implementation.

* The number of runs depends on the actual text and maybe anywhere between * 1 and maxLength. It is typically small. * * @param pErrorCode must be a valid pointer to an error code value. * * @return An empty UBiDi object with preallocated memory. * @stable ICU 2.0 */ U_STABLE UBiDi * U_EXPORT2 ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode); /** * ubidi_close() must be called to free the memory * associated with a UBiDi object.

* * Important: * A parent UBiDi object must not be destroyed or reused if * it still has children. * If a UBiDi object has become the child * of another one (its parent) by calling * ubidi_setLine(), then the child object must * be destroyed (closed) or reused (by calling * ubidi_setPara() or ubidi_setLine()) * before the parent object. * * @param pBiDi is a UBiDi object. * * @see ubidi_setPara * @see ubidi_setLine * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ubidi_close(UBiDi *pBiDi); #if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN /** * \class LocalUBiDiPointer * "Smart pointer" class, closes a UBiDi via ubidi_close(). * For most methods see the LocalPointerBase base class. * * @see LocalPointerBase * @see LocalPointer * @stable ICU 4.4 */ U_DEFINE_LOCAL_OPEN_POINTER(LocalUBiDiPointer, UBiDi, ubidi_close); U_NAMESPACE_END #endif /** * Modify the operation of the Bidi algorithm such that it * approximates an "inverse Bidi" algorithm. This function * must be called before ubidi_setPara(). * *

The normal operation of the Bidi algorithm as described * in the Unicode Technical Report is to take text stored in logical * (keyboard, typing) order and to determine the reordering of it for visual * rendering. * Some legacy systems store text in visual order, and for operations * with standard, Unicode-based algorithms, the text needs to be transformed * to logical order. This is effectively the inverse algorithm of the * described Bidi algorithm. Note that there is no standard algorithm for * this "inverse Bidi" and that the current implementation provides only an * approximation of "inverse Bidi".

* *

With isInverse set to TRUE, * this function changes the behavior of some of the subsequent functions * in a way that they can be used for the inverse Bidi algorithm. * Specifically, runs of text with numeric characters will be treated in a * special way and may need to be surrounded with LRM characters when they are * written in reordered sequence.

* *

Output runs should be retrieved using ubidi_getVisualRun(). * Since the actual input for "inverse Bidi" is visually ordered text and * ubidi_getVisualRun() gets the reordered runs, these are actually * the runs of the logically ordered output.

* *

Calling this function with argument isInverse set to * TRUE is equivalent to calling * ubidi_setReorderingMode with argument * reorderingMode * set to #UBIDI_REORDER_INVERSE_NUMBERS_AS_L.
* Calling this function with argument isInverse set to * FALSE is equivalent to calling * ubidi_setReorderingMode with argument * reorderingMode * set to #UBIDI_REORDER_DEFAULT. * * @param pBiDi is a UBiDi object. * * @param isInverse specifies "forward" or "inverse" Bidi operation. * * @see ubidi_setPara * @see ubidi_writeReordered * @see ubidi_setReorderingMode * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ubidi_setInverse(UBiDi *pBiDi, UBool isInverse); /** * Is this Bidi object set to perform the inverse Bidi algorithm? *

Note: calling this function after setting the reordering mode with * ubidi_setReorderingMode will return TRUE if the * reordering mode was set to #UBIDI_REORDER_INVERSE_NUMBERS_AS_L, * FALSE for all other values.

* * @param pBiDi is a UBiDi object. * @return TRUE if the Bidi object is set to perform the inverse Bidi algorithm * by handling numbers as L. * * @see ubidi_setInverse * @see ubidi_setReorderingMode * @stable ICU 2.0 */ U_STABLE UBool U_EXPORT2 ubidi_isInverse(UBiDi *pBiDi); /** * Specify whether block separators must be allocated level zero, * so that successive paragraphs will progress from left to right. * This function must be called before ubidi_setPara(). * Paragraph separators (B) may appear in the text. Setting them to level zero * means that all paragraph separators (including one possibly appearing * in the last text position) are kept in the reordered text after the text * that they follow in the source text. * When this feature is not enabled, a paragraph separator at the last * position of the text before reordering will go to the first position * of the reordered text when the paragraph level is odd. * * @param pBiDi is a UBiDi object. * * @param orderParagraphsLTR specifies whether paragraph separators (B) must * receive level 0, so that successive paragraphs progress from left to right. * * @see ubidi_setPara * @stable ICU 3.4 */ U_STABLE void U_EXPORT2 ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR); /** * Is this Bidi object set to allocate level 0 to block separators so that * successive paragraphs progress from left to right? * * @param pBiDi is a UBiDi object. * @return TRUE if the Bidi object is set to allocate level 0 to block * separators. * * @see ubidi_orderParagraphsLTR * @stable ICU 3.4 */ U_STABLE UBool U_EXPORT2 ubidi_isOrderParagraphsLTR(UBiDi *pBiDi); /** * UBiDiReorderingMode values indicate which variant of the Bidi * algorithm to use. * * @see ubidi_setReorderingMode * @stable ICU 3.6 */ typedef enum UBiDiReorderingMode { /** Regular Logical to Visual Bidi algorithm according to Unicode. * This is a 0 value. * @stable ICU 3.6 */ UBIDI_REORDER_DEFAULT = 0, /** Logical to Visual algorithm which handles numbers in a way which * mimicks the behavior of Windows XP. * @stable ICU 3.6 */ UBIDI_REORDER_NUMBERS_SPECIAL, /** Logical to Visual algorithm grouping numbers with adjacent R characters * (reversible algorithm). * @stable ICU 3.6 */ UBIDI_REORDER_GROUP_NUMBERS_WITH_R, /** Reorder runs only to transform a Logical LTR string to the Logical RTL * string with the same display, or vice-versa.
* If this mode is set together with option * #UBIDI_OPTION_INSERT_MARKS, some Bidi controls in the source * text may be removed and other controls may be added to produce the * minimum combination which has the required display. * @stable ICU 3.6 */ UBIDI_REORDER_RUNS_ONLY, /** Visual to Logical algorithm which handles numbers like L * (same algorithm as selected by ubidi_setInverse(TRUE). * @see ubidi_setInverse * @stable ICU 3.6 */ UBIDI_REORDER_INVERSE_NUMBERS_AS_L, /** Visual to Logical algorithm equivalent to the regular Logical to Visual * algorithm. * @stable ICU 3.6 */ UBIDI_REORDER_INVERSE_LIKE_DIRECT, /** Inverse Bidi (Visual to Logical) algorithm for the * UBIDI_REORDER_NUMBERS_SPECIAL Bidi algorithm. * @stable ICU 3.6 */ UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL, /** Number of values for reordering mode. * @stable ICU 3.6 */ UBIDI_REORDER_COUNT } UBiDiReorderingMode; /** * Modify the operation of the Bidi algorithm such that it implements some * variant to the basic Bidi algorithm or approximates an "inverse Bidi" * algorithm, depending on different values of the "reordering mode". * This function must be called before ubidi_setPara(), and stays * in effect until called again with a different argument. * *

The normal operation of the Bidi algorithm as described * in the Unicode Standard Annex #9 is to take text stored in logical * (keyboard, typing) order and to determine how to reorder it for visual * rendering.

* *

With the reordering mode set to a value other than * #UBIDI_REORDER_DEFAULT, this function changes the behavior of * some of the subsequent functions in a way such that they implement an * inverse Bidi algorithm or some other algorithm variants.

* *

Some legacy systems store text in visual order, and for operations * with standard, Unicode-based algorithms, the text needs to be transformed * into logical order. This is effectively the inverse algorithm of the * described Bidi algorithm. Note that there is no standard algorithm for * this "inverse Bidi", so a number of variants are implemented here.

* *

In other cases, it may be desirable to emulate some variant of the * Logical to Visual algorithm (e.g. one used in MS Windows), or perform a * Logical to Logical transformation.

* *
    *
  • When the reordering mode is set to #UBIDI_REORDER_DEFAULT, * the standard Bidi Logical to Visual algorithm is applied.
  • * *
  • When the reordering mode is set to * #UBIDI_REORDER_NUMBERS_SPECIAL, * the algorithm used to perform Bidi transformations when calling * ubidi_setPara should approximate the algorithm used in * Microsoft Windows XP rather than strictly conform to the Unicode Bidi * algorithm. *
    * The differences between the basic algorithm and the algorithm addressed * by this option are as follows: *
      *
    • Within text at an even embedding level, the sequence "123AB" * (where AB represent R or AL letters) is transformed to "123BA" by the * Unicode algorithm and to "BA123" by the Windows algorithm.
    • *
    • Arabic-Indic numbers (AN) are handled by the Windows algorithm just * like regular numbers (EN).
    • *
  • * *
  • When the reordering mode is set to * #UBIDI_REORDER_GROUP_NUMBERS_WITH_R, * numbers located between LTR text and RTL text are associated with the RTL * text. For instance, an LTR paragraph with content "abc 123 DEF" (where * upper case letters represent RTL characters) will be transformed to * "abc FED 123" (and not "abc 123 FED"), "DEF 123 abc" will be transformed * to "123 FED abc" and "123 FED abc" will be transformed to "DEF 123 abc". * This makes the algorithm reversible and makes it useful when round trip * (from visual to logical and back to visual) must be achieved without * adding LRM characters. However, this is a variation from the standard * Unicode Bidi algorithm.
    * The source text should not contain Bidi control characters other than LRM * or RLM.
  • * *
  • When the reordering mode is set to * #UBIDI_REORDER_RUNS_ONLY, * a "Logical to Logical" transformation must be performed: *
      *
    • If the default text level of the source text (argument paraLevel * in ubidi_setPara) is even, the source text will be handled as * LTR logical text and will be transformed to the RTL logical text which has * the same LTR visual display.
    • *
    • If the default level of the source text is odd, the source text * will be handled as RTL logical text and will be transformed to the * LTR logical text which has the same LTR visual display.
    • *
    * This mode may be needed when logical text which is basically Arabic or * Hebrew, with possible included numbers or phrases in English, has to be * displayed as if it had an even embedding level (this can happen if the * displaying application treats all text as if it was basically LTR). *
    * This mode may also be needed in the reverse case, when logical text which is * basically English, with possible included phrases in Arabic or Hebrew, has to * be displayed as if it had an odd embedding level. *
    * Both cases could be handled by adding LRE or RLE at the head of the text, * if the display subsystem supports these formatting controls. If it does not, * the problem may be handled by transforming the source text in this mode * before displaying it, so that it will be displayed properly.
    * The source text should not contain Bidi control characters other than LRM * or RLM.
  • * *
  • When the reordering mode is set to * #UBIDI_REORDER_INVERSE_NUMBERS_AS_L, an "inverse Bidi" algorithm * is applied. * Runs of text with numeric characters will be treated like LTR letters and * may need to be surrounded with LRM characters when they are written in * reordered sequence (the option #UBIDI_INSERT_LRM_FOR_NUMERIC can * be used with function ubidi_writeReordered to this end. This * mode is equivalent to calling ubidi_setInverse() with * argument isInverse set to TRUE.
  • * *
  • When the reordering mode is set to * #UBIDI_REORDER_INVERSE_LIKE_DIRECT, the "direct" Logical to Visual * Bidi algorithm is used as an approximation of an "inverse Bidi" algorithm. * This mode is similar to mode #UBIDI_REORDER_INVERSE_NUMBERS_AS_L * but is closer to the regular Bidi algorithm. *
    * For example, an LTR paragraph with the content "FED 123 456 CBA" (where * upper case represents RTL characters) will be transformed to * "ABC 456 123 DEF", as opposed to "DEF 123 456 ABC" * with mode UBIDI_REORDER_INVERSE_NUMBERS_AS_L.
    * When used in conjunction with option * #UBIDI_OPTION_INSERT_MARKS, this mode generally * adds Bidi marks to the output significantly more sparingly than mode * #UBIDI_REORDER_INVERSE_NUMBERS_AS_L with option * #UBIDI_INSERT_LRM_FOR_NUMERIC in calls to * ubidi_writeReordered.
  • * *
  • When the reordering mode is set to * #UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL, the Logical to Visual * Bidi algorithm used in Windows XP is used as an approximation of an "inverse Bidi" algorithm. *
    * For example, an LTR paragraph with the content "abc FED123" (where * upper case represents RTL characters) will be transformed to "abc 123DEF."
  • *
* *

In all the reordering modes specifying an "inverse Bidi" algorithm * (i.e. those with a name starting with UBIDI_REORDER_INVERSE), * output runs should be retrieved using * ubidi_getVisualRun(), and the output text with * ubidi_writeReordered(). The caller should keep in mind that in * "inverse Bidi" modes the input is actually visually ordered text and * reordered output returned by ubidi_getVisualRun() or * ubidi_writeReordered() are actually runs or character string * of logically ordered output.
* For all the "inverse Bidi" modes, the source text should not contain * Bidi control characters other than LRM or RLM.

* *

Note that option #UBIDI_OUTPUT_REVERSE of * ubidi_writeReordered has no useful meaning and should not be * used in conjunction with any value of the reordering mode specifying * "inverse Bidi" or with value UBIDI_REORDER_RUNS_ONLY. * * @param pBiDi is a UBiDi object. * @param reorderingMode specifies the required variant of the Bidi algorithm. * * @see UBiDiReorderingMode * @see ubidi_setInverse * @see ubidi_setPara * @see ubidi_writeReordered * @stable ICU 3.6 */ U_STABLE void U_EXPORT2 ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode); /** * What is the requested reordering mode for a given Bidi object? * * @param pBiDi is a UBiDi object. * @return the current reordering mode of the Bidi object * @see ubidi_setReorderingMode * @stable ICU 3.6 */ U_STABLE UBiDiReorderingMode U_EXPORT2 ubidi_getReorderingMode(UBiDi *pBiDi); /** * UBiDiReorderingOption values indicate which options are * specified to affect the Bidi algorithm. * * @see ubidi_setReorderingOptions * @stable ICU 3.6 */ typedef enum UBiDiReorderingOption { /** * option value for ubidi_setReorderingOptions: * disable all the options which can be set with this function * @see ubidi_setReorderingOptions * @stable ICU 3.6 */ UBIDI_OPTION_DEFAULT = 0, /** * option bit for ubidi_setReorderingOptions: * insert Bidi marks (LRM or RLM) when needed to ensure correct result of * a reordering to a Logical order * *

This option must be set or reset before calling * ubidi_setPara.

* *

This option is significant only with reordering modes which generate * a result with Logical order, specifically:

*
    *
  • #UBIDI_REORDER_RUNS_ONLY
  • *
  • #UBIDI_REORDER_INVERSE_NUMBERS_AS_L
  • *
  • #UBIDI_REORDER_INVERSE_LIKE_DIRECT
  • *
  • #UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL
  • *
* *

If this option is set in conjunction with reordering mode * #UBIDI_REORDER_INVERSE_NUMBERS_AS_L or with calling * ubidi_setInverse(TRUE), it implies * option #UBIDI_INSERT_LRM_FOR_NUMERIC * in calls to function ubidi_writeReordered().

* *

For other reordering modes, a minimum number of LRM or RLM characters * will be added to the source text after reordering it so as to ensure * round trip, i.e. when applying the inverse reordering mode on the * resulting logical text with removal of Bidi marks * (option #UBIDI_OPTION_REMOVE_CONTROLS set before calling * ubidi_setPara() or option #UBIDI_REMOVE_BIDI_CONTROLS * in ubidi_writeReordered), the result will be identical to the * source text in the first transformation. * *

This option will be ignored if specified together with option * #UBIDI_OPTION_REMOVE_CONTROLS. It inhibits option * UBIDI_REMOVE_BIDI_CONTROLS in calls to function * ubidi_writeReordered() and it implies option * #UBIDI_INSERT_LRM_FOR_NUMERIC in calls to function * ubidi_writeReordered() if the reordering mode is * #UBIDI_REORDER_INVERSE_NUMBERS_AS_L.

* * @see ubidi_setReorderingMode * @see ubidi_setReorderingOptions * @stable ICU 3.6 */ UBIDI_OPTION_INSERT_MARKS = 1, /** * option bit for ubidi_setReorderingOptions: * remove Bidi control characters * *

This option must be set or reset before calling * ubidi_setPara.

* *

This option nullifies option #UBIDI_OPTION_INSERT_MARKS. * It inhibits option #UBIDI_INSERT_LRM_FOR_NUMERIC in calls * to function ubidi_writeReordered() and it implies option * #UBIDI_REMOVE_BIDI_CONTROLS in calls to that function.

* * @see ubidi_setReorderingMode * @see ubidi_setReorderingOptions * @stable ICU 3.6 */ UBIDI_OPTION_REMOVE_CONTROLS = 2, /** * option bit for ubidi_setReorderingOptions: * process the output as part of a stream to be continued * *

This option must be set or reset before calling * ubidi_setPara.

* *

This option specifies that the caller is interested in processing large * text object in parts. * The results of the successive calls are expected to be concatenated by the * caller. Only the call for the last part will have this option bit off.

* *

When this option bit is on, ubidi_setPara() may process * less than the full source text in order to truncate the text at a meaningful * boundary. The caller should call ubidi_getProcessedLength() * immediately after calling ubidi_setPara() in order to * determine how much of the source text has been processed. * Source text beyond that length should be resubmitted in following calls to * ubidi_setPara. The processed length may be less than * the length of the source text if a character preceding the last character of * the source text constitutes a reasonable boundary (like a block separator) * for text to be continued.
* If the last character of the source text constitutes a reasonable * boundary, the whole text will be processed at once.
* If nowhere in the source text there exists * such a reasonable boundary, the processed length will be zero.
* The caller should check for such an occurrence and do one of the following: *

  • submit a larger amount of text with a better chance to include * a reasonable boundary.
  • *
  • resubmit the same text after turning off option * UBIDI_OPTION_STREAMING.
* In all cases, this option should be turned off before processing the last * part of the text.

* *

When the UBIDI_OPTION_STREAMING option is used, * it is recommended to call ubidi_orderParagraphsLTR() with * argument orderParagraphsLTR set to TRUE before * calling ubidi_setPara so that later paragraphs may be * concatenated to previous paragraphs on the right.

* * @see ubidi_setReorderingMode * @see ubidi_setReorderingOptions * @see ubidi_getProcessedLength * @see ubidi_orderParagraphsLTR * @stable ICU 3.6 */ UBIDI_OPTION_STREAMING = 4 } UBiDiReorderingOption; /** * Specify which of the reordering options * should be applied during Bidi transformations. * * @param pBiDi is a UBiDi object. * @param reorderingOptions is a combination of zero or more of the following * options: * #UBIDI_OPTION_DEFAULT, #UBIDI_OPTION_INSERT_MARKS, * #UBIDI_OPTION_REMOVE_CONTROLS, #UBIDI_OPTION_STREAMING. * * @see ubidi_getReorderingOptions * @stable ICU 3.6 */ U_STABLE void U_EXPORT2 ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions); /** * What are the reordering options applied to a given Bidi object? * * @param pBiDi is a UBiDi object. * @return the current reordering options of the Bidi object * @see ubidi_setReorderingOptions * @stable ICU 3.6 */ U_STABLE uint32_t U_EXPORT2 ubidi_getReorderingOptions(UBiDi *pBiDi); /** * Perform the Unicode Bidi algorithm. It is defined in the * Unicode Standard Anned #9, * version 13, * also described in The Unicode Standard, Version 4.0 .

* * This function takes a piece of plain text containing one or more paragraphs, * with or without externally specified embedding levels from styled * text and computes the left-right-directionality of each character.

* * If the entire text is all of the same directionality, then * the function may not perform all the steps described by the algorithm, * i.e., some levels may not be the same as if all steps were performed. * This is not relevant for unidirectional text.
* For example, in pure LTR text with numbers the numbers would get * a resolved level of 2 higher than the surrounding text according to * the algorithm. This implementation may set all resolved levels to * the same value in such a case.

* * The text can be composed of multiple paragraphs. Occurrence of a block * separator in the text terminates a paragraph, and whatever comes next starts * a new paragraph. The exception to this rule is when a Carriage Return (CR) * is followed by a Line Feed (LF). Both CR and LF are block separators, but * in that case, the pair of characters is considered as terminating the * preceding paragraph, and a new paragraph will be started by a character * coming after the LF. * * @param pBiDi A UBiDi object allocated with ubidi_open() * which will be set to contain the reordering information, * especially the resolved levels for all the characters in text. * * @param text is a pointer to the text that the Bidi algorithm will be performed on. * This pointer is stored in the UBiDi object and can be retrieved * with ubidi_getText().
* Note: the text must be (at least) length long. * * @param length is the length of the text; if length==-1 then * the text must be zero-terminated. * * @param paraLevel specifies the default level for the text; * it is typically 0 (LTR) or 1 (RTL). * If the function shall determine the paragraph level from the text, * then paraLevel can be set to * either #UBIDI_DEFAULT_LTR * or #UBIDI_DEFAULT_RTL; if the text contains multiple * paragraphs, the paragraph level shall be determined separately for * each paragraph; if a paragraph does not include any strongly typed * character, then the desired default is used (0 for LTR or 1 for RTL). * Any other value between 0 and #UBIDI_MAX_EXPLICIT_LEVEL * is also valid, with odd levels indicating RTL. * * @param embeddingLevels (in) may be used to preset the embedding and override levels, * ignoring characters like LRE and PDF in the text. * A level overrides the directional property of its corresponding * (same index) character if the level has the * #UBIDI_LEVEL_OVERRIDE bit set.

* Except for that bit, it must be * paraLevel<=embeddingLevels[]<=UBIDI_MAX_EXPLICIT_LEVEL, * with one exception: a level of zero may be specified for a paragraph * separator even if paraLevel>0 when multiple paragraphs * are submitted in the same call to ubidi_setPara().

* Caution: A copy of this pointer, not of the levels, * will be stored in the UBiDi object; * the embeddingLevels array must not be * deallocated before the UBiDi structure is destroyed or reused, * and the embeddingLevels * should not be modified to avoid unexpected results on subsequent Bidi operations. * However, the ubidi_setPara() and * ubidi_setLine() functions may modify some or all of the levels.

* After the UBiDi object is reused or destroyed, the caller * must take care of the deallocation of the embeddingLevels array.

* Note: the embeddingLevels array must be * at least length long. * This pointer can be NULL if this * value is not necessary. * * @param pErrorCode must be a valid pointer to an error code value. * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length, UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels, UErrorCode *pErrorCode); /** * ubidi_setLine() sets a UBiDi to * contain the reordering information, especially the resolved levels, * for all the characters in a line of text. This line of text is * specified by referring to a UBiDi object representing * this information for a piece of text containing one or more paragraphs, * and by specifying a range of indexes in this text.

* In the new line object, the indexes will range from 0 to limit-start-1.

* * This is used after calling ubidi_setPara() * for a piece of text, and after line-breaking on that text. * It is not necessary if each paragraph is treated as a single line.

* * After line-breaking, rules (L1) and (L2) for the treatment of * trailing WS and for reordering are performed on * a UBiDi object that represents a line.

* * Important: pLineBiDi shares data with * pParaBiDi. * You must destroy or reuse pLineBiDi before pParaBiDi. * In other words, you must destroy or reuse the UBiDi object for a line * before the object for its parent paragraph.

* * The text pointer that was stored in pParaBiDi is also copied, * and start is added to it so that it points to the beginning of the * line for this object. * * @param pParaBiDi is the parent paragraph object. It must have been set * by a successful call to ubidi_setPara. * * @param start is the line's first index into the text. * * @param limit is just behind the line's last index into the text * (its last index +1).
* It must be 0<=startcontaining paragraph limit. * If the specified line crosses a paragraph boundary, the function * will terminate with error code U_ILLEGAL_ARGUMENT_ERROR. * * @param pLineBiDi is the object that will now represent a line of the text. * * @param pErrorCode must be a valid pointer to an error code value. * * @see ubidi_setPara * @see ubidi_getProcessedLength * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ubidi_setLine(const UBiDi *pParaBiDi, int32_t start, int32_t limit, UBiDi *pLineBiDi, UErrorCode *pErrorCode); /** * Get the directionality of the text. * * @param pBiDi is the paragraph or line UBiDi object. * * @return a value of UBIDI_LTR, UBIDI_RTL * or UBIDI_MIXED * that indicates if the entire text * represented by this object is unidirectional, * and which direction, or if it is mixed-directional. * Note - The value UBIDI_NEUTRAL is never returned from this method. * * @see UBiDiDirection * @stable ICU 2.0 */ U_STABLE UBiDiDirection U_EXPORT2 ubidi_getDirection(const UBiDi *pBiDi); /** * Gets the base direction of the text provided according * to the Unicode Bidirectional Algorithm. The base direction * is derived from the first character in the string with bidirectional * character type L, R, or AL. If the first such character has type L, * UBIDI_LTR is returned. If the first such character has * type R or AL, UBIDI_RTL is returned. If the string does * not contain any character of these types, then * UBIDI_NEUTRAL is returned. * * This is a lightweight function for use when only the base direction * is needed and no further bidi processing of the text is needed. * * @param text is a pointer to the text whose base * direction is needed. * Note: the text must be (at least) @c length long. * * @param length is the length of the text; * if length==-1 then the text * must be zero-terminated. * * @return UBIDI_LTR, UBIDI_RTL, * UBIDI_NEUTRAL * * @see UBiDiDirection * @draft ICU 4.6 */ U_DRAFT UBiDiDirection U_EXPORT2 ubidi_getBaseDirection(const UChar *text, int32_t length ); /** * Get the pointer to the text. * * @param pBiDi is the paragraph or line UBiDi object. * * @return The pointer to the text that the UBiDi object was created for. * * @see ubidi_setPara * @see ubidi_setLine * @stable ICU 2.0 */ U_STABLE const UChar * U_EXPORT2 ubidi_getText(const UBiDi *pBiDi); /** * Get the length of the text. * * @param pBiDi is the paragraph or line UBiDi object. * * @return The length of the text that the UBiDi object was created for. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ubidi_getLength(const UBiDi *pBiDi); /** * Get the paragraph level of the text. * * @param pBiDi is the paragraph or line UBiDi object. * * @return The paragraph level. If there are multiple paragraphs, their * level may vary if the required paraLevel is UBIDI_DEFAULT_LTR or * UBIDI_DEFAULT_RTL. In that case, the level of the first paragraph * is returned. * * @see UBiDiLevel * @see ubidi_getParagraph * @see ubidi_getParagraphByIndex * @stable ICU 2.0 */ U_STABLE UBiDiLevel U_EXPORT2 ubidi_getParaLevel(const UBiDi *pBiDi); /** * Get the number of paragraphs. * * @param pBiDi is the paragraph or line UBiDi object. * * @return The number of paragraphs. * @stable ICU 3.4 */ U_STABLE int32_t U_EXPORT2 ubidi_countParagraphs(UBiDi *pBiDi); /** * Get a paragraph, given a position within the text. * This function returns information about a paragraph.
* Note: if the paragraph index is known, it is more efficient to * retrieve the paragraph information using ubidi_getParagraphByIndex().

* * @param pBiDi is the paragraph or line UBiDi object. * * @param charIndex is the index of a character within the text, in the * range [0..ubidi_getProcessedLength(pBiDi)-1]. * * @param pParaStart will receive the index of the first character of the * paragraph in the text. * This pointer can be NULL if this * value is not necessary. * * @param pParaLimit will receive the limit of the paragraph. * The l-value that you point to here may be the * same expression (variable) as the one for * charIndex. * This pointer can be NULL if this * value is not necessary. * * @param pParaLevel will receive the level of the paragraph. * This pointer can be NULL if this * value is not necessary. * * @param pErrorCode must be a valid pointer to an error code value. * * @return The index of the paragraph containing the specified position. * * @see ubidi_getProcessedLength * @stable ICU 3.4 */ U_STABLE int32_t U_EXPORT2 ubidi_getParagraph(const UBiDi *pBiDi, int32_t charIndex, int32_t *pParaStart, int32_t *pParaLimit, UBiDiLevel *pParaLevel, UErrorCode *pErrorCode); /** * Get a paragraph, given the index of this paragraph. * * This function returns information about a paragraph.

* * @param pBiDi is the paragraph UBiDi object. * * @param paraIndex is the number of the paragraph, in the * range [0..ubidi_countParagraphs(pBiDi)-1]. * * @param pParaStart will receive the index of the first character of the * paragraph in the text. * This pointer can be NULL if this * value is not necessary. * * @param pParaLimit will receive the limit of the paragraph. * This pointer can be NULL if this * value is not necessary. * * @param pParaLevel will receive the level of the paragraph. * This pointer can be NULL if this * value is not necessary. * * @param pErrorCode must be a valid pointer to an error code value. * * @stable ICU 3.4 */ U_STABLE void U_EXPORT2 ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex, int32_t *pParaStart, int32_t *pParaLimit, UBiDiLevel *pParaLevel, UErrorCode *pErrorCode); /** * Get the level for one character. * * @param pBiDi is the paragraph or line UBiDi object. * * @param charIndex the index of a character. It must be in the range * [0..ubidi_getProcessedLength(pBiDi)]. * * @return The level for the character at charIndex (0 if charIndex is not * in the valid range). * * @see UBiDiLevel * @see ubidi_getProcessedLength * @stable ICU 2.0 */ U_STABLE UBiDiLevel U_EXPORT2 ubidi_getLevelAt(const UBiDi *pBiDi, int32_t charIndex); /** * Get an array of levels for each character.

* * Note that this function may allocate memory under some * circumstances, unlike ubidi_getLevelAt(). * * @param pBiDi is the paragraph or line UBiDi object, whose * text length must be strictly positive. * * @param pErrorCode must be a valid pointer to an error code value. * * @return The levels array for the text, * or NULL if an error occurs. * * @see UBiDiLevel * @see ubidi_getProcessedLength * @stable ICU 2.0 */ U_STABLE const UBiDiLevel * U_EXPORT2 ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode); /** * Get a logical run. * This function returns information about a run and is used * to retrieve runs in logical order.

* This is especially useful for line-breaking on a paragraph. * * @param pBiDi is the paragraph or line UBiDi object. * * @param logicalPosition is a logical position within the source text. * * @param pLogicalLimit will receive the limit of the corresponding run. * The l-value that you point to here may be the * same expression (variable) as the one for * logicalPosition. * This pointer can be NULL if this * value is not necessary. * * @param pLevel will receive the level of the corresponding run. * This pointer can be NULL if this * value is not necessary. * * @see ubidi_getProcessedLength * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ubidi_getLogicalRun(const UBiDi *pBiDi, int32_t logicalPosition, int32_t *pLogicalLimit, UBiDiLevel *pLevel); /** * Get the number of runs. * This function may invoke the actual reordering on the * UBiDi object, after ubidi_setPara() * may have resolved only the levels of the text. Therefore, * ubidi_countRuns() may have to allocate memory, * and may fail doing so. * * @param pBiDi is the paragraph or line UBiDi object. * * @param pErrorCode must be a valid pointer to an error code value. * * @return The number of runs. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ubidi_countRuns(UBiDi *pBiDi, UErrorCode *pErrorCode); /** * Get one run's logical start, length, and directionality, * which can be 0 for LTR or 1 for RTL. * In an RTL run, the character at the logical start is * visually on the right of the displayed run. * The length is the number of characters in the run.

* ubidi_countRuns() should be called * before the runs are retrieved. * * @param pBiDi is the paragraph or line UBiDi object. * * @param runIndex is the number of the run in visual order, in the * range [0..ubidi_countRuns(pBiDi)-1]. * * @param pLogicalStart is the first logical character index in the text. * The pointer may be NULL if this index is not needed. * * @param pLength is the number of characters (at least one) in the run. * The pointer may be NULL if this is not needed. * * @return the directionality of the run, * UBIDI_LTR==0 or UBIDI_RTL==1, * never UBIDI_MIXED, * never UBIDI_NEUTRAL. * * @see ubidi_countRuns * * Example: *

 * \code
 * int32_t i, count=ubidi_countRuns(pBiDi),
 *         logicalStart, visualIndex=0, length;
 * for(i=0; i0);
 *     } else {
 *         logicalStart+=length;  // logicalLimit
 *         do { // RTL
 *             show_char(text[--logicalStart], visualIndex++);
 *         } while(--length>0);
 *     }
 * }
 *\endcode
 * 
* * Note that in right-to-left runs, code like this places * second surrogates before first ones (which is generally a bad idea) * and combining characters before base characters. *

* Use of ubidi_writeReordered(), optionally with the * #UBIDI_KEEP_BASE_COMBINING option, can be considered in order * to avoid these issues. * @stable ICU 2.0 */ U_STABLE UBiDiDirection U_EXPORT2 ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex, int32_t *pLogicalStart, int32_t *pLength); /** * Get the visual position from a logical text position. * If such a mapping is used many times on the same * UBiDi object, then calling * ubidi_getLogicalMap() is more efficient.

* * The value returned may be #UBIDI_MAP_NOWHERE if there is no * visual position because the corresponding text character is a Bidi control * removed from output by the option #UBIDI_OPTION_REMOVE_CONTROLS. *

* When the visual output is altered by using options of * ubidi_writeReordered() such as UBIDI_INSERT_LRM_FOR_NUMERIC, * UBIDI_KEEP_BASE_COMBINING, UBIDI_OUTPUT_REVERSE, * UBIDI_REMOVE_BIDI_CONTROLS, the visual position returned may not * be correct. It is advised to use, when possible, reordering options * such as UBIDI_OPTION_INSERT_MARKS and UBIDI_OPTION_REMOVE_CONTROLS. *

* Note that in right-to-left runs, this mapping places * second surrogates before first ones (which is generally a bad idea) * and combining characters before base characters. * Use of ubidi_writeReordered(), optionally with the * #UBIDI_KEEP_BASE_COMBINING option can be considered instead * of using the mapping, in order to avoid these issues. * * @param pBiDi is the paragraph or line UBiDi object. * * @param logicalIndex is the index of a character in the text. * * @param pErrorCode must be a valid pointer to an error code value. * * @return The visual position of this character. * * @see ubidi_getLogicalMap * @see ubidi_getLogicalIndex * @see ubidi_getProcessedLength * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode); /** * Get the logical text position from a visual position. * If such a mapping is used many times on the same * UBiDi object, then calling * ubidi_getVisualMap() is more efficient.

* * The value returned may be #UBIDI_MAP_NOWHERE if there is no * logical position because the corresponding text character is a Bidi mark * inserted in the output by option #UBIDI_OPTION_INSERT_MARKS. *

* This is the inverse function to ubidi_getVisualIndex(). *

* When the visual output is altered by using options of * ubidi_writeReordered() such as UBIDI_INSERT_LRM_FOR_NUMERIC, * UBIDI_KEEP_BASE_COMBINING, UBIDI_OUTPUT_REVERSE, * UBIDI_REMOVE_BIDI_CONTROLS, the logical position returned may not * be correct. It is advised to use, when possible, reordering options * such as UBIDI_OPTION_INSERT_MARKS and UBIDI_OPTION_REMOVE_CONTROLS. * * @param pBiDi is the paragraph or line UBiDi object. * * @param visualIndex is the visual position of a character. * * @param pErrorCode must be a valid pointer to an error code value. * * @return The index of this character in the text. * * @see ubidi_getVisualMap * @see ubidi_getVisualIndex * @see ubidi_getResultLength * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode); /** * Get a logical-to-visual index map (array) for the characters in the UBiDi * (paragraph or line) object. *

* Some values in the map may be #UBIDI_MAP_NOWHERE if the * corresponding text characters are Bidi controls removed from the visual * output by the option #UBIDI_OPTION_REMOVE_CONTROLS. *

* When the visual output is altered by using options of * ubidi_writeReordered() such as UBIDI_INSERT_LRM_FOR_NUMERIC, * UBIDI_KEEP_BASE_COMBINING, UBIDI_OUTPUT_REVERSE, * UBIDI_REMOVE_BIDI_CONTROLS, the visual positions returned may not * be correct. It is advised to use, when possible, reordering options * such as UBIDI_OPTION_INSERT_MARKS and UBIDI_OPTION_REMOVE_CONTROLS. *

* Note that in right-to-left runs, this mapping places * second surrogates before first ones (which is generally a bad idea) * and combining characters before base characters. * Use of ubidi_writeReordered(), optionally with the * #UBIDI_KEEP_BASE_COMBINING option can be considered instead * of using the mapping, in order to avoid these issues. * * @param pBiDi is the paragraph or line UBiDi object. * * @param indexMap is a pointer to an array of ubidi_getProcessedLength() * indexes which will reflect the reordering of the characters. * If option #UBIDI_OPTION_INSERT_MARKS is set, the number * of elements allocated in indexMap must be no less than * ubidi_getResultLength(). * The array does not need to be initialized.

* The index map will result in indexMap[logicalIndex]==visualIndex. * * @param pErrorCode must be a valid pointer to an error code value. * * @see ubidi_getVisualMap * @see ubidi_getVisualIndex * @see ubidi_getProcessedLength * @see ubidi_getResultLength * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode); /** * Get a visual-to-logical index map (array) for the characters in the UBiDi * (paragraph or line) object. *

* Some values in the map may be #UBIDI_MAP_NOWHERE if the * corresponding text characters are Bidi marks inserted in the visual output * by the option #UBIDI_OPTION_INSERT_MARKS. *

* When the visual output is altered by using options of * ubidi_writeReordered() such as UBIDI_INSERT_LRM_FOR_NUMERIC, * UBIDI_KEEP_BASE_COMBINING, UBIDI_OUTPUT_REVERSE, * UBIDI_REMOVE_BIDI_CONTROLS, the logical positions returned may not * be correct. It is advised to use, when possible, reordering options * such as UBIDI_OPTION_INSERT_MARKS and UBIDI_OPTION_REMOVE_CONTROLS. * * @param pBiDi is the paragraph or line UBiDi object. * * @param indexMap is a pointer to an array of ubidi_getResultLength() * indexes which will reflect the reordering of the characters. * If option #UBIDI_OPTION_REMOVE_CONTROLS is set, the number * of elements allocated in indexMap must be no less than * ubidi_getProcessedLength(). * The array does not need to be initialized.

* The index map will result in indexMap[visualIndex]==logicalIndex. * * @param pErrorCode must be a valid pointer to an error code value. * * @see ubidi_getLogicalMap * @see ubidi_getLogicalIndex * @see ubidi_getProcessedLength * @see ubidi_getResultLength * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode); /** * This is a convenience function that does not use a UBiDi object. * It is intended to be used for when an application has determined the levels * of objects (character sequences) and just needs to have them reordered (L2). * This is equivalent to using ubidi_getLogicalMap() on a * UBiDi object. * * @param levels is an array with length levels that have been determined by * the application. * * @param length is the number of levels in the array, or, semantically, * the number of objects to be reordered. * It must be length>0. * * @param indexMap is a pointer to an array of length * indexes which will reflect the reordering of the characters. * The array does not need to be initialized.

* The index map will result in indexMap[logicalIndex]==visualIndex. * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap); /** * This is a convenience function that does not use a UBiDi object. * It is intended to be used for when an application has determined the levels * of objects (character sequences) and just needs to have them reordered (L2). * This is equivalent to using ubidi_getVisualMap() on a * UBiDi object. * * @param levels is an array with length levels that have been determined by * the application. * * @param length is the number of levels in the array, or, semantically, * the number of objects to be reordered. * It must be length>0. * * @param indexMap is a pointer to an array of length * indexes which will reflect the reordering of the characters. * The array does not need to be initialized.

* The index map will result in indexMap[visualIndex]==logicalIndex. * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap); /** * Invert an index map. * The index mapping of the first map is inverted and written to * the second one. * * @param srcMap is an array with length elements * which defines the original mapping from a source array containing * length elements to a destination array. * Some elements of the source array may have no mapping in the * destination array. In that case, their value will be * the special value UBIDI_MAP_NOWHERE. * All elements must be >=0 or equal to UBIDI_MAP_NOWHERE. * Some elements may have a value >= length, if the * destination array has more elements than the source array. * There must be no duplicate indexes (two or more elements with the * same value except UBIDI_MAP_NOWHERE). * * @param destMap is an array with a number of elements equal to 1 + the highest * value in srcMap. * destMap will be filled with the inverse mapping. * If element with index i in srcMap has a value k different * from UBIDI_MAP_NOWHERE, this means that element i of * the source array maps to element k in the destination array. * The inverse map will have value i in its k-th element. * For all elements of the destination array which do not map to * an element in the source array, the corresponding element in the * inverse map will have a value equal to UBIDI_MAP_NOWHERE. * * @param length is the length of each array. * @see UBIDI_MAP_NOWHERE * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length); /** option flags for ubidi_writeReordered() */ /** * option bit for ubidi_writeReordered(): * keep combining characters after their base characters in RTL runs * * @see ubidi_writeReordered * @stable ICU 2.0 */ #define UBIDI_KEEP_BASE_COMBINING 1 /** * option bit for ubidi_writeReordered(): * replace characters with the "mirrored" property in RTL runs * by their mirror-image mappings * * @see ubidi_writeReordered * @stable ICU 2.0 */ #define UBIDI_DO_MIRRORING 2 /** * option bit for ubidi_writeReordered(): * surround the run with LRMs if necessary; * this is part of the approximate "inverse Bidi" algorithm * *

This option does not imply corresponding adjustment of the index * mappings.

* * @see ubidi_setInverse * @see ubidi_writeReordered * @stable ICU 2.0 */ #define UBIDI_INSERT_LRM_FOR_NUMERIC 4 /** * option bit for ubidi_writeReordered(): * remove Bidi control characters * (this does not affect #UBIDI_INSERT_LRM_FOR_NUMERIC) * *

This option does not imply corresponding adjustment of the index * mappings.

* * @see ubidi_writeReordered * @stable ICU 2.0 */ #define UBIDI_REMOVE_BIDI_CONTROLS 8 /** * option bit for ubidi_writeReordered(): * write the output in reverse order * *

This has the same effect as calling ubidi_writeReordered() * first without this option, and then calling * ubidi_writeReverse() without mirroring. * Doing this in the same step is faster and avoids a temporary buffer. * An example for using this option is output to a character terminal that * is designed for RTL scripts and stores text in reverse order.

* * @see ubidi_writeReordered * @stable ICU 2.0 */ #define UBIDI_OUTPUT_REVERSE 16 /** * Get the length of the source text processed by the last call to * ubidi_setPara(). This length may be different from the length * of the source text if option #UBIDI_OPTION_STREAMING * has been set. *
* Note that whenever the length of the text affects the execution or the * result of a function, it is the processed length which must be considered, * except for ubidi_setPara (which receives unprocessed source * text) and ubidi_getLength (which returns the original length * of the source text).
* In particular, the processed length is the one to consider in the following * cases: *
    *
  • maximum value of the limit argument of * ubidi_setLine
  • *
  • maximum value of the charIndex argument of * ubidi_getParagraph
  • *
  • maximum value of the charIndex argument of * ubidi_getLevelAt
  • *
  • number of elements in the array returned by ubidi_getLevels
  • *
  • maximum value of the logicalStart argument of * ubidi_getLogicalRun
  • *
  • maximum value of the logicalIndex argument of * ubidi_getVisualIndex
  • *
  • number of elements filled in the *indexMap argument of * ubidi_getLogicalMap
  • *
  • length of text processed by ubidi_writeReordered
  • *
* * @param pBiDi is the paragraph UBiDi object. * * @return The length of the part of the source text processed by * the last call to ubidi_setPara. * @see ubidi_setPara * @see UBIDI_OPTION_STREAMING * @stable ICU 3.6 */ U_STABLE int32_t U_EXPORT2 ubidi_getProcessedLength(const UBiDi *pBiDi); /** * Get the length of the reordered text resulting from the last call to * ubidi_setPara(). This length may be different from the length * of the source text if option #UBIDI_OPTION_INSERT_MARKS * or option #UBIDI_OPTION_REMOVE_CONTROLS has been set. *
* This resulting length is the one to consider in the following cases: *
    *
  • maximum value of the visualIndex argument of * ubidi_getLogicalIndex
  • *
  • number of elements of the *indexMap argument of * ubidi_getVisualMap
  • *
* Note that this length stays identical to the source text length if * Bidi marks are inserted or removed using option bits of * ubidi_writeReordered, or if option * #UBIDI_REORDER_INVERSE_NUMBERS_AS_L has been set. * * @param pBiDi is the paragraph UBiDi object. * * @return The length of the reordered text resulting from * the last call to ubidi_setPara. * @see ubidi_setPara * @see UBIDI_OPTION_INSERT_MARKS * @see UBIDI_OPTION_REMOVE_CONTROLS * @stable ICU 3.6 */ U_STABLE int32_t U_EXPORT2 ubidi_getResultLength(const UBiDi *pBiDi); U_CDECL_BEGIN /** * value returned by UBiDiClassCallback callbacks when * there is no need to override the standard Bidi class for a given code point. * @see UBiDiClassCallback * @stable ICU 3.6 */ #define U_BIDI_CLASS_DEFAULT U_CHAR_DIRECTION_COUNT /** * Callback type declaration for overriding default Bidi class values with * custom ones. *

Usually, the function pointer will be propagated to a UBiDi * object by calling the ubidi_setClassCallback() function; * then the callback will be invoked by the UBA implementation any time the * class of a character is to be determined.

* * @param context is a pointer to the callback private data. * * @param c is the code point to get a Bidi class for. * * @return The directional property / Bidi class for the given code point * c if the default class has been overridden, or * #U_BIDI_CLASS_DEFAULT if the standard Bidi class value * for c is to be used. * @see ubidi_setClassCallback * @see ubidi_getClassCallback * @stable ICU 3.6 */ typedef UCharDirection U_CALLCONV UBiDiClassCallback(const void *context, UChar32 c); U_CDECL_END /** * Retrieve the Bidi class for a given code point. *

If a #UBiDiClassCallback callback is defined and returns a * value other than #U_BIDI_CLASS_DEFAULT, that value is used; * otherwise the default class determination mechanism is invoked.

* * @param pBiDi is the paragraph UBiDi object. * * @param c is the code point whose Bidi class must be retrieved. * * @return The Bidi class for character c based * on the given pBiDi instance. * @see UBiDiClassCallback * @stable ICU 3.6 */ U_STABLE UCharDirection U_EXPORT2 ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c); /** * Set the callback function and callback data used by the UBA * implementation for Bidi class determination. *

This may be useful for assigning Bidi classes to PUA characters, or * for special application needs. For instance, an application may want to * handle all spaces like L or R characters (according to the base direction) * when creating the visual ordering of logical lines which are part of a report * organized in columns: there should not be interaction between adjacent * cells.

* * @param pBiDi is the paragraph UBiDi object. * * @param newFn is the new callback function pointer. * * @param newContext is the new callback context pointer. This can be NULL. * * @param oldFn fillin: Returns the old callback function pointer. This can be * NULL. * * @param oldContext fillin: Returns the old callback's context. This can be * NULL. * * @param pErrorCode must be a valid pointer to an error code value. * * @see ubidi_getClassCallback * @stable ICU 3.6 */ U_STABLE void U_EXPORT2 ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn, const void *newContext, UBiDiClassCallback **oldFn, const void **oldContext, UErrorCode *pErrorCode); /** * Get the current callback function used for Bidi class determination. * * @param pBiDi is the paragraph UBiDi object. * * @param fn fillin: Returns the callback function pointer. * * @param context fillin: Returns the callback's private context. * * @see ubidi_setClassCallback * @stable ICU 3.6 */ U_STABLE void U_EXPORT2 ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context); /** * Take a UBiDi object containing the reordering * information for a piece of text (one or more paragraphs) set by * ubidi_setPara() or for a line of text set by * ubidi_setLine() and write a reordered string to the * destination buffer. * * This function preserves the integrity of characters with multiple * code units and (optionally) combining characters. * Characters in RTL runs can be replaced by mirror-image characters * in the destination buffer. Note that "real" mirroring has * to be done in a rendering engine by glyph selection * and that for many "mirrored" characters there are no * Unicode characters as mirror-image equivalents. * There are also options to insert or remove Bidi control * characters; see the description of the destSize * and options parameters and of the option bit flags. * * @param pBiDi A pointer to a UBiDi object that * is set by ubidi_setPara() or * ubidi_setLine() and contains the reordering * information for the text that it was defined for, * as well as a pointer to that text.

* The text was aliased (only the pointer was stored * without copying the contents) and must not have been modified * since the ubidi_setPara() call. * * @param dest A pointer to where the reordered text is to be copied. * The source text and dest[destSize] * must not overlap. * * @param destSize The size of the dest buffer, * in number of UChars. * If the UBIDI_INSERT_LRM_FOR_NUMERIC * option is set, then the destination length could be * as large as * ubidi_getLength(pBiDi)+2*ubidi_countRuns(pBiDi). * If the UBIDI_REMOVE_BIDI_CONTROLS option * is set, then the destination length may be less than * ubidi_getLength(pBiDi). * If none of these options is set, then the destination length * will be exactly ubidi_getProcessedLength(pBiDi). * * @param options A bit set of options for the reordering that control * how the reordered text is written. * The options include mirroring the characters on a code * point basis and inserting LRM characters, which is used * especially for transforming visually stored text * to logically stored text (although this is still an * imperfect implementation of an "inverse Bidi" algorithm * because it uses the "forward Bidi" algorithm at its core). * The available options are: * #UBIDI_DO_MIRRORING, * #UBIDI_INSERT_LRM_FOR_NUMERIC, * #UBIDI_KEEP_BASE_COMBINING, * #UBIDI_OUTPUT_REVERSE, * #UBIDI_REMOVE_BIDI_CONTROLS * * @param pErrorCode must be a valid pointer to an error code value. * * @return The length of the output string. * * @see ubidi_getProcessedLength * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ubidi_writeReordered(UBiDi *pBiDi, UChar *dest, int32_t destSize, uint16_t options, UErrorCode *pErrorCode); /** * Reverse a Right-To-Left run of Unicode text. * * This function preserves the integrity of characters with multiple * code units and (optionally) combining characters. * Characters can be replaced by mirror-image characters * in the destination buffer. Note that "real" mirroring has * to be done in a rendering engine by glyph selection * and that for many "mirrored" characters there are no * Unicode characters as mirror-image equivalents. * There are also options to insert or remove Bidi control * characters. * * This function is the implementation for reversing RTL runs as part * of ubidi_writeReordered(). For detailed descriptions * of the parameters, see there. * Since no Bidi controls are inserted here, the output string length * will never exceed srcLength. * * @see ubidi_writeReordered * * @param src A pointer to the RTL run text. * * @param srcLength The length of the RTL run. * * @param dest A pointer to where the reordered text is to be copied. * src[srcLength] and dest[destSize] * must not overlap. * * @param destSize The size of the dest buffer, * in number of UChars. * If the UBIDI_REMOVE_BIDI_CONTROLS option * is set, then the destination length may be less than * srcLength. * If this option is not set, then the destination length * will be exactly srcLength. * * @param options A bit set of options for the reordering that control * how the reordered text is written. * See the options parameter in ubidi_writeReordered(). * * @param pErrorCode must be a valid pointer to an error code value. * * @return The length of the output string. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ubidi_writeReverse(const UChar *src, int32_t srcLength, UChar *dest, int32_t destSize, uint16_t options, UErrorCode *pErrorCode); /*#define BIDI_SAMPLE_CODE*/ /*@}*/ #endif android-audiosystem-1.8+13.10.20130807/include/unicode/ucnv_err.h0000644000015700001700000005157712200324306024756 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (C) 1999-2009, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * * * ucnv_err.h: */ /** * \file * \brief C UConverter predefined error callbacks * *

Error Behaviour Functions

* Defines some error behaviour functions called by ucnv_{from,to}Unicode * These are provided as part of ICU and many are stable, but they * can also be considered only as an example of what can be done with * callbacks. You may of course write your own. * * If you want to write your own, you may also find the functions from * ucnv_cb.h useful when writing your own callbacks. * * These functions, although public, should NEVER be called directly. * They should be used as parameters to the ucnv_setFromUCallback * and ucnv_setToUCallback functions, to set the behaviour of a converter * when it encounters ILLEGAL/UNMAPPED/INVALID sequences. * * usage example: 'STOP' doesn't need any context, but newContext * could be set to something other than 'NULL' if needed. The available * contexts in this header can modify the default behavior of the callback. * * \code * UErrorCode err = U_ZERO_ERROR; * UConverter *myConverter = ucnv_open("ibm-949", &err); * const void *oldContext; * UConverterFromUCallback oldAction; * * * if (U_SUCCESS(err)) * { * ucnv_setFromUCallBack(myConverter, * UCNV_FROM_U_CALLBACK_STOP, * NULL, * &oldAction, * &oldContext, * &status); * } * \endcode * * The code above tells "myConverter" to stop when it encounters an * ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from * Unicode -> Codepage. The behavior from Codepage to Unicode is not changed, * and ucnv_setToUCallBack would need to be called in order to change * that behavior too. * * Here is an example with a context: * * \code * UErrorCode err = U_ZERO_ERROR; * UConverter *myConverter = ucnv_open("ibm-949", &err); * const void *oldContext; * UConverterFromUCallback oldAction; * * * if (U_SUCCESS(err)) * { * ucnv_setToUCallBack(myConverter, * UCNV_TO_U_CALLBACK_SUBSTITUTE, * UCNV_SUB_STOP_ON_ILLEGAL, * &oldAction, * &oldContext, * &status); * } * \endcode * * The code above tells "myConverter" to stop when it encounters an * ILLEGAL/TRUNCATED/INVALID sequences when it is used to convert from * Codepage -> Unicode. Any unmapped and legal characters will be * substituted to be the default substitution character. */ #ifndef UCNV_ERR_H #define UCNV_ERR_H #include "unicode/utypes.h" #if !UCONFIG_NO_CONVERSION /** Forward declaring the UConverter structure. @stable ICU 2.0 */ struct UConverter; /** @stable ICU 2.0 */ typedef struct UConverter UConverter; /** * FROM_U, TO_U context options for sub callback * @stable ICU 2.0 */ #define UCNV_SUB_STOP_ON_ILLEGAL "i" /** * FROM_U, TO_U context options for skip callback * @stable ICU 2.0 */ #define UCNV_SKIP_STOP_ON_ILLEGAL "i" /** * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to ICU (%UXXXX) * @stable ICU 2.0 */ #define UCNV_ESCAPE_ICU NULL /** * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to JAVA (\\uXXXX) * @stable ICU 2.0 */ #define UCNV_ESCAPE_JAVA "J" /** * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to C (\\uXXXX \\UXXXXXXXX) * TO_U_CALLBACK_ESCAPE option to escape the character value accoding to C (\\xXXXX) * @stable ICU 2.0 */ #define UCNV_ESCAPE_C "C" /** * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Decimal escape \htmlonly(&#DDDD;)\endhtmlonly * TO_U_CALLBACK_ESCAPE context option to escape the character value accoding to XML Decimal escape \htmlonly(&#DDDD;)\endhtmlonly * @stable ICU 2.0 */ #define UCNV_ESCAPE_XML_DEC "D" /** * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to XML Hex escape \htmlonly(&#xXXXX;)\endhtmlonly * TO_U_CALLBACK_ESCAPE context option to escape the character value accoding to XML Hex escape \htmlonly(&#xXXXX;)\endhtmlonly * @stable ICU 2.0 */ #define UCNV_ESCAPE_XML_HEX "X" /** * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to Unicode (U+XXXXX) * @stable ICU 2.0 */ #define UCNV_ESCAPE_UNICODE "U" /** * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to CSS2 conventions (\\HH..H, that is, * a backslash, 1..6 hex digits, and a space) * @stable ICU 4.0 */ #define UCNV_ESCAPE_CSS2 "S" /** * The process condition code to be used with the callbacks. * Codes which are greater than UCNV_IRREGULAR should be * passed on to any chained callbacks. * @stable ICU 2.0 */ typedef enum { UCNV_UNASSIGNED = 0, /**< The code point is unassigned. The error code U_INVALID_CHAR_FOUND will be set. */ UCNV_ILLEGAL = 1, /**< The code point is illegal. For example, \\x81\\x2E is illegal in SJIS because \\x2E is not a valid trail byte for the \\x81 lead byte. Also, starting with Unicode 3.0.1, non-shortest byte sequences in UTF-8 (like \\xC1\\xA1 instead of \\x61 for U+0061) are also illegal, not just irregular. The error code U_ILLEGAL_CHAR_FOUND will be set. */ UCNV_IRREGULAR = 2, /**< The codepoint is not a regular sequence in the encoding. For example, \\xED\\xA0\\x80..\\xED\\xBF\\xBF are irregular UTF-8 byte sequences for single surrogate code points. The error code U_INVALID_CHAR_FOUND will be set. */ UCNV_RESET = 3, /**< The callback is called with this reason when a 'reset' has occured. Callback should reset all state. */ UCNV_CLOSE = 4, /**< Called when the converter is closed. The callback should release any allocated memory.*/ UCNV_CLONE = 5 /**< Called when ucnv_safeClone() is called on the converter. the pointer available as the 'context' is an alias to the original converters' context pointer. If the context must be owned by the new converter, the callback must clone the data and call ucnv_setFromUCallback (or setToUCallback) with the correct pointer. @stable ICU 2.2 */ } UConverterCallbackReason; /** * The structure for the fromUnicode callback function parameter. * @stable ICU 2.0 */ typedef struct { uint16_t size; /**< The size of this struct. @stable ICU 2.0 */ UBool flush; /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0 */ UConverter *converter; /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */ const UChar *source; /**< Pointer to the source source buffer. @stable ICU 2.0 */ const UChar *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */ char *target; /**< Pointer to the target buffer. @stable ICU 2.0 */ const char *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */ int32_t *offsets; /**< Pointer to the buffer that recieves the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */ } UConverterFromUnicodeArgs; /** * The structure for the toUnicode callback function parameter. * @stable ICU 2.0 */ typedef struct { uint16_t size; /**< The size of this struct @stable ICU 2.0 */ UBool flush; /**< The internal state of converter will be reset and data flushed if set to TRUE. @stable ICU 2.0 */ UConverter *converter; /**< Pointer to the converter that is opened and to which this struct is passed as an argument. @stable ICU 2.0 */ const char *source; /**< Pointer to the source source buffer. @stable ICU 2.0 */ const char *sourceLimit; /**< Pointer to the limit (end + 1) of source buffer. @stable ICU 2.0 */ UChar *target; /**< Pointer to the target buffer. @stable ICU 2.0 */ const UChar *targetLimit; /**< Pointer to the limit (end + 1) of target buffer. @stable ICU 2.0 */ int32_t *offsets; /**< Pointer to the buffer that recieves the offsets. *offset = blah ; offset++;. @stable ICU 2.0 */ } UConverterToUnicodeArgs; /** * DO NOT CALL THIS FUNCTION DIRECTLY! * This From Unicode callback STOPS at the ILLEGAL_SEQUENCE, * returning the error code back to the caller immediately. * * @param context Pointer to the callback's private data * @param fromUArgs Information about the conversion in progress * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence * @param length Size (in bytes) of the concerned codepage sequence * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. * @param reason Defines the reason the callback was invoked * @param err This should always be set to a failure status prior to calling. * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_STOP ( const void *context, UConverterFromUnicodeArgs *fromUArgs, const UChar* codeUnits, int32_t length, UChar32 codePoint, UConverterCallbackReason reason, UErrorCode * err); /** * DO NOT CALL THIS FUNCTION DIRECTLY! * This To Unicode callback STOPS at the ILLEGAL_SEQUENCE, * returning the error code back to the caller immediately. * * @param context Pointer to the callback's private data * @param toUArgs Information about the conversion in progress * @param codeUnits Points to 'length' bytes of the concerned codepage sequence * @param length Size (in bytes) of the concerned codepage sequence * @param reason Defines the reason the callback was invoked * @param err This should always be set to a failure status prior to calling. * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP ( const void *context, UConverterToUnicodeArgs *toUArgs, const char* codeUnits, int32_t length, UConverterCallbackReason reason, UErrorCode * err); /** * DO NOT CALL THIS FUNCTION DIRECTLY! * This From Unicode callback skips any ILLEGAL_SEQUENCE, or * skips only UNASSINGED_SEQUENCE depending on the context parameter * simply ignoring those characters. * * @param context The function currently recognizes the callback options: * UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, * returning the error code back to the caller immediately. * NULL: Skips any ILLEGAL_SEQUENCE * @param fromUArgs Information about the conversion in progress * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence * @param length Size (in bytes) of the concerned codepage sequence * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. * @param reason Defines the reason the callback was invoked * @param err Return value will be set to success if the callback was handled, * otherwise this value will be set to a failure status. * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP ( const void *context, UConverterFromUnicodeArgs *fromUArgs, const UChar* codeUnits, int32_t length, UChar32 codePoint, UConverterCallbackReason reason, UErrorCode * err); /** * DO NOT CALL THIS FUNCTION DIRECTLY! * This From Unicode callback will Substitute the ILLEGAL SEQUENCE, or * UNASSIGNED_SEQUENCE depending on context parameter, with the * current substitution string for the converter. This is the default * callback. * * @param context The function currently recognizes the callback options: * UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, * returning the error code back to the caller immediately. * NULL: Substitutes any ILLEGAL_SEQUENCE * @param fromUArgs Information about the conversion in progress * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence * @param length Size (in bytes) of the concerned codepage sequence * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. * @param reason Defines the reason the callback was invoked * @param err Return value will be set to success if the callback was handled, * otherwise this value will be set to a failure status. * @see ucnv_setSubstChars * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE ( const void *context, UConverterFromUnicodeArgs *fromUArgs, const UChar* codeUnits, int32_t length, UChar32 codePoint, UConverterCallbackReason reason, UErrorCode * err); /** * DO NOT CALL THIS FUNCTION DIRECTLY! * This From Unicode callback will Substitute the ILLEGAL SEQUENCE with the * hexadecimal representation of the illegal codepoints * * @param context The function currently recognizes the callback options: *
    *
  • UCNV_ESCAPE_ICU: Substitues the ILLEGAL SEQUENCE with the hexadecimal * representation in the format %UXXXX, e.g. "%uFFFE%u00AC%uC8FE"). * In the Event the converter doesn't support the characters {%,U}[A-F][0-9], * it will substitute the illegal sequence with the substitution characters. * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as * %UD84D%UDC56
  • *
  • UCNV_ESCAPE_JAVA: Substitues the ILLEGAL SEQUENCE with the hexadecimal * representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE"). * In the Event the converter doesn't support the characters {\,u}[A-F][0-9], * it will substitute the illegal sequence with the substitution characters. * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as * \\uD84D\\uDC56
  • *
  • UCNV_ESCAPE_C: Substitues the ILLEGAL SEQUENCE with the hexadecimal * representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE"). * In the Event the converter doesn't support the characters {\,u,U}[A-F][0-9], * it will substitute the illegal sequence with the substitution characters. * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as * \\U00023456
  • *
  • UCNV_ESCAPE_XML_DEC: Substitues the ILLEGAL SEQUENCE with the decimal * representation in the format \htmlonly&#DDDDDDDD;, e.g. "&#65534;&#172;&#51454;")\endhtmlonly. * In the Event the converter doesn't support the characters {&,#}[0-9], * it will substitute the illegal sequence with the substitution characters. * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as * &#144470; and Zero padding is ignored.
  • *
  • UCNV_ESCAPE_XML_HEX:Substitues the ILLEGAL SEQUENCE with the decimal * representation in the format \htmlonly&#xXXXX; e.g. "&#xFFFE;&#x00AC;&#xC8FE;")\endhtmlonly. * In the Event the converter doesn't support the characters {&,#,x}[0-9], * it will substitute the illegal sequence with the substitution characters. * Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as * \htmlonly&#x23456;\endhtmlonly
  • *
* @param fromUArgs Information about the conversion in progress * @param codeUnits Points to 'length' UChars of the concerned Unicode sequence * @param length Size (in bytes) of the concerned codepage sequence * @param codePoint Single UChar32 (UTF-32) containing the concerend Unicode codepoint. * @param reason Defines the reason the callback was invoked * @param err Return value will be set to success if the callback was handled, * otherwise this value will be set to a failure status. * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE ( const void *context, UConverterFromUnicodeArgs *fromUArgs, const UChar* codeUnits, int32_t length, UChar32 codePoint, UConverterCallbackReason reason, UErrorCode * err); /** * DO NOT CALL THIS FUNCTION DIRECTLY! * This To Unicode callback skips any ILLEGAL_SEQUENCE, or * skips only UNASSINGED_SEQUENCE depending on the context parameter * simply ignoring those characters. * * @param context The function currently recognizes the callback options: * UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, * returning the error code back to the caller immediately. * NULL: Skips any ILLEGAL_SEQUENCE * @param toUArgs Information about the conversion in progress * @param codeUnits Points to 'length' bytes of the concerned codepage sequence * @param length Size (in bytes) of the concerned codepage sequence * @param reason Defines the reason the callback was invoked * @param err Return value will be set to success if the callback was handled, * otherwise this value will be set to a failure status. * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP ( const void *context, UConverterToUnicodeArgs *toUArgs, const char* codeUnits, int32_t length, UConverterCallbackReason reason, UErrorCode * err); /** * DO NOT CALL THIS FUNCTION DIRECTLY! * This To Unicode callback will Substitute the ILLEGAL SEQUENCE,or * UNASSIGNED_SEQUENCE depending on context parameter, with the * Unicode substitution character, U+FFFD. * * @param context The function currently recognizes the callback options: * UCNV_SUB_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE, * returning the error code back to the caller immediately. * NULL: Substitutes any ILLEGAL_SEQUENCE * @param toUArgs Information about the conversion in progress * @param codeUnits Points to 'length' bytes of the concerned codepage sequence * @param length Size (in bytes) of the concerned codepage sequence * @param reason Defines the reason the callback was invoked * @param err Return value will be set to success if the callback was handled, * otherwise this value will be set to a failure status. * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SUBSTITUTE ( const void *context, UConverterToUnicodeArgs *toUArgs, const char* codeUnits, int32_t length, UConverterCallbackReason reason, UErrorCode * err); /** * DO NOT CALL THIS FUNCTION DIRECTLY! * This To Unicode callback will Substitute the ILLEGAL SEQUENCE with the * hexadecimal representation of the illegal bytes * (in the format %XNN, e.g. "%XFF%X0A%XC8%X03"). * * @param context This function currently recognizes the callback options: * UCNV_ESCAPE_ICU, UCNV_ESCAPE_JAVA, UCNV_ESCAPE_C, UCNV_ESCAPE_XML_DEC, * UCNV_ESCAPE_XML_HEX and UCNV_ESCAPE_UNICODE. * @param toUArgs Information about the conversion in progress * @param codeUnits Points to 'length' bytes of the concerned codepage sequence * @param length Size (in bytes) of the concerned codepage sequence * @param reason Defines the reason the callback was invoked * @param err Return value will be set to success if the callback was handled, * otherwise this value will be set to a failure status. * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_ESCAPE ( const void *context, UConverterToUnicodeArgs *toUArgs, const char* codeUnits, int32_t length, UConverterCallbackReason reason, UErrorCode * err); #endif #endif /*UCNV_ERR_H*/ android-audiosystem-1.8+13.10.20130807/include/unicode/udraft.h0000644000015700001700000001255212200324306024406 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * Copyright (C) 2004-2010, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* * * file name: udraft.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * Created by: genheaders.pl, a perl script written by Ram Viswanadha * * Contains data for commenting out APIs. * Gets included by umachine.h * * THIS FILE IS MACHINE-GENERATED, DON'T PLAY WITH IT IF YOU DON'T KNOW WHAT * YOU ARE DOING, OTHERWISE VERY BAD THINGS WILL HAPPEN! */ #ifndef UDRAFT_H #define UDRAFT_H #ifdef U_HIDE_DRAFT_API # if U_DISABLE_RENAMING # define ubidi_getBaseDirection ubidi_getBaseDirection_DRAFT_API_DO_NOT_USE # define uidna_close uidna_close_DRAFT_API_DO_NOT_USE # define uidna_labelToASCII uidna_labelToASCII_DRAFT_API_DO_NOT_USE # define uidna_labelToASCII_UTF8 uidna_labelToASCII_UTF8_DRAFT_API_DO_NOT_USE # define uidna_labelToUnicode uidna_labelToUnicode_DRAFT_API_DO_NOT_USE # define uidna_labelToUnicodeUTF8 uidna_labelToUnicodeUTF8_DRAFT_API_DO_NOT_USE # define uidna_nameToASCII uidna_nameToASCII_DRAFT_API_DO_NOT_USE # define uidna_nameToASCII_UTF8 uidna_nameToASCII_UTF8_DRAFT_API_DO_NOT_USE # define uidna_nameToUnicode uidna_nameToUnicode_DRAFT_API_DO_NOT_USE # define uidna_nameToUnicodeUTF8 uidna_nameToUnicodeUTF8_DRAFT_API_DO_NOT_USE # define uidna_openUTS46 uidna_openUTS46_DRAFT_API_DO_NOT_USE # define uloc_forLanguageTag uloc_forLanguageTag_DRAFT_API_DO_NOT_USE # define uloc_toLanguageTag uloc_toLanguageTag_DRAFT_API_DO_NOT_USE # define unorm2_getDecomposition unorm2_getDecomposition_DRAFT_API_DO_NOT_USE # define uregex_end64 uregex_end64_DRAFT_API_DO_NOT_USE # define uregex_find64 uregex_find64_DRAFT_API_DO_NOT_USE # define uregex_getFindProgressCallback uregex_getFindProgressCallback_DRAFT_API_DO_NOT_USE # define uregex_lookingAt64 uregex_lookingAt64_DRAFT_API_DO_NOT_USE # define uregex_matches64 uregex_matches64_DRAFT_API_DO_NOT_USE # define uregex_patternUText uregex_patternUText_DRAFT_API_DO_NOT_USE # define uregex_regionEnd64 uregex_regionEnd64_DRAFT_API_DO_NOT_USE # define uregex_regionStart64 uregex_regionStart64_DRAFT_API_DO_NOT_USE # define uregex_reset64 uregex_reset64_DRAFT_API_DO_NOT_USE # define uregex_setFindProgressCallback uregex_setFindProgressCallback_DRAFT_API_DO_NOT_USE # define uregex_setRegion64 uregex_setRegion64_DRAFT_API_DO_NOT_USE # define uregex_setRegionAndStart uregex_setRegionAndStart_DRAFT_API_DO_NOT_USE # define uregex_start64 uregex_start64_DRAFT_API_DO_NOT_USE # define uscript_getScriptExtensions uscript_getScriptExtensions_DRAFT_API_DO_NOT_USE # define uscript_hasScript uscript_hasScript_DRAFT_API_DO_NOT_USE # else # define ubidi_getBaseDirection_4_6 ubidi_getBaseDirection_DRAFT_API_DO_NOT_USE # define uidna_close_4_6 uidna_close_DRAFT_API_DO_NOT_USE # define uidna_labelToASCII_4_6 uidna_labelToASCII_DRAFT_API_DO_NOT_USE # define uidna_labelToASCII_UTF8_4_6 uidna_labelToASCII_UTF8_DRAFT_API_DO_NOT_USE # define uidna_labelToUnicodeUTF8_4_6 uidna_labelToUnicodeUTF8_DRAFT_API_DO_NOT_USE # define uidna_labelToUnicode_4_6 uidna_labelToUnicode_DRAFT_API_DO_NOT_USE # define uidna_nameToASCII_4_6 uidna_nameToASCII_DRAFT_API_DO_NOT_USE # define uidna_nameToASCII_UTF8_4_6 uidna_nameToASCII_UTF8_DRAFT_API_DO_NOT_USE # define uidna_nameToUnicodeUTF8_4_6 uidna_nameToUnicodeUTF8_DRAFT_API_DO_NOT_USE # define uidna_nameToUnicode_4_6 uidna_nameToUnicode_DRAFT_API_DO_NOT_USE # define uidna_openUTS46_4_6 uidna_openUTS46_DRAFT_API_DO_NOT_USE # define uloc_forLanguageTag_4_6 uloc_forLanguageTag_DRAFT_API_DO_NOT_USE # define uloc_toLanguageTag_4_6 uloc_toLanguageTag_DRAFT_API_DO_NOT_USE # define unorm2_getDecomposition_4_6 unorm2_getDecomposition_DRAFT_API_DO_NOT_USE # define uregex_end64_4_6 uregex_end64_DRAFT_API_DO_NOT_USE # define uregex_find64_4_6 uregex_find64_DRAFT_API_DO_NOT_USE # define uregex_getFindProgressCallback_4_6 uregex_getFindProgressCallback_DRAFT_API_DO_NOT_USE # define uregex_lookingAt64_4_6 uregex_lookingAt64_DRAFT_API_DO_NOT_USE # define uregex_matches64_4_6 uregex_matches64_DRAFT_API_DO_NOT_USE # define uregex_patternUText_4_6 uregex_patternUText_DRAFT_API_DO_NOT_USE # define uregex_regionEnd64_4_6 uregex_regionEnd64_DRAFT_API_DO_NOT_USE # define uregex_regionStart64_4_6 uregex_regionStart64_DRAFT_API_DO_NOT_USE # define uregex_reset64_4_6 uregex_reset64_DRAFT_API_DO_NOT_USE # define uregex_setFindProgressCallback_4_6 uregex_setFindProgressCallback_DRAFT_API_DO_NOT_USE # define uregex_setRegion64_4_6 uregex_setRegion64_DRAFT_API_DO_NOT_USE # define uregex_setRegionAndStart_4_6 uregex_setRegionAndStart_DRAFT_API_DO_NOT_USE # define uregex_start64_4_6 uregex_start64_DRAFT_API_DO_NOT_USE # define uscript_getScriptExtensions_4_6 uscript_getScriptExtensions_DRAFT_API_DO_NOT_USE # define uscript_hasScript_4_6 uscript_hasScript_DRAFT_API_DO_NOT_USE # endif /* U_DISABLE_RENAMING */ #endif /* U_HIDE_DRAFT_API */ #endif /* UDRAFT_H */ android-audiosystem-1.8+13.10.20130807/include/unicode/utf.h0000644000015700001700000002012212200324306023707 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * * Copyright (C) 1999-2010, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: utf.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 1999sep09 * created by: Markus W. Scherer */ /** * \file * \brief C API: Code point macros * * This file defines macros for checking whether a code point is * a surrogate or a non-character etc. * * The UChar and UChar32 data types for Unicode code units and code points * are defined in umachines.h because they can be machine-dependent. * * utf.h is included by utypes.h and itself includes utf8.h and utf16.h after some * common definitions. Those files define macros for efficiently getting code points * in and out of UTF-8/16 strings. * utf16.h macros have "U16_" prefixes. * utf8.h defines similar macros with "U8_" prefixes for UTF-8 string handling. * * ICU processes 16-bit Unicode strings. * Most of the time, such strings are well-formed UTF-16. * Single, unpaired surrogates must be handled as well, and are treated in ICU * like regular code points where possible. * (Pairs of surrogate code points are indistinguishable from supplementary * code points encoded as pairs of supplementary code units.) * * In fact, almost all Unicode code points in normal text (>99%) * are on the BMP (<=U+ffff) and even <=U+d7ff. * ICU functions handle supplementary code points (U+10000..U+10ffff) * but are optimized for the much more frequently occurring BMP code points. * * utf.h defines UChar to be an unsigned 16-bit integer. If this matches wchar_t, then * UChar is defined to be exactly wchar_t, otherwise uint16_t. * * UChar32 is defined to be a signed 32-bit integer (int32_t), large enough for a 21-bit * Unicode code point (Unicode scalar value, 0..0x10ffff). * Before ICU 2.4, the definition of UChar32 was similarly platform-dependent as * the definition of UChar. For details see the documentation for UChar32 itself. * * utf.h also defines a small number of C macros for single Unicode code points. * These are simple checks for surrogates and non-characters. * For actual Unicode character properties see uchar.h. * * By default, string operations must be done with error checking in case * a string is not well-formed UTF-16. * The macros will detect if a surrogate code unit is unpaired * (lead unit without trail unit or vice versa) and just return the unit itself * as the code point. * (It is an accidental property of Unicode and UTF-16 that all * malformed sequences can be expressed unambiguously with a distinct subrange * of Unicode code points.) * * The regular "safe" macros require that the initial, passed-in string index * is within bounds. They only check the index when they read more than one * code unit. This is usually done with code similar to the following loop: *
while(i
 *
 * When it is safe to assume that text is well-formed UTF-16
 * (does not contain single, unpaired surrogates), then one can use
 * U16_..._UNSAFE macros.
 * These do not check for proper code unit sequences or truncated text and may
 * yield wrong results or even cause a crash if they are used with "malformed"
 * text.
 * In practice, U16_..._UNSAFE macros will produce slightly less code but
 * should not be faster because the processing is only different when a
 * surrogate code unit is detected, which will be rare.
 *
 * Similarly for UTF-8, there are "safe" macros without a suffix,
 * and U8_..._UNSAFE versions.
 * The performance differences are much larger here because UTF-8 provides so
 * many opportunities for malformed sequences.
 * The unsafe UTF-8 macros are entirely implemented inside the macro definitions
 * and are fast, while the safe UTF-8 macros call functions for all but the
 * trivial (ASCII) cases.
 * (ICU 3.6 optimizes U8_NEXT() and U8_APPEND() to handle most other common
 * characters inline as well.)
 *
 * Unlike with UTF-16, malformed sequences cannot be expressed with distinct
 * code point values (0..U+10ffff). They are indicated with negative values instead.
 *
 * For more information see the ICU User Guide Strings chapter
 * (http://icu-project.org/userguide/strings.html).
 *
 * Usage:
 * ICU coding guidelines for if() statements should be followed when using these macros.
 * Compound statements (curly braces {}) must be used  for if-else-while... 
 * bodies and all macro statements should be terminated with semicolon.
 *
 * @stable ICU 2.4
 */

#ifndef __UTF_H__
#define __UTF_H__

#include "unicode/utypes.h"
/* include the utfXX.h after the following definitions */

/* single-code point definitions -------------------------------------------- */

/**
 * This value is intended for sentinel values for APIs that
 * (take or) return single code points (UChar32).
 * It is outside of the Unicode code point range 0..0x10ffff.
 * 
 * For example, a "done" or "error" value in a new API
 * could be indicated with U_SENTINEL.
 *
 * ICU APIs designed before ICU 2.4 usually define service-specific "done"
 * values, mostly 0xffff.
 * Those may need to be distinguished from
 * actual U+ffff text contents by calling functions like
 * CharacterIterator::hasNext() or UnicodeString::length().
 *
 * @return -1
 * @see UChar32
 * @stable ICU 2.4
 */
#define U_SENTINEL (-1)

/**
 * Is this code point a Unicode noncharacter?
 * @param c 32-bit code point
 * @return TRUE or FALSE
 * @stable ICU 2.4
 */
#define U_IS_UNICODE_NONCHAR(c) \
    ((c)>=0xfdd0 && \
     ((uint32_t)(c)<=0xfdef || ((c)&0xfffe)==0xfffe) && \
     (uint32_t)(c)<=0x10ffff)

/**
 * Is c a Unicode code point value (0..U+10ffff)
 * that can be assigned a character?
 *
 * Code points that are not characters include:
 * - single surrogate code points (U+d800..U+dfff, 2048 code points)
 * - the last two code points on each plane (U+__fffe and U+__ffff, 34 code points)
 * - U+fdd0..U+fdef (new with Unicode 3.1, 32 code points)
 * - the highest Unicode code point value is U+10ffff
 *
 * This means that all code points below U+d800 are character code points,
 * and that boundary is tested first for performance.
 *
 * @param c 32-bit code point
 * @return TRUE or FALSE
 * @stable ICU 2.4
 */
#define U_IS_UNICODE_CHAR(c) \
    ((uint32_t)(c)<0xd800 || \
        ((uint32_t)(c)>0xdfff && \
         (uint32_t)(c)<=0x10ffff && \
         !U_IS_UNICODE_NONCHAR(c)))

/**
 * Is this code point a BMP code point (U+0000..U+ffff)?
 * @param c 32-bit code point
 * @return TRUE or FALSE
 * @stable ICU 2.8
 */
#define U_IS_BMP(c) ((uint32_t)(c)<=0xffff)

/**
 * Is this code point a supplementary code point (U+10000..U+10ffff)?
 * @param c 32-bit code point
 * @return TRUE or FALSE
 * @stable ICU 2.8
 */
#define U_IS_SUPPLEMENTARY(c) ((uint32_t)((c)-0x10000)<=0xfffff)
 
/**
 * Is this code point a lead surrogate (U+d800..U+dbff)?
 * @param c 32-bit code point
 * @return TRUE or FALSE
 * @stable ICU 2.4
 */
#define U_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)

/**
 * Is this code point a trail surrogate (U+dc00..U+dfff)?
 * @param c 32-bit code point
 * @return TRUE or FALSE
 * @stable ICU 2.4
 */
#define U_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)

/**
 * Is this code point a surrogate (U+d800..U+dfff)?
 * @param c 32-bit code point
 * @return TRUE or FALSE
 * @stable ICU 2.4
 */
#define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800)

/**
 * Assuming c is a surrogate code point (U_IS_SURROGATE(c)),
 * is it a lead surrogate?
 * @param c 32-bit code point
 * @return TRUE or FALSE
 * @stable ICU 2.4
 */
#define U_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)

/**
 * Assuming c is a surrogate code point (U_IS_SURROGATE(c)),
 * is it a trail surrogate?
 * @param c 32-bit code point
 * @return TRUE or FALSE
 * @stable ICU 4.2
 */
#define U_IS_SURROGATE_TRAIL(c) (((c)&0x400)!=0)

/* include the utfXX.h ------------------------------------------------------ */

#include "unicode/utf8.h"
#include "unicode/utf16.h"

/* utf_old.h contains deprecated, pre-ICU 2.4 definitions */
#include "unicode/utf_old.h"

#endif
android-audiosystem-1.8+13.10.20130807/include/unicode/icudataver.h0000644000015700001700000000355512200324306025253 0ustar  pbuserpbgroup00000000000000/*
******************************************************************************
*
*   Copyright (C) 2009-2010, International Business Machines
*   Corporation and others.  All Rights Reserved.
*
******************************************************************************
*/

#ifndef __ICU_DATA_VER_H__
#define __ICU_DATA_VER_H__

#include "unicode/utypes.h"

/**
 * @internal ICU 4.4
 */
#define U_ICU_VERSION_BUNDLE "icuver"

/**
 * @internal ICU 4.4
 */
#define U_ICU_STD_BUNDLE "icustd"

/**
 * @internal ICU 4.4
 */
#define U_ICU_DATA_KEY "DataVersion"

/**
 * This function loads up icuver and compares the data version to the wired-in U_ICU_DATA_VERSION.
 * If icuver shows something less than U_ICU_DATA_VERSION it returns TRUE, else FALSE. The version
 * found will be returned in the first fillin parameter (if non-null), and *isModified will be set
 * to TRUE if "icustd" is NOT found. Thus, if the data has been repackaged or modified, "icustd"
 * (standard ICU) will be missing, and the function will alert the caller that the data is not standard.
 * 
 * @param dataVersionFillin icuver data version information to be filled in if not-null
 * @param isModifiedFillin if the data is not standard if not-null
 * @param status stores the error code from the calls to resource bundle
 *
 * @return TRUE if U_ICU_DATA_VERSION is newer than icuver, else FALSE
 * 
 * @internal ICU 4.4
 */
U_INTERNAL UBool U_EXPORT2 u_isDataOlder(UVersionInfo dataVersionFillin, UBool *isModifiedFillin, UErrorCode *status);

/**
 * Retrieves the data version from icuver and stores it in dataVersionFillin.
 * 
 * @param dataVersionFillin icuver data version information to be filled in if not-null
 * @param status stores the error code from the calls to resource bundle
 * 
 * @internal ICU 4.4
 */
U_INTERNAL void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status);

#endif
android-audiosystem-1.8+13.10.20130807/include/unicode/icuplug.h0000644000015700001700000002657112200324306024577 0ustar  pbuserpbgroup00000000000000/*
******************************************************************************
*
*   Copyright (C) 2009-2010, International Business Machines
*   Corporation and others.  All Rights Reserved.
*
******************************************************************************
*
*  FILE NAME : icuplug.h
*
*   Date         Name        Description
*   10/29/2009   sl          New.
******************************************************************************
*/

/**
 * \file
 * \brief C API: ICU Plugin API 
 *
 * 

C API: ICU Plugin API

* *

C API allowing run-time loadable modules that extend or modify ICU functionality.

* *

Loading and Configuration

* *

At ICU startup time, the environment variable "ICU_PLUGINS" will be * queried for a directory name. If it is not set, the preprocessor symbol * "DEFAULT_ICU_PLUGINS" will be checked for a default value.

* *

Within the above-named directory, the file "icuplugins##.txt" will be * opened, if present, where ## is the major+minor number of the currently * running ICU (such as, 44 for ICU 4.4, thus icuplugins44.txt)

* *

The configuration file has this format:

* *
    *
  • Hash (#) begins a comment line
  • * *
  • Non-comment lines have two or three components: * LIBRARYNAME ENTRYPOINT [ CONFIGURATION .. ]
  • * *
  • Tabs or spaces separate the three items.
  • * *
  • LIBRARYNAME is the name of a shared library, either a short name if * it is on the loader path, or a full pathname.
  • * *
  • ENTRYPOINT is the short (undecorated) symbol name of the plugin's * entrypoint, as above.
  • * *
  • CONFIGURATION is the entire rest of the line . It's passed as-is to * the plugin.
  • *
* *

An example configuration file is, in its entirety:

* * \code * # this is icuplugins44.txt * testplug.dll myPlugin hello=world * \endcode *

Plugins are categorized as "high" or "low" level. Low level are those * which must be run BEFORE high level plugins, and before any operations * which cause ICU to be 'initialized'. If a plugin is low level but * causes ICU to allocate memory or become initialized, that plugin is said * to cause a 'level change'.

* *

At load time, ICU first queries all plugins to determine their level, * then loads all 'low' plugins first, and then loads all 'high' plugins. * Plugins are otherwise loaded in the order listed in the configuration file.

* *

Implementing a Plugin

* \code * U_CAPI UPlugTokenReturn U_EXPORT2 * myPlugin (UPlugData *plug, UPlugReason reason, UErrorCode *status) { * if(reason==UPLUG_REASON_QUERY) { * uplug_setPlugName(plug, "Simple Plugin"); * uplug_setPlugLevel(plug, UPLUG_LEVEL_HIGH); * } else if(reason==UPLUG_REASON_LOAD) { * ... Set up some ICU things here.... * } else if(reason==UPLUG_REASON_UNLOAD) { * ... unload, clean up ... * } * return UPLUG_TOKEN; * } * \endcode * *

The UPlugData* is an opaque pointer to the plugin-specific data, and is * used in all other API calls.

* *

The API contract is:

*
  1. The plugin MUST always return UPLUG_TOKEN as a return value- to * indicate that it is a valid plugin.
  2. * *
  3. When the 'reason' parameter is set to UPLUG_REASON_QUERY, the * plugin MUST call uplug_setPlugLevel() to indicate whether it is a high * level or low level plugin.
  4. * *
  5. When the 'reason' parameter is UPLUG_REASON_QUERY, the plugin * SHOULD call uplug_setPlugName to indicate a human readable plugin name.
* * * \internal ICU 4.4 Technology Preview */ #ifndef ICUPLUG_H #define ICUPLUG_H #include "unicode/utypes.h" /* === Basic types === */ /** * @{ * Opaque structure passed to/from a plugin. * use the APIs to access it. * @internal ICU 4.4 Technology Preview */ struct UPlugData; typedef struct UPlugData UPlugData; /** @} */ /** * Random Token to identify a valid ICU plugin. Plugins must return this * from the entrypoint. * @internal ICU 4.4 Technology Preview */ #define UPLUG_TOKEN 0x54762486 /** * Max width of names, symbols, and configuration strings * @internal ICU 4.4 Technology Preview */ #define UPLUG_NAME_MAX 100 /** * Return value from a plugin entrypoint. * Must always be set to UPLUG_TOKEN * @see UPLUG_TOKEN * @internal ICU 4.4 Technology Preview */ typedef uint32_t UPlugTokenReturn; /** * Reason code for the entrypoint's call * @internal ICU 4.4 Technology Preview */ typedef enum { UPLUG_REASON_QUERY = 0, /**< The plugin is being queried for info. **/ UPLUG_REASON_LOAD = 1, /**< The plugin is being loaded. **/ UPLUG_REASON_UNLOAD = 2, /**< The plugin is being unloaded. **/ UPLUG_REASON_COUNT /**< count of known reasons **/ } UPlugReason; /** * Level of plugin loading * INITIAL: UNKNOWN * QUERY: INVALID -> { LOW | HIGH } * ERR -> INVALID * @internal ICU 4.4 Technology Preview */ typedef enum { UPLUG_LEVEL_INVALID = 0, /**< The plugin is invalid, hasn't called uplug_setLevel, or can't load. **/ UPLUG_LEVEL_UNKNOWN = 1, /**< The plugin is waiting to be installed. **/ UPLUG_LEVEL_LOW = 2, /**< The plugin must be called before u_init completes **/ UPLUG_LEVEL_HIGH = 3, /**< The plugin can run at any time. **/ UPLUG_LEVEL_COUNT /**< count of known reasons **/ } UPlugLevel; /** * Entrypoint for an ICU plugin. * @param plug the UPlugData handle. * @param status the plugin's extended status code. * @return A valid plugin must return UPLUG_TOKEN * @internal ICU 4.4 Technology Preview */ typedef UPlugTokenReturn (U_EXPORT2 UPlugEntrypoint) ( UPlugData *plug, UPlugReason reason, UErrorCode *status); /* === Needed for Implementing === */ /** * Request that this plugin not be unloaded at cleanup time. * This is appropriate for plugins which cannot be cleaned up. * @see u_cleanup() * @param plug plugin * @param dontUnload set true if this plugin can't be unloaded * @internal ICU 4.4 Technology Preview */ U_CAPI void U_EXPORT2 uplug_setPlugNoUnload(UPlugData *plug, UBool dontUnload); /** * Set the level of this plugin. * @param plug plugin data handle * @param level the level of this plugin * @internal ICU 4.4 Technology Preview */ U_CAPI void U_EXPORT2 uplug_setPlugLevel(UPlugData *plug, UPlugLevel level); /** * Get the level of this plugin. * @param plug plugin data handle * @return the level of this plugin * @internal ICU 4.4 Technology Preview */ U_CAPI UPlugLevel U_EXPORT2 uplug_getPlugLevel(UPlugData *plug); /** * Get the lowest level of plug which can currently load. * For example, if UPLUG_LEVEL_LOW is returned, then low level plugins may load * if UPLUG_LEVEL_HIGH is returned, then only high level plugins may load. * @return the lowest level of plug which can currently load * @internal ICU 4.4 Technology Preview */ U_CAPI UPlugLevel U_EXPORT2 uplug_getCurrentLevel(void); /** * Get plug load status * @return The error code of this plugin's load attempt. * @internal ICU 4.4 Technology Preview */ U_CAPI UErrorCode U_EXPORT2 uplug_getPlugLoadStatus(UPlugData *plug); /** * Set the human-readable name of this plugin. * @param plug plugin data handle * @param name the name of this plugin. The first UPLUG_NAME_MAX characters willi be copied into a new buffer. * @internal ICU 4.4 Technology Preview */ U_CAPI void U_EXPORT2 uplug_setPlugName(UPlugData *plug, const char *name); /** * Get the human-readable name of this plugin. * @param plug plugin data handle * @return the name of this plugin * @internal ICU 4.4 Technology Preview */ U_CAPI const char * U_EXPORT2 uplug_getPlugName(UPlugData *plug); /** * Return the symbol name for this plugin, if known. * @param plug plugin data handle * @return the symbol name, or NULL * @internal ICU 4.4 Technology Preview */ U_CAPI const char * U_EXPORT2 uplug_getSymbolName(UPlugData *plug); /** * Return the library name for this plugin, if known. * @param plug plugin data handle * @param status error code * @return the library name, or NULL * @internal ICU 4.4 Technology Preview */ U_CAPI const char * U_EXPORT2 uplug_getLibraryName(UPlugData *plug, UErrorCode *status); /** * Return the library used for this plugin, if known. * Plugins could use this to load data out of their * @param plug plugin data handle * @return the library, or NULL * @internal ICU 4.4 Technology Preview */ U_CAPI void * U_EXPORT2 uplug_getLibrary(UPlugData *plug); /** * Return the plugin-specific context data. * @param plug plugin data handle * @return the context, or NULL if not set * @internal ICU 4.4 Technology Preview */ U_CAPI void * U_EXPORT2 uplug_getContext(UPlugData *plug); /** * Set the plugin-specific context data. * @param plug plugin data handle * @param context new context to set * @internal ICU 4.4 Technology Preview */ U_CAPI void U_EXPORT2 uplug_setContext(UPlugData *plug, void *context); /** * Get the configuration string, if available. * The string is in the platform default codepage. * @param plug plugin data handle * @return configuration string, or else null. * @internal ICU 4.4 Technology Preview */ U_CAPI const char * U_EXPORT2 uplug_getConfiguration(UPlugData *plug); /** * Return all currently installed plugins, from newest to oldest * Usage Example: * \code * UPlugData *plug = NULL; * while(plug=uplug_nextPlug(plug)) { * ... do something with 'plug' ... * } * \endcode * Not thread safe- do not call while plugs are added or removed. * @param prior pass in 'NULL' to get the first (most recent) plug, * otherwise pass the value returned on a prior call to uplug_nextPlug * @return the next oldest plugin, or NULL if no more. * @internal ICU 4.4 Technology Preview */ U_CAPI UPlugData* U_EXPORT2 uplug_nextPlug(UPlugData *prior); /** * Inject a plugin as if it were loaded from a library. * This is useful for testing plugins. * Note that it will have a 'NULL' library pointer associated * with it, and therefore no llibrary will be closed at cleanup time. * Low level plugins may not be able to load, as ordering can't be enforced. * @param entrypoint entrypoint to install * @param config user specified configuration string, if available, or NULL. * @param status error result * @return the new UPlugData associated with this plugin, or NULL if error. * @internal ICU 4.4 Technology Preview */ U_CAPI UPlugData* U_EXPORT2 uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UErrorCode *status); /** * Inject a plugin from a library, as if the information came from a config file. * Low level plugins may not be able to load, and ordering can't be enforced. * @param libName DLL name to load * @param sym symbol of plugin (UPlugEntrypoint function) * @param config configuration string, or NULL * @param status error result * @return the new UPlugData associated with this plugin, or NULL if error. * @internal ICU 4.4 Technology Preview */ U_CAPI UPlugData* U_EXPORT2 uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status); /** * Remove a plugin. * Will request the plugin to be unloaded, and close the library if needed * @param plug plugin handle to close * @param status error result * @internal ICU 4.4 Technology Preview */ U_CAPI void U_EXPORT2 uplug_removePlug(UPlugData *plug, UErrorCode *status); #endif android-audiosystem-1.8+13.10.20130807/include/unicode/schriter.h0000644000015700001700000001422512200324306024743 0ustar pbuserpbgroup00000000000000/* ****************************************************************************** * * Copyright (C) 1998-2005, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * * File schriter.h * * Modification History: * * Date Name Description * 05/05/99 stephen Cleaned up. ****************************************************************************** */ #ifndef SCHRITER_H #define SCHRITER_H #include "unicode/utypes.h" #include "unicode/chariter.h" #include "unicode/uchriter.h" /** * \file * \brief C++ API: String Character Iterator */ U_NAMESPACE_BEGIN /** * A concrete subclass of CharacterIterator that iterates over the * characters (code units or code points) in a UnicodeString. * It's possible not only to create an * iterator that iterates over an entire UnicodeString, but also to * create one that iterates over only a subrange of a UnicodeString * (iterators over different subranges of the same UnicodeString don't * compare equal). * @see CharacterIterator * @see ForwardCharacterIterator * @stable ICU 2.0 */ class U_COMMON_API StringCharacterIterator : public UCharCharacterIterator { public: /** * Create an iterator over the UnicodeString referred to by "textStr". * The UnicodeString object is copied. * The iteration range is the whole string, and the starting position is 0. * @param textStr The unicode string used to create an iterator * @stable ICU 2.0 */ StringCharacterIterator(const UnicodeString& textStr); /** * Create an iterator over the UnicodeString referred to by "textStr". * The iteration range is the whole string, and the starting * position is specified by "textPos". If "textPos" is outside the valid * iteration range, the behavior of this object is undefined. * @param textStr The unicode string used to create an iterator * @param textPos The starting position of the iteration * @stable ICU 2.0 */ StringCharacterIterator(const UnicodeString& textStr, int32_t textPos); /** * Create an iterator over the UnicodeString referred to by "textStr". * The UnicodeString object is copied. * The iteration range begins with the code unit specified by * "textBegin" and ends with the code unit BEFORE the code unit specfied * by "textEnd". The starting position is specified by "textPos". If * "textBegin" and "textEnd" don't form a valid range on "text" (i.e., * textBegin >= textEnd or either is negative or greater than text.size()), * or "textPos" is outside the range defined by "textBegin" and "textEnd", * the behavior of this iterator is undefined. * @param textStr The unicode string used to create the StringCharacterIterator * @param textBegin The begin position of the iteration range * @param textEnd The end position of the iteration range * @param textPos The starting position of the iteration * @stable ICU 2.0 */ StringCharacterIterator(const UnicodeString& textStr, int32_t textBegin, int32_t textEnd, int32_t textPos); /** * Copy constructor. The new iterator iterates over the same range * of the same string as "that", and its initial position is the * same as "that"'s current position. * The UnicodeString object in "that" is copied. * @param that The StringCharacterIterator to be copied * @stable ICU 2.0 */ StringCharacterIterator(const StringCharacterIterator& that); /** * Destructor. * @stable ICU 2.0 */ virtual ~StringCharacterIterator(); /** * Assignment operator. *this is altered to iterate over the same * range of the same string as "that", and refers to the same * character within that string as "that" does. * @param that The object to be copied. * @return the newly created object. * @stable ICU 2.0 */ StringCharacterIterator& operator=(const StringCharacterIterator& that); /** * Returns true if the iterators iterate over the same range of the * same string and are pointing at the same character. * @param that The ForwardCharacterIterator to be compared for equality * @return true if the iterators iterate over the same range of the * same string and are pointing at the same character. * @stable ICU 2.0 */ virtual UBool operator==(const ForwardCharacterIterator& that) const; /** * Returns a new StringCharacterIterator referring to the same * character in the same range of the same string as this one. The * caller must delete the new iterator. * @return the newly cloned object. * @stable ICU 2.0 */ virtual CharacterIterator* clone(void) const; /** * Sets the iterator to iterate over the provided string. * @param newText The string to be iterated over * @stable ICU 2.0 */ void setText(const UnicodeString& newText); /** * Copies the UnicodeString under iteration into the UnicodeString * referred to by "result". Even if this iterator iterates across * only a part of this string, the whole string is copied. * @param result Receives a copy of the text under iteration. * @stable ICU 2.0 */ virtual void getText(UnicodeString& result); /** * Return a class ID for this object (not really public) * @return a class ID for this object. * @stable ICU 2.0 */ virtual UClassID getDynamicClassID(void) const; /** * Return a class ID for this class (not really public) * @return a class ID for this class * @stable ICU 2.0 */ static UClassID U_EXPORT2 getStaticClassID(void); protected: /** * Default constructor, iteration over empty string. * @stable ICU 2.0 */ StringCharacterIterator(); /** * Sets the iterator to iterate over the provided string. * @param newText The string to be iterated over * @param newTextLength The length of the String * @stable ICU 2.0 */ void setText(const UChar* newText, int32_t newTextLength); /** * Copy of the iterated string object. * @stable ICU 2.0 */ UnicodeString text; }; U_NAMESPACE_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/uversion.h0000644000015700001700000001450712200324306024775 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * Copyright (C) 2000-2010, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* * * file name: uversion.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * Created by: Vladimir Weinstein * * Gets included by utypes.h and Windows .rc files */ /** * \file * \brief C API: API for accessing ICU version numbers. */ /*===========================================================================*/ /* Main ICU version information */ /*===========================================================================*/ #ifndef UVERSION_H #define UVERSION_H #include "unicode/umachine.h" /* Actual version info lives in uvernum.h */ #include "unicode/uvernum.h" /** Maximum length of the copyright string. * @stable ICU 2.4 */ #define U_COPYRIGHT_STRING_LENGTH 128 /** An ICU version consists of up to 4 numbers from 0..255. * @stable ICU 2.4 */ #define U_MAX_VERSION_LENGTH 4 /** In a string, ICU version fields are delimited by dots. * @stable ICU 2.4 */ #define U_VERSION_DELIMITER '.' /** The maximum length of an ICU version string. * @stable ICU 2.4 */ #define U_MAX_VERSION_STRING_LENGTH 20 /** The binary form of a version on ICU APIs is an array of 4 uint8_t. * To compare two versions, use memcmp(v1,v2,sizeof(UVersionInfo)). * @stable ICU 2.4 */ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]; /*===========================================================================*/ /* C++ namespace if supported. Versioned unless versioning is disabled. */ /*===========================================================================*/ /** * \def U_NAMESPACE_BEGIN * This is used to begin a declaration of a public ICU C++ API. * When not compiling for C++, it does nothing. * When compiling for C++, it begins an extern "C++" linkage block (to protect * against cases in which an external client includes ICU header files inside * an extern "C" linkage block). * If the C++ compiler supports namespaces, it also begins a namespace block. * @stable ICU 2.4 */ /** * \def U_NAMESPACE_END * This is used to end a declaration of a public ICU C++ API. * When not compiling for C++, it does nothing. * When compiling for C++, it ends the extern "C++" block begun by * U_NAMESPACE_BEGIN. * If the C++ compiler supports namespaces, it also ends the namespace block * begun by U_NAMESPACE_BEGIN. * @stable ICU 2.4 */ /** * \def U_NAMESPACE_USE * This is used to specify that the rest of the code uses the * public ICU C++ API namespace. * If the compiler doesn't support namespaces, this does nothing. * @stable ICU 2.4 */ /** * \def U_NAMESPACE_QUALIFIER * This is used to qualify that a function or class is part of * the public ICU C++ API namespace. * If the compiler doesn't support namespaces, this does nothing. * @stable ICU 2.4 */ /* Define namespace symbols if the compiler supports it. */ #ifdef XP_CPLUSPLUS #if U_HAVE_NAMESPACE # if U_DISABLE_RENAMING # define U_ICU_NAMESPACE icu namespace U_ICU_NAMESPACE { } # else # define U_ICU_NAMESPACE U_ICU_ENTRY_POINT_RENAME(icu) namespace U_ICU_NAMESPACE { } namespace icu = U_ICU_NAMESPACE; # endif # define U_NAMESPACE_BEGIN extern "C++" { namespace U_ICU_NAMESPACE { # define U_NAMESPACE_END } } # define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE; # define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE:: # ifndef U_USING_ICU_NAMESPACE # define U_USING_ICU_NAMESPACE 1 # endif # if U_USING_ICU_NAMESPACE U_NAMESPACE_USE # endif #else # define U_NAMESPACE_BEGIN extern "C++" { # define U_NAMESPACE_END } # define U_NAMESPACE_USE # define U_NAMESPACE_QUALIFIER #endif #else # define U_NAMESPACE_BEGIN # define U_NAMESPACE_END # define U_NAMESPACE_USE # define U_NAMESPACE_QUALIFIER #endif /*===========================================================================*/ /* General version helper functions. Definitions in putil.c */ /*===========================================================================*/ /** * Parse a string with dotted-decimal version information and * fill in a UVersionInfo structure with the result. * Definition of this function lives in putil.c * * @param versionArray The destination structure for the version information. * @param versionString A string with dotted-decimal version information, * with up to four non-negative number fields with * values of up to 255 each. * @stable ICU 2.4 */ U_STABLE void U_EXPORT2 u_versionFromString(UVersionInfo versionArray, const char *versionString); /** * Parse a Unicode string with dotted-decimal version information and * fill in a UVersionInfo structure with the result. * Definition of this function lives in putil.c * * @param versionArray The destination structure for the version information. * @param versionString A Unicode string with dotted-decimal version * information, with up to four non-negative number * fields with values of up to 255 each. * @stable ICU 4.2 */ U_STABLE void U_EXPORT2 u_versionFromUString(UVersionInfo versionArray, const UChar *versionString); /** * Write a string with dotted-decimal version information according * to the input UVersionInfo. * Definition of this function lives in putil.c * * @param versionArray The version information to be written as a string. * @param versionString A string buffer that will be filled in with * a string corresponding to the numeric version * information in versionArray. * The buffer size must be at least U_MAX_VERSION_STRING_LENGTH. * @stable ICU 2.4 */ U_STABLE void U_EXPORT2 u_versionToString(UVersionInfo versionArray, char *versionString); /** * Gets the ICU release version. The version array stores the version information * for ICU. For example, release "1.3.31.2" is then represented as 0x01031F02. * Definition of this function lives in putil.c * * @param versionArray the version # information, the result will be filled in * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 u_getVersion(UVersionInfo versionArray); #endif android-audiosystem-1.8+13.10.20130807/include/unicode/uset.h0000644000015700001700000011651612200324306024106 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * * Copyright (C) 2002-2010, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: uset.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2002mar07 * created by: Markus W. Scherer * * C version of UnicodeSet. */ /** * \file * \brief C API: Unicode Set * *

This is a C wrapper around the C++ UnicodeSet class.

*/ #ifndef __USET_H__ #define __USET_H__ #include "unicode/utypes.h" #include "unicode/uchar.h" #include "unicode/localpointer.h" #ifndef UCNV_H struct USet; /** * A UnicodeSet. Use the uset_* API to manipulate. Create with * uset_open*, and destroy with uset_close. * @stable ICU 2.4 */ typedef struct USet USet; #endif /** * Bitmask values to be passed to uset_openPatternOptions() or * uset_applyPattern() taking an option parameter. * @stable ICU 2.4 */ enum { /** * Ignore white space within patterns unless quoted or escaped. * @stable ICU 2.4 */ USET_IGNORE_SPACE = 1, /** * Enable case insensitive matching. E.g., "[ab]" with this flag * will match 'a', 'A', 'b', and 'B'. "[^ab]" with this flag will * match all except 'a', 'A', 'b', and 'B'. This performs a full * closure over case mappings, e.g. U+017F for s. * * The resulting set is a superset of the input for the code points but * not for the strings. * It performs a case mapping closure of the code points and adds * full case folding strings for the code points, and reduces strings of * the original set to their full case folding equivalents. * * This is designed for case-insensitive matches, for example * in regular expressions. The full code point case closure allows checking of * an input character directly against the closure set. * Strings are matched by comparing the case-folded form from the closure * set with an incremental case folding of the string in question. * * The closure set will also contain single code points if the original * set contained case-equivalent strings (like U+00DF for "ss" or "Ss" etc.). * This is not necessary (that is, redundant) for the above matching method * but results in the same closure sets regardless of whether the original * set contained the code point or a string. * * @stable ICU 2.4 */ USET_CASE_INSENSITIVE = 2, /** * Enable case insensitive matching. E.g., "[ab]" with this flag * will match 'a', 'A', 'b', and 'B'. "[^ab]" with this flag will * match all except 'a', 'A', 'b', and 'B'. This adds the lower-, * title-, and uppercase mappings as well as the case folding * of each existing element in the set. * @stable ICU 3.2 */ USET_ADD_CASE_MAPPINGS = 4, /** * Enough for any single-code point set * @internal */ USET_SERIALIZED_STATIC_ARRAY_CAPACITY=8 }; /** * Argument values for whether span() and similar functions continue while * the current character is contained vs. not contained in the set. * * The functionality is straightforward for sets with only single code points, * without strings (which is the common case): * - USET_SPAN_CONTAINED and USET_SPAN_SIMPLE * work the same. * - span() and spanBack() partition any string the same way when * alternating between span(USET_SPAN_NOT_CONTAINED) and * span(either "contained" condition). * - Using a complemented (inverted) set and the opposite span conditions * yields the same results. * * When a set contains multi-code point strings, then these statements may not * be true, depending on the strings in the set (for example, whether they * overlap with each other) and the string that is processed. * For a set with strings: * - The complement of the set contains the opposite set of code points, * but the same set of strings. * Therefore, complementing both the set and the span conditions * may yield different results. * - When starting spans at different positions in a string * (span(s, ...) vs. span(s+1, ...)) the ends of the spans may be different * because a set string may start before the later position. * - span(USET_SPAN_SIMPLE) may be shorter than * span(USET_SPAN_CONTAINED) because it will not recursively try * all possible paths. * For example, with a set which contains the three strings "xy", "xya" and "ax", * span("xyax", USET_SPAN_CONTAINED) will return 4 but * span("xyax", USET_SPAN_SIMPLE) will return 3. * span(USET_SPAN_SIMPLE) will never be longer than * span(USET_SPAN_CONTAINED). * - With either "contained" condition, span() and spanBack() may partition * a string in different ways. * For example, with a set which contains the two strings "ab" and "ba", * and when processing the string "aba", * span() will yield contained/not-contained boundaries of { 0, 2, 3 } * while spanBack() will yield boundaries of { 0, 1, 3 }. * * Note: If it is important to get the same boundaries whether iterating forward * or backward through a string, then either only span() should be used and * the boundaries cached for backward operation, or an ICU BreakIterator * could be used. * * Note: Unpaired surrogates are treated like surrogate code points. * Similarly, set strings match only on code point boundaries, * never in the middle of a surrogate pair. * Illegal UTF-8 sequences are treated like U+FFFD. * When processing UTF-8 strings, malformed set strings * (strings with unpaired surrogates which cannot be converted to UTF-8) * are ignored. * * @stable ICU 3.8 */ typedef enum USetSpanCondition { /** * Continue a span() while there is no set element at the current position. * Stops before the first set element (character or string). * (For code points only, this is like while contains(current)==FALSE). * * When span() returns, the substring between where it started and the position * it returned consists only of characters that are not in the set, * and none of its strings overlap with the span. * * @stable ICU 3.8 */ USET_SPAN_NOT_CONTAINED = 0, /** * Continue a span() while there is a set element at the current position. * (For characters only, this is like while contains(current)==TRUE). * * When span() returns, the substring between where it started and the position * it returned consists only of set elements (characters or strings) that are in the set. * * If a set contains strings, then the span will be the longest substring * matching any of the possible concatenations of set elements (characters or strings). * (There must be a single, non-overlapping concatenation of characters or strings.) * This is equivalent to a POSIX regular expression for (OR of each set element)*. * * @stable ICU 3.8 */ USET_SPAN_CONTAINED = 1, /** * Continue a span() while there is a set element at the current position. * (For characters only, this is like while contains(current)==TRUE). * * When span() returns, the substring between where it started and the position * it returned consists only of set elements (characters or strings) that are in the set. * * If a set only contains single characters, then this is the same * as USET_SPAN_CONTAINED. * * If a set contains strings, then the span will be the longest substring * with a match at each position with the longest single set element (character or string). * * Use this span condition together with other longest-match algorithms, * such as ICU converters (ucnv_getUnicodeSet()). * * @stable ICU 3.8 */ USET_SPAN_SIMPLE = 2, /** * One more than the last span condition. * @stable ICU 3.8 */ USET_SPAN_CONDITION_COUNT } USetSpanCondition; /** * A serialized form of a Unicode set. Limited manipulations are * possible directly on a serialized set. See below. * @stable ICU 2.4 */ typedef struct USerializedSet { /** * The serialized Unicode Set. * @stable ICU 2.4 */ const uint16_t *array; /** * The length of the array that contains BMP characters. * @stable ICU 2.4 */ int32_t bmpLength; /** * The total length of the array. * @stable ICU 2.4 */ int32_t length; /** * A small buffer for the array to reduce memory allocations. * @stable ICU 2.4 */ uint16_t staticArray[USET_SERIALIZED_STATIC_ARRAY_CAPACITY]; } USerializedSet; /********************************************************************* * USet API *********************************************************************/ /** * Create an empty USet object. * Equivalent to uset_open(1, 0). * @return a newly created USet. The caller must call uset_close() on * it when done. * @stable ICU 4.2 */ U_STABLE USet* U_EXPORT2 uset_openEmpty(); /** * Creates a USet object that contains the range of characters * start..end, inclusive. If start > end * then an empty set is created (same as using uset_openEmpty()). * @param start first character of the range, inclusive * @param end last character of the range, inclusive * @return a newly created USet. The caller must call uset_close() on * it when done. * @stable ICU 2.4 */ U_STABLE USet* U_EXPORT2 uset_open(UChar32 start, UChar32 end); /** * Creates a set from the given pattern. See the UnicodeSet class * description for the syntax of the pattern language. * @param pattern a string specifying what characters are in the set * @param patternLength the length of the pattern, or -1 if null * terminated * @param ec the error code * @stable ICU 2.4 */ U_STABLE USet* U_EXPORT2 uset_openPattern(const UChar* pattern, int32_t patternLength, UErrorCode* ec); /** * Creates a set from the given pattern. See the UnicodeSet class * description for the syntax of the pattern language. * @param pattern a string specifying what characters are in the set * @param patternLength the length of the pattern, or -1 if null * terminated * @param options bitmask for options to apply to the pattern. * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. * @param ec the error code * @stable ICU 2.4 */ U_STABLE USet* U_EXPORT2 uset_openPatternOptions(const UChar* pattern, int32_t patternLength, uint32_t options, UErrorCode* ec); /** * Disposes of the storage used by a USet object. This function should * be called exactly once for objects returned by uset_open(). * @param set the object to dispose of * @stable ICU 2.4 */ U_STABLE void U_EXPORT2 uset_close(USet* set); #if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN /** * \class LocalUSetPointer * "Smart pointer" class, closes a USet via uset_close(). * For most methods see the LocalPointerBase base class. * * @see LocalPointerBase * @see LocalPointer * @stable ICU 4.4 */ U_DEFINE_LOCAL_OPEN_POINTER(LocalUSetPointer, USet, uset_close); U_NAMESPACE_END #endif /** * Returns a copy of this object. * If this set is frozen, then the clone will be frozen as well. * Use uset_cloneAsThawed() for a mutable clone of a frozen set. * @param set the original set * @return the newly allocated copy of the set * @see uset_cloneAsThawed * @stable ICU 3.8 */ U_STABLE USet * U_EXPORT2 uset_clone(const USet *set); /** * Determines whether the set has been frozen (made immutable) or not. * See the ICU4J Freezable interface for details. * @param set the set * @return TRUE/FALSE for whether the set has been frozen * @see uset_freeze * @see uset_cloneAsThawed * @stable ICU 3.8 */ U_STABLE UBool U_EXPORT2 uset_isFrozen(const USet *set); /** * Freeze the set (make it immutable). * Once frozen, it cannot be unfrozen and is therefore thread-safe * until it is deleted. * See the ICU4J Freezable interface for details. * Freezing the set may also make some operations faster, for example * uset_contains() and uset_span(). * A frozen set will not be modified. (It remains frozen.) * @param set the set * @return the same set, now frozen * @see uset_isFrozen * @see uset_cloneAsThawed * @stable ICU 3.8 */ U_STABLE void U_EXPORT2 uset_freeze(USet *set); /** * Clone the set and make the clone mutable. * See the ICU4J Freezable interface for details. * @param set the set * @return the mutable clone * @see uset_freeze * @see uset_isFrozen * @see uset_clone * @stable ICU 3.8 */ U_STABLE USet * U_EXPORT2 uset_cloneAsThawed(const USet *set); /** * Causes the USet object to represent the range start - end. * If start > end then this USet is set to an empty range. * A frozen set will not be modified. * @param set the object to set to the given range * @param start first character in the set, inclusive * @param end last character in the set, inclusive * @stable ICU 3.2 */ U_STABLE void U_EXPORT2 uset_set(USet* set, UChar32 start, UChar32 end); /** * Modifies the set to represent the set specified by the given * pattern. See the UnicodeSet class description for the syntax of * the pattern language. See also the User Guide chapter about UnicodeSet. * Empties the set passed before applying the pattern. * A frozen set will not be modified. * @param set The set to which the pattern is to be applied. * @param pattern A pointer to UChar string specifying what characters are in the set. * The character at pattern[0] must be a '['. * @param patternLength The length of the UChar string. -1 if NUL terminated. * @param options A bitmask for options to apply to the pattern. * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE. * @param status Returns an error if the pattern cannot be parsed. * @return Upon successful parse, the value is either * the index of the character after the closing ']' * of the parsed pattern. * If the status code indicates failure, then the return value * is the index of the error in the source. * * @stable ICU 2.8 */ U_STABLE int32_t U_EXPORT2 uset_applyPattern(USet *set, const UChar *pattern, int32_t patternLength, uint32_t options, UErrorCode *status); /** * Modifies the set to contain those code points which have the given value * for the given binary or enumerated property, as returned by * u_getIntPropertyValue. Prior contents of this set are lost. * A frozen set will not be modified. * * @param set the object to contain the code points defined by the property * * @param prop a property in the range UCHAR_BIN_START..UCHAR_BIN_LIMIT-1 * or UCHAR_INT_START..UCHAR_INT_LIMIT-1 * or UCHAR_MASK_START..UCHAR_MASK_LIMIT-1. * * @param value a value in the range u_getIntPropertyMinValue(prop).. * u_getIntPropertyMaxValue(prop), with one exception. If prop is * UCHAR_GENERAL_CATEGORY_MASK, then value should not be a UCharCategory, but * rather a mask value produced by U_GET_GC_MASK(). This allows grouped * categories such as [:L:] to be represented. * * @param ec error code input/output parameter * * @stable ICU 3.2 */ U_STABLE void U_EXPORT2 uset_applyIntPropertyValue(USet* set, UProperty prop, int32_t value, UErrorCode* ec); /** * Modifies the set to contain those code points which have the * given value for the given property. Prior contents of this * set are lost. * A frozen set will not be modified. * * @param set the object to contain the code points defined by the given * property and value alias * * @param prop a string specifying a property alias, either short or long. * The name is matched loosely. See PropertyAliases.txt for names and a * description of loose matching. If the value string is empty, then this * string is interpreted as either a General_Category value alias, a Script * value alias, a binary property alias, or a special ID. Special IDs are * matched loosely and correspond to the following sets: * * "ANY" = [\\u0000-\\U0010FFFF], * "ASCII" = [\\u0000-\\u007F], * "Assigned" = [:^Cn:]. * * @param propLength the length of the prop, or -1 if NULL * * @param value a string specifying a value alias, either short or long. * The name is matched loosely. See PropertyValueAliases.txt for names * and a description of loose matching. In addition to aliases listed, * numeric values and canonical combining classes may be expressed * numerically, e.g., ("nv", "0.5") or ("ccc", "220"). The value string * may also be empty. * * @param valueLength the length of the value, or -1 if NULL * * @param ec error code input/output parameter * * @stable ICU 3.2 */ U_STABLE void U_EXPORT2 uset_applyPropertyAlias(USet* set, const UChar *prop, int32_t propLength, const UChar *value, int32_t valueLength, UErrorCode* ec); /** * Return true if the given position, in the given pattern, appears * to be the start of a UnicodeSet pattern. * * @param pattern a string specifying the pattern * @param patternLength the length of the pattern, or -1 if NULL * @param pos the given position * @stable ICU 3.2 */ U_STABLE UBool U_EXPORT2 uset_resemblesPattern(const UChar *pattern, int32_t patternLength, int32_t pos); /** * Returns a string representation of this set. If the result of * calling this function is passed to a uset_openPattern(), it * will produce another set that is equal to this one. * @param set the set * @param result the string to receive the rules, may be NULL * @param resultCapacity the capacity of result, may be 0 if result is NULL * @param escapeUnprintable if TRUE then convert unprintable * character to their hex escape representations, \\uxxxx or * \\Uxxxxxxxx. Unprintable characters are those other than * U+000A, U+0020..U+007E. * @param ec error code. * @return length of string, possibly larger than resultCapacity * @stable ICU 2.4 */ U_STABLE int32_t U_EXPORT2 uset_toPattern(const USet* set, UChar* result, int32_t resultCapacity, UBool escapeUnprintable, UErrorCode* ec); /** * Adds the given character to the given USet. After this call, * uset_contains(set, c) will return TRUE. * A frozen set will not be modified. * @param set the object to which to add the character * @param c the character to add * @stable ICU 2.4 */ U_STABLE void U_EXPORT2 uset_add(USet* set, UChar32 c); /** * Adds all of the elements in the specified set to this set if * they're not already present. This operation effectively * modifies this set so that its value is the union of the two * sets. The behavior of this operation is unspecified if the specified * collection is modified while the operation is in progress. * A frozen set will not be modified. * * @param set the object to which to add the set * @param additionalSet the source set whose elements are to be added to this set. * @stable ICU 2.6 */ U_STABLE void U_EXPORT2 uset_addAll(USet* set, const USet *additionalSet); /** * Adds the given range of characters to the given USet. After this call, * uset_contains(set, start, end) will return TRUE. * A frozen set will not be modified. * @param set the object to which to add the character * @param start the first character of the range to add, inclusive * @param end the last character of the range to add, inclusive * @stable ICU 2.2 */ U_STABLE void U_EXPORT2 uset_addRange(USet* set, UChar32 start, UChar32 end); /** * Adds the given string to the given USet. After this call, * uset_containsString(set, str, strLen) will return TRUE. * A frozen set will not be modified. * @param set the object to which to add the character * @param str the string to add * @param strLen the length of the string or -1 if null terminated. * @stable ICU 2.4 */ U_STABLE void U_EXPORT2 uset_addString(USet* set, const UChar* str, int32_t strLen); /** * Adds each of the characters in this string to the set. Thus "ch" => {"c", "h"} * If this set already any particular character, it has no effect on that character. * A frozen set will not be modified. * @param set the object to which to add the character * @param str the source string * @param strLen the length of the string or -1 if null terminated. * @stable ICU 3.4 */ U_STABLE void U_EXPORT2 uset_addAllCodePoints(USet* set, const UChar *str, int32_t strLen); /** * Removes the given character from the given USet. After this call, * uset_contains(set, c) will return FALSE. * A frozen set will not be modified. * @param set the object from which to remove the character * @param c the character to remove * @stable ICU 2.4 */ U_STABLE void U_EXPORT2 uset_remove(USet* set, UChar32 c); /** * Removes the given range of characters from the given USet. After this call, * uset_contains(set, start, end) will return FALSE. * A frozen set will not be modified. * @param set the object to which to add the character * @param start the first character of the range to remove, inclusive * @param end the last character of the range to remove, inclusive * @stable ICU 2.2 */ U_STABLE void U_EXPORT2 uset_removeRange(USet* set, UChar32 start, UChar32 end); /** * Removes the given string to the given USet. After this call, * uset_containsString(set, str, strLen) will return FALSE. * A frozen set will not be modified. * @param set the object to which to add the character * @param str the string to remove * @param strLen the length of the string or -1 if null terminated. * @stable ICU 2.4 */ U_STABLE void U_EXPORT2 uset_removeString(USet* set, const UChar* str, int32_t strLen); /** * Removes from this set all of its elements that are contained in the * specified set. This operation effectively modifies this * set so that its value is the asymmetric set difference of * the two sets. * A frozen set will not be modified. * @param set the object from which the elements are to be removed * @param removeSet the object that defines which elements will be * removed from this set * @stable ICU 3.2 */ U_STABLE void U_EXPORT2 uset_removeAll(USet* set, const USet* removeSet); /** * Retain only the elements in this set that are contained in the * specified range. If start > end then an empty range is * retained, leaving the set empty. This is equivalent to * a boolean logic AND, or a set INTERSECTION. * A frozen set will not be modified. * * @param set the object for which to retain only the specified range * @param start first character, inclusive, of range to be retained * to this set. * @param end last character, inclusive, of range to be retained * to this set. * @stable ICU 3.2 */ U_STABLE void U_EXPORT2 uset_retain(USet* set, UChar32 start, UChar32 end); /** * Retains only the elements in this set that are contained in the * specified set. In other words, removes from this set all of * its elements that are not contained in the specified set. This * operation effectively modifies this set so that its value is * the intersection of the two sets. * A frozen set will not be modified. * * @param set the object on which to perform the retain * @param retain set that defines which elements this set will retain * @stable ICU 3.2 */ U_STABLE void U_EXPORT2 uset_retainAll(USet* set, const USet* retain); /** * Reallocate this objects internal structures to take up the least * possible space, without changing this object's value. * A frozen set will not be modified. * * @param set the object on which to perfrom the compact * @stable ICU 3.2 */ U_STABLE void U_EXPORT2 uset_compact(USet* set); /** * Inverts this set. This operation modifies this set so that * its value is its complement. This operation does not affect * the multicharacter strings, if any. * A frozen set will not be modified. * @param set the set * @stable ICU 2.4 */ U_STABLE void U_EXPORT2 uset_complement(USet* set); /** * Complements in this set all elements contained in the specified * set. Any character in the other set will be removed if it is * in this set, or will be added if it is not in this set. * A frozen set will not be modified. * * @param set the set with which to complement * @param complement set that defines which elements will be xor'ed * from this set. * @stable ICU 3.2 */ U_STABLE void U_EXPORT2 uset_complementAll(USet* set, const USet* complement); /** * Removes all of the elements from this set. This set will be * empty after this call returns. * A frozen set will not be modified. * @param set the set * @stable ICU 2.4 */ U_STABLE void U_EXPORT2 uset_clear(USet* set); /** * Close this set over the given attribute. For the attribute * USET_CASE, the result is to modify this set so that: * * 1. For each character or string 'a' in this set, all strings or * characters 'b' such that foldCase(a) == foldCase(b) are added * to this set. * * 2. For each string 'e' in the resulting set, if e != * foldCase(e), 'e' will be removed. * * Example: [aq\\u00DF{Bc}{bC}{Fi}] => [aAqQ\\u00DF\\uFB01{ss}{bc}{fi}] * * (Here foldCase(x) refers to the operation u_strFoldCase, and a * == b denotes that the contents are the same, not pointer * comparison.) * * A frozen set will not be modified. * * @param set the set * * @param attributes bitmask for attributes to close over. * Currently only the USET_CASE bit is supported. Any undefined bits * are ignored. * @stable ICU 4.2 */ U_STABLE void U_EXPORT2 uset_closeOver(USet* set, int32_t attributes); /** * Remove all strings from this set. * * @param set the set * @stable ICU 4.2 */ U_STABLE void U_EXPORT2 uset_removeAllStrings(USet* set); /** * Returns TRUE if the given USet contains no characters and no * strings. * @param set the set * @return true if set is empty * @stable ICU 2.4 */ U_STABLE UBool U_EXPORT2 uset_isEmpty(const USet* set); /** * Returns TRUE if the given USet contains the given character. * This function works faster with a frozen set. * @param set the set * @param c The codepoint to check for within the set * @return true if set contains c * @stable ICU 2.4 */ U_STABLE UBool U_EXPORT2 uset_contains(const USet* set, UChar32 c); /** * Returns TRUE if the given USet contains all characters c * where start <= c && c <= end. * @param set the set * @param start the first character of the range to test, inclusive * @param end the last character of the range to test, inclusive * @return TRUE if set contains the range * @stable ICU 2.2 */ U_STABLE UBool U_EXPORT2 uset_containsRange(const USet* set, UChar32 start, UChar32 end); /** * Returns TRUE if the given USet contains the given string. * @param set the set * @param str the string * @param strLen the length of the string or -1 if null terminated. * @return true if set contains str * @stable ICU 2.4 */ U_STABLE UBool U_EXPORT2 uset_containsString(const USet* set, const UChar* str, int32_t strLen); /** * Returns the index of the given character within this set, where * the set is ordered by ascending code point. If the character * is not in this set, return -1. The inverse of this method is * charAt(). * @param set the set * @param c the character to obtain the index for * @return an index from 0..size()-1, or -1 * @stable ICU 3.2 */ U_STABLE int32_t U_EXPORT2 uset_indexOf(const USet* set, UChar32 c); /** * Returns the character at the given index within this set, where * the set is ordered by ascending code point. If the index is * out of range, return (UChar32)-1. The inverse of this method is * indexOf(). * @param set the set * @param charIndex an index from 0..size()-1 to obtain the char for * @return the character at the given index, or (UChar32)-1. * @stable ICU 3.2 */ U_STABLE UChar32 U_EXPORT2 uset_charAt(const USet* set, int32_t charIndex); /** * Returns the number of characters and strings contained in the given * USet. * @param set the set * @return a non-negative integer counting the characters and strings * contained in set * @stable ICU 2.4 */ U_STABLE int32_t U_EXPORT2 uset_size(const USet* set); /** * Returns the number of items in this set. An item is either a range * of characters or a single multicharacter string. * @param set the set * @return a non-negative integer counting the character ranges * and/or strings contained in set * @stable ICU 2.4 */ U_STABLE int32_t U_EXPORT2 uset_getItemCount(const USet* set); /** * Returns an item of this set. An item is either a range of * characters or a single multicharacter string. * @param set the set * @param itemIndex a non-negative integer in the range 0.. * uset_getItemCount(set)-1 * @param start pointer to variable to receive first character * in range, inclusive * @param end pointer to variable to receive last character in range, * inclusive * @param str buffer to receive the string, may be NULL * @param strCapacity capacity of str, or 0 if str is NULL * @param ec error code * @return the length of the string (>= 2), or 0 if the item is a * range, in which case it is the range *start..*end, or -1 if * itemIndex is out of range * @stable ICU 2.4 */ U_STABLE int32_t U_EXPORT2 uset_getItem(const USet* set, int32_t itemIndex, UChar32* start, UChar32* end, UChar* str, int32_t strCapacity, UErrorCode* ec); /** * Returns true if set1 contains all the characters and strings * of set2. It answers the question, 'Is set1 a superset of set2?' * @param set1 set to be checked for containment * @param set2 set to be checked for containment * @return true if the test condition is met * @stable ICU 3.2 */ U_STABLE UBool U_EXPORT2 uset_containsAll(const USet* set1, const USet* set2); /** * Returns true if this set contains all the characters * of the given string. This is does not check containment of grapheme * clusters, like uset_containsString. * @param set set of characters to be checked for containment * @param str string containing codepoints to be checked for containment * @param strLen the length of the string or -1 if null terminated. * @return true if the test condition is met * @stable ICU 3.4 */ U_STABLE UBool U_EXPORT2 uset_containsAllCodePoints(const USet* set, const UChar *str, int32_t strLen); /** * Returns true if set1 contains none of the characters and strings * of set2. It answers the question, 'Is set1 a disjoint set of set2?' * @param set1 set to be checked for containment * @param set2 set to be checked for containment * @return true if the test condition is met * @stable ICU 3.2 */ U_STABLE UBool U_EXPORT2 uset_containsNone(const USet* set1, const USet* set2); /** * Returns true if set1 contains some of the characters and strings * of set2. It answers the question, 'Does set1 and set2 have an intersection?' * @param set1 set to be checked for containment * @param set2 set to be checked for containment * @return true if the test condition is met * @stable ICU 3.2 */ U_STABLE UBool U_EXPORT2 uset_containsSome(const USet* set1, const USet* set2); /** * Returns the length of the initial substring of the input string which * consists only of characters and strings that are contained in this set * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), * or only of characters and strings that are not contained * in this set (USET_SPAN_NOT_CONTAINED). * See USetSpanCondition for details. * Similar to the strspn() C library function. * Unpaired surrogates are treated according to contains() of their surrogate code points. * This function works faster with a frozen set and with a non-negative string length argument. * @param set the set * @param s start of the string * @param length of the string; can be -1 for NUL-terminated * @param spanCondition specifies the containment condition * @return the length of the initial substring according to the spanCondition; * 0 if the start of the string does not fit the spanCondition * @stable ICU 3.8 * @see USetSpanCondition */ U_STABLE int32_t U_EXPORT2 uset_span(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition); /** * Returns the start of the trailing substring of the input string which * consists only of characters and strings that are contained in this set * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), * or only of characters and strings that are not contained * in this set (USET_SPAN_NOT_CONTAINED). * See USetSpanCondition for details. * Unpaired surrogates are treated according to contains() of their surrogate code points. * This function works faster with a frozen set and with a non-negative string length argument. * @param set the set * @param s start of the string * @param length of the string; can be -1 for NUL-terminated * @param spanCondition specifies the containment condition * @return the start of the trailing substring according to the spanCondition; * the string length if the end of the string does not fit the spanCondition * @stable ICU 3.8 * @see USetSpanCondition */ U_STABLE int32_t U_EXPORT2 uset_spanBack(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition); /** * Returns the length of the initial substring of the input string which * consists only of characters and strings that are contained in this set * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), * or only of characters and strings that are not contained * in this set (USET_SPAN_NOT_CONTAINED). * See USetSpanCondition for details. * Similar to the strspn() C library function. * Malformed byte sequences are treated according to contains(0xfffd). * This function works faster with a frozen set and with a non-negative string length argument. * @param set the set * @param s start of the string (UTF-8) * @param length of the string; can be -1 for NUL-terminated * @param spanCondition specifies the containment condition * @return the length of the initial substring according to the spanCondition; * 0 if the start of the string does not fit the spanCondition * @stable ICU 3.8 * @see USetSpanCondition */ U_STABLE int32_t U_EXPORT2 uset_spanUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition); /** * Returns the start of the trailing substring of the input string which * consists only of characters and strings that are contained in this set * (USET_SPAN_CONTAINED, USET_SPAN_SIMPLE), * or only of characters and strings that are not contained * in this set (USET_SPAN_NOT_CONTAINED). * See USetSpanCondition for details. * Malformed byte sequences are treated according to contains(0xfffd). * This function works faster with a frozen set and with a non-negative string length argument. * @param set the set * @param s start of the string (UTF-8) * @param length of the string; can be -1 for NUL-terminated * @param spanCondition specifies the containment condition * @return the start of the trailing substring according to the spanCondition; * the string length if the end of the string does not fit the spanCondition * @stable ICU 3.8 * @see USetSpanCondition */ U_STABLE int32_t U_EXPORT2 uset_spanBackUTF8(const USet *set, const char *s, int32_t length, USetSpanCondition spanCondition); /** * Returns true if set1 contains all of the characters and strings * of set2, and vis versa. It answers the question, 'Is set1 equal to set2?' * @param set1 set to be checked for containment * @param set2 set to be checked for containment * @return true if the test condition is met * @stable ICU 3.2 */ U_STABLE UBool U_EXPORT2 uset_equals(const USet* set1, const USet* set2); /********************************************************************* * Serialized set API *********************************************************************/ /** * Serializes this set into an array of 16-bit integers. Serialization * (currently) only records the characters in the set; multicharacter * strings are ignored. * * The array * has following format (each line is one 16-bit integer): * * length = (n+2*m) | (m!=0?0x8000:0) * bmpLength = n; present if m!=0 * bmp[0] * bmp[1] * ... * bmp[n-1] * supp-high[0] * supp-low[0] * supp-high[1] * supp-low[1] * ... * supp-high[m-1] * supp-low[m-1] * * The array starts with a header. After the header are n bmp * code points, then m supplementary code points. Either n or m * or both may be zero. n+2*m is always <= 0x7FFF. * * If there are no supplementary characters (if m==0) then the * header is one 16-bit integer, 'length', with value n. * * If there are supplementary characters (if m!=0) then the header * is two 16-bit integers. The first, 'length', has value * (n+2*m)|0x8000. The second, 'bmpLength', has value n. * * After the header the code points are stored in ascending order. * Supplementary code points are stored as most significant 16 * bits followed by least significant 16 bits. * * @param set the set * @param dest pointer to buffer of destCapacity 16-bit integers. * May be NULL only if destCapacity is zero. * @param destCapacity size of dest, or zero. Must not be negative. * @param pErrorCode pointer to the error code. Will be set to * U_INDEX_OUTOFBOUNDS_ERROR if n+2*m > 0x7FFF. Will be set to * U_BUFFER_OVERFLOW_ERROR if n+2*m+(m!=0?2:1) > destCapacity. * @return the total length of the serialized format, including * the header, that is, n+2*m+(m!=0?2:1), or 0 on error other * than U_BUFFER_OVERFLOW_ERROR. * @stable ICU 2.4 */ U_STABLE int32_t U_EXPORT2 uset_serialize(const USet* set, uint16_t* dest, int32_t destCapacity, UErrorCode* pErrorCode); /** * Given a serialized array, fill in the given serialized set object. * @param fillSet pointer to result * @param src pointer to start of array * @param srcLength length of array * @return true if the given array is valid, otherwise false * @stable ICU 2.4 */ U_STABLE UBool U_EXPORT2 uset_getSerializedSet(USerializedSet* fillSet, const uint16_t* src, int32_t srcLength); /** * Set the USerializedSet to contain the given character (and nothing * else). * @param fillSet pointer to result * @param c The codepoint to set * @stable ICU 2.4 */ U_STABLE void U_EXPORT2 uset_setSerializedToOne(USerializedSet* fillSet, UChar32 c); /** * Returns TRUE if the given USerializedSet contains the given * character. * @param set the serialized set * @param c The codepoint to check for within the set * @return true if set contains c * @stable ICU 2.4 */ U_STABLE UBool U_EXPORT2 uset_serializedContains(const USerializedSet* set, UChar32 c); /** * Returns the number of disjoint ranges of characters contained in * the given serialized set. Ignores any strings contained in the * set. * @param set the serialized set * @return a non-negative integer counting the character ranges * contained in set * @stable ICU 2.4 */ U_STABLE int32_t U_EXPORT2 uset_getSerializedRangeCount(const USerializedSet* set); /** * Returns a range of characters contained in the given serialized * set. * @param set the serialized set * @param rangeIndex a non-negative integer in the range 0.. * uset_getSerializedRangeCount(set)-1 * @param pStart pointer to variable to receive first character * in range, inclusive * @param pEnd pointer to variable to receive last character in range, * inclusive * @return true if rangeIndex is valid, otherwise false * @stable ICU 2.4 */ U_STABLE UBool U_EXPORT2 uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex, UChar32* pStart, UChar32* pEnd); #endif android-audiosystem-1.8+13.10.20130807/include/unicode/ucat.h0000644000015700001700000001237312200324306024056 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (c) 2003-2004, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Author: Alan Liu * Created: March 19 2003 * Since: ICU 2.6 ********************************************************************** */ #ifndef UCAT_H #define UCAT_H #include "unicode/utypes.h" #include "unicode/ures.h" /** * \file * \brief C API: Message Catalog Wrappers * * This C API provides look-alike functions that deliberately resemble * the POSIX catopen, catclose, and catgets functions. The underlying * implementation is in terms of ICU resource bundles, rather than * POSIX message catalogs. * * The ICU resource bundles obey standard ICU inheritance policies. * To facilitate this, sets and messages are flattened into one tier. * This is done by creating resource bundle keys of the form * <set_num>%<msg_num> where set_num is the set number and msg_num is * the message number, formatted as decimal strings. * * Example: Consider a message catalog containing two sets: * * Set 1: Message 4 = "Good morning." * Message 5 = "Good afternoon." * Message 7 = "Good evening." * Message 8 = "Good night." * Set 4: Message 14 = "Please " * Message 19 = "Thank you." * Message 20 = "Sincerely," * * The ICU resource bundle source file would, assuming it is named * "greet.txt", would look like this: * * greet * { * 1%4 { "Good morning." } * 1%5 { "Good afternoon." } * 1%7 { "Good evening." } * 1%8 { "Good night." } * * 4%14 { "Please " } * 4%19 { "Thank you." } * 4%20 { "Sincerely," } * } * * The catgets function is commonly used in combination with functions * like printf and strftime. ICU components like message format can * be used instead, although they use a different format syntax. * There is an ICU package, icuio, that provides some of * the POSIX-style formatting API. */ U_CDECL_BEGIN /** * An ICU message catalog descriptor, analogous to nl_catd. * * @stable ICU 2.6 */ typedef UResourceBundle* u_nl_catd; /** * Open and return an ICU message catalog descriptor. The descriptor * may be passed to u_catgets() to retrieve localized strings. * * @param name string containing the full path pointing to the * directory where the resources reside followed by the package name * e.g. "/usr/resource/my_app/resources/guimessages" on a Unix system. * If NULL, ICU default data files will be used. * * Unlike POSIX, environment variables are not interpolated within the * name. * * @param locale the locale for which we want to open the resource. If * NULL, the default ICU locale will be used (see uloc_getDefault). If * strlen(locale) == 0, the root locale will be used. * * @param ec input/output error code. Upon output, * U_USING_FALLBACK_WARNING indicates that a fallback locale was * used. For example, 'de_CH' was requested, but nothing was found * there, so 'de' was used. U_USING_DEFAULT_WARNING indicates that the * default locale data or root locale data was used; neither the * requested locale nor any of its fallback locales were found. * * @return a message catalog descriptor that may be passed to * u_catgets(). If the ec parameter indicates success, then the caller * is responsible for calling u_catclose() to close the message * catalog. If the ec parameter indicates failure, then NULL will be * returned. * * @stable ICU 2.6 */ U_STABLE u_nl_catd U_EXPORT2 u_catopen(const char* name, const char* locale, UErrorCode* ec); /** * Close an ICU message catalog, given its descriptor. * * @param catd a message catalog descriptor to be closed. May be NULL, * in which case no action is taken. * * @stable ICU 2.6 */ U_STABLE void U_EXPORT2 u_catclose(u_nl_catd catd); /** * Retrieve a localized string from an ICU message catalog. * * @param catd a message catalog descriptor returned by u_catopen. * * @param set_num the message catalog set number. Sets need not be * numbered consecutively. * * @param msg_num the message catalog message number within the * set. Messages need not be numbered consecutively. * * @param s the default string. This is returned if the string * specified by the set_num and msg_num is not found. It must be * zero-terminated. * * @param len fill-in parameter to receive the length of the result. * May be NULL, in which case it is ignored. * * @param ec input/output error code. May be U_USING_FALLBACK_WARNING * or U_USING_DEFAULT_WARNING. U_MISSING_RESOURCE_ERROR indicates that * the set_num/msg_num tuple does not specify a valid message string * in this catalog. * * @return a pointer to a zero-terminated UChar array which lives in * an internal buffer area, typically a memory mapped/DLL file. The * caller must NOT delete this pointer. If the call is unsuccessful * for any reason, then s is returned. This includes the situation in * which ec indicates a failing error code upon entry to this * function. * * @stable ICU 2.6 */ U_STABLE const UChar* U_EXPORT2 u_catgets(u_nl_catd catd, int32_t set_num, int32_t msg_num, const UChar* s, int32_t* len, UErrorCode* ec); U_CDECL_END #endif /*UCAT_H*/ /*eof*/ android-audiosystem-1.8+13.10.20130807/include/unicode/uvernum.h0000644000015700001700000001357412200324306024627 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * Copyright (C) 2000-2010, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* * * file name: uvernum.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * Created by: Vladimir Weinstein * Updated by: Steven R. Loomis * * Gets included by uversion.h and other files. * * IMPORTANT: When updating version, the following things need to be done: * source/common/unicode/uvernum.h - this file: update major, minor, * patchlevel, suffix, version, short version constants, namespace, * renaming macro, and copyright * * The following files need to be updated as well, which can be done * by running the UNIX makefile target 'update-windows-makefiles' in icu/source. * * * source/common/common.vcproj - update 'Output file name' on the link tab so * that it contains the new major/minor combination * source/i18n/i18n.vcproj - same as for the common.vcproj * source/layout/layout.vcproj - same as for the common.vcproj * source/layoutex/layoutex.vcproj - same * source/stubdata/stubdata.vcproj - same as for the common.vcproj * source/io/io.vcproj - same as for the common.vcproj * source/data/makedata.mak - change U_ICUDATA_NAME so that it contains * the new major/minor combination and the Unicode version. */ #ifndef UVERNUM_H #define UVERNUM_H /** The standard copyright notice that gets compiled into each library. * This value will change in the subsequent releases of ICU * @stable ICU 2.4 */ #define U_COPYRIGHT_STRING \ " Copyright (C) 2010, International Business Machines Corporation and others. All Rights Reserved. " /** The current ICU major version as an integer. * This value will change in the subsequent releases of ICU * @stable ICU 2.4 */ #define U_ICU_VERSION_MAJOR_NUM 4 /** The current ICU minor version as an integer. * This value will change in the subsequent releases of ICU * @stable ICU 2.6 */ #define U_ICU_VERSION_MINOR_NUM 6 /** The current ICU patchlevel version as an integer. * This value will change in the subsequent releases of ICU * @stable ICU 2.4 */ #define U_ICU_VERSION_PATCHLEVEL_NUM 0 /** The current ICU build level version as an integer. * This value is for use by ICU clients. It defaults to 0. * @stable ICU 4.0 */ #ifndef U_ICU_VERSION_BUILDLEVEL_NUM #define U_ICU_VERSION_BUILDLEVEL_NUM 0 #endif /** Glued version suffix for renamers * This value will change in the subsequent releases of ICU * @stable ICU 2.6 */ #define U_ICU_VERSION_SUFFIX _46 /** Glued version suffix function for renamers * This value will change in the subsequent releases of ICU. * If a custom suffix (such as matching library suffixes) is desired, this can be modified. * Note that if present, platform.h may contain an earlier definition of this macro. * @stable ICU 4.2 */ #ifndef U_ICU_ENTRY_POINT_RENAME #define U_ICU_ENTRY_POINT_RENAME(x) x ## _46 #endif /** The current ICU library version as a dotted-decimal string. The patchlevel * only appears in this string if it non-zero. * This value will change in the subsequent releases of ICU * @stable ICU 2.4 */ #define U_ICU_VERSION "4.6" /** The current ICU library major/minor version as a string without dots, for library name suffixes. * This value will change in the subsequent releases of ICU * @stable ICU 2.6 */ #define U_ICU_VERSION_SHORT "46" /** Data version in ICU4C. * @internal ICU 4.4 Internal Use Only **/ #define U_ICU_DATA_VERSION "4.6" /*=========================================================================== * ICU collation framework version information * Version info that can be obtained from a collator is affected by these * numbers in a secret and magic way. Please use collator version as whole *=========================================================================== */ /** Collation runtime version (sort key generator, strcoll). * If the version is different, sortkeys for the same string could be different * version 2 was in ICU 1.8.1. changed is: compression intervals, French secondary * compression, generating quad level always when strength is quad or more * version 4 - ICU 2.2 - tracking UCA changes, ignore completely ignorables * in contractions, ignore primary ignorables after shifted * version 5 - ICU 2.8 - changed implicit generation code * version 6 - ICU 3.4 - with the UCA 4.1, Thai tag is no longer generated or used * This value may change in the subsequent releases of ICU * @stable ICU 2.4 */ #define UCOL_RUNTIME_VERSION 6 /** Builder code version. When this is different, same tailoring might result * in assigning different collation elements to code points * version 2 was in ICU 1.8.1. added support for prefixes, tweaked canonical * closure. However, the tailorings should probably get same CEs assigned * version 5 - ICU 2.2 - fixed some bugs, renamed some indirect values. * version 6 - ICU 2.8 - fixed bug in builder that allowed 0xFF in primary values * version 7 - ICU 3.4 - with the UCA 4.1 Thai tag is no longer processed, complete ignorables * now break contractions * version 8 - ICU 4.6 - the addition of collation reordering. It should in general be * compatible since the data is at the end of the file. However, * if data parsers make assumptions about lengths this will cause problems. * Backward compatible with the old rules. * This value may change in the subsequent releases of ICU * @stable ICU 2.4 */ #define UCOL_BUILDER_VERSION 8 /** This is the version of the tailorings * This value may change in the subsequent releases of ICU * @stable ICU 2.4 */ #define UCOL_TAILORINGS_VERSION 1 #endif android-audiosystem-1.8+13.10.20130807/include/unicode/platform.h0000644000015700001700000002614412200324306024747 0ustar pbuserpbgroup00000000000000/* ****************************************************************************** * * Copyright (C) 1997-2010, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * * Note: autoconf creates platform.h from platform.h.in at configure time. * ****************************************************************************** * * FILE NAME : platform.h * * Date Name Description * 05/13/98 nos Creation (content moved here from ptypes.h). * 03/02/99 stephen Added AS400 support. * 03/30/99 stephen Added Linux support. * 04/13/99 stephen Reworked for autoconf. ****************************************************************************** */ #ifndef _PLATFORM_H #define _PLATFORM_H /** * \file * \brief Basic types for the platform */ /* This file should be included before uvernum.h. */ #if defined(UVERNUM_H) # error Do not include unicode/uvernum.h before #including unicode/platform.h. Instead of unicode/uvernum.h, #include unicode/uversion.h #endif /** * Determine wheter to enable auto cleanup of libraries. * @internal */ #ifndef UCLN_NO_AUTO_CLEANUP #define UCLN_NO_AUTO_CLEANUP 1 #endif /* Need platform.h when using CYGWINMSVC to get definitions above. Ignore everything else. */ #ifndef CYGWINMSVC /** Define the platform we're on. */ #ifndef U_LINUX #define U_LINUX #endif /** * \def U_HAVE_DIRENT_H * Define whether dirent.h is available * @internal */ #ifndef U_HAVE_DIRENT_H #define U_HAVE_DIRENT_H 1 #endif /** Define whether inttypes.h is available */ #ifndef U_HAVE_INTTYPES_H #define U_HAVE_INTTYPES_H 1 #endif /** * Define what support for C++ streams is available. * If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available * (1997711 is the date the ISO/IEC C++ FDIS was published), and then * one should qualify streams using the std namespace in ICU header * files. * If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is * available instead (198506 is the date when Stroustrup published * "An Extensible I/O Facility for C++" at the summer USENIX conference). * If U_IOSTREAM_SOURCE is 0, then C++ streams are not available and * support for them will be silently suppressed in ICU. * */ #ifndef U_IOSTREAM_SOURCE #define U_IOSTREAM_SOURCE 199711 #endif /** * \def U_HAVE_STD_STRING * Define whether the standard C++ (STL) <string> header is available. * For platforms that do not use platform.h and do not define this constant * in their platform-specific headers, std_string.h defaults * U_HAVE_STD_STRING to 1. * @internal */ #ifdef HAVE_ANDROID_OS #define U_HAVE_STD_STRING 0 #else #ifndef U_HAVE_STD_STRING #define U_HAVE_STD_STRING 1 #endif #endif /** @{ Determines whether specific types are available */ #ifndef U_HAVE_INT8_T #define U_HAVE_INT8_T 1 #endif #ifndef U_HAVE_UINT8_T #define U_HAVE_UINT8_T 1 #endif #ifndef U_HAVE_INT16_T #define U_HAVE_INT16_T 1 #endif #ifndef U_HAVE_UINT16_T #define U_HAVE_UINT16_T 1 #endif #ifndef U_HAVE_INT32_T #define U_HAVE_INT32_T 1 #endif #ifndef U_HAVE_UINT32_T #define U_HAVE_UINT32_T 1 #endif #ifndef U_HAVE_INT64_T #define U_HAVE_INT64_T 1 #endif #ifndef U_HAVE_UINT64_T #define U_HAVE_UINT64_T 1 #endif /** @} */ /*===========================================================================*/ /** @{ Compiler and environment features */ /*===========================================================================*/ /* Define whether namespace is supported */ #ifndef U_HAVE_NAMESPACE #define U_HAVE_NAMESPACE 1 #endif /* Determines the endianness of the platform It's done this way in case multiple architectures are being built at once. For example, Darwin supports fat binaries, which can be both PPC and x86 based. */ #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) #define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN) #else #define U_IS_BIG_ENDIAN 0 #endif /* 1 or 0 to enable or disable threads. If undefined, default is: enable threads. */ #ifndef ICU_USE_THREADS #define ICU_USE_THREADS 1 #endif /* On strong memory model CPUs (e.g. x86 CPUs), we use a safe & quick double check lock. */ #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) #define UMTX_STRONG_MEMORY_MODEL 1 #endif #ifndef U_DEBUG #define U_DEBUG 1 #endif #ifndef U_RELEASE #define U_RELEASE 0 #endif /* Determine whether to disable renaming or not. This overrides the setting in umachine.h which is for all platforms. */ #ifndef U_DISABLE_RENAMING #define U_DISABLE_RENAMING 0 #endif /* Determine whether to override new and delete. */ #ifndef U_OVERRIDE_CXX_ALLOCATION #define U_OVERRIDE_CXX_ALLOCATION 1 #endif /* Determine whether to override placement new and delete for STL. */ #ifndef U_HAVE_PLACEMENT_NEW #define U_HAVE_PLACEMENT_NEW 1 #endif /* Determine whether to enable tracing. */ #ifndef U_ENABLE_TRACING #define U_ENABLE_TRACING 0 #endif /** * Whether to enable Dynamic loading in ICU * @internal */ #ifndef U_ENABLE_DYLOAD #define U_ENABLE_DYLOAD 1 #endif /** * Whether to test Dynamic loading as an OS capabilty * @internal */ #ifndef U_CHECK_DYLOAD #define U_CHECK_DYLOAD 1 #endif /** Do we allow ICU users to use the draft APIs by default? */ #ifndef U_DEFAULT_SHOW_DRAFT #define U_DEFAULT_SHOW_DRAFT 1 #endif /** @} */ /*===========================================================================*/ /** @{ Character data types */ /*===========================================================================*/ #if ((defined(OS390) && (!defined(__CHARSET_LIB) || !__CHARSET_LIB))) || defined(OS400) # define U_CHARSET_FAMILY 1 #endif /** @} */ /*===========================================================================*/ /** @{ Information about wchar support */ /*===========================================================================*/ // BEGIN android-note // We changed "ARM_FLAG" to "HAVE_ANDROID_OS" immediately below. // Consensus seems to be that the intent of ARM_FLAG is actually that // it represent whether we are compiling for Android, and if that's // the case then we might as well use the standard definition instead. // END android-note #ifdef HAVE_ANDROID_OS #define U_HAVE_WCHAR_H 0 #define U_SIZEOF_WCHAR_T 1 #define U_HAVE_WCSCPY 0 #else #ifndef U_HAVE_WCHAR_H #define U_HAVE_WCHAR_H 1 #endif #ifndef U_SIZEOF_WCHAR_T #define U_SIZEOF_WCHAR_T 4 #endif #ifndef U_HAVE_WCSCPY #define U_HAVE_WCSCPY 1 #endif #endif /** @} */ /** * @{ * \def U_DECLARE_UTF16 * Do not use this macro. Use the UNICODE_STRING or U_STRING_DECL macros * instead. * @internal * * \def U_GNUC_UTF16_STRING * @internal */ #ifndef U_GNUC_UTF16_STRING #define U_GNUC_UTF16_STRING 0 #endif #if 1 || defined(U_CHECK_UTF16_STRING) #if (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \ || (defined(__HP_aCC) && __HP_aCC >= 035000) \ || (defined(__HP_cc) && __HP_cc >= 111106) \ || U_GNUC_UTF16_STRING #define U_DECLARE_UTF16(string) u ## string #elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) /* || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x580) */ /* Sun's C compiler has issues with this notation, and it's unreliable. */ #define U_DECLARE_UTF16(string) U ## string #elif U_SIZEOF_WCHAR_T == 2 \ && (U_CHARSET_FAMILY == 0 || ((defined(OS390) || defined(OS400)) && defined(__UCS2__))) #define U_DECLARE_UTF16(string) L ## string #endif #endif /** @} */ /*===========================================================================*/ /** @{ Information about POSIX support */ /*===========================================================================*/ // BEGIN android-note // See Android comment above. // END android-note #if !HAVE_ANDROID_OS #define U_HAVE_NL_LANGINFO 1 #ifndef U_HAVE_NL_LANGINFO_CODESET #define U_HAVE_NL_LANGINFO_CODESET 1 #endif #endif #ifndef U_NL_LANGINFO_CODESET #define U_NL_LANGINFO_CODESET CODESET #endif #if !HAVE_ANDROID_OS #if 1 #define U_TZSET tzset #endif #if 1 #define U_TIMEZONE __timezone #endif #if 1 #define U_TZNAME tzname #endif #endif #define U_HAVE_MMAP 1 #define U_HAVE_POPEN 1 /** @} */ /*===========================================================================*/ /** @{ Symbol import-export control */ /*===========================================================================*/ #if 1 #define U_EXPORT __attribute__((visibility("default"))) #elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \ || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550) #define U_EXPORT __global /*#elif defined(__HP_aCC) || defined(__HP_cc) #define U_EXPORT __declspec(dllexport)*/ #else #define U_EXPORT #endif /* U_CALLCONV is releated to U_EXPORT2 */ #define U_EXPORT2 /* cygwin needs to export/import data */ #if defined(U_CYGWIN) && !defined(__GNUC__) #define U_IMPORT __declspec(dllimport) #else #define U_IMPORT #endif /* @} */ /*===========================================================================*/ /** @{ Code alignment and C function inlining */ /*===========================================================================*/ #ifndef U_INLINE # ifdef __cplusplus # define U_INLINE inline # else # define U_INLINE __inline__ # endif #endif #ifndef U_ALIGN_CODE #define U_ALIGN_CODE(n) #endif /** @} */ /*===========================================================================*/ /** @{ GCC built in functions for atomic memory operations */ /*===========================================================================*/ // BEGIN android-added #if !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) #define U_HAVE_GCC_ATOMICS 0 #endif // END android-added /** * \def U_HAVE_GCC_ATOMICS * @internal */ #ifndef U_HAVE_GCC_ATOMICS #define U_HAVE_GCC_ATOMICS 1 #endif /** @} */ /*===========================================================================*/ /** @{ Programs used by ICU code */ /*===========================================================================*/ /** * \def U_MAKE * What program to execute to run 'make' */ #ifndef U_MAKE #define U_MAKE "make" #endif /** @} */ #endif /* CYGWINMSVC */ /*===========================================================================*/ /* Custom icu entry point renaming */ /*===========================================================================*/ /** * Define the library suffix with C syntax. * @internal */ # define U_LIB_SUFFIX_C_NAME /** * Define the library suffix as a string with C syntax * @internal */ # define U_LIB_SUFFIX_C_NAME_STRING "" /** * 1 if a custom library suffix is set * @internal */ # define U_HAVE_LIB_SUFFIX 0 #if U_HAVE_LIB_SUFFIX # ifndef U_ICU_ENTRY_POINT_RENAME /* Renaming pattern: u_strcpy_41_suffix */ # define U_ICU_ENTRY_POINT_RENAME(x) x ## _ ## 46 ## # define U_DEF_ICUDATA_ENTRY_POINT(major, minor) icudt####major##minor##_dat # endif #endif #endif android-audiosystem-1.8+13.10.20130807/include/unicode/urename.h0000644000015700001700000046043212200324306024561 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * Copyright (C) 2002-2010, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* * * file name: urename.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * Created by: Perl script written by Vladimir Weinstein * * Contains data for renaming ICU exports. * Gets included by umachine.h * * THIS FILE IS MACHINE-GENERATED, DON'T PLAY WITH IT IF YOU DON'T KNOW WHAT * YOU ARE DOING, OTHERWISE VERY BAD THINGS WILL HAPPEN! */ #ifndef URENAME_H #define URENAME_H /* Uncomment the following line to disable renaming on platforms that do not use Autoconf. */ /* #define U_DISABLE_RENAMING 1 */ #if !U_DISABLE_RENAMING /* We need the U_ICU_ENTRY_POINT_RENAME definition. There's a default one in unicode/uvernum.h we can use, but we will give the platform a chance to define it first. Normally (if utypes.h or umachine.h was included first) this will not be necessary as it will already be defined. */ #ifndef U_ICU_ENTRY_POINT_RENAME #include "unicode/umachine.h" #endif /* If we still don't have U_ICU_ENTRY_POINT_RENAME use the default. */ #ifndef U_ICU_ENTRY_POINT_RENAME #include "unicode/uvernum.h" #endif /* Error out before the following defines cause very strange and unexpected code breakage */ #ifndef U_ICU_ENTRY_POINT_RENAME #error U_ICU_ENTRY_POINT_RENAME is not defined - cannot continue. Consider defining U_DISABLE_RENAMING if renaming should not be used. #endif /* C exports renaming data */ #define DECPOWERS U_ICU_ENTRY_POINT_RENAME(DECPOWERS) #define DECSTICKYTAB U_ICU_ENTRY_POINT_RENAME(DECSTICKYTAB) #define LNnn U_ICU_ENTRY_POINT_RENAME(LNnn) #define T_CString_int64ToString U_ICU_ENTRY_POINT_RENAME(T_CString_int64ToString) #define T_CString_integerToString U_ICU_ENTRY_POINT_RENAME(T_CString_integerToString) #define T_CString_stricmp U_ICU_ENTRY_POINT_RENAME(T_CString_stricmp) #define T_CString_stringToInteger U_ICU_ENTRY_POINT_RENAME(T_CString_stringToInteger) #define T_CString_strnicmp U_ICU_ENTRY_POINT_RENAME(T_CString_strnicmp) #define T_CString_toLowerCase U_ICU_ENTRY_POINT_RENAME(T_CString_toLowerCase) #define T_CString_toUpperCase U_ICU_ENTRY_POINT_RENAME(T_CString_toUpperCase) #define UCNV_FROM_U_CALLBACK_ESCAPE U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_ESCAPE) #define UCNV_FROM_U_CALLBACK_SKIP U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_SKIP) #define UCNV_FROM_U_CALLBACK_STOP U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_STOP) #define UCNV_FROM_U_CALLBACK_SUBSTITUTE U_ICU_ENTRY_POINT_RENAME(UCNV_FROM_U_CALLBACK_SUBSTITUTE) #define UCNV_TO_U_CALLBACK_ESCAPE U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_ESCAPE) #define UCNV_TO_U_CALLBACK_SKIP U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_SKIP) #define UCNV_TO_U_CALLBACK_STOP U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_STOP) #define UCNV_TO_U_CALLBACK_SUBSTITUTE U_ICU_ENTRY_POINT_RENAME(UCNV_TO_U_CALLBACK_SUBSTITUTE) #define UDataMemory_createNewInstance U_ICU_ENTRY_POINT_RENAME(UDataMemory_createNewInstance) #define UDataMemory_init U_ICU_ENTRY_POINT_RENAME(UDataMemory_init) #define UDataMemory_isLoaded U_ICU_ENTRY_POINT_RENAME(UDataMemory_isLoaded) #define UDataMemory_normalizeDataPointer U_ICU_ENTRY_POINT_RENAME(UDataMemory_normalizeDataPointer) #define UDataMemory_setData U_ICU_ENTRY_POINT_RENAME(UDataMemory_setData) #define UDatamemory_assign U_ICU_ENTRY_POINT_RENAME(UDatamemory_assign) #define _ASCIIData U_ICU_ENTRY_POINT_RENAME(_ASCIIData) #define _Bocu1Data U_ICU_ENTRY_POINT_RENAME(_Bocu1Data) #define _CESU8Data U_ICU_ENTRY_POINT_RENAME(_CESU8Data) #define _HZData U_ICU_ENTRY_POINT_RENAME(_HZData) #define _IMAPData U_ICU_ENTRY_POINT_RENAME(_IMAPData) #define _ISCIIData U_ICU_ENTRY_POINT_RENAME(_ISCIIData) #define _ISO2022Data U_ICU_ENTRY_POINT_RENAME(_ISO2022Data) #define _LMBCSData1 U_ICU_ENTRY_POINT_RENAME(_LMBCSData1) #define _LMBCSData11 U_ICU_ENTRY_POINT_RENAME(_LMBCSData11) #define _LMBCSData16 U_ICU_ENTRY_POINT_RENAME(_LMBCSData16) #define _LMBCSData17 U_ICU_ENTRY_POINT_RENAME(_LMBCSData17) #define _LMBCSData18 U_ICU_ENTRY_POINT_RENAME(_LMBCSData18) #define _LMBCSData19 U_ICU_ENTRY_POINT_RENAME(_LMBCSData19) #define _LMBCSData2 U_ICU_ENTRY_POINT_RENAME(_LMBCSData2) #define _LMBCSData3 U_ICU_ENTRY_POINT_RENAME(_LMBCSData3) #define _LMBCSData4 U_ICU_ENTRY_POINT_RENAME(_LMBCSData4) #define _LMBCSData5 U_ICU_ENTRY_POINT_RENAME(_LMBCSData5) #define _LMBCSData6 U_ICU_ENTRY_POINT_RENAME(_LMBCSData6) #define _LMBCSData8 U_ICU_ENTRY_POINT_RENAME(_LMBCSData8) #define _Latin1Data U_ICU_ENTRY_POINT_RENAME(_Latin1Data) #define _MBCSData U_ICU_ENTRY_POINT_RENAME(_MBCSData) #define _SCSUData U_ICU_ENTRY_POINT_RENAME(_SCSUData) #define _UTF16BEData U_ICU_ENTRY_POINT_RENAME(_UTF16BEData) #define _UTF16Data U_ICU_ENTRY_POINT_RENAME(_UTF16Data) #define _UTF16LEData U_ICU_ENTRY_POINT_RENAME(_UTF16LEData) #define _UTF32BEData U_ICU_ENTRY_POINT_RENAME(_UTF32BEData) #define _UTF32Data U_ICU_ENTRY_POINT_RENAME(_UTF32Data) #define _UTF32LEData U_ICU_ENTRY_POINT_RENAME(_UTF32LEData) #define _UTF7Data U_ICU_ENTRY_POINT_RENAME(_UTF7Data) #define _UTF8Data U_ICU_ENTRY_POINT_RENAME(_UTF8Data) #define bms_close U_ICU_ENTRY_POINT_RENAME(bms_close) #define bms_empty U_ICU_ENTRY_POINT_RENAME(bms_empty) #define bms_getData U_ICU_ENTRY_POINT_RENAME(bms_getData) #define bms_open U_ICU_ENTRY_POINT_RENAME(bms_open) #define bms_search U_ICU_ENTRY_POINT_RENAME(bms_search) #define bms_setTargetString U_ICU_ENTRY_POINT_RENAME(bms_setTargetString) #define buildWSConfusableData U_ICU_ENTRY_POINT_RENAME(buildWSConfusableData) #define cmemory_cleanup U_ICU_ENTRY_POINT_RENAME(cmemory_cleanup) #define cmemory_inUse U_ICU_ENTRY_POINT_RENAME(cmemory_inUse) #define d2utable U_ICU_ENTRY_POINT_RENAME(d2utable) #define deleteCEList U_ICU_ENTRY_POINT_RENAME(deleteCEList) #define deleteChars U_ICU_ENTRY_POINT_RENAME(deleteChars) #define deleteCollDataCacheEntry U_ICU_ENTRY_POINT_RENAME(deleteCollDataCacheEntry) #define deleteStringList U_ICU_ENTRY_POINT_RENAME(deleteStringList) #define deleteUnicodeStringKey U_ICU_ENTRY_POINT_RENAME(deleteUnicodeStringKey) #define izrule_clone U_ICU_ENTRY_POINT_RENAME(izrule_clone) #define izrule_close U_ICU_ENTRY_POINT_RENAME(izrule_close) #define izrule_equals U_ICU_ENTRY_POINT_RENAME(izrule_equals) #define izrule_getDSTSavings U_ICU_ENTRY_POINT_RENAME(izrule_getDSTSavings) #define izrule_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(izrule_getDynamicClassID) #define izrule_getFinalStart U_ICU_ENTRY_POINT_RENAME(izrule_getFinalStart) #define izrule_getFirstStart U_ICU_ENTRY_POINT_RENAME(izrule_getFirstStart) #define izrule_getName U_ICU_ENTRY_POINT_RENAME(izrule_getName) #define izrule_getNextStart U_ICU_ENTRY_POINT_RENAME(izrule_getNextStart) #define izrule_getPreviousStart U_ICU_ENTRY_POINT_RENAME(izrule_getPreviousStart) #define izrule_getRawOffset U_ICU_ENTRY_POINT_RENAME(izrule_getRawOffset) #define izrule_getStaticClassID U_ICU_ENTRY_POINT_RENAME(izrule_getStaticClassID) #define izrule_isEquivalentTo U_ICU_ENTRY_POINT_RENAME(izrule_isEquivalentTo) #define izrule_open U_ICU_ENTRY_POINT_RENAME(izrule_open) #define le_close U_ICU_ENTRY_POINT_RENAME(le_close) #define le_create U_ICU_ENTRY_POINT_RENAME(le_create) #define le_getCharIndices U_ICU_ENTRY_POINT_RENAME(le_getCharIndices) #define le_getCharIndicesWithBase U_ICU_ENTRY_POINT_RENAME(le_getCharIndicesWithBase) #define le_getGlyphCount U_ICU_ENTRY_POINT_RENAME(le_getGlyphCount) #define le_getGlyphPosition U_ICU_ENTRY_POINT_RENAME(le_getGlyphPosition) #define le_getGlyphPositions U_ICU_ENTRY_POINT_RENAME(le_getGlyphPositions) #define le_getGlyphs U_ICU_ENTRY_POINT_RENAME(le_getGlyphs) #define le_layoutChars U_ICU_ENTRY_POINT_RENAME(le_layoutChars) #define le_reset U_ICU_ENTRY_POINT_RENAME(le_reset) #define locale_getKeywords U_ICU_ENTRY_POINT_RENAME(locale_getKeywords) #define locale_getKeywordsStart U_ICU_ENTRY_POINT_RENAME(locale_getKeywordsStart) #define locale_get_default U_ICU_ENTRY_POINT_RENAME(locale_get_default) #define locale_set_default U_ICU_ENTRY_POINT_RENAME(locale_set_default) #define pl_addFontRun U_ICU_ENTRY_POINT_RENAME(pl_addFontRun) #define pl_addLocaleRun U_ICU_ENTRY_POINT_RENAME(pl_addLocaleRun) #define pl_addValueRun U_ICU_ENTRY_POINT_RENAME(pl_addValueRun) #define pl_close U_ICU_ENTRY_POINT_RENAME(pl_close) #define pl_closeFontRuns U_ICU_ENTRY_POINT_RENAME(pl_closeFontRuns) #define pl_closeLine U_ICU_ENTRY_POINT_RENAME(pl_closeLine) #define pl_closeLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_closeLocaleRuns) #define pl_closeValueRuns U_ICU_ENTRY_POINT_RENAME(pl_closeValueRuns) #define pl_countLineRuns U_ICU_ENTRY_POINT_RENAME(pl_countLineRuns) #define pl_create U_ICU_ENTRY_POINT_RENAME(pl_create) #define pl_getAscent U_ICU_ENTRY_POINT_RENAME(pl_getAscent) #define pl_getDescent U_ICU_ENTRY_POINT_RENAME(pl_getDescent) #define pl_getFontRunCount U_ICU_ENTRY_POINT_RENAME(pl_getFontRunCount) #define pl_getFontRunFont U_ICU_ENTRY_POINT_RENAME(pl_getFontRunFont) #define pl_getFontRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getFontRunLastLimit) #define pl_getFontRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getFontRunLimit) #define pl_getLeading U_ICU_ENTRY_POINT_RENAME(pl_getLeading) #define pl_getLineAscent U_ICU_ENTRY_POINT_RENAME(pl_getLineAscent) #define pl_getLineDescent U_ICU_ENTRY_POINT_RENAME(pl_getLineDescent) #define pl_getLineLeading U_ICU_ENTRY_POINT_RENAME(pl_getLineLeading) #define pl_getLineVisualRun U_ICU_ENTRY_POINT_RENAME(pl_getLineVisualRun) #define pl_getLineWidth U_ICU_ENTRY_POINT_RENAME(pl_getLineWidth) #define pl_getLocaleRunCount U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunCount) #define pl_getLocaleRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLastLimit) #define pl_getLocaleRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLimit) #define pl_getLocaleRunLocale U_ICU_ENTRY_POINT_RENAME(pl_getLocaleRunLocale) #define pl_getParagraphLevel U_ICU_ENTRY_POINT_RENAME(pl_getParagraphLevel) #define pl_getTextDirection U_ICU_ENTRY_POINT_RENAME(pl_getTextDirection) #define pl_getValueRunCount U_ICU_ENTRY_POINT_RENAME(pl_getValueRunCount) #define pl_getValueRunLastLimit U_ICU_ENTRY_POINT_RENAME(pl_getValueRunLastLimit) #define pl_getValueRunLimit U_ICU_ENTRY_POINT_RENAME(pl_getValueRunLimit) #define pl_getValueRunValue U_ICU_ENTRY_POINT_RENAME(pl_getValueRunValue) #define pl_getVisualRunAscent U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunAscent) #define pl_getVisualRunDescent U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunDescent) #define pl_getVisualRunDirection U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunDirection) #define pl_getVisualRunFont U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunFont) #define pl_getVisualRunGlyphCount U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphCount) #define pl_getVisualRunGlyphToCharMap U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphToCharMap) #define pl_getVisualRunGlyphs U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunGlyphs) #define pl_getVisualRunLeading U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunLeading) #define pl_getVisualRunPositions U_ICU_ENTRY_POINT_RENAME(pl_getVisualRunPositions) #define pl_isComplex U_ICU_ENTRY_POINT_RENAME(pl_isComplex) #define pl_nextLine U_ICU_ENTRY_POINT_RENAME(pl_nextLine) #define pl_openEmptyFontRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyFontRuns) #define pl_openEmptyLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyLocaleRuns) #define pl_openEmptyValueRuns U_ICU_ENTRY_POINT_RENAME(pl_openEmptyValueRuns) #define pl_openFontRuns U_ICU_ENTRY_POINT_RENAME(pl_openFontRuns) #define pl_openLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_openLocaleRuns) #define pl_openValueRuns U_ICU_ENTRY_POINT_RENAME(pl_openValueRuns) #define pl_reflow U_ICU_ENTRY_POINT_RENAME(pl_reflow) #define pl_resetFontRuns U_ICU_ENTRY_POINT_RENAME(pl_resetFontRuns) #define pl_resetLocaleRuns U_ICU_ENTRY_POINT_RENAME(pl_resetLocaleRuns) #define pl_resetValueRuns U_ICU_ENTRY_POINT_RENAME(pl_resetValueRuns) #define res_countArrayItems U_ICU_ENTRY_POINT_RENAME(res_countArrayItems) #define res_findResource U_ICU_ENTRY_POINT_RENAME(res_findResource) #define res_getAlias U_ICU_ENTRY_POINT_RENAME(res_getAlias) #define res_getArrayItem U_ICU_ENTRY_POINT_RENAME(res_getArrayItem) #define res_getBinary U_ICU_ENTRY_POINT_RENAME(res_getBinary) #define res_getIntVector U_ICU_ENTRY_POINT_RENAME(res_getIntVector) #define res_getPublicType U_ICU_ENTRY_POINT_RENAME(res_getPublicType) #define res_getResource U_ICU_ENTRY_POINT_RENAME(res_getResource) #define res_getString U_ICU_ENTRY_POINT_RENAME(res_getString) #define res_getTableItemByIndex U_ICU_ENTRY_POINT_RENAME(res_getTableItemByIndex) #define res_getTableItemByKey U_ICU_ENTRY_POINT_RENAME(res_getTableItemByKey) #define res_load U_ICU_ENTRY_POINT_RENAME(res_load) #define res_read U_ICU_ENTRY_POINT_RENAME(res_read) #define res_unload U_ICU_ENTRY_POINT_RENAME(res_unload) #define tmutfmtHashTableValueComparator U_ICU_ENTRY_POINT_RENAME(tmutfmtHashTableValueComparator) #define triedict_swap U_ICU_ENTRY_POINT_RENAME(triedict_swap) #define u_UCharsToChars U_ICU_ENTRY_POINT_RENAME(u_UCharsToChars) #define u_austrcpy U_ICU_ENTRY_POINT_RENAME(u_austrcpy) #define u_austrncpy U_ICU_ENTRY_POINT_RENAME(u_austrncpy) #define u_catclose U_ICU_ENTRY_POINT_RENAME(u_catclose) #define u_catgets U_ICU_ENTRY_POINT_RENAME(u_catgets) #define u_catopen U_ICU_ENTRY_POINT_RENAME(u_catopen) #define u_charAge U_ICU_ENTRY_POINT_RENAME(u_charAge) #define u_charDigitValue U_ICU_ENTRY_POINT_RENAME(u_charDigitValue) #define u_charDirection U_ICU_ENTRY_POINT_RENAME(u_charDirection) #define u_charFromName U_ICU_ENTRY_POINT_RENAME(u_charFromName) #define u_charMirror U_ICU_ENTRY_POINT_RENAME(u_charMirror) #define u_charName U_ICU_ENTRY_POINT_RENAME(u_charName) #define u_charType U_ICU_ENTRY_POINT_RENAME(u_charType) #define u_charsToUChars U_ICU_ENTRY_POINT_RENAME(u_charsToUChars) #define u_cleanup U_ICU_ENTRY_POINT_RENAME(u_cleanup) #define u_countChar32 U_ICU_ENTRY_POINT_RENAME(u_countChar32) #define u_digit U_ICU_ENTRY_POINT_RENAME(u_digit) #define u_enumCharNames U_ICU_ENTRY_POINT_RENAME(u_enumCharNames) #define u_enumCharTypes U_ICU_ENTRY_POINT_RENAME(u_enumCharTypes) #define u_errorName U_ICU_ENTRY_POINT_RENAME(u_errorName) #define u_fadopt U_ICU_ENTRY_POINT_RENAME(u_fadopt) #define u_fclose U_ICU_ENTRY_POINT_RENAME(u_fclose) #define u_feof U_ICU_ENTRY_POINT_RENAME(u_feof) #define u_fflush U_ICU_ENTRY_POINT_RENAME(u_fflush) #define u_fgetConverter U_ICU_ENTRY_POINT_RENAME(u_fgetConverter) #define u_fgetc U_ICU_ENTRY_POINT_RENAME(u_fgetc) #define u_fgetcodepage U_ICU_ENTRY_POINT_RENAME(u_fgetcodepage) #define u_fgetcx U_ICU_ENTRY_POINT_RENAME(u_fgetcx) #define u_fgetfile U_ICU_ENTRY_POINT_RENAME(u_fgetfile) #define u_fgetlocale U_ICU_ENTRY_POINT_RENAME(u_fgetlocale) #define u_fgets U_ICU_ENTRY_POINT_RENAME(u_fgets) #define u_file_read U_ICU_ENTRY_POINT_RENAME(u_file_read) #define u_file_write U_ICU_ENTRY_POINT_RENAME(u_file_write) #define u_file_write_flush U_ICU_ENTRY_POINT_RENAME(u_file_write_flush) #define u_finit U_ICU_ENTRY_POINT_RENAME(u_finit) #define u_flushDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_flushDefaultConverter) #define u_foldCase U_ICU_ENTRY_POINT_RENAME(u_foldCase) #define u_fopen U_ICU_ENTRY_POINT_RENAME(u_fopen) #define u_forDigit U_ICU_ENTRY_POINT_RENAME(u_forDigit) #define u_formatMessage U_ICU_ENTRY_POINT_RENAME(u_formatMessage) #define u_formatMessageWithError U_ICU_ENTRY_POINT_RENAME(u_formatMessageWithError) #define u_fprintf U_ICU_ENTRY_POINT_RENAME(u_fprintf) #define u_fprintf_u U_ICU_ENTRY_POINT_RENAME(u_fprintf_u) #define u_fputc U_ICU_ENTRY_POINT_RENAME(u_fputc) #define u_fputs U_ICU_ENTRY_POINT_RENAME(u_fputs) #define u_frewind U_ICU_ENTRY_POINT_RENAME(u_frewind) #define u_fscanf U_ICU_ENTRY_POINT_RENAME(u_fscanf) #define u_fscanf_u U_ICU_ENTRY_POINT_RENAME(u_fscanf_u) #define u_fsetcodepage U_ICU_ENTRY_POINT_RENAME(u_fsetcodepage) #define u_fsetlocale U_ICU_ENTRY_POINT_RENAME(u_fsetlocale) #define u_fsettransliterator U_ICU_ENTRY_POINT_RENAME(u_fsettransliterator) #define u_fstropen U_ICU_ENTRY_POINT_RENAME(u_fstropen) #define u_fungetc U_ICU_ENTRY_POINT_RENAME(u_fungetc) #define u_getCombiningClass U_ICU_ENTRY_POINT_RENAME(u_getCombiningClass) #define u_getDataDirectory U_ICU_ENTRY_POINT_RENAME(u_getDataDirectory) #define u_getDataVersion U_ICU_ENTRY_POINT_RENAME(u_getDataVersion) #define u_getDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_getDefaultConverter) #define u_getFC_NFKC_Closure U_ICU_ENTRY_POINT_RENAME(u_getFC_NFKC_Closure) #define u_getISOComment U_ICU_ENTRY_POINT_RENAME(u_getISOComment) #define u_getIntPropertyMaxValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMaxValue) #define u_getIntPropertyMinValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyMinValue) #define u_getIntPropertyValue U_ICU_ENTRY_POINT_RENAME(u_getIntPropertyValue) #define u_getNumericValue U_ICU_ENTRY_POINT_RENAME(u_getNumericValue) #define u_getPropertyEnum U_ICU_ENTRY_POINT_RENAME(u_getPropertyEnum) #define u_getPropertyName U_ICU_ENTRY_POINT_RENAME(u_getPropertyName) #define u_getPropertyValueEnum U_ICU_ENTRY_POINT_RENAME(u_getPropertyValueEnum) #define u_getPropertyValueName U_ICU_ENTRY_POINT_RENAME(u_getPropertyValueName) #define u_getUnicodeProperties U_ICU_ENTRY_POINT_RENAME(u_getUnicodeProperties) #define u_getUnicodeVersion U_ICU_ENTRY_POINT_RENAME(u_getUnicodeVersion) #define u_getVersion U_ICU_ENTRY_POINT_RENAME(u_getVersion) #define u_hasBinaryProperty U_ICU_ENTRY_POINT_RENAME(u_hasBinaryProperty) #define u_init U_ICU_ENTRY_POINT_RENAME(u_init) #define u_isDataOlder U_ICU_ENTRY_POINT_RENAME(u_isDataOlder) #define u_isIDIgnorable U_ICU_ENTRY_POINT_RENAME(u_isIDIgnorable) #define u_isIDPart U_ICU_ENTRY_POINT_RENAME(u_isIDPart) #define u_isIDStart U_ICU_ENTRY_POINT_RENAME(u_isIDStart) #define u_isISOControl U_ICU_ENTRY_POINT_RENAME(u_isISOControl) #define u_isJavaIDPart U_ICU_ENTRY_POINT_RENAME(u_isJavaIDPart) #define u_isJavaIDStart U_ICU_ENTRY_POINT_RENAME(u_isJavaIDStart) #define u_isJavaSpaceChar U_ICU_ENTRY_POINT_RENAME(u_isJavaSpaceChar) #define u_isMirrored U_ICU_ENTRY_POINT_RENAME(u_isMirrored) #define u_isUAlphabetic U_ICU_ENTRY_POINT_RENAME(u_isUAlphabetic) #define u_isULowercase U_ICU_ENTRY_POINT_RENAME(u_isULowercase) #define u_isUUppercase U_ICU_ENTRY_POINT_RENAME(u_isUUppercase) #define u_isUWhiteSpace U_ICU_ENTRY_POINT_RENAME(u_isUWhiteSpace) #define u_isWhitespace U_ICU_ENTRY_POINT_RENAME(u_isWhitespace) #define u_isalnum U_ICU_ENTRY_POINT_RENAME(u_isalnum) #define u_isalnumPOSIX U_ICU_ENTRY_POINT_RENAME(u_isalnumPOSIX) #define u_isalpha U_ICU_ENTRY_POINT_RENAME(u_isalpha) #define u_isbase U_ICU_ENTRY_POINT_RENAME(u_isbase) #define u_isblank U_ICU_ENTRY_POINT_RENAME(u_isblank) #define u_iscntrl U_ICU_ENTRY_POINT_RENAME(u_iscntrl) #define u_isdefined U_ICU_ENTRY_POINT_RENAME(u_isdefined) #define u_isdigit U_ICU_ENTRY_POINT_RENAME(u_isdigit) #define u_isgraph U_ICU_ENTRY_POINT_RENAME(u_isgraph) #define u_isgraphPOSIX U_ICU_ENTRY_POINT_RENAME(u_isgraphPOSIX) #define u_islower U_ICU_ENTRY_POINT_RENAME(u_islower) #define u_isprint U_ICU_ENTRY_POINT_RENAME(u_isprint) #define u_isprintPOSIX U_ICU_ENTRY_POINT_RENAME(u_isprintPOSIX) #define u_ispunct U_ICU_ENTRY_POINT_RENAME(u_ispunct) #define u_isspace U_ICU_ENTRY_POINT_RENAME(u_isspace) #define u_istitle U_ICU_ENTRY_POINT_RENAME(u_istitle) #define u_isupper U_ICU_ENTRY_POINT_RENAME(u_isupper) #define u_isxdigit U_ICU_ENTRY_POINT_RENAME(u_isxdigit) #define u_lengthOfIdenticalLevelRun U_ICU_ENTRY_POINT_RENAME(u_lengthOfIdenticalLevelRun) #define u_locbund_close U_ICU_ENTRY_POINT_RENAME(u_locbund_close) #define u_locbund_getNumberFormat U_ICU_ENTRY_POINT_RENAME(u_locbund_getNumberFormat) #define u_locbund_init U_ICU_ENTRY_POINT_RENAME(u_locbund_init) #define u_memcasecmp U_ICU_ENTRY_POINT_RENAME(u_memcasecmp) #define u_memchr U_ICU_ENTRY_POINT_RENAME(u_memchr) #define u_memchr32 U_ICU_ENTRY_POINT_RENAME(u_memchr32) #define u_memcmp U_ICU_ENTRY_POINT_RENAME(u_memcmp) #define u_memcmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_memcmpCodePointOrder) #define u_memcpy U_ICU_ENTRY_POINT_RENAME(u_memcpy) #define u_memmove U_ICU_ENTRY_POINT_RENAME(u_memmove) #define u_memrchr U_ICU_ENTRY_POINT_RENAME(u_memrchr) #define u_memrchr32 U_ICU_ENTRY_POINT_RENAME(u_memrchr32) #define u_memset U_ICU_ENTRY_POINT_RENAME(u_memset) #define u_parseMessage U_ICU_ENTRY_POINT_RENAME(u_parseMessage) #define u_parseMessageWithError U_ICU_ENTRY_POINT_RENAME(u_parseMessageWithError) #define u_printf_parse U_ICU_ENTRY_POINT_RENAME(u_printf_parse) #define u_releaseDefaultConverter U_ICU_ENTRY_POINT_RENAME(u_releaseDefaultConverter) #define u_scanf_parse U_ICU_ENTRY_POINT_RENAME(u_scanf_parse) #define u_setAtomicIncDecFunctions U_ICU_ENTRY_POINT_RENAME(u_setAtomicIncDecFunctions) #define u_setDataDirectory U_ICU_ENTRY_POINT_RENAME(u_setDataDirectory) #define u_setMemoryFunctions U_ICU_ENTRY_POINT_RENAME(u_setMemoryFunctions) #define u_setMutexFunctions U_ICU_ENTRY_POINT_RENAME(u_setMutexFunctions) #define u_shapeArabic U_ICU_ENTRY_POINT_RENAME(u_shapeArabic) #define u_snprintf U_ICU_ENTRY_POINT_RENAME(u_snprintf) #define u_snprintf_u U_ICU_ENTRY_POINT_RENAME(u_snprintf_u) #define u_sprintf U_ICU_ENTRY_POINT_RENAME(u_sprintf) #define u_sprintf_u U_ICU_ENTRY_POINT_RENAME(u_sprintf_u) #define u_sscanf U_ICU_ENTRY_POINT_RENAME(u_sscanf) #define u_sscanf_u U_ICU_ENTRY_POINT_RENAME(u_sscanf_u) #define u_strCaseCompare U_ICU_ENTRY_POINT_RENAME(u_strCaseCompare) #define u_strCompare U_ICU_ENTRY_POINT_RENAME(u_strCompare) #define u_strCompareIter U_ICU_ENTRY_POINT_RENAME(u_strCompareIter) #define u_strFindFirst U_ICU_ENTRY_POINT_RENAME(u_strFindFirst) #define u_strFindLast U_ICU_ENTRY_POINT_RENAME(u_strFindLast) #define u_strFoldCase U_ICU_ENTRY_POINT_RENAME(u_strFoldCase) #define u_strFromJavaModifiedUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromJavaModifiedUTF8WithSub) #define u_strFromPunycode U_ICU_ENTRY_POINT_RENAME(u_strFromPunycode) #define u_strFromUTF32 U_ICU_ENTRY_POINT_RENAME(u_strFromUTF32) #define u_strFromUTF32WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromUTF32WithSub) #define u_strFromUTF8 U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8) #define u_strFromUTF8Lenient U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8Lenient) #define u_strFromUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strFromUTF8WithSub) #define u_strFromWCS U_ICU_ENTRY_POINT_RENAME(u_strFromWCS) #define u_strHasMoreChar32Than U_ICU_ENTRY_POINT_RENAME(u_strHasMoreChar32Than) #define u_strToJavaModifiedUTF8 U_ICU_ENTRY_POINT_RENAME(u_strToJavaModifiedUTF8) #define u_strToLower U_ICU_ENTRY_POINT_RENAME(u_strToLower) #define u_strToPunycode U_ICU_ENTRY_POINT_RENAME(u_strToPunycode) #define u_strToTitle U_ICU_ENTRY_POINT_RENAME(u_strToTitle) #define u_strToUTF32 U_ICU_ENTRY_POINT_RENAME(u_strToUTF32) #define u_strToUTF32WithSub U_ICU_ENTRY_POINT_RENAME(u_strToUTF32WithSub) #define u_strToUTF8 U_ICU_ENTRY_POINT_RENAME(u_strToUTF8) #define u_strToUTF8WithSub U_ICU_ENTRY_POINT_RENAME(u_strToUTF8WithSub) #define u_strToUpper U_ICU_ENTRY_POINT_RENAME(u_strToUpper) #define u_strToWCS U_ICU_ENTRY_POINT_RENAME(u_strToWCS) #define u_strcasecmp U_ICU_ENTRY_POINT_RENAME(u_strcasecmp) #define u_strcat U_ICU_ENTRY_POINT_RENAME(u_strcat) #define u_strchr U_ICU_ENTRY_POINT_RENAME(u_strchr) #define u_strchr32 U_ICU_ENTRY_POINT_RENAME(u_strchr32) #define u_strcmp U_ICU_ENTRY_POINT_RENAME(u_strcmp) #define u_strcmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_strcmpCodePointOrder) #define u_strcmpFold U_ICU_ENTRY_POINT_RENAME(u_strcmpFold) #define u_strcpy U_ICU_ENTRY_POINT_RENAME(u_strcpy) #define u_strcspn U_ICU_ENTRY_POINT_RENAME(u_strcspn) #define u_strlen U_ICU_ENTRY_POINT_RENAME(u_strlen) #define u_strncasecmp U_ICU_ENTRY_POINT_RENAME(u_strncasecmp) #define u_strncat U_ICU_ENTRY_POINT_RENAME(u_strncat) #define u_strncmp U_ICU_ENTRY_POINT_RENAME(u_strncmp) #define u_strncmpCodePointOrder U_ICU_ENTRY_POINT_RENAME(u_strncmpCodePointOrder) #define u_strncpy U_ICU_ENTRY_POINT_RENAME(u_strncpy) #define u_strpbrk U_ICU_ENTRY_POINT_RENAME(u_strpbrk) #define u_strrchr U_ICU_ENTRY_POINT_RENAME(u_strrchr) #define u_strrchr32 U_ICU_ENTRY_POINT_RENAME(u_strrchr32) #define u_strrstr U_ICU_ENTRY_POINT_RENAME(u_strrstr) #define u_strspn U_ICU_ENTRY_POINT_RENAME(u_strspn) #define u_strstr U_ICU_ENTRY_POINT_RENAME(u_strstr) #define u_strtok_r U_ICU_ENTRY_POINT_RENAME(u_strtok_r) #define u_terminateChars U_ICU_ENTRY_POINT_RENAME(u_terminateChars) #define u_terminateUChar32s U_ICU_ENTRY_POINT_RENAME(u_terminateUChar32s) #define u_terminateUChars U_ICU_ENTRY_POINT_RENAME(u_terminateUChars) #define u_terminateWChars U_ICU_ENTRY_POINT_RENAME(u_terminateWChars) #define u_tolower U_ICU_ENTRY_POINT_RENAME(u_tolower) #define u_totitle U_ICU_ENTRY_POINT_RENAME(u_totitle) #define u_toupper U_ICU_ENTRY_POINT_RENAME(u_toupper) #define u_uastrcpy U_ICU_ENTRY_POINT_RENAME(u_uastrcpy) #define u_uastrncpy U_ICU_ENTRY_POINT_RENAME(u_uastrncpy) #define u_unescape U_ICU_ENTRY_POINT_RENAME(u_unescape) #define u_unescapeAt U_ICU_ENTRY_POINT_RENAME(u_unescapeAt) #define u_versionFromString U_ICU_ENTRY_POINT_RENAME(u_versionFromString) #define u_versionFromUString U_ICU_ENTRY_POINT_RENAME(u_versionFromUString) #define u_versionToString U_ICU_ENTRY_POINT_RENAME(u_versionToString) #define u_vformatMessage U_ICU_ENTRY_POINT_RENAME(u_vformatMessage) #define u_vformatMessageWithError U_ICU_ENTRY_POINT_RENAME(u_vformatMessageWithError) #define u_vfprintf U_ICU_ENTRY_POINT_RENAME(u_vfprintf) #define u_vfprintf_u U_ICU_ENTRY_POINT_RENAME(u_vfprintf_u) #define u_vfscanf U_ICU_ENTRY_POINT_RENAME(u_vfscanf) #define u_vfscanf_u U_ICU_ENTRY_POINT_RENAME(u_vfscanf_u) #define u_vparseMessage U_ICU_ENTRY_POINT_RENAME(u_vparseMessage) #define u_vparseMessageWithError U_ICU_ENTRY_POINT_RENAME(u_vparseMessageWithError) #define u_vsnprintf U_ICU_ENTRY_POINT_RENAME(u_vsnprintf) #define u_vsnprintf_u U_ICU_ENTRY_POINT_RENAME(u_vsnprintf_u) #define u_vsprintf U_ICU_ENTRY_POINT_RENAME(u_vsprintf) #define u_vsprintf_u U_ICU_ENTRY_POINT_RENAME(u_vsprintf_u) #define u_vsscanf U_ICU_ENTRY_POINT_RENAME(u_vsscanf) #define u_vsscanf_u U_ICU_ENTRY_POINT_RENAME(u_vsscanf_u) #define u_writeDiff U_ICU_ENTRY_POINT_RENAME(u_writeDiff) #define u_writeIdenticalLevelRun U_ICU_ENTRY_POINT_RENAME(u_writeIdenticalLevelRun) #define u_writeIdenticalLevelRunTwoChars U_ICU_ENTRY_POINT_RENAME(u_writeIdenticalLevelRunTwoChars) #define ubidi_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(ubidi_addPropertyStarts) #define ubidi_close U_ICU_ENTRY_POINT_RENAME(ubidi_close) #define ubidi_countParagraphs U_ICU_ENTRY_POINT_RENAME(ubidi_countParagraphs) #define ubidi_countRuns U_ICU_ENTRY_POINT_RENAME(ubidi_countRuns) #define ubidi_getBaseDirection U_ICU_ENTRY_POINT_RENAME(ubidi_getBaseDirection) #define ubidi_getClass U_ICU_ENTRY_POINT_RENAME(ubidi_getClass) #define ubidi_getClassCallback U_ICU_ENTRY_POINT_RENAME(ubidi_getClassCallback) #define ubidi_getCustomizedClass U_ICU_ENTRY_POINT_RENAME(ubidi_getCustomizedClass) #define ubidi_getDirection U_ICU_ENTRY_POINT_RENAME(ubidi_getDirection) #define ubidi_getJoiningGroup U_ICU_ENTRY_POINT_RENAME(ubidi_getJoiningGroup) #define ubidi_getJoiningType U_ICU_ENTRY_POINT_RENAME(ubidi_getJoiningType) #define ubidi_getLength U_ICU_ENTRY_POINT_RENAME(ubidi_getLength) #define ubidi_getLevelAt U_ICU_ENTRY_POINT_RENAME(ubidi_getLevelAt) #define ubidi_getLevels U_ICU_ENTRY_POINT_RENAME(ubidi_getLevels) #define ubidi_getLogicalIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalIndex) #define ubidi_getLogicalMap U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalMap) #define ubidi_getLogicalRun U_ICU_ENTRY_POINT_RENAME(ubidi_getLogicalRun) #define ubidi_getMaxValue U_ICU_ENTRY_POINT_RENAME(ubidi_getMaxValue) #define ubidi_getMemory U_ICU_ENTRY_POINT_RENAME(ubidi_getMemory) #define ubidi_getMirror U_ICU_ENTRY_POINT_RENAME(ubidi_getMirror) #define ubidi_getParaLevel U_ICU_ENTRY_POINT_RENAME(ubidi_getParaLevel) #define ubidi_getParagraph U_ICU_ENTRY_POINT_RENAME(ubidi_getParagraph) #define ubidi_getParagraphByIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getParagraphByIndex) #define ubidi_getProcessedLength U_ICU_ENTRY_POINT_RENAME(ubidi_getProcessedLength) #define ubidi_getReorderingMode U_ICU_ENTRY_POINT_RENAME(ubidi_getReorderingMode) #define ubidi_getReorderingOptions U_ICU_ENTRY_POINT_RENAME(ubidi_getReorderingOptions) #define ubidi_getResultLength U_ICU_ENTRY_POINT_RENAME(ubidi_getResultLength) #define ubidi_getRuns U_ICU_ENTRY_POINT_RENAME(ubidi_getRuns) #define ubidi_getSingleton U_ICU_ENTRY_POINT_RENAME(ubidi_getSingleton) #define ubidi_getText U_ICU_ENTRY_POINT_RENAME(ubidi_getText) #define ubidi_getVisualIndex U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualIndex) #define ubidi_getVisualMap U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualMap) #define ubidi_getVisualRun U_ICU_ENTRY_POINT_RENAME(ubidi_getVisualRun) #define ubidi_invertMap U_ICU_ENTRY_POINT_RENAME(ubidi_invertMap) #define ubidi_isBidiControl U_ICU_ENTRY_POINT_RENAME(ubidi_isBidiControl) #define ubidi_isInverse U_ICU_ENTRY_POINT_RENAME(ubidi_isInverse) #define ubidi_isJoinControl U_ICU_ENTRY_POINT_RENAME(ubidi_isJoinControl) #define ubidi_isMirrored U_ICU_ENTRY_POINT_RENAME(ubidi_isMirrored) #define ubidi_isOrderParagraphsLTR U_ICU_ENTRY_POINT_RENAME(ubidi_isOrderParagraphsLTR) #define ubidi_open U_ICU_ENTRY_POINT_RENAME(ubidi_open) #define ubidi_openSized U_ICU_ENTRY_POINT_RENAME(ubidi_openSized) #define ubidi_orderParagraphsLTR U_ICU_ENTRY_POINT_RENAME(ubidi_orderParagraphsLTR) #define ubidi_reorderLogical U_ICU_ENTRY_POINT_RENAME(ubidi_reorderLogical) #define ubidi_reorderVisual U_ICU_ENTRY_POINT_RENAME(ubidi_reorderVisual) #define ubidi_setClassCallback U_ICU_ENTRY_POINT_RENAME(ubidi_setClassCallback) #define ubidi_setInverse U_ICU_ENTRY_POINT_RENAME(ubidi_setInverse) #define ubidi_setLine U_ICU_ENTRY_POINT_RENAME(ubidi_setLine) #define ubidi_setPara U_ICU_ENTRY_POINT_RENAME(ubidi_setPara) #define ubidi_setReorderingMode U_ICU_ENTRY_POINT_RENAME(ubidi_setReorderingMode) #define ubidi_setReorderingOptions U_ICU_ENTRY_POINT_RENAME(ubidi_setReorderingOptions) #define ubidi_writeReordered U_ICU_ENTRY_POINT_RENAME(ubidi_writeReordered) #define ubidi_writeReverse U_ICU_ENTRY_POINT_RENAME(ubidi_writeReverse) #define ublock_getCode U_ICU_ENTRY_POINT_RENAME(ublock_getCode) #define ubrk_close U_ICU_ENTRY_POINT_RENAME(ubrk_close) #define ubrk_countAvailable U_ICU_ENTRY_POINT_RENAME(ubrk_countAvailable) #define ubrk_current U_ICU_ENTRY_POINT_RENAME(ubrk_current) #define ubrk_first U_ICU_ENTRY_POINT_RENAME(ubrk_first) #define ubrk_following U_ICU_ENTRY_POINT_RENAME(ubrk_following) #define ubrk_getAvailable U_ICU_ENTRY_POINT_RENAME(ubrk_getAvailable) #define ubrk_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ubrk_getLocaleByType) #define ubrk_getRuleStatus U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatus) #define ubrk_getRuleStatusVec U_ICU_ENTRY_POINT_RENAME(ubrk_getRuleStatusVec) #define ubrk_isBoundary U_ICU_ENTRY_POINT_RENAME(ubrk_isBoundary) #define ubrk_last U_ICU_ENTRY_POINT_RENAME(ubrk_last) #define ubrk_next U_ICU_ENTRY_POINT_RENAME(ubrk_next) #define ubrk_open U_ICU_ENTRY_POINT_RENAME(ubrk_open) #define ubrk_openRules U_ICU_ENTRY_POINT_RENAME(ubrk_openRules) #define ubrk_preceding U_ICU_ENTRY_POINT_RENAME(ubrk_preceding) #define ubrk_previous U_ICU_ENTRY_POINT_RENAME(ubrk_previous) #define ubrk_safeClone U_ICU_ENTRY_POINT_RENAME(ubrk_safeClone) #define ubrk_setText U_ICU_ENTRY_POINT_RENAME(ubrk_setText) #define ubrk_setUText U_ICU_ENTRY_POINT_RENAME(ubrk_setUText) #define ubrk_swap U_ICU_ENTRY_POINT_RENAME(ubrk_swap) #define ucal_add U_ICU_ENTRY_POINT_RENAME(ucal_add) #define ucal_clear U_ICU_ENTRY_POINT_RENAME(ucal_clear) #define ucal_clearField U_ICU_ENTRY_POINT_RENAME(ucal_clearField) #define ucal_clone U_ICU_ENTRY_POINT_RENAME(ucal_clone) #define ucal_close U_ICU_ENTRY_POINT_RENAME(ucal_close) #define ucal_countAvailable U_ICU_ENTRY_POINT_RENAME(ucal_countAvailable) #define ucal_equivalentTo U_ICU_ENTRY_POINT_RENAME(ucal_equivalentTo) #define ucal_get U_ICU_ENTRY_POINT_RENAME(ucal_get) #define ucal_getAttribute U_ICU_ENTRY_POINT_RENAME(ucal_getAttribute) #define ucal_getAvailable U_ICU_ENTRY_POINT_RENAME(ucal_getAvailable) #define ucal_getCanonicalTimeZoneID U_ICU_ENTRY_POINT_RENAME(ucal_getCanonicalTimeZoneID) #define ucal_getDSTSavings U_ICU_ENTRY_POINT_RENAME(ucal_getDSTSavings) #define ucal_getDayOfWeekType U_ICU_ENTRY_POINT_RENAME(ucal_getDayOfWeekType) #define ucal_getDefaultTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_getDefaultTimeZone) #define ucal_getGregorianChange U_ICU_ENTRY_POINT_RENAME(ucal_getGregorianChange) #define ucal_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucal_getKeywordValuesForLocale) #define ucal_getLimit U_ICU_ENTRY_POINT_RENAME(ucal_getLimit) #define ucal_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ucal_getLocaleByType) #define ucal_getMillis U_ICU_ENTRY_POINT_RENAME(ucal_getMillis) #define ucal_getNow U_ICU_ENTRY_POINT_RENAME(ucal_getNow) #define ucal_getTZDataVersion U_ICU_ENTRY_POINT_RENAME(ucal_getTZDataVersion) #define ucal_getTimeZoneDisplayName U_ICU_ENTRY_POINT_RENAME(ucal_getTimeZoneDisplayName) #define ucal_getType U_ICU_ENTRY_POINT_RENAME(ucal_getType) #define ucal_getWeekendTransition U_ICU_ENTRY_POINT_RENAME(ucal_getWeekendTransition) #define ucal_inDaylightTime U_ICU_ENTRY_POINT_RENAME(ucal_inDaylightTime) #define ucal_isSet U_ICU_ENTRY_POINT_RENAME(ucal_isSet) #define ucal_isWeekend U_ICU_ENTRY_POINT_RENAME(ucal_isWeekend) #define ucal_open U_ICU_ENTRY_POINT_RENAME(ucal_open) #define ucal_openCountryTimeZones U_ICU_ENTRY_POINT_RENAME(ucal_openCountryTimeZones) #define ucal_openTimeZones U_ICU_ENTRY_POINT_RENAME(ucal_openTimeZones) #define ucal_roll U_ICU_ENTRY_POINT_RENAME(ucal_roll) #define ucal_set U_ICU_ENTRY_POINT_RENAME(ucal_set) #define ucal_setAttribute U_ICU_ENTRY_POINT_RENAME(ucal_setAttribute) #define ucal_setDate U_ICU_ENTRY_POINT_RENAME(ucal_setDate) #define ucal_setDateTime U_ICU_ENTRY_POINT_RENAME(ucal_setDateTime) #define ucal_setDefaultTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_setDefaultTimeZone) #define ucal_setGregorianChange U_ICU_ENTRY_POINT_RENAME(ucal_setGregorianChange) #define ucal_setMillis U_ICU_ENTRY_POINT_RENAME(ucal_setMillis) #define ucal_setTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_setTimeZone) #define ucase_addCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addCaseClosure) #define ucase_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(ucase_addPropertyStarts) #define ucase_addStringCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addStringCaseClosure) #define ucase_fold U_ICU_ENTRY_POINT_RENAME(ucase_fold) #define ucase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ucase_getCaseLocale) #define ucase_getSingleton U_ICU_ENTRY_POINT_RENAME(ucase_getSingleton) #define ucase_getType U_ICU_ENTRY_POINT_RENAME(ucase_getType) #define ucase_getTypeOrIgnorable U_ICU_ENTRY_POINT_RENAME(ucase_getTypeOrIgnorable) #define ucase_hasBinaryProperty U_ICU_ENTRY_POINT_RENAME(ucase_hasBinaryProperty) #define ucase_isCaseSensitive U_ICU_ENTRY_POINT_RENAME(ucase_isCaseSensitive) #define ucase_isSoftDotted U_ICU_ENTRY_POINT_RENAME(ucase_isSoftDotted) #define ucase_toFullFolding U_ICU_ENTRY_POINT_RENAME(ucase_toFullFolding) #define ucase_toFullLower U_ICU_ENTRY_POINT_RENAME(ucase_toFullLower) #define ucase_toFullTitle U_ICU_ENTRY_POINT_RENAME(ucase_toFullTitle) #define ucase_toFullUpper U_ICU_ENTRY_POINT_RENAME(ucase_toFullUpper) #define ucase_tolower U_ICU_ENTRY_POINT_RENAME(ucase_tolower) #define ucase_totitle U_ICU_ENTRY_POINT_RENAME(ucase_totitle) #define ucase_toupper U_ICU_ENTRY_POINT_RENAME(ucase_toupper) #define ucasemap_close U_ICU_ENTRY_POINT_RENAME(ucasemap_close) #define ucasemap_getBreakIterator U_ICU_ENTRY_POINT_RENAME(ucasemap_getBreakIterator) #define ucasemap_getLocale U_ICU_ENTRY_POINT_RENAME(ucasemap_getLocale) #define ucasemap_getOptions U_ICU_ENTRY_POINT_RENAME(ucasemap_getOptions) #define ucasemap_open U_ICU_ENTRY_POINT_RENAME(ucasemap_open) #define ucasemap_setBreakIterator U_ICU_ENTRY_POINT_RENAME(ucasemap_setBreakIterator) #define ucasemap_setLocale U_ICU_ENTRY_POINT_RENAME(ucasemap_setLocale) #define ucasemap_setOptions U_ICU_ENTRY_POINT_RENAME(ucasemap_setOptions) #define ucasemap_toTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_toTitle) #define ucasemap_utf8FoldCase U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8FoldCase) #define ucasemap_utf8ToLower U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToLower) #define ucasemap_utf8ToTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToTitle) #define ucasemap_utf8ToUpper U_ICU_ENTRY_POINT_RENAME(ucasemap_utf8ToUpper) #define ucd_close U_ICU_ENTRY_POINT_RENAME(ucd_close) #define ucd_flushCache U_ICU_ENTRY_POINT_RENAME(ucd_flushCache) #define ucd_freeCache U_ICU_ENTRY_POINT_RENAME(ucd_freeCache) #define ucd_getCollator U_ICU_ENTRY_POINT_RENAME(ucd_getCollator) #define ucd_open U_ICU_ENTRY_POINT_RENAME(ucd_open) #define uchar_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(uchar_addPropertyStarts) #define uchar_swapNames U_ICU_ENTRY_POINT_RENAME(uchar_swapNames) #define ucln_cleanupOne U_ICU_ENTRY_POINT_RENAME(ucln_cleanupOne) #define ucln_common_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_common_registerCleanup) #define ucln_i18n_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_i18n_registerCleanup) #define ucln_io_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_io_registerCleanup) #define ucln_lib_cleanup U_ICU_ENTRY_POINT_RENAME(ucln_lib_cleanup) #define ucln_registerCleanup U_ICU_ENTRY_POINT_RENAME(ucln_registerCleanup) #define ucnv_MBCSFromUChar32 U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSFromUChar32) #define ucnv_MBCSFromUnicodeWithOffsets U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSFromUnicodeWithOffsets) #define ucnv_MBCSGetFilteredUnicodeSetForUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetFilteredUnicodeSetForUnicode) #define ucnv_MBCSGetType U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetType) #define ucnv_MBCSGetUnicodeSetForUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSGetUnicodeSetForUnicode) #define ucnv_MBCSIsLeadByte U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSIsLeadByte) #define ucnv_MBCSSimpleGetNextUChar U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSSimpleGetNextUChar) #define ucnv_MBCSToUnicodeWithOffsets U_ICU_ENTRY_POINT_RENAME(ucnv_MBCSToUnicodeWithOffsets) #define ucnv_bld_countAvailableConverters U_ICU_ENTRY_POINT_RENAME(ucnv_bld_countAvailableConverters) #define ucnv_bld_getAvailableConverter U_ICU_ENTRY_POINT_RENAME(ucnv_bld_getAvailableConverter) #define ucnv_canCreateConverter U_ICU_ENTRY_POINT_RENAME(ucnv_canCreateConverter) #define ucnv_cbFromUWriteBytes U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteBytes) #define ucnv_cbFromUWriteSub U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteSub) #define ucnv_cbFromUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_cbFromUWriteUChars) #define ucnv_cbToUWriteSub U_ICU_ENTRY_POINT_RENAME(ucnv_cbToUWriteSub) #define ucnv_cbToUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_cbToUWriteUChars) #define ucnv_close U_ICU_ENTRY_POINT_RENAME(ucnv_close) #define ucnv_compareNames U_ICU_ENTRY_POINT_RENAME(ucnv_compareNames) #define ucnv_convert U_ICU_ENTRY_POINT_RENAME(ucnv_convert) #define ucnv_convertEx U_ICU_ENTRY_POINT_RENAME(ucnv_convertEx) #define ucnv_countAliases U_ICU_ENTRY_POINT_RENAME(ucnv_countAliases) #define ucnv_countAvailable U_ICU_ENTRY_POINT_RENAME(ucnv_countAvailable) #define ucnv_countStandards U_ICU_ENTRY_POINT_RENAME(ucnv_countStandards) #define ucnv_createAlgorithmicConverter U_ICU_ENTRY_POINT_RENAME(ucnv_createAlgorithmicConverter) #define ucnv_createConverter U_ICU_ENTRY_POINT_RENAME(ucnv_createConverter) #define ucnv_createConverterFromPackage U_ICU_ENTRY_POINT_RENAME(ucnv_createConverterFromPackage) #define ucnv_createConverterFromSharedData U_ICU_ENTRY_POINT_RENAME(ucnv_createConverterFromSharedData) #define ucnv_detectUnicodeSignature U_ICU_ENTRY_POINT_RENAME(ucnv_detectUnicodeSignature) #define ucnv_extContinueMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extContinueMatchFromU) #define ucnv_extContinueMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extContinueMatchToU) #define ucnv_extGetUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_extGetUnicodeSet) #define ucnv_extInitialMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extInitialMatchFromU) #define ucnv_extInitialMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extInitialMatchToU) #define ucnv_extSimpleMatchFromU U_ICU_ENTRY_POINT_RENAME(ucnv_extSimpleMatchFromU) #define ucnv_extSimpleMatchToU U_ICU_ENTRY_POINT_RENAME(ucnv_extSimpleMatchToU) #define ucnv_fixFileSeparator U_ICU_ENTRY_POINT_RENAME(ucnv_fixFileSeparator) #define ucnv_flushCache U_ICU_ENTRY_POINT_RENAME(ucnv_flushCache) #define ucnv_fromAlgorithmic U_ICU_ENTRY_POINT_RENAME(ucnv_fromAlgorithmic) #define ucnv_fromUChars U_ICU_ENTRY_POINT_RENAME(ucnv_fromUChars) #define ucnv_fromUCountPending U_ICU_ENTRY_POINT_RENAME(ucnv_fromUCountPending) #define ucnv_fromUWriteBytes U_ICU_ENTRY_POINT_RENAME(ucnv_fromUWriteBytes) #define ucnv_fromUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode) #define ucnv_fromUnicode_UTF8 U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode_UTF8) #define ucnv_fromUnicode_UTF8_OFFSETS_LOGIC U_ICU_ENTRY_POINT_RENAME(ucnv_fromUnicode_UTF8_OFFSETS_LOGIC) #define ucnv_getAlias U_ICU_ENTRY_POINT_RENAME(ucnv_getAlias) #define ucnv_getAliases U_ICU_ENTRY_POINT_RENAME(ucnv_getAliases) #define ucnv_getAvailableName U_ICU_ENTRY_POINT_RENAME(ucnv_getAvailableName) #define ucnv_getCCSID U_ICU_ENTRY_POINT_RENAME(ucnv_getCCSID) #define ucnv_getCanonicalName U_ICU_ENTRY_POINT_RENAME(ucnv_getCanonicalName) #define ucnv_getCompleteUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getCompleteUnicodeSet) #define ucnv_getDefaultName U_ICU_ENTRY_POINT_RENAME(ucnv_getDefaultName) #define ucnv_getDisplayName U_ICU_ENTRY_POINT_RENAME(ucnv_getDisplayName) #define ucnv_getFromUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_getFromUCallBack) #define ucnv_getInvalidChars U_ICU_ENTRY_POINT_RENAME(ucnv_getInvalidChars) #define ucnv_getInvalidUChars U_ICU_ENTRY_POINT_RENAME(ucnv_getInvalidUChars) #define ucnv_getMaxCharSize U_ICU_ENTRY_POINT_RENAME(ucnv_getMaxCharSize) #define ucnv_getMinCharSize U_ICU_ENTRY_POINT_RENAME(ucnv_getMinCharSize) #define ucnv_getName U_ICU_ENTRY_POINT_RENAME(ucnv_getName) #define ucnv_getNextUChar U_ICU_ENTRY_POINT_RENAME(ucnv_getNextUChar) #define ucnv_getNonSurrogateUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getNonSurrogateUnicodeSet) #define ucnv_getPlatform U_ICU_ENTRY_POINT_RENAME(ucnv_getPlatform) #define ucnv_getStandard U_ICU_ENTRY_POINT_RENAME(ucnv_getStandard) #define ucnv_getStandardName U_ICU_ENTRY_POINT_RENAME(ucnv_getStandardName) #define ucnv_getStarters U_ICU_ENTRY_POINT_RENAME(ucnv_getStarters) #define ucnv_getSubstChars U_ICU_ENTRY_POINT_RENAME(ucnv_getSubstChars) #define ucnv_getToUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_getToUCallBack) #define ucnv_getType U_ICU_ENTRY_POINT_RENAME(ucnv_getType) #define ucnv_getUnicodeSet U_ICU_ENTRY_POINT_RENAME(ucnv_getUnicodeSet) #define ucnv_incrementRefCount U_ICU_ENTRY_POINT_RENAME(ucnv_incrementRefCount) #define ucnv_io_countKnownConverters U_ICU_ENTRY_POINT_RENAME(ucnv_io_countKnownConverters) #define ucnv_io_getConverterName U_ICU_ENTRY_POINT_RENAME(ucnv_io_getConverterName) #define ucnv_io_stripASCIIForCompare U_ICU_ENTRY_POINT_RENAME(ucnv_io_stripASCIIForCompare) #define ucnv_io_stripEBCDICForCompare U_ICU_ENTRY_POINT_RENAME(ucnv_io_stripEBCDICForCompare) #define ucnv_isAmbiguous U_ICU_ENTRY_POINT_RENAME(ucnv_isAmbiguous) #define ucnv_load U_ICU_ENTRY_POINT_RENAME(ucnv_load) #define ucnv_loadSharedData U_ICU_ENTRY_POINT_RENAME(ucnv_loadSharedData) #define ucnv_open U_ICU_ENTRY_POINT_RENAME(ucnv_open) #define ucnv_openAllNames U_ICU_ENTRY_POINT_RENAME(ucnv_openAllNames) #define ucnv_openCCSID U_ICU_ENTRY_POINT_RENAME(ucnv_openCCSID) #define ucnv_openPackage U_ICU_ENTRY_POINT_RENAME(ucnv_openPackage) #define ucnv_openStandardNames U_ICU_ENTRY_POINT_RENAME(ucnv_openStandardNames) #define ucnv_openU U_ICU_ENTRY_POINT_RENAME(ucnv_openU) #define ucnv_reset U_ICU_ENTRY_POINT_RENAME(ucnv_reset) #define ucnv_resetFromUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_resetFromUnicode) #define ucnv_resetToUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_resetToUnicode) #define ucnv_safeClone U_ICU_ENTRY_POINT_RENAME(ucnv_safeClone) #define ucnv_setDefaultName U_ICU_ENTRY_POINT_RENAME(ucnv_setDefaultName) #define ucnv_setFallback U_ICU_ENTRY_POINT_RENAME(ucnv_setFallback) #define ucnv_setFromUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_setFromUCallBack) #define ucnv_setSubstChars U_ICU_ENTRY_POINT_RENAME(ucnv_setSubstChars) #define ucnv_setSubstString U_ICU_ENTRY_POINT_RENAME(ucnv_setSubstString) #define ucnv_setToUCallBack U_ICU_ENTRY_POINT_RENAME(ucnv_setToUCallBack) #define ucnv_swap U_ICU_ENTRY_POINT_RENAME(ucnv_swap) #define ucnv_swapAliases U_ICU_ENTRY_POINT_RENAME(ucnv_swapAliases) #define ucnv_toAlgorithmic U_ICU_ENTRY_POINT_RENAME(ucnv_toAlgorithmic) #define ucnv_toUChars U_ICU_ENTRY_POINT_RENAME(ucnv_toUChars) #define ucnv_toUCountPending U_ICU_ENTRY_POINT_RENAME(ucnv_toUCountPending) #define ucnv_toUWriteCodePoint U_ICU_ENTRY_POINT_RENAME(ucnv_toUWriteCodePoint) #define ucnv_toUWriteUChars U_ICU_ENTRY_POINT_RENAME(ucnv_toUWriteUChars) #define ucnv_toUnicode U_ICU_ENTRY_POINT_RENAME(ucnv_toUnicode) #define ucnv_unload U_ICU_ENTRY_POINT_RENAME(ucnv_unload) #define ucnv_unloadSharedDataIfReady U_ICU_ENTRY_POINT_RENAME(ucnv_unloadSharedDataIfReady) #define ucnv_usesFallback U_ICU_ENTRY_POINT_RENAME(ucnv_usesFallback) #define ucnvsel_close U_ICU_ENTRY_POINT_RENAME(ucnvsel_close) #define ucnvsel_open U_ICU_ENTRY_POINT_RENAME(ucnvsel_open) #define ucnvsel_openFromSerialized U_ICU_ENTRY_POINT_RENAME(ucnvsel_openFromSerialized) #define ucnvsel_selectForString U_ICU_ENTRY_POINT_RENAME(ucnvsel_selectForString) #define ucnvsel_selectForUTF8 U_ICU_ENTRY_POINT_RENAME(ucnvsel_selectForUTF8) #define ucnvsel_serialize U_ICU_ENTRY_POINT_RENAME(ucnvsel_serialize) #define ucol_allocWeights U_ICU_ENTRY_POINT_RENAME(ucol_allocWeights) #define ucol_assembleTailoringTable U_ICU_ENTRY_POINT_RENAME(ucol_assembleTailoringTable) #define ucol_buildPermutationTable U_ICU_ENTRY_POINT_RENAME(ucol_buildPermutationTable) #define ucol_calcSortKey U_ICU_ENTRY_POINT_RENAME(ucol_calcSortKey) #define ucol_calcSortKeySimpleTertiary U_ICU_ENTRY_POINT_RENAME(ucol_calcSortKeySimpleTertiary) #define ucol_cloneBinary U_ICU_ENTRY_POINT_RENAME(ucol_cloneBinary) #define ucol_cloneRuleData U_ICU_ENTRY_POINT_RENAME(ucol_cloneRuleData) #define ucol_close U_ICU_ENTRY_POINT_RENAME(ucol_close) #define ucol_closeElements U_ICU_ENTRY_POINT_RENAME(ucol_closeElements) #define ucol_countAvailable U_ICU_ENTRY_POINT_RENAME(ucol_countAvailable) #define ucol_createElements U_ICU_ENTRY_POINT_RENAME(ucol_createElements) #define ucol_doCE U_ICU_ENTRY_POINT_RENAME(ucol_doCE) #define ucol_equal U_ICU_ENTRY_POINT_RENAME(ucol_equal) #define ucol_equals U_ICU_ENTRY_POINT_RENAME(ucol_equals) #define ucol_findReorderingEntry U_ICU_ENTRY_POINT_RENAME(ucol_findReorderingEntry) #define ucol_forceHanImplicit U_ICU_ENTRY_POINT_RENAME(ucol_forceHanImplicit) #define ucol_forgetUCA U_ICU_ENTRY_POINT_RENAME(ucol_forgetUCA) #define ucol_freeOffsetBuffer U_ICU_ENTRY_POINT_RENAME(ucol_freeOffsetBuffer) #define ucol_getAttribute U_ICU_ENTRY_POINT_RENAME(ucol_getAttribute) #define ucol_getAttributeOrDefault U_ICU_ENTRY_POINT_RENAME(ucol_getAttributeOrDefault) #define ucol_getAvailable U_ICU_ENTRY_POINT_RENAME(ucol_getAvailable) #define ucol_getBound U_ICU_ENTRY_POINT_RENAME(ucol_getBound) #define ucol_getCEStrengthDifference U_ICU_ENTRY_POINT_RENAME(ucol_getCEStrengthDifference) #define ucol_getContractions U_ICU_ENTRY_POINT_RENAME(ucol_getContractions) #define ucol_getContractionsAndExpansions U_ICU_ENTRY_POINT_RENAME(ucol_getContractionsAndExpansions) #define ucol_getDisplayName U_ICU_ENTRY_POINT_RENAME(ucol_getDisplayName) #define ucol_getFirstCE U_ICU_ENTRY_POINT_RENAME(ucol_getFirstCE) #define ucol_getFunctionalEquivalent U_ICU_ENTRY_POINT_RENAME(ucol_getFunctionalEquivalent) #define ucol_getKeywordValues U_ICU_ENTRY_POINT_RENAME(ucol_getKeywordValues) #define ucol_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucol_getKeywordValuesForLocale) #define ucol_getKeywords U_ICU_ENTRY_POINT_RENAME(ucol_getKeywords) #define ucol_getLeadBytesForReorderCode U_ICU_ENTRY_POINT_RENAME(ucol_getLeadBytesForReorderCode) #define ucol_getLocale U_ICU_ENTRY_POINT_RENAME(ucol_getLocale) #define ucol_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ucol_getLocaleByType) #define ucol_getMaxExpansion U_ICU_ENTRY_POINT_RENAME(ucol_getMaxExpansion) #define ucol_getNextCE U_ICU_ENTRY_POINT_RENAME(ucol_getNextCE) #define ucol_getOffset U_ICU_ENTRY_POINT_RENAME(ucol_getOffset) #define ucol_getPrevCE U_ICU_ENTRY_POINT_RENAME(ucol_getPrevCE) #define ucol_getReorderCodes U_ICU_ENTRY_POINT_RENAME(ucol_getReorderCodes) #define ucol_getReorderCodesForLeadByte U_ICU_ENTRY_POINT_RENAME(ucol_getReorderCodesForLeadByte) #define ucol_getRules U_ICU_ENTRY_POINT_RENAME(ucol_getRules) #define ucol_getRulesEx U_ICU_ENTRY_POINT_RENAME(ucol_getRulesEx) #define ucol_getShortDefinitionString U_ICU_ENTRY_POINT_RENAME(ucol_getShortDefinitionString) #define ucol_getSortKey U_ICU_ENTRY_POINT_RENAME(ucol_getSortKey) #define ucol_getSortKeySize U_ICU_ENTRY_POINT_RENAME(ucol_getSortKeySize) #define ucol_getSortKeyWithAllocation U_ICU_ENTRY_POINT_RENAME(ucol_getSortKeyWithAllocation) #define ucol_getStrength U_ICU_ENTRY_POINT_RENAME(ucol_getStrength) #define ucol_getTailoredSet U_ICU_ENTRY_POINT_RENAME(ucol_getTailoredSet) #define ucol_getUCAVersion U_ICU_ENTRY_POINT_RENAME(ucol_getUCAVersion) #define ucol_getUnsafeSet U_ICU_ENTRY_POINT_RENAME(ucol_getUnsafeSet) #define ucol_getVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_getVariableTop) #define ucol_getVersion U_ICU_ENTRY_POINT_RENAME(ucol_getVersion) #define ucol_greater U_ICU_ENTRY_POINT_RENAME(ucol_greater) #define ucol_greaterOrEqual U_ICU_ENTRY_POINT_RENAME(ucol_greaterOrEqual) #define ucol_initBuffers U_ICU_ENTRY_POINT_RENAME(ucol_initBuffers) #define ucol_initCollator U_ICU_ENTRY_POINT_RENAME(ucol_initCollator) #define ucol_initInverseUCA U_ICU_ENTRY_POINT_RENAME(ucol_initInverseUCA) #define ucol_initUCA U_ICU_ENTRY_POINT_RENAME(ucol_initUCA) #define ucol_inv_getNextCE U_ICU_ENTRY_POINT_RENAME(ucol_inv_getNextCE) #define ucol_inv_getPrevCE U_ICU_ENTRY_POINT_RENAME(ucol_inv_getPrevCE) #define ucol_isTailored U_ICU_ENTRY_POINT_RENAME(ucol_isTailored) #define ucol_keyHashCode U_ICU_ENTRY_POINT_RENAME(ucol_keyHashCode) #define ucol_looksLikeCollationBinary U_ICU_ENTRY_POINT_RENAME(ucol_looksLikeCollationBinary) #define ucol_mergeSortkeys U_ICU_ENTRY_POINT_RENAME(ucol_mergeSortkeys) #define ucol_next U_ICU_ENTRY_POINT_RENAME(ucol_next) #define ucol_nextProcessed U_ICU_ENTRY_POINT_RENAME(ucol_nextProcessed) #define ucol_nextSortKeyPart U_ICU_ENTRY_POINT_RENAME(ucol_nextSortKeyPart) #define ucol_nextWeight U_ICU_ENTRY_POINT_RENAME(ucol_nextWeight) #define ucol_normalizeShortDefinitionString U_ICU_ENTRY_POINT_RENAME(ucol_normalizeShortDefinitionString) #define ucol_open U_ICU_ENTRY_POINT_RENAME(ucol_open) #define ucol_openAvailableLocales U_ICU_ENTRY_POINT_RENAME(ucol_openAvailableLocales) #define ucol_openBinary U_ICU_ENTRY_POINT_RENAME(ucol_openBinary) #define ucol_openElements U_ICU_ENTRY_POINT_RENAME(ucol_openElements) #define ucol_openFromShortString U_ICU_ENTRY_POINT_RENAME(ucol_openFromShortString) #define ucol_openRules U_ICU_ENTRY_POINT_RENAME(ucol_openRules) #define ucol_openRulesForImport U_ICU_ENTRY_POINT_RENAME(ucol_openRulesForImport) #define ucol_open_internal U_ICU_ENTRY_POINT_RENAME(ucol_open_internal) #define ucol_prepareShortStringOpen U_ICU_ENTRY_POINT_RENAME(ucol_prepareShortStringOpen) #define ucol_previous U_ICU_ENTRY_POINT_RENAME(ucol_previous) #define ucol_previousProcessed U_ICU_ENTRY_POINT_RENAME(ucol_previousProcessed) #define ucol_primaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_primaryOrder) #define ucol_prv_getSpecialCE U_ICU_ENTRY_POINT_RENAME(ucol_prv_getSpecialCE) #define ucol_prv_getSpecialPrevCE U_ICU_ENTRY_POINT_RENAME(ucol_prv_getSpecialPrevCE) #define ucol_reset U_ICU_ENTRY_POINT_RENAME(ucol_reset) #define ucol_restoreVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_restoreVariableTop) #define ucol_safeClone U_ICU_ENTRY_POINT_RENAME(ucol_safeClone) #define ucol_secondaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_secondaryOrder) #define ucol_setAttribute U_ICU_ENTRY_POINT_RENAME(ucol_setAttribute) #define ucol_setOffset U_ICU_ENTRY_POINT_RENAME(ucol_setOffset) #define ucol_setOptionsFromHeader U_ICU_ENTRY_POINT_RENAME(ucol_setOptionsFromHeader) #define ucol_setReorderCodes U_ICU_ENTRY_POINT_RENAME(ucol_setReorderCodes) #define ucol_setReqValidLocales U_ICU_ENTRY_POINT_RENAME(ucol_setReqValidLocales) #define ucol_setStrength U_ICU_ENTRY_POINT_RENAME(ucol_setStrength) #define ucol_setText U_ICU_ENTRY_POINT_RENAME(ucol_setText) #define ucol_setVariableTop U_ICU_ENTRY_POINT_RENAME(ucol_setVariableTop) #define ucol_strcoll U_ICU_ENTRY_POINT_RENAME(ucol_strcoll) #define ucol_strcollIter U_ICU_ENTRY_POINT_RENAME(ucol_strcollIter) #define ucol_swap U_ICU_ENTRY_POINT_RENAME(ucol_swap) #define ucol_swapBinary U_ICU_ENTRY_POINT_RENAME(ucol_swapBinary) #define ucol_swapInverseUCA U_ICU_ENTRY_POINT_RENAME(ucol_swapInverseUCA) #define ucol_tertiaryOrder U_ICU_ENTRY_POINT_RENAME(ucol_tertiaryOrder) #define ucol_tok_assembleTokenList U_ICU_ENTRY_POINT_RENAME(ucol_tok_assembleTokenList) #define ucol_tok_closeTokenList U_ICU_ENTRY_POINT_RENAME(ucol_tok_closeTokenList) #define ucol_tok_getNextArgument U_ICU_ENTRY_POINT_RENAME(ucol_tok_getNextArgument) #define ucol_tok_getRulesFromBundle U_ICU_ENTRY_POINT_RENAME(ucol_tok_getRulesFromBundle) #define ucol_tok_initTokenList U_ICU_ENTRY_POINT_RENAME(ucol_tok_initTokenList) #define ucol_tok_parseNextToken U_ICU_ENTRY_POINT_RENAME(ucol_tok_parseNextToken) #define ucol_updateInternalState U_ICU_ENTRY_POINT_RENAME(ucol_updateInternalState) #define ucsdet_close U_ICU_ENTRY_POINT_RENAME(ucsdet_close) #define ucsdet_detect U_ICU_ENTRY_POINT_RENAME(ucsdet_detect) #define ucsdet_detectAll U_ICU_ENTRY_POINT_RENAME(ucsdet_detectAll) #define ucsdet_enableInputFilter U_ICU_ENTRY_POINT_RENAME(ucsdet_enableInputFilter) #define ucsdet_getAllDetectableCharsets U_ICU_ENTRY_POINT_RENAME(ucsdet_getAllDetectableCharsets) #define ucsdet_getConfidence U_ICU_ENTRY_POINT_RENAME(ucsdet_getConfidence) #define ucsdet_getLanguage U_ICU_ENTRY_POINT_RENAME(ucsdet_getLanguage) #define ucsdet_getName U_ICU_ENTRY_POINT_RENAME(ucsdet_getName) #define ucsdet_getUChars U_ICU_ENTRY_POINT_RENAME(ucsdet_getUChars) #define ucsdet_isInputFilterEnabled U_ICU_ENTRY_POINT_RENAME(ucsdet_isInputFilterEnabled) #define ucsdet_open U_ICU_ENTRY_POINT_RENAME(ucsdet_open) #define ucsdet_setDeclaredEncoding U_ICU_ENTRY_POINT_RENAME(ucsdet_setDeclaredEncoding) #define ucsdet_setText U_ICU_ENTRY_POINT_RENAME(ucsdet_setText) #define ucurr_countCurrencies U_ICU_ENTRY_POINT_RENAME(ucurr_countCurrencies) #define ucurr_forLocale U_ICU_ENTRY_POINT_RENAME(ucurr_forLocale) #define ucurr_forLocaleAndDate U_ICU_ENTRY_POINT_RENAME(ucurr_forLocaleAndDate) #define ucurr_getDefaultFractionDigits U_ICU_ENTRY_POINT_RENAME(ucurr_getDefaultFractionDigits) #define ucurr_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucurr_getKeywordValuesForLocale) #define ucurr_getName U_ICU_ENTRY_POINT_RENAME(ucurr_getName) #define ucurr_getPluralName U_ICU_ENTRY_POINT_RENAME(ucurr_getPluralName) #define ucurr_getRoundingIncrement U_ICU_ENTRY_POINT_RENAME(ucurr_getRoundingIncrement) #define ucurr_openISOCurrencies U_ICU_ENTRY_POINT_RENAME(ucurr_openISOCurrencies) #define ucurr_register U_ICU_ENTRY_POINT_RENAME(ucurr_register) #define ucurr_unregister U_ICU_ENTRY_POINT_RENAME(ucurr_unregister) #define udat_applyPattern U_ICU_ENTRY_POINT_RENAME(udat_applyPattern) #define udat_applyPatternRelative U_ICU_ENTRY_POINT_RENAME(udat_applyPatternRelative) #define udat_clone U_ICU_ENTRY_POINT_RENAME(udat_clone) #define udat_close U_ICU_ENTRY_POINT_RENAME(udat_close) #define udat_countAvailable U_ICU_ENTRY_POINT_RENAME(udat_countAvailable) #define udat_countSymbols U_ICU_ENTRY_POINT_RENAME(udat_countSymbols) #define udat_format U_ICU_ENTRY_POINT_RENAME(udat_format) #define udat_get2DigitYearStart U_ICU_ENTRY_POINT_RENAME(udat_get2DigitYearStart) #define udat_getAvailable U_ICU_ENTRY_POINT_RENAME(udat_getAvailable) #define udat_getCalendar U_ICU_ENTRY_POINT_RENAME(udat_getCalendar) #define udat_getLocaleByType U_ICU_ENTRY_POINT_RENAME(udat_getLocaleByType) #define udat_getNumberFormat U_ICU_ENTRY_POINT_RENAME(udat_getNumberFormat) #define udat_getSymbols U_ICU_ENTRY_POINT_RENAME(udat_getSymbols) #define udat_isLenient U_ICU_ENTRY_POINT_RENAME(udat_isLenient) #define udat_open U_ICU_ENTRY_POINT_RENAME(udat_open) #define udat_parse U_ICU_ENTRY_POINT_RENAME(udat_parse) #define udat_parseCalendar U_ICU_ENTRY_POINT_RENAME(udat_parseCalendar) #define udat_set2DigitYearStart U_ICU_ENTRY_POINT_RENAME(udat_set2DigitYearStart) #define udat_setCalendar U_ICU_ENTRY_POINT_RENAME(udat_setCalendar) #define udat_setLenient U_ICU_ENTRY_POINT_RENAME(udat_setLenient) #define udat_setNumberFormat U_ICU_ENTRY_POINT_RENAME(udat_setNumberFormat) #define udat_setSymbols U_ICU_ENTRY_POINT_RENAME(udat_setSymbols) #define udat_toCalendarDateField U_ICU_ENTRY_POINT_RENAME(udat_toCalendarDateField) #define udat_toPattern U_ICU_ENTRY_POINT_RENAME(udat_toPattern) #define udat_toPatternRelativeDate U_ICU_ENTRY_POINT_RENAME(udat_toPatternRelativeDate) #define udat_toPatternRelativeTime U_ICU_ENTRY_POINT_RENAME(udat_toPatternRelativeTime) #define udata_checkCommonData U_ICU_ENTRY_POINT_RENAME(udata_checkCommonData) #define udata_close U_ICU_ENTRY_POINT_RENAME(udata_close) #define udata_closeSwapper U_ICU_ENTRY_POINT_RENAME(udata_closeSwapper) #define udata_getHeaderSize U_ICU_ENTRY_POINT_RENAME(udata_getHeaderSize) #define udata_getInfo U_ICU_ENTRY_POINT_RENAME(udata_getInfo) #define udata_getInfoSize U_ICU_ENTRY_POINT_RENAME(udata_getInfoSize) #define udata_getLength U_ICU_ENTRY_POINT_RENAME(udata_getLength) #define udata_getMemory U_ICU_ENTRY_POINT_RENAME(udata_getMemory) #define udata_getRawMemory U_ICU_ENTRY_POINT_RENAME(udata_getRawMemory) #define udata_open U_ICU_ENTRY_POINT_RENAME(udata_open) #define udata_openChoice U_ICU_ENTRY_POINT_RENAME(udata_openChoice) #define udata_openSwapper U_ICU_ENTRY_POINT_RENAME(udata_openSwapper) #define udata_openSwapperForInputData U_ICU_ENTRY_POINT_RENAME(udata_openSwapperForInputData) #define udata_printError U_ICU_ENTRY_POINT_RENAME(udata_printError) #define udata_readInt16 U_ICU_ENTRY_POINT_RENAME(udata_readInt16) #define udata_readInt32 U_ICU_ENTRY_POINT_RENAME(udata_readInt32) #define udata_setAppData U_ICU_ENTRY_POINT_RENAME(udata_setAppData) #define udata_setCommonData U_ICU_ENTRY_POINT_RENAME(udata_setCommonData) #define udata_setFileAccess U_ICU_ENTRY_POINT_RENAME(udata_setFileAccess) #define udata_swapDataHeader U_ICU_ENTRY_POINT_RENAME(udata_swapDataHeader) #define udata_swapInvStringBlock U_ICU_ENTRY_POINT_RENAME(udata_swapInvStringBlock) #define udatpg_addPattern U_ICU_ENTRY_POINT_RENAME(udatpg_addPattern) #define udatpg_clone U_ICU_ENTRY_POINT_RENAME(udatpg_clone) #define udatpg_close U_ICU_ENTRY_POINT_RENAME(udatpg_close) #define udatpg_getAppendItemFormat U_ICU_ENTRY_POINT_RENAME(udatpg_getAppendItemFormat) #define udatpg_getAppendItemName U_ICU_ENTRY_POINT_RENAME(udatpg_getAppendItemName) #define udatpg_getBaseSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getBaseSkeleton) #define udatpg_getBestPattern U_ICU_ENTRY_POINT_RENAME(udatpg_getBestPattern) #define udatpg_getBestPatternWithOptions U_ICU_ENTRY_POINT_RENAME(udatpg_getBestPatternWithOptions) #define udatpg_getDateTimeFormat U_ICU_ENTRY_POINT_RENAME(udatpg_getDateTimeFormat) #define udatpg_getDecimal U_ICU_ENTRY_POINT_RENAME(udatpg_getDecimal) #define udatpg_getPatternForSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getPatternForSkeleton) #define udatpg_getSkeleton U_ICU_ENTRY_POINT_RENAME(udatpg_getSkeleton) #define udatpg_open U_ICU_ENTRY_POINT_RENAME(udatpg_open) #define udatpg_openBaseSkeletons U_ICU_ENTRY_POINT_RENAME(udatpg_openBaseSkeletons) #define udatpg_openEmpty U_ICU_ENTRY_POINT_RENAME(udatpg_openEmpty) #define udatpg_openSkeletons U_ICU_ENTRY_POINT_RENAME(udatpg_openSkeletons) #define udatpg_replaceFieldTypes U_ICU_ENTRY_POINT_RENAME(udatpg_replaceFieldTypes) #define udatpg_replaceFieldTypesWithOptions U_ICU_ENTRY_POINT_RENAME(udatpg_replaceFieldTypesWithOptions) #define udatpg_setAppendItemFormat U_ICU_ENTRY_POINT_RENAME(udatpg_setAppendItemFormat) #define udatpg_setAppendItemName U_ICU_ENTRY_POINT_RENAME(udatpg_setAppendItemName) #define udatpg_setDateTimeFormat U_ICU_ENTRY_POINT_RENAME(udatpg_setDateTimeFormat) #define udatpg_setDecimal U_ICU_ENTRY_POINT_RENAME(udatpg_setDecimal) #define uenum_close U_ICU_ENTRY_POINT_RENAME(uenum_close) #define uenum_count U_ICU_ENTRY_POINT_RENAME(uenum_count) #define uenum_next U_ICU_ENTRY_POINT_RENAME(uenum_next) #define uenum_nextDefault U_ICU_ENTRY_POINT_RENAME(uenum_nextDefault) #define uenum_openCharStringsEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openCharStringsEnumeration) #define uenum_openFromStringEnumeration U_ICU_ENTRY_POINT_RENAME(uenum_openFromStringEnumeration) #define uenum_reset U_ICU_ENTRY_POINT_RENAME(uenum_reset) #define uenum_unext U_ICU_ENTRY_POINT_RENAME(uenum_unext) #define uenum_unextDefault U_ICU_ENTRY_POINT_RENAME(uenum_unextDefault) #define ufile_close_translit U_ICU_ENTRY_POINT_RENAME(ufile_close_translit) #define ufile_fill_uchar_buffer U_ICU_ENTRY_POINT_RENAME(ufile_fill_uchar_buffer) #define ufile_flush_io U_ICU_ENTRY_POINT_RENAME(ufile_flush_io) #define ufile_flush_translit U_ICU_ENTRY_POINT_RENAME(ufile_flush_translit) #define ufile_getch U_ICU_ENTRY_POINT_RENAME(ufile_getch) #define ufile_getch32 U_ICU_ENTRY_POINT_RENAME(ufile_getch32) #define ufmt_64tou U_ICU_ENTRY_POINT_RENAME(ufmt_64tou) #define ufmt_defaultCPToUnicode U_ICU_ENTRY_POINT_RENAME(ufmt_defaultCPToUnicode) #define ufmt_digitvalue U_ICU_ENTRY_POINT_RENAME(ufmt_digitvalue) #define ufmt_isdigit U_ICU_ENTRY_POINT_RENAME(ufmt_isdigit) #define ufmt_ptou U_ICU_ENTRY_POINT_RENAME(ufmt_ptou) #define ufmt_uto64 U_ICU_ENTRY_POINT_RENAME(ufmt_uto64) #define ufmt_utop U_ICU_ENTRY_POINT_RENAME(ufmt_utop) #define uhash_close U_ICU_ENTRY_POINT_RENAME(uhash_close) #define uhash_compareCaselessUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_compareCaselessUnicodeString) #define uhash_compareChars U_ICU_ENTRY_POINT_RENAME(uhash_compareChars) #define uhash_compareIChars U_ICU_ENTRY_POINT_RENAME(uhash_compareIChars) #define uhash_compareLong U_ICU_ENTRY_POINT_RENAME(uhash_compareLong) #define uhash_compareUChars U_ICU_ENTRY_POINT_RENAME(uhash_compareUChars) #define uhash_compareUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_compareUnicodeString) #define uhash_count U_ICU_ENTRY_POINT_RENAME(uhash_count) #define uhash_deleteHashtable U_ICU_ENTRY_POINT_RENAME(uhash_deleteHashtable) #define uhash_deleteUObject U_ICU_ENTRY_POINT_RENAME(uhash_deleteUObject) #define uhash_deleteUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_deleteUnicodeString) #define uhash_equals U_ICU_ENTRY_POINT_RENAME(uhash_equals) #define uhash_find U_ICU_ENTRY_POINT_RENAME(uhash_find) #define uhash_freeBlock U_ICU_ENTRY_POINT_RENAME(uhash_freeBlock) #define uhash_get U_ICU_ENTRY_POINT_RENAME(uhash_get) #define uhash_geti U_ICU_ENTRY_POINT_RENAME(uhash_geti) #define uhash_hashCaselessUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_hashCaselessUnicodeString) #define uhash_hashChars U_ICU_ENTRY_POINT_RENAME(uhash_hashChars) #define uhash_hashIChars U_ICU_ENTRY_POINT_RENAME(uhash_hashIChars) #define uhash_hashLong U_ICU_ENTRY_POINT_RENAME(uhash_hashLong) #define uhash_hashUChars U_ICU_ENTRY_POINT_RENAME(uhash_hashUChars) #define uhash_hashUCharsN U_ICU_ENTRY_POINT_RENAME(uhash_hashUCharsN) #define uhash_hashUnicodeString U_ICU_ENTRY_POINT_RENAME(uhash_hashUnicodeString) #define uhash_iget U_ICU_ENTRY_POINT_RENAME(uhash_iget) #define uhash_igeti U_ICU_ENTRY_POINT_RENAME(uhash_igeti) #define uhash_init U_ICU_ENTRY_POINT_RENAME(uhash_init) #define uhash_iput U_ICU_ENTRY_POINT_RENAME(uhash_iput) #define uhash_iputi U_ICU_ENTRY_POINT_RENAME(uhash_iputi) #define uhash_iremove U_ICU_ENTRY_POINT_RENAME(uhash_iremove) #define uhash_iremovei U_ICU_ENTRY_POINT_RENAME(uhash_iremovei) #define uhash_nextElement U_ICU_ENTRY_POINT_RENAME(uhash_nextElement) #define uhash_open U_ICU_ENTRY_POINT_RENAME(uhash_open) #define uhash_openSize U_ICU_ENTRY_POINT_RENAME(uhash_openSize) #define uhash_put U_ICU_ENTRY_POINT_RENAME(uhash_put) #define uhash_puti U_ICU_ENTRY_POINT_RENAME(uhash_puti) #define uhash_remove U_ICU_ENTRY_POINT_RENAME(uhash_remove) #define uhash_removeAll U_ICU_ENTRY_POINT_RENAME(uhash_removeAll) #define uhash_removeElement U_ICU_ENTRY_POINT_RENAME(uhash_removeElement) #define uhash_removei U_ICU_ENTRY_POINT_RENAME(uhash_removei) #define uhash_setKeyComparator U_ICU_ENTRY_POINT_RENAME(uhash_setKeyComparator) #define uhash_setKeyDeleter U_ICU_ENTRY_POINT_RENAME(uhash_setKeyDeleter) #define uhash_setKeyHasher U_ICU_ENTRY_POINT_RENAME(uhash_setKeyHasher) #define uhash_setResizePolicy U_ICU_ENTRY_POINT_RENAME(uhash_setResizePolicy) #define uhash_setValueComparator U_ICU_ENTRY_POINT_RENAME(uhash_setValueComparator) #define uhash_setValueDeleter U_ICU_ENTRY_POINT_RENAME(uhash_setValueDeleter) #define uidna_IDNToASCII U_ICU_ENTRY_POINT_RENAME(uidna_IDNToASCII) #define uidna_IDNToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_IDNToUnicode) #define uidna_close U_ICU_ENTRY_POINT_RENAME(uidna_close) #define uidna_compare U_ICU_ENTRY_POINT_RENAME(uidna_compare) #define uidna_labelToASCII U_ICU_ENTRY_POINT_RENAME(uidna_labelToASCII) #define uidna_labelToASCII_UTF8 U_ICU_ENTRY_POINT_RENAME(uidna_labelToASCII_UTF8) #define uidna_labelToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_labelToUnicode) #define uidna_labelToUnicodeUTF8 U_ICU_ENTRY_POINT_RENAME(uidna_labelToUnicodeUTF8) #define uidna_nameToASCII U_ICU_ENTRY_POINT_RENAME(uidna_nameToASCII) #define uidna_nameToASCII_UTF8 U_ICU_ENTRY_POINT_RENAME(uidna_nameToASCII_UTF8) #define uidna_nameToUnicode U_ICU_ENTRY_POINT_RENAME(uidna_nameToUnicode) #define uidna_nameToUnicodeUTF8 U_ICU_ENTRY_POINT_RENAME(uidna_nameToUnicodeUTF8) #define uidna_openUTS46 U_ICU_ENTRY_POINT_RENAME(uidna_openUTS46) #define uidna_toASCII U_ICU_ENTRY_POINT_RENAME(uidna_toASCII) #define uidna_toUnicode U_ICU_ENTRY_POINT_RENAME(uidna_toUnicode) #define uiter_current32 U_ICU_ENTRY_POINT_RENAME(uiter_current32) #define uiter_getState U_ICU_ENTRY_POINT_RENAME(uiter_getState) #define uiter_next32 U_ICU_ENTRY_POINT_RENAME(uiter_next32) #define uiter_previous32 U_ICU_ENTRY_POINT_RENAME(uiter_previous32) #define uiter_setCharacterIterator U_ICU_ENTRY_POINT_RENAME(uiter_setCharacterIterator) #define uiter_setReplaceable U_ICU_ENTRY_POINT_RENAME(uiter_setReplaceable) #define uiter_setState U_ICU_ENTRY_POINT_RENAME(uiter_setState) #define uiter_setString U_ICU_ENTRY_POINT_RENAME(uiter_setString) #define uiter_setUTF16BE U_ICU_ENTRY_POINT_RENAME(uiter_setUTF16BE) #define uiter_setUTF8 U_ICU_ENTRY_POINT_RENAME(uiter_setUTF8) #define uldn_close U_ICU_ENTRY_POINT_RENAME(uldn_close) #define uldn_getDialectHandling U_ICU_ENTRY_POINT_RENAME(uldn_getDialectHandling) #define uldn_getLocale U_ICU_ENTRY_POINT_RENAME(uldn_getLocale) #define uldn_keyDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_keyDisplayName) #define uldn_keyValueDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_keyValueDisplayName) #define uldn_languageDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_languageDisplayName) #define uldn_localeDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_localeDisplayName) #define uldn_open U_ICU_ENTRY_POINT_RENAME(uldn_open) #define uldn_regionDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_regionDisplayName) #define uldn_scriptCodeDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_scriptCodeDisplayName) #define uldn_scriptDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_scriptDisplayName) #define uldn_variantDisplayName U_ICU_ENTRY_POINT_RENAME(uldn_variantDisplayName) #define ulist_addItemBeginList U_ICU_ENTRY_POINT_RENAME(ulist_addItemBeginList) #define ulist_addItemEndList U_ICU_ENTRY_POINT_RENAME(ulist_addItemEndList) #define ulist_close_keyword_values_iterator U_ICU_ENTRY_POINT_RENAME(ulist_close_keyword_values_iterator) #define ulist_containsString U_ICU_ENTRY_POINT_RENAME(ulist_containsString) #define ulist_count_keyword_values U_ICU_ENTRY_POINT_RENAME(ulist_count_keyword_values) #define ulist_createEmptyList U_ICU_ENTRY_POINT_RENAME(ulist_createEmptyList) #define ulist_deleteList U_ICU_ENTRY_POINT_RENAME(ulist_deleteList) #define ulist_getListFromEnum U_ICU_ENTRY_POINT_RENAME(ulist_getListFromEnum) #define ulist_getListSize U_ICU_ENTRY_POINT_RENAME(ulist_getListSize) #define ulist_getNext U_ICU_ENTRY_POINT_RENAME(ulist_getNext) #define ulist_next_keyword_value U_ICU_ENTRY_POINT_RENAME(ulist_next_keyword_value) #define ulist_resetList U_ICU_ENTRY_POINT_RENAME(ulist_resetList) #define ulist_reset_keyword_values_iterator U_ICU_ENTRY_POINT_RENAME(ulist_reset_keyword_values_iterator) #define uloc_acceptLanguage U_ICU_ENTRY_POINT_RENAME(uloc_acceptLanguage) #define uloc_acceptLanguageFromHTTP U_ICU_ENTRY_POINT_RENAME(uloc_acceptLanguageFromHTTP) #define uloc_addLikelySubtags U_ICU_ENTRY_POINT_RENAME(uloc_addLikelySubtags) #define uloc_canonicalize U_ICU_ENTRY_POINT_RENAME(uloc_canonicalize) #define uloc_countAvailable U_ICU_ENTRY_POINT_RENAME(uloc_countAvailable) #define uloc_forLanguageTag U_ICU_ENTRY_POINT_RENAME(uloc_forLanguageTag) #define uloc_getAvailable U_ICU_ENTRY_POINT_RENAME(uloc_getAvailable) #define uloc_getBaseName U_ICU_ENTRY_POINT_RENAME(uloc_getBaseName) #define uloc_getCharacterOrientation U_ICU_ENTRY_POINT_RENAME(uloc_getCharacterOrientation) #define uloc_getCountry U_ICU_ENTRY_POINT_RENAME(uloc_getCountry) #define uloc_getCurrentCountryID U_ICU_ENTRY_POINT_RENAME(uloc_getCurrentCountryID) #define uloc_getCurrentLanguageID U_ICU_ENTRY_POINT_RENAME(uloc_getCurrentLanguageID) #define uloc_getDefault U_ICU_ENTRY_POINT_RENAME(uloc_getDefault) #define uloc_getDisplayCountry U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayCountry) #define uloc_getDisplayKeyword U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayKeyword) #define uloc_getDisplayKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayKeywordValue) #define uloc_getDisplayLanguage U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayLanguage) #define uloc_getDisplayName U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayName) #define uloc_getDisplayScript U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayScript) #define uloc_getDisplayVariant U_ICU_ENTRY_POINT_RENAME(uloc_getDisplayVariant) #define uloc_getISO3Country U_ICU_ENTRY_POINT_RENAME(uloc_getISO3Country) #define uloc_getISO3Language U_ICU_ENTRY_POINT_RENAME(uloc_getISO3Language) #define uloc_getISOCountries U_ICU_ENTRY_POINT_RENAME(uloc_getISOCountries) #define uloc_getISOLanguages U_ICU_ENTRY_POINT_RENAME(uloc_getISOLanguages) #define uloc_getKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_getKeywordValue) #define uloc_getLCID U_ICU_ENTRY_POINT_RENAME(uloc_getLCID) #define uloc_getLanguage U_ICU_ENTRY_POINT_RENAME(uloc_getLanguage) #define uloc_getLineOrientation U_ICU_ENTRY_POINT_RENAME(uloc_getLineOrientation) #define uloc_getLocaleForLCID U_ICU_ENTRY_POINT_RENAME(uloc_getLocaleForLCID) #define uloc_getName U_ICU_ENTRY_POINT_RENAME(uloc_getName) #define uloc_getParent U_ICU_ENTRY_POINT_RENAME(uloc_getParent) #define uloc_getScript U_ICU_ENTRY_POINT_RENAME(uloc_getScript) #define uloc_getTableStringWithFallback U_ICU_ENTRY_POINT_RENAME(uloc_getTableStringWithFallback) #define uloc_getVariant U_ICU_ENTRY_POINT_RENAME(uloc_getVariant) #define uloc_minimizeSubtags U_ICU_ENTRY_POINT_RENAME(uloc_minimizeSubtags) #define uloc_openKeywordList U_ICU_ENTRY_POINT_RENAME(uloc_openKeywordList) #define uloc_openKeywords U_ICU_ENTRY_POINT_RENAME(uloc_openKeywords) #define uloc_setDefault U_ICU_ENTRY_POINT_RENAME(uloc_setDefault) #define uloc_setKeywordValue U_ICU_ENTRY_POINT_RENAME(uloc_setKeywordValue) #define uloc_toLanguageTag U_ICU_ENTRY_POINT_RENAME(uloc_toLanguageTag) #define ulocdata_close U_ICU_ENTRY_POINT_RENAME(ulocdata_close) #define ulocdata_getCLDRVersion U_ICU_ENTRY_POINT_RENAME(ulocdata_getCLDRVersion) #define ulocdata_getDelimiter U_ICU_ENTRY_POINT_RENAME(ulocdata_getDelimiter) #define ulocdata_getExemplarSet U_ICU_ENTRY_POINT_RENAME(ulocdata_getExemplarSet) #define ulocdata_getLocaleDisplayPattern U_ICU_ENTRY_POINT_RENAME(ulocdata_getLocaleDisplayPattern) #define ulocdata_getLocaleSeparator U_ICU_ENTRY_POINT_RENAME(ulocdata_getLocaleSeparator) #define ulocdata_getMeasurementSystem U_ICU_ENTRY_POINT_RENAME(ulocdata_getMeasurementSystem) #define ulocdata_getNoSubstitute U_ICU_ENTRY_POINT_RENAME(ulocdata_getNoSubstitute) #define ulocdata_getPaperSize U_ICU_ENTRY_POINT_RENAME(ulocdata_getPaperSize) #define ulocdata_open U_ICU_ENTRY_POINT_RENAME(ulocdata_open) #define ulocdata_setNoSubstitute U_ICU_ENTRY_POINT_RENAME(ulocdata_setNoSubstitute) #define ulocimp_getCountry U_ICU_ENTRY_POINT_RENAME(ulocimp_getCountry) #define ulocimp_getLanguage U_ICU_ENTRY_POINT_RENAME(ulocimp_getLanguage) #define ulocimp_getScript U_ICU_ENTRY_POINT_RENAME(ulocimp_getScript) #define umsg_applyPattern U_ICU_ENTRY_POINT_RENAME(umsg_applyPattern) #define umsg_autoQuoteApostrophe U_ICU_ENTRY_POINT_RENAME(umsg_autoQuoteApostrophe) #define umsg_clone U_ICU_ENTRY_POINT_RENAME(umsg_clone) #define umsg_close U_ICU_ENTRY_POINT_RENAME(umsg_close) #define umsg_format U_ICU_ENTRY_POINT_RENAME(umsg_format) #define umsg_getLocale U_ICU_ENTRY_POINT_RENAME(umsg_getLocale) #define umsg_open U_ICU_ENTRY_POINT_RENAME(umsg_open) #define umsg_parse U_ICU_ENTRY_POINT_RENAME(umsg_parse) #define umsg_setLocale U_ICU_ENTRY_POINT_RENAME(umsg_setLocale) #define umsg_toPattern U_ICU_ENTRY_POINT_RENAME(umsg_toPattern) #define umsg_vformat U_ICU_ENTRY_POINT_RENAME(umsg_vformat) #define umsg_vparse U_ICU_ENTRY_POINT_RENAME(umsg_vparse) #define umtx_atomic_dec U_ICU_ENTRY_POINT_RENAME(umtx_atomic_dec) #define umtx_atomic_inc U_ICU_ENTRY_POINT_RENAME(umtx_atomic_inc) #define umtx_cleanup U_ICU_ENTRY_POINT_RENAME(umtx_cleanup) #define umtx_destroy U_ICU_ENTRY_POINT_RENAME(umtx_destroy) #define umtx_init U_ICU_ENTRY_POINT_RENAME(umtx_init) #define umtx_lock U_ICU_ENTRY_POINT_RENAME(umtx_lock) #define umtx_unlock U_ICU_ENTRY_POINT_RENAME(umtx_unlock) #define uniset_getUnicode32Instance U_ICU_ENTRY_POINT_RENAME(uniset_getUnicode32Instance) #define unorm2_append U_ICU_ENTRY_POINT_RENAME(unorm2_append) #define unorm2_close U_ICU_ENTRY_POINT_RENAME(unorm2_close) #define unorm2_getDecomposition U_ICU_ENTRY_POINT_RENAME(unorm2_getDecomposition) #define unorm2_getInstance U_ICU_ENTRY_POINT_RENAME(unorm2_getInstance) #define unorm2_hasBoundaryAfter U_ICU_ENTRY_POINT_RENAME(unorm2_hasBoundaryAfter) #define unorm2_hasBoundaryBefore U_ICU_ENTRY_POINT_RENAME(unorm2_hasBoundaryBefore) #define unorm2_isInert U_ICU_ENTRY_POINT_RENAME(unorm2_isInert) #define unorm2_isNormalized U_ICU_ENTRY_POINT_RENAME(unorm2_isNormalized) #define unorm2_normalize U_ICU_ENTRY_POINT_RENAME(unorm2_normalize) #define unorm2_normalizeSecondAndAppend U_ICU_ENTRY_POINT_RENAME(unorm2_normalizeSecondAndAppend) #define unorm2_openFiltered U_ICU_ENTRY_POINT_RENAME(unorm2_openFiltered) #define unorm2_quickCheck U_ICU_ENTRY_POINT_RENAME(unorm2_quickCheck) #define unorm2_spanQuickCheckYes U_ICU_ENTRY_POINT_RENAME(unorm2_spanQuickCheckYes) #define unorm2_swap U_ICU_ENTRY_POINT_RENAME(unorm2_swap) #define unorm_closeIter U_ICU_ENTRY_POINT_RENAME(unorm_closeIter) #define unorm_compare U_ICU_ENTRY_POINT_RENAME(unorm_compare) #define unorm_concatenate U_ICU_ENTRY_POINT_RENAME(unorm_concatenate) #define unorm_getFCDTrieIndex U_ICU_ENTRY_POINT_RENAME(unorm_getFCDTrieIndex) #define unorm_getQuickCheck U_ICU_ENTRY_POINT_RENAME(unorm_getQuickCheck) #define unorm_isNormalized U_ICU_ENTRY_POINT_RENAME(unorm_isNormalized) #define unorm_isNormalizedWithOptions U_ICU_ENTRY_POINT_RENAME(unorm_isNormalizedWithOptions) #define unorm_next U_ICU_ENTRY_POINT_RENAME(unorm_next) #define unorm_normalize U_ICU_ENTRY_POINT_RENAME(unorm_normalize) #define unorm_openIter U_ICU_ENTRY_POINT_RENAME(unorm_openIter) #define unorm_previous U_ICU_ENTRY_POINT_RENAME(unorm_previous) #define unorm_quickCheck U_ICU_ENTRY_POINT_RENAME(unorm_quickCheck) #define unorm_quickCheckWithOptions U_ICU_ENTRY_POINT_RENAME(unorm_quickCheckWithOptions) #define unorm_setIter U_ICU_ENTRY_POINT_RENAME(unorm_setIter) #define unum_applyPattern U_ICU_ENTRY_POINT_RENAME(unum_applyPattern) #define unum_clone U_ICU_ENTRY_POINT_RENAME(unum_clone) #define unum_close U_ICU_ENTRY_POINT_RENAME(unum_close) #define unum_countAvailable U_ICU_ENTRY_POINT_RENAME(unum_countAvailable) #define unum_format U_ICU_ENTRY_POINT_RENAME(unum_format) #define unum_formatDecimal U_ICU_ENTRY_POINT_RENAME(unum_formatDecimal) #define unum_formatDouble U_ICU_ENTRY_POINT_RENAME(unum_formatDouble) #define unum_formatDoubleCurrency U_ICU_ENTRY_POINT_RENAME(unum_formatDoubleCurrency) #define unum_formatInt64 U_ICU_ENTRY_POINT_RENAME(unum_formatInt64) #define unum_getAttribute U_ICU_ENTRY_POINT_RENAME(unum_getAttribute) #define unum_getAvailable U_ICU_ENTRY_POINT_RENAME(unum_getAvailable) #define unum_getDoubleAttribute U_ICU_ENTRY_POINT_RENAME(unum_getDoubleAttribute) #define unum_getLocaleByType U_ICU_ENTRY_POINT_RENAME(unum_getLocaleByType) #define unum_getSymbol U_ICU_ENTRY_POINT_RENAME(unum_getSymbol) #define unum_getTextAttribute U_ICU_ENTRY_POINT_RENAME(unum_getTextAttribute) #define unum_open U_ICU_ENTRY_POINT_RENAME(unum_open) #define unum_parse U_ICU_ENTRY_POINT_RENAME(unum_parse) #define unum_parseDecimal U_ICU_ENTRY_POINT_RENAME(unum_parseDecimal) #define unum_parseDouble U_ICU_ENTRY_POINT_RENAME(unum_parseDouble) #define unum_parseDoubleCurrency U_ICU_ENTRY_POINT_RENAME(unum_parseDoubleCurrency) #define unum_parseInt64 U_ICU_ENTRY_POINT_RENAME(unum_parseInt64) #define unum_setAttribute U_ICU_ENTRY_POINT_RENAME(unum_setAttribute) #define unum_setDoubleAttribute U_ICU_ENTRY_POINT_RENAME(unum_setDoubleAttribute) #define unum_setSymbol U_ICU_ENTRY_POINT_RENAME(unum_setSymbol) #define unum_setTextAttribute U_ICU_ENTRY_POINT_RENAME(unum_setTextAttribute) #define unum_toPattern U_ICU_ENTRY_POINT_RENAME(unum_toPattern) #define uplug_closeLibrary U_ICU_ENTRY_POINT_RENAME(uplug_closeLibrary) #define uplug_findLibrary U_ICU_ENTRY_POINT_RENAME(uplug_findLibrary) #define uplug_getConfiguration U_ICU_ENTRY_POINT_RENAME(uplug_getConfiguration) #define uplug_getContext U_ICU_ENTRY_POINT_RENAME(uplug_getContext) #define uplug_getCurrentLevel U_ICU_ENTRY_POINT_RENAME(uplug_getCurrentLevel) #define uplug_getLibrary U_ICU_ENTRY_POINT_RENAME(uplug_getLibrary) #define uplug_getLibraryName U_ICU_ENTRY_POINT_RENAME(uplug_getLibraryName) #define uplug_getPlugInternal U_ICU_ENTRY_POINT_RENAME(uplug_getPlugInternal) #define uplug_getPlugLevel U_ICU_ENTRY_POINT_RENAME(uplug_getPlugLevel) #define uplug_getPlugLoadStatus U_ICU_ENTRY_POINT_RENAME(uplug_getPlugLoadStatus) #define uplug_getPlugName U_ICU_ENTRY_POINT_RENAME(uplug_getPlugName) #define uplug_getPluginFile U_ICU_ENTRY_POINT_RENAME(uplug_getPluginFile) #define uplug_getSymbolName U_ICU_ENTRY_POINT_RENAME(uplug_getSymbolName) #define uplug_init U_ICU_ENTRY_POINT_RENAME(uplug_init) #define uplug_loadPlugFromEntrypoint U_ICU_ENTRY_POINT_RENAME(uplug_loadPlugFromEntrypoint) #define uplug_loadPlugFromLibrary U_ICU_ENTRY_POINT_RENAME(uplug_loadPlugFromLibrary) #define uplug_nextPlug U_ICU_ENTRY_POINT_RENAME(uplug_nextPlug) #define uplug_openLibrary U_ICU_ENTRY_POINT_RENAME(uplug_openLibrary) #define uplug_removePlug U_ICU_ENTRY_POINT_RENAME(uplug_removePlug) #define uplug_setContext U_ICU_ENTRY_POINT_RENAME(uplug_setContext) #define uplug_setPlugLevel U_ICU_ENTRY_POINT_RENAME(uplug_setPlugLevel) #define uplug_setPlugName U_ICU_ENTRY_POINT_RENAME(uplug_setPlugName) #define uplug_setPlugNoUnload U_ICU_ENTRY_POINT_RENAME(uplug_setPlugNoUnload) #define upname_swap U_ICU_ENTRY_POINT_RENAME(upname_swap) #define uprops_getSource U_ICU_ENTRY_POINT_RENAME(uprops_getSource) #define upropsvec_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(upropsvec_addPropertyStarts) #define uprv_aestrncpy U_ICU_ENTRY_POINT_RENAME(uprv_aestrncpy) #define uprv_asciiFromEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_asciiFromEbcdic) #define uprv_asciitolower U_ICU_ENTRY_POINT_RENAME(uprv_asciitolower) #define uprv_ceil U_ICU_ENTRY_POINT_RENAME(uprv_ceil) #define uprv_cnttab_addContraction U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_addContraction) #define uprv_cnttab_changeContraction U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_changeContraction) #define uprv_cnttab_changeLastCE U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_changeLastCE) #define uprv_cnttab_clone U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_clone) #define uprv_cnttab_close U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_close) #define uprv_cnttab_constructTable U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_constructTable) #define uprv_cnttab_findCE U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_findCE) #define uprv_cnttab_findCP U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_findCP) #define uprv_cnttab_getCE U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_getCE) #define uprv_cnttab_insertContraction U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_insertContraction) #define uprv_cnttab_isTailored U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_isTailored) #define uprv_cnttab_open U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_open) #define uprv_cnttab_setContraction U_ICU_ENTRY_POINT_RENAME(uprv_cnttab_setContraction) #define uprv_collIterateAtEnd U_ICU_ENTRY_POINT_RENAME(uprv_collIterateAtEnd) #define uprv_compareASCIIPropertyNames U_ICU_ENTRY_POINT_RENAME(uprv_compareASCIIPropertyNames) #define uprv_compareEBCDICPropertyNames U_ICU_ENTRY_POINT_RENAME(uprv_compareEBCDICPropertyNames) #define uprv_compareInvAscii U_ICU_ENTRY_POINT_RENAME(uprv_compareInvAscii) #define uprv_compareInvEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdic) #define uprv_compareInvEbcdicAsAscii U_ICU_ENTRY_POINT_RENAME(uprv_compareInvEbcdicAsAscii) #define uprv_convertToLCID U_ICU_ENTRY_POINT_RENAME(uprv_convertToLCID) #define uprv_convertToPosix U_ICU_ENTRY_POINT_RENAME(uprv_convertToPosix) #define uprv_copyAscii U_ICU_ENTRY_POINT_RENAME(uprv_copyAscii) #define uprv_copyEbcdic U_ICU_ENTRY_POINT_RENAME(uprv_copyEbcdic) #define uprv_decContextClearStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextClearStatus) #define uprv_decContextDefault U_ICU_ENTRY_POINT_RENAME(uprv_decContextDefault) #define uprv_decContextGetRounding U_ICU_ENTRY_POINT_RENAME(uprv_decContextGetRounding) #define uprv_decContextGetStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextGetStatus) #define uprv_decContextRestoreStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextRestoreStatus) #define uprv_decContextSaveStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextSaveStatus) #define uprv_decContextSetRounding U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetRounding) #define uprv_decContextSetStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatus) #define uprv_decContextSetStatusFromString U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusFromString) #define uprv_decContextSetStatusFromStringQuiet U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusFromStringQuiet) #define uprv_decContextSetStatusQuiet U_ICU_ENTRY_POINT_RENAME(uprv_decContextSetStatusQuiet) #define uprv_decContextStatusToString U_ICU_ENTRY_POINT_RENAME(uprv_decContextStatusToString) #define uprv_decContextTestEndian U_ICU_ENTRY_POINT_RENAME(uprv_decContextTestEndian) #define uprv_decContextTestSavedStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextTestSavedStatus) #define uprv_decContextTestStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextTestStatus) #define uprv_decContextZeroStatus U_ICU_ENTRY_POINT_RENAME(uprv_decContextZeroStatus) #define uprv_decNumberAbs U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAbs) #define uprv_decNumberAdd U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAdd) #define uprv_decNumberAnd U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAnd) #define uprv_decNumberClass U_ICU_ENTRY_POINT_RENAME(uprv_decNumberClass) #define uprv_decNumberClassToString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberClassToString) #define uprv_decNumberCompare U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompare) #define uprv_decNumberCompareSignal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareSignal) #define uprv_decNumberCompareTotal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareTotal) #define uprv_decNumberCompareTotalMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareTotalMag) #define uprv_decNumberCopy U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopy) #define uprv_decNumberCopyAbs U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopyAbs) #define uprv_decNumberCopyNegate U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopyNegate) #define uprv_decNumberCopySign U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCopySign) #define uprv_decNumberDivide U_ICU_ENTRY_POINT_RENAME(uprv_decNumberDivide) #define uprv_decNumberDivideInteger U_ICU_ENTRY_POINT_RENAME(uprv_decNumberDivideInteger) #define uprv_decNumberExp U_ICU_ENTRY_POINT_RENAME(uprv_decNumberExp) #define uprv_decNumberFMA U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFMA) #define uprv_decNumberFromInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromInt32) #define uprv_decNumberFromString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromString) #define uprv_decNumberFromUInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberFromUInt32) #define uprv_decNumberGetBCD U_ICU_ENTRY_POINT_RENAME(uprv_decNumberGetBCD) #define uprv_decNumberInvert U_ICU_ENTRY_POINT_RENAME(uprv_decNumberInvert) #define uprv_decNumberIsNormal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberIsNormal) #define uprv_decNumberIsSubnormal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberIsSubnormal) #define uprv_decNumberLn U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLn) #define uprv_decNumberLog10 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLog10) #define uprv_decNumberLogB U_ICU_ENTRY_POINT_RENAME(uprv_decNumberLogB) #define uprv_decNumberMax U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMax) #define uprv_decNumberMaxMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMaxMag) #define uprv_decNumberMin U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMin) #define uprv_decNumberMinMag U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMinMag) #define uprv_decNumberMinus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMinus) #define uprv_decNumberMultiply U_ICU_ENTRY_POINT_RENAME(uprv_decNumberMultiply) #define uprv_decNumberNextMinus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextMinus) #define uprv_decNumberNextPlus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextPlus) #define uprv_decNumberNextToward U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNextToward) #define uprv_decNumberNormalize U_ICU_ENTRY_POINT_RENAME(uprv_decNumberNormalize) #define uprv_decNumberOr U_ICU_ENTRY_POINT_RENAME(uprv_decNumberOr) #define uprv_decNumberPlus U_ICU_ENTRY_POINT_RENAME(uprv_decNumberPlus) #define uprv_decNumberPower U_ICU_ENTRY_POINT_RENAME(uprv_decNumberPower) #define uprv_decNumberQuantize U_ICU_ENTRY_POINT_RENAME(uprv_decNumberQuantize) #define uprv_decNumberReduce U_ICU_ENTRY_POINT_RENAME(uprv_decNumberReduce) #define uprv_decNumberRemainder U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRemainder) #define uprv_decNumberRemainderNear U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRemainderNear) #define uprv_decNumberRescale U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRescale) #define uprv_decNumberRotate U_ICU_ENTRY_POINT_RENAME(uprv_decNumberRotate) #define uprv_decNumberSameQuantum U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSameQuantum) #define uprv_decNumberScaleB U_ICU_ENTRY_POINT_RENAME(uprv_decNumberScaleB) #define uprv_decNumberSetBCD U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSetBCD) #define uprv_decNumberShift U_ICU_ENTRY_POINT_RENAME(uprv_decNumberShift) #define uprv_decNumberSquareRoot U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSquareRoot) #define uprv_decNumberSubtract U_ICU_ENTRY_POINT_RENAME(uprv_decNumberSubtract) #define uprv_decNumberToEngString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToEngString) #define uprv_decNumberToInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToInt32) #define uprv_decNumberToIntegralExact U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToIntegralExact) #define uprv_decNumberToIntegralValue U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToIntegralValue) #define uprv_decNumberToString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToString) #define uprv_decNumberToUInt32 U_ICU_ENTRY_POINT_RENAME(uprv_decNumberToUInt32) #define uprv_decNumberTrim U_ICU_ENTRY_POINT_RENAME(uprv_decNumberTrim) #define uprv_decNumberVersion U_ICU_ENTRY_POINT_RENAME(uprv_decNumberVersion) #define uprv_decNumberXor U_ICU_ENTRY_POINT_RENAME(uprv_decNumberXor) #define uprv_decNumberZero U_ICU_ENTRY_POINT_RENAME(uprv_decNumberZero) #define uprv_delete_collIterate U_ICU_ENTRY_POINT_RENAME(uprv_delete_collIterate) #define uprv_dl_close U_ICU_ENTRY_POINT_RENAME(uprv_dl_close) #define uprv_dl_open U_ICU_ENTRY_POINT_RENAME(uprv_dl_open) #define uprv_dl_sym U_ICU_ENTRY_POINT_RENAME(uprv_dl_sym) #define uprv_eastrncpy U_ICU_ENTRY_POINT_RENAME(uprv_eastrncpy) #define uprv_ebcdicFromAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicFromAscii) #define uprv_ebcdictolower U_ICU_ENTRY_POINT_RENAME(uprv_ebcdictolower) #define uprv_fabs U_ICU_ENTRY_POINT_RENAME(uprv_fabs) #define uprv_floor U_ICU_ENTRY_POINT_RENAME(uprv_floor) #define uprv_fmax U_ICU_ENTRY_POINT_RENAME(uprv_fmax) #define uprv_fmin U_ICU_ENTRY_POINT_RENAME(uprv_fmin) #define uprv_fmod U_ICU_ENTRY_POINT_RENAME(uprv_fmod) #define uprv_free U_ICU_ENTRY_POINT_RENAME(uprv_free) #define uprv_getCharNameCharacters U_ICU_ENTRY_POINT_RENAME(uprv_getCharNameCharacters) #define uprv_getDefaultCodepage U_ICU_ENTRY_POINT_RENAME(uprv_getDefaultCodepage) #define uprv_getDefaultLocaleID U_ICU_ENTRY_POINT_RENAME(uprv_getDefaultLocaleID) #define uprv_getInfinity U_ICU_ENTRY_POINT_RENAME(uprv_getInfinity) #define uprv_getMaxCharNameLength U_ICU_ENTRY_POINT_RENAME(uprv_getMaxCharNameLength) #define uprv_getMaxValues U_ICU_ENTRY_POINT_RENAME(uprv_getMaxValues) #define uprv_getNaN U_ICU_ENTRY_POINT_RENAME(uprv_getNaN) #define uprv_getRawUTCtime U_ICU_ENTRY_POINT_RENAME(uprv_getRawUTCtime) #define uprv_getStaticCurrencyName U_ICU_ENTRY_POINT_RENAME(uprv_getStaticCurrencyName) #define uprv_getUTCtime U_ICU_ENTRY_POINT_RENAME(uprv_getUTCtime) #define uprv_haveProperties U_ICU_ENTRY_POINT_RENAME(uprv_haveProperties) #define uprv_init_collIterate U_ICU_ENTRY_POINT_RENAME(uprv_init_collIterate) #define uprv_init_pce U_ICU_ENTRY_POINT_RENAME(uprv_init_pce) #define uprv_int32Comparator U_ICU_ENTRY_POINT_RENAME(uprv_int32Comparator) #define uprv_isInfinite U_ICU_ENTRY_POINT_RENAME(uprv_isInfinite) #define uprv_isInvariantString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantString) #define uprv_isInvariantUString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantUString) #define uprv_isNaN U_ICU_ENTRY_POINT_RENAME(uprv_isNaN) #define uprv_isNegativeInfinity U_ICU_ENTRY_POINT_RENAME(uprv_isNegativeInfinity) #define uprv_isPositiveInfinity U_ICU_ENTRY_POINT_RENAME(uprv_isPositiveInfinity) #define uprv_isRuleWhiteSpace U_ICU_ENTRY_POINT_RENAME(uprv_isRuleWhiteSpace) #define uprv_itou U_ICU_ENTRY_POINT_RENAME(uprv_itou) #define uprv_log U_ICU_ENTRY_POINT_RENAME(uprv_log) #define uprv_malloc U_ICU_ENTRY_POINT_RENAME(uprv_malloc) #define uprv_mapFile U_ICU_ENTRY_POINT_RENAME(uprv_mapFile) #define uprv_max U_ICU_ENTRY_POINT_RENAME(uprv_max) #define uprv_maxMantissa U_ICU_ENTRY_POINT_RENAME(uprv_maxMantissa) #define uprv_maximumPtr U_ICU_ENTRY_POINT_RENAME(uprv_maximumPtr) #define uprv_min U_ICU_ENTRY_POINT_RENAME(uprv_min) #define uprv_modf U_ICU_ENTRY_POINT_RENAME(uprv_modf) #define uprv_new_collIterate U_ICU_ENTRY_POINT_RENAME(uprv_new_collIterate) #define uprv_openRuleWhiteSpaceSet U_ICU_ENTRY_POINT_RENAME(uprv_openRuleWhiteSpaceSet) #define uprv_parseCurrency U_ICU_ENTRY_POINT_RENAME(uprv_parseCurrency) #define uprv_pathIsAbsolute U_ICU_ENTRY_POINT_RENAME(uprv_pathIsAbsolute) #define uprv_pow U_ICU_ENTRY_POINT_RENAME(uprv_pow) #define uprv_pow10 U_ICU_ENTRY_POINT_RENAME(uprv_pow10) #define uprv_realloc U_ICU_ENTRY_POINT_RENAME(uprv_realloc) #define uprv_round U_ICU_ENTRY_POINT_RENAME(uprv_round) #define uprv_sortArray U_ICU_ENTRY_POINT_RENAME(uprv_sortArray) #define uprv_strCompare U_ICU_ENTRY_POINT_RENAME(uprv_strCompare) #define uprv_strdup U_ICU_ENTRY_POINT_RENAME(uprv_strdup) #define uprv_strndup U_ICU_ENTRY_POINT_RENAME(uprv_strndup) #define uprv_syntaxError U_ICU_ENTRY_POINT_RENAME(uprv_syntaxError) #define uprv_timezone U_ICU_ENTRY_POINT_RENAME(uprv_timezone) #define uprv_toupper U_ICU_ENTRY_POINT_RENAME(uprv_toupper) #define uprv_trunc U_ICU_ENTRY_POINT_RENAME(uprv_trunc) #define uprv_tzname U_ICU_ENTRY_POINT_RENAME(uprv_tzname) #define uprv_tzset U_ICU_ENTRY_POINT_RENAME(uprv_tzset) #define uprv_uca_addAnElement U_ICU_ENTRY_POINT_RENAME(uprv_uca_addAnElement) #define uprv_uca_assembleTable U_ICU_ENTRY_POINT_RENAME(uprv_uca_assembleTable) #define uprv_uca_canonicalClosure U_ICU_ENTRY_POINT_RENAME(uprv_uca_canonicalClosure) #define uprv_uca_closeTempTable U_ICU_ENTRY_POINT_RENAME(uprv_uca_closeTempTable) #define uprv_uca_getCodePointFromRaw U_ICU_ENTRY_POINT_RENAME(uprv_uca_getCodePointFromRaw) #define uprv_uca_getImplicitFromRaw U_ICU_ENTRY_POINT_RENAME(uprv_uca_getImplicitFromRaw) #define uprv_uca_getRawFromCodePoint U_ICU_ENTRY_POINT_RENAME(uprv_uca_getRawFromCodePoint) #define uprv_uca_getRawFromImplicit U_ICU_ENTRY_POINT_RENAME(uprv_uca_getRawFromImplicit) #define uprv_uca_initImplicitConstants U_ICU_ENTRY_POINT_RENAME(uprv_uca_initImplicitConstants) #define uprv_uca_initTempTable U_ICU_ENTRY_POINT_RENAME(uprv_uca_initTempTable) #define uprv_uint16Comparator U_ICU_ENTRY_POINT_RENAME(uprv_uint16Comparator) #define uprv_uint32Comparator U_ICU_ENTRY_POINT_RENAME(uprv_uint32Comparator) #define uprv_unmapFile U_ICU_ENTRY_POINT_RENAME(uprv_unmapFile) #define upvec_cloneArray U_ICU_ENTRY_POINT_RENAME(upvec_cloneArray) #define upvec_close U_ICU_ENTRY_POINT_RENAME(upvec_close) #define upvec_compact U_ICU_ENTRY_POINT_RENAME(upvec_compact) #define upvec_compactToUTrie2Handler U_ICU_ENTRY_POINT_RENAME(upvec_compactToUTrie2Handler) #define upvec_compactToUTrie2WithRowIndexes U_ICU_ENTRY_POINT_RENAME(upvec_compactToUTrie2WithRowIndexes) #define upvec_getArray U_ICU_ENTRY_POINT_RENAME(upvec_getArray) #define upvec_getRow U_ICU_ENTRY_POINT_RENAME(upvec_getRow) #define upvec_getValue U_ICU_ENTRY_POINT_RENAME(upvec_getValue) #define upvec_open U_ICU_ENTRY_POINT_RENAME(upvec_open) #define upvec_setValue U_ICU_ENTRY_POINT_RENAME(upvec_setValue) #define uregex_appendReplacement U_ICU_ENTRY_POINT_RENAME(uregex_appendReplacement) #define uregex_appendReplacementUText U_ICU_ENTRY_POINT_RENAME(uregex_appendReplacementUText) #define uregex_appendTail U_ICU_ENTRY_POINT_RENAME(uregex_appendTail) #define uregex_appendTailUText U_ICU_ENTRY_POINT_RENAME(uregex_appendTailUText) #define uregex_clone U_ICU_ENTRY_POINT_RENAME(uregex_clone) #define uregex_close U_ICU_ENTRY_POINT_RENAME(uregex_close) #define uregex_end U_ICU_ENTRY_POINT_RENAME(uregex_end) #define uregex_end64 U_ICU_ENTRY_POINT_RENAME(uregex_end64) #define uregex_find U_ICU_ENTRY_POINT_RENAME(uregex_find) #define uregex_find64 U_ICU_ENTRY_POINT_RENAME(uregex_find64) #define uregex_findNext U_ICU_ENTRY_POINT_RENAME(uregex_findNext) #define uregex_flags U_ICU_ENTRY_POINT_RENAME(uregex_flags) #define uregex_getFindProgressCallback U_ICU_ENTRY_POINT_RENAME(uregex_getFindProgressCallback) #define uregex_getMatchCallback U_ICU_ENTRY_POINT_RENAME(uregex_getMatchCallback) #define uregex_getStackLimit U_ICU_ENTRY_POINT_RENAME(uregex_getStackLimit) #define uregex_getText U_ICU_ENTRY_POINT_RENAME(uregex_getText) #define uregex_getTimeLimit U_ICU_ENTRY_POINT_RENAME(uregex_getTimeLimit) #define uregex_getUText U_ICU_ENTRY_POINT_RENAME(uregex_getUText) #define uregex_group U_ICU_ENTRY_POINT_RENAME(uregex_group) #define uregex_groupCount U_ICU_ENTRY_POINT_RENAME(uregex_groupCount) #define uregex_groupUText U_ICU_ENTRY_POINT_RENAME(uregex_groupUText) #define uregex_groupUTextDeep U_ICU_ENTRY_POINT_RENAME(uregex_groupUTextDeep) #define uregex_hasAnchoringBounds U_ICU_ENTRY_POINT_RENAME(uregex_hasAnchoringBounds) #define uregex_hasTransparentBounds U_ICU_ENTRY_POINT_RENAME(uregex_hasTransparentBounds) #define uregex_hitEnd U_ICU_ENTRY_POINT_RENAME(uregex_hitEnd) #define uregex_lookingAt U_ICU_ENTRY_POINT_RENAME(uregex_lookingAt) #define uregex_lookingAt64 U_ICU_ENTRY_POINT_RENAME(uregex_lookingAt64) #define uregex_matches U_ICU_ENTRY_POINT_RENAME(uregex_matches) #define uregex_matches64 U_ICU_ENTRY_POINT_RENAME(uregex_matches64) #define uregex_open U_ICU_ENTRY_POINT_RENAME(uregex_open) #define uregex_openC U_ICU_ENTRY_POINT_RENAME(uregex_openC) #define uregex_openUText U_ICU_ENTRY_POINT_RENAME(uregex_openUText) #define uregex_pattern U_ICU_ENTRY_POINT_RENAME(uregex_pattern) #define uregex_patternUText U_ICU_ENTRY_POINT_RENAME(uregex_patternUText) #define uregex_regionEnd U_ICU_ENTRY_POINT_RENAME(uregex_regionEnd) #define uregex_regionEnd64 U_ICU_ENTRY_POINT_RENAME(uregex_regionEnd64) #define uregex_regionStart U_ICU_ENTRY_POINT_RENAME(uregex_regionStart) #define uregex_regionStart64 U_ICU_ENTRY_POINT_RENAME(uregex_regionStart64) #define uregex_replaceAll U_ICU_ENTRY_POINT_RENAME(uregex_replaceAll) #define uregex_replaceAllUText U_ICU_ENTRY_POINT_RENAME(uregex_replaceAllUText) #define uregex_replaceFirst U_ICU_ENTRY_POINT_RENAME(uregex_replaceFirst) #define uregex_replaceFirstUText U_ICU_ENTRY_POINT_RENAME(uregex_replaceFirstUText) #define uregex_requireEnd U_ICU_ENTRY_POINT_RENAME(uregex_requireEnd) #define uregex_reset U_ICU_ENTRY_POINT_RENAME(uregex_reset) #define uregex_reset64 U_ICU_ENTRY_POINT_RENAME(uregex_reset64) #define uregex_setFindProgressCallback U_ICU_ENTRY_POINT_RENAME(uregex_setFindProgressCallback) #define uregex_setMatchCallback U_ICU_ENTRY_POINT_RENAME(uregex_setMatchCallback) #define uregex_setRegion U_ICU_ENTRY_POINT_RENAME(uregex_setRegion) #define uregex_setRegion64 U_ICU_ENTRY_POINT_RENAME(uregex_setRegion64) #define uregex_setRegionAndStart U_ICU_ENTRY_POINT_RENAME(uregex_setRegionAndStart) #define uregex_setStackLimit U_ICU_ENTRY_POINT_RENAME(uregex_setStackLimit) #define uregex_setText U_ICU_ENTRY_POINT_RENAME(uregex_setText) #define uregex_setTimeLimit U_ICU_ENTRY_POINT_RENAME(uregex_setTimeLimit) #define uregex_setUText U_ICU_ENTRY_POINT_RENAME(uregex_setUText) #define uregex_split U_ICU_ENTRY_POINT_RENAME(uregex_split) #define uregex_splitUText U_ICU_ENTRY_POINT_RENAME(uregex_splitUText) #define uregex_start U_ICU_ENTRY_POINT_RENAME(uregex_start) #define uregex_start64 U_ICU_ENTRY_POINT_RENAME(uregex_start64) #define uregex_ucstr_unescape_charAt U_ICU_ENTRY_POINT_RENAME(uregex_ucstr_unescape_charAt) #define uregex_useAnchoringBounds U_ICU_ENTRY_POINT_RENAME(uregex_useAnchoringBounds) #define uregex_useTransparentBounds U_ICU_ENTRY_POINT_RENAME(uregex_useTransparentBounds) #define uregex_utext_unescape_charAt U_ICU_ENTRY_POINT_RENAME(uregex_utext_unescape_charAt) #define ures_close U_ICU_ENTRY_POINT_RENAME(ures_close) #define ures_copyResb U_ICU_ENTRY_POINT_RENAME(ures_copyResb) #define ures_countArrayItems U_ICU_ENTRY_POINT_RENAME(ures_countArrayItems) #define ures_findResource U_ICU_ENTRY_POINT_RENAME(ures_findResource) #define ures_findSubResource U_ICU_ENTRY_POINT_RENAME(ures_findSubResource) #define ures_getBinary U_ICU_ENTRY_POINT_RENAME(ures_getBinary) #define ures_getByIndex U_ICU_ENTRY_POINT_RENAME(ures_getByIndex) #define ures_getByKey U_ICU_ENTRY_POINT_RENAME(ures_getByKey) #define ures_getByKeyWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getByKeyWithFallback) #define ures_getFunctionalEquivalent U_ICU_ENTRY_POINT_RENAME(ures_getFunctionalEquivalent) #define ures_getInt U_ICU_ENTRY_POINT_RENAME(ures_getInt) #define ures_getIntVector U_ICU_ENTRY_POINT_RENAME(ures_getIntVector) #define ures_getKey U_ICU_ENTRY_POINT_RENAME(ures_getKey) #define ures_getKeywordValues U_ICU_ENTRY_POINT_RENAME(ures_getKeywordValues) #define ures_getLocale U_ICU_ENTRY_POINT_RENAME(ures_getLocale) #define ures_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ures_getLocaleByType) #define ures_getLocaleInternal U_ICU_ENTRY_POINT_RENAME(ures_getLocaleInternal) #define ures_getName U_ICU_ENTRY_POINT_RENAME(ures_getName) #define ures_getNextResource U_ICU_ENTRY_POINT_RENAME(ures_getNextResource) #define ures_getNextString U_ICU_ENTRY_POINT_RENAME(ures_getNextString) #define ures_getSize U_ICU_ENTRY_POINT_RENAME(ures_getSize) #define ures_getString U_ICU_ENTRY_POINT_RENAME(ures_getString) #define ures_getStringByIndex U_ICU_ENTRY_POINT_RENAME(ures_getStringByIndex) #define ures_getStringByKey U_ICU_ENTRY_POINT_RENAME(ures_getStringByKey) #define ures_getStringByKeyWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getStringByKeyWithFallback) #define ures_getType U_ICU_ENTRY_POINT_RENAME(ures_getType) #define ures_getUInt U_ICU_ENTRY_POINT_RENAME(ures_getUInt) #define ures_getUTF8String U_ICU_ENTRY_POINT_RENAME(ures_getUTF8String) #define ures_getUTF8StringByIndex U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByIndex) #define ures_getUTF8StringByKey U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByKey) #define ures_getVersion U_ICU_ENTRY_POINT_RENAME(ures_getVersion) #define ures_getVersionByKey U_ICU_ENTRY_POINT_RENAME(ures_getVersionByKey) #define ures_getVersionNumber U_ICU_ENTRY_POINT_RENAME(ures_getVersionNumber) #define ures_getVersionNumberInternal U_ICU_ENTRY_POINT_RENAME(ures_getVersionNumberInternal) #define ures_hasNext U_ICU_ENTRY_POINT_RENAME(ures_hasNext) #define ures_initStackObject U_ICU_ENTRY_POINT_RENAME(ures_initStackObject) #define ures_open U_ICU_ENTRY_POINT_RENAME(ures_open) #define ures_openAvailableLocales U_ICU_ENTRY_POINT_RENAME(ures_openAvailableLocales) #define ures_openDirect U_ICU_ENTRY_POINT_RENAME(ures_openDirect) #define ures_openFillIn U_ICU_ENTRY_POINT_RENAME(ures_openFillIn) #define ures_openU U_ICU_ENTRY_POINT_RENAME(ures_openU) #define ures_resetIterator U_ICU_ENTRY_POINT_RENAME(ures_resetIterator) #define ures_swap U_ICU_ENTRY_POINT_RENAME(ures_swap) #define uscript_closeRun U_ICU_ENTRY_POINT_RENAME(uscript_closeRun) #define uscript_getCode U_ICU_ENTRY_POINT_RENAME(uscript_getCode) #define uscript_getName U_ICU_ENTRY_POINT_RENAME(uscript_getName) #define uscript_getScript U_ICU_ENTRY_POINT_RENAME(uscript_getScript) #define uscript_getScriptExtensions U_ICU_ENTRY_POINT_RENAME(uscript_getScriptExtensions) #define uscript_getShortName U_ICU_ENTRY_POINT_RENAME(uscript_getShortName) #define uscript_hasScript U_ICU_ENTRY_POINT_RENAME(uscript_hasScript) #define uscript_nextRun U_ICU_ENTRY_POINT_RENAME(uscript_nextRun) #define uscript_openRun U_ICU_ENTRY_POINT_RENAME(uscript_openRun) #define uscript_resetRun U_ICU_ENTRY_POINT_RENAME(uscript_resetRun) #define uscript_setRunText U_ICU_ENTRY_POINT_RENAME(uscript_setRunText) #define usearch_close U_ICU_ENTRY_POINT_RENAME(usearch_close) #define usearch_first U_ICU_ENTRY_POINT_RENAME(usearch_first) #define usearch_following U_ICU_ENTRY_POINT_RENAME(usearch_following) #define usearch_getAttribute U_ICU_ENTRY_POINT_RENAME(usearch_getAttribute) #define usearch_getBreakIterator U_ICU_ENTRY_POINT_RENAME(usearch_getBreakIterator) #define usearch_getCollator U_ICU_ENTRY_POINT_RENAME(usearch_getCollator) #define usearch_getMatchedLength U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedLength) #define usearch_getMatchedStart U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedStart) #define usearch_getMatchedText U_ICU_ENTRY_POINT_RENAME(usearch_getMatchedText) #define usearch_getOffset U_ICU_ENTRY_POINT_RENAME(usearch_getOffset) #define usearch_getPattern U_ICU_ENTRY_POINT_RENAME(usearch_getPattern) #define usearch_getText U_ICU_ENTRY_POINT_RENAME(usearch_getText) #define usearch_handleNextCanonical U_ICU_ENTRY_POINT_RENAME(usearch_handleNextCanonical) #define usearch_handleNextExact U_ICU_ENTRY_POINT_RENAME(usearch_handleNextExact) #define usearch_handlePreviousCanonical U_ICU_ENTRY_POINT_RENAME(usearch_handlePreviousCanonical) #define usearch_handlePreviousExact U_ICU_ENTRY_POINT_RENAME(usearch_handlePreviousExact) #define usearch_last U_ICU_ENTRY_POINT_RENAME(usearch_last) #define usearch_next U_ICU_ENTRY_POINT_RENAME(usearch_next) #define usearch_open U_ICU_ENTRY_POINT_RENAME(usearch_open) #define usearch_openFromCollator U_ICU_ENTRY_POINT_RENAME(usearch_openFromCollator) #define usearch_preceding U_ICU_ENTRY_POINT_RENAME(usearch_preceding) #define usearch_previous U_ICU_ENTRY_POINT_RENAME(usearch_previous) #define usearch_reset U_ICU_ENTRY_POINT_RENAME(usearch_reset) #define usearch_search U_ICU_ENTRY_POINT_RENAME(usearch_search) #define usearch_searchBackwards U_ICU_ENTRY_POINT_RENAME(usearch_searchBackwards) #define usearch_setAttribute U_ICU_ENTRY_POINT_RENAME(usearch_setAttribute) #define usearch_setBreakIterator U_ICU_ENTRY_POINT_RENAME(usearch_setBreakIterator) #define usearch_setCollator U_ICU_ENTRY_POINT_RENAME(usearch_setCollator) #define usearch_setOffset U_ICU_ENTRY_POINT_RENAME(usearch_setOffset) #define usearch_setPattern U_ICU_ENTRY_POINT_RENAME(usearch_setPattern) #define usearch_setText U_ICU_ENTRY_POINT_RENAME(usearch_setText) #define uset_add U_ICU_ENTRY_POINT_RENAME(uset_add) #define uset_addAll U_ICU_ENTRY_POINT_RENAME(uset_addAll) #define uset_addAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_addAllCodePoints) #define uset_addRange U_ICU_ENTRY_POINT_RENAME(uset_addRange) #define uset_addString U_ICU_ENTRY_POINT_RENAME(uset_addString) #define uset_applyIntPropertyValue U_ICU_ENTRY_POINT_RENAME(uset_applyIntPropertyValue) #define uset_applyPattern U_ICU_ENTRY_POINT_RENAME(uset_applyPattern) #define uset_applyPropertyAlias U_ICU_ENTRY_POINT_RENAME(uset_applyPropertyAlias) #define uset_charAt U_ICU_ENTRY_POINT_RENAME(uset_charAt) #define uset_clear U_ICU_ENTRY_POINT_RENAME(uset_clear) #define uset_clone U_ICU_ENTRY_POINT_RENAME(uset_clone) #define uset_cloneAsThawed U_ICU_ENTRY_POINT_RENAME(uset_cloneAsThawed) #define uset_close U_ICU_ENTRY_POINT_RENAME(uset_close) #define uset_closeOver U_ICU_ENTRY_POINT_RENAME(uset_closeOver) #define uset_compact U_ICU_ENTRY_POINT_RENAME(uset_compact) #define uset_complement U_ICU_ENTRY_POINT_RENAME(uset_complement) #define uset_complementAll U_ICU_ENTRY_POINT_RENAME(uset_complementAll) #define uset_contains U_ICU_ENTRY_POINT_RENAME(uset_contains) #define uset_containsAll U_ICU_ENTRY_POINT_RENAME(uset_containsAll) #define uset_containsAllCodePoints U_ICU_ENTRY_POINT_RENAME(uset_containsAllCodePoints) #define uset_containsNone U_ICU_ENTRY_POINT_RENAME(uset_containsNone) #define uset_containsRange U_ICU_ENTRY_POINT_RENAME(uset_containsRange) #define uset_containsSome U_ICU_ENTRY_POINT_RENAME(uset_containsSome) #define uset_containsString U_ICU_ENTRY_POINT_RENAME(uset_containsString) #define uset_equals U_ICU_ENTRY_POINT_RENAME(uset_equals) #define uset_freeze U_ICU_ENTRY_POINT_RENAME(uset_freeze) #define uset_getItem U_ICU_ENTRY_POINT_RENAME(uset_getItem) #define uset_getItemCount U_ICU_ENTRY_POINT_RENAME(uset_getItemCount) #define uset_getSerializedRange U_ICU_ENTRY_POINT_RENAME(uset_getSerializedRange) #define uset_getSerializedRangeCount U_ICU_ENTRY_POINT_RENAME(uset_getSerializedRangeCount) #define uset_getSerializedSet U_ICU_ENTRY_POINT_RENAME(uset_getSerializedSet) #define uset_indexOf U_ICU_ENTRY_POINT_RENAME(uset_indexOf) #define uset_isEmpty U_ICU_ENTRY_POINT_RENAME(uset_isEmpty) #define uset_isFrozen U_ICU_ENTRY_POINT_RENAME(uset_isFrozen) #define uset_open U_ICU_ENTRY_POINT_RENAME(uset_open) #define uset_openEmpty U_ICU_ENTRY_POINT_RENAME(uset_openEmpty) #define uset_openPattern U_ICU_ENTRY_POINT_RENAME(uset_openPattern) #define uset_openPatternOptions U_ICU_ENTRY_POINT_RENAME(uset_openPatternOptions) #define uset_remove U_ICU_ENTRY_POINT_RENAME(uset_remove) #define uset_removeAll U_ICU_ENTRY_POINT_RENAME(uset_removeAll) #define uset_removeAllStrings U_ICU_ENTRY_POINT_RENAME(uset_removeAllStrings) #define uset_removeRange U_ICU_ENTRY_POINT_RENAME(uset_removeRange) #define uset_removeString U_ICU_ENTRY_POINT_RENAME(uset_removeString) #define uset_resemblesPattern U_ICU_ENTRY_POINT_RENAME(uset_resemblesPattern) #define uset_retain U_ICU_ENTRY_POINT_RENAME(uset_retain) #define uset_retainAll U_ICU_ENTRY_POINT_RENAME(uset_retainAll) #define uset_serialize U_ICU_ENTRY_POINT_RENAME(uset_serialize) #define uset_serializedContains U_ICU_ENTRY_POINT_RENAME(uset_serializedContains) #define uset_set U_ICU_ENTRY_POINT_RENAME(uset_set) #define uset_setSerializedToOne U_ICU_ENTRY_POINT_RENAME(uset_setSerializedToOne) #define uset_size U_ICU_ENTRY_POINT_RENAME(uset_size) #define uset_span U_ICU_ENTRY_POINT_RENAME(uset_span) #define uset_spanBack U_ICU_ENTRY_POINT_RENAME(uset_spanBack) #define uset_spanBackUTF8 U_ICU_ENTRY_POINT_RENAME(uset_spanBackUTF8) #define uset_spanUTF8 U_ICU_ENTRY_POINT_RENAME(uset_spanUTF8) #define uset_toPattern U_ICU_ENTRY_POINT_RENAME(uset_toPattern) #define uspoof_areConfusable U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusable) #define uspoof_areConfusableUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusableUTF8) #define uspoof_areConfusableUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusableUnicodeString) #define uspoof_check U_ICU_ENTRY_POINT_RENAME(uspoof_check) #define uspoof_checkUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_checkUTF8) #define uspoof_checkUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_checkUnicodeString) #define uspoof_clone U_ICU_ENTRY_POINT_RENAME(uspoof_clone) #define uspoof_close U_ICU_ENTRY_POINT_RENAME(uspoof_close) #define uspoof_getAllowedChars U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedChars) #define uspoof_getAllowedLocales U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedLocales) #define uspoof_getAllowedUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_getAllowedUnicodeSet) #define uspoof_getChecks U_ICU_ENTRY_POINT_RENAME(uspoof_getChecks) #define uspoof_getSkeleton U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeleton) #define uspoof_getSkeletonUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeletonUTF8) #define uspoof_getSkeletonUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_getSkeletonUnicodeString) #define uspoof_open U_ICU_ENTRY_POINT_RENAME(uspoof_open) #define uspoof_openFromSerialized U_ICU_ENTRY_POINT_RENAME(uspoof_openFromSerialized) #define uspoof_openFromSource U_ICU_ENTRY_POINT_RENAME(uspoof_openFromSource) #define uspoof_serialize U_ICU_ENTRY_POINT_RENAME(uspoof_serialize) #define uspoof_setAllowedChars U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedChars) #define uspoof_setAllowedLocales U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedLocales) #define uspoof_setAllowedUnicodeSet U_ICU_ENTRY_POINT_RENAME(uspoof_setAllowedUnicodeSet) #define uspoof_setChecks U_ICU_ENTRY_POINT_RENAME(uspoof_setChecks) #define uspoof_swap U_ICU_ENTRY_POINT_RENAME(uspoof_swap) #define usprep_close U_ICU_ENTRY_POINT_RENAME(usprep_close) #define usprep_open U_ICU_ENTRY_POINT_RENAME(usprep_open) #define usprep_openByType U_ICU_ENTRY_POINT_RENAME(usprep_openByType) #define usprep_prepare U_ICU_ENTRY_POINT_RENAME(usprep_prepare) #define usprep_swap U_ICU_ENTRY_POINT_RENAME(usprep_swap) #define ustr_foldCase U_ICU_ENTRY_POINT_RENAME(ustr_foldCase) #define ustr_toLower U_ICU_ENTRY_POINT_RENAME(ustr_toLower) #define ustr_toTitle U_ICU_ENTRY_POINT_RENAME(ustr_toTitle) #define ustr_toUpper U_ICU_ENTRY_POINT_RENAME(ustr_toUpper) #define utext_caseCompare U_ICU_ENTRY_POINT_RENAME(utext_caseCompare) #define utext_caseCompareNativeLimit U_ICU_ENTRY_POINT_RENAME(utext_caseCompareNativeLimit) #define utext_char32At U_ICU_ENTRY_POINT_RENAME(utext_char32At) #define utext_clone U_ICU_ENTRY_POINT_RENAME(utext_clone) #define utext_close U_ICU_ENTRY_POINT_RENAME(utext_close) #define utext_compare U_ICU_ENTRY_POINT_RENAME(utext_compare) #define utext_compareNativeLimit U_ICU_ENTRY_POINT_RENAME(utext_compareNativeLimit) #define utext_copy U_ICU_ENTRY_POINT_RENAME(utext_copy) #define utext_current32 U_ICU_ENTRY_POINT_RENAME(utext_current32) #define utext_equals U_ICU_ENTRY_POINT_RENAME(utext_equals) #define utext_extract U_ICU_ENTRY_POINT_RENAME(utext_extract) #define utext_freeze U_ICU_ENTRY_POINT_RENAME(utext_freeze) #define utext_getNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_getNativeIndex) #define utext_getPreviousNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_getPreviousNativeIndex) #define utext_hasMetaData U_ICU_ENTRY_POINT_RENAME(utext_hasMetaData) #define utext_isLengthExpensive U_ICU_ENTRY_POINT_RENAME(utext_isLengthExpensive) #define utext_isWritable U_ICU_ENTRY_POINT_RENAME(utext_isWritable) #define utext_moveIndex32 U_ICU_ENTRY_POINT_RENAME(utext_moveIndex32) #define utext_nativeLength U_ICU_ENTRY_POINT_RENAME(utext_nativeLength) #define utext_next32 U_ICU_ENTRY_POINT_RENAME(utext_next32) #define utext_next32From U_ICU_ENTRY_POINT_RENAME(utext_next32From) #define utext_openCharacterIterator U_ICU_ENTRY_POINT_RENAME(utext_openCharacterIterator) #define utext_openConstUnicodeString U_ICU_ENTRY_POINT_RENAME(utext_openConstUnicodeString) #define utext_openReplaceable U_ICU_ENTRY_POINT_RENAME(utext_openReplaceable) #define utext_openUChars U_ICU_ENTRY_POINT_RENAME(utext_openUChars) #define utext_openUTF8 U_ICU_ENTRY_POINT_RENAME(utext_openUTF8) #define utext_openUnicodeString U_ICU_ENTRY_POINT_RENAME(utext_openUnicodeString) #define utext_previous32 U_ICU_ENTRY_POINT_RENAME(utext_previous32) #define utext_previous32From U_ICU_ENTRY_POINT_RENAME(utext_previous32From) #define utext_replace U_ICU_ENTRY_POINT_RENAME(utext_replace) #define utext_setNativeIndex U_ICU_ENTRY_POINT_RENAME(utext_setNativeIndex) #define utext_setup U_ICU_ENTRY_POINT_RENAME(utext_setup) #define utf8_appendCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_appendCharSafeBody) #define utf8_back1SafeBody U_ICU_ENTRY_POINT_RENAME(utf8_back1SafeBody) #define utf8_countTrailBytes U_ICU_ENTRY_POINT_RENAME(utf8_countTrailBytes) #define utf8_nextCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_nextCharSafeBody) #define utf8_prevCharSafeBody U_ICU_ENTRY_POINT_RENAME(utf8_prevCharSafeBody) #define utmscale_fromInt64 U_ICU_ENTRY_POINT_RENAME(utmscale_fromInt64) #define utmscale_getTimeScaleValue U_ICU_ENTRY_POINT_RENAME(utmscale_getTimeScaleValue) #define utmscale_toInt64 U_ICU_ENTRY_POINT_RENAME(utmscale_toInt64) #define utrace_cleanup U_ICU_ENTRY_POINT_RENAME(utrace_cleanup) #define utrace_data U_ICU_ENTRY_POINT_RENAME(utrace_data) #define utrace_entry U_ICU_ENTRY_POINT_RENAME(utrace_entry) #define utrace_exit U_ICU_ENTRY_POINT_RENAME(utrace_exit) #define utrace_format U_ICU_ENTRY_POINT_RENAME(utrace_format) #define utrace_functionName U_ICU_ENTRY_POINT_RENAME(utrace_functionName) #define utrace_getFunctions U_ICU_ENTRY_POINT_RENAME(utrace_getFunctions) #define utrace_getLevel U_ICU_ENTRY_POINT_RENAME(utrace_getLevel) #define utrace_level U_ICU_ENTRY_POINT_RENAME(utrace_level) #define utrace_setFunctions U_ICU_ENTRY_POINT_RENAME(utrace_setFunctions) #define utrace_setLevel U_ICU_ENTRY_POINT_RENAME(utrace_setLevel) #define utrace_vformat U_ICU_ENTRY_POINT_RENAME(utrace_vformat) #define utrans_clone U_ICU_ENTRY_POINT_RENAME(utrans_clone) #define utrans_close U_ICU_ENTRY_POINT_RENAME(utrans_close) #define utrans_countAvailableIDs U_ICU_ENTRY_POINT_RENAME(utrans_countAvailableIDs) #define utrans_getAvailableID U_ICU_ENTRY_POINT_RENAME(utrans_getAvailableID) #define utrans_getID U_ICU_ENTRY_POINT_RENAME(utrans_getID) #define utrans_getUnicodeID U_ICU_ENTRY_POINT_RENAME(utrans_getUnicodeID) #define utrans_open U_ICU_ENTRY_POINT_RENAME(utrans_open) #define utrans_openIDs U_ICU_ENTRY_POINT_RENAME(utrans_openIDs) #define utrans_openInverse U_ICU_ENTRY_POINT_RENAME(utrans_openInverse) #define utrans_openU U_ICU_ENTRY_POINT_RENAME(utrans_openU) #define utrans_register U_ICU_ENTRY_POINT_RENAME(utrans_register) #define utrans_rep_caseContextIterator U_ICU_ENTRY_POINT_RENAME(utrans_rep_caseContextIterator) #define utrans_setFilter U_ICU_ENTRY_POINT_RENAME(utrans_setFilter) #define utrans_stripRules U_ICU_ENTRY_POINT_RENAME(utrans_stripRules) #define utrans_trans U_ICU_ENTRY_POINT_RENAME(utrans_trans) #define utrans_transIncremental U_ICU_ENTRY_POINT_RENAME(utrans_transIncremental) #define utrans_transIncrementalUChars U_ICU_ENTRY_POINT_RENAME(utrans_transIncrementalUChars) #define utrans_transUChars U_ICU_ENTRY_POINT_RENAME(utrans_transUChars) #define utrans_transliterator_cleanup U_ICU_ENTRY_POINT_RENAME(utrans_transliterator_cleanup) #define utrans_unregister U_ICU_ENTRY_POINT_RENAME(utrans_unregister) #define utrans_unregisterID U_ICU_ENTRY_POINT_RENAME(utrans_unregisterID) #define utrie2_clone U_ICU_ENTRY_POINT_RENAME(utrie2_clone) #define utrie2_cloneAsThawed U_ICU_ENTRY_POINT_RENAME(utrie2_cloneAsThawed) #define utrie2_close U_ICU_ENTRY_POINT_RENAME(utrie2_close) #define utrie2_enum U_ICU_ENTRY_POINT_RENAME(utrie2_enum) #define utrie2_enumForLeadSurrogate U_ICU_ENTRY_POINT_RENAME(utrie2_enumForLeadSurrogate) #define utrie2_freeze U_ICU_ENTRY_POINT_RENAME(utrie2_freeze) #define utrie2_fromUTrie U_ICU_ENTRY_POINT_RENAME(utrie2_fromUTrie) #define utrie2_get32 U_ICU_ENTRY_POINT_RENAME(utrie2_get32) #define utrie2_get32FromLeadSurrogateCodeUnit U_ICU_ENTRY_POINT_RENAME(utrie2_get32FromLeadSurrogateCodeUnit) #define utrie2_getVersion U_ICU_ENTRY_POINT_RENAME(utrie2_getVersion) #define utrie2_internalU8NextIndex U_ICU_ENTRY_POINT_RENAME(utrie2_internalU8NextIndex) #define utrie2_internalU8PrevIndex U_ICU_ENTRY_POINT_RENAME(utrie2_internalU8PrevIndex) #define utrie2_isFrozen U_ICU_ENTRY_POINT_RENAME(utrie2_isFrozen) #define utrie2_open U_ICU_ENTRY_POINT_RENAME(utrie2_open) #define utrie2_openDummy U_ICU_ENTRY_POINT_RENAME(utrie2_openDummy) #define utrie2_openFromSerialized U_ICU_ENTRY_POINT_RENAME(utrie2_openFromSerialized) #define utrie2_serialize U_ICU_ENTRY_POINT_RENAME(utrie2_serialize) #define utrie2_set32 U_ICU_ENTRY_POINT_RENAME(utrie2_set32) #define utrie2_set32ForLeadSurrogateCodeUnit U_ICU_ENTRY_POINT_RENAME(utrie2_set32ForLeadSurrogateCodeUnit) #define utrie2_setRange32 U_ICU_ENTRY_POINT_RENAME(utrie2_setRange32) #define utrie2_swap U_ICU_ENTRY_POINT_RENAME(utrie2_swap) #define utrie2_swapAnyVersion U_ICU_ENTRY_POINT_RENAME(utrie2_swapAnyVersion) #define utrie_clone U_ICU_ENTRY_POINT_RENAME(utrie_clone) #define utrie_close U_ICU_ENTRY_POINT_RENAME(utrie_close) #define utrie_defaultGetFoldingOffset U_ICU_ENTRY_POINT_RENAME(utrie_defaultGetFoldingOffset) #define utrie_enum U_ICU_ENTRY_POINT_RENAME(utrie_enum) #define utrie_get32 U_ICU_ENTRY_POINT_RENAME(utrie_get32) #define utrie_getData U_ICU_ENTRY_POINT_RENAME(utrie_getData) #define utrie_open U_ICU_ENTRY_POINT_RENAME(utrie_open) #define utrie_serialize U_ICU_ENTRY_POINT_RENAME(utrie_serialize) #define utrie_set32 U_ICU_ENTRY_POINT_RENAME(utrie_set32) #define utrie_setRange32 U_ICU_ENTRY_POINT_RENAME(utrie_setRange32) #define utrie_swap U_ICU_ENTRY_POINT_RENAME(utrie_swap) #define utrie_unserialize U_ICU_ENTRY_POINT_RENAME(utrie_unserialize) #define utrie_unserializeDummy U_ICU_ENTRY_POINT_RENAME(utrie_unserializeDummy) #define vzone_clone U_ICU_ENTRY_POINT_RENAME(vzone_clone) #define vzone_close U_ICU_ENTRY_POINT_RENAME(vzone_close) #define vzone_countTransitionRules U_ICU_ENTRY_POINT_RENAME(vzone_countTransitionRules) #define vzone_equals U_ICU_ENTRY_POINT_RENAME(vzone_equals) #define vzone_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(vzone_getDynamicClassID) #define vzone_getLastModified U_ICU_ENTRY_POINT_RENAME(vzone_getLastModified) #define vzone_getNextTransition U_ICU_ENTRY_POINT_RENAME(vzone_getNextTransition) #define vzone_getOffset U_ICU_ENTRY_POINT_RENAME(vzone_getOffset) #define vzone_getOffset2 U_ICU_ENTRY_POINT_RENAME(vzone_getOffset2) #define vzone_getOffset3 U_ICU_ENTRY_POINT_RENAME(vzone_getOffset3) #define vzone_getPreviousTransition U_ICU_ENTRY_POINT_RENAME(vzone_getPreviousTransition) #define vzone_getRawOffset U_ICU_ENTRY_POINT_RENAME(vzone_getRawOffset) #define vzone_getStaticClassID U_ICU_ENTRY_POINT_RENAME(vzone_getStaticClassID) #define vzone_getTZURL U_ICU_ENTRY_POINT_RENAME(vzone_getTZURL) #define vzone_hasSameRules U_ICU_ENTRY_POINT_RENAME(vzone_hasSameRules) #define vzone_inDaylightTime U_ICU_ENTRY_POINT_RENAME(vzone_inDaylightTime) #define vzone_openData U_ICU_ENTRY_POINT_RENAME(vzone_openData) #define vzone_openID U_ICU_ENTRY_POINT_RENAME(vzone_openID) #define vzone_setLastModified U_ICU_ENTRY_POINT_RENAME(vzone_setLastModified) #define vzone_setRawOffset U_ICU_ENTRY_POINT_RENAME(vzone_setRawOffset) #define vzone_setTZURL U_ICU_ENTRY_POINT_RENAME(vzone_setTZURL) #define vzone_useDaylightTime U_ICU_ENTRY_POINT_RENAME(vzone_useDaylightTime) #define vzone_write U_ICU_ENTRY_POINT_RENAME(vzone_write) #define vzone_writeFromStart U_ICU_ENTRY_POINT_RENAME(vzone_writeFromStart) #define vzone_writeSimple U_ICU_ENTRY_POINT_RENAME(vzone_writeSimple) #define zrule_close U_ICU_ENTRY_POINT_RENAME(zrule_close) #define zrule_equals U_ICU_ENTRY_POINT_RENAME(zrule_equals) #define zrule_getDSTSavings U_ICU_ENTRY_POINT_RENAME(zrule_getDSTSavings) #define zrule_getName U_ICU_ENTRY_POINT_RENAME(zrule_getName) #define zrule_getRawOffset U_ICU_ENTRY_POINT_RENAME(zrule_getRawOffset) #define zrule_isEquivalentTo U_ICU_ENTRY_POINT_RENAME(zrule_isEquivalentTo) #define ztrans_adoptFrom U_ICU_ENTRY_POINT_RENAME(ztrans_adoptFrom) #define ztrans_adoptTo U_ICU_ENTRY_POINT_RENAME(ztrans_adoptTo) #define ztrans_clone U_ICU_ENTRY_POINT_RENAME(ztrans_clone) #define ztrans_close U_ICU_ENTRY_POINT_RENAME(ztrans_close) #define ztrans_equals U_ICU_ENTRY_POINT_RENAME(ztrans_equals) #define ztrans_getDynamicClassID U_ICU_ENTRY_POINT_RENAME(ztrans_getDynamicClassID) #define ztrans_getFrom U_ICU_ENTRY_POINT_RENAME(ztrans_getFrom) #define ztrans_getStaticClassID U_ICU_ENTRY_POINT_RENAME(ztrans_getStaticClassID) #define ztrans_getTime U_ICU_ENTRY_POINT_RENAME(ztrans_getTime) #define ztrans_getTo U_ICU_ENTRY_POINT_RENAME(ztrans_getTo) #define ztrans_open U_ICU_ENTRY_POINT_RENAME(ztrans_open) #define ztrans_openEmpty U_ICU_ENTRY_POINT_RENAME(ztrans_openEmpty) #define ztrans_setFrom U_ICU_ENTRY_POINT_RENAME(ztrans_setFrom) #define ztrans_setTime U_ICU_ENTRY_POINT_RENAME(ztrans_setTime) #define ztrans_setTo U_ICU_ENTRY_POINT_RENAME(ztrans_setTo) /* C++ class names renaming defines */ #ifdef XP_CPLUSPLUS #if !U_HAVE_NAMESPACE #define AbsoluteValueSubstitution U_ICU_ENTRY_POINT_RENAME(AbsoluteValueSubstitution) #define AlternateSubstitutionSubtable U_ICU_ENTRY_POINT_RENAME(AlternateSubstitutionSubtable) #define AnchorTable U_ICU_ENTRY_POINT_RENAME(AnchorTable) #define AndConstraint U_ICU_ENTRY_POINT_RENAME(AndConstraint) #define AnnualTimeZoneRule U_ICU_ENTRY_POINT_RENAME(AnnualTimeZoneRule) #define AnyTransliterator U_ICU_ENTRY_POINT_RENAME(AnyTransliterator) #define ArabicOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(ArabicOpenTypeLayoutEngine) #define ArabicShaping U_ICU_ENTRY_POINT_RENAME(ArabicShaping) #define ArgExtractor U_ICU_ENTRY_POINT_RENAME(ArgExtractor) #define BMPSet U_ICU_ENTRY_POINT_RENAME(BMPSet) #define BackwardUTrie2StringIterator U_ICU_ENTRY_POINT_RENAME(BackwardUTrie2StringIterator) #define BadCharacterTable U_ICU_ENTRY_POINT_RENAME(BadCharacterTable) #define BasicCalendarFactory U_ICU_ENTRY_POINT_RENAME(BasicCalendarFactory) #define BasicTimeZone U_ICU_ENTRY_POINT_RENAME(BasicTimeZone) #define BinarySearchLookupTable U_ICU_ENTRY_POINT_RENAME(BinarySearchLookupTable) #define BoyerMooreSearch U_ICU_ENTRY_POINT_RENAME(BoyerMooreSearch) #define BreakIterator U_ICU_ENTRY_POINT_RENAME(BreakIterator) #define BreakTransliterator U_ICU_ENTRY_POINT_RENAME(BreakTransliterator) #define BuddhistCalendar U_ICU_ENTRY_POINT_RENAME(BuddhistCalendar) #define BuildCompactTrieHorizontalNode U_ICU_ENTRY_POINT_RENAME(BuildCompactTrieHorizontalNode) #define BuildCompactTrieNode U_ICU_ENTRY_POINT_RENAME(BuildCompactTrieNode) #define BuildCompactTrieVerticalNode U_ICU_ENTRY_POINT_RENAME(BuildCompactTrieVerticalNode) #define BuilderScriptSet U_ICU_ENTRY_POINT_RENAME(BuilderScriptSet) #define ByteSink U_ICU_ENTRY_POINT_RENAME(ByteSink) #define CEBuffer U_ICU_ENTRY_POINT_RENAME(CEBuffer) #define CECalendar U_ICU_ENTRY_POINT_RENAME(CECalendar) #define CEList U_ICU_ENTRY_POINT_RENAME(CEList) #define CEToStringsMap U_ICU_ENTRY_POINT_RENAME(CEToStringsMap) #define CFactory U_ICU_ENTRY_POINT_RENAME(CFactory) #define Calendar U_ICU_ENTRY_POINT_RENAME(Calendar) #define CalendarAstronomer U_ICU_ENTRY_POINT_RENAME(CalendarAstronomer) #define CalendarCache U_ICU_ENTRY_POINT_RENAME(CalendarCache) #define CalendarData U_ICU_ENTRY_POINT_RENAME(CalendarData) #define CalendarService U_ICU_ENTRY_POINT_RENAME(CalendarService) #define CanonIterData U_ICU_ENTRY_POINT_RENAME(CanonIterData) #define CanonIterDataSingleton U_ICU_ENTRY_POINT_RENAME(CanonIterDataSingleton) #define CanonMarkFilter U_ICU_ENTRY_POINT_RENAME(CanonMarkFilter) #define CanonShaping U_ICU_ENTRY_POINT_RENAME(CanonShaping) #define CanonicalIterator U_ICU_ENTRY_POINT_RENAME(CanonicalIterator) #define CaseMapTransliterator U_ICU_ENTRY_POINT_RENAME(CaseMapTransliterator) #define ChainingContextualSubstitutionFormat1Subtable U_ICU_ENTRY_POINT_RENAME(ChainingContextualSubstitutionFormat1Subtable) #define ChainingContextualSubstitutionFormat2Subtable U_ICU_ENTRY_POINT_RENAME(ChainingContextualSubstitutionFormat2Subtable) #define ChainingContextualSubstitutionFormat3Subtable U_ICU_ENTRY_POINT_RENAME(ChainingContextualSubstitutionFormat3Subtable) #define ChainingContextualSubstitutionSubtable U_ICU_ENTRY_POINT_RENAME(ChainingContextualSubstitutionSubtable) #define CharString U_ICU_ENTRY_POINT_RENAME(CharString) #define CharSubstitutionFilter U_ICU_ENTRY_POINT_RENAME(CharSubstitutionFilter) #define CharacterIterator U_ICU_ENTRY_POINT_RENAME(CharacterIterator) #define CharacterNode U_ICU_ENTRY_POINT_RENAME(CharacterNode) #define CharsetDetector U_ICU_ENTRY_POINT_RENAME(CharsetDetector) #define CharsetMatch U_ICU_ENTRY_POINT_RENAME(CharsetMatch) #define CharsetRecog_2022 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_2022) #define CharsetRecog_2022CN U_ICU_ENTRY_POINT_RENAME(CharsetRecog_2022CN) #define CharsetRecog_2022JP U_ICU_ENTRY_POINT_RENAME(CharsetRecog_2022JP) #define CharsetRecog_2022KR U_ICU_ENTRY_POINT_RENAME(CharsetRecog_2022KR) #define CharsetRecog_8859_1 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1) #define CharsetRecog_8859_1_da U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_da) #define CharsetRecog_8859_1_de U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_de) #define CharsetRecog_8859_1_en U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_en) #define CharsetRecog_8859_1_es U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_es) #define CharsetRecog_8859_1_fr U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_fr) #define CharsetRecog_8859_1_it U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_it) #define CharsetRecog_8859_1_nl U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_nl) #define CharsetRecog_8859_1_no U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_no) #define CharsetRecog_8859_1_pt U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_pt) #define CharsetRecog_8859_1_sv U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_1_sv) #define CharsetRecog_8859_2 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_2) #define CharsetRecog_8859_2_cs U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_2_cs) #define CharsetRecog_8859_2_hu U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_2_hu) #define CharsetRecog_8859_2_pl U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_2_pl) #define CharsetRecog_8859_2_ro U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_2_ro) #define CharsetRecog_8859_5 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_5) #define CharsetRecog_8859_5_ru U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_5_ru) #define CharsetRecog_8859_6 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_6) #define CharsetRecog_8859_6_ar U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_6_ar) #define CharsetRecog_8859_7 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_7) #define CharsetRecog_8859_7_el U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_7_el) #define CharsetRecog_8859_8 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_8) #define CharsetRecog_8859_8_I_he U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_8_I_he) #define CharsetRecog_8859_8_he U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_8_he) #define CharsetRecog_8859_9 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_9) #define CharsetRecog_8859_9_tr U_ICU_ENTRY_POINT_RENAME(CharsetRecog_8859_9_tr) #define CharsetRecog_IBM420_ar U_ICU_ENTRY_POINT_RENAME(CharsetRecog_IBM420_ar) #define CharsetRecog_IBM420_ar_ltr U_ICU_ENTRY_POINT_RENAME(CharsetRecog_IBM420_ar_ltr) #define CharsetRecog_IBM420_ar_rtl U_ICU_ENTRY_POINT_RENAME(CharsetRecog_IBM420_ar_rtl) #define CharsetRecog_IBM424_he U_ICU_ENTRY_POINT_RENAME(CharsetRecog_IBM424_he) #define CharsetRecog_IBM424_he_ltr U_ICU_ENTRY_POINT_RENAME(CharsetRecog_IBM424_he_ltr) #define CharsetRecog_IBM424_he_rtl U_ICU_ENTRY_POINT_RENAME(CharsetRecog_IBM424_he_rtl) #define CharsetRecog_KOI8_R U_ICU_ENTRY_POINT_RENAME(CharsetRecog_KOI8_R) #define CharsetRecog_UTF8 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_UTF8) #define CharsetRecog_UTF_16_BE U_ICU_ENTRY_POINT_RENAME(CharsetRecog_UTF_16_BE) #define CharsetRecog_UTF_16_LE U_ICU_ENTRY_POINT_RENAME(CharsetRecog_UTF_16_LE) #define CharsetRecog_UTF_32 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_UTF_32) #define CharsetRecog_UTF_32_BE U_ICU_ENTRY_POINT_RENAME(CharsetRecog_UTF_32_BE) #define CharsetRecog_UTF_32_LE U_ICU_ENTRY_POINT_RENAME(CharsetRecog_UTF_32_LE) #define CharsetRecog_Unicode U_ICU_ENTRY_POINT_RENAME(CharsetRecog_Unicode) #define CharsetRecog_big5 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_big5) #define CharsetRecog_euc U_ICU_ENTRY_POINT_RENAME(CharsetRecog_euc) #define CharsetRecog_euc_jp U_ICU_ENTRY_POINT_RENAME(CharsetRecog_euc_jp) #define CharsetRecog_euc_kr U_ICU_ENTRY_POINT_RENAME(CharsetRecog_euc_kr) #define CharsetRecog_gb_18030 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_gb_18030) #define CharsetRecog_mbcs U_ICU_ENTRY_POINT_RENAME(CharsetRecog_mbcs) #define CharsetRecog_sbcs U_ICU_ENTRY_POINT_RENAME(CharsetRecog_sbcs) #define CharsetRecog_sjis U_ICU_ENTRY_POINT_RENAME(CharsetRecog_sjis) #define CharsetRecog_windows_1251 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_windows_1251) #define CharsetRecog_windows_1256 U_ICU_ENTRY_POINT_RENAME(CharsetRecog_windows_1256) #define CharsetRecognizer U_ICU_ENTRY_POINT_RENAME(CharsetRecognizer) #define CheckedArrayByteSink U_ICU_ENTRY_POINT_RENAME(CheckedArrayByteSink) #define ChineseCalendar U_ICU_ENTRY_POINT_RENAME(ChineseCalendar) #define ChoiceFormat U_ICU_ENTRY_POINT_RENAME(ChoiceFormat) #define ClassDefFormat1Table U_ICU_ENTRY_POINT_RENAME(ClassDefFormat1Table) #define ClassDefFormat2Table U_ICU_ENTRY_POINT_RENAME(ClassDefFormat2Table) #define ClassDefinitionTable U_ICU_ENTRY_POINT_RENAME(ClassDefinitionTable) #define ClockMath U_ICU_ENTRY_POINT_RENAME(ClockMath) #define CollData U_ICU_ENTRY_POINT_RENAME(CollData) #define CollDataCache U_ICU_ENTRY_POINT_RENAME(CollDataCache) #define CollDataCacheEntry U_ICU_ENTRY_POINT_RENAME(CollDataCacheEntry) #define CollationElementIterator U_ICU_ENTRY_POINT_RENAME(CollationElementIterator) #define CollationKey U_ICU_ENTRY_POINT_RENAME(CollationKey) #define CollationLocaleListEnumeration U_ICU_ENTRY_POINT_RENAME(CollationLocaleListEnumeration) #define Collator U_ICU_ENTRY_POINT_RENAME(Collator) #define CollatorFactory U_ICU_ENTRY_POINT_RENAME(CollatorFactory) #define CompactTrieDictionary U_ICU_ENTRY_POINT_RENAME(CompactTrieDictionary) #define CompactTrieEnumeration U_ICU_ENTRY_POINT_RENAME(CompactTrieEnumeration) #define ComposeNormalizer2 U_ICU_ENTRY_POINT_RENAME(ComposeNormalizer2) #define CompoundTransliterator U_ICU_ENTRY_POINT_RENAME(CompoundTransliterator) #define ConfusabledataBuilder U_ICU_ENTRY_POINT_RENAME(ConfusabledataBuilder) #define ContextualGlyphSubstitutionProcessor U_ICU_ENTRY_POINT_RENAME(ContextualGlyphSubstitutionProcessor) #define ContextualSubstitutionBase U_ICU_ENTRY_POINT_RENAME(ContextualSubstitutionBase) #define ContextualSubstitutionFormat1Subtable U_ICU_ENTRY_POINT_RENAME(ContextualSubstitutionFormat1Subtable) #define ContextualSubstitutionFormat2Subtable U_ICU_ENTRY_POINT_RENAME(ContextualSubstitutionFormat2Subtable) #define ContextualSubstitutionFormat3Subtable U_ICU_ENTRY_POINT_RENAME(ContextualSubstitutionFormat3Subtable) #define ContextualSubstitutionSubtable U_ICU_ENTRY_POINT_RENAME(ContextualSubstitutionSubtable) #define CopticCalendar U_ICU_ENTRY_POINT_RENAME(CopticCalendar) #define CoverageFormat1Table U_ICU_ENTRY_POINT_RENAME(CoverageFormat1Table) #define CoverageFormat2Table U_ICU_ENTRY_POINT_RENAME(CoverageFormat2Table) #define CoverageTable U_ICU_ENTRY_POINT_RENAME(CoverageTable) #define CurrencyAmount U_ICU_ENTRY_POINT_RENAME(CurrencyAmount) #define CurrencyFormat U_ICU_ENTRY_POINT_RENAME(CurrencyFormat) #define CurrencyPluralInfo U_ICU_ENTRY_POINT_RENAME(CurrencyPluralInfo) #define CurrencyUnit U_ICU_ENTRY_POINT_RENAME(CurrencyUnit) #define CursiveAttachmentSubtable U_ICU_ENTRY_POINT_RENAME(CursiveAttachmentSubtable) #define DTRedundantEnumeration U_ICU_ENTRY_POINT_RENAME(DTRedundantEnumeration) #define DTSkeletonEnumeration U_ICU_ENTRY_POINT_RENAME(DTSkeletonEnumeration) #define DateFormat U_ICU_ENTRY_POINT_RENAME(DateFormat) #define DateFormatSymbols U_ICU_ENTRY_POINT_RENAME(DateFormatSymbols) #define DateInterval U_ICU_ENTRY_POINT_RENAME(DateInterval) #define DateIntervalFormat U_ICU_ENTRY_POINT_RENAME(DateIntervalFormat) #define DateIntervalInfo U_ICU_ENTRY_POINT_RENAME(DateIntervalInfo) #define DateTimeMatcher U_ICU_ENTRY_POINT_RENAME(DateTimeMatcher) #define DateTimePatternGenerator U_ICU_ENTRY_POINT_RENAME(DateTimePatternGenerator) #define DateTimeRule U_ICU_ENTRY_POINT_RENAME(DateTimeRule) #define DecimalFormat U_ICU_ENTRY_POINT_RENAME(DecimalFormat) #define DecimalFormatSymbols U_ICU_ENTRY_POINT_RENAME(DecimalFormatSymbols) #define DecomposeNormalizer2 U_ICU_ENTRY_POINT_RENAME(DecomposeNormalizer2) #define DefaultCalendarFactory U_ICU_ENTRY_POINT_RENAME(DefaultCalendarFactory) #define DefaultCharMapper U_ICU_ENTRY_POINT_RENAME(DefaultCharMapper) #define DeviceTable U_ICU_ENTRY_POINT_RENAME(DeviceTable) #define DictionaryBreakEngine U_ICU_ENTRY_POINT_RENAME(DictionaryBreakEngine) #define DigitList U_ICU_ENTRY_POINT_RENAME(DigitList) #define DistanceInfo U_ICU_ENTRY_POINT_RENAME(DistanceInfo) #define EnumToOffset U_ICU_ENTRY_POINT_RENAME(EnumToOffset) #define ErrorCode U_ICU_ENTRY_POINT_RENAME(ErrorCode) #define EscapeTransliterator U_ICU_ENTRY_POINT_RENAME(EscapeTransliterator) #define EthiopicCalendar U_ICU_ENTRY_POINT_RENAME(EthiopicCalendar) #define EventListener U_ICU_ENTRY_POINT_RENAME(EventListener) #define ExtensionSubtable U_ICU_ENTRY_POINT_RENAME(ExtensionSubtable) #define FCDNormalizer2 U_ICU_ENTRY_POINT_RENAME(FCDNormalizer2) #define FCDTrieSingleton U_ICU_ENTRY_POINT_RENAME(FCDTrieSingleton) #define FeatureListTable U_ICU_ENTRY_POINT_RENAME(FeatureListTable) #define FieldPosition U_ICU_ENTRY_POINT_RENAME(FieldPosition) #define FieldPositionHandler U_ICU_ENTRY_POINT_RENAME(FieldPositionHandler) #define FieldPositionIterator U_ICU_ENTRY_POINT_RENAME(FieldPositionIterator) #define FieldPositionIteratorHandler U_ICU_ENTRY_POINT_RENAME(FieldPositionIteratorHandler) #define FieldPositionOnlyHandler U_ICU_ENTRY_POINT_RENAME(FieldPositionOnlyHandler) #define FilteredNormalizer2 U_ICU_ENTRY_POINT_RENAME(FilteredNormalizer2) #define FontRuns U_ICU_ENTRY_POINT_RENAME(FontRuns) #define Format U_ICU_ENTRY_POINT_RENAME(Format) #define Format1AnchorTable U_ICU_ENTRY_POINT_RENAME(Format1AnchorTable) #define Format2AnchorTable U_ICU_ENTRY_POINT_RENAME(Format2AnchorTable) #define Format3AnchorTable U_ICU_ENTRY_POINT_RENAME(Format3AnchorTable) #define FormatNameEnumeration U_ICU_ENTRY_POINT_RENAME(FormatNameEnumeration) #define FormatParser U_ICU_ENTRY_POINT_RENAME(FormatParser) #define Formattable U_ICU_ENTRY_POINT_RENAME(Formattable) #define ForwardCharacterIterator U_ICU_ENTRY_POINT_RENAME(ForwardCharacterIterator) #define ForwardUTrie2StringIterator U_ICU_ENTRY_POINT_RENAME(ForwardUTrie2StringIterator) #define FractionalPartSubstitution U_ICU_ENTRY_POINT_RENAME(FractionalPartSubstitution) #define FunctionReplacer U_ICU_ENTRY_POINT_RENAME(FunctionReplacer) #define GDEFMarkFilter U_ICU_ENTRY_POINT_RENAME(GDEFMarkFilter) #define GXLayoutEngine U_ICU_ENTRY_POINT_RENAME(GXLayoutEngine) #define GlyphDefinitionTableHeader U_ICU_ENTRY_POINT_RENAME(GlyphDefinitionTableHeader) #define GlyphIterator U_ICU_ENTRY_POINT_RENAME(GlyphIterator) #define GlyphLookupTableHeader U_ICU_ENTRY_POINT_RENAME(GlyphLookupTableHeader) #define GlyphPositionAdjustments U_ICU_ENTRY_POINT_RENAME(GlyphPositionAdjustments) #define GlyphPositioningLookupProcessor U_ICU_ENTRY_POINT_RENAME(GlyphPositioningLookupProcessor) #define GlyphPositioningTableHeader U_ICU_ENTRY_POINT_RENAME(GlyphPositioningTableHeader) #define GlyphSubstitutionLookupProcessor U_ICU_ENTRY_POINT_RENAME(GlyphSubstitutionLookupProcessor) #define GlyphSubstitutionTableHeader U_ICU_ENTRY_POINT_RENAME(GlyphSubstitutionTableHeader) #define GoodSuffixTable U_ICU_ENTRY_POINT_RENAME(GoodSuffixTable) #define Grego U_ICU_ENTRY_POINT_RENAME(Grego) #define GregorianCalendar U_ICU_ENTRY_POINT_RENAME(GregorianCalendar) #define HanOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(HanOpenTypeLayoutEngine) #define HangulOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(HangulOpenTypeLayoutEngine) #define HebrewCalendar U_ICU_ENTRY_POINT_RENAME(HebrewCalendar) #define ICUBreakIteratorFactory U_ICU_ENTRY_POINT_RENAME(ICUBreakIteratorFactory) #define ICUBreakIteratorService U_ICU_ENTRY_POINT_RENAME(ICUBreakIteratorService) #define ICUCollatorFactory U_ICU_ENTRY_POINT_RENAME(ICUCollatorFactory) #define ICUCollatorService U_ICU_ENTRY_POINT_RENAME(ICUCollatorService) #define ICUDataTable U_ICU_ENTRY_POINT_RENAME(ICUDataTable) #define ICULanguageBreakFactory U_ICU_ENTRY_POINT_RENAME(ICULanguageBreakFactory) #define ICULocaleService U_ICU_ENTRY_POINT_RENAME(ICULocaleService) #define ICUNotifier U_ICU_ENTRY_POINT_RENAME(ICUNotifier) #define ICUNumberFormatFactory U_ICU_ENTRY_POINT_RENAME(ICUNumberFormatFactory) #define ICUNumberFormatService U_ICU_ENTRY_POINT_RENAME(ICUNumberFormatService) #define ICUResourceBundleFactory U_ICU_ENTRY_POINT_RENAME(ICUResourceBundleFactory) #define ICUService U_ICU_ENTRY_POINT_RENAME(ICUService) #define ICUServiceFactory U_ICU_ENTRY_POINT_RENAME(ICUServiceFactory) #define ICUServiceKey U_ICU_ENTRY_POINT_RENAME(ICUServiceKey) #define ICU_Utility U_ICU_ENTRY_POINT_RENAME(ICU_Utility) #define IDNA U_ICU_ENTRY_POINT_RENAME(IDNA) #define IndianCalendar U_ICU_ENTRY_POINT_RENAME(IndianCalendar) #define IndicClassTable U_ICU_ENTRY_POINT_RENAME(IndicClassTable) #define IndicOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(IndicOpenTypeLayoutEngine) #define IndicRearrangementProcessor U_ICU_ENTRY_POINT_RENAME(IndicRearrangementProcessor) #define IndicReordering U_ICU_ENTRY_POINT_RENAME(IndicReordering) #define InitialTimeZoneRule U_ICU_ENTRY_POINT_RENAME(InitialTimeZoneRule) #define InputText U_ICU_ENTRY_POINT_RENAME(InputText) #define IntegralPartSubstitution U_ICU_ENTRY_POINT_RENAME(IntegralPartSubstitution) #define IslamicCalendar U_ICU_ENTRY_POINT_RENAME(IslamicCalendar) #define IteratedChar U_ICU_ENTRY_POINT_RENAME(IteratedChar) #define JapaneseCalendar U_ICU_ENTRY_POINT_RENAME(JapaneseCalendar) #define KernTable U_ICU_ENTRY_POINT_RENAME(KernTable) #define KeywordEnumeration U_ICU_ENTRY_POINT_RENAME(KeywordEnumeration) #define KhmerClassTable U_ICU_ENTRY_POINT_RENAME(KhmerClassTable) #define KhmerOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(KhmerOpenTypeLayoutEngine) #define KhmerReordering U_ICU_ENTRY_POINT_RENAME(KhmerReordering) #define LECharMapper U_ICU_ENTRY_POINT_RENAME(LECharMapper) #define LEFontInstance U_ICU_ENTRY_POINT_RENAME(LEFontInstance) #define LEGlyphFilter U_ICU_ENTRY_POINT_RENAME(LEGlyphFilter) #define LEGlyphStorage U_ICU_ENTRY_POINT_RENAME(LEGlyphStorage) #define LEInsertionCallback U_ICU_ENTRY_POINT_RENAME(LEInsertionCallback) #define LEInsertionList U_ICU_ENTRY_POINT_RENAME(LEInsertionList) #define LXUtilities U_ICU_ENTRY_POINT_RENAME(LXUtilities) #define LanguageBreakEngine U_ICU_ENTRY_POINT_RENAME(LanguageBreakEngine) #define LanguageBreakFactory U_ICU_ENTRY_POINT_RENAME(LanguageBreakFactory) #define LayoutEngine U_ICU_ENTRY_POINT_RENAME(LayoutEngine) #define LigatureSubstitutionProcessor U_ICU_ENTRY_POINT_RENAME(LigatureSubstitutionProcessor) #define LigatureSubstitutionSubtable U_ICU_ENTRY_POINT_RENAME(LigatureSubstitutionSubtable) #define LocDataParser U_ICU_ENTRY_POINT_RENAME(LocDataParser) #define Locale U_ICU_ENTRY_POINT_RENAME(Locale) #define LocaleBased U_ICU_ENTRY_POINT_RENAME(LocaleBased) #define LocaleDisplayNames U_ICU_ENTRY_POINT_RENAME(LocaleDisplayNames) #define LocaleDisplayNamesImpl U_ICU_ENTRY_POINT_RENAME(LocaleDisplayNamesImpl) #define LocaleKey U_ICU_ENTRY_POINT_RENAME(LocaleKey) #define LocaleKeyFactory U_ICU_ENTRY_POINT_RENAME(LocaleKeyFactory) #define LocaleRuns U_ICU_ENTRY_POINT_RENAME(LocaleRuns) #define LocaleUtility U_ICU_ENTRY_POINT_RENAME(LocaleUtility) #define LocalizationInfo U_ICU_ENTRY_POINT_RENAME(LocalizationInfo) #define LookupListTable U_ICU_ENTRY_POINT_RENAME(LookupListTable) #define LookupProcessor U_ICU_ENTRY_POINT_RENAME(LookupProcessor) #define LookupSubtable U_ICU_ENTRY_POINT_RENAME(LookupSubtable) #define LookupTable U_ICU_ENTRY_POINT_RENAME(LookupTable) #define LowercaseTransliterator U_ICU_ENTRY_POINT_RENAME(LowercaseTransliterator) #define MPreFixups U_ICU_ENTRY_POINT_RENAME(MPreFixups) #define MarkArray U_ICU_ENTRY_POINT_RENAME(MarkArray) #define MarkToBasePositioningSubtable U_ICU_ENTRY_POINT_RENAME(MarkToBasePositioningSubtable) #define MarkToLigaturePositioningSubtable U_ICU_ENTRY_POINT_RENAME(MarkToLigaturePositioningSubtable) #define MarkToMarkPositioningSubtable U_ICU_ENTRY_POINT_RENAME(MarkToMarkPositioningSubtable) #define Measure U_ICU_ENTRY_POINT_RENAME(Measure) #define MeasureFormat U_ICU_ENTRY_POINT_RENAME(MeasureFormat) #define MeasureUnit U_ICU_ENTRY_POINT_RENAME(MeasureUnit) #define MessageFormat U_ICU_ENTRY_POINT_RENAME(MessageFormat) #define MessageFormatAdapter U_ICU_ENTRY_POINT_RENAME(MessageFormatAdapter) #define ModulusSubstitution U_ICU_ENTRY_POINT_RENAME(ModulusSubstitution) #define MoonRiseSetCoordFunc U_ICU_ENTRY_POINT_RENAME(MoonRiseSetCoordFunc) #define MoonTimeAngleFunc U_ICU_ENTRY_POINT_RENAME(MoonTimeAngleFunc) #define MorphSubtableHeader U_ICU_ENTRY_POINT_RENAME(MorphSubtableHeader) #define MorphTableHeader U_ICU_ENTRY_POINT_RENAME(MorphTableHeader) #define MultipleSubstitutionSubtable U_ICU_ENTRY_POINT_RENAME(MultipleSubstitutionSubtable) #define MultiplierSubstitution U_ICU_ENTRY_POINT_RENAME(MultiplierSubstitution) #define MutableTrieDictionary U_ICU_ENTRY_POINT_RENAME(MutableTrieDictionary) #define MutableTrieEnumeration U_ICU_ENTRY_POINT_RENAME(MutableTrieEnumeration) #define NFFactory U_ICU_ENTRY_POINT_RENAME(NFFactory) #define NFKDBuffer U_ICU_ENTRY_POINT_RENAME(NFKDBuffer) #define NFRule U_ICU_ENTRY_POINT_RENAME(NFRule) #define NFRuleSet U_ICU_ENTRY_POINT_RENAME(NFRuleSet) #define NFSubstitution U_ICU_ENTRY_POINT_RENAME(NFSubstitution) #define NGramParser U_ICU_ENTRY_POINT_RENAME(NGramParser) #define NameToEnum U_ICU_ENTRY_POINT_RENAME(NameToEnum) #define NameUnicodeTransliterator U_ICU_ENTRY_POINT_RENAME(NameUnicodeTransliterator) #define NonContextualGlyphSubstitutionProcessor U_ICU_ENTRY_POINT_RENAME(NonContextualGlyphSubstitutionProcessor) #define NonContiguousEnumToOffset U_ICU_ENTRY_POINT_RENAME(NonContiguousEnumToOffset) #define NoopNormalizer2 U_ICU_ENTRY_POINT_RENAME(NoopNormalizer2) #define Norm2AllModes U_ICU_ENTRY_POINT_RENAME(Norm2AllModes) #define NormalizationTransliterator U_ICU_ENTRY_POINT_RENAME(NormalizationTransliterator) #define Normalizer U_ICU_ENTRY_POINT_RENAME(Normalizer) #define Normalizer2 U_ICU_ENTRY_POINT_RENAME(Normalizer2) #define Normalizer2Factory U_ICU_ENTRY_POINT_RENAME(Normalizer2Factory) #define Normalizer2Impl U_ICU_ENTRY_POINT_RENAME(Normalizer2Impl) #define Normalizer2WithImpl U_ICU_ENTRY_POINT_RENAME(Normalizer2WithImpl) #define NullSubstitution U_ICU_ENTRY_POINT_RENAME(NullSubstitution) #define NullTransliterator U_ICU_ENTRY_POINT_RENAME(NullTransliterator) #define NumberFormat U_ICU_ENTRY_POINT_RENAME(NumberFormat) #define NumberFormatFactory U_ICU_ENTRY_POINT_RENAME(NumberFormatFactory) #define NumberingSystem U_ICU_ENTRY_POINT_RENAME(NumberingSystem) #define NumeratorSubstitution U_ICU_ENTRY_POINT_RENAME(NumeratorSubstitution) #define OlsonTimeZone U_ICU_ENTRY_POINT_RENAME(OlsonTimeZone) #define OpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(OpenTypeLayoutEngine) #define OpenTypeUtilities U_ICU_ENTRY_POINT_RENAME(OpenTypeUtilities) #define OrConstraint U_ICU_ENTRY_POINT_RENAME(OrConstraint) #define PCEBuffer U_ICU_ENTRY_POINT_RENAME(PCEBuffer) #define PairPositioningFormat1Subtable U_ICU_ENTRY_POINT_RENAME(PairPositioningFormat1Subtable) #define PairPositioningFormat2Subtable U_ICU_ENTRY_POINT_RENAME(PairPositioningFormat2Subtable) #define PairPositioningSubtable U_ICU_ENTRY_POINT_RENAME(PairPositioningSubtable) #define ParagraphLayout U_ICU_ENTRY_POINT_RENAME(ParagraphLayout) #define ParseData U_ICU_ENTRY_POINT_RENAME(ParseData) #define ParsePosition U_ICU_ENTRY_POINT_RENAME(ParsePosition) #define PatternMap U_ICU_ENTRY_POINT_RENAME(PatternMap) #define PatternMapIterator U_ICU_ENTRY_POINT_RENAME(PatternMapIterator) #define PersianCalendar U_ICU_ENTRY_POINT_RENAME(PersianCalendar) #define PluralFormat U_ICU_ENTRY_POINT_RENAME(PluralFormat) #define PluralKeywordEnumeration U_ICU_ENTRY_POINT_RENAME(PluralKeywordEnumeration) #define PluralRules U_ICU_ENTRY_POINT_RENAME(PluralRules) #define PropertyAliases U_ICU_ENTRY_POINT_RENAME(PropertyAliases) #define PtnElem U_ICU_ENTRY_POINT_RENAME(PtnElem) #define PtnSkeleton U_ICU_ENTRY_POINT_RENAME(PtnSkeleton) #define Quantifier U_ICU_ENTRY_POINT_RENAME(Quantifier) #define RBBIDataWrapper U_ICU_ENTRY_POINT_RENAME(RBBIDataWrapper) #define RBBINode U_ICU_ENTRY_POINT_RENAME(RBBINode) #define RBBIRuleBuilder U_ICU_ENTRY_POINT_RENAME(RBBIRuleBuilder) #define RBBIRuleScanner U_ICU_ENTRY_POINT_RENAME(RBBIRuleScanner) #define RBBISetBuilder U_ICU_ENTRY_POINT_RENAME(RBBISetBuilder) #define RBBIStateDescriptor U_ICU_ENTRY_POINT_RENAME(RBBIStateDescriptor) #define RBBISymbolTable U_ICU_ENTRY_POINT_RENAME(RBBISymbolTable) #define RBBISymbolTableEntry U_ICU_ENTRY_POINT_RENAME(RBBISymbolTableEntry) #define RBBITableBuilder U_ICU_ENTRY_POINT_RENAME(RBBITableBuilder) #define RCEBuffer U_ICU_ENTRY_POINT_RENAME(RCEBuffer) #define RangeDescriptor U_ICU_ENTRY_POINT_RENAME(RangeDescriptor) #define RegexCompile U_ICU_ENTRY_POINT_RENAME(RegexCompile) #define RegexMatcher U_ICU_ENTRY_POINT_RENAME(RegexMatcher) #define RegexPattern U_ICU_ENTRY_POINT_RENAME(RegexPattern) #define RegexStaticSets U_ICU_ENTRY_POINT_RENAME(RegexStaticSets) #define RegularExpression U_ICU_ENTRY_POINT_RENAME(RegularExpression) #define RelativeDateFormat U_ICU_ENTRY_POINT_RENAME(RelativeDateFormat) #define RemoveTransliterator U_ICU_ENTRY_POINT_RENAME(RemoveTransliterator) #define ReorderingBuffer U_ICU_ENTRY_POINT_RENAME(ReorderingBuffer) #define Replaceable U_ICU_ENTRY_POINT_RENAME(Replaceable) #define ReplaceableGlue U_ICU_ENTRY_POINT_RENAME(ReplaceableGlue) #define ResourceBundle U_ICU_ENTRY_POINT_RENAME(ResourceBundle) #define RiseSetCoordFunc U_ICU_ENTRY_POINT_RENAME(RiseSetCoordFunc) #define RuleBasedBreakIterator U_ICU_ENTRY_POINT_RENAME(RuleBasedBreakIterator) #define RuleBasedCollator U_ICU_ENTRY_POINT_RENAME(RuleBasedCollator) #define RuleBasedNumberFormat U_ICU_ENTRY_POINT_RENAME(RuleBasedNumberFormat) #define RuleBasedTimeZone U_ICU_ENTRY_POINT_RENAME(RuleBasedTimeZone) #define RuleBasedTransliterator U_ICU_ENTRY_POINT_RENAME(RuleBasedTransliterator) #define RuleChain U_ICU_ENTRY_POINT_RENAME(RuleChain) #define RuleCharacterIterator U_ICU_ENTRY_POINT_RENAME(RuleCharacterIterator) #define RuleHalf U_ICU_ENTRY_POINT_RENAME(RuleHalf) #define RuleParser U_ICU_ENTRY_POINT_RENAME(RuleParser) #define RunArray U_ICU_ENTRY_POINT_RENAME(RunArray) #define SPUString U_ICU_ENTRY_POINT_RENAME(SPUString) #define SPUStringPool U_ICU_ENTRY_POINT_RENAME(SPUStringPool) #define SafeZoneStringFormatPtr U_ICU_ENTRY_POINT_RENAME(SafeZoneStringFormatPtr) #define SameValueSubstitution U_ICU_ENTRY_POINT_RENAME(SameValueSubstitution) #define ScriptListTable U_ICU_ENTRY_POINT_RENAME(ScriptListTable) #define ScriptRunIterator U_ICU_ENTRY_POINT_RENAME(ScriptRunIterator) #define ScriptSet U_ICU_ENTRY_POINT_RENAME(ScriptSet) #define ScriptTable U_ICU_ENTRY_POINT_RENAME(ScriptTable) #define SearchIterator U_ICU_ENTRY_POINT_RENAME(SearchIterator) #define SegmentArrayProcessor U_ICU_ENTRY_POINT_RENAME(SegmentArrayProcessor) #define SegmentSingleProcessor U_ICU_ENTRY_POINT_RENAME(SegmentSingleProcessor) #define SelectFormat U_ICU_ENTRY_POINT_RENAME(SelectFormat) #define ServiceEnumeration U_ICU_ENTRY_POINT_RENAME(ServiceEnumeration) #define ServiceListener U_ICU_ENTRY_POINT_RENAME(ServiceListener) #define SimpleArrayProcessor U_ICU_ENTRY_POINT_RENAME(SimpleArrayProcessor) #define SimpleDateFormat U_ICU_ENTRY_POINT_RENAME(SimpleDateFormat) #define SimpleFactory U_ICU_ENTRY_POINT_RENAME(SimpleFactory) #define SimpleLocaleKeyFactory U_ICU_ENTRY_POINT_RENAME(SimpleLocaleKeyFactory) #define SimpleNumberFormatFactory U_ICU_ENTRY_POINT_RENAME(SimpleNumberFormatFactory) #define SimpleSingleton U_ICU_ENTRY_POINT_RENAME(SimpleSingleton) #define SimpleTimeZone U_ICU_ENTRY_POINT_RENAME(SimpleTimeZone) #define SinglePositioningFormat1Subtable U_ICU_ENTRY_POINT_RENAME(SinglePositioningFormat1Subtable) #define SinglePositioningFormat2Subtable U_ICU_ENTRY_POINT_RENAME(SinglePositioningFormat2Subtable) #define SinglePositioningSubtable U_ICU_ENTRY_POINT_RENAME(SinglePositioningSubtable) #define SingleSubstitutionFormat1Subtable U_ICU_ENTRY_POINT_RENAME(SingleSubstitutionFormat1Subtable) #define SingleSubstitutionFormat2Subtable U_ICU_ENTRY_POINT_RENAME(SingleSubstitutionFormat2Subtable) #define SingleSubstitutionSubtable U_ICU_ENTRY_POINT_RENAME(SingleSubstitutionSubtable) #define SingleTableProcessor U_ICU_ENTRY_POINT_RENAME(SingleTableProcessor) #define SpoofData U_ICU_ENTRY_POINT_RENAME(SpoofData) #define SpoofImpl U_ICU_ENTRY_POINT_RENAME(SpoofImpl) #define StateTableProcessor U_ICU_ENTRY_POINT_RENAME(StateTableProcessor) #define StringCharacterIterator U_ICU_ENTRY_POINT_RENAME(StringCharacterIterator) #define StringEnumeration U_ICU_ENTRY_POINT_RENAME(StringEnumeration) #define StringList U_ICU_ENTRY_POINT_RENAME(StringList) #define StringLocalizationInfo U_ICU_ENTRY_POINT_RENAME(StringLocalizationInfo) #define StringMatcher U_ICU_ENTRY_POINT_RENAME(StringMatcher) #define StringPair U_ICU_ENTRY_POINT_RENAME(StringPair) #define StringPiece U_ICU_ENTRY_POINT_RENAME(StringPiece) #define StringReplacer U_ICU_ENTRY_POINT_RENAME(StringReplacer) #define StringSearch U_ICU_ENTRY_POINT_RENAME(StringSearch) #define StringToCEsMap U_ICU_ENTRY_POINT_RENAME(StringToCEsMap) #define StyleRuns U_ICU_ENTRY_POINT_RENAME(StyleRuns) #define SubstitutionLookup U_ICU_ENTRY_POINT_RENAME(SubstitutionLookup) #define SubtableProcessor U_ICU_ENTRY_POINT_RENAME(SubtableProcessor) #define SunTimeAngleFunc U_ICU_ENTRY_POINT_RENAME(SunTimeAngleFunc) #define SymbolTable U_ICU_ENTRY_POINT_RENAME(SymbolTable) #define TZEnumeration U_ICU_ENTRY_POINT_RENAME(TZEnumeration) #define TaiwanCalendar U_ICU_ENTRY_POINT_RENAME(TaiwanCalendar) #define Target U_ICU_ENTRY_POINT_RENAME(Target) #define TernaryNode U_ICU_ENTRY_POINT_RENAME(TernaryNode) #define TextTrieMap U_ICU_ENTRY_POINT_RENAME(TextTrieMap) #define TextTrieMapSearchResultHandler U_ICU_ENTRY_POINT_RENAME(TextTrieMapSearchResultHandler) #define ThaiBreakEngine U_ICU_ENTRY_POINT_RENAME(ThaiBreakEngine) #define ThaiLayoutEngine U_ICU_ENTRY_POINT_RENAME(ThaiLayoutEngine) #define ThaiShaping U_ICU_ENTRY_POINT_RENAME(ThaiShaping) #define TibetanClassTable U_ICU_ENTRY_POINT_RENAME(TibetanClassTable) #define TibetanOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(TibetanOpenTypeLayoutEngine) #define TibetanReordering U_ICU_ENTRY_POINT_RENAME(TibetanReordering) #define TimeArrayTimeZoneRule U_ICU_ENTRY_POINT_RENAME(TimeArrayTimeZoneRule) #define TimeUnit U_ICU_ENTRY_POINT_RENAME(TimeUnit) #define TimeUnitAmount U_ICU_ENTRY_POINT_RENAME(TimeUnitAmount) #define TimeUnitFormat U_ICU_ENTRY_POINT_RENAME(TimeUnitFormat) #define TimeZone U_ICU_ENTRY_POINT_RENAME(TimeZone) #define TimeZoneRule U_ICU_ENTRY_POINT_RENAME(TimeZoneRule) #define TimeZoneTransition U_ICU_ENTRY_POINT_RENAME(TimeZoneTransition) #define TitlecaseTransliterator U_ICU_ENTRY_POINT_RENAME(TitlecaseTransliterator) #define TransliterationRule U_ICU_ENTRY_POINT_RENAME(TransliterationRule) #define TransliterationRuleData U_ICU_ENTRY_POINT_RENAME(TransliterationRuleData) #define TransliterationRuleSet U_ICU_ENTRY_POINT_RENAME(TransliterationRuleSet) #define Transliterator U_ICU_ENTRY_POINT_RENAME(Transliterator) #define TransliteratorAlias U_ICU_ENTRY_POINT_RENAME(TransliteratorAlias) #define TransliteratorEntry U_ICU_ENTRY_POINT_RENAME(TransliteratorEntry) #define TransliteratorIDParser U_ICU_ENTRY_POINT_RENAME(TransliteratorIDParser) #define TransliteratorParser U_ICU_ENTRY_POINT_RENAME(TransliteratorParser) #define TransliteratorRegistry U_ICU_ENTRY_POINT_RENAME(TransliteratorRegistry) #define TransliteratorSpec U_ICU_ENTRY_POINT_RENAME(TransliteratorSpec) #define TriStateSingleton U_ICU_ENTRY_POINT_RENAME(TriStateSingleton) #define TrieWordDictionary U_ICU_ENTRY_POINT_RENAME(TrieWordDictionary) #define TrimmedArrayProcessor U_ICU_ENTRY_POINT_RENAME(TrimmedArrayProcessor) #define UCharCharacterIterator U_ICU_ENTRY_POINT_RENAME(UCharCharacterIterator) #define UCollationPCE U_ICU_ENTRY_POINT_RENAME(UCollationPCE) #define UDataPathIterator U_ICU_ENTRY_POINT_RENAME(UDataPathIterator) #define ULocRuns U_ICU_ENTRY_POINT_RENAME(ULocRuns) #define UMemory U_ICU_ENTRY_POINT_RENAME(UMemory) #define UObject U_ICU_ENTRY_POINT_RENAME(UObject) #define UStack U_ICU_ENTRY_POINT_RENAME(UStack) #define UStringEnumeration U_ICU_ENTRY_POINT_RENAME(UStringEnumeration) #define UTS46 U_ICU_ENTRY_POINT_RENAME(UTS46) #define UTrie2Singleton U_ICU_ENTRY_POINT_RENAME(UTrie2Singleton) #define UVector U_ICU_ENTRY_POINT_RENAME(UVector) #define UVector32 U_ICU_ENTRY_POINT_RENAME(UVector32) #define UVector64 U_ICU_ENTRY_POINT_RENAME(UVector64) #define UnescapeTransliterator U_ICU_ENTRY_POINT_RENAME(UnescapeTransliterator) #define UnhandledEngine U_ICU_ENTRY_POINT_RENAME(UnhandledEngine) #define UnicodeArabicOpenTypeLayoutEngine U_ICU_ENTRY_POINT_RENAME(UnicodeArabicOpenTypeLayoutEngine) #define UnicodeFilter U_ICU_ENTRY_POINT_RENAME(UnicodeFilter) #define UnicodeFunctor U_ICU_ENTRY_POINT_RENAME(UnicodeFunctor) #define UnicodeMatcher U_ICU_ENTRY_POINT_RENAME(UnicodeMatcher) #define UnicodeNameTransliterator U_ICU_ENTRY_POINT_RENAME(UnicodeNameTransliterator) #define UnicodeReplacer U_ICU_ENTRY_POINT_RENAME(UnicodeReplacer) #define UnicodeSet U_ICU_ENTRY_POINT_RENAME(UnicodeSet) #define UnicodeSetIterator U_ICU_ENTRY_POINT_RENAME(UnicodeSetIterator) #define UnicodeSetStringSpan U_ICU_ENTRY_POINT_RENAME(UnicodeSetStringSpan) #define UnicodeString U_ICU_ENTRY_POINT_RENAME(UnicodeString) #define UppercaseTransliterator U_ICU_ENTRY_POINT_RENAME(UppercaseTransliterator) #define VTZReader U_ICU_ENTRY_POINT_RENAME(VTZReader) #define VTZWriter U_ICU_ENTRY_POINT_RENAME(VTZWriter) #define VTimeZone U_ICU_ENTRY_POINT_RENAME(VTimeZone) #define ValueRecord U_ICU_ENTRY_POINT_RENAME(ValueRecord) #define ValueRuns U_ICU_ENTRY_POINT_RENAME(ValueRuns) #define ZSFCache U_ICU_ENTRY_POINT_RENAME(ZSFCache) #define ZSFCacheEntry U_ICU_ENTRY_POINT_RENAME(ZSFCacheEntry) #define ZSFStringPool U_ICU_ENTRY_POINT_RENAME(ZSFStringPool) #define ZSFStringPoolChunk U_ICU_ENTRY_POINT_RENAME(ZSFStringPoolChunk) #define ZoneMeta U_ICU_ENTRY_POINT_RENAME(ZoneMeta) #define ZoneStringFormat U_ICU_ENTRY_POINT_RENAME(ZoneStringFormat) #define ZoneStringInfo U_ICU_ENTRY_POINT_RENAME(ZoneStringInfo) #define ZoneStringSearchResultHandler U_ICU_ENTRY_POINT_RENAME(ZoneStringSearchResultHandler) #define ZoneStrings U_ICU_ENTRY_POINT_RENAME(ZoneStrings) #define collIterate U_ICU_ENTRY_POINT_RENAME(collIterate) #define locale_set_default_internal U_ICU_ENTRY_POINT_RENAME(locale_set_default_internal) #define util64_fromDouble U_ICU_ENTRY_POINT_RENAME(util64_fromDouble) #define util64_pow U_ICU_ENTRY_POINT_RENAME(util64_pow) #define util64_tou U_ICU_ENTRY_POINT_RENAME(util64_tou) #endif #endif #endif #endif android-audiosystem-1.8+13.10.20130807/include/unicode/std_string.h0000644000015700001700000000336512200324306025303 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * * Copyright (C) 2009-2010, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: std_string.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2009feb19 * created by: Markus W. Scherer */ #ifndef __STD_STRING_H__ #define __STD_STRING_H__ /** * \file * \brief C++ API: Central ICU header for including the C++ standard <string> * header and for related definitions. */ #include "unicode/utypes.h" /** * \def U_HAVE_STD_STRING * Define whether the standard C++ (STL) <string> header is available. * @internal */ #ifndef U_HAVE_STD_STRING #define U_HAVE_STD_STRING 1 #endif #if U_HAVE_STD_STRING #include /** * \def U_STD_NS * Define the namespace to use for standard C++ (STL) classes. * Either std or empty. * @draft ICU 4.2 */ /** * \def U_STD_NSQ * Define the namespace qualifier to use for standard C++ (STL) classes. * Either std:: or empty. * For example, * U_STD_NSQ string StringFromUnicodeString(const UnicodeString &unistr); * @draft ICU 4.2 */ /** * \def U_STD_NS_USE * This is used to specify that the rest of the code uses the * standard (STL) namespace. * Either "using namespace std;" or empty. * @draft ICU 4.2 */ #ifndef U_STD_NSQ # if U_HAVE_NAMESPACE # define U_STD_NS std # define U_STD_NSQ U_STD_NS:: # define U_STD_NS_USE using namespace U_STD_NS; # else # define U_STD_NS # define U_STD_NSQ # define U_STD_NS_USE # endif #endif #endif // U_HAVE_STD_STRING #endif // __STD_STRING_H__ android-audiosystem-1.8+13.10.20130807/include/unicode/localpointer.h0000644000015700001700000002211712200324306025612 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * * Copyright (C) 2009-2010, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: localpointer.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2009nov13 * created by: Markus W. Scherer */ #ifndef __LOCALPOINTER_H__ #define __LOCALPOINTER_H__ /** * \file * \brief C++ API: "Smart pointers" for use with and in ICU4C C++ code. * * These classes are inspired by * - std::auto_ptr * - boost::scoped_ptr & boost::scoped_array * - Taligent Safe Pointers (TOnlyPointerTo) * * but none of those provide for all of the goals for ICU smart pointers: * - Smart pointer owns the object and releases it when it goes out of scope. * - No transfer of ownership via copy/assignment to reduce misuse. Simpler & more robust. * - ICU-compatible: No exceptions. * - Need to be able to orphan/release the pointer and its ownership. * - Need variants for normal C++ object pointers, C++ arrays, and ICU C service objects. * * For details see http://site.icu-project.org/design/cpp/scoped_ptr */ #include "unicode/utypes.h" #if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN /** * "Smart pointer" base class; do not use directly: use LocalPointer etc. * * Base class for smart pointer classes that do not throw exceptions. * * Do not use this base class directly, since it does not delete its pointer. * A subclass must implement methods that delete the pointer: * Destructor and adoptInstead(). * * There is no operator T *() provided because the programmer must decide * whether to use getAlias() (without transfer of ownership) or orpan() * (with transfer of ownership and NULLing of the pointer). * * @see LocalPointer * @see LocalArray * @see U_DEFINE_LOCAL_OPEN_POINTER * @stable ICU 4.4 */ template class LocalPointerBase { public: /** * Constructor takes ownership. * @param p simple pointer to an object that is adopted * @stable ICU 4.4 */ explicit LocalPointerBase(T *p=NULL) : ptr(p) {} /** * Destructor deletes the object it owns. * Subclass must override: Base class does nothing. * @stable ICU 4.4 */ ~LocalPointerBase() { /* delete ptr; */ } /** * NULL check. * @return TRUE if ==NULL * @stable ICU 4.4 */ UBool isNull() const { return ptr==NULL; } /** * NULL check. * @return TRUE if !=NULL * @stable ICU 4.4 */ UBool isValid() const { return ptr!=NULL; } /** * Comparison with a simple pointer, so that existing code * with ==NULL need not be changed. * @param other simple pointer for comparison * @return true if this pointer value equals other * @stable ICU 4.4 */ bool operator==(const T *other) const { return ptr==other; } /** * Comparison with a simple pointer, so that existing code * with !=NULL need not be changed. * @param other simple pointer for comparison * @return true if this pointer value differs from other * @stable ICU 4.4 */ bool operator!=(const T *other) const { return ptr!=other; } /** * Access without ownership change. * @return the pointer value * @stable ICU 4.4 */ T *getAlias() const { return ptr; } /** * Access without ownership change. * @return the pointer value as a reference * @stable ICU 4.4 */ T &operator*() const { return *ptr; } /** * Access without ownership change. * @return the pointer value * @stable ICU 4.4 */ T *operator->() const { return ptr; } /** * Gives up ownership; the internal pointer becomes NULL. * @return the pointer value; * caller becomes responsible for deleting the object * @stable ICU 4.4 */ T *orphan() { T *p=ptr; ptr=NULL; return p; } /** * Deletes the object it owns, * and adopts (takes ownership of) the one passed in. * Subclass must override: Base class does not delete the object. * @param p simple pointer to an object that is adopted * @stable ICU 4.4 */ void adoptInstead(T *p) { // delete ptr; ptr=p; } protected: T *ptr; private: // No comparison operators with other LocalPointerBases. bool operator==(const LocalPointerBase &other); bool operator!=(const LocalPointerBase &other); // No ownership transfer: No copy constructor, no assignment operator. LocalPointerBase(const LocalPointerBase &other); void operator=(const LocalPointerBase &other); // No heap allocation. Use only on the stack. static void * U_EXPORT2 operator new(size_t size); static void * U_EXPORT2 operator new[](size_t size); #if U_HAVE_PLACEMENT_NEW static void * U_EXPORT2 operator new(size_t, void *ptr); #endif }; /** * "Smart pointer" class, deletes objects via the standard C++ delete operator. * For most methods see the LocalPointerBase base class. * * Usage example: * \code * LocalPointer s(new UnicodeString((UChar32)0x50005)); * int32_t length=s->length(); // 2 * UChar lead=s->charAt(0); // 0xd900 * if(some condition) { return; } // no need to explicitly delete the pointer * s.adoptInstead(new UnicodeString((UChar)0xfffc)); * length=s->length(); // 1 * // no need to explicitly delete the pointer * \endcode * * @see LocalPointerBase * @stable ICU 4.4 */ template class LocalPointer : public LocalPointerBase { public: /** * Constructor takes ownership. * @param p simple pointer to an object that is adopted * @stable ICU 4.4 */ explicit LocalPointer(T *p=NULL) : LocalPointerBase(p) {} /** * Destructor deletes the object it owns. * @stable ICU 4.4 */ ~LocalPointer() { delete LocalPointerBase::ptr; } /** * Deletes the object it owns, * and adopts (takes ownership of) the one passed in. * @param p simple pointer to an object that is adopted * @stable ICU 4.4 */ void adoptInstead(T *p) { delete LocalPointerBase::ptr; LocalPointerBase::ptr=p; } }; /** * "Smart pointer" class, deletes objects via the C++ array delete[] operator. * For most methods see the LocalPointerBase base class. * Adds operator[] for array item access. * * Usage example: * \code * LocalArray a(new UnicodeString[2]); * a[0].append((UChar)0x61); * if(some condition) { return; } // no need to explicitly delete the array * a.adoptInstead(new UnicodeString[4]); * a[3].append((UChar)0x62).append((UChar)0x63).reverse(); * // no need to explicitly delete the array * \endcode * * @see LocalPointerBase * @stable ICU 4.4 */ template class LocalArray : public LocalPointerBase { public: /** * Constructor takes ownership. * @param p simple pointer to an array of T objects that is adopted * @stable ICU 4.4 */ explicit LocalArray(T *p=NULL) : LocalPointerBase(p) {} /** * Destructor deletes the array it owns. * @stable ICU 4.4 */ ~LocalArray() { delete[] LocalPointerBase::ptr; } /** * Deletes the array it owns, * and adopts (takes ownership of) the one passed in. * @param p simple pointer to an array of T objects that is adopted * @stable ICU 4.4 */ void adoptInstead(T *p) { delete[] LocalPointerBase::ptr; LocalPointerBase::ptr=p; } /** * Array item access (writable). * No index bounds check. * @param i array index * @return reference to the array item * @stable ICU 4.4 */ T &operator[](ptrdiff_t i) const { return LocalPointerBase::ptr[i]; } }; /** * \def U_DEFINE_LOCAL_OPEN_POINTER * "Smart pointer" definition macro, deletes objects via the closeFunction. * Defines a subclass of LocalPointerBase which works just * like LocalPointer except that this subclass will use the closeFunction * rather than the C++ delete operator. * * Requirement: The closeFunction must tolerate a NULL pointer. * (We could add a NULL check here but it is normally redundant.) * * Usage example: * \code * LocalUCaseMapPointer csm(ucasemap_open(localeID, options, &errorCode)); * utf8OutLength=ucasemap_utf8ToLower(csm.getAlias(), * utf8Out, (int32_t)sizeof(utf8Out), * utf8In, utf8InLength, &errorCode); * if(U_FAILURE(errorCode)) { return; } // no need to explicitly delete the UCaseMap * \endcode * * @see LocalPointerBase * @see LocalPointer * @stable ICU 4.4 */ #define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction) \ class LocalPointerClassName : public LocalPointerBase { \ public: \ explicit LocalPointerClassName(Type *p=NULL) : LocalPointerBase(p) {} \ ~LocalPointerClassName() { closeFunction(ptr); } \ void adoptInstead(Type *p) { \ closeFunction(ptr); \ ptr=p; \ } \ } U_NAMESPACE_END #endif /* U_SHOW_CPLUSPLUS_API */ #endif /* __LOCALPOINTER_H__ */ android-audiosystem-1.8+13.10.20130807/include/unicode/ptypes.h0000644000015700001700000000451712200324306024447 0ustar pbuserpbgroup00000000000000/* ****************************************************************************** * * Copyright (C) 1997-2010, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * * FILE NAME : ptypes.h * * Date Name Description * 05/13/98 nos Creation (content moved here from ptypes.h). * 03/02/99 stephen Added AS400 support. * 03/30/99 stephen Added Linux support. * 04/13/99 stephen Reworked for autoconf. * 09/18/08 srl Moved basic types back to ptypes.h from platform.h ****************************************************************************** */ #ifndef _PTYPES_H #define _PTYPES_H #include #include "unicode/platform.h" /*===========================================================================*/ /* Generic data types */ /*===========================================================================*/ /* If your platform does not have the header, you may need to edit the typedefs below. */ #if U_HAVE_INTTYPES_H /* autoconf 2.13 sometimes can't properly find the data types in */ /* os/390 needs , but it doesn't have int8_t, and it sometimes */ /* doesn't have uint8_t depending on the OS version. */ /* So we have this work around. */ #ifdef OS390 /* The features header is needed to get (u)int64_t sometimes. */ #include #if ! U_HAVE_INT8_T typedef signed char int8_t; #endif #if !defined(__uint8_t) #define __uint8_t 1 typedef unsigned char uint8_t; #endif #endif /* OS390 */ #include #else /* U_HAVE_INTTYPES_H */ #if ! U_HAVE_INT8_T typedef signed char int8_t; #endif #if ! U_HAVE_UINT8_T typedef unsigned char uint8_t; #endif #if ! U_HAVE_INT16_T typedef signed short int16_t; #endif #if ! U_HAVE_UINT16_T typedef unsigned short uint16_t; #endif #if ! U_HAVE_INT32_T typedef signed int int32_t; #endif #if ! U_HAVE_UINT32_T typedef unsigned int uint32_t; #endif #if ! U_HAVE_INT64_T typedef signed long long int64_t; /* else we may not have a 64-bit type */ #endif #if ! U_HAVE_UINT64_T typedef unsigned long long uint64_t; /* else we may not have a 64-bit type */ #endif #endif /* U_HAVE_INTTYPES_H */ #endif /* _PTYPES_H */ android-audiosystem-1.8+13.10.20130807/include/unicode/usystem.h0000644000015700001700000000361612200324306024633 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * Copyright (C) 2004-2010, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* * * file name: usystem.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * Created by: genheaders.pl, a perl script written by Ram Viswanadha * * Contains data for commenting out APIs. * Gets included by umachine.h * * THIS FILE IS MACHINE-GENERATED, DON'T PLAY WITH IT IF YOU DON'T KNOW WHAT * YOU ARE DOING, OTHERWISE VERY BAD THINGS WILL HAPPEN! */ #ifndef USYSTEM_H #define USYSTEM_H #ifdef U_HIDE_SYSTEM_API # if U_DISABLE_RENAMING # define u_cleanup u_cleanup_SYSTEM_API_DO_NOT_USE # define u_setAtomicIncDecFunctions u_setAtomicIncDecFunctions_SYSTEM_API_DO_NOT_USE # define u_setMemoryFunctions u_setMemoryFunctions_SYSTEM_API_DO_NOT_USE # define u_setMutexFunctions u_setMutexFunctions_SYSTEM_API_DO_NOT_USE # define ucnv_setDefaultName ucnv_setDefaultName_SYSTEM_API_DO_NOT_USE # define uloc_getDefault uloc_getDefault_SYSTEM_API_DO_NOT_USE # define uloc_setDefault uloc_setDefault_SYSTEM_API_DO_NOT_USE # else # define u_cleanup_4_6 u_cleanup_SYSTEM_API_DO_NOT_USE # define u_setAtomicIncDecFunctions_4_6 u_setAtomicIncDecFunctions_SYSTEM_API_DO_NOT_USE # define u_setMemoryFunctions_4_6 u_setMemoryFunctions_SYSTEM_API_DO_NOT_USE # define u_setMutexFunctions_4_6 u_setMutexFunctions_SYSTEM_API_DO_NOT_USE # define ucnv_setDefaultName_4_6 ucnv_setDefaultName_SYSTEM_API_DO_NOT_USE # define uloc_getDefault_4_6 uloc_getDefault_SYSTEM_API_DO_NOT_USE # define uloc_setDefault_4_6 uloc_setDefault_SYSTEM_API_DO_NOT_USE # endif /* U_DISABLE_RENAMING */ #endif /* U_HIDE_SYSTEM_API */ #endif /* USYSTEM_H */ android-audiosystem-1.8+13.10.20130807/include/unicode/utf8.h0000644000015700001700000005367212200324306024017 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * * Copyright (C) 1999-2009, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: utf8.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 1999sep13 * created by: Markus W. Scherer */ /** * \file * \brief C API: 8-bit Unicode handling macros * * This file defines macros to deal with 8-bit Unicode (UTF-8) code units (bytes) and strings. * utf8.h is included by utf.h after unicode/umachine.h * and some common definitions. * * For more information see utf.h and the ICU User Guide Strings chapter * (http://icu-project.org/userguide/strings.html). * * Usage: * ICU coding guidelines for if() statements should be followed when using these macros. * Compound statements (curly braces {}) must be used for if-else-while... * bodies and all macro statements should be terminated with semicolon. */ #ifndef __UTF8_H__ #define __UTF8_H__ /* utf.h must be included first. */ #ifndef __UTF_H__ # include "unicode/utf.h" #endif /* internal definitions ----------------------------------------------------- */ /** * \var utf8_countTrailBytes * Internal array with numbers of trail bytes for any given byte used in * lead byte position. * * This is internal since it is not meant to be called directly by external clients; * however it is called by public macros in this file and thus must remain stable, * and should not be hidden when other internal functions are hidden (otherwise * public macros would fail to compile). * @internal */ #ifdef U_UTF8_IMPL U_EXPORT const uint8_t #elif defined(U_STATIC_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) U_CFUNC const uint8_t #else U_CFUNC U_IMPORT const uint8_t /* U_IMPORT2? */ /*U_IMPORT*/ #endif utf8_countTrailBytes[256]; /** * Count the trail bytes for a UTF-8 lead byte. * * This is internal since it is not meant to be called directly by external clients; * however it is called by public macros in this file and thus must remain stable. * @internal */ #define U8_COUNT_TRAIL_BYTES(leadByte) (utf8_countTrailBytes[(uint8_t)leadByte]) /** * Mask a UTF-8 lead byte, leave only the lower bits that form part of the code point value. * * This is internal since it is not meant to be called directly by external clients; * however it is called by public macros in this file and thus must remain stable. * @internal */ #define U8_MASK_LEAD_BYTE(leadByte, countTrailBytes) ((leadByte)&=(1<<(6-(countTrailBytes)))-1) /** * Function for handling "next code point" with error-checking. * * This is internal since it is not meant to be called directly by external clients; * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this * file and thus must remain stable, and should not be hidden when other internal * functions are hidden (otherwise public macros would fail to compile). * @internal */ U_STABLE UChar32 U_EXPORT2 utf8_nextCharSafeBody(const uint8_t *s, int32_t *pi, int32_t length, UChar32 c, UBool strict); /** * Function for handling "append code point" with error-checking. * * This is internal since it is not meant to be called directly by external clients; * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this * file and thus must remain stable, and should not be hidden when other internal * functions are hidden (otherwise public macros would fail to compile). * @internal */ U_STABLE int32_t U_EXPORT2 utf8_appendCharSafeBody(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool *pIsError); /** * Function for handling "previous code point" with error-checking. * * This is internal since it is not meant to be called directly by external clients; * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this * file and thus must remain stable, and should not be hidden when other internal * functions are hidden (otherwise public macros would fail to compile). * @internal */ U_STABLE UChar32 U_EXPORT2 utf8_prevCharSafeBody(const uint8_t *s, int32_t start, int32_t *pi, UChar32 c, UBool strict); /** * Function for handling "skip backward one code point" with error-checking. * * This is internal since it is not meant to be called directly by external clients; * however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this * file and thus must remain stable, and should not be hidden when other internal * functions are hidden (otherwise public macros would fail to compile). * @internal */ U_STABLE int32_t U_EXPORT2 utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i); /* single-code point definitions -------------------------------------------- */ /** * Does this code unit (byte) encode a code point by itself (US-ASCII 0..0x7f)? * @param c 8-bit code unit (byte) * @return TRUE or FALSE * @stable ICU 2.4 */ #define U8_IS_SINGLE(c) (((c)&0x80)==0) /** * Is this code unit (byte) a UTF-8 lead byte? * @param c 8-bit code unit (byte) * @return TRUE or FALSE * @stable ICU 2.4 */ #define U8_IS_LEAD(c) ((uint8_t)((c)-0xc0)<0x3e) /** * Is this code unit (byte) a UTF-8 trail byte? * @param c 8-bit code unit (byte) * @return TRUE or FALSE * @stable ICU 2.4 */ #define U8_IS_TRAIL(c) (((c)&0xc0)==0x80) /** * How many code units (bytes) are used for the UTF-8 encoding * of this Unicode code point? * @param c 32-bit code point * @return 1..4, or 0 if c is a surrogate or not a Unicode code point * @stable ICU 2.4 */ #define U8_LENGTH(c) \ ((uint32_t)(c)<=0x7f ? 1 : \ ((uint32_t)(c)<=0x7ff ? 2 : \ ((uint32_t)(c)<=0xd7ff ? 3 : \ ((uint32_t)(c)<=0xdfff || (uint32_t)(c)>0x10ffff ? 0 : \ ((uint32_t)(c)<=0xffff ? 3 : 4)\ ) \ ) \ ) \ ) /** * The maximum number of UTF-8 code units (bytes) per Unicode code point (U+0000..U+10ffff). * @return 4 * @stable ICU 2.4 */ #define U8_MAX_LENGTH 4 /** * Get a code point from a string at a random-access offset, * without changing the offset. * The offset may point to either the lead byte or one of the trail bytes * for a code point, in which case the macro will read all of the bytes * for the code point. * The result is undefined if the offset points to an illegal UTF-8 * byte sequence. * Iteration through a string is more efficient with U8_NEXT_UNSAFE or U8_NEXT. * * @param s const uint8_t * string * @param i string offset * @param c output UChar32 variable * @see U8_GET * @stable ICU 2.4 */ #define U8_GET_UNSAFE(s, i, c) { \ int32_t _u8_get_unsafe_index=(int32_t)(i); \ U8_SET_CP_START_UNSAFE(s, _u8_get_unsafe_index); \ U8_NEXT_UNSAFE(s, _u8_get_unsafe_index, c); \ } /** * Get a code point from a string at a random-access offset, * without changing the offset. * The offset may point to either the lead byte or one of the trail bytes * for a code point, in which case the macro will read all of the bytes * for the code point. * If the offset points to an illegal UTF-8 byte sequence, then * c is set to a negative value. * Iteration through a string is more efficient with U8_NEXT_UNSAFE or U8_NEXT. * * @param s const uint8_t * string * @param start starting string offset * @param i string offset, must be start<=i=0x80) { \ uint8_t __t1, __t2; \ if( /* handle U+1000..U+CFFF inline */ \ (0xe0<(c) && (c)<=0xec) && \ (((i)+1)<(length)) && \ (__t1=(uint8_t)((s)[i]-0x80))<=0x3f && \ (__t2=(uint8_t)((s)[(i)+1]-0x80))<= 0x3f \ ) { \ /* no need for (c&0xf) because the upper bits are truncated after <<12 in the cast to (UChar) */ \ (c)=(UChar)(((c)<<12)|(__t1<<6)|__t2); \ (i)+=2; \ } else if( /* handle U+0080..U+07FF inline */ \ ((c)<0xe0 && (c)>=0xc2) && \ ((i)<(length)) && \ (__t1=(uint8_t)((s)[i]-0x80))<=0x3f \ ) { \ (c)=(UChar)((((c)&0x1f)<<6)|__t1); \ ++(i); \ } else if(U8_IS_LEAD(c)) { \ /* function call for "complicated" and error cases */ \ (c)=utf8_nextCharSafeBody((const uint8_t *)s, &(i), (int32_t)(length), c, -1); \ } else { \ (c)=U_SENTINEL; \ } \ } \ } /** * Append a code point to a string, overwriting 1 to 4 bytes. * The offset points to the current end of the string contents * and is advanced (post-increment). * "Unsafe" macro, assumes a valid code point and sufficient space in the string. * Otherwise, the result is undefined. * * @param s const uint8_t * string buffer * @param i string offset * @param c code point to append * @see U8_APPEND * @stable ICU 2.4 */ #define U8_APPEND_UNSAFE(s, i, c) { \ if((uint32_t)(c)<=0x7f) { \ (s)[(i)++]=(uint8_t)(c); \ } else { \ if((uint32_t)(c)<=0x7ff) { \ (s)[(i)++]=(uint8_t)(((c)>>6)|0xc0); \ } else { \ if((uint32_t)(c)<=0xffff) { \ (s)[(i)++]=(uint8_t)(((c)>>12)|0xe0); \ } else { \ (s)[(i)++]=(uint8_t)(((c)>>18)|0xf0); \ (s)[(i)++]=(uint8_t)((((c)>>12)&0x3f)|0x80); \ } \ (s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80); \ } \ (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \ } \ } /** * Append a code point to a string, overwriting 1 to 4 bytes. * The offset points to the current end of the string contents * and is advanced (post-increment). * "Safe" macro, checks for a valid code point. * If a non-ASCII code point is written, checks for sufficient space in the string. * If the code point is not valid or trail bytes do not fit, * then isError is set to TRUE. * * @param s const uint8_t * string buffer * @param i string offset, must be i>6)|0xc0); \ (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \ } else if((uint32_t)(c)<=0xd7ff && (i)+2<(capacity)) { \ (s)[(i)++]=(uint8_t)(((c)>>12)|0xe0); \ (s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80); \ (s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \ } else { \ (i)=utf8_appendCharSafeBody(s, (int32_t)(i), (int32_t)(capacity), c, &(isError)); \ } \ } /** * Advance the string offset from one code point boundary to the next. * (Post-incrementing iteration.) * "Unsafe" macro, assumes well-formed UTF-8. * * @param s const uint8_t * string * @param i string offset * @see U8_FWD_1 * @stable ICU 2.4 */ #define U8_FWD_1_UNSAFE(s, i) { \ (i)+=1+U8_COUNT_TRAIL_BYTES((s)[i]); \ } /** * Advance the string offset from one code point boundary to the next. * (Post-incrementing iteration.) * "Safe" macro, checks for illegal sequences and for string boundaries. * * @param s const uint8_t * string * @param i string offset, must be i(length)) { \ __count=(uint8_t)((length)-(i)); \ } \ while(__count>0 && U8_IS_TRAIL((s)[i])) { \ ++(i); \ --__count; \ } \ } \ } /** * Advance the string offset from one code point boundary to the n-th next one, * i.e., move forward by n code points. * (Post-incrementing iteration.) * "Unsafe" macro, assumes well-formed UTF-8. * * @param s const uint8_t * string * @param i string offset * @param n number of code points to skip * @see U8_FWD_N * @stable ICU 2.4 */ #define U8_FWD_N_UNSAFE(s, i, n) { \ int32_t __N=(n); \ while(__N>0) { \ U8_FWD_1_UNSAFE(s, i); \ --__N; \ } \ } /** * Advance the string offset from one code point boundary to the n-th next one, * i.e., move forward by n code points. * (Post-incrementing iteration.) * "Safe" macro, checks for illegal sequences and for string boundaries. * * @param s const uint8_t * string * @param i string offset, must be i0 && (i)<(length)) { \ U8_FWD_1(s, i, length); \ --__N; \ } \ } /** * Adjust a random-access offset to a code point boundary * at the start of a code point. * If the offset points to a UTF-8 trail byte, * then the offset is moved backward to the corresponding lead byte. * Otherwise, it is not modified. * "Unsafe" macro, assumes well-formed UTF-8. * * @param s const uint8_t * string * @param i string offset * @see U8_SET_CP_START * @stable ICU 2.4 */ #define U8_SET_CP_START_UNSAFE(s, i) { \ while(U8_IS_TRAIL((s)[i])) { --(i); } \ } /** * Adjust a random-access offset to a code point boundary * at the start of a code point. * If the offset points to a UTF-8 trail byte, * then the offset is moved backward to the corresponding lead byte. * Otherwise, it is not modified. * "Safe" macro, checks for illegal sequences and for string boundaries. * * @param s const uint8_t * string * @param start starting string offset (usually 0) * @param i string offset, must be start<=i * @see U8_SET_CP_START_UNSAFE * @stable ICU 2.4 */ #define U8_SET_CP_START(s, start, i) { \ if(U8_IS_TRAIL((s)[(i)])) { \ (i)=utf8_back1SafeBody(s, start, (int32_t)(i)); \ } \ } /* definitions with backward iteration -------------------------------------- */ /** * Move the string offset from one code point boundary to the previous one * and get the code point between them. * (Pre-decrementing backward iteration.) * "Unsafe" macro, assumes well-formed UTF-8. * * The input offset may be the same as the string length. * If the offset is behind a multi-byte sequence, then the macro will read * the whole sequence. * If the offset is behind a lead byte, then that itself * will be returned as the code point. * The result is undefined if the offset is behind an illegal UTF-8 sequence. * * @param s const uint8_t * string * @param i string offset * @param c output UChar32 variable * @see U8_PREV * @stable ICU 2.4 */ #define U8_PREV_UNSAFE(s, i, c) { \ (c)=(uint8_t)(s)[--(i)]; \ if(U8_IS_TRAIL(c)) { \ uint8_t __b, __count=1, __shift=6; \ \ /* c is a trail byte */ \ (c)&=0x3f; \ for(;;) { \ __b=(uint8_t)(s)[--(i)]; \ if(__b>=0xc0) { \ U8_MASK_LEAD_BYTE(__b, __count); \ (c)|=(UChar32)__b<<__shift; \ break; \ } else { \ (c)|=(UChar32)(__b&0x3f)<<__shift; \ ++__count; \ __shift+=6; \ } \ } \ } \ } /** * Move the string offset from one code point boundary to the previous one * and get the code point between them. * (Pre-decrementing backward iteration.) * "Safe" macro, checks for illegal sequences and for string boundaries. * * The input offset may be the same as the string length. * If the offset is behind a multi-byte sequence, then the macro will read * the whole sequence. * If the offset is behind a lead byte, then that itself * will be returned as the code point. * If the offset is behind an illegal UTF-8 sequence, then c is set to a negative value. * * @param s const uint8_t * string * @param start starting string offset (usually 0) * @param i string offset, must be start=0x80) { \ if((c)<=0xbf) { \ (c)=utf8_prevCharSafeBody((const uint8_t *)s, start, &(i), c, -1); \ } else { \ (c)=U_SENTINEL; \ } \ } \ } /** * Move the string offset from one code point boundary to the previous one. * (Pre-decrementing backward iteration.) * The input offset may be the same as the string length. * "Unsafe" macro, assumes well-formed UTF-8. * * @param s const uint8_t * string * @param i string offset * @see U8_BACK_1 * @stable ICU 2.4 */ #define U8_BACK_1_UNSAFE(s, i) { \ while(U8_IS_TRAIL((s)[--(i)])) {} \ } /** * Move the string offset from one code point boundary to the previous one. * (Pre-decrementing backward iteration.) * The input offset may be the same as the string length. * "Safe" macro, checks for illegal sequences and for string boundaries. * * @param s const uint8_t * string * @param start starting string offset (usually 0) * @param i string offset, must be start0) { \ U8_BACK_1_UNSAFE(s, i); \ --__N; \ } \ } /** * Move the string offset from one code point boundary to the n-th one before it, * i.e., move backward by n code points. * (Pre-decrementing backward iteration.) * The input offset may be the same as the string length. * "Safe" macro, checks for illegal sequences and for string boundaries. * * @param s const uint8_t * string * @param start index of the start of the string * @param i string offset, must be start0 && (i)>(start)) { \ U8_BACK_1(s, start, i); \ --__N; \ } \ } /** * Adjust a random-access offset to a code point boundary after a code point. * If the offset is behind a partial multi-byte sequence, * then the offset is incremented to behind the whole sequence. * Otherwise, it is not modified. * The input offset may be the same as the string length. * "Unsafe" macro, assumes well-formed UTF-8. * * @param s const uint8_t * string * @param i string offset * @see U8_SET_CP_LIMIT * @stable ICU 2.4 */ #define U8_SET_CP_LIMIT_UNSAFE(s, i) { \ U8_BACK_1_UNSAFE(s, i); \ U8_FWD_1_UNSAFE(s, i); \ } /** * Adjust a random-access offset to a code point boundary after a code point. * If the offset is behind a partial multi-byte sequence, * then the offset is incremented to behind the whole sequence. * Otherwise, it is not modified. * The input offset may be the same as the string length. * "Safe" macro, checks for illegal sequences and for string boundaries. * * @param s const uint8_t * string * @param start starting string offset (usually 0) * @param i string offset, must be start<=i<=length * @param length string length * @see U8_SET_CP_LIMIT_UNSAFE * @stable ICU 2.4 */ #define U8_SET_CP_LIMIT(s, start, i, length) { \ if((start)<(i) && (i)<(length)) { \ U8_BACK_1(s, start, i); \ U8_FWD_1(s, i, length); \ } \ } #endif android-audiosystem-1.8+13.10.20130807/include/unicode/umachine.h0000644000015700001700000002676512200324306024725 0ustar pbuserpbgroup00000000000000/* ****************************************************************************** * * Copyright (C) 1999-2010, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * file name: umachine.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 1999sep13 * created by: Markus W. Scherer * * This file defines basic types and constants for utf.h to be * platform-independent. umachine.h and utf.h are included into * utypes.h to provide all the general definitions for ICU. * All of these definitions used to be in utypes.h before * the UTF-handling macros made this unmaintainable. */ #ifndef __UMACHINE_H__ #define __UMACHINE_H__ /** * \file * \brief Basic types and constants for UTF * *

Basic types and constants for UTF

* This file defines basic types and constants for utf.h to be * platform-independent. umachine.h and utf.h are included into * utypes.h to provide all the general definitions for ICU. * All of these definitions used to be in utypes.h before * the UTF-handling macros made this unmaintainable. * */ /*==========================================================================*/ /* Include platform-dependent definitions */ /* which are contained in the platform-specific file platform.h */ /*==========================================================================*/ #if defined(U_PALMOS) # include "unicode/ppalmos.h" #elif !defined(__MINGW32__) && (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) #ifdef CYGWINMSVC # include "unicode/platform.h" #endif # include "unicode/pwin32.h" #else # include "unicode/ptypes.h" /* platform.h is included in ptypes.h */ #endif /* * ANSI C headers: * stddef.h defines wchar_t */ #include /*==========================================================================*/ /* XP_CPLUSPLUS is a cross-platform symbol which should be defined when */ /* using C++. It should not be defined when compiling under C. */ /*==========================================================================*/ #ifdef __cplusplus # ifndef XP_CPLUSPLUS # define XP_CPLUSPLUS # endif #else # undef XP_CPLUSPLUS #endif /*==========================================================================*/ /* For C wrappers, we use the symbol U_STABLE. */ /* This works properly if the includer is C or C++. */ /* Functions are declared U_STABLE return-type U_EXPORT2 function-name()... */ /*==========================================================================*/ /** * \def U_CFUNC * This is used in a declaration of a library private ICU C function. * @stable ICU 2.4 */ /** * \def U_CDECL_BEGIN * This is used to begin a declaration of a library private ICU C API. * @stable ICU 2.4 */ /** * \def U_CDECL_END * This is used to end a declaration of a library private ICU C API * @stable ICU 2.4 */ #ifdef XP_CPLUSPLUS # define U_CFUNC extern "C" # define U_CDECL_BEGIN extern "C" { # define U_CDECL_END } #else # define U_CFUNC extern # define U_CDECL_BEGIN # define U_CDECL_END #endif /** * \def U_ATTRIBUTE_DEPRECATED * This is used for GCC specific attributes * @internal */ #if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)) # define U_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated)) /** * \def U_ATTRIBUTE_DEPRECATED * This is used for Visual C++ specific attributes * @internal */ #elif defined(U_WINDOWS) && defined(_MSC_VER) && (_MSC_VER >= 1400) # define U_ATTRIBUTE_DEPRECATED __declspec(deprecated) #else # define U_ATTRIBUTE_DEPRECATED #endif /** This is used to declare a function as a public ICU C API @stable ICU 2.0*/ #define U_CAPI U_CFUNC U_EXPORT /** This is used to declare a function as a stable public ICU C API*/ #define U_STABLE U_CAPI /** This is used to declare a function as a draft public ICU C API */ #define U_DRAFT U_CAPI /** This is used to declare a function as a deprecated public ICU C API */ #define U_DEPRECATED U_CAPI U_ATTRIBUTE_DEPRECATED /** This is used to declare a function as an obsolete public ICU C API */ #define U_OBSOLETE U_CAPI /** This is used to declare a function as an internal ICU C API */ #define U_INTERNAL U_CAPI /*==========================================================================*/ /* limits for int32_t etc., like in POSIX inttypes.h */ /*==========================================================================*/ #ifndef INT8_MIN /** The smallest value an 8 bit signed integer can hold @stable ICU 2.0 */ # define INT8_MIN ((int8_t)(-128)) #endif #ifndef INT16_MIN /** The smallest value a 16 bit signed integer can hold @stable ICU 2.0 */ # define INT16_MIN ((int16_t)(-32767-1)) #endif #ifndef INT32_MIN /** The smallest value a 32 bit signed integer can hold @stable ICU 2.0 */ # define INT32_MIN ((int32_t)(-2147483647-1)) #endif #ifndef INT8_MAX /** The largest value an 8 bit signed integer can hold @stable ICU 2.0 */ # define INT8_MAX ((int8_t)(127)) #endif #ifndef INT16_MAX /** The largest value a 16 bit signed integer can hold @stable ICU 2.0 */ # define INT16_MAX ((int16_t)(32767)) #endif #ifndef INT32_MAX /** The largest value a 32 bit signed integer can hold @stable ICU 2.0 */ # define INT32_MAX ((int32_t)(2147483647)) #endif #ifndef UINT8_MAX /** The largest value an 8 bit unsigned integer can hold @stable ICU 2.0 */ # define UINT8_MAX ((uint8_t)(255U)) #endif #ifndef UINT16_MAX /** The largest value a 16 bit unsigned integer can hold @stable ICU 2.0 */ # define UINT16_MAX ((uint16_t)(65535U)) #endif #ifndef UINT32_MAX /** The largest value a 32 bit unsigned integer can hold @stable ICU 2.0 */ # define UINT32_MAX ((uint32_t)(4294967295U)) #endif #if defined(U_INT64_T_UNAVAILABLE) # error int64_t is required for decimal format and rule-based number format. #else # ifndef INT64_C /** * Provides a platform independent way to specify a signed 64-bit integer constant. * note: may be wrong for some 64 bit platforms - ensure your compiler provides INT64_C * @stable ICU 2.8 */ # define INT64_C(c) c ## LL # endif # ifndef UINT64_C /** * Provides a platform independent way to specify an unsigned 64-bit integer constant. * note: may be wrong for some 64 bit platforms - ensure your compiler provides UINT64_C * @stable ICU 2.8 */ # define UINT64_C(c) c ## ULL # endif # ifndef U_INT64_MIN /** The smallest value a 64 bit signed integer can hold @stable ICU 2.8 */ # define U_INT64_MIN ((int64_t)(INT64_C(-9223372036854775807)-1)) # endif # ifndef U_INT64_MAX /** The largest value a 64 bit signed integer can hold @stable ICU 2.8 */ # define U_INT64_MAX ((int64_t)(INT64_C(9223372036854775807))) # endif # ifndef U_UINT64_MAX /** The largest value a 64 bit unsigned integer can hold @stable ICU 2.8 */ # define U_UINT64_MAX ((uint64_t)(UINT64_C(18446744073709551615))) # endif #endif /*==========================================================================*/ /* Boolean data type */ /*==========================================================================*/ /** The ICU boolean type @stable ICU 2.0 */ typedef int8_t UBool; #ifndef TRUE /** The TRUE value of a UBool @stable ICU 2.0 */ # define TRUE 1 #endif #ifndef FALSE /** The FALSE value of a UBool @stable ICU 2.0 */ # define FALSE 0 #endif /*==========================================================================*/ /* Unicode data types */ /*==========================================================================*/ /* wchar_t-related definitions -------------------------------------------- */ /** * \def U_HAVE_WCHAR_H * Indicates whether is available (1) or not (0). Set to 1 by default. * * @stable ICU 2.0 */ #ifndef U_HAVE_WCHAR_H # define U_HAVE_WCHAR_H 1 #endif /** * \def U_SIZEOF_WCHAR_T * U_SIZEOF_WCHAR_T==sizeof(wchar_t) (0 means it is not defined or autoconf could not set it) * * @stable ICU 2.0 */ #if U_SIZEOF_WCHAR_T==0 # undef U_SIZEOF_WCHAR_T # define U_SIZEOF_WCHAR_T 4 #endif /* * \def U_WCHAR_IS_UTF16 * Defined if wchar_t uses UTF-16. * * @stable ICU 2.0 */ /* * \def U_WCHAR_IS_UTF32 * Defined if wchar_t uses UTF-32. * * @stable ICU 2.0 */ #if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32) # ifdef __STDC_ISO_10646__ # if (U_SIZEOF_WCHAR_T==2) # define U_WCHAR_IS_UTF16 # elif (U_SIZEOF_WCHAR_T==4) # define U_WCHAR_IS_UTF32 # endif # elif defined __UCS2__ # if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2) # define U_WCHAR_IS_UTF16 # endif # elif defined __UCS4__ # if (U_SIZEOF_WCHAR_T==4) # define U_WCHAR_IS_UTF32 # endif # elif defined(U_WINDOWS) # define U_WCHAR_IS_UTF16 # endif #endif /* UChar and UChar32 definitions -------------------------------------------- */ /** Number of bytes in a UChar. @stable ICU 2.0 */ #define U_SIZEOF_UCHAR 2 /** * \var UChar * Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned. * If wchar_t is not 16 bits wide, then define UChar to be uint16_t or char16_t because GCC >=4.4 * can handle UTF16 string literals. * This makes the definition of UChar platform-dependent * but allows direct string type compatibility with platforms with * 16-bit wchar_t types. * * @draft ICU 4.4 */ /* Define UChar to be compatible with wchar_t if possible. */ #if U_SIZEOF_WCHAR_T==2 typedef wchar_t UChar; #elif U_GNUC_UTF16_STRING #if defined _GCC_ typedef __CHAR16_TYPE__ char16_t; #endif typedef char16_t UChar; #else typedef uint16_t UChar; #endif /** * Define UChar32 as a type for single Unicode code points. * UChar32 is a signed 32-bit integer (same as int32_t). * * The Unicode code point range is 0..0x10ffff. * All other values (negative or >=0x110000) are illegal as Unicode code points. * They may be used as sentinel values to indicate "done", "error" * or similar non-code point conditions. * * Before ICU 2.4 (Jitterbug 2146), UChar32 was defined * to be wchar_t if that is 32 bits wide (wchar_t may be signed or unsigned) * or else to be uint32_t. * That is, the definition of UChar32 was platform-dependent. * * @see U_SENTINEL * @stable ICU 2.4 */ typedef int32_t UChar32; /*==========================================================================*/ /* U_INLINE and U_ALIGN_CODE Set default values if these are not already */ /* defined. Definitions normally are in */ /* platform.h or the corresponding file for */ /* the OS in use. */ /*==========================================================================*/ #ifndef U_HIDE_INTERNAL_API /** * \def U_ALIGN_CODE * This is used to align code fragments to a specific byte boundary. * This is useful for getting consistent performance test results. * @internal */ #ifndef U_ALIGN_CODE # define U_ALIGN_CODE(n) #endif #endif /* U_HIDE_INTERNAL_API */ /** * \def U_INLINE * This is used to request inlining of a function, on platforms and languages which support it. */ #ifndef U_INLINE # ifdef XP_CPLUSPLUS # define U_INLINE inline # else # define U_INLINE # endif #endif #include "unicode/urename.h" #endif android-audiosystem-1.8+13.10.20130807/include/unicode/platform.h.in0000644000015700001700000002612012200324306025346 0ustar pbuserpbgroup00000000000000/* ****************************************************************************** * * Copyright (C) 1997-2010, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * * Note: autoconf creates platform.h from platform.h.in at configure time. * ****************************************************************************** * * FILE NAME : platform.h * * Date Name Description * 05/13/98 nos Creation (content moved here from ptypes.h). * 03/02/99 stephen Added AS400 support. * 03/30/99 stephen Added Linux support. * 04/13/99 stephen Reworked for autoconf. ****************************************************************************** */ #ifndef _PLATFORM_H #define _PLATFORM_H /** * \file * \brief Basic types for the platform */ /* This file should be included before uvernum.h. */ #if defined(UVERNUM_H) # error Do not include unicode/uvernum.h before #including unicode/platform.h. Instead of unicode/uvernum.h, #include unicode/uversion.h #endif /** * Determine wheter to enable auto cleanup of libraries. * @internal */ #ifndef UCLN_NO_AUTO_CLEANUP #define UCLN_NO_AUTO_CLEANUP @UCLN_NO_AUTO_CLEANUP@ #endif /* Need platform.h when using CYGWINMSVC to get definitions above. Ignore everything else. */ #ifndef CYGWINMSVC /** Define the platform we're on. */ #ifndef @platform@ #define @platform@ #endif /** * \def U_HAVE_DIRENT_H * Define whether dirent.h is available * @internal */ #ifndef U_HAVE_DIRENT_H #define U_HAVE_DIRENT_H @U_HAVE_DIRENT_H@ #endif /** Define whether inttypes.h is available */ #ifndef U_HAVE_INTTYPES_H #define U_HAVE_INTTYPES_H @U_HAVE_INTTYPES_H@ #endif /** * Define what support for C++ streams is available. * If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available * (1997711 is the date the ISO/IEC C++ FDIS was published), and then * one should qualify streams using the std namespace in ICU header * files. * If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is * available instead (198506 is the date when Stroustrup published * "An Extensible I/O Facility for C++" at the summer USENIX conference). * If U_IOSTREAM_SOURCE is 0, then C++ streams are not available and * support for them will be silently suppressed in ICU. * */ #ifndef U_IOSTREAM_SOURCE #define U_IOSTREAM_SOURCE @U_IOSTREAM_SOURCE@ #endif /** * \def U_HAVE_STD_STRING * Define whether the standard C++ (STL) <string> header is available. * For platforms that do not use platform.h and do not define this constant * in their platform-specific headers, std_string.h defaults * U_HAVE_STD_STRING to 1. * @internal */ #ifndef U_HAVE_STD_STRING #define U_HAVE_STD_STRING @U_HAVE_STD_STRING@ #endif /** @{ Determines whether specific types are available */ #ifndef U_HAVE_INT8_T #define U_HAVE_INT8_T @HAVE_INT8_T@ #endif #ifndef U_HAVE_UINT8_T #define U_HAVE_UINT8_T @HAVE_UINT8_T@ #endif #ifndef U_HAVE_INT16_T #define U_HAVE_INT16_T @HAVE_INT16_T@ #endif #ifndef U_HAVE_UINT16_T #define U_HAVE_UINT16_T @HAVE_UINT16_T@ #endif #ifndef U_HAVE_INT32_T #define U_HAVE_INT32_T @HAVE_INT32_T@ #endif #ifndef U_HAVE_UINT32_T #define U_HAVE_UINT32_T @HAVE_UINT32_T@ #endif #ifndef U_HAVE_INT64_T #define U_HAVE_INT64_T @HAVE_INT64_T@ #endif #ifndef U_HAVE_UINT64_T #define U_HAVE_UINT64_T @HAVE_UINT64_T@ #endif /** @} */ /*===========================================================================*/ /** @{ Compiler and environment features */ /*===========================================================================*/ /* Define whether namespace is supported */ #ifndef U_HAVE_NAMESPACE #define U_HAVE_NAMESPACE @U_HAVE_NAMESPACE@ #endif /* Determines the endianness of the platform It's done this way in case multiple architectures are being built at once. For example, Darwin supports fat binaries, which can be both PPC and x86 based. */ #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) #define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN) #else #define U_IS_BIG_ENDIAN @U_IS_BIG_ENDIAN@ #endif /* 1 or 0 to enable or disable threads. If undefined, default is: enable threads. */ #ifndef ICU_USE_THREADS #define ICU_USE_THREADS @ICU_USE_THREADS@ #endif /* On strong memory model CPUs (e.g. x86 CPUs), we use a safe & quick double check lock. */ #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) #define UMTX_STRONG_MEMORY_MODEL 1 #endif #ifndef U_DEBUG #define U_DEBUG @ENABLE_DEBUG@ #endif #ifndef U_RELEASE #define U_RELEASE @ENABLE_RELEASE@ #endif /* Determine whether to disable renaming or not. This overrides the setting in umachine.h which is for all platforms. */ #ifndef U_DISABLE_RENAMING #define U_DISABLE_RENAMING @U_DISABLE_RENAMING@ #endif /* Determine whether to override new and delete. */ #ifndef U_OVERRIDE_CXX_ALLOCATION #define U_OVERRIDE_CXX_ALLOCATION @U_OVERRIDE_CXX_ALLOCATION@ #endif /* Determine whether to override placement new and delete for STL. */ #ifndef U_HAVE_PLACEMENT_NEW #define U_HAVE_PLACEMENT_NEW @U_HAVE_PLACEMENT_NEW@ #endif /* Determine whether to enable tracing. */ #ifndef U_ENABLE_TRACING #define U_ENABLE_TRACING @U_ENABLE_TRACING@ #endif /** * Whether to enable Dynamic loading in ICU * @internal */ #ifndef U_ENABLE_DYLOAD #define U_ENABLE_DYLOAD @U_ENABLE_DYLOAD@ #endif /** * Whether to test Dynamic loading as an OS capabilty * @internal */ #ifndef U_CHECK_DYLOAD #define U_CHECK_DYLOAD @U_CHECK_DYLOAD@ #endif /** Do we allow ICU users to use the draft APIs by default? */ #ifndef U_DEFAULT_SHOW_DRAFT #define U_DEFAULT_SHOW_DRAFT @U_DEFAULT_SHOW_DRAFT@ #endif /** @} */ /*===========================================================================*/ /** @{ Character data types */ /*===========================================================================*/ #if ((defined(OS390) && (!defined(__CHARSET_LIB) || !__CHARSET_LIB))) || defined(OS400) # define U_CHARSET_FAMILY 1 #endif /** @} */ /*===========================================================================*/ /** @{ Information about wchar support */ /*===========================================================================*/ #ifndef U_HAVE_WCHAR_H #define U_HAVE_WCHAR_H @U_HAVE_WCHAR_H@ #endif #ifndef U_SIZEOF_WCHAR_T #define U_SIZEOF_WCHAR_T @U_SIZEOF_WCHAR_T@ #endif #ifndef U_HAVE_WCSCPY #define U_HAVE_WCSCPY @U_HAVE_WCSCPY@ #endif /** @} */ /** * @{ * \def U_DECLARE_UTF16 * Do not use this macro. Use the UNICODE_STRING or U_STRING_DECL macros * instead. * @internal * * \def U_GNUC_UTF16_STRING * @internal */ #ifndef U_GNUC_UTF16_STRING #define U_GNUC_UTF16_STRING @U_CHECK_GNUC_UTF16_STRING@ #endif #if @U_CHECK_UTF16_STRING@ || defined(U_CHECK_UTF16_STRING) #if (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \ || (defined(__HP_aCC) && __HP_aCC >= 035000) \ || (defined(__HP_cc) && __HP_cc >= 111106) \ || U_GNUC_UTF16_STRING #define U_DECLARE_UTF16(string) u ## string #elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) /* || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x580) */ /* Sun's C compiler has issues with this notation, and it's unreliable. */ #define U_DECLARE_UTF16(string) U ## string #elif U_SIZEOF_WCHAR_T == 2 \ && (U_CHARSET_FAMILY == 0 || ((defined(OS390) || defined(OS400)) && defined(__UCS2__))) #define U_DECLARE_UTF16(string) L ## string #endif #endif /** @} */ /*===========================================================================*/ /** @{ Information about POSIX support */ /*===========================================================================*/ #ifndef U_HAVE_NL_LANGINFO_CODESET #define U_HAVE_NL_LANGINFO_CODESET @U_HAVE_NL_LANGINFO_CODESET@ #endif #ifndef U_NL_LANGINFO_CODESET #define U_NL_LANGINFO_CODESET @U_NL_LANGINFO_CODESET@ #endif #if @U_HAVE_TZSET@ #define U_TZSET @U_TZSET@ #endif #if @U_HAVE_TIMEZONE@ #define U_TIMEZONE @U_TIMEZONE@ #endif #if @U_HAVE_TZNAME@ #define U_TZNAME @U_TZNAME@ #endif #define U_HAVE_MMAP @HAVE_MMAP@ #define U_HAVE_POPEN @U_HAVE_POPEN@ /** @} */ /*===========================================================================*/ /** @{ Symbol import-export control */ /*===========================================================================*/ #if @U_USE_GCC_VISIBILITY_ATTRIBUTE@ #define U_EXPORT __attribute__((visibility("default"))) #elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \ || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550) #define U_EXPORT __global /*#elif defined(__HP_aCC) || defined(__HP_cc) #define U_EXPORT __declspec(dllexport)*/ #else #define U_EXPORT #endif /* U_CALLCONV is releated to U_EXPORT2 */ #define U_EXPORT2 /* cygwin needs to export/import data */ #if defined(U_CYGWIN) && !defined(__GNUC__) #define U_IMPORT __declspec(dllimport) #else #define U_IMPORT #endif /* @} */ /*===========================================================================*/ /** @{ Code alignment and C function inlining */ /*===========================================================================*/ #ifndef U_INLINE # ifdef __cplusplus # define U_INLINE inline # else # define U_INLINE @U_INLINE@ # endif #endif #ifndef U_ALIGN_CODE #define U_ALIGN_CODE(n) #endif /** @} */ /*===========================================================================*/ /** @{ GCC built in functions for atomic memory operations */ /*===========================================================================*/ /** * \def U_HAVE_GCC_ATOMICS * @internal */ #ifndef U_HAVE_GCC_ATOMICS #define U_HAVE_GCC_ATOMICS @U_HAVE_GCC_ATOMICS@ #endif /** @} */ /*===========================================================================*/ /** @{ Programs used by ICU code */ /*===========================================================================*/ /** * \def U_MAKE * What program to execute to run 'make' */ #ifndef U_MAKE #define U_MAKE "@U_MAKE@" #endif /** @} */ #endif /* CYGWINMSVC */ /*===========================================================================*/ /* Custom icu entry point renaming */ /*===========================================================================*/ /** * Define the library suffix with C syntax. * @internal */ # define U_LIB_SUFFIX_C_NAME @ICULIBSUFFIXCNAME@ /** * Define the library suffix as a string with C syntax * @internal */ # define U_LIB_SUFFIX_C_NAME_STRING "@ICULIBSUFFIXCNAME@" /** * 1 if a custom library suffix is set * @internal */ # define U_HAVE_LIB_SUFFIX @U_HAVE_LIB_SUFFIX@ #if U_HAVE_LIB_SUFFIX # ifndef U_ICU_ENTRY_POINT_RENAME /* Renaming pattern: u_strcpy_41_suffix */ # define U_ICU_ENTRY_POINT_RENAME(x) x ## _ ## @LIB_VERSION_MAJOR@ ## @ICULIBSUFFIXCNAME@ # define U_DEF_ICUDATA_ENTRY_POINT(major, minor) icudt##@ICULIBSUFFIXCNAME@##major##minor##_dat # endif #endif #endif android-audiosystem-1.8+13.10.20130807/include/unicode/uintrnal.h0000644000015700001700000004400612200324306024754 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * Copyright (C) 2004-2010, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* * * file name: uintrnal.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * Created by: genheaders.pl, a perl script written by Ram Viswanadha * * Contains data for commenting out APIs. * Gets included by umachine.h * * THIS FILE IS MACHINE-GENERATED, DON'T PLAY WITH IT IF YOU DON'T KNOW WHAT * YOU ARE DOING, OTHERWISE VERY BAD THINGS WILL HAPPEN! */ #ifndef UINTRNAL_H #define UINTRNAL_H #ifdef U_HIDE_INTERNAL_API # if U_DISABLE_RENAMING # define RegexPatternDump RegexPatternDump_INTERNAL_API_DO_NOT_USE # define bms_close bms_close_INTERNAL_API_DO_NOT_USE # define bms_empty bms_empty_INTERNAL_API_DO_NOT_USE # define bms_getData bms_getData_INTERNAL_API_DO_NOT_USE # define bms_open bms_open_INTERNAL_API_DO_NOT_USE # define bms_search bms_search_INTERNAL_API_DO_NOT_USE # define bms_setTargetString bms_setTargetString_INTERNAL_API_DO_NOT_USE # define pl_addFontRun pl_addFontRun_INTERNAL_API_DO_NOT_USE # define pl_addLocaleRun pl_addLocaleRun_INTERNAL_API_DO_NOT_USE # define pl_addValueRun pl_addValueRun_INTERNAL_API_DO_NOT_USE # define pl_close pl_close_INTERNAL_API_DO_NOT_USE # define pl_closeFontRuns pl_closeFontRuns_INTERNAL_API_DO_NOT_USE # define pl_closeLine pl_closeLine_INTERNAL_API_DO_NOT_USE # define pl_closeLocaleRuns pl_closeLocaleRuns_INTERNAL_API_DO_NOT_USE # define pl_closeValueRuns pl_closeValueRuns_INTERNAL_API_DO_NOT_USE # define pl_countLineRuns pl_countLineRuns_INTERNAL_API_DO_NOT_USE # define pl_getAscent pl_getAscent_INTERNAL_API_DO_NOT_USE # define pl_getDescent pl_getDescent_INTERNAL_API_DO_NOT_USE # define pl_getFontRunCount pl_getFontRunCount_INTERNAL_API_DO_NOT_USE # define pl_getFontRunFont pl_getFontRunFont_INTERNAL_API_DO_NOT_USE # define pl_getFontRunLastLimit pl_getFontRunLastLimit_INTERNAL_API_DO_NOT_USE # define pl_getFontRunLimit pl_getFontRunLimit_INTERNAL_API_DO_NOT_USE # define pl_getLeading pl_getLeading_INTERNAL_API_DO_NOT_USE # define pl_getLineAscent pl_getLineAscent_INTERNAL_API_DO_NOT_USE # define pl_getLineDescent pl_getLineDescent_INTERNAL_API_DO_NOT_USE # define pl_getLineLeading pl_getLineLeading_INTERNAL_API_DO_NOT_USE # define pl_getLineVisualRun pl_getLineVisualRun_INTERNAL_API_DO_NOT_USE # define pl_getLineWidth pl_getLineWidth_INTERNAL_API_DO_NOT_USE # define pl_getLocaleRunCount pl_getLocaleRunCount_INTERNAL_API_DO_NOT_USE # define pl_getLocaleRunLastLimit pl_getLocaleRunLastLimit_INTERNAL_API_DO_NOT_USE # define pl_getLocaleRunLimit pl_getLocaleRunLimit_INTERNAL_API_DO_NOT_USE # define pl_getLocaleRunLocale pl_getLocaleRunLocale_INTERNAL_API_DO_NOT_USE # define pl_getParagraphLevel pl_getParagraphLevel_INTERNAL_API_DO_NOT_USE # define pl_getTextDirection pl_getTextDirection_INTERNAL_API_DO_NOT_USE # define pl_getValueRunCount pl_getValueRunCount_INTERNAL_API_DO_NOT_USE # define pl_getValueRunLastLimit pl_getValueRunLastLimit_INTERNAL_API_DO_NOT_USE # define pl_getValueRunLimit pl_getValueRunLimit_INTERNAL_API_DO_NOT_USE # define pl_getValueRunValue pl_getValueRunValue_INTERNAL_API_DO_NOT_USE # define pl_getVisualRunAscent pl_getVisualRunAscent_INTERNAL_API_DO_NOT_USE # define pl_getVisualRunDescent pl_getVisualRunDescent_INTERNAL_API_DO_NOT_USE # define pl_getVisualRunDirection pl_getVisualRunDirection_INTERNAL_API_DO_NOT_USE # define pl_getVisualRunFont pl_getVisualRunFont_INTERNAL_API_DO_NOT_USE # define pl_getVisualRunGlyphCount pl_getVisualRunGlyphCount_INTERNAL_API_DO_NOT_USE # define pl_getVisualRunGlyphToCharMap pl_getVisualRunGlyphToCharMap_INTERNAL_API_DO_NOT_USE # define pl_getVisualRunGlyphs pl_getVisualRunGlyphs_INTERNAL_API_DO_NOT_USE # define pl_getVisualRunLeading pl_getVisualRunLeading_INTERNAL_API_DO_NOT_USE # define pl_getVisualRunPositions pl_getVisualRunPositions_INTERNAL_API_DO_NOT_USE # define pl_line pl_line_INTERNAL_API_DO_NOT_USE # define pl_nextLine pl_nextLine_INTERNAL_API_DO_NOT_USE # define pl_openEmptyFontRuns pl_openEmptyFontRuns_INTERNAL_API_DO_NOT_USE # define pl_openEmptyLocaleRuns pl_openEmptyLocaleRuns_INTERNAL_API_DO_NOT_USE # define pl_openEmptyValueRuns pl_openEmptyValueRuns_INTERNAL_API_DO_NOT_USE # define pl_openFontRuns pl_openFontRuns_INTERNAL_API_DO_NOT_USE # define pl_openLocaleRuns pl_openLocaleRuns_INTERNAL_API_DO_NOT_USE # define pl_openValueRuns pl_openValueRuns_INTERNAL_API_DO_NOT_USE # define pl_paragraph pl_paragraph_INTERNAL_API_DO_NOT_USE # define pl_reflow pl_reflow_INTERNAL_API_DO_NOT_USE # define pl_resetFontRuns pl_resetFontRuns_INTERNAL_API_DO_NOT_USE # define pl_resetLocaleRuns pl_resetLocaleRuns_INTERNAL_API_DO_NOT_USE # define pl_resetValueRuns pl_resetValueRuns_INTERNAL_API_DO_NOT_USE # define pl_visualRun pl_visualRun_INTERNAL_API_DO_NOT_USE # define ucd_close ucd_close_INTERNAL_API_DO_NOT_USE # define ucd_flushCache ucd_flushCache_INTERNAL_API_DO_NOT_USE # define ucd_freeCache ucd_freeCache_INTERNAL_API_DO_NOT_USE # define ucd_getCollator ucd_getCollator_INTERNAL_API_DO_NOT_USE # define ucd_open ucd_open_INTERNAL_API_DO_NOT_USE # define ucol_equals ucol_equals_INTERNAL_API_DO_NOT_USE # define ucol_forceHanImplicit ucol_forceHanImplicit_INTERNAL_API_DO_NOT_USE # define ucol_forgetUCA ucol_forgetUCA_INTERNAL_API_DO_NOT_USE # define ucol_getAttributeOrDefault ucol_getAttributeOrDefault_INTERNAL_API_DO_NOT_USE # define ucol_getReorderCodes ucol_getReorderCodes_INTERNAL_API_DO_NOT_USE # define ucol_getUnsafeSet ucol_getUnsafeSet_INTERNAL_API_DO_NOT_USE # define ucol_nextProcessed ucol_nextProcessed_INTERNAL_API_DO_NOT_USE # define ucol_prepareShortStringOpen ucol_prepareShortStringOpen_INTERNAL_API_DO_NOT_USE # define ucol_previousProcessed ucol_previousProcessed_INTERNAL_API_DO_NOT_USE # define ucol_setReorderCodes ucol_setReorderCodes_INTERNAL_API_DO_NOT_USE # define udat_applyPatternRelative udat_applyPatternRelative_INTERNAL_API_DO_NOT_USE # define udat_toPatternRelativeDate udat_toPatternRelativeDate_INTERNAL_API_DO_NOT_USE # define udat_toPatternRelativeTime udat_toPatternRelativeTime_INTERNAL_API_DO_NOT_USE # define uplug_getConfiguration uplug_getConfiguration_INTERNAL_API_DO_NOT_USE # define uplug_getContext uplug_getContext_INTERNAL_API_DO_NOT_USE # define uplug_getCurrentLevel uplug_getCurrentLevel_INTERNAL_API_DO_NOT_USE # define uplug_getLibrary uplug_getLibrary_INTERNAL_API_DO_NOT_USE # define uplug_getLibraryName uplug_getLibraryName_INTERNAL_API_DO_NOT_USE # define uplug_getPlugLevel uplug_getPlugLevel_INTERNAL_API_DO_NOT_USE # define uplug_getPlugLoadStatus uplug_getPlugLoadStatus_INTERNAL_API_DO_NOT_USE # define uplug_getPlugName uplug_getPlugName_INTERNAL_API_DO_NOT_USE # define uplug_getSymbolName uplug_getSymbolName_INTERNAL_API_DO_NOT_USE # define uplug_loadPlugFromEntrypoint uplug_loadPlugFromEntrypoint_INTERNAL_API_DO_NOT_USE # define uplug_loadPlugFromLibrary uplug_loadPlugFromLibrary_INTERNAL_API_DO_NOT_USE # define uplug_nextPlug uplug_nextPlug_INTERNAL_API_DO_NOT_USE # define uplug_removePlug uplug_removePlug_INTERNAL_API_DO_NOT_USE # define uplug_setContext uplug_setContext_INTERNAL_API_DO_NOT_USE # define uplug_setPlugLevel uplug_setPlugLevel_INTERNAL_API_DO_NOT_USE # define uplug_setPlugName uplug_setPlugName_INTERNAL_API_DO_NOT_USE # define uplug_setPlugNoUnload uplug_setPlugNoUnload_INTERNAL_API_DO_NOT_USE # define uprv_getDefaultCodepage uprv_getDefaultCodepage_INTERNAL_API_DO_NOT_USE # define uprv_getDefaultLocaleID uprv_getDefaultLocaleID_INTERNAL_API_DO_NOT_USE # define ures_openFillIn ures_openFillIn_INTERNAL_API_DO_NOT_USE # define usearch_search usearch_search_INTERNAL_API_DO_NOT_USE # define usearch_searchBackwards usearch_searchBackwards_INTERNAL_API_DO_NOT_USE # define utext_caseCompare utext_caseCompare_INTERNAL_API_DO_NOT_USE # define utext_caseCompareNativeLimit utext_caseCompareNativeLimit_INTERNAL_API_DO_NOT_USE # define utext_compare utext_compare_INTERNAL_API_DO_NOT_USE # define utext_compareNativeLimit utext_compareNativeLimit_INTERNAL_API_DO_NOT_USE # define utf8_appendCharSafeBody utf8_appendCharSafeBody_INTERNAL_API_DO_NOT_USE # define utf8_back1SafeBody utf8_back1SafeBody_INTERNAL_API_DO_NOT_USE # define utf8_countTrailBytes utf8_countTrailBytes_INTERNAL_API_DO_NOT_USE # define utf8_nextCharSafeBody utf8_nextCharSafeBody_INTERNAL_API_DO_NOT_USE # define utf8_prevCharSafeBody utf8_prevCharSafeBody_INTERNAL_API_DO_NOT_USE # else # define RegexPatternDump_4_6 RegexPatternDump_INTERNAL_API_DO_NOT_USE # define bms_close_4_6 bms_close_INTERNAL_API_DO_NOT_USE # define bms_empty_4_6 bms_empty_INTERNAL_API_DO_NOT_USE # define bms_getData_4_6 bms_getData_INTERNAL_API_DO_NOT_USE # define bms_open_4_6 bms_open_INTERNAL_API_DO_NOT_USE # define bms_search_4_6 bms_search_INTERNAL_API_DO_NOT_USE # define bms_setTargetString_4_6 bms_setTargetString_INTERNAL_API_DO_NOT_USE # define pl_addFontRun_4_6 pl_addFontRun_INTERNAL_API_DO_NOT_USE # define pl_addLocaleRun_4_6 pl_addLocaleRun_INTERNAL_API_DO_NOT_USE # define pl_addValueRun_4_6 pl_addValueRun_INTERNAL_API_DO_NOT_USE # define pl_close_4_6 pl_close_INTERNAL_API_DO_NOT_USE # define pl_closeFontRuns_4_6 pl_closeFontRuns_INTERNAL_API_DO_NOT_USE # define pl_closeLine_4_6 pl_closeLine_INTERNAL_API_DO_NOT_USE # define pl_closeLocaleRuns_4_6 pl_closeLocaleRuns_INTERNAL_API_DO_NOT_USE # define pl_closeValueRuns_4_6 pl_closeValueRuns_INTERNAL_API_DO_NOT_USE # define pl_countLineRuns_4_6 pl_countLineRuns_INTERNAL_API_DO_NOT_USE # define pl_getAscent_4_6 pl_getAscent_INTERNAL_API_DO_NOT_USE # define pl_getDescent_4_6 pl_getDescent_INTERNAL_API_DO_NOT_USE # define pl_getFontRunCount_4_6 pl_getFontRunCount_INTERNAL_API_DO_NOT_USE # define pl_getFontRunFont_4_6 pl_getFontRunFont_INTERNAL_API_DO_NOT_USE # define pl_getFontRunLastLimit_4_6 pl_getFontRunLastLimit_INTERNAL_API_DO_NOT_USE # define pl_getFontRunLimit_4_6 pl_getFontRunLimit_INTERNAL_API_DO_NOT_USE # define pl_getLeading_4_6 pl_getLeading_INTERNAL_API_DO_NOT_USE # define pl_getLineAscent_4_6 pl_getLineAscent_INTERNAL_API_DO_NOT_USE # define pl_getLineDescent_4_6 pl_getLineDescent_INTERNAL_API_DO_NOT_USE # define pl_getLineLeading_4_6 pl_getLineLeading_INTERNAL_API_DO_NOT_USE # define pl_getLineVisualRun_4_6 pl_getLineVisualRun_INTERNAL_API_DO_NOT_USE # define pl_getLineWidth_4_6 pl_getLineWidth_INTERNAL_API_DO_NOT_USE # define pl_getLocaleRunCount_4_6 pl_getLocaleRunCount_INTERNAL_API_DO_NOT_USE # define pl_getLocaleRunLastLimit_4_6 pl_getLocaleRunLastLimit_INTERNAL_API_DO_NOT_USE # define pl_getLocaleRunLimit_4_6 pl_getLocaleRunLimit_INTERNAL_API_DO_NOT_USE # define pl_getLocaleRunLocale_4_6 pl_getLocaleRunLocale_INTERNAL_API_DO_NOT_USE # define pl_getParagraphLevel_4_6 pl_getParagraphLevel_INTERNAL_API_DO_NOT_USE # define pl_getTextDirection_4_6 pl_getTextDirection_INTERNAL_API_DO_NOT_USE # define pl_getValueRunCount_4_6 pl_getValueRunCount_INTERNAL_API_DO_NOT_USE # define pl_getValueRunLastLimit_4_6 pl_getValueRunLastLimit_INTERNAL_API_DO_NOT_USE # define pl_getValueRunLimit_4_6 pl_getValueRunLimit_INTERNAL_API_DO_NOT_USE # define pl_getValueRunValue_4_6 pl_getValueRunValue_INTERNAL_API_DO_NOT_USE # define pl_getVisualRunAscent_4_6 pl_getVisualRunAscent_INTERNAL_API_DO_NOT_USE # define pl_getVisualRunDescent_4_6 pl_getVisualRunDescent_INTERNAL_API_DO_NOT_USE # define pl_getVisualRunDirection_4_6 pl_getVisualRunDirection_INTERNAL_API_DO_NOT_USE # define pl_getVisualRunFont_4_6 pl_getVisualRunFont_INTERNAL_API_DO_NOT_USE # define pl_getVisualRunGlyphCount_4_6 pl_getVisualRunGlyphCount_INTERNAL_API_DO_NOT_USE # define pl_getVisualRunGlyphToCharMap_4_6 pl_getVisualRunGlyphToCharMap_INTERNAL_API_DO_NOT_USE # define pl_getVisualRunGlyphs_4_6 pl_getVisualRunGlyphs_INTERNAL_API_DO_NOT_USE # define pl_getVisualRunLeading_4_6 pl_getVisualRunLeading_INTERNAL_API_DO_NOT_USE # define pl_getVisualRunPositions_4_6 pl_getVisualRunPositions_INTERNAL_API_DO_NOT_USE # define pl_line_4_6 pl_line_INTERNAL_API_DO_NOT_USE # define pl_nextLine_4_6 pl_nextLine_INTERNAL_API_DO_NOT_USE # define pl_openEmptyFontRuns_4_6 pl_openEmptyFontRuns_INTERNAL_API_DO_NOT_USE # define pl_openEmptyLocaleRuns_4_6 pl_openEmptyLocaleRuns_INTERNAL_API_DO_NOT_USE # define pl_openEmptyValueRuns_4_6 pl_openEmptyValueRuns_INTERNAL_API_DO_NOT_USE # define pl_openFontRuns_4_6 pl_openFontRuns_INTERNAL_API_DO_NOT_USE # define pl_openLocaleRuns_4_6 pl_openLocaleRuns_INTERNAL_API_DO_NOT_USE # define pl_openValueRuns_4_6 pl_openValueRuns_INTERNAL_API_DO_NOT_USE # define pl_paragraph_4_6 pl_paragraph_INTERNAL_API_DO_NOT_USE # define pl_reflow_4_6 pl_reflow_INTERNAL_API_DO_NOT_USE # define pl_resetFontRuns_4_6 pl_resetFontRuns_INTERNAL_API_DO_NOT_USE # define pl_resetLocaleRuns_4_6 pl_resetLocaleRuns_INTERNAL_API_DO_NOT_USE # define pl_resetValueRuns_4_6 pl_resetValueRuns_INTERNAL_API_DO_NOT_USE # define pl_visualRun_4_6 pl_visualRun_INTERNAL_API_DO_NOT_USE # define ucd_close_4_6 ucd_close_INTERNAL_API_DO_NOT_USE # define ucd_flushCache_4_6 ucd_flushCache_INTERNAL_API_DO_NOT_USE # define ucd_freeCache_4_6 ucd_freeCache_INTERNAL_API_DO_NOT_USE # define ucd_getCollator_4_6 ucd_getCollator_INTERNAL_API_DO_NOT_USE # define ucd_open_4_6 ucd_open_INTERNAL_API_DO_NOT_USE # define ucol_equals_4_6 ucol_equals_INTERNAL_API_DO_NOT_USE # define ucol_forceHanImplicit_4_6 ucol_forceHanImplicit_INTERNAL_API_DO_NOT_USE # define ucol_forgetUCA_4_6 ucol_forgetUCA_INTERNAL_API_DO_NOT_USE # define ucol_getAttributeOrDefault_4_6 ucol_getAttributeOrDefault_INTERNAL_API_DO_NOT_USE # define ucol_getReorderCodes_4_6 ucol_getReorderCodes_INTERNAL_API_DO_NOT_USE # define ucol_getUnsafeSet_4_6 ucol_getUnsafeSet_INTERNAL_API_DO_NOT_USE # define ucol_nextProcessed_4_6 ucol_nextProcessed_INTERNAL_API_DO_NOT_USE # define ucol_prepareShortStringOpen_4_6 ucol_prepareShortStringOpen_INTERNAL_API_DO_NOT_USE # define ucol_previousProcessed_4_6 ucol_previousProcessed_INTERNAL_API_DO_NOT_USE # define ucol_setReorderCodes_4_6 ucol_setReorderCodes_INTERNAL_API_DO_NOT_USE # define udat_applyPatternRelative_4_6 udat_applyPatternRelative_INTERNAL_API_DO_NOT_USE # define udat_toPatternRelativeDate_4_6 udat_toPatternRelativeDate_INTERNAL_API_DO_NOT_USE # define udat_toPatternRelativeTime_4_6 udat_toPatternRelativeTime_INTERNAL_API_DO_NOT_USE # define uplug_getConfiguration_4_6 uplug_getConfiguration_INTERNAL_API_DO_NOT_USE # define uplug_getContext_4_6 uplug_getContext_INTERNAL_API_DO_NOT_USE # define uplug_getCurrentLevel_4_6 uplug_getCurrentLevel_INTERNAL_API_DO_NOT_USE # define uplug_getLibrary_4_6 uplug_getLibrary_INTERNAL_API_DO_NOT_USE # define uplug_getLibraryName_4_6 uplug_getLibraryName_INTERNAL_API_DO_NOT_USE # define uplug_getPlugLevel_4_6 uplug_getPlugLevel_INTERNAL_API_DO_NOT_USE # define uplug_getPlugLoadStatus_4_6 uplug_getPlugLoadStatus_INTERNAL_API_DO_NOT_USE # define uplug_getPlugName_4_6 uplug_getPlugName_INTERNAL_API_DO_NOT_USE # define uplug_getSymbolName_4_6 uplug_getSymbolName_INTERNAL_API_DO_NOT_USE # define uplug_loadPlugFromEntrypoint_4_6 uplug_loadPlugFromEntrypoint_INTERNAL_API_DO_NOT_USE # define uplug_loadPlugFromLibrary_4_6 uplug_loadPlugFromLibrary_INTERNAL_API_DO_NOT_USE # define uplug_nextPlug_4_6 uplug_nextPlug_INTERNAL_API_DO_NOT_USE # define uplug_removePlug_4_6 uplug_removePlug_INTERNAL_API_DO_NOT_USE # define uplug_setContext_4_6 uplug_setContext_INTERNAL_API_DO_NOT_USE # define uplug_setPlugLevel_4_6 uplug_setPlugLevel_INTERNAL_API_DO_NOT_USE # define uplug_setPlugName_4_6 uplug_setPlugName_INTERNAL_API_DO_NOT_USE # define uplug_setPlugNoUnload_4_6 uplug_setPlugNoUnload_INTERNAL_API_DO_NOT_USE # define uprv_getDefaultCodepage_4_6 uprv_getDefaultCodepage_INTERNAL_API_DO_NOT_USE # define uprv_getDefaultLocaleID_4_6 uprv_getDefaultLocaleID_INTERNAL_API_DO_NOT_USE # define ures_openFillIn_4_6 ures_openFillIn_INTERNAL_API_DO_NOT_USE # define usearch_search_4_6 usearch_search_INTERNAL_API_DO_NOT_USE # define usearch_searchBackwards_4_6 usearch_searchBackwards_INTERNAL_API_DO_NOT_USE # define utext_caseCompareNativeLimit_4_6 utext_caseCompareNativeLimit_INTERNAL_API_DO_NOT_USE # define utext_caseCompare_4_6 utext_caseCompare_INTERNAL_API_DO_NOT_USE # define utext_compareNativeLimit_4_6 utext_compareNativeLimit_INTERNAL_API_DO_NOT_USE # define utext_compare_4_6 utext_compare_INTERNAL_API_DO_NOT_USE # define utf8_appendCharSafeBody_4_6 utf8_appendCharSafeBody_INTERNAL_API_DO_NOT_USE # define utf8_back1SafeBody_4_6 utf8_back1SafeBody_INTERNAL_API_DO_NOT_USE # define utf8_countTrailBytes_4_6 utf8_countTrailBytes_INTERNAL_API_DO_NOT_USE # define utf8_nextCharSafeBody_4_6 utf8_nextCharSafeBody_INTERNAL_API_DO_NOT_USE # define utf8_prevCharSafeBody_4_6 utf8_prevCharSafeBody_INTERNAL_API_DO_NOT_USE # endif /* U_DISABLE_RENAMING */ #endif /* U_HIDE_INTERNAL_API */ #endif /* UINTRNAL_H */ android-audiosystem-1.8+13.10.20130807/include/unicode/ucasemap.h0000644000015700001700000004070512200324306024720 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * * Copyright (C) 2005-2010, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: ucasemap.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2005may06 * created by: Markus W. Scherer * * Case mapping service object and functions using it. */ #ifndef __UCASEMAP_H__ #define __UCASEMAP_H__ #include "unicode/utypes.h" #include "unicode/ustring.h" #include "unicode/localpointer.h" /** * \file * \brief C API: Unicode case mapping functions using a UCaseMap service object. * * The service object takes care of memory allocations, data loading, and setup * for the attributes, as usual. * * Currently, the functionality provided here does not overlap with uchar.h * and ustring.h, except for ucasemap_toTitle(). * * ucasemap_utf8XYZ() functions operate directly on UTF-8 strings. */ /** * UCaseMap is an opaque service object for newer ICU case mapping functions. * Older functions did not use a service object. * @stable ICU 3.4 */ struct UCaseMap; typedef struct UCaseMap UCaseMap; /**< C typedef for struct UCaseMap. @stable ICU 3.4 */ /** * Open a UCaseMap service object for a locale and a set of options. * The locale ID and options are preprocessed so that functions using the * service object need not process them in each call. * * @param locale ICU locale ID, used for language-dependent * upper-/lower-/title-casing according to the Unicode standard. * Usual semantics: ""=root, NULL=default locale, etc. * @param options Options bit set, used for case folding and string comparisons. * Same flags as for u_foldCase(), u_strFoldCase(), * u_strCaseCompare(), etc. * Use 0 or U_FOLD_CASE_DEFAULT for default behavior. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return Pointer to a UCaseMap service object, if successful. * * @see U_FOLD_CASE_DEFAULT * @see U_FOLD_CASE_EXCLUDE_SPECIAL_I * @see U_TITLECASE_NO_LOWERCASE * @see U_TITLECASE_NO_BREAK_ADJUSTMENT * @stable ICU 3.4 */ U_STABLE UCaseMap * U_EXPORT2 ucasemap_open(const char *locale, uint32_t options, UErrorCode *pErrorCode); /** * Close a UCaseMap service object. * @param csm Object to be closed. * @stable ICU 3.4 */ U_STABLE void U_EXPORT2 ucasemap_close(UCaseMap *csm); #if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN /** * \class LocalUCaseMapPointer * "Smart pointer" class, closes a UCaseMap via ucasemap_close(). * For most methods see the LocalPointerBase base class. * * @see LocalPointerBase * @see LocalPointer * @stable ICU 4.4 */ U_DEFINE_LOCAL_OPEN_POINTER(LocalUCaseMapPointer, UCaseMap, ucasemap_close); U_NAMESPACE_END #endif /** * Get the locale ID that is used for language-dependent case mappings. * @param csm UCaseMap service object. * @return locale ID * @stable ICU 3.4 */ U_STABLE const char * U_EXPORT2 ucasemap_getLocale(const UCaseMap *csm); /** * Get the options bit set that is used for case folding and string comparisons. * @param csm UCaseMap service object. * @return options bit set * @stable ICU 3.4 */ U_STABLE uint32_t U_EXPORT2 ucasemap_getOptions(const UCaseMap *csm); /** * Set the locale ID that is used for language-dependent case mappings. * * @param csm UCaseMap service object. * @param locale Locale ID, see ucasemap_open(). * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * * @see ucasemap_open * @stable ICU 3.4 */ U_STABLE void U_EXPORT2 ucasemap_setLocale(UCaseMap *csm, const char *locale, UErrorCode *pErrorCode); /** * Set the options bit set that is used for case folding and string comparisons. * * @param csm UCaseMap service object. * @param options Options bit set, see ucasemap_open(). * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * * @see ucasemap_open * @stable ICU 3.4 */ U_STABLE void U_EXPORT2 ucasemap_setOptions(UCaseMap *csm, uint32_t options, UErrorCode *pErrorCode); /** * Do not lowercase non-initial parts of words when titlecasing. * Option bit for titlecasing APIs that take an options bit set. * * By default, titlecasing will titlecase the first cased character * of a word and lowercase all other characters. * With this option, the other characters will not be modified. * * @see ucasemap_setOptions * @see ucasemap_toTitle * @see ucasemap_utf8ToTitle * @see UnicodeString::toTitle * @stable ICU 3.8 */ #define U_TITLECASE_NO_LOWERCASE 0x100 /** * Do not adjust the titlecasing indexes from BreakIterator::next() indexes; * titlecase exactly the characters at breaks from the iterator. * Option bit for titlecasing APIs that take an options bit set. * * By default, titlecasing will take each break iterator index, * adjust it by looking for the next cased character, and titlecase that one. * Other characters are lowercased. * * This follows Unicode 4 & 5 section 3.13 Default Case Operations: * * R3 toTitlecase(X): Find the word boundaries based on Unicode Standard Annex * #29, "Text Boundaries." Between each pair of word boundaries, find the first * cased character F. If F exists, map F to default_title(F); then map each * subsequent character C to default_lower(C). * * @see ucasemap_setOptions * @see ucasemap_toTitle * @see ucasemap_utf8ToTitle * @see UnicodeString::toTitle * @see U_TITLECASE_NO_LOWERCASE * @stable ICU 3.8 */ #define U_TITLECASE_NO_BREAK_ADJUSTMENT 0x200 #if !UCONFIG_NO_BREAK_ITERATION /** * Get the break iterator that is used for titlecasing. * Do not modify the returned break iterator. * @param csm UCaseMap service object. * @return titlecasing break iterator * @stable ICU 3.8 */ U_STABLE const UBreakIterator * U_EXPORT2 ucasemap_getBreakIterator(const UCaseMap *csm); /** * Set the break iterator that is used for titlecasing. * The UCaseMap service object releases a previously set break iterator * and "adopts" this new one, taking ownership of it. * It will be released in a subsequent call to ucasemap_setBreakIterator() * or ucasemap_close(). * * Break iterator operations are not thread-safe. Therefore, titlecasing * functions use non-const UCaseMap objects. It is not possible to titlecase * strings concurrently using the same UCaseMap. * * @param csm UCaseMap service object. * @param iterToAdopt Break iterator to be adopted for titlecasing. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * * @see ucasemap_toTitle * @see ucasemap_utf8ToTitle * @stable ICU 3.8 */ U_STABLE void U_EXPORT2 ucasemap_setBreakIterator(UCaseMap *csm, UBreakIterator *iterToAdopt, UErrorCode *pErrorCode); /** * Titlecase a UTF-16 string. This function is almost a duplicate of u_strToTitle(), * except that it takes ucasemap_setOptions() into account and has performance * advantages from being able to use a UCaseMap object for multiple case mapping * operations, saving setup time. * * Casing is locale-dependent and context-sensitive. * Titlecasing uses a break iterator to find the first characters of words * that are to be titlecased. It titlecases those characters and lowercases * all others. (This can be modified with ucasemap_setOptions().) * * Note: This function takes a non-const UCaseMap pointer because it will * open a default break iterator if no break iterator was set yet, * and effectively call ucasemap_setBreakIterator(); * also because the break iterator is stateful and will be modified during * the iteration. * * The titlecase break iterator can be provided to customize for arbitrary * styles, using rules and dictionaries beyond the standard iterators. * The standard titlecase iterator for the root locale implements the * algorithm of Unicode TR 21. * * This function uses only the setUText(), first(), next() and close() methods of the * provided break iterator. * * The result may be longer or shorter than the original. * The source string and the destination buffer must not overlap. * * @param csm UCaseMap service object. This pointer is non-const! * See the note above for details. * @param dest A buffer for the result string. The result will be NUL-terminated if * the buffer is large enough. * The contents is undefined in case of failure. * @param destCapacity The size of the buffer (number of bytes). If it is 0, then * dest may be NULL and the function will only return the length of the result * without writing any of the result string. * @param src The original string. * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The length of the result string, if successful - or in case of a buffer overflow, * in which case it will be greater than destCapacity. * * @see u_strToTitle * @stable ICU 3.8 */ U_STABLE int32_t U_EXPORT2 ucasemap_toTitle(UCaseMap *csm, UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, UErrorCode *pErrorCode); #endif /** * Lowercase the characters in a UTF-8 string. * Casing is locale-dependent and context-sensitive. * The result may be longer or shorter than the original. * The source string and the destination buffer must not overlap. * * @param csm UCaseMap service object. * @param dest A buffer for the result string. The result will be NUL-terminated if * the buffer is large enough. * The contents is undefined in case of failure. * @param destCapacity The size of the buffer (number of bytes). If it is 0, then * dest may be NULL and the function will only return the length of the result * without writing any of the result string. * @param src The original string. * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The length of the result string, if successful - or in case of a buffer overflow, * in which case it will be greater than destCapacity. * * @see u_strToLower * @stable ICU 3.4 */ U_STABLE int32_t U_EXPORT2 ucasemap_utf8ToLower(const UCaseMap *csm, char *dest, int32_t destCapacity, const char *src, int32_t srcLength, UErrorCode *pErrorCode); /** * Uppercase the characters in a UTF-8 string. * Casing is locale-dependent and context-sensitive. * The result may be longer or shorter than the original. * The source string and the destination buffer must not overlap. * * @param csm UCaseMap service object. * @param dest A buffer for the result string. The result will be NUL-terminated if * the buffer is large enough. * The contents is undefined in case of failure. * @param destCapacity The size of the buffer (number of bytes). If it is 0, then * dest may be NULL and the function will only return the length of the result * without writing any of the result string. * @param src The original string. * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The length of the result string, if successful - or in case of a buffer overflow, * in which case it will be greater than destCapacity. * * @see u_strToUpper * @stable ICU 3.4 */ U_STABLE int32_t U_EXPORT2 ucasemap_utf8ToUpper(const UCaseMap *csm, char *dest, int32_t destCapacity, const char *src, int32_t srcLength, UErrorCode *pErrorCode); #if !UCONFIG_NO_BREAK_ITERATION /** * Titlecase a UTF-8 string. * Casing is locale-dependent and context-sensitive. * Titlecasing uses a break iterator to find the first characters of words * that are to be titlecased. It titlecases those characters and lowercases * all others. (This can be modified with ucasemap_setOptions().) * * Note: This function takes a non-const UCaseMap pointer because it will * open a default break iterator if no break iterator was set yet, * and effectively call ucasemap_setBreakIterator(); * also because the break iterator is stateful and will be modified during * the iteration. * * The titlecase break iterator can be provided to customize for arbitrary * styles, using rules and dictionaries beyond the standard iterators. * The standard titlecase iterator for the root locale implements the * algorithm of Unicode TR 21. * * This function uses only the setUText(), first(), next() and close() methods of the * provided break iterator. * * The result may be longer or shorter than the original. * The source string and the destination buffer must not overlap. * * @param csm UCaseMap service object. This pointer is non-const! * See the note above for details. * @param dest A buffer for the result string. The result will be NUL-terminated if * the buffer is large enough. * The contents is undefined in case of failure. * @param destCapacity The size of the buffer (number of bytes). If it is 0, then * dest may be NULL and the function will only return the length of the result * without writing any of the result string. * @param src The original string. * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The length of the result string, if successful - or in case of a buffer overflow, * in which case it will be greater than destCapacity. * * @see u_strToTitle * @see U_TITLECASE_NO_LOWERCASE * @see U_TITLECASE_NO_BREAK_ADJUSTMENT * @stable ICU 3.8 */ U_STABLE int32_t U_EXPORT2 ucasemap_utf8ToTitle(UCaseMap *csm, char *dest, int32_t destCapacity, const char *src, int32_t srcLength, UErrorCode *pErrorCode); #endif /** * Case-fold the characters in a UTF-8 string. * Case-folding is locale-independent and not context-sensitive, * but there is an option for whether to include or exclude mappings for dotted I * and dotless i that are marked with 'I' in CaseFolding.txt. * The result may be longer or shorter than the original. * The source string and the destination buffer must not overlap. * * @param csm UCaseMap service object. * @param dest A buffer for the result string. The result will be NUL-terminated if * the buffer is large enough. * The contents is undefined in case of failure. * @param destCapacity The size of the buffer (number of bytes). If it is 0, then * dest may be NULL and the function will only return the length of the result * without writing any of the result string. * @param src The original string. * @param srcLength The length of the original string. If -1, then src must be NUL-terminated. * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * @return The length of the result string, if successful - or in case of a buffer overflow, * in which case it will be greater than destCapacity. * * @see u_strFoldCase * @see ucasemap_setOptions * @see U_FOLD_CASE_DEFAULT * @see U_FOLD_CASE_EXCLUDE_SPECIAL_I * @stable ICU 3.8 */ U_STABLE int32_t U_EXPORT2 ucasemap_utf8FoldCase(const UCaseMap *csm, char *dest, int32_t destCapacity, const char *src, int32_t srcLength, UErrorCode *pErrorCode); #endif android-audiosystem-1.8+13.10.20130807/include/unicode/usetiter.h0000644000015700001700000002260612200324306024766 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (c) 2002-2008, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** */ #ifndef USETITER_H #define USETITER_H #include "unicode/utypes.h" #include "unicode/uobject.h" #include "unicode/unistr.h" /** * \file * \brief C++ API: UnicodeSetIterator iterates over the contents of a UnicodeSet. */ U_NAMESPACE_BEGIN class UnicodeSet; class UnicodeString; /** * * UnicodeSetIterator iterates over the contents of a UnicodeSet. It * iterates over either code points or code point ranges. After all * code points or ranges have been returned, it returns the * multicharacter strings of the UnicodeSet, if any. * * This class is not intended to be subclassed. Consider any fields * or methods declared as "protected" to be private. The use of * protected in this class is an artifact of history. * *

To iterate over code points and strings, use a loop like this: *

 * UnicodeSetIterator it(set);
 * while (it.next()) {
 *     processItem(it.getString());
 * }
 * 
*

Each item in the set is accessed as a string. Set elements * consisting of single code points are returned as strings containing * just the one code point. * *

To iterate over code point ranges, instead of individual code points, * use a loop like this: *

 * UnicodeSetIterator it(set);
 * while (it.nextRange()) {
 *   if (it.isString()) {
 *     processString(it.getString());
 *   } else {
 *     processCodepointRange(it.getCodepoint(), it.getCodepointEnd());
 *   }
 * }
 * 
* @author M. Davis * @stable ICU 2.4 */ class U_COMMON_API UnicodeSetIterator : public UObject { protected: /** * Value of codepoint if the iterator points to a string. * If codepoint == IS_STRING, then examine * string for the current iteration result. * @stable ICU 2.4 */ enum { IS_STRING = -1 }; /** * Current code point, or the special value IS_STRING, if * the iterator points to a string. * @stable ICU 2.4 */ UChar32 codepoint; /** * When iterating over ranges using nextRange(), * codepointEnd contains the inclusive end of the * iteration range, if codepoint != IS_STRING. If * iterating over code points using next(), or if * codepoint == IS_STRING, then the value of * codepointEnd is undefined. * @stable ICU 2.4 */ UChar32 codepointEnd; /** * If codepoint == IS_STRING, then string points * to the current string. If codepoint != IS_STRING, the * value of string is undefined. * @stable ICU 2.4 */ const UnicodeString* string; public: /** * Create an iterator over the given set. The iterator is valid * only so long as set is valid. * @param set set to iterate over * @stable ICU 2.4 */ UnicodeSetIterator(const UnicodeSet& set); /** * Create an iterator over nothing. next() and * nextRange() return false. This is a convenience * constructor allowing the target to be set later. * @stable ICU 2.4 */ UnicodeSetIterator(); /** * Destructor. * @stable ICU 2.4 */ virtual ~UnicodeSetIterator(); /** * Returns true if the current element is a string. If so, the * caller can retrieve it with getString(). If this * method returns false, the current element is a code point or * code point range, depending on whether next() or * nextRange() was called. * Elements of types string and codepoint can both be retrieved * with the function getString(). * Elements of type codepoint can also be retrieved with * getCodepoint(). * For ranges, getCodepoint() returns the starting codepoint * of the range, and getCodepointEnd() returns the end * of the range. * @stable ICU 2.4 */ inline UBool isString() const; /** * Returns the current code point, if isString() returned * false. Otherwise returns an undefined result. * @stable ICU 2.4 */ inline UChar32 getCodepoint() const; /** * Returns the end of the current code point range, if * isString() returned false and nextRange() was * called. Otherwise returns an undefined result. * @stable ICU 2.4 */ inline UChar32 getCodepointEnd() const; /** * Returns the current string, if isString() returned * true. If the current iteration item is a code point, a UnicodeString * containing that single code point is returned. * * Ownership of the returned string remains with the iterator. * The string is guaranteed to remain valid only until the iterator is * advanced to the next item, or until the iterator is deleted. * * @stable ICU 2.4 */ const UnicodeString& getString(); /** * Advances the iteration position to the next element in the set, * which can be either a single code point or a string. * If there are no more elements in the set, return false. * *

* If isString() == TRUE, the value is a * string, otherwise the value is a * single code point. Elements of either type can be retrieved * with the function getString(), while elements of * consisting of a single code point can be retrieved with * getCodepoint() * *

The order of iteration is all code points in sorted order, * followed by all strings sorted order. Do not mix * calls to next() and nextRange() without * calling reset() between them. The results of doing so * are undefined. * * @return true if there was another element in the set. * @stable ICU 2.4 */ UBool next(); /** * Returns the next element in the set, either a code point range * or a string. If there are no more elements in the set, return * false. If isString() == TRUE, the value is a * string and can be accessed with getString(). Otherwise the value is a * range of one or more code points from getCodepoint() to * getCodepointeEnd() inclusive. * *

The order of iteration is all code points ranges in sorted * order, followed by all strings sorted order. Ranges are * disjoint and non-contiguous. The value returned from getString() * is undefined unless isString() == TRUE. Do not mix calls to * next() and nextRange() without calling * reset() between them. The results of doing so are * undefined. * * @return true if there was another element in the set. * @stable ICU 2.4 */ UBool nextRange(); /** * Sets this iterator to visit the elements of the given set and * resets it to the start of that set. The iterator is valid only * so long as set is valid. * @param set the set to iterate over. * @stable ICU 2.4 */ void reset(const UnicodeSet& set); /** * Resets this iterator to the start of the set. * @stable ICU 2.4 */ void reset(); /** * ICU "poor man's RTTI", returns a UClassID for this class. * * @stable ICU 2.4 */ static UClassID U_EXPORT2 getStaticClassID(); /** * ICU "poor man's RTTI", returns a UClassID for the actual class. * * @stable ICU 2.4 */ virtual UClassID getDynamicClassID() const; // ======================= PRIVATES =========================== protected: // endElement and nextElements are really UChar32's, but we keep // them as signed int32_t's so we can do comparisons with // endElement set to -1. Leave them as int32_t's. /** The set * @stable ICU 2.4 */ const UnicodeSet* set; /** End range * @stable ICU 2.4 */ int32_t endRange; /** Range * @stable ICU 2.4 */ int32_t range; /** End element * @stable ICU 2.4 */ int32_t endElement; /** Next element * @stable ICU 2.4 */ int32_t nextElement; //UBool abbreviated; /** Next string * @stable ICU 2.4 */ int32_t nextString; /** String count * @stable ICU 2.4 */ int32_t stringCount; /** * Points to the string to use when the caller asks for a * string and the current iteration item is a code point, not a string. * @internal */ UnicodeString *cpString; /** Copy constructor. Disallowed. * @stable ICU 2.4 */ UnicodeSetIterator(const UnicodeSetIterator&); // disallow /** Assignment operator. Disallowed. * @stable ICU 2.4 */ UnicodeSetIterator& operator=(const UnicodeSetIterator&); // disallow /** Load range * @stable ICU 2.4 */ virtual void loadRange(int32_t range); }; inline UBool UnicodeSetIterator::isString() const { return codepoint == (UChar32)IS_STRING; } inline UChar32 UnicodeSetIterator::getCodepoint() const { return codepoint; } inline UChar32 UnicodeSetIterator::getCodepointEnd() const { return codepointEnd; } U_NAMESPACE_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/unifilt.h0000644000015700001700000000702012200324306024565 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (C) 1999-2010, International Business Machines Corporation and others. * All Rights Reserved. ********************************************************************** * Date Name Description * 11/17/99 aliu Creation. ********************************************************************** */ #ifndef UNIFILT_H #define UNIFILT_H #include "unicode/unifunct.h" #include "unicode/unimatch.h" /** * \file * \brief C++ API: Unicode Filter */ U_NAMESPACE_BEGIN /** * U_ETHER is used to represent character values for positions outside * a range. For example, transliterator uses this to represent * characters outside the range contextStart..contextLimit-1. This * allows explicit matching by rules and UnicodeSets of text outside a * defined range. * @stable ICU 3.0 */ #define U_ETHER ((UChar)0xFFFF) /** * * UnicodeFilter defines a protocol for selecting a * subset of the full range (U+0000 to U+10FFFF) of Unicode characters. * Currently, filters are used in conjunction with classes like {@link * Transliterator} to only process selected characters through a * transformation. * *

Note: UnicodeFilter currently stubs out two pure virtual methods * of its base class, UnicodeMatcher. These methods are toPattern() * and matchesIndexValue(). This is done so that filter classes that * are not actually used as matchers -- specifically, those in the * UnicodeFilterLogic component, and those in tests -- can continue to * work without defining these methods. As long as a filter is not * used in an RBT during real transliteration, these methods will not * be called. However, this breaks the UnicodeMatcher base class * protocol, and it is not a correct solution. * *

In the future we may revisit the UnicodeMatcher / UnicodeFilter * hierarchy and either redesign it, or simply remove the stubs in * UnicodeFilter and force subclasses to implement the full * UnicodeMatcher protocol. * * @see UnicodeFilterLogic * @stable ICU 2.0 */ class U_COMMON_API UnicodeFilter : public UnicodeFunctor, public UnicodeMatcher { public: /** * Destructor * @stable ICU 2.0 */ virtual ~UnicodeFilter(); /** * Returns true for characters that are in the selected * subset. In other words, if a character is to be * filtered, then contains() returns * false. * @stable ICU 2.0 */ virtual UBool contains(UChar32 c) const = 0; /** * UnicodeFunctor API. Cast 'this' to a UnicodeMatcher* pointer * and return the pointer. * @stable ICU 2.4 */ virtual UnicodeMatcher* toMatcher() const; /** * Implement UnicodeMatcher API. * @stable ICU 2.4 */ virtual UMatchDegree matches(const Replaceable& text, int32_t& offset, int32_t limit, UBool incremental); /** * UnicodeFunctor API. Nothing to do. * @stable ICU 2.4 */ virtual void setData(const TransliterationRuleData*); /** * ICU "poor man's RTTI", returns a UClassID for this class. * * @stable ICU 2.2 */ static UClassID U_EXPORT2 getStaticClassID(); protected: /* * Since this class has pure virtual functions, * a constructor can't be used. * @stable ICU 2.0 */ /* UnicodeFilter();*/ }; /*inline UnicodeFilter::UnicodeFilter() {}*/ U_NAMESPACE_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/utf32.h0000644000015700001700000000121512200324306024056 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * * Copyright (C) 1999-2001, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: utf32.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 1999sep20 * created by: Markus W. Scherer */ /** * \file * \brief C API: UTF-32 macros * * This file is obsolete and its contents moved to utf_old.h. * See utf_old.h and Jitterbug 2150 and its discussion on the ICU mailing list * in September 2002. */ android-audiosystem-1.8+13.10.20130807/include/unicode/uiter.h0000644000015700001700000005532012200324306024251 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * * Copyright (C) 2002-2006,2009 International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: uiter.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2002jan18 * created by: Markus W. Scherer */ #ifndef __UITER_H__ #define __UITER_H__ /** * \file * \brief C API: Unicode Character Iteration * * @see UCharIterator */ #include "unicode/utypes.h" #if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN class CharacterIterator; class Replaceable; U_NAMESPACE_END #endif U_CDECL_BEGIN struct UCharIterator; typedef struct UCharIterator UCharIterator; /**< C typedef for struct UCharIterator. @stable ICU 2.1 */ /** * Origin constants for UCharIterator.getIndex() and UCharIterator.move(). * @see UCharIteratorMove * @see UCharIterator * @stable ICU 2.1 */ typedef enum UCharIteratorOrigin { UITER_START, UITER_CURRENT, UITER_LIMIT, UITER_ZERO, UITER_LENGTH } UCharIteratorOrigin; /** Constants for UCharIterator. @stable ICU 2.6 */ enum { /** * Constant value that may be returned by UCharIteratorMove * indicating that the final UTF-16 index is not known, but that the move succeeded. * This can occur when moving relative to limit or length, or * when moving relative to the current index after a setState() * when the current UTF-16 index is not known. * * It would be very inefficient to have to count from the beginning of the text * just to get the current/limit/length index after moving relative to it. * The actual index can be determined with getIndex(UITER_CURRENT) * which will count the UChars if necessary. * * @stable ICU 2.6 */ UITER_UNKNOWN_INDEX=-2 }; /** * Constant for UCharIterator getState() indicating an error or * an unknown state. * Returned by uiter_getState()/UCharIteratorGetState * when an error occurs. * Also, some UCharIterator implementations may not be able to return * a valid state for each position. This will be clearly documented * for each such iterator (none of the public ones here). * * @stable ICU 2.6 */ #define UITER_NO_STATE ((uint32_t)0xffffffff) /** * Function type declaration for UCharIterator.getIndex(). * * Gets the current position, or the start or limit of the * iteration range. * * This function may perform slowly for UITER_CURRENT after setState() was called, * or for UITER_LENGTH, because an iterator implementation may have to count * UChars if the underlying storage is not UTF-16. * * @param iter the UCharIterator structure ("this pointer") * @param origin get the 0, start, limit, length, or current index * @return the requested index, or U_SENTINEL in an error condition * * @see UCharIteratorOrigin * @see UCharIterator * @stable ICU 2.1 */ typedef int32_t U_CALLCONV UCharIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin); /** * Function type declaration for UCharIterator.move(). * * Use iter->move(iter, index, UITER_ZERO) like CharacterIterator::setIndex(index). * * Moves the current position relative to the start or limit of the * iteration range, or relative to the current position itself. * The movement is expressed in numbers of code units forward * or backward by specifying a positive or negative delta. * Out of bounds movement will be pinned to the start or limit. * * This function may perform slowly for moving relative to UITER_LENGTH * because an iterator implementation may have to count the rest of the * UChars if the native storage is not UTF-16. * * When moving relative to the limit or length, or * relative to the current position after setState() was called, * move() may return UITER_UNKNOWN_INDEX (-2) to avoid an inefficient * determination of the actual UTF-16 index. * The actual index can be determined with getIndex(UITER_CURRENT) * which will count the UChars if necessary. * See UITER_UNKNOWN_INDEX for details. * * @param iter the UCharIterator structure ("this pointer") * @param delta can be positive, zero, or negative * @param origin move relative to the 0, start, limit, length, or current index * @return the new index, or U_SENTINEL on an error condition, * or UITER_UNKNOWN_INDEX when the index is not known. * * @see UCharIteratorOrigin * @see UCharIterator * @see UITER_UNKNOWN_INDEX * @stable ICU 2.1 */ typedef int32_t U_CALLCONV UCharIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin); /** * Function type declaration for UCharIterator.hasNext(). * * Check if current() and next() can still * return another code unit. * * @param iter the UCharIterator structure ("this pointer") * @return boolean value for whether current() and next() can still return another code unit * * @see UCharIterator * @stable ICU 2.1 */ typedef UBool U_CALLCONV UCharIteratorHasNext(UCharIterator *iter); /** * Function type declaration for UCharIterator.hasPrevious(). * * Check if previous() can still return another code unit. * * @param iter the UCharIterator structure ("this pointer") * @return boolean value for whether previous() can still return another code unit * * @see UCharIterator * @stable ICU 2.1 */ typedef UBool U_CALLCONV UCharIteratorHasPrevious(UCharIterator *iter); /** * Function type declaration for UCharIterator.current(). * * Return the code unit at the current position, * or U_SENTINEL if there is none (index is at the limit). * * @param iter the UCharIterator structure ("this pointer") * @return the current code unit * * @see UCharIterator * @stable ICU 2.1 */ typedef UChar32 U_CALLCONV UCharIteratorCurrent(UCharIterator *iter); /** * Function type declaration for UCharIterator.next(). * * Return the code unit at the current index and increment * the index (post-increment, like s[i++]), * or return U_SENTINEL if there is none (index is at the limit). * * @param iter the UCharIterator structure ("this pointer") * @return the current code unit (and post-increment the current index) * * @see UCharIterator * @stable ICU 2.1 */ typedef UChar32 U_CALLCONV UCharIteratorNext(UCharIterator *iter); /** * Function type declaration for UCharIterator.previous(). * * Decrement the index and return the code unit from there * (pre-decrement, like s[--i]), * or return U_SENTINEL if there is none (index is at the start). * * @param iter the UCharIterator structure ("this pointer") * @return the previous code unit (after pre-decrementing the current index) * * @see UCharIterator * @stable ICU 2.1 */ typedef UChar32 U_CALLCONV UCharIteratorPrevious(UCharIterator *iter); /** * Function type declaration for UCharIterator.reservedFn(). * Reserved for future use. * * @param iter the UCharIterator structure ("this pointer") * @param something some integer argument * @return some integer * * @see UCharIterator * @stable ICU 2.1 */ typedef int32_t U_CALLCONV UCharIteratorReserved(UCharIterator *iter, int32_t something); /** * Function type declaration for UCharIterator.getState(). * * Get the "state" of the iterator in the form of a single 32-bit word. * It is recommended that the state value be calculated to be as small as * is feasible. For strings with limited lengths, fewer than 32 bits may * be sufficient. * * This is used together with setState()/UCharIteratorSetState * to save and restore the iterator position more efficiently than with * getIndex()/move(). * * The iterator state is defined as a uint32_t value because it is designed * for use in ucol_nextSortKeyPart() which provides 32 bits to store the state * of the character iterator. * * With some UCharIterator implementations (e.g., UTF-8), * getting and setting the UTF-16 index with existing functions * (getIndex(UITER_CURRENT) followed by move(pos, UITER_ZERO)) is possible but * relatively slow because the iterator has to "walk" from a known index * to the requested one. * This takes more time the farther it needs to go. * * An opaque state value allows an iterator implementation to provide * an internal index (UTF-8: the source byte array index) for * fast, constant-time restoration. * * After calling setState(), a getIndex(UITER_CURRENT) may be slow because * the UTF-16 index may not be restored as well, but the iterator can deliver * the correct text contents and move relative to the current position * without performance degradation. * * Some UCharIterator implementations may not be able to return * a valid state for each position, in which case they return UITER_NO_STATE instead. * This will be clearly documented for each such iterator (none of the public ones here). * * @param iter the UCharIterator structure ("this pointer") * @return the state word * * @see UCharIterator * @see UCharIteratorSetState * @see UITER_NO_STATE * @stable ICU 2.6 */ typedef uint32_t U_CALLCONV UCharIteratorGetState(const UCharIterator *iter); /** * Function type declaration for UCharIterator.setState(). * * Restore the "state" of the iterator using a state word from a getState() call. * The iterator object need not be the same one as for which getState() was called, * but it must be of the same type (set up using the same uiter_setXYZ function) * and it must iterate over the same string * (binary identical regardless of memory address). * For more about the state word see UCharIteratorGetState. * * After calling setState(), a getIndex(UITER_CURRENT) may be slow because * the UTF-16 index may not be restored as well, but the iterator can deliver * the correct text contents and move relative to the current position * without performance degradation. * * @param iter the UCharIterator structure ("this pointer") * @param state the state word from a getState() call * on a same-type, same-string iterator * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * * @see UCharIterator * @see UCharIteratorGetState * @stable ICU 2.6 */ typedef void U_CALLCONV UCharIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode); /** * C API for code unit iteration. * This can be used as a C wrapper around * CharacterIterator, Replaceable, or implemented using simple strings, etc. * * There are two roles for using UCharIterator: * * A "provider" sets the necessary function pointers and controls the "protected" * fields of the UCharIterator structure. A "provider" passes a UCharIterator * into C APIs that need a UCharIterator as an abstract, flexible string interface. * * Implementations of such C APIs are "callers" of UCharIterator functions; * they only use the "public" function pointers and never access the "protected" * fields directly. * * The current() and next() functions only check the current index against the * limit, and previous() only checks the current index against the start, * to see if the iterator already reached the end of the iteration range. * * The assumption - in all iterators - is that the index is moved via the API, * which means it won't go out of bounds, or the index is modified by * user code that knows enough about the iterator implementation to set valid * index values. * * UCharIterator functions return code unit values 0..0xffff, * or U_SENTINEL if the iteration bounds are reached. * * @stable ICU 2.1 */ struct UCharIterator { /** * (protected) Pointer to string or wrapped object or similar. * Not used by caller. * @stable ICU 2.1 */ const void *context; /** * (protected) Length of string or similar. * Not used by caller. * @stable ICU 2.1 */ int32_t length; /** * (protected) Start index or similar. * Not used by caller. * @stable ICU 2.1 */ int32_t start; /** * (protected) Current index or similar. * Not used by caller. * @stable ICU 2.1 */ int32_t index; /** * (protected) Limit index or similar. * Not used by caller. * @stable ICU 2.1 */ int32_t limit; /** * (protected) Used by UTF-8 iterators and possibly others. * @stable ICU 2.1 */ int32_t reservedField; /** * (public) Returns the current position or the * start or limit index of the iteration range. * * @see UCharIteratorGetIndex * @stable ICU 2.1 */ UCharIteratorGetIndex *getIndex; /** * (public) Moves the current position relative to the start or limit of the * iteration range, or relative to the current position itself. * The movement is expressed in numbers of code units forward * or backward by specifying a positive or negative delta. * * @see UCharIteratorMove * @stable ICU 2.1 */ UCharIteratorMove *move; /** * (public) Check if current() and next() can still * return another code unit. * * @see UCharIteratorHasNext * @stable ICU 2.1 */ UCharIteratorHasNext *hasNext; /** * (public) Check if previous() can still return another code unit. * * @see UCharIteratorHasPrevious * @stable ICU 2.1 */ UCharIteratorHasPrevious *hasPrevious; /** * (public) Return the code unit at the current position, * or U_SENTINEL if there is none (index is at the limit). * * @see UCharIteratorCurrent * @stable ICU 2.1 */ UCharIteratorCurrent *current; /** * (public) Return the code unit at the current index and increment * the index (post-increment, like s[i++]), * or return U_SENTINEL if there is none (index is at the limit). * * @see UCharIteratorNext * @stable ICU 2.1 */ UCharIteratorNext *next; /** * (public) Decrement the index and return the code unit from there * (pre-decrement, like s[--i]), * or return U_SENTINEL if there is none (index is at the start). * * @see UCharIteratorPrevious * @stable ICU 2.1 */ UCharIteratorPrevious *previous; /** * (public) Reserved for future use. Currently NULL. * * @see UCharIteratorReserved * @stable ICU 2.1 */ UCharIteratorReserved *reservedFn; /** * (public) Return the state of the iterator, to be restored later with setState(). * This function pointer is NULL if the iterator does not implement it. * * @see UCharIteratorGet * @stable ICU 2.6 */ UCharIteratorGetState *getState; /** * (public) Restore the iterator state from the state word from a call * to getState(). * This function pointer is NULL if the iterator does not implement it. * * @see UCharIteratorSet * @stable ICU 2.6 */ UCharIteratorSetState *setState; }; /** * Helper function for UCharIterator to get the code point * at the current index. * * Return the code point that includes the code unit at the current position, * or U_SENTINEL if there is none (index is at the limit). * If the current code unit is a lead or trail surrogate, * then the following or preceding surrogate is used to form * the code point value. * * @param iter the UCharIterator structure ("this pointer") * @return the current code point * * @see UCharIterator * @see U16_GET * @see UnicodeString::char32At() * @stable ICU 2.1 */ U_STABLE UChar32 U_EXPORT2 uiter_current32(UCharIterator *iter); /** * Helper function for UCharIterator to get the next code point. * * Return the code point at the current index and increment * the index (post-increment, like s[i++]), * or return U_SENTINEL if there is none (index is at the limit). * * @param iter the UCharIterator structure ("this pointer") * @return the current code point (and post-increment the current index) * * @see UCharIterator * @see U16_NEXT * @stable ICU 2.1 */ U_STABLE UChar32 U_EXPORT2 uiter_next32(UCharIterator *iter); /** * Helper function for UCharIterator to get the previous code point. * * Decrement the index and return the code point from there * (pre-decrement, like s[--i]), * or return U_SENTINEL if there is none (index is at the start). * * @param iter the UCharIterator structure ("this pointer") * @return the previous code point (after pre-decrementing the current index) * * @see UCharIterator * @see U16_PREV * @stable ICU 2.1 */ U_STABLE UChar32 U_EXPORT2 uiter_previous32(UCharIterator *iter); /** * Get the "state" of the iterator in the form of a single 32-bit word. * This is a convenience function that calls iter->getState(iter) * if iter->getState is not NULL; * if it is NULL or any other error occurs, then UITER_NO_STATE is returned. * * Some UCharIterator implementations may not be able to return * a valid state for each position, in which case they return UITER_NO_STATE instead. * This will be clearly documented for each such iterator (none of the public ones here). * * @param iter the UCharIterator structure ("this pointer") * @return the state word * * @see UCharIterator * @see UCharIteratorGetState * @see UITER_NO_STATE * @stable ICU 2.6 */ U_STABLE uint32_t U_EXPORT2 uiter_getState(const UCharIterator *iter); /** * Restore the "state" of the iterator using a state word from a getState() call. * This is a convenience function that calls iter->setState(iter, state, pErrorCode) * if iter->setState is not NULL; if it is NULL, then U_UNSUPPORTED_ERROR is set. * * @param iter the UCharIterator structure ("this pointer") * @param state the state word from a getState() call * on a same-type, same-string iterator * @param pErrorCode Must be a valid pointer to an error code value, * which must not indicate a failure before the function call. * * @see UCharIterator * @see UCharIteratorSetState * @stable ICU 2.6 */ U_STABLE void U_EXPORT2 uiter_setState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode); /** * Set up a UCharIterator to iterate over a string. * * Sets the UCharIterator function pointers for iteration over the string s * with iteration boundaries start=index=0 and length=limit=string length. * The "provider" may set the start, index, and limit values at any time * within the range 0..length. * The length field will be ignored. * * The string pointer s is set into UCharIterator.context without copying * or reallocating the string contents. * * getState() simply returns the current index. * move() will always return the final index. * * @param iter UCharIterator structure to be set for iteration * @param s String to iterate over * @param length Length of s, or -1 if NUL-terminated * * @see UCharIterator * @stable ICU 2.1 */ U_STABLE void U_EXPORT2 uiter_setString(UCharIterator *iter, const UChar *s, int32_t length); /** * Set up a UCharIterator to iterate over a UTF-16BE string * (byte vector with a big-endian pair of bytes per UChar). * * Everything works just like with a normal UChar iterator (uiter_setString), * except that UChars are assembled from byte pairs, * and that the length argument here indicates an even number of bytes. * * getState() simply returns the current index. * move() will always return the final index. * * @param iter UCharIterator structure to be set for iteration * @param s UTF-16BE string to iterate over * @param length Length of s as an even number of bytes, or -1 if NUL-terminated * (NUL means pair of 0 bytes at even index from s) * * @see UCharIterator * @see uiter_setString * @stable ICU 2.6 */ U_STABLE void U_EXPORT2 uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length); /** * Set up a UCharIterator to iterate over a UTF-8 string. * * Sets the UCharIterator function pointers for iteration over the UTF-8 string s * with UTF-8 iteration boundaries 0 and length. * The implementation counts the UTF-16 index on the fly and * lazily evaluates the UTF-16 length of the text. * * The start field is used as the UTF-8 offset, the limit field as the UTF-8 length. * When the reservedField is not 0, then it contains a supplementary code point * and the UTF-16 index is between the two corresponding surrogates. * At that point, the UTF-8 index is behind that code point. * * The UTF-8 string pointer s is set into UCharIterator.context without copying * or reallocating the string contents. * * getState() returns a state value consisting of * - the current UTF-8 source byte index (bits 31..1) * - a flag (bit 0) that indicates whether the UChar position is in the middle * of a surrogate pair * (from a 4-byte UTF-8 sequence for the corresponding supplementary code point) * * getState() cannot also encode the UTF-16 index in the state value. * move(relative to limit or length), or * move(relative to current) after setState(), may return UITER_UNKNOWN_INDEX. * * @param iter UCharIterator structure to be set for iteration * @param s UTF-8 string to iterate over * @param length Length of s in bytes, or -1 if NUL-terminated * * @see UCharIterator * @stable ICU 2.6 */ U_STABLE void U_EXPORT2 uiter_setUTF8(UCharIterator *iter, const char *s, int32_t length); #if U_SHOW_CPLUSPLUS_API /** * Set up a UCharIterator to wrap around a C++ CharacterIterator. * * Sets the UCharIterator function pointers for iteration using the * CharacterIterator charIter. * * The CharacterIterator pointer charIter is set into UCharIterator.context * without copying or cloning the CharacterIterator object. * The other "protected" UCharIterator fields are set to 0 and will be ignored. * The iteration index and boundaries are controlled by the CharacterIterator. * * getState() simply returns the current index. * move() will always return the final index. * * @param iter UCharIterator structure to be set for iteration * @param charIter CharacterIterator to wrap * * @see UCharIterator * @stable ICU 2.1 */ U_STABLE void U_EXPORT2 uiter_setCharacterIterator(UCharIterator *iter, U_NAMESPACE_QUALIFIER CharacterIterator *charIter); /** * Set up a UCharIterator to iterate over a C++ Replaceable. * * Sets the UCharIterator function pointers for iteration over the * Replaceable rep with iteration boundaries start=index=0 and * length=limit=rep->length(). * The "provider" may set the start, index, and limit values at any time * within the range 0..length=rep->length(). * The length field will be ignored. * * The Replaceable pointer rep is set into UCharIterator.context without copying * or cloning/reallocating the Replaceable object. * * getState() simply returns the current index. * move() will always return the final index. * * @param iter UCharIterator structure to be set for iteration * @param rep Replaceable to iterate over * * @see UCharIterator * @stable ICU 2.1 */ U_STABLE void U_EXPORT2 uiter_setReplaceable(UCharIterator *iter, const U_NAMESPACE_QUALIFIER Replaceable *rep); #endif U_CDECL_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/ubrk.h0000644000015700001700000004332412200324306024065 0ustar pbuserpbgroup00000000000000/* ****************************************************************************** * Copyright (C) 1996-2010, International Business Machines Corporation and others. * All Rights Reserved. ****************************************************************************** */ #ifndef UBRK_H #define UBRK_H #include "unicode/utypes.h" #include "unicode/uloc.h" #include "unicode/utext.h" #include "unicode/localpointer.h" /** * A text-break iterator. * For usage in C programs. */ #ifndef UBRK_TYPEDEF_UBREAK_ITERATOR # define UBRK_TYPEDEF_UBREAK_ITERATOR /** * Opaque type representing an ICU Break iterator object. * @stable ICU 2.0 */ typedef struct UBreakIterator UBreakIterator; #endif #if !UCONFIG_NO_BREAK_ITERATION #include "unicode/parseerr.h" /** * \file * \brief C API: BreakIterator * *

BreakIterator C API

* * The BreakIterator C API defines methods for finding the location * of boundaries in text. Pointer to a UBreakIterator maintain a * current position and scan over text returning the index of characters * where boundaries occur. *

* Line boundary analysis determines where a text string can be broken * when line-wrapping. The mechanism correctly handles punctuation and * hyphenated words. *

* Sentence boundary analysis allows selection with correct * interpretation of periods within numbers and abbreviations, and * trailing punctuation marks such as quotation marks and parentheses. *

* Word boundary analysis is used by search and replace functions, as * well as within text editing applications that allow the user to * select words with a double click. Word selection provides correct * interpretation of punctuation marks within and following * words. Characters that are not part of a word, such as symbols or * punctuation marks, have word-breaks on both sides. *

* Character boundary analysis identifies the boundaries of * "Extended Grapheme Clusters", which are groupings of codepoints * that should be treated as character-like units for many text operations. * Please see Unicode Standard Annex #29, Unicode Text Segmentation, * http://www.unicode.org/reports/tr29/ for additional information * on grapheme clusters and guidelines on their use. *

* Title boundary analysis locates all positions, * typically starts of words, that should be set to Title Case * when title casing the text. *

* The text boundary positions are found according to the rules * described in Unicode Standard Annex #29, Text Boundaries, and * Unicode Standard Annex #14, Line Breaking Properties. These * are available at http://www.unicode.org/reports/tr14/ and * http://www.unicode.org/reports/tr29/. *

* In addition to the plain C API defined in this header file, an * object oriented C++ API with equivalent functionality is defined in the * file brkiter.h. *

* Code snippets illustrating the use of the Break Iterator APIs * are available in the ICU User Guide, * http://icu-project.org/userguide/boundaryAnalysis.html * and in the sample program icu/source/samples/break/break.cpp */ /** The possible types of text boundaries. @stable ICU 2.0 */ typedef enum UBreakIteratorType { /** Character breaks @stable ICU 2.0 */ UBRK_CHARACTER = 0, /** Word breaks @stable ICU 2.0 */ UBRK_WORD = 1, /** Line breaks @stable ICU 2.0 */ UBRK_LINE = 2, /** Sentence breaks @stable ICU 2.0 */ UBRK_SENTENCE = 3, #ifndef U_HIDE_DEPRECATED_API /** * Title Case breaks * The iterator created using this type locates title boundaries as described for * Unicode 3.2 only. For Unicode 4.0 and above title boundary iteration, * please use Word Boundary iterator. * * @deprecated ICU 2.8 Use the word break iterator for titlecasing for Unicode 4 and later. */ UBRK_TITLE = 4, #endif /* U_HIDE_DEPRECATED_API */ UBRK_COUNT = 5 } UBreakIteratorType; /** Value indicating all text boundaries have been returned. * @stable ICU 2.0 */ #define UBRK_DONE ((int32_t) -1) /** * Enum constants for the word break tags returned by * getRuleStatus(). A range of values is defined for each category of * word, to allow for further subdivisions of a category in future releases. * Applications should check for tag values falling within the range, rather * than for single individual values. * @stable ICU 2.2 */ typedef enum UWordBreak { /** Tag value for "words" that do not fit into any of other categories. * Includes spaces and most punctuation. */ UBRK_WORD_NONE = 0, /** Upper bound for tags for uncategorized words. */ UBRK_WORD_NONE_LIMIT = 100, /** Tag value for words that appear to be numbers, lower limit. */ UBRK_WORD_NUMBER = 100, /** Tag value for words that appear to be numbers, upper limit. */ UBRK_WORD_NUMBER_LIMIT = 200, /** Tag value for words that contain letters, excluding * hiragana, katakana or ideographic characters, lower limit. */ UBRK_WORD_LETTER = 200, /** Tag value for words containing letters, upper limit */ UBRK_WORD_LETTER_LIMIT = 300, /** Tag value for words containing kana characters, lower limit */ UBRK_WORD_KANA = 300, /** Tag value for words containing kana characters, upper limit */ UBRK_WORD_KANA_LIMIT = 400, /** Tag value for words containing ideographic characters, lower limit */ UBRK_WORD_IDEO = 400, /** Tag value for words containing ideographic characters, upper limit */ UBRK_WORD_IDEO_LIMIT = 500 } UWordBreak; /** * Enum constants for the line break tags returned by getRuleStatus(). * A range of values is defined for each category of * word, to allow for further subdivisions of a category in future releases. * Applications should check for tag values falling within the range, rather * than for single individual values. * @stable ICU 2.8 */ typedef enum ULineBreakTag { /** Tag value for soft line breaks, positions at which a line break * is acceptable but not required */ UBRK_LINE_SOFT = 0, /** Upper bound for soft line breaks. */ UBRK_LINE_SOFT_LIMIT = 100, /** Tag value for a hard, or mandatory line break */ UBRK_LINE_HARD = 100, /** Upper bound for hard line breaks. */ UBRK_LINE_HARD_LIMIT = 200 } ULineBreakTag; /** * Enum constants for the sentence break tags returned by getRuleStatus(). * A range of values is defined for each category of * sentence, to allow for further subdivisions of a category in future releases. * Applications should check for tag values falling within the range, rather * than for single individual values. * @stable ICU 2.8 */ typedef enum USentenceBreakTag { /** Tag value for for sentences ending with a sentence terminator * ('.', '?', '!', etc.) character, possibly followed by a * hard separator (CR, LF, PS, etc.) */ UBRK_SENTENCE_TERM = 0, /** Upper bound for tags for sentences ended by sentence terminators. */ UBRK_SENTENCE_TERM_LIMIT = 100, /** Tag value for for sentences that do not contain an ending * sentence terminator ('.', '?', '!', etc.) character, but * are ended only by a hard separator (CR, LF, PS, etc.) or end of input. */ UBRK_SENTENCE_SEP = 100, /** Upper bound for tags for sentences ended by a separator. */ UBRK_SENTENCE_SEP_LIMIT = 200 /** Tag value for a hard, or mandatory line break */ } USentenceBreakTag; /** * Open a new UBreakIterator for locating text boundaries for a specified locale. * A UBreakIterator may be used for detecting character, line, word, * and sentence breaks in text. * @param type The type of UBreakIterator to open: one of UBRK_CHARACTER, UBRK_WORD, * UBRK_LINE, UBRK_SENTENCE * @param locale The locale specifying the text-breaking conventions. * @param text The text to be iterated over. * @param textLength The number of characters in text, or -1 if null-terminated. * @param status A UErrorCode to receive any errors. * @return A UBreakIterator for the specified locale. * @see ubrk_openRules * @stable ICU 2.0 */ U_STABLE UBreakIterator* U_EXPORT2 ubrk_open(UBreakIteratorType type, const char *locale, const UChar *text, int32_t textLength, UErrorCode *status); /** * Open a new UBreakIterator for locating text boundaries using specified breaking rules. * The rule syntax is ... (TBD) * @param rules A set of rules specifying the text breaking conventions. * @param rulesLength The number of characters in rules, or -1 if null-terminated. * @param text The text to be iterated over. May be null, in which case ubrk_setText() is * used to specify the text to be iterated. * @param textLength The number of characters in text, or -1 if null-terminated. * @param parseErr Receives position and context information for any syntax errors * detected while parsing the rules. * @param status A UErrorCode to receive any errors. * @return A UBreakIterator for the specified rules. * @see ubrk_open * @stable ICU 2.2 */ U_STABLE UBreakIterator* U_EXPORT2 ubrk_openRules(const UChar *rules, int32_t rulesLength, const UChar *text, int32_t textLength, UParseError *parseErr, UErrorCode *status); /** * Thread safe cloning operation * @param bi iterator to be cloned * @param stackBuffer user allocated space for the new clone. If NULL new memory will be allocated. * If buffer is not large enough, new memory will be allocated. * Clients can use the U_BRK_SAFECLONE_BUFFERSIZE. This will probably be enough to avoid memory allocations. * @param pBufferSize pointer to size of allocated space. * If *pBufferSize == 0, a sufficient size for use in cloning will * be returned ('pre-flighting') * If *pBufferSize is not enough for a stack-based safe clone, * new memory will be allocated. * @param status to indicate whether the operation went on smoothly or there were errors * An informational status value, U_SAFECLONE_ALLOCATED_ERROR, is used if any allocations were necessary. * @return pointer to the new clone * @stable ICU 2.0 */ U_STABLE UBreakIterator * U_EXPORT2 ubrk_safeClone( const UBreakIterator *bi, void *stackBuffer, int32_t *pBufferSize, UErrorCode *status); /** * A recommended size (in bytes) for the memory buffer to be passed to ubrk_saveClone(). * @stable ICU 2.0 */ #define U_BRK_SAFECLONE_BUFFERSIZE 512 /** * Close a UBreakIterator. * Once closed, a UBreakIterator may no longer be used. * @param bi The break iterator to close. * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ubrk_close(UBreakIterator *bi); #if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN /** * \class LocalUBreakIteratorPointer * "Smart pointer" class, closes a UBreakIterator via ubrk_close(). * For most methods see the LocalPointerBase base class. * * @see LocalPointerBase * @see LocalPointer * @stable ICU 4.4 */ U_DEFINE_LOCAL_OPEN_POINTER(LocalUBreakIteratorPointer, UBreakIterator, ubrk_close); U_NAMESPACE_END #endif /** * Sets an existing iterator to point to a new piece of text * @param bi The iterator to use * @param text The text to be set * @param textLength The length of the text * @param status The error code * @stable ICU 2.0 */ U_STABLE void U_EXPORT2 ubrk_setText(UBreakIterator* bi, const UChar* text, int32_t textLength, UErrorCode* status); /** * Sets an existing iterator to point to a new piece of text * @param bi The iterator to use * @param text The text to be set. * This function makes a shallow clone of the supplied UText. This means * that the caller is free to immediately close or otherwise reuse the * UText that was passed as a parameter, but that the underlying text itself * must not be altered while being referenced by the break iterator. * @param status The error code * @stable ICU 3.4 */ U_STABLE void U_EXPORT2 ubrk_setUText(UBreakIterator* bi, UText* text, UErrorCode* status); /** * Determine the most recently-returned text boundary. * * @param bi The break iterator to use. * @return The character index most recently returned by \ref ubrk_next, \ref ubrk_previous, * \ref ubrk_first, or \ref ubrk_last. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ubrk_current(const UBreakIterator *bi); /** * Determine the text boundary following the current text boundary. * * @param bi The break iterator to use. * @return The character index of the next text boundary, or UBRK_DONE * if all text boundaries have been returned. * @see ubrk_previous * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ubrk_next(UBreakIterator *bi); /** * Determine the text boundary preceding the current text boundary. * * @param bi The break iterator to use. * @return The character index of the preceding text boundary, or UBRK_DONE * if all text boundaries have been returned. * @see ubrk_next * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ubrk_previous(UBreakIterator *bi); /** * Determine the index of the first character in the text being scanned. * This is not always the same as index 0 of the text. * @param bi The break iterator to use. * @return The character index of the first character in the text being scanned. * @see ubrk_last * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ubrk_first(UBreakIterator *bi); /** * Determine the index immediately beyond the last character in the text being * scanned. * This is not the same as the last character. * @param bi The break iterator to use. * @return The character offset immediately beyond the last character in the * text being scanned. * @see ubrk_first * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ubrk_last(UBreakIterator *bi); /** * Determine the text boundary preceding the specified offset. * The value returned is always smaller than offset, or UBRK_DONE. * @param bi The break iterator to use. * @param offset The offset to begin scanning. * @return The text boundary preceding offset, or UBRK_DONE. * @see ubrk_following * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ubrk_preceding(UBreakIterator *bi, int32_t offset); /** * Determine the text boundary following the specified offset. * The value returned is always greater than offset, or UBRK_DONE. * @param bi The break iterator to use. * @param offset The offset to begin scanning. * @return The text boundary following offset, or UBRK_DONE. * @see ubrk_preceding * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ubrk_following(UBreakIterator *bi, int32_t offset); /** * Get a locale for which text breaking information is available. * A UBreakIterator in a locale returned by this function will perform the correct * text breaking for the locale. * @param index The index of the desired locale. * @return A locale for which number text breaking information is available, or 0 if none. * @see ubrk_countAvailable * @stable ICU 2.0 */ U_STABLE const char* U_EXPORT2 ubrk_getAvailable(int32_t index); /** * Determine how many locales have text breaking information available. * This function is most useful as determining the loop ending condition for * calls to \ref ubrk_getAvailable. * @return The number of locales for which text breaking information is available. * @see ubrk_getAvailable * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 ubrk_countAvailable(void); /** * Returns true if the specfied position is a boundary position. As a side * effect, leaves the iterator pointing to the first boundary position at * or after "offset". * @param bi The break iterator to use. * @param offset the offset to check. * @return True if "offset" is a boundary position. * @stable ICU 2.0 */ U_STABLE UBool U_EXPORT2 ubrk_isBoundary(UBreakIterator *bi, int32_t offset); /** * Return the status from the break rule that determined the most recently * returned break position. The values appear in the rule source * within brackets, {123}, for example. For rules that do not specify a * status, a default value of 0 is returned. *

* For word break iterators, the possible values are defined in enum UWordBreak. * @stable ICU 2.2 */ U_STABLE int32_t U_EXPORT2 ubrk_getRuleStatus(UBreakIterator *bi); /** * Get the statuses from the break rules that determined the most recently * returned break position. The values appear in the rule source * within brackets, {123}, for example. The default status value for rules * that do not explicitly provide one is zero. *

* For word break iterators, the possible values are defined in enum UWordBreak. * @param bi The break iterator to use * @param fillInVec an array to be filled in with the status values. * @param capacity the length of the supplied vector. A length of zero causes * the function to return the number of status values, in the * normal way, without attemtping to store any values. * @param status receives error codes. * @return The number of rule status values from rules that determined * the most recent boundary returned by the break iterator. * @stable ICU 3.0 */ U_STABLE int32_t U_EXPORT2 ubrk_getRuleStatusVec(UBreakIterator *bi, int32_t *fillInVec, int32_t capacity, UErrorCode *status); /** * Return the locale of the break iterator. You can choose between the valid and * the actual locale. * @param bi break iterator * @param type locale type (valid or actual) * @param status error code * @return locale string * @stable ICU 2.8 */ U_STABLE const char* U_EXPORT2 ubrk_getLocaleByType(const UBreakIterator *bi, ULocDataLocaleType type, UErrorCode* status); #endif /* #if !UCONFIG_NO_BREAK_ITERATION */ #endif android-audiosystem-1.8+13.10.20130807/include/unicode/uchriter.h0000644000015700001700000003151412200324306024745 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (C) 1998-2005, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** */ #ifndef UCHRITER_H #define UCHRITER_H #include "unicode/utypes.h" #include "unicode/chariter.h" /** * \file * \brief C++ API: UChar Character Iterator */ U_NAMESPACE_BEGIN /** * A concrete subclass of CharacterIterator that iterates over the * characters (code units or code points) in a UChar array. * It's possible not only to create an * iterator that iterates over an entire UChar array, but also to * create one that iterates over only a subrange of a UChar array * (iterators over different subranges of the same UChar array don't * compare equal). * @see CharacterIterator * @see ForwardCharacterIterator * @stable ICU 2.0 */ class U_COMMON_API UCharCharacterIterator : public CharacterIterator { public: /** * Create an iterator over the UChar array referred to by "textPtr". * The iteration range is 0 to length-1. * text is only aliased, not adopted (the * destructor will not delete it). * @param textPtr The UChar array to be iterated over * @param length The length of the UChar array * @stable ICU 2.0 */ UCharCharacterIterator(const UChar* textPtr, int32_t length); /** * Create an iterator over the UChar array referred to by "textPtr". * The iteration range is 0 to length-1. * text is only aliased, not adopted (the * destructor will not delete it). * The starting * position is specified by "position". If "position" is outside the valid * iteration range, the behavior of this object is undefined. * @param textPtr The UChar array to be iteratd over * @param length The length of the UChar array * @param position The starting position of the iteration * @stable ICU 2.0 */ UCharCharacterIterator(const UChar* textPtr, int32_t length, int32_t position); /** * Create an iterator over the UChar array referred to by "textPtr". * The iteration range is 0 to end-1. * text is only aliased, not adopted (the * destructor will not delete it). * The starting * position is specified by "position". If begin and end do not * form a valid iteration range or "position" is outside the valid * iteration range, the behavior of this object is undefined. * @param textPtr The UChar array to be iterated over * @param length The length of the UChar array * @param textBegin The begin position of the iteration range * @param textEnd The end position of the iteration range * @param position The starting position of the iteration * @stable ICU 2.0 */ UCharCharacterIterator(const UChar* textPtr, int32_t length, int32_t textBegin, int32_t textEnd, int32_t position); /** * Copy constructor. The new iterator iterates over the same range * of the same string as "that", and its initial position is the * same as "that"'s current position. * @param that The UCharCharacterIterator to be copied * @stable ICU 2.0 */ UCharCharacterIterator(const UCharCharacterIterator& that); /** * Destructor. * @stable ICU 2.0 */ virtual ~UCharCharacterIterator(); /** * Assignment operator. *this is altered to iterate over the sane * range of the same string as "that", and refers to the same * character within that string as "that" does. * @param that The object to be copied * @return the newly created object * @stable ICU 2.0 */ UCharCharacterIterator& operator=(const UCharCharacterIterator& that); /** * Returns true if the iterators iterate over the same range of the * same string and are pointing at the same character. * @param that The ForwardCharacterIterator used to be compared for equality * @return true if the iterators iterate over the same range of the * same string and are pointing at the same character. * @stable ICU 2.0 */ virtual UBool operator==(const ForwardCharacterIterator& that) const; /** * Generates a hash code for this iterator. * @return the hash code. * @stable ICU 2.0 */ virtual int32_t hashCode(void) const; /** * Returns a new UCharCharacterIterator referring to the same * character in the same range of the same string as this one. The * caller must delete the new iterator. * @return the CharacterIterator newly created * @stable ICU 2.0 */ virtual CharacterIterator* clone(void) const; /** * Sets the iterator to refer to the first code unit in its * iteration range, and returns that code unit. * This can be used to begin an iteration with next(). * @return the first code unit in its iteration range. * @stable ICU 2.0 */ virtual UChar first(void); /** * Sets the iterator to refer to the first code unit in its * iteration range, returns that code unit, and moves the position * to the second code unit. This is an alternative to setToStart() * for forward iteration with nextPostInc(). * @return the first code unit in its iteration range * @stable ICU 2.0 */ virtual UChar firstPostInc(void); /** * Sets the iterator to refer to the first code point in its * iteration range, and returns that code unit, * This can be used to begin an iteration with next32(). * Note that an iteration with next32PostInc(), beginning with, * e.g., setToStart() or firstPostInc(), is more efficient. * @return the first code point in its iteration range * @stable ICU 2.0 */ virtual UChar32 first32(void); /** * Sets the iterator to refer to the first code point in its * iteration range, returns that code point, and moves the position * to the second code point. This is an alternative to setToStart() * for forward iteration with next32PostInc(). * @return the first code point in its iteration range. * @stable ICU 2.0 */ virtual UChar32 first32PostInc(void); /** * Sets the iterator to refer to the last code unit in its * iteration range, and returns that code unit. * This can be used to begin an iteration with previous(). * @return the last code unit in its iteration range. * @stable ICU 2.0 */ virtual UChar last(void); /** * Sets the iterator to refer to the last code point in its * iteration range, and returns that code unit. * This can be used to begin an iteration with previous32(). * @return the last code point in its iteration range. * @stable ICU 2.0 */ virtual UChar32 last32(void); /** * Sets the iterator to refer to the "position"-th code unit * in the text-storage object the iterator refers to, and * returns that code unit. * @param position the position within the text-storage object * @return the code unit * @stable ICU 2.0 */ virtual UChar setIndex(int32_t position); /** * Sets the iterator to refer to the beginning of the code point * that contains the "position"-th code unit * in the text-storage object the iterator refers to, and * returns that code point. * The current position is adjusted to the beginning of the code point * (its first code unit). * @param position the position within the text-storage object * @return the code unit * @stable ICU 2.0 */ virtual UChar32 setIndex32(int32_t position); /** * Returns the code unit the iterator currently refers to. * @return the code unit the iterator currently refers to. * @stable ICU 2.0 */ virtual UChar current(void) const; /** * Returns the code point the iterator currently refers to. * @return the code point the iterator currently refers to. * @stable ICU 2.0 */ virtual UChar32 current32(void) const; /** * Advances to the next code unit in the iteration range (toward * endIndex()), and returns that code unit. If there are no more * code units to return, returns DONE. * @return the next code unit in the iteration range. * @stable ICU 2.0 */ virtual UChar next(void); /** * Gets the current code unit for returning and advances to the next code unit * in the iteration range * (toward endIndex()). If there are * no more code units to return, returns DONE. * @return the current code unit. * @stable ICU 2.0 */ virtual UChar nextPostInc(void); /** * Advances to the next code point in the iteration range (toward * endIndex()), and returns that code point. If there are no more * code points to return, returns DONE. * Note that iteration with "pre-increment" semantics is less * efficient than iteration with "post-increment" semantics * that is provided by next32PostInc(). * @return the next code point in the iteration range. * @stable ICU 2.0 */ virtual UChar32 next32(void); /** * Gets the current code point for returning and advances to the next code point * in the iteration range * (toward endIndex()). If there are * no more code points to return, returns DONE. * @return the current point. * @stable ICU 2.0 */ virtual UChar32 next32PostInc(void); /** * Returns FALSE if there are no more code units or code points * at or after the current position in the iteration range. * This is used with nextPostInc() or next32PostInc() in forward * iteration. * @return FALSE if there are no more code units or code points * at or after the current position in the iteration range. * @stable ICU 2.0 */ virtual UBool hasNext(); /** * Advances to the previous code unit in the iteration range (toward * startIndex()), and returns that code unit. If there are no more * code units to return, returns DONE. * @return the previous code unit in the iteration range. * @stable ICU 2.0 */ virtual UChar previous(void); /** * Advances to the previous code point in the iteration range (toward * startIndex()), and returns that code point. If there are no more * code points to return, returns DONE. * @return the previous code point in the iteration range. * @stable ICU 2.0 */ virtual UChar32 previous32(void); /** * Returns FALSE if there are no more code units or code points * before the current position in the iteration range. * This is used with previous() or previous32() in backward * iteration. * @return FALSE if there are no more code units or code points * before the current position in the iteration range. * @stable ICU 2.0 */ virtual UBool hasPrevious(); /** * Moves the current position relative to the start or end of the * iteration range, or relative to the current position itself. * The movement is expressed in numbers of code units forward * or backward by specifying a positive or negative delta. * @param delta the position relative to origin. A positive delta means forward; * a negative delta means backward. * @param origin Origin enumeration {kStart, kCurrent, kEnd} * @return the new position * @stable ICU 2.0 */ virtual int32_t move(int32_t delta, EOrigin origin); /** * Moves the current position relative to the start or end of the * iteration range, or relative to the current position itself. * The movement is expressed in numbers of code points forward * or backward by specifying a positive or negative delta. * @param delta the position relative to origin. A positive delta means forward; * a negative delta means backward. * @param origin Origin enumeration {kStart, kCurrent, kEnd} * @return the new position * @stable ICU 2.0 */ virtual int32_t move32(int32_t delta, EOrigin origin); /** * Sets the iterator to iterate over a new range of text * @stable ICU 2.0 */ void setText(const UChar* newText, int32_t newTextLength); /** * Copies the UChar array under iteration into the UnicodeString * referred to by "result". Even if this iterator iterates across * only a part of this string, the whole string is copied. * @param result Receives a copy of the text under iteration. * @stable ICU 2.0 */ virtual void getText(UnicodeString& result); /** * Return a class ID for this class (not really public) * @return a class ID for this class * @stable ICU 2.0 */ static UClassID U_EXPORT2 getStaticClassID(void); /** * Return a class ID for this object (not really public) * @return a class ID for this object. * @stable ICU 2.0 */ virtual UClassID getDynamicClassID(void) const; protected: /** * Protected constructor * @stable ICU 2.0 */ UCharCharacterIterator(); /** * Protected member text * @stable ICU 2.0 */ const UChar* text; }; U_NAMESPACE_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/uclean.h0000644000015700001700000002524712200324306024375 0ustar pbuserpbgroup00000000000000/* ****************************************************************************** * * * Copyright (C) 2001-2009, International Business Machines * * Corporation and others. All Rights Reserved. * * * ****************************************************************************** * file name: uclean.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2001July05 * created by: George Rhoten */ #ifndef __UCLEAN_H__ #define __UCLEAN_H__ #include "unicode/utypes.h" /** * \file * \brief C API: Initialize and clean up ICU */ /** * Initialize ICU. * * Use of this function is optional. It is OK to simply use ICU * services and functions without first having initialized * ICU by calling u_init(). * * u_init() will attempt to load some part of ICU's data, and is * useful as a test for configuration or installation problems that * leave the ICU data inaccessible. A successful invocation of u_init() * does not, however, guarantee that all ICU data is accessible. * * Multiple calls to u_init() cause no harm, aside from the small amount * of time required. * * In old versions of ICU, u_init() was required in multi-threaded applications * to ensure the thread safety of ICU. u_init() is no longer needed for this purpose. * * @param status An ICU UErrorCode parameter. It must not be NULL. * An Error will be returned if some required part of ICU data can not * be loaded or initialized. * The function returns immediately if the input error code indicates a * failure, as usual. * * @stable ICU 2.6 */ U_STABLE void U_EXPORT2 u_init(UErrorCode *status); /** * Clean up the system resources, such as allocated memory or open files, * used in all ICU libraries. This will free/delete all memory owned by the * ICU libraries, and return them to their original load state. All open ICU * items (collators, resource bundles, converters, etc.) must be closed before * calling this function, otherwise ICU may not free its allocated memory * (e.g. close your converters and resource bundles before calling this * function). Generally, this function should be called once just before * an application exits. For applications that dynamically load and unload * the ICU libraries (relatively uncommon), u_cleanup() should be called * just before the library unload. *

* u_cleanup() also clears any ICU heap functions, mutex functions or * trace functions that may have been set for the process. * This has the effect of restoring ICU to its initial condition, before * any of these override functions were installed. Refer to * u_setMemoryFunctions(), u_setMutexFunctions and * utrace_setFunctions(). If ICU is to be reinitialized after after * calling u_cleanup(), these runtime override functions will need to * be set up again if they are still required. *

* u_cleanup() is not thread safe. All other threads should stop using ICU * before calling this function. *

* Any open ICU items will be left in an undefined state by u_cleanup(), * and any subsequent attempt to use such an item will give unpredictable * results. *

* After calling u_cleanup(), an application may continue to use ICU by * calling u_init(). An application must invoke u_init() first from one single * thread before allowing other threads call u_init(). All threads existing * at the time of the first thread's call to u_init() must also call * u_init() themselves before continuing with other ICU operations. *

* The use of u_cleanup() just before an application terminates is optional, * but it should be called only once for performance reasons. The primary * benefit is to eliminate reports of memory or resource leaks originating * in ICU code from the results generated by heap analysis tools. *

* Use this function with great care! *

* * @stable ICU 2.0 * @system */ U_STABLE void U_EXPORT2 u_cleanup(void); /** * An opaque pointer type that represents an ICU mutex. * For user-implemented mutexes, the value will typically point to a * struct or object that implements the mutex. * @stable ICU 2.8 * @system */ typedef void *UMTX; /** * Function Pointer type for a user supplied mutex initialization function. * The user-supplied function will be called by ICU whenever ICU needs to create a * new mutex. The function implementation should create a mutex, and store a pointer * to something that uniquely identifies the mutex into the UMTX that is supplied * as a paramter. * @param context user supplied value, obtained from from u_setMutexFunctions(). * @param mutex Receives a pointer that identifies the new mutex. * The mutex init function must set the UMTX to a non-null value. * Subsequent calls by ICU to lock, unlock, or destroy a mutex will * identify the mutex by the UMTX value. * @param status Error status. Report errors back to ICU by setting this variable * with an error code. * @stable ICU 2.8 * @system */ typedef void U_CALLCONV UMtxInitFn (const void *context, UMTX *mutex, UErrorCode* status); /** * Function Pointer type for a user supplied mutex functions. * One of the user-supplied functions with this signature will be called by ICU * whenever ICU needs to lock, unlock, or destroy a mutex. * @param context user supplied value, obtained from from u_setMutexFunctions(). * @param mutex specify the mutex on which to operate. * @stable ICU 2.8 * @system */ typedef void U_CALLCONV UMtxFn (const void *context, UMTX *mutex); /** * Set the functions that ICU will use for mutex operations * Use of this function is optional; by default (without this function), ICU will * directly access system functions for mutex operations * This function can only be used when ICU is in an initial, unused state, before * u_init() has been called. * This function may be used even when ICU has been built without multi-threaded * support (see ICU_USE_THREADS pre-processor variable, umutex.h) * @param context This pointer value will be saved, and then (later) passed as * a parameter to the user-supplied mutex functions each time they * are called. * @param init Pointer to a mutex initialization function. Must be non-null. * @param destroy Pointer to the mutex destroy function. Must be non-null. * @param lock pointer to the mutex lock function. Must be non-null. * @param unlock Pointer to the mutex unlock function. Must be non-null. * @param status Receives error values. * @stable ICU 2.8 * @system */ U_STABLE void U_EXPORT2 u_setMutexFunctions(const void *context, UMtxInitFn *init, UMtxFn *destroy, UMtxFn *lock, UMtxFn *unlock, UErrorCode *status); /** * Pointer type for a user supplied atomic increment or decrement function. * @param context user supplied value, obtained from from u_setAtomicIncDecFunctions(). * @param p Pointer to a 32 bit int to be incremented or decremented * @return The value of the variable after the inc or dec operation. * @stable ICU 2.8 * @system */ typedef int32_t U_CALLCONV UMtxAtomicFn(const void *context, int32_t *p); /** * Set the functions that ICU will use for atomic increment and decrement of int32_t values. * Use of this function is optional; by default (without this function), ICU will * use its own internal implementation of atomic increment/decrement. * This function can only be used when ICU is in an initial, unused state, before * u_init() has been called. * @param context This pointer value will be saved, and then (later) passed as * a parameter to the increment and decrement functions each time they * are called. This function can only be called * @param inc Pointer to a function to do an atomic increment operation. Must be non-null. * @param dec Pointer to a function to do an atomic decrement operation. Must be non-null. * @param status Receives error values. * @stable ICU 2.8 * @system */ U_STABLE void U_EXPORT2 u_setAtomicIncDecFunctions(const void *context, UMtxAtomicFn *inc, UMtxAtomicFn *dec, UErrorCode *status); /** * Pointer type for a user supplied memory allocation function. * @param context user supplied value, obtained from from u_setMemoryFunctions(). * @param size The number of bytes to be allocated * @return Pointer to the newly allocated memory, or NULL if the allocation failed. * @stable ICU 2.8 * @system */ typedef void *U_CALLCONV UMemAllocFn(const void *context, size_t size); /** * Pointer type for a user supplied memory re-allocation function. * @param context user supplied value, obtained from from u_setMemoryFunctions(). * @param size The number of bytes to be allocated * @return Pointer to the newly allocated memory, or NULL if the allocation failed. * @stable ICU 2.8 * @system */ typedef void *U_CALLCONV UMemReallocFn(const void *context, void *mem, size_t size); /** * Pointer type for a user supplied memory free function. Behavior should be * similar the standard C library free(). * @param context user supplied value, obtained from from u_setMemoryFunctions(). * @param mem Pointer to the memory block to be resized * @param size The new size for the block * @return Pointer to the resized memory block, or NULL if the resizing failed. * @stable ICU 2.8 * @system */ typedef void U_CALLCONV UMemFreeFn (const void *context, void *mem); /** * Set the functions that ICU will use for memory allocation. * Use of this function is optional; by default (without this function), ICU will * use the standard C library malloc() and free() functions. * This function can only be used when ICU is in an initial, unused state, before * u_init() has been called. * @param context This pointer value will be saved, and then (later) passed as * a parameter to the memory functions each time they * are called. * @param a Pointer to a user-supplied malloc function. * @param r Pointer to a user-supplied realloc function. * @param f Pointer to a user-supplied free function. * @param status Receives error values. * @stable ICU 2.8 * @system */ U_STABLE void U_EXPORT2 u_setMemoryFunctions(const void *context, UMemAllocFn *a, UMemReallocFn *r, UMemFreeFn *f, UErrorCode *status); #endif android-audiosystem-1.8+13.10.20130807/include/unicode/parsepos.h0000644000015700001700000001253412200324306024755 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 1997-2005, International Business Machines Corporation and others. All Rights Reserved. ******************************************************************************* * * File PARSEPOS.H * * Modification History: * * Date Name Description * 07/09/97 helena Converted from java. * 07/17/98 stephen Added errorIndex support. * 05/11/99 stephen Cleaned up. ******************************************************************************* */ #ifndef PARSEPOS_H #define PARSEPOS_H #include "unicode/utypes.h" #include "unicode/uobject.h" U_NAMESPACE_BEGIN /** * \file * \brief C++ API: Canonical Iterator */ /** * ParsePosition is a simple class used by Format * and its subclasses to keep track of the current position during parsing. * The parseObject method in the various Format * classes requires a ParsePosition object as an argument. * *

* By design, as you parse through a string with different formats, * you can use the same ParsePosition, since the index parameter * records the current position. * * The ParsePosition class is not suitable for subclassing. * * @version 1.3 10/30/97 * @author Mark Davis, Helena Shih * @see java.text.Format */ class U_COMMON_API ParsePosition : public UObject { public: /** * Default constructor, the index starts with 0 as default. * @stable ICU 2.0 */ ParsePosition() : UObject(), index(0), errorIndex(-1) {} /** * Create a new ParsePosition with the given initial index. * @param newIndex the new text offset. * @stable ICU 2.0 */ ParsePosition(int32_t newIndex) : UObject(), index(newIndex), errorIndex(-1) {} /** * Copy constructor * @param copy the object to be copied from. * @stable ICU 2.0 */ ParsePosition(const ParsePosition& copy) : UObject(copy), index(copy.index), errorIndex(copy.errorIndex) {} /** * Destructor * @stable ICU 2.0 */ virtual ~ParsePosition(); /** * Assignment operator * @stable ICU 2.0 */ ParsePosition& operator=(const ParsePosition& copy); /** * Equality operator. * @return TRUE if the two parse positions are equal, FALSE otherwise. * @stable ICU 2.0 */ UBool operator==(const ParsePosition& that) const; /** * Equality operator. * @return TRUE if the two parse positions are not equal, FALSE otherwise. * @stable ICU 2.0 */ UBool operator!=(const ParsePosition& that) const; /** * Clone this object. * Clones can be used concurrently in multiple threads. * If an error occurs, then NULL is returned. * The caller must delete the clone. * * @return a clone of this object * * @see getDynamicClassID * @stable ICU 2.8 */ ParsePosition *clone() const; /** * Retrieve the current parse position. On input to a parse method, this * is the index of the character at which parsing will begin; on output, it * is the index of the character following the last character parsed. * @return the current index. * @stable ICU 2.0 */ int32_t getIndex(void) const; /** * Set the current parse position. * @param index the new index. * @stable ICU 2.0 */ void setIndex(int32_t index); /** * Set the index at which a parse error occurred. Formatters * should set this before returning an error code from their * parseObject method. The default value is -1 if this is not * set. * @stable ICU 2.0 */ void setErrorIndex(int32_t ei); /** * Retrieve the index at which an error occurred, or -1 if the * error index has not been set. * @stable ICU 2.0 */ int32_t getErrorIndex(void) const; /** * ICU "poor man's RTTI", returns a UClassID for this class. * * @stable ICU 2.2 */ static UClassID U_EXPORT2 getStaticClassID(); /** * ICU "poor man's RTTI", returns a UClassID for the actual class. * * @stable ICU 2.2 */ virtual UClassID getDynamicClassID() const; private: /** * Input: the place you start parsing. *
Output: position where the parse stopped. * This is designed to be used serially, * with each call setting index up for the next one. */ int32_t index; /** * The index at which a parse error occurred. */ int32_t errorIndex; }; inline ParsePosition& ParsePosition::operator=(const ParsePosition& copy) { index = copy.index; errorIndex = copy.errorIndex; return *this; } inline UBool ParsePosition::operator==(const ParsePosition& copy) const { if(index != copy.index || errorIndex != copy.errorIndex) return FALSE; else return TRUE; } inline UBool ParsePosition::operator!=(const ParsePosition& copy) const { return !operator==(copy); } inline int32_t ParsePosition::getIndex() const { return index; } inline void ParsePosition::setIndex(int32_t offset) { this->index = offset; } inline int32_t ParsePosition::getErrorIndex() const { return errorIndex; } inline void ParsePosition::setErrorIndex(int32_t ei) { this->errorIndex = ei; } U_NAMESPACE_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/docmain.h0000644000015700001700000001375112200324306024535 0ustar pbuserpbgroup00000000000000/******************************************************************** * COPYRIGHT: * Copyright (c) 1997-2010, International Business Machines Corporation and * others. All Rights Reserved. * * FILE NAME: DOCMAIN.h * * Date Name Description * 12/11/2000 Ram Creation. */ /* This file contains documentation for Doxygen and doesnot have * any significance with respect to C or C++ API */ /*! \mainpage * * \section API API Reference Usage * *

C++ Programmers:

*

Use Class Hierarchy or Alphabetical List * or Compound List * to find the class you are interested in. For example, to find BreakIterator, * you can go to the Alphabetical List, then click on * "BreakIterator". Once you are at the class, you will find an inheritance * chart, a list of the public members, a detailed description of the class, * then detailed member descriptions.

* *

C Programmers:

*

Use Module List or File Members * to find a list of all the functions and constants. * For example, to find BreakIterator functions you would click on * File List, * then find "ubrk.h" and click on it. You will find descriptions of Defines, * Typedefs, Enumerations, and Functions, with detailed descriptions below. * If you want to find a specific function, such as ubrk_next(), then click * first on File Members, then use your browser * Find dialog to search for "ubrk_next()".

* * *

API References for Previous Releases

*

The API References for each release of ICU are also available as * a zip file from the ICU * download page.

* *
* *

Architecture (User's Guide)

* * *
*\htmlonly

Module List

\endhtmlonly * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Module NameCC++
Basic Types and Constantsutypes.hutypes.h
Strings and Character Iterationustring.h, utf.hUnicodeString, CharacterIterator
Unicode Character
Properties and Names
uchar.huchar.h C API
Codepage Conversionucnv.hucnv.h C API
Unicode Text Compressionucnv.h
(encoding name "SCSU" or "BOCU-1")
ucnv.h C API
Locales uloc.hLocale
Resource Bundlesures.hResourceBundle
Normalizationunorm.hNormalizer
Calendarsucal.hCalendar
Date and Time Formattingudat.hDateFormat
Message Formattingumsg.hMessageFormat
Number Formattingunum.hNumberFormat
Number Spellout
(Rule Based Number Formatting)
unum.h
(use UNUM_SPELLOUT)
RuleBasedNumberFormat
Text Transformation
(Transliteration)
utrans.hTransliterator
Bidirectional Algorithmubidi.hubidi.h C API
Arabic Shapingushape.hushape.h C API
Collationucol.hCollator
String Searchingusearch.hStringSearch
Text Boundary Analysis
(Break Iteration)
ubrk.hBreakIterator
Unicode Setuset.hUnicodeSet
Regular Expressionsuregex.hRegexPattern, RegexMatcher
StringPrepusprep.husprep.h C API
International Domain Names in Applicationsuidna.huidna.h C API
Identifier Spoofing & Confusabilityuspoof.huspoof.h C API
Universal Time Scaleutmscale.hutmscale.h C API
Basic Layout Engine Types and Constants(no C API)LETypes.h
Complex Text Layout(no C API)LayoutEngine, ParagraphLayout
ICU I/Oustdio.hustream.h
* This main page is generated from docmain.h */ android-audiosystem-1.8+13.10.20130807/include/unicode/normlzr.h0000644000015700001700000007237512200324306024635 0ustar pbuserpbgroup00000000000000/* ******************************************************************** * COPYRIGHT: * Copyright (c) 1996-2010, International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************** */ #ifndef NORMLZR_H #define NORMLZR_H #include "unicode/utypes.h" /** * \file * \brief C++ API: Unicode Normalization */ #if !UCONFIG_NO_NORMALIZATION #include "unicode/chariter.h" #include "unicode/normalizer2.h" #include "unicode/unistr.h" #include "unicode/unorm.h" #include "unicode/uobject.h" U_NAMESPACE_BEGIN /** * The Normalizer class supports the standard normalization forms described in * * Unicode Standard Annex #15: Unicode Normalization Forms. * * Note: This API has been replaced by the Normalizer2 class and is only available * for backward compatibility. This class simply delegates to the Normalizer2 class. * There is one exception: The new API does not provide a replacement for Normalizer::compare(). * * The Normalizer class consists of two parts: * - static functions that normalize strings or test if strings are normalized * - a Normalizer object is an iterator that takes any kind of text and * provides iteration over its normalized form * * The Normalizer class is not suitable for subclassing. * * For basic information about normalization forms and details about the C API * please see the documentation in unorm.h. * * The iterator API with the Normalizer constructors and the non-static functions * use a CharacterIterator as input. It is possible to pass a string which * is then internally wrapped in a CharacterIterator. * The input text is not normalized all at once, but incrementally where needed * (providing efficient random access). * This allows to pass in a large text but spend only a small amount of time * normalizing a small part of that text. * However, if the entire text is normalized, then the iterator will be * slower than normalizing the entire text at once and iterating over the result. * A possible use of the Normalizer iterator is also to report an index into the * original text that is close to where the normalized characters come from. * * Important: The iterator API was cleaned up significantly for ICU 2.0. * The earlier implementation reported the getIndex() inconsistently, * and previous() could not be used after setIndex(), next(), first(), and current(). * * Normalizer allows to start normalizing from anywhere in the input text by * calling setIndexOnly(), first(), or last(). * Without calling any of these, the iterator will start at the beginning of the text. * * At any time, next() returns the next normalized code point (UChar32), * with post-increment semantics (like CharacterIterator::next32PostInc()). * previous() returns the previous normalized code point (UChar32), * with pre-decrement semantics (like CharacterIterator::previous32()). * * current() returns the current code point * (respectively the one at the newly set index) without moving * the getIndex(). Note that if the text at the current position * needs to be normalized, then these functions will do that. * (This is why current() is not const.) * It is more efficient to call setIndexOnly() instead, which does not * normalize. * * getIndex() always refers to the position in the input text where the normalized * code points are returned from. It does not always change with each returned * code point. * The code point that is returned from any of the functions * corresponds to text at or after getIndex(), according to the * function's iteration semantics (post-increment or pre-decrement). * * next() returns a code point from at or after the getIndex() * from before the next() call. After the next() call, the getIndex() * might have moved to where the next code point will be returned from * (from a next() or current() call). * This is semantically equivalent to array access with array[index++] * (post-increment semantics). * * previous() returns a code point from at or after the getIndex() * from after the previous() call. * This is semantically equivalent to array access with array[--index] * (pre-decrement semantics). * * Internally, the Normalizer iterator normalizes a small piece of text * starting at the getIndex() and ending at a following "safe" index. * The normalized results is stored in an internal string buffer, and * the code points are iterated from there. * With multiple iteration calls, this is repeated until the next piece * of text needs to be normalized, and the getIndex() needs to be moved. * * The following "safe" index, the internal buffer, and the secondary * iteration index into that buffer are not exposed on the API. * This also means that it is currently not practical to return to * a particular, arbitrary position in the text because one would need to * know, and be able to set, in addition to the getIndex(), at least also the * current index into the internal buffer. * It is currently only possible to observe when getIndex() changes * (with careful consideration of the iteration semantics), * at which time the internal index will be 0. * For example, if getIndex() is different after next() than before it, * then the internal index is 0 and one can return to this getIndex() * later with setIndexOnly(). * * Note: While the setIndex() and getIndex() refer to indices in the * underlying Unicode input text, the next() and previous() methods * iterate through characters in the normalized output. * This means that there is not necessarily a one-to-one correspondence * between characters returned by next() and previous() and the indices * passed to and returned from setIndex() and getIndex(). * It is for this reason that Normalizer does not implement the CharacterIterator interface. * * @author Laura Werner, Mark Davis, Markus Scherer * @stable ICU 2.0 */ class U_COMMON_API Normalizer : public UObject { public: /** * If DONE is returned from an iteration function that returns a code point, * then there are no more normalization results available. * @stable ICU 2.0 */ enum { DONE=0xffff }; // Constructors /** * Creates a new Normalizer object for iterating over the * normalized form of a given string. *

* @param str The string to be normalized. The normalization * will start at the beginning of the string. * * @param mode The normalization mode. * @stable ICU 2.0 */ Normalizer(const UnicodeString& str, UNormalizationMode mode); /** * Creates a new Normalizer object for iterating over the * normalized form of a given string. *

* @param str The string to be normalized. The normalization * will start at the beginning of the string. * * @param length Length of the string, or -1 if NUL-terminated. * @param mode The normalization mode. * @stable ICU 2.0 */ Normalizer(const UChar* str, int32_t length, UNormalizationMode mode); /** * Creates a new Normalizer object for iterating over the * normalized form of the given text. *

* @param iter The input text to be normalized. The normalization * will start at the beginning of the string. * * @param mode The normalization mode. * @stable ICU 2.0 */ Normalizer(const CharacterIterator& iter, UNormalizationMode mode); /** * Copy constructor. * @param copy The object to be copied. * @stable ICU 2.0 */ Normalizer(const Normalizer& copy); /** * Destructor * @stable ICU 2.0 */ virtual ~Normalizer(); //------------------------------------------------------------------------- // Static utility methods //------------------------------------------------------------------------- /** * Normalizes a UnicodeString according to the specified normalization mode. * This is a wrapper for unorm_normalize(), using UnicodeString's. * * The options parameter specifies which optional * Normalizer features are to be enabled for this operation. * * @param source the input string to be normalized. * @param mode the normalization mode * @param options the optional features to be enabled (0 for no options) * @param result The normalized string (on output). * @param status The error code. * @stable ICU 2.0 */ static void U_EXPORT2 normalize(const UnicodeString& source, UNormalizationMode mode, int32_t options, UnicodeString& result, UErrorCode &status); /** * Compose a UnicodeString. * This is equivalent to normalize() with mode UNORM_NFC or UNORM_NFKC. * This is a wrapper for unorm_normalize(), using UnicodeString's. * * The options parameter specifies which optional * Normalizer features are to be enabled for this operation. * * @param source the string to be composed. * @param compat Perform compatibility decomposition before composition. * If this argument is FALSE, only canonical * decomposition will be performed. * @param options the optional features to be enabled (0 for no options) * @param result The composed string (on output). * @param status The error code. * @stable ICU 2.0 */ static void U_EXPORT2 compose(const UnicodeString& source, UBool compat, int32_t options, UnicodeString& result, UErrorCode &status); /** * Static method to decompose a UnicodeString. * This is equivalent to normalize() with mode UNORM_NFD or UNORM_NFKD. * This is a wrapper for unorm_normalize(), using UnicodeString's. * * The options parameter specifies which optional * Normalizer features are to be enabled for this operation. * * @param source the string to be decomposed. * @param compat Perform compatibility decomposition. * If this argument is FALSE, only canonical * decomposition will be performed. * @param options the optional features to be enabled (0 for no options) * @param result The decomposed string (on output). * @param status The error code. * @stable ICU 2.0 */ static void U_EXPORT2 decompose(const UnicodeString& source, UBool compat, int32_t options, UnicodeString& result, UErrorCode &status); /** * Performing quick check on a string, to quickly determine if the string is * in a particular normalization format. * This is a wrapper for unorm_quickCheck(), using a UnicodeString. * * Three types of result can be returned UNORM_YES, UNORM_NO or * UNORM_MAYBE. Result UNORM_YES indicates that the argument * string is in the desired normalized format, UNORM_NO determines that * argument string is not in the desired normalized format. A * UNORM_MAYBE result indicates that a more thorough check is required, * the user may have to put the string in its normalized form and compare the * results. * @param source string for determining if it is in a normalized format * @param mode normalization format * @param status A reference to a UErrorCode to receive any errors * @return UNORM_YES, UNORM_NO or UNORM_MAYBE * * @see isNormalized * @stable ICU 2.0 */ static inline UNormalizationCheckResult quickCheck(const UnicodeString &source, UNormalizationMode mode, UErrorCode &status); /** * Performing quick check on a string; same as the other version of quickCheck * but takes an extra options parameter like most normalization functions. * * @param source string for determining if it is in a normalized format * @param mode normalization format * @param options the optional features to be enabled (0 for no options) * @param status A reference to a UErrorCode to receive any errors * @return UNORM_YES, UNORM_NO or UNORM_MAYBE * * @see isNormalized * @stable ICU 2.6 */ static UNormalizationCheckResult quickCheck(const UnicodeString &source, UNormalizationMode mode, int32_t options, UErrorCode &status); /** * Test if a string is in a given normalization form. * This is semantically equivalent to source.equals(normalize(source, mode)) . * * Unlike unorm_quickCheck(), this function returns a definitive result, * never a "maybe". * For NFD, NFKD, and FCD, both functions work exactly the same. * For NFC and NFKC where quickCheck may return "maybe", this function will * perform further tests to arrive at a TRUE/FALSE result. * * @param src String that is to be tested if it is in a normalization format. * @param mode Which normalization form to test for. * @param errorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return Boolean value indicating whether the source string is in the * "mode" normalization form. * * @see quickCheck * @stable ICU 2.2 */ static inline UBool isNormalized(const UnicodeString &src, UNormalizationMode mode, UErrorCode &errorCode); /** * Test if a string is in a given normalization form; same as the other version of isNormalized * but takes an extra options parameter like most normalization functions. * * @param src String that is to be tested if it is in a normalization format. * @param mode Which normalization form to test for. * @param options the optional features to be enabled (0 for no options) * @param errorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return Boolean value indicating whether the source string is in the * "mode" normalization form. * * @see quickCheck * @stable ICU 2.6 */ static UBool isNormalized(const UnicodeString &src, UNormalizationMode mode, int32_t options, UErrorCode &errorCode); /** * Concatenate normalized strings, making sure that the result is normalized as well. * * If both the left and the right strings are in * the normalization form according to "mode/options", * then the result will be * * \code * dest=normalize(left+right, mode, options) * \endcode * * For details see unorm_concatenate in unorm.h. * * @param left Left source string. * @param right Right source string. * @param result The output string. * @param mode The normalization mode. * @param options A bit set of normalization options. * @param errorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return result * * @see unorm_concatenate * @see normalize * @see unorm_next * @see unorm_previous * * @stable ICU 2.1 */ static UnicodeString & U_EXPORT2 concatenate(UnicodeString &left, UnicodeString &right, UnicodeString &result, UNormalizationMode mode, int32_t options, UErrorCode &errorCode); /** * Compare two strings for canonical equivalence. * Further options include case-insensitive comparison and * code point order (as opposed to code unit order). * * Canonical equivalence between two strings is defined as their normalized * forms (NFD or NFC) being identical. * This function compares strings incrementally instead of normalizing * (and optionally case-folding) both strings entirely, * improving performance significantly. * * Bulk normalization is only necessary if the strings do not fulfill the FCD * conditions. Only in this case, and only if the strings are relatively long, * is memory allocated temporarily. * For FCD strings and short non-FCD strings there is no memory allocation. * * Semantically, this is equivalent to * strcmp[CodePointOrder](NFD(foldCase(s1)), NFD(foldCase(s2))) * where code point order and foldCase are all optional. * * UAX 21 2.5 Caseless Matching specifies that for a canonical caseless match * the case folding must be performed first, then the normalization. * * @param s1 First source string. * @param s2 Second source string. * * @param options A bit set of options: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: * Case-sensitive comparison in code unit order, and the input strings * are quick-checked for FCD. * * - UNORM_INPUT_IS_FCD * Set if the caller knows that both s1 and s2 fulfill the FCD conditions. * If not set, the function will quickCheck for FCD * and normalize if necessary. * * - U_COMPARE_CODE_POINT_ORDER * Set to choose code point order instead of code unit order * (see u_strCompare for details). * * - U_COMPARE_IGNORE_CASE * Set to compare strings case-insensitively using case folding, * instead of case-sensitively. * If set, then the following case folding options are used. * * - Options as used with case-insensitive comparisons, currently: * * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * (see u_strCaseCompare for details) * * - regular normalization options shifted left by UNORM_COMPARE_NORM_OPTIONS_SHIFT * * @param errorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return <0 or 0 or >0 as usual for string comparisons * * @see unorm_compare * @see normalize * @see UNORM_FCD * @see u_strCompare * @see u_strCaseCompare * * @stable ICU 2.2 */ static inline int32_t compare(const UnicodeString &s1, const UnicodeString &s2, uint32_t options, UErrorCode &errorCode); //------------------------------------------------------------------------- // Iteration API //------------------------------------------------------------------------- /** * Return the current character in the normalized text. * current() may need to normalize some text at getIndex(). * The getIndex() is not changed. * * @return the current normalized code point * @stable ICU 2.0 */ UChar32 current(void); /** * Return the first character in the normalized text. * This is equivalent to setIndexOnly(startIndex()) followed by next(). * (Post-increment semantics.) * * @return the first normalized code point * @stable ICU 2.0 */ UChar32 first(void); /** * Return the last character in the normalized text. * This is equivalent to setIndexOnly(endIndex()) followed by previous(). * (Pre-decrement semantics.) * * @return the last normalized code point * @stable ICU 2.0 */ UChar32 last(void); /** * Return the next character in the normalized text. * (Post-increment semantics.) * If the end of the text has already been reached, DONE is returned. * The DONE value could be confused with a U+FFFF non-character code point * in the text. If this is possible, you can test getIndex()startIndex() || first()!=DONE). (Calling first() will change * the iterator state!) * * The C API unorm_previous() is more efficient and does not have this ambiguity. * * @return the previous normalized code point * @stable ICU 2.0 */ UChar32 previous(void); /** * Set the iteration position in the input text that is being normalized, * without any immediate normalization. * After setIndexOnly(), getIndex() will return the same index that is * specified here. * * @param index the desired index in the input text. * @stable ICU 2.0 */ void setIndexOnly(int32_t index); /** * Reset the index to the beginning of the text. * This is equivalent to setIndexOnly(startIndex)). * @stable ICU 2.0 */ void reset(void); /** * Retrieve the current iteration position in the input text that is * being normalized. * * A following call to next() will return a normalized code point from * the input text at or after this index. * * After a call to previous(), getIndex() will point at or before the * position in the input text where the normalized code point * was returned from with previous(). * * @return the current index in the input text * @stable ICU 2.0 */ int32_t getIndex(void) const; /** * Retrieve the index of the start of the input text. This is the begin index * of the CharacterIterator or the start (i.e. index 0) of the string * over which this Normalizer is iterating. * * @return the smallest index in the input text where the Normalizer operates * @stable ICU 2.0 */ int32_t startIndex(void) const; /** * Retrieve the index of the end of the input text. This is the end index * of the CharacterIterator or the length of the string * over which this Normalizer is iterating. * This end index is exclusive, i.e., the Normalizer operates only on characters * before this index. * * @return the first index in the input text where the Normalizer does not operate * @stable ICU 2.0 */ int32_t endIndex(void) const; /** * Returns TRUE when both iterators refer to the same character in the same * input text. * * @param that a Normalizer object to compare this one to * @return comparison result * @stable ICU 2.0 */ UBool operator==(const Normalizer& that) const; /** * Returns FALSE when both iterators refer to the same character in the same * input text. * * @param that a Normalizer object to compare this one to * @return comparison result * @stable ICU 2.0 */ inline UBool operator!=(const Normalizer& that) const; /** * Returns a pointer to a new Normalizer that is a clone of this one. * The caller is responsible for deleting the new clone. * @return a pointer to a new Normalizer * @stable ICU 2.0 */ Normalizer* clone(void) const; /** * Generates a hash code for this iterator. * * @return the hash code * @stable ICU 2.0 */ int32_t hashCode(void) const; //------------------------------------------------------------------------- // Property access methods //------------------------------------------------------------------------- /** * Set the normalization mode for this object. *

* Note:If the normalization mode is changed while iterating * over a string, calls to {@link #next() } and {@link #previous() } may * return previously buffers characters in the old normalization mode * until the iteration is able to re-sync at the next base character. * It is safest to call {@link #setIndexOnly }, {@link #reset() }, * {@link #setText }, {@link #first() }, * {@link #last() }, etc. after calling setMode. *

* @param newMode the new mode for this Normalizer. * @see #getUMode * @stable ICU 2.0 */ void setMode(UNormalizationMode newMode); /** * Return the normalization mode for this object. * * This is an unusual name because there used to be a getMode() that * returned a different type. * * @return the mode for this Normalizer * @see #setMode * @stable ICU 2.0 */ UNormalizationMode getUMode(void) const; /** * Set options that affect this Normalizer's operation. * Options do not change the basic composition or decomposition operation * that is being performed, but they control whether * certain optional portions of the operation are done. * Currently the only available option is obsolete. * * It is possible to specify multiple options that are all turned on or off. * * @param option the option(s) whose value is/are to be set. * @param value the new setting for the option. Use TRUE to * turn the option(s) on and FALSE to turn it/them off. * * @see #getOption * @stable ICU 2.0 */ void setOption(int32_t option, UBool value); /** * Determine whether an option is turned on or off. * If multiple options are specified, then the result is TRUE if any * of them are set. *

* @param option the option(s) that are to be checked * @return TRUE if any of the option(s) are set * @see #setOption * @stable ICU 2.0 */ UBool getOption(int32_t option) const; /** * Set the input text over which this Normalizer will iterate. * The iteration position is set to the beginning. * * @param newText a string that replaces the current input text * @param status a UErrorCode * @stable ICU 2.0 */ void setText(const UnicodeString& newText, UErrorCode &status); /** * Set the input text over which this Normalizer will iterate. * The iteration position is set to the beginning. * * @param newText a CharacterIterator object that replaces the current input text * @param status a UErrorCode * @stable ICU 2.0 */ void setText(const CharacterIterator& newText, UErrorCode &status); /** * Set the input text over which this Normalizer will iterate. * The iteration position is set to the beginning. * * @param newText a string that replaces the current input text * @param length the length of the string, or -1 if NUL-terminated * @param status a UErrorCode * @stable ICU 2.0 */ void setText(const UChar* newText, int32_t length, UErrorCode &status); /** * Copies the input text into the UnicodeString argument. * * @param result Receives a copy of the text under iteration. * @stable ICU 2.0 */ void getText(UnicodeString& result); /** * ICU "poor man's RTTI", returns a UClassID for this class. * @returns a UClassID for this class. * @stable ICU 2.2 */ static UClassID U_EXPORT2 getStaticClassID(); /** * ICU "poor man's RTTI", returns a UClassID for the actual class. * @return a UClassID for the actual class. * @stable ICU 2.2 */ virtual UClassID getDynamicClassID() const; private: //------------------------------------------------------------------------- // Private functions //------------------------------------------------------------------------- Normalizer(); // default constructor not implemented Normalizer &operator=(const Normalizer &that); // assignment operator not implemented // Private utility methods for iteration // For documentation, see the source code UBool nextNormalize(); UBool previousNormalize(); void init(); void clearBuffer(void); //------------------------------------------------------------------------- // Private data //------------------------------------------------------------------------- FilteredNormalizer2*fFilteredNorm2; // owned if not NULL const Normalizer2 *fNorm2; // not owned; may be equal to fFilteredNorm2 UNormalizationMode fUMode; int32_t fOptions; // The input text and our position in it CharacterIterator *text; // The normalization buffer is the result of normalization // of the source in [currentIndex..nextIndex[ . int32_t currentIndex, nextIndex; // A buffer for holding intermediate results UnicodeString buffer; int32_t bufferPos; }; //------------------------------------------------------------------------- // Inline implementations //------------------------------------------------------------------------- inline UBool Normalizer::operator!= (const Normalizer& other) const { return ! operator==(other); } inline UNormalizationCheckResult Normalizer::quickCheck(const UnicodeString& source, UNormalizationMode mode, UErrorCode &status) { return quickCheck(source, mode, 0, status); } inline UBool Normalizer::isNormalized(const UnicodeString& source, UNormalizationMode mode, UErrorCode &status) { return isNormalized(source, mode, 0, status); } inline int32_t Normalizer::compare(const UnicodeString &s1, const UnicodeString &s2, uint32_t options, UErrorCode &errorCode) { // all argument checking is done in unorm_compare return unorm_compare(s1.getBuffer(), s1.length(), s2.getBuffer(), s2.length(), options, &errorCode); } U_NAMESPACE_END #endif /* #if !UCONFIG_NO_NORMALIZATION */ #endif // NORMLZR_H android-audiosystem-1.8+13.10.20130807/include/unicode/stringpiece.h0000644000015700001700000001454612200324306025442 0ustar pbuserpbgroup00000000000000// Copyright (C) 2010, International Business Machines // Corporation and others. All Rights Reserved. // // Copyright 2001 and onwards Google Inc. // Author: Sanjay Ghemawat // This code is a contribution of Google code, and the style used here is // a compromise between the original Google code and the ICU coding guidelines. // For example, data types are ICU-ified (size_t,int->int32_t), // and API comments doxygen-ified, but function names and behavior are // as in the original, if possible. // Assertion-style error handling, not available in ICU, was changed to // parameter "pinning" similar to UnicodeString. // // In addition, this is only a partial port of the original Google code, // limited to what was needed so far. The (nearly) complete original code // is in the ICU svn repository at icuhtml/trunk/design/strings/contrib // (see ICU ticket 6765, r25517). #ifndef __STRINGPIECE_H__ #define __STRINGPIECE_H__ /** * \file * \brief C++ API: StringPiece: Read-only byte string wrapper class. */ #include "unicode/utypes.h" #include "unicode/uobject.h" #include "unicode/std_string.h" // Arghh! I wish C++ literals were "string". U_NAMESPACE_BEGIN /** * A string-like object that points to a sized piece of memory. * * We provide non-explicit singleton constructors so users can pass * in a "const char*" or a "string" wherever a "StringPiece" is * expected. * * Functions or methods may use const StringPiece& parameters to accept either * a "const char*" or a "string" value that will be implicitly converted to * a StringPiece. * * Systematic usage of StringPiece is encouraged as it will reduce unnecessary * conversions from "const char*" to "string" and back again. * * @stable ICU 4.2 */ class U_COMMON_API StringPiece : public UMemory { private: const char* ptr_; int32_t length_; public: /** * Default constructor, creates an empty StringPiece. * @stable ICU 4.2 */ StringPiece() : ptr_(NULL), length_(0) { } /** * Constructs from a NUL-terminated const char * pointer. * @param str a NUL-terminated const char * pointer * @stable ICU 4.2 */ StringPiece(const char* str); #if U_HAVE_STD_STRING /** * Constructs from a std::string. * @stable ICU 4.2 */ StringPiece(const U_STD_NSQ string& str) : ptr_(str.data()), length_(static_cast(str.size())) { } #endif /** * Constructs from a const char * pointer and a specified length. * @param offset a const char * pointer (need not be terminated) * @param len the length of the string; must be non-negative * @stable ICU 4.2 */ StringPiece(const char* offset, int32_t len) : ptr_(offset), length_(len) { } /** * Substring of another StringPiece. * @param x the other StringPiece * @param pos start position in x; must be non-negative and <= x.length(). * @stable ICU 4.2 */ StringPiece(const StringPiece& x, int32_t pos); /** * Substring of another StringPiece. * @param x the other StringPiece * @param pos start position in x; must be non-negative and <= x.length(). * @param len length of the substring; * must be non-negative and will be pinned to at most x.length() - pos. * @stable ICU 4.2 */ StringPiece(const StringPiece& x, int32_t pos, int32_t len); /** * Returns the string pointer. May be NULL if it is empty. * * data() may return a pointer to a buffer with embedded NULs, and the * returned buffer may or may not be null terminated. Therefore it is * typically a mistake to pass data() to a routine that expects a NUL * terminated string. * @return the string pointer * @stable ICU 4.2 */ const char* data() const { return ptr_; } /** * Returns the string length. Same as length(). * @return the string length * @stable ICU 4.2 */ int32_t size() const { return length_; } /** * Returns the string length. Same as size(). * @return the string length * @stable ICU 4.2 */ int32_t length() const { return length_; } /** * Returns whether the string is empty. * @return TRUE if the string is empty * @stable ICU 4.2 */ UBool empty() const { return length_ == 0; } /** * Sets to an empty string. * @stable ICU 4.2 */ void clear() { ptr_ = NULL; length_ = 0; } /** * Reset the stringpiece to refer to new data. * @param data pointer the new string data. Need not be nul terminated. * @param len the length of the new data * @internal */ void set(const char* data, int32_t len) { ptr_ = data; length_ = len; } /** * Reset the stringpiece to refer to new data. * @param str a pointer to a NUL-terminated string. * @internal */ void set(const char* str); /** * Removes the first n string units. * @param n prefix length, must be non-negative and <=length() * @stable ICU 4.2 */ void remove_prefix(int32_t n) { if (n >= 0) { if (n > length_) { n = length_; } ptr_ += n; length_ -= n; } } /** * Removes the last n string units. * @param n suffix length, must be non-negative and <=length() * @stable ICU 4.2 */ void remove_suffix(int32_t n) { if (n >= 0) { if (n <= length_) { length_ -= n; } else { length_ = 0; } } } /** * Maximum integer, used as a default value for substring methods. * @stable ICU 4.2 */ static const int32_t npos = 0x7fffffff; /** * Returns a substring of this StringPiece. * @param pos start position; must be non-negative and <= length(). * @param len length of the substring; * must be non-negative and will be pinned to at most length() - pos. * @return the substring StringPiece * @stable ICU 4.2 */ StringPiece substr(int32_t pos, int32_t len = npos) const { return StringPiece(*this, pos, len); } }; /** * Global operator == for StringPiece * @param x The first StringPiece to compare. * @param y The second StringPiece to compare. * @return TRUE if the string data is equal * @internal */ U_EXPORT UBool U_EXPORT2 operator==(const StringPiece& x, const StringPiece& y); /** * Global operator != for StringPiece * @param x The first StringPiece to compare. * @param y The second StringPiece to compare. * @return TRUE if the string data is not equal * @internal */ inline UBool operator!=(const StringPiece& x, const StringPiece& y) { return !(x == y); } U_NAMESPACE_END #endif // __STRINGPIECE_H__ android-audiosystem-1.8+13.10.20130807/include/unicode/unorm.h0000644000015700001700000005561712200324306024272 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * Copyright (c) 1996-2010, International Business Machines Corporation * and others. All Rights Reserved. ******************************************************************************* * File unorm.h * * Created by: Vladimir Weinstein 12052000 * * Modification history : * * Date Name Description * 02/01/01 synwee Added normalization quickcheck enum and method. */ #ifndef UNORM_H #define UNORM_H #include "unicode/utypes.h" #if !UCONFIG_NO_NORMALIZATION #include "unicode/uiter.h" #include "unicode/unorm2.h" /** * \file * \brief C API: Unicode Normalization * *

Unicode normalization API

* * Note: This API has been replaced by the unorm2.h API and is only available * for backward compatibility. The functions here simply delegate to the * unorm2.h functions, for example unorm2_getInstance() and unorm2_normalize(). * There is one exception: The new API does not provide a replacement for unorm_compare(). * * unorm_normalize transforms Unicode text into an equivalent composed or * decomposed form, allowing for easier sorting and searching of text. * unorm_normalize supports the standard normalization forms described in * * Unicode Standard Annex #15: Unicode Normalization Forms. * * Characters with accents or other adornments can be encoded in * several different ways in Unicode. For example, take the character A-acute. * In Unicode, this can be encoded as a single character (the * "composed" form): * * \code * 00C1 LATIN CAPITAL LETTER A WITH ACUTE * \endcode * * or as two separate characters (the "decomposed" form): * * \code * 0041 LATIN CAPITAL LETTER A * 0301 COMBINING ACUTE ACCENT * \endcode * * To a user of your program, however, both of these sequences should be * treated as the same "user-level" character "A with acute accent". When you are searching or * comparing text, you must ensure that these two sequences are treated * equivalently. In addition, you must handle characters with more than one * accent. Sometimes the order of a character's combining accents is * significant, while in other cases accent sequences in different orders are * really equivalent. * * Similarly, the string "ffi" can be encoded as three separate letters: * * \code * 0066 LATIN SMALL LETTER F * 0066 LATIN SMALL LETTER F * 0069 LATIN SMALL LETTER I * \endcode * * or as the single character * * \code * FB03 LATIN SMALL LIGATURE FFI * \endcode * * The ffi ligature is not a distinct semantic character, and strictly speaking * it shouldn't be in Unicode at all, but it was included for compatibility * with existing character sets that already provided it. The Unicode standard * identifies such characters by giving them "compatibility" decompositions * into the corresponding semantic characters. When sorting and searching, you * will often want to use these mappings. * * unorm_normalize helps solve these problems by transforming text into the * canonical composed and decomposed forms as shown in the first example above. * In addition, you can have it perform compatibility decompositions so that * you can treat compatibility characters the same as their equivalents. * Finally, unorm_normalize rearranges accents into the proper canonical * order, so that you do not have to worry about accent rearrangement on your * own. * * Form FCD, "Fast C or D", is also designed for collation. * It allows to work on strings that are not necessarily normalized * with an algorithm (like in collation) that works under "canonical closure", i.e., it treats precomposed * characters and their decomposed equivalents the same. * * It is not a normalization form because it does not provide for uniqueness of representation. Multiple strings * may be canonically equivalent (their NFDs are identical) and may all conform to FCD without being identical * themselves. * * The form is defined such that the "raw decomposition", the recursive canonical decomposition of each character, * results in a string that is canonically ordered. This means that precomposed characters are allowed for as long * as their decompositions do not need canonical reordering. * * Its advantage for a process like collation is that all NFD and most NFC texts - and many unnormalized texts - * already conform to FCD and do not need to be normalized (NFD) for such a process. The FCD quick check will * return UNORM_YES for most strings in practice. * * unorm_normalize(UNORM_FCD) may be implemented with UNORM_NFD. * * For more details on FCD see the collation design document: * http://source.icu-project.org/repos/icu/icuhtml/trunk/design/collation/ICU_collation_design.htm * * ICU collation performs either NFD or FCD normalization automatically if normalization * is turned on for the collator object. * Beyond collation and string search, normalized strings may be useful for string equivalence comparisons, * transliteration/transcription, unique representations, etc. * * The W3C generally recommends to exchange texts in NFC. * Note also that most legacy character encodings use only precomposed forms and often do not * encode any combining marks by themselves. For conversion to such character encodings the * Unicode text needs to be normalized to NFC. * For more usage examples, see the Unicode Standard Annex. */ /** * Constants for normalization modes. * @stable ICU 2.0 */ typedef enum { /** No decomposition/composition. @stable ICU 2.0 */ UNORM_NONE = 1, /** Canonical decomposition. @stable ICU 2.0 */ UNORM_NFD = 2, /** Compatibility decomposition. @stable ICU 2.0 */ UNORM_NFKD = 3, /** Canonical decomposition followed by canonical composition. @stable ICU 2.0 */ UNORM_NFC = 4, /** Default normalization. @stable ICU 2.0 */ UNORM_DEFAULT = UNORM_NFC, /** Compatibility decomposition followed by canonical composition. @stable ICU 2.0 */ UNORM_NFKC =5, /** "Fast C or D" form. @stable ICU 2.0 */ UNORM_FCD = 6, /** One more than the highest normalization mode constant. @stable ICU 2.0 */ UNORM_MODE_COUNT } UNormalizationMode; /** * Constants for options flags for normalization. * Use 0 for default options, * including normalization according to the Unicode version * that is currently supported by ICU (see u_getUnicodeVersion). * @stable ICU 2.6 */ enum { /** * Options bit set value to select Unicode 3.2 normalization * (except NormalizationCorrections). * At most one Unicode version can be selected at a time. * @stable ICU 2.6 */ UNORM_UNICODE_3_2=0x20 }; /** * Lowest-order bit number of unorm_compare() options bits corresponding to * normalization options bits. * * The options parameter for unorm_compare() uses most bits for * itself and for various comparison and folding flags. * The most significant bits, however, are shifted down and passed on * to the normalization implementation. * (That is, from unorm_compare(..., options, ...), * options>>UNORM_COMPARE_NORM_OPTIONS_SHIFT will be passed on to the * internal normalization functions.) * * @see unorm_compare * @stable ICU 2.6 */ #define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20 /** * Normalize a string. * The string will be normalized according the specified normalization mode * and options. * The source and result buffers must not be the same, nor overlap. * * @param source The string to normalize. * @param sourceLength The length of source, or -1 if NUL-terminated. * @param mode The normalization mode; one of UNORM_NONE, * UNORM_NFD, UNORM_NFC, UNORM_NFKC, UNORM_NFKD, UNORM_DEFAULT. * @param options The normalization options, ORed together (0 for no options). * @param result A pointer to a buffer to receive the result string. * The result string is NUL-terminated if possible. * @param resultLength The maximum size of result. * @param status A pointer to a UErrorCode to receive any errors. * @return The total buffer size needed; if greater than resultLength, * the output was truncated, and the error code is set to U_BUFFER_OVERFLOW_ERROR. * @stable ICU 2.0 */ U_STABLE int32_t U_EXPORT2 unorm_normalize(const UChar *source, int32_t sourceLength, UNormalizationMode mode, int32_t options, UChar *result, int32_t resultLength, UErrorCode *status); /** * Performing quick check on a string, to quickly determine if the string is * in a particular normalization format. * Three types of result can be returned UNORM_YES, UNORM_NO or * UNORM_MAYBE. Result UNORM_YES indicates that the argument * string is in the desired normalized format, UNORM_NO determines that * argument string is not in the desired normalized format. A * UNORM_MAYBE result indicates that a more thorough check is required, * the user may have to put the string in its normalized form and compare the * results. * * @param source string for determining if it is in a normalized format * @param sourcelength length of source to test, or -1 if NUL-terminated * @param mode which normalization form to test for * @param status a pointer to a UErrorCode to receive any errors * @return UNORM_YES, UNORM_NO or UNORM_MAYBE * * @see unorm_isNormalized * @stable ICU 2.0 */ U_STABLE UNormalizationCheckResult U_EXPORT2 unorm_quickCheck(const UChar *source, int32_t sourcelength, UNormalizationMode mode, UErrorCode *status); /** * Performing quick check on a string; same as unorm_quickCheck but * takes an extra options parameter like most normalization functions. * * @param src String that is to be tested if it is in a normalization format. * @param srcLength Length of source to test, or -1 if NUL-terminated. * @param mode Which normalization form to test for. * @param options The normalization options, ORed together (0 for no options). * @param pErrorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return UNORM_YES, UNORM_NO or UNORM_MAYBE * * @see unorm_quickCheck * @see unorm_isNormalized * @stable ICU 2.6 */ U_STABLE UNormalizationCheckResult U_EXPORT2 unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength, UNormalizationMode mode, int32_t options, UErrorCode *pErrorCode); /** * Test if a string is in a given normalization form. * This is semantically equivalent to source.equals(normalize(source, mode)) . * * Unlike unorm_quickCheck(), this function returns a definitive result, * never a "maybe". * For NFD, NFKD, and FCD, both functions work exactly the same. * For NFC and NFKC where quickCheck may return "maybe", this function will * perform further tests to arrive at a TRUE/FALSE result. * * @param src String that is to be tested if it is in a normalization format. * @param srcLength Length of source to test, or -1 if NUL-terminated. * @param mode Which normalization form to test for. * @param pErrorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return Boolean value indicating whether the source string is in the * "mode" normalization form. * * @see unorm_quickCheck * @stable ICU 2.2 */ U_STABLE UBool U_EXPORT2 unorm_isNormalized(const UChar *src, int32_t srcLength, UNormalizationMode mode, UErrorCode *pErrorCode); /** * Test if a string is in a given normalization form; same as unorm_isNormalized but * takes an extra options parameter like most normalization functions. * * @param src String that is to be tested if it is in a normalization format. * @param srcLength Length of source to test, or -1 if NUL-terminated. * @param mode Which normalization form to test for. * @param options The normalization options, ORed together (0 for no options). * @param pErrorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return Boolean value indicating whether the source string is in the * "mode/options" normalization form. * * @see unorm_quickCheck * @see unorm_isNormalized * @stable ICU 2.6 */ U_STABLE UBool U_EXPORT2 unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength, UNormalizationMode mode, int32_t options, UErrorCode *pErrorCode); /** * Iterative normalization forward. * This function (together with unorm_previous) is somewhat * similar to the C++ Normalizer class (see its non-static functions). * * Iterative normalization is useful when only a small portion of a longer * string/text needs to be processed. * * For example, the likelihood may be high that processing the first 10% of some * text will be sufficient to find certain data. * Another example: When one wants to concatenate two normalized strings and get a * normalized result, it is much more efficient to normalize just a small part of * the result around the concatenation place instead of re-normalizing everything. * * The input text is an instance of the C character iteration API UCharIterator. * It may wrap around a simple string, a CharacterIterator, a Replaceable, or any * other kind of text object. * * If a buffer overflow occurs, then the caller needs to reset the iterator to the * old index and call the function again with a larger buffer - if the caller cares * for the actual output. * Regardless of the output buffer, the iterator will always be moved to the next * normalization boundary. * * This function (like unorm_previous) serves two purposes: * * 1) To find the next boundary so that the normalization of the part of the text * from the current position to that boundary does not affect and is not affected * by the part of the text beyond that boundary. * * 2) To normalize the text up to the boundary. * * The second step is optional, per the doNormalize parameter. * It is omitted for operations like string concatenation, where the two adjacent * string ends need to be normalized together. * In such a case, the output buffer will just contain a copy of the text up to the * boundary. * * pNeededToNormalize is an output-only parameter. Its output value is only defined * if normalization was requested (doNormalize) and successful (especially, no * buffer overflow). * It is useful for operations like a normalizing transliterator, where one would * not want to replace a piece of text if it is not modified. * * If doNormalize==TRUE and pNeededToNormalize!=NULL then *pNeeded... is set TRUE * if the normalization was necessary. * * If doNormalize==FALSE then *pNeededToNormalize will be set to FALSE. * * If the buffer overflows, then *pNeededToNormalize will be undefined; * essentially, whenever U_FAILURE is true (like in buffer overflows), this result * will be undefined. * * @param src The input text in the form of a C character iterator. * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting. * @param destCapacity The number of UChars that fit into dest. * @param mode The normalization mode. * @param options The normalization options, ORed together (0 for no options). * @param doNormalize Indicates if the source text up to the next boundary * is to be normalized (TRUE) or just copied (FALSE). * @param pNeededToNormalize Output flag indicating if the normalization resulted in * different text from the input. * Not defined if an error occurs including buffer overflow. * Always FALSE if !doNormalize. * @param pErrorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return Length of output (number of UChars) when successful or buffer overflow. * * @see unorm_previous * @see unorm_normalize * * @stable ICU 2.1 */ U_STABLE int32_t U_EXPORT2 unorm_next(UCharIterator *src, UChar *dest, int32_t destCapacity, UNormalizationMode mode, int32_t options, UBool doNormalize, UBool *pNeededToNormalize, UErrorCode *pErrorCode); /** * Iterative normalization backward. * This function (together with unorm_next) is somewhat * similar to the C++ Normalizer class (see its non-static functions). * For all details see unorm_next. * * @param src The input text in the form of a C character iterator. * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting. * @param destCapacity The number of UChars that fit into dest. * @param mode The normalization mode. * @param options The normalization options, ORed together (0 for no options). * @param doNormalize Indicates if the source text up to the next boundary * is to be normalized (TRUE) or just copied (FALSE). * @param pNeededToNormalize Output flag indicating if the normalization resulted in * different text from the input. * Not defined if an error occurs including buffer overflow. * Always FALSE if !doNormalize. * @param pErrorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return Length of output (number of UChars) when successful or buffer overflow. * * @see unorm_next * @see unorm_normalize * * @stable ICU 2.1 */ U_STABLE int32_t U_EXPORT2 unorm_previous(UCharIterator *src, UChar *dest, int32_t destCapacity, UNormalizationMode mode, int32_t options, UBool doNormalize, UBool *pNeededToNormalize, UErrorCode *pErrorCode); /** * Concatenate normalized strings, making sure that the result is normalized as well. * * If both the left and the right strings are in * the normalization form according to "mode/options", * then the result will be * * \code * dest=normalize(left+right, mode, options) * \endcode * * With the input strings already being normalized, * this function will use unorm_next() and unorm_previous() * to find the adjacent end pieces of the input strings. * Only the concatenation of these end pieces will be normalized and * then concatenated with the remaining parts of the input strings. * * It is allowed to have dest==left to avoid copying the entire left string. * * @param left Left source string, may be same as dest. * @param leftLength Length of left source string, or -1 if NUL-terminated. * @param right Right source string. Must not be the same as dest, nor overlap. * @param rightLength Length of right source string, or -1 if NUL-terminated. * @param dest The output buffer; can be NULL if destCapacity==0 for pure preflighting. * @param destCapacity The number of UChars that fit into dest. * @param mode The normalization mode. * @param options The normalization options, ORed together (0 for no options). * @param pErrorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return Length of output (number of UChars) when successful or buffer overflow. * * @see unorm_normalize * @see unorm_next * @see unorm_previous * * @stable ICU 2.1 */ U_STABLE int32_t U_EXPORT2 unorm_concatenate(const UChar *left, int32_t leftLength, const UChar *right, int32_t rightLength, UChar *dest, int32_t destCapacity, UNormalizationMode mode, int32_t options, UErrorCode *pErrorCode); /** * Option bit for unorm_compare: * Both input strings are assumed to fulfill FCD conditions. * @stable ICU 2.2 */ #define UNORM_INPUT_IS_FCD 0x20000 /** * Option bit for unorm_compare: * Perform case-insensitive comparison. * @stable ICU 2.2 */ #define U_COMPARE_IGNORE_CASE 0x10000 #ifndef U_COMPARE_CODE_POINT_ORDER /* see also unistr.h and ustring.h */ /** * Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc: * Compare strings in code point order instead of code unit order. * @stable ICU 2.2 */ #define U_COMPARE_CODE_POINT_ORDER 0x8000 #endif /** * Compare two strings for canonical equivalence. * Further options include case-insensitive comparison and * code point order (as opposed to code unit order). * * Canonical equivalence between two strings is defined as their normalized * forms (NFD or NFC) being identical. * This function compares strings incrementally instead of normalizing * (and optionally case-folding) both strings entirely, * improving performance significantly. * * Bulk normalization is only necessary if the strings do not fulfill the FCD * conditions. Only in this case, and only if the strings are relatively long, * is memory allocated temporarily. * For FCD strings and short non-FCD strings there is no memory allocation. * * Semantically, this is equivalent to * strcmp[CodePointOrder](NFD(foldCase(NFD(s1))), NFD(foldCase(NFD(s2)))) * where code point order and foldCase are all optional. * * UAX 21 2.5 Caseless Matching specifies that for a canonical caseless match * the case folding must be performed first, then the normalization. * * @param s1 First source string. * @param length1 Length of first source string, or -1 if NUL-terminated. * * @param s2 Second source string. * @param length2 Length of second source string, or -1 if NUL-terminated. * * @param options A bit set of options: * - U_FOLD_CASE_DEFAULT or 0 is used for default options: * Case-sensitive comparison in code unit order, and the input strings * are quick-checked for FCD. * * - UNORM_INPUT_IS_FCD * Set if the caller knows that both s1 and s2 fulfill the FCD conditions. * If not set, the function will quickCheck for FCD * and normalize if necessary. * * - U_COMPARE_CODE_POINT_ORDER * Set to choose code point order instead of code unit order * (see u_strCompare for details). * * - U_COMPARE_IGNORE_CASE * Set to compare strings case-insensitively using case folding, * instead of case-sensitively. * If set, then the following case folding options are used. * * - Options as used with case-insensitive comparisons, currently: * * - U_FOLD_CASE_EXCLUDE_SPECIAL_I * (see u_strCaseCompare for details) * * - regular normalization options shifted left by UNORM_COMPARE_NORM_OPTIONS_SHIFT * * @param pErrorCode ICU error code in/out parameter. * Must fulfill U_SUCCESS before the function call. * @return <0 or 0 or >0 as usual for string comparisons * * @see unorm_normalize * @see UNORM_FCD * @see u_strCompare * @see u_strCaseCompare * * @stable ICU 2.2 */ U_STABLE int32_t U_EXPORT2 unorm_compare(const UChar *s1, int32_t length1, const UChar *s2, int32_t length2, uint32_t options, UErrorCode *pErrorCode); #endif /* #if !UCONFIG_NO_NORMALIZATION */ #endif android-audiosystem-1.8+13.10.20130807/include/unicode/errorcode.h0000644000015700001700000001120212200324306025074 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * * Copyright (C) 2009-2010, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: errorcode.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2009mar10 * created by: Markus W. Scherer */ #ifndef __ERRORCODE_H__ #define __ERRORCODE_H__ /** * \file * \brief C++ API: ErrorCode class intended to make it easier to use * ICU C and C++ APIs from C++ user code. */ #include "unicode/utypes.h" #include "unicode/uobject.h" U_NAMESPACE_BEGIN /** * Wrapper class for UErrorCode, with conversion operators for direct use * in ICU C and C++ APIs. * Intended to be used as a base class, where a subclass overrides * the handleFailure() function so that it throws an exception, * does an assert(), logs an error, etc. * This is not an abstract base class. This class can be used and instantiated * by itself, although it will be more useful when subclassed. * * Features: * - The constructor initializes the internal UErrorCode to U_ZERO_ERROR, * removing one common source of errors. * - Same use in C APIs taking a UErrorCode * (pointer) * and C++ taking UErrorCode & (reference) via conversion operators. * - Possible automatic checking for success when it goes out of scope. * * Note: For automatic checking for success in the destructor, a subclass * must implement such logic in its own destructor because the base class * destructor cannot call a subclass function (like handleFailure()). * The ErrorCode base class destructor does nothing. * * Note also: While it is possible for a destructor to throw an exception, * it is generally unsafe to do so. This means that in a subclass the destructor * and the handleFailure() function may need to take different actions. * * Sample code: * \code * class IcuErrorCode: public icu::ErrorCode { * public: * virtual ~IcuErrorCode() { * // Safe because our handleFailure() does not throw exceptions. * if(isFailure()) { handleFailure(); } * } * protected: * virtual void handleFailure() const { * log_failure(u_errorName(errorCode)); * exit(errorCode); * } * }; * IcuErrorCode error_code; * UConverter *cnv = ucnv_open("Shift-JIS", error_code); * length = ucnv_fromUChars(dest, capacity, src, length, error_code); * ucnv_close(cnv); * // IcuErrorCode destructor checks for success. * \endcode * * @stable ICU 4.2 */ class U_COMMON_API ErrorCode: public UMemory { public: /** * Default constructor. Initializes its UErrorCode to U_ZERO_ERROR. * @stable ICU 4.2 */ ErrorCode() : errorCode(U_ZERO_ERROR) {} /** Destructor, does nothing. See class documentation for details. @stable ICU 4.2 */ virtual ~ErrorCode() {} /** Conversion operator, returns a reference. @stable ICU 4.2 */ operator UErrorCode & () { return errorCode; } /** Conversion operator, returns a pointer. @stable ICU 4.2 */ operator UErrorCode * () { return &errorCode; } /** Tests for U_SUCCESS(). @stable ICU 4.2 */ UBool isSuccess() const { return U_SUCCESS(errorCode); } /** Tests for U_FAILURE(). @stable ICU 4.2 */ UBool isFailure() const { return U_FAILURE(errorCode); } /** Returns the UErrorCode value. @stable ICU 4.2 */ UErrorCode get() const { return errorCode; } /** Sets the UErrorCode value. @stable ICU 4.2 */ void set(UErrorCode value) { errorCode=value; } /** Returns the UErrorCode value and resets it to U_ZERO_ERROR. @stable ICU 4.2 */ UErrorCode reset(); /** * Asserts isSuccess(). * In other words, this method checks for a failure code, * and the base class handles it like this: * \code * if(isFailure()) { handleFailure(); } * \endcode * @stable ICU 4.4 */ void assertSuccess() const; /** * Return a string for the UErrorCode value. * The string will be the same as the name of the error code constant * in the UErrorCode enum. * @stable ICU 4.4 */ const char* errorName() const; protected: /** * Internal UErrorCode, accessible to subclasses. * @stable ICU 4.2 */ UErrorCode errorCode; /** * Called by assertSuccess() if isFailure() is true. * A subclass should override this function to deal with a failure code: * Throw an exception, log an error, terminate the program, or similar. * @stable ICU 4.2 */ virtual void handleFailure() const {} }; U_NAMESPACE_END #endif // __ERRORCODE_H__ android-audiosystem-1.8+13.10.20130807/include/unicode/chariter.h0000644000015700001700000005717212200324306024731 0ustar pbuserpbgroup00000000000000/* ******************************************************************** * * Copyright (C) 1997-2005, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************** */ #ifndef CHARITER_H #define CHARITER_H #include "unicode/utypes.h" #include "unicode/uobject.h" #include "unicode/unistr.h" /** * \file * \brief C++ API: Character Iterator */ U_NAMESPACE_BEGIN /** * Abstract class that defines an API for forward-only iteration * on text objects. * This is a minimal interface for iteration without random access * or backwards iteration. It is especially useful for wrapping * streams with converters into an object for collation or * normalization. * *

Characters can be accessed in two ways: as code units or as * code points. * Unicode code points are 21-bit integers and are the scalar values * of Unicode characters. ICU uses the type UChar32 for them. * Unicode code units are the storage units of a given * Unicode/UCS Transformation Format (a character encoding scheme). * With UTF-16, all code points can be represented with either one * or two code units ("surrogates"). * String storage is typically based on code units, while properties * of characters are typically determined using code point values. * Some processes may be designed to work with sequences of code units, * or it may be known that all characters that are important to an * algorithm can be represented with single code units. * Other processes will need to use the code point access functions.

* *

ForwardCharacterIterator provides nextPostInc() to access * a code unit and advance an internal position into the text object, * similar to a return text[position++].
* It provides next32PostInc() to access a code point and advance an internal * position.

* *

next32PostInc() assumes that the current position is that of * the beginning of a code point, i.e., of its first code unit. * After next32PostInc(), this will be true again. * In general, access to code units and code points in the same * iteration loop should not be mixed. In UTF-16, if the current position * is on a second code unit (Low Surrogate), then only that code unit * is returned even by next32PostInc().

* *

For iteration with either function, there are two ways to * check for the end of the iteration. When there are no more * characters in the text object: *

    *
  • The hasNext() function returns FALSE.
  • *
  • nextPostInc() and next32PostInc() return DONE * when one attempts to read beyond the end of the text object.
  • *
* * Example: * \code * void function1(ForwardCharacterIterator &it) { * UChar32 c; * while(it.hasNext()) { * c=it.next32PostInc(); * // use c * } * } * * void function1(ForwardCharacterIterator &it) { * UChar c; * while((c=it.nextPostInc())!=ForwardCharacterIterator::DONE) { * // use c * } * } * \endcode *

* * @stable ICU 2.0 */ class U_COMMON_API ForwardCharacterIterator : public UObject { public: /** * Value returned by most of ForwardCharacterIterator's functions * when the iterator has reached the limits of its iteration. * @stable ICU 2.0 */ enum { DONE = 0xffff }; /** * Destructor. * @stable ICU 2.0 */ virtual ~ForwardCharacterIterator(); /** * Returns true when both iterators refer to the same * character in the same character-storage object. * @param that The ForwardCharacterIterator to be compared for equality * @return true when both iterators refer to the same * character in the same character-storage object * @stable ICU 2.0 */ virtual UBool operator==(const ForwardCharacterIterator& that) const = 0; /** * Returns true when the iterators refer to different * text-storage objects, or to different characters in the * same text-storage object. * @param that The ForwardCharacterIterator to be compared for inequality * @return true when the iterators refer to different * text-storage objects, or to different characters in the * same text-storage object * @stable ICU 2.0 */ inline UBool operator!=(const ForwardCharacterIterator& that) const; /** * Generates a hash code for this iterator. * @return the hash code. * @stable ICU 2.0 */ virtual int32_t hashCode(void) const = 0; /** * Returns a UClassID for this ForwardCharacterIterator ("poor man's * RTTI").

Despite the fact that this function is public, * DO NOT CONSIDER IT PART OF CHARACTERITERATOR'S API! * @return a UClassID for this ForwardCharacterIterator * @stable ICU 2.0 */ virtual UClassID getDynamicClassID(void) const = 0; /** * Gets the current code unit for returning and advances to the next code unit * in the iteration range * (toward endIndex()). If there are * no more code units to return, returns DONE. * @return the current code unit. * @stable ICU 2.0 */ virtual UChar nextPostInc(void) = 0; /** * Gets the current code point for returning and advances to the next code point * in the iteration range * (toward endIndex()). If there are * no more code points to return, returns DONE. * @return the current code point. * @stable ICU 2.0 */ virtual UChar32 next32PostInc(void) = 0; /** * Returns FALSE if there are no more code units or code points * at or after the current position in the iteration range. * This is used with nextPostInc() or next32PostInc() in forward * iteration. * @returns FALSE if there are no more code units or code points * at or after the current position in the iteration range. * @stable ICU 2.0 */ virtual UBool hasNext() = 0; protected: /** Default constructor to be overridden in the implementing class. @stable ICU 2.0*/ ForwardCharacterIterator(); /** Copy constructor to be overridden in the implementing class. @stable ICU 2.0*/ ForwardCharacterIterator(const ForwardCharacterIterator &other); /** * Assignment operator to be overridden in the implementing class. * @stable ICU 2.0 */ ForwardCharacterIterator &operator=(const ForwardCharacterIterator&) { return *this; } }; /** * Abstract class that defines an API for iteration * on text objects. * This is an interface for forward and backward iteration * and random access into a text object. * *

The API provides backward compatibility to the Java and older ICU * CharacterIterator classes but extends them significantly: *

    *
  1. CharacterIterator is now a subclass of ForwardCharacterIterator.
  2. *
  3. While the old API functions provided forward iteration with * "pre-increment" semantics, the new one also provides functions * with "post-increment" semantics. They are more efficient and should * be the preferred iterator functions for new implementations. * The backward iteration always had "pre-decrement" semantics, which * are efficient.
  4. *
  5. Just like ForwardCharacterIterator, it provides access to * both code units and code points. Code point access versions are available * for the old and the new iteration semantics.
  6. *
  7. There are new functions for setting and moving the current position * without returning a character, for efficiency.
  8. *
* * See ForwardCharacterIterator for examples for using the new forward iteration * functions. For backward iteration, there is also a hasPrevious() function * that can be used analogously to hasNext(). * The old functions work as before and are shown below.

* *

Examples for some of the new functions:

* * Forward iteration with hasNext(): * \code * void forward1(CharacterIterator &it) { * UChar32 c; * for(it.setToStart(); it.hasNext();) { * c=it.next32PostInc(); * // use c * } * } * \endcode * Forward iteration more similar to loops with the old forward iteration, * showing a way to convert simple for() loops: * \code * void forward2(CharacterIterator &it) { * UChar c; * for(c=it.firstPostInc(); c!=CharacterIterator::DONE; c=it.nextPostInc()) { * // use c * } * } * \endcode * Backward iteration with setToEnd() and hasPrevious(): * \code * void backward1(CharacterIterator &it) { * UChar32 c; * for(it.setToEnd(); it.hasPrevious();) { * c=it.previous32(); * // use c * } * } * \endcode * Backward iteration with a more traditional for() loop: * \code * void backward2(CharacterIterator &it) { * UChar c; * for(c=it.last(); c!=CharacterIterator::DONE; c=it.previous()) { * // use c * } * } * \endcode * * Example for random access: * \code * void random(CharacterIterator &it) { * // set to the third code point from the beginning * it.move32(3, CharacterIterator::kStart); * // get a code point from here without moving the position * UChar32 c=it.current32(); * // get the position * int32_t pos=it.getIndex(); * // get the previous code unit * UChar u=it.previous(); * // move back one more code unit * it.move(-1, CharacterIterator::kCurrent); * // set the position back to where it was * // and read the same code point c and move beyond it * it.setIndex(pos); * if(c!=it.next32PostInc()) { * exit(1); // CharacterIterator inconsistent * } * } * \endcode * *

Examples, especially for the old API:

* * Function processing characters, in this example simple output *
 * \code
 *  void processChar( UChar c )
 *  {
 *      cout << " " << c;
 *  }
 * \endcode
 * 
* Traverse the text from start to finish *
 
 * \code
 *  void traverseForward(CharacterIterator& iter)
 *  {
 *      for(UChar c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
 *          processChar(c);
 *      }
 *  }
 * \endcode
 * 
* Traverse the text backwards, from end to start *
 * \code
 *  void traverseBackward(CharacterIterator& iter)
 *  {
 *      for(UChar c = iter.last(); c != CharacterIterator.DONE; c = iter.previous()) {
 *          processChar(c);
 *      }
 *  }
 * \endcode
 * 
* Traverse both forward and backward from a given position in the text. * Calls to notBoundary() in this example represents some additional stopping criteria. *
 * \code
 * void traverseOut(CharacterIterator& iter, int32_t pos)
 * {
 *      UChar c;
 *      for (c = iter.setIndex(pos);
 *      c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c));
 *          c = iter.next()) {}
 *      int32_t end = iter.getIndex();
 *      for (c = iter.setIndex(pos);
 *          c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c));
 *          c = iter.previous()) {}
 *      int32_t start = iter.getIndex() + 1;
 *  
 *      cout << "start: " << start << " end: " << end << endl;
 *      for (c = iter.setIndex(start); iter.getIndex() < end; c = iter.next() ) {
 *          processChar(c);
 *     }
 *  }
 * \endcode
 * 
* Creating a StringCharacterIterator and calling the test functions *
 * \code
 *  void CharacterIterator_Example( void )
 *   {
 *       cout << endl << "===== CharacterIterator_Example: =====" << endl;
 *       UnicodeString text("Ein kleiner Satz.");
 *       StringCharacterIterator iterator(text);
 *       cout << "----- traverseForward: -----------" << endl;
 *       traverseForward( iterator );
 *       cout << endl << endl << "----- traverseBackward: ----------" << endl;
 *       traverseBackward( iterator );
 *       cout << endl << endl << "----- traverseOut: ---------------" << endl;
 *       traverseOut( iterator, 7 );
 *       cout << endl << endl << "-----" << endl;
 *   }
 * \endcode
 * 
* * @stable ICU 2.0 */ class U_COMMON_API CharacterIterator : public ForwardCharacterIterator { public: /** * Origin enumeration for the move() and move32() functions. * @stable ICU 2.0 */ enum EOrigin { kStart, kCurrent, kEnd }; /** * Returns a pointer to a new CharacterIterator of the same * concrete class as this one, and referring to the same * character in the same text-storage object as this one. The * caller is responsible for deleting the new clone. * @return a pointer to a new CharacterIterator * @stable ICU 2.0 */ virtual CharacterIterator* clone(void) const = 0; /** * Sets the iterator to refer to the first code unit in its * iteration range, and returns that code unit. * This can be used to begin an iteration with next(). * @return the first code unit in its iteration range. * @stable ICU 2.0 */ virtual UChar first(void) = 0; /** * Sets the iterator to refer to the first code unit in its * iteration range, returns that code unit, and moves the position * to the second code unit. This is an alternative to setToStart() * for forward iteration with nextPostInc(). * @return the first code unit in its iteration range. * @stable ICU 2.0 */ virtual UChar firstPostInc(void); /** * Sets the iterator to refer to the first code point in its * iteration range, and returns that code unit, * This can be used to begin an iteration with next32(). * Note that an iteration with next32PostInc(), beginning with, * e.g., setToStart() or firstPostInc(), is more efficient. * @return the first code point in its iteration range. * @stable ICU 2.0 */ virtual UChar32 first32(void) = 0; /** * Sets the iterator to refer to the first code point in its * iteration range, returns that code point, and moves the position * to the second code point. This is an alternative to setToStart() * for forward iteration with next32PostInc(). * @return the first code point in its iteration range. * @stable ICU 2.0 */ virtual UChar32 first32PostInc(void); /** * Sets the iterator to refer to the first code unit or code point in its * iteration range. This can be used to begin a forward * iteration with nextPostInc() or next32PostInc(). * @return the start position of the iteration range * @stable ICU 2.0 */ inline int32_t setToStart(); /** * Sets the iterator to refer to the last code unit in its * iteration range, and returns that code unit. * This can be used to begin an iteration with previous(). * @return the last code unit. * @stable ICU 2.0 */ virtual UChar last(void) = 0; /** * Sets the iterator to refer to the last code point in its * iteration range, and returns that code unit. * This can be used to begin an iteration with previous32(). * @return the last code point. * @stable ICU 2.0 */ virtual UChar32 last32(void) = 0; /** * Sets the iterator to the end of its iteration range, just behind * the last code unit or code point. This can be used to begin a backward * iteration with previous() or previous32(). * @return the end position of the iteration range * @stable ICU 2.0 */ inline int32_t setToEnd(); /** * Sets the iterator to refer to the "position"-th code unit * in the text-storage object the iterator refers to, and * returns that code unit. * @param position the "position"-th code unit in the text-storage object * @return the "position"-th code unit. * @stable ICU 2.0 */ virtual UChar setIndex(int32_t position) = 0; /** * Sets the iterator to refer to the beginning of the code point * that contains the "position"-th code unit * in the text-storage object the iterator refers to, and * returns that code point. * The current position is adjusted to the beginning of the code point * (its first code unit). * @param position the "position"-th code unit in the text-storage object * @return the "position"-th code point. * @stable ICU 2.0 */ virtual UChar32 setIndex32(int32_t position) = 0; /** * Returns the code unit the iterator currently refers to. * @return the current code unit. * @stable ICU 2.0 */ virtual UChar current(void) const = 0; /** * Returns the code point the iterator currently refers to. * @return the current code point. * @stable ICU 2.0 */ virtual UChar32 current32(void) const = 0; /** * Advances to the next code unit in the iteration range * (toward endIndex()), and returns that code unit. If there are * no more code units to return, returns DONE. * @return the next code unit. * @stable ICU 2.0 */ virtual UChar next(void) = 0; /** * Advances to the next code point in the iteration range * (toward endIndex()), and returns that code point. If there are * no more code points to return, returns DONE. * Note that iteration with "pre-increment" semantics is less * efficient than iteration with "post-increment" semantics * that is provided by next32PostInc(). * @return the next code point. * @stable ICU 2.0 */ virtual UChar32 next32(void) = 0; /** * Advances to the previous code unit in the iteration range * (toward startIndex()), and returns that code unit. If there are * no more code units to return, returns DONE. * @return the previous code unit. * @stable ICU 2.0 */ virtual UChar previous(void) = 0; /** * Advances to the previous code point in the iteration range * (toward startIndex()), and returns that code point. If there are * no more code points to return, returns DONE. * @return the previous code point. * @stable ICU 2.0 */ virtual UChar32 previous32(void) = 0; /** * Returns FALSE if there are no more code units or code points * before the current position in the iteration range. * This is used with previous() or previous32() in backward * iteration. * @return FALSE if there are no more code units or code points * before the current position in the iteration range, return TRUE otherwise. * @stable ICU 2.0 */ virtual UBool hasPrevious() = 0; /** * Returns the numeric index in the underlying text-storage * object of the character returned by first(). Since it's * possible to create an iterator that iterates across only * part of a text-storage object, this number isn't * necessarily 0. * @returns the numeric index in the underlying text-storage * object of the character returned by first(). * @stable ICU 2.0 */ inline int32_t startIndex(void) const; /** * Returns the numeric index in the underlying text-storage * object of the position immediately BEYOND the character * returned by last(). * @return the numeric index in the underlying text-storage * object of the position immediately BEYOND the character * returned by last(). * @stable ICU 2.0 */ inline int32_t endIndex(void) const; /** * Returns the numeric index in the underlying text-storage * object of the character the iterator currently refers to * (i.e., the character returned by current()). * @return the numberic index in the text-storage object of * the character the iterator currently refers to * @stable ICU 2.0 */ inline int32_t getIndex(void) const; /** * Returns the length of the entire text in the underlying * text-storage object. * @return the length of the entire text in the text-storage object * @stable ICU 2.0 */ inline int32_t getLength() const; /** * Moves the current position relative to the start or end of the * iteration range, or relative to the current position itself. * The movement is expressed in numbers of code units forward * or backward by specifying a positive or negative delta. * @param delta the position relative to origin. A positive delta means forward; * a negative delta means backward. * @param origin Origin enumeration {kStart, kCurrent, kEnd} * @return the new position * @stable ICU 2.0 */ virtual int32_t move(int32_t delta, EOrigin origin) = 0; /** * Moves the current position relative to the start or end of the * iteration range, or relative to the current position itself. * The movement is expressed in numbers of code points forward * or backward by specifying a positive or negative delta. * @param delta the position relative to origin. A positive delta means forward; * a negative delta means backward. * @param origin Origin enumeration {kStart, kCurrent, kEnd} * @return the new position * @stable ICU 2.0 */ virtual int32_t move32(int32_t delta, EOrigin origin) = 0; /** * Copies the text under iteration into the UnicodeString * referred to by "result". * @param result Receives a copy of the text under iteration. * @stable ICU 2.0 */ virtual void getText(UnicodeString& result) = 0; protected: /** * Empty constructor. * @stable ICU 2.0 */ CharacterIterator(); /** * Constructor, just setting the length field in this base class. * @stable ICU 2.0 */ CharacterIterator(int32_t length); /** * Constructor, just setting the length and position fields in this base class. * @stable ICU 2.0 */ CharacterIterator(int32_t length, int32_t position); /** * Constructor, just setting the length, start, end, and position fields in this base class. * @stable ICU 2.0 */ CharacterIterator(int32_t length, int32_t textBegin, int32_t textEnd, int32_t position); /** * Copy constructor. * * @param that The CharacterIterator to be copied * @stable ICU 2.0 */ CharacterIterator(const CharacterIterator &that); /** * Assignment operator. Sets this CharacterIterator to have the same behavior, * as the one passed in. * @param that The CharacterIterator passed in. * @return the newly set CharacterIterator. * @stable ICU 2.0 */ CharacterIterator &operator=(const CharacterIterator &that); /** * Base class text length field. * Necessary this for correct getText() and hashCode(). * @stable ICU 2.0 */ int32_t textLength; /** * Base class field for the current position. * @stable ICU 2.0 */ int32_t pos; /** * Base class field for the start of the iteration range. * @stable ICU 2.0 */ int32_t begin; /** * Base class field for the end of the iteration range. * @stable ICU 2.0 */ int32_t end; }; inline UBool ForwardCharacterIterator::operator!=(const ForwardCharacterIterator& that) const { return !operator==(that); } inline int32_t CharacterIterator::setToStart() { return move(0, kStart); } inline int32_t CharacterIterator::setToEnd() { return move(0, kEnd); } inline int32_t CharacterIterator::startIndex(void) const { return begin; } inline int32_t CharacterIterator::endIndex(void) const { return end; } inline int32_t CharacterIterator::getIndex(void) const { return pos; } inline int32_t CharacterIterator::getLength(void) const { return textLength; } U_NAMESPACE_END #endif android-audiosystem-1.8+13.10.20130807/include/unicode/utypes.h0000644000015700001700000010603612200324306024453 0ustar pbuserpbgroup00000000000000/* ********************************************************************** * Copyright (C) 1996-2010, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * * FILE NAME : UTYPES.H (formerly ptypes.h) * * Date Name Description * 12/11/96 helena Creation. * 02/27/97 aliu Added typedefs for UClassID, int8, int16, int32, * uint8, uint16, and uint32. * 04/01/97 aliu Added XP_CPLUSPLUS and modified to work under C as * well as C++. * Modified to use memcpy() for uprv_arrayCopy() fns. * 04/14/97 aliu Added TPlatformUtilities. * 05/07/97 aliu Added import/export specifiers (replacing the old * broken EXT_CLASS). Added version number for our * code. Cleaned up header. * 6/20/97 helena Java class name change. * 08/11/98 stephen UErrorCode changed from typedef to enum * 08/12/98 erm Changed T_ANALYTIC_PACKAGE_VERSION to 3 * 08/14/98 stephen Added uprv_arrayCopy() for int8_t, int16_t, int32_t * 12/09/98 jfitz Added BUFFER_OVERFLOW_ERROR (bug 1100066) * 04/20/99 stephen Cleaned up & reworked for autoconf. * Renamed to utypes.h. * 05/05/99 stephen Changed to use * 12/07/99 helena Moved copyright notice string from ucnv_bld.h here. ******************************************************************************* */ #ifndef UTYPES_H #define UTYPES_H #include "unicode/umachine.h" #include "unicode/utf.h" #include "unicode/uversion.h" #include "unicode/uconfig.h" /*! * \file * \brief Basic definitions for ICU, for both C and C++ APIs * * This file defines basic types, constants, and enumerations directly or * indirectly by including other header files, especially utf.h for the * basic character and string definitions and umachine.h for consistent * integer and other types. */ /** * \def U_SHOW_CPLUSPLUS_API * @internal */ #ifdef XP_CPLUSPLUS # ifndef U_SHOW_CPLUSPLUS_API # define U_SHOW_CPLUSPLUS_API 1 # endif #else # undef U_SHOW_CPLUSPLUS_API # define U_SHOW_CPLUSPLUS_API 0 #endif /** @{ API visibility control */ /** * \def U_HIDE_DRAFT_API * Define this to 1 to request that draft API be "hidden" */ #if !U_DEFAULT_SHOW_DRAFT && !defined(U_SHOW_DRAFT_API) #define U_HIDE_DRAFT_API 1 #endif #if !U_DEFAULT_SHOW_DRAFT && !defined(U_SHOW_INTERNAL_API) #define U_HIDE_INTERNAL_API 1 #endif #ifdef U_HIDE_DRAFT_API #include "unicode/udraft.h" #endif #ifdef U_HIDE_DEPRECATED_API #include "unicode/udeprctd.h" #endif #ifdef U_HIDE_DEPRECATED_API #include "unicode/uobslete.h" #endif #ifdef U_HIDE_INTERNAL_API #include "unicode/uintrnal.h" #endif #ifdef U_HIDE_SYSTEM_API #include "unicode/usystem.h" #endif /** @} */ /*===========================================================================*/ /* char Character set family */ /*===========================================================================*/ /** * U_CHARSET_FAMILY is equal to this value when the platform is an ASCII based platform. * @stable ICU 2.0 */ #define U_ASCII_FAMILY 0 /** * U_CHARSET_FAMILY is equal to this value when the platform is an EBCDIC based platform. * @stable ICU 2.0 */ #define U_EBCDIC_FAMILY 1 /** * \def U_CHARSET_FAMILY * *

These definitions allow to specify the encoding of text * in the char data type as defined by the platform and the compiler. * It is enough to determine the code point values of "invariant characters", * which are the ones shared by all encodings that are in use * on a given platform.

* *

Those "invariant characters" should be all the uppercase and lowercase * latin letters, the digits, the space, and "basic punctuation". * Also, '\\n', '\\r', '\\t' should be available.

* *

The list of "invariant characters" is:
* \code * A-Z a-z 0-9 SPACE " % & ' ( ) * + , - . / : ; < = > ? _ * \endcode *
* (52 letters + 10 numbers + 20 punc/sym/space = 82 total)

* *

This matches the IBM Syntactic Character Set (CS 640).

* *

In other words, all the graphic characters in 7-bit ASCII should * be safely accessible except the following:

* * \code * '\' * '[' * ']' * '{' * '}' * '^' * '~' * '!' * '#' * '|' * '$' * '@' * '`' * \endcode * @stable ICU 2.0 */ #ifndef U_CHARSET_FAMILY # define U_CHARSET_FAMILY 0 #endif /** * \def U_CHARSET_IS_UTF8 * * Hardcode the default charset to UTF-8. * * If this is set to 1, then * - ICU will assume that all non-invariant char*, StringPiece, std::string etc. * contain UTF-8 text, regardless of what the system API uses * - some ICU code will use fast functions like u_strFromUTF8() * rather than the more general and more heavy-weight conversion API (ucnv.h) * - ucnv_getDefaultName() always returns "UTF-8" * - ucnv_setDefaultName() is disabled and will not change the default charset * - static builds of ICU are smaller * - more functionality is available with the UCONFIG_NO_CONVERSION build-time * configuration option (see unicode/uconfig.h) * - the UCONFIG_NO_CONVERSION build option in uconfig.h is more usable * * @stable ICU 4.2 * @see UCONFIG_NO_CONVERSION */ #ifndef U_CHARSET_IS_UTF8 # define U_CHARSET_IS_UTF8 0 #endif /*===========================================================================*/ /* ICUDATA naming scheme */ /*===========================================================================*/ /** * \def U_ICUDATA_TYPE_LETTER * * This is a platform-dependent string containing one letter: * - b for big-endian, ASCII-family platforms * - l for little-endian, ASCII-family platforms * - e for big-endian, EBCDIC-family platforms * This letter is part of the common data file name. * @stable ICU 2.0 */ /** * \def U_ICUDATA_TYPE_LITLETTER * The non-string form of U_ICUDATA_TYPE_LETTER * @stable ICU 2.0 */ #if U_CHARSET_FAMILY # if U_IS_BIG_ENDIAN /* EBCDIC - should always be BE */ # define U_ICUDATA_TYPE_LETTER "e" # define U_ICUDATA_TYPE_LITLETTER e # else # error "Don't know what to do with little endian EBCDIC!" # define U_ICUDATA_TYPE_LETTER "x" # define U_ICUDATA_TYPE_LITLETTER x # endif #else # if U_IS_BIG_ENDIAN /* Big-endian ASCII */ # define U_ICUDATA_TYPE_LETTER "b" # define U_ICUDATA_TYPE_LITLETTER b # else /* Little-endian ASCII */ # define U_ICUDATA_TYPE_LETTER "l" # define U_ICUDATA_TYPE_LITLETTER l # endif #endif /** * A single string literal containing the icudata stub name. i.e. 'icudt18e' for * ICU 1.8.x on EBCDIC, etc.. * @stable ICU 2.0 */ #define U_ICUDATA_NAME "icudt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER /**< @internal */ #define U_USRDATA_NAME "usrdt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER /**< @internal */ #define U_USE_USRDATA 1 /**< @internal */ /** * U_ICU_ENTRY_POINT is the name of the DLL entry point to the ICU data library. * Defined as a literal, not a string. * Tricky Preprocessor use - ## operator replaces macro paramters with the literal string * from the corresponding macro invocation, _before_ other macro substitutions. * Need a nested \#defines to get the actual version numbers rather than * the literal text U_ICU_VERSION_MAJOR_NUM into the name. * The net result will be something of the form * \#define U_ICU_ENTRY_POINT icudt19_dat * @stable ICU 2.4 */ #define U_ICUDATA_ENTRY_POINT U_DEF2_ICUDATA_ENTRY_POINT(U_ICU_VERSION_MAJOR_NUM, U_ICU_VERSION_MINOR_NUM) /** * Do not use. * @internal */ #define U_DEF2_ICUDATA_ENTRY_POINT(major, minor) U_DEF_ICUDATA_ENTRY_POINT(major, minor) /** * Do not use. * @internal */ #ifndef U_DEF_ICUDATA_ENTRY_POINT /* affected by symbol renaming. See platform.h */ #define U_DEF_ICUDATA_ENTRY_POINT(major, minor) icudt##major##minor##_dat #endif /** * \def U_CALLCONV * Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary * in callback function typedefs to make sure that the calling convention * is compatible. * * This is only used for non-ICU-API functions. * When a function is a public ICU API, * you must use the U_CAPI and U_EXPORT2 qualifiers. * @stable ICU 2.0 */ #if defined(OS390) && defined(XP_CPLUSPLUS) # define U_CALLCONV __cdecl #else # define U_CALLCONV U_EXPORT2 #endif /** * \def NULL * Define NULL if necessary, to 0 for C++ and to ((void *)0) for C. * @stable ICU 2.0 */ #ifndef NULL #ifdef XP_CPLUSPLUS #define NULL 0 #else #define NULL ((void *)0) #endif #endif /*===========================================================================*/ /* Calendar/TimeZone data types */ /*===========================================================================*/ /** * Date and Time data type. * This is a primitive data type that holds the date and time * as the number of milliseconds since 1970-jan-01, 00:00 UTC. * UTC leap seconds are ignored. * @stable ICU 2.0 */ typedef double UDate; /** The number of milliseconds per second @stable ICU 2.0 */ #define U_MILLIS_PER_SECOND (1000) /** The number of milliseconds per minute @stable ICU 2.0 */ #define U_MILLIS_PER_MINUTE (60000) /** The number of milliseconds per hour @stable ICU 2.0 */ #define U_MILLIS_PER_HOUR (3600000) /** The number of milliseconds per day @stable ICU 2.0 */ #define U_MILLIS_PER_DAY (86400000) /*===========================================================================*/ /* UClassID-based RTTI */ /*===========================================================================*/ /** * UClassID is used to identify classes without using RTTI, since RTTI * is not yet supported by all C++ compilers. Each class hierarchy which needs * to implement polymorphic clone() or operator==() defines two methods, * described in detail below. UClassID values can be compared using * operator==(). Nothing else should be done with them. * * \par * getDynamicClassID() is declared in the base class of the hierarchy as * a pure virtual. Each concrete subclass implements it in the same way: * * \code * class Base { * public: * virtual UClassID getDynamicClassID() const = 0; * } * * class Derived { * public: * virtual UClassID getDynamicClassID() const * { return Derived::getStaticClassID(); } * } * \endcode * * Each concrete class implements getStaticClassID() as well, which allows * clients to test for a specific type. * * \code * class Derived { * public: * static UClassID U_EXPORT2 getStaticClassID(); * private: * static char fgClassID; * } * * // In Derived.cpp: * UClassID Derived::getStaticClassID() * { return (UClassID)&Derived::fgClassID; } * char Derived::fgClassID = 0; // Value is irrelevant * \endcode * @stable ICU 2.0 */ typedef void* UClassID; /*===========================================================================*/ /* Shared library/DLL import-export API control */ /*===========================================================================*/ /* * Control of symbol import/export. * ICU is separated into three libraries. */ /* * \def U_COMBINED_IMPLEMENTATION * Set to export library symbols from inside the ICU library * when all of ICU is in a single library. * This can be set as a compiler option while building ICU, and it * needs to be the first one tested to override U_COMMON_API, U_I18N_API, etc. * @stable ICU 2.0 */ /** * \def U_DATA_API * Set to export library symbols from inside the stubdata library, * and to import them from outside. * @stable ICU 3.0 */ /** * \def U_COMMON_API * Set to export library symbols from inside the common library, * and to import them from outside. * @stable ICU 2.0 */ /** * \def U_I18N_API * Set to export library symbols from inside the i18n library, * and to import them from outside. * @stable ICU 2.0 */ /** * \def U_LAYOUT_API * Set to export library symbols from inside the layout engine library, * and to import them from outside. * @stable ICU 2.0 */ /** * \def U_LAYOUTEX_API * Set to export library symbols from inside the layout extensions library, * and to import them from outside. * @stable ICU 2.6 */ /** * \def U_IO_API * Set to export library symbols from inside the ustdio library, * and to import them from outside. * @stable ICU 2.0 */ /** * \def U_TOOLUTIL_API * Set to export library symbols from inside the toolutil library, * and to import them from outside. * @stable ICU 3.4 */ #if defined(U_COMBINED_IMPLEMENTATION) #define U_DATA_API U_EXPORT #define U_COMMON_API U_EXPORT #define U_I18N_API U_EXPORT #define U_LAYOUT_API U_EXPORT #define U_LAYOUTEX_API U_EXPORT #define U_IO_API U_EXPORT #define U_TOOLUTIL_API U_EXPORT #elif defined(U_STATIC_IMPLEMENTATION) #define U_DATA_API #define U_COMMON_API #define U_I18N_API #define U_LAYOUT_API #define U_LAYOUTEX_API #define U_IO_API #define U_TOOLUTIL_API #elif defined(U_COMMON_IMPLEMENTATION) #define U_DATA_API U_IMPORT #define U_COMMON_API U_EXPORT #define U_I18N_API U_IMPORT #define U_LAYOUT_API U_IMPORT #define U_LAYOUTEX_API U_IMPORT #define U_IO_API U_IMPORT #define U_TOOLUTIL_API U_IMPORT #elif defined(U_I18N_IMPLEMENTATION) #define U_DATA_API U_IMPORT #define U_COMMON_API U_IMPORT #define U_I18N_API U_EXPORT #define U_LAYOUT_API U_IMPORT #define U_LAYOUTEX_API U_IMPORT #define U_IO_API U_IMPORT #define U_TOOLUTIL_API U_IMPORT #elif defined(U_LAYOUT_IMPLEMENTATION) #define U_DATA_API U_IMPORT #define U_COMMON_API U_IMPORT #define U_I18N_API U_IMPORT #define U_LAYOUT_API U_EXPORT #define U_LAYOUTEX_API U_IMPORT #define U_IO_API U_IMPORT #define U_TOOLUTIL_API U_IMPORT #elif defined(U_LAYOUTEX_IMPLEMENTATION) #define U_DATA_API U_IMPORT #define U_COMMON_API U_IMPORT #define U_I18N_API U_IMPORT #define U_LAYOUT_API U_IMPORT #define U_LAYOUTEX_API U_EXPORT #define U_IO_API U_IMPORT #define U_TOOLUTIL_API U_IMPORT #elif defined(U_IO_IMPLEMENTATION) #define U_DATA_API U_IMPORT #define U_COMMON_API U_IMPORT #define U_I18N_API U_IMPORT #define U_LAYOUT_API U_IMPORT #define U_LAYOUTEX_API U_IMPORT #define U_IO_API U_EXPORT #define U_TOOLUTIL_API U_IMPORT #elif defined(U_TOOLUTIL_IMPLEMENTATION) #define U_DATA_API U_IMPORT #define U_COMMON_API U_IMPORT #define U_I18N_API U_IMPORT #define U_LAYOUT_API U_IMPORT #define U_LAYOUTEX_API U_IMPORT #define U_IO_API U_IMPORT #define U_TOOLUTIL_API U_EXPORT #else #define U_DATA_API U_IMPORT #define U_COMMON_API U_IMPORT #define U_I18N_API U_IMPORT #define U_LAYOUT_API U_IMPORT #define U_LAYOUTEX_API U_IMPORT #define U_IO_API U_IMPORT #define U_TOOLUTIL_API U_IMPORT #endif /** * \def U_STANDARD_CPP_NAMESPACE * Control of C++ Namespace * @stable ICU 2.0 */ #ifdef __cplusplus #define U_STANDARD_CPP_NAMESPACE :: #else #define U_STANDARD_CPP_NAMESPACE #endif /*===========================================================================*/ /* Global delete operator */ /*===========================================================================*/ /* * The ICU4C library must not use the global new and delete operators. * These operators here are defined to enable testing for this. * See Jitterbug 2581 for details of why this is necessary. * * Verification that ICU4C's memory usage is correct, i.e., * that global new/delete are not used: * * a) Check for imports of global new/delete (see uobject.cpp for details) * b) Verify that new is never imported. * c) Verify that delete is only imported from object code for interface/mixin classes. * d) Add global delete and delete[] only for the ICU4C library itself * and define them in a way that crashes or otherwise easily shows a problem. * * The following implements d). * The operator implementations crash; this is intentional and used for library debugging. * * Note: This is currently only done on Windows because * some Linux/Unix compilers have problems with defining global new/delete. * On Windows, U_WINDOWS is defined, and it is _MSC_VER>=1200 for MSVC 6.0 and higher. */ #if defined(XP_CPLUSPLUS) && defined(U_WINDOWS) && U_DEBUG && U_OVERRIDE_CXX_ALLOCATION && (_MSC_VER>=1200) && !defined(U_STATIC_IMPLEMENTATION) && (defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || defined(U_LAYOUT_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION)) #ifndef U_HIDE_INTERNAL_API /** * Global operator new, defined only inside ICU4C, must not be used. * Crashes intentionally. * @internal */ inline void * operator new(size_t /*size*/) { char *q=NULL; *q=5; /* break it */ return q; } #ifdef _Ret_bytecap_ /* This is only needed to suppress a Visual C++ 2008 warning for operator new[]. */ _Ret_bytecap_(_Size) #endif /** * Global operator new[], defined only inside ICU4C, must not be used. * Crashes intentionally. * @internal */ inline void * operator new[](size_t /*size*/) { char *q=NULL; *q=5; /* break it */ return q; } /** * Global operator delete, defined only inside ICU4C, must not be used. * Crashes intentionally. * @internal */ inline void operator delete(void * /*p*/) { char *q=NULL; *q=5; /* break it */ } /** * Global operator delete[], defined only inside ICU4C, must not be used. * Crashes intentionally. * @internal */ inline void operator delete[](void * /*p*/) { char *q=NULL; *q=5; /* break it */ } #endif /* U_HIDE_INTERNAL_API */ #endif /*===========================================================================*/ /* UErrorCode */ /*===========================================================================*/ /** * Error code to replace exception handling, so that the code is compatible with all C++ compilers, * and to use the same mechanism for C and C++. * * \par * ICU functions that take a reference (C++) or a pointer (C) to a UErrorCode * first test if(U_FAILURE(errorCode)) { return immediately; } * so that in a chain of such functions the first one that sets an error code * causes the following ones to not perform any operations. * * \par * Error codes should be tested using U_FAILURE() and U_SUCCESS(). * @stable ICU 2.0 */ typedef enum UErrorCode { /* The ordering of U_ERROR_INFO_START Vs U_USING_FALLBACK_WARNING looks weird * and is that way because VC++ debugger displays first encountered constant, * which is not the what the code is used for */ U_USING_FALLBACK_WARNING = -128, /**< A resource bundle lookup returned a fallback result (not an error) */ U_ERROR_WARNING_START = -128, /**< Start of information results (semantically successful) */ U_USING_DEFAULT_WARNING = -127, /**< A resource bundle lookup returned a result from the root locale (not an error) */ U_SAFECLONE_ALLOCATED_WARNING = -126, /**< A SafeClone operation required allocating memory (informational only) */ U_STATE_OLD_WARNING = -125, /**< ICU has to use compatibility layer to construct the service. Expect performance/memory usage degradation. Consider upgrading */ U_STRING_NOT_TERMINATED_WARNING = -124,/**< An output string could not be NUL-terminated because output length==destCapacity. */ U_SORT_KEY_TOO_SHORT_WARNING = -123, /**< Number of levels requested in getBound is higher than the number of levels in the sort key */ U_AMBIGUOUS_ALIAS_WARNING = -122, /**< This converter alias can go to different converter implementations */ U_DIFFERENT_UCA_VERSION = -121, /**< ucol_open encountered a mismatch between UCA version and collator image version, so the collator was constructed from rules. No impact to further function */ U_PLUGIN_CHANGED_LEVEL_WARNING = -120, /**< A plugin caused a level change. May not be an error, but later plugins may not load. */ U_ERROR_WARNING_LIMIT, /**< This must always be the last warning value to indicate the limit for UErrorCode warnings (last warning code +1) */ U_ZERO_ERROR = 0, /**< No error, no warning. */ U_ILLEGAL_ARGUMENT_ERROR = 1, /**< Start of codes indicating failure */ U_MISSING_RESOURCE_ERROR = 2, /**< The requested resource cannot be found */ U_INVALID_FORMAT_ERROR = 3, /**< Data format is not what is expected */ U_FILE_ACCESS_ERROR = 4, /**< The requested file cannot be found */ U_INTERNAL_PROGRAM_ERROR = 5, /**< Indicates a bug in the library code */ U_MESSAGE_PARSE_ERROR = 6, /**< Unable to parse a message (message format) */ U_MEMORY_ALLOCATION_ERROR = 7, /**< Memory allocation error */ U_INDEX_OUTOFBOUNDS_ERROR = 8, /**< Trying to access the index that is out of bounds */ U_PARSE_ERROR = 9, /**< Equivalent to Java ParseException */ U_INVALID_CHAR_FOUND = 10, /**< Character conversion: Unmappable input sequence. In other APIs: Invalid character. */ U_TRUNCATED_CHAR_FOUND = 11, /**< Character conversion: Incomplete input sequence. */ U_ILLEGAL_CHAR_FOUND = 12, /**< Character conversion: Illegal input sequence/combination of input units. */ U_INVALID_TABLE_FORMAT = 13, /**< Conversion table file found, but corrupted */ U_INVALID_TABLE_FILE = 14, /**< Conversion table file not found */ U_BUFFER_OVERFLOW_ERROR = 15, /**< A result would not fit in the supplied buffer */ U_UNSUPPORTED_ERROR = 16, /**< Requested operation not supported in current context */ U_RESOURCE_TYPE_MISMATCH = 17, /**< an operation is requested over a resource that does not support it */ U_ILLEGAL_ESCAPE_SEQUENCE = 18, /**< ISO-2022 illlegal escape sequence */ U_UNSUPPORTED_ESCAPE_SEQUENCE = 19, /**< ISO-2022 unsupported escape sequence */ U_NO_SPACE_AVAILABLE = 20, /**< No space available for in-buffer expansion for Arabic shaping */ U_CE_NOT_FOUND_ERROR = 21, /**< Currently used only while setting variable top, but can be used generally */ U_PRIMARY_TOO_LONG_ERROR = 22, /**< User tried to set variable top to a primary that is longer than two bytes */ U_STATE_TOO_OLD_ERROR = 23, /**< ICU cannot construct a service from this state, as it is no longer supported */ U_TOO_MANY_ALIASES_ERROR = 24, /**< There are too many aliases in the path to the requested resource. It is very possible that a circular alias definition has occured */ U_ENUM_OUT_OF_SYNC_ERROR = 25, /**< UEnumeration out of sync with underlying collection */ U_INVARIANT_CONVERSION_ERROR = 26, /**< Unable to convert a UChar* string to char* with the invariant converter. */ U_INVALID_STATE_ERROR = 27, /**< Requested operation can not be completed with ICU in its current state */ U_COLLATOR_VERSION_MISMATCH = 28, /**< Collator version is not compatible with the base version */ U_USELESS_COLLATOR_ERROR = 29, /**< Collator is options only and no base is specified */ U_NO_WRITE_PERMISSION = 30, /**< Attempt to modify read-only or constant data. */ U_STANDARD_ERROR_LIMIT, /**< This must always be the last value to indicate the limit for standard errors */ /* * the error code range 0x10000 0x10100 are reserved for Transliterator */ U_BAD_VARIABLE_DEFINITION=0x10000,/**< Missing '$' or duplicate variable name */ U_PARSE_ERROR_START = 0x10000, /**< Start of Transliterator errors */ U_MALFORMED_RULE, /**< Elements of a rule are misplaced */ U_MALFORMED_SET, /**< A UnicodeSet pattern is invalid*/ U_MALFORMED_SYMBOL_REFERENCE, /**< UNUSED as of ICU 2.4 */ U_MALFORMED_UNICODE_ESCAPE, /**< A Unicode escape pattern is invalid*/ U_MALFORMED_VARIABLE_DEFINITION, /**< A variable definition is invalid */ U_MALFORMED_VARIABLE_REFERENCE, /**< A variable reference is invalid */ U_MISMATCHED_SEGMENT_DELIMITERS, /**< UNUSED as of ICU 2.4 */ U_MISPLACED_ANCHOR_START, /**< A start anchor appears at an illegal position */ U_MISPLACED_CURSOR_OFFSET, /**< A cursor offset occurs at an illegal position */ U_MISPLACED_QUANTIFIER, /**< A quantifier appears after a segment close delimiter */ U_MISSING_OPERATOR, /**< A rule contains no operator */ U_MISSING_SEGMENT_CLOSE, /**< UNUSED as of ICU 2.4 */ U_MULTIPLE_ANTE_CONTEXTS, /**< More than one ante context */ U_MULTIPLE_CURSORS, /**< More than one cursor */ U_MULTIPLE_POST_CONTEXTS, /**< More than one post context */ U_TRAILING_BACKSLASH, /**< A dangling backslash */ U_UNDEFINED_SEGMENT_REFERENCE, /**< A segment reference does not correspond to a defined segment */ U_UNDEFINED_VARIABLE, /**< A variable reference does not correspond to a defined variable */ U_UNQUOTED_SPECIAL, /**< A special character was not quoted or escaped */ U_UNTERMINATED_QUOTE, /**< A closing single quote is missing */ U_RULE_MASK_ERROR, /**< A rule is hidden by an earlier more general rule */ U_MISPLACED_COMPOUND_FILTER, /**< A compound filter is in an invalid location */ U_MULTIPLE_COMPOUND_FILTERS, /**< More than one compound filter */ U_INVALID_RBT_SYNTAX, /**< A "::id" rule was passed to the RuleBasedTransliterator parser */ U_INVALID_PROPERTY_PATTERN, /**< UNUSED as of ICU 2.4 */ U_MALFORMED_PRAGMA, /**< A 'use' pragma is invlalid */ U_UNCLOSED_SEGMENT, /**< A closing ')' is missing */ U_ILLEGAL_CHAR_IN_SEGMENT, /**< UNUSED as of ICU 2.4 */ U_VARIABLE_RANGE_EXHAUSTED, /**< Too many stand-ins generated for the given variable range */ U_VARIABLE_RANGE_OVERLAP, /**< The variable range overlaps characters used in rules */ U_ILLEGAL_CHARACTER, /**< A special character is outside its allowed context */ U_INTERNAL_TRANSLITERATOR_ERROR, /**< Internal transliterator system error */ U_INVALID_ID, /**< A "::id" rule specifies an unknown transliterator */ U_INVALID_FUNCTION, /**< A "&fn()" rule specifies an unknown transliterator */ U_PARSE_ERROR_LIMIT, /**< The limit for Transliterator errors */ /* * the error code range 0x10100 0x10200 are reserved for formatting API parsing error */ U_UNEXPECTED_TOKEN=0x10100, /**< Syntax error in format pattern */ U_FMT_PARSE_ERROR_START=0x10100, /**< Start of format library errors */ U_MULTIPLE_DECIMAL_SEPARATORS, /**< More than one decimal separator in number pattern */ U_MULTIPLE_DECIMAL_SEPERATORS = U_MULTIPLE_DECIMAL_SEPARATORS, /**< Typo: kept for backward compatibility. Use U_MULTIPLE_DECIMAL_SEPARATORS */ U_MULTIPLE_EXPONENTIAL_SYMBOLS, /**< More than one exponent symbol in number pattern */ U_MALFORMED_EXPONENTIAL_PATTERN, /**< Grouping symbol in exponent pattern */ U_MULTIPLE_PERCENT_SYMBOLS, /**< More than one percent symbol in number pattern */ U_MULTIPLE_PERMILL_SYMBOLS, /**< More than one permill symbol in number pattern */ U_MULTIPLE_PAD_SPECIFIERS, /**< More than one pad symbol in number pattern */ U_PATTERN_SYNTAX_ERROR, /**< Syntax error in format pattern */ U_ILLEGAL_PAD_POSITION, /**< Pad symbol misplaced in number pattern */ U_UNMATCHED_BRACES, /**< Braces do not match in message pattern */ U_UNSUPPORTED_PROPERTY, /**< UNUSED as of ICU 2.4 */ U_UNSUPPORTED_ATTRIBUTE, /**< UNUSED as of ICU 2.4 */ U_ARGUMENT_TYPE_MISMATCH, /**< Argument name and argument index mismatch in MessageFormat functions */ U_DUPLICATE_KEYWORD, /**< Duplicate keyword in PluralFormat */ U_UNDEFINED_KEYWORD, /**< Undefined Plural keyword */ U_DEFAULT_KEYWORD_MISSING, /**< Missing DEFAULT rule in plural rules */ U_DECIMAL_NUMBER_SYNTAX_ERROR, /**< Decimal number syntax error */ U_FMT_PARSE_ERROR_LIMIT, /**< The limit for format library errors */ /* * the error code range 0x10200 0x102ff are reserved for Break Iterator related error */ U_BRK_INTERNAL_ERROR=0x10200, /**< An internal error (bug) was detected. */ U_BRK_ERROR_START=0x10200, /**< Start of codes indicating Break Iterator failures */ U_BRK_HEX_DIGITS_EXPECTED, /**< Hex digits expected as part of a escaped char in a rule. */ U_BRK_SEMICOLON_EXPECTED, /**< Missing ';' at the end of a RBBI rule. */ U_BRK_RULE_SYNTAX, /**< Syntax error in RBBI rule. */ U_BRK_UNCLOSED_SET, /**< UnicodeSet witing an RBBI rule missing a closing ']'. */ U_BRK_ASSIGN_ERROR, /**< Syntax error in RBBI rule assignment statement. */ U_BRK_VARIABLE_REDFINITION, /**< RBBI rule $Variable redefined. */ U_BRK_MISMATCHED_PAREN, /**< Mis-matched parentheses in an RBBI rule. */ U_BRK_NEW_LINE_IN_QUOTED_STRING, /**< Missing closing quote in an RBBI rule. */ U_BRK_UNDEFINED_VARIABLE, /**< Use of an undefined $Variable in an RBBI rule. */ U_BRK_INIT_ERROR, /**< Initialization failure. Probable missing ICU Data. */ U_BRK_RULE_EMPTY_SET, /**< Rule contains an empty Unicode Set. */ U_BRK_UNRECOGNIZED_OPTION, /**< !!option in RBBI rules not recognized. */ U_BRK_MALFORMED_RULE_TAG, /**< The {nnn} tag on a rule is mal formed */ U_BRK_ERROR_LIMIT, /**< This must always be the last value to indicate the limit for Break Iterator failures */ /* * The error codes in the range 0x10300-0x103ff are reserved for regular expression related errrs */ U_REGEX_INTERNAL_ERROR=0x10300, /**< An internal error (bug) was detected. */ U_REGEX_ERROR_START=0x10300, /**< Start of codes indicating Regexp failures */ U_REGEX_RULE_SYNTAX, /**< Syntax error in regexp pattern. */ U_REGEX_INVALID_STATE, /**< RegexMatcher in invalid state for requested operation */ U_REGEX_BAD_ESCAPE_SEQUENCE, /**< Unrecognized backslash escape sequence in pattern */ U_REGEX_PROPERTY_SYNTAX, /**< Incorrect Unicode property */ U_REGEX_UNIMPLEMENTED, /**< Use of regexp feature that is not yet implemented. */ U_REGEX_MISMATCHED_PAREN, /**< Incorrectly nested parentheses in regexp pattern. */ U_REGEX_NUMBER_TOO_BIG, /**< Decimal number is too large. */ U_REGEX_BAD_INTERVAL, /**< Error in {min,max} interval */ U_REGEX_MAX_LT_MIN, /**< In {min,max}, max is less than min. */ U_REGEX_INVALID_BACK_REF, /**< Back-reference to a non-existent capture group. */ U_REGEX_INVALID_FLAG, /**< Invalid value for match mode flags. */ U_REGEX_LOOK_BEHIND_LIMIT, /**< Look-Behind pattern matches must have a bounded maximum length. */ U_REGEX_SET_CONTAINS_STRING, /**< Regexps cannot have UnicodeSets containing strings.*/ U_REGEX_OCTAL_TOO_BIG, /**< Octal character constants must be <= 0377. */ U_REGEX_MISSING_CLOSE_BRACKET, /**< Missing closing bracket on a bracket expression. */ U_REGEX_INVALID_RANGE, /**< In a character range [x-y], x is greater than y. */ U_REGEX_STACK_OVERFLOW, /**< Regular expression backtrack stack overflow. */ U_REGEX_TIME_OUT, /**< Maximum allowed match time exceeded */ U_REGEX_STOPPED_BY_CALLER, /**< Matching operation aborted by user callback fn. */ U_REGEX_ERROR_LIMIT, /**< This must always be the last value to indicate the limit for regexp errors */ /* * The error code in the range 0x10400-0x104ff are reserved for IDNA related error codes */ U_IDNA_PROHIBITED_ERROR=0x10400, U_IDNA_ERROR_START=0x10400, U_IDNA_UNASSIGNED_ERROR, U_IDNA_CHECK_BIDI_ERROR, U_IDNA_STD3_ASCII_RULES_ERROR, U_IDNA_ACE_PREFIX_ERROR, U_IDNA_VERIFICATION_ERROR, U_IDNA_LABEL_TOO_LONG_ERROR, U_IDNA_ZERO_LENGTH_LABEL_ERROR, U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR, U_IDNA_ERROR_LIMIT, /* * Aliases for StringPrep */ U_STRINGPREP_PROHIBITED_ERROR = U_IDNA_PROHIBITED_ERROR, U_STRINGPREP_UNASSIGNED_ERROR = U_IDNA_UNASSIGNED_ERROR, U_STRINGPREP_CHECK_BIDI_ERROR = U_IDNA_CHECK_BIDI_ERROR, /* * The error code in the range 0x10500-0x105ff are reserved for Plugin related error codes */ U_PLUGIN_ERROR_START=0x10500, /**< Start of codes indicating plugin failures */ U_PLUGIN_TOO_HIGH=0x10500, /**< The plugin's level is too high to be loaded right now. */ U_PLUGIN_DIDNT_SET_LEVEL, /**< The plugin didn't call uplug_setPlugLevel in response to a QUERY */ U_PLUGIN_ERROR_LIMIT, /**< This must always be the last value to indicate the limit for plugin errors */ U_ERROR_LIMIT=U_PLUGIN_ERROR_LIMIT /**< This must always be the last value to indicate the limit for UErrorCode (last error code +1) */ } UErrorCode; /* Use the following to determine if an UErrorCode represents */ /* operational success or failure. */ #ifdef XP_CPLUSPLUS /** * Does the error code indicate success? * @stable ICU 2.0 */ static inline UBool U_SUCCESS(UErrorCode code) { return (UBool)(code<=U_ZERO_ERROR); } /** * Does the error code indicate a failure? * @stable ICU 2.0 */ static inline UBool U_FAILURE(UErrorCode code) { return (UBool)(code>U_ZERO_ERROR); } #else /** * Does the error code indicate success? * @stable ICU 2.0 */ # define U_SUCCESS(x) ((x)<=U_ZERO_ERROR) /** * Does the error code indicate a failure? * @stable ICU 2.0 */ # define U_FAILURE(x) ((x)>U_ZERO_ERROR) #endif /** * Return a string for a UErrorCode value. * The string will be the same as the name of the error code constant * in the UErrorCode enum above. * @stable ICU 2.0 */ U_STABLE const char * U_EXPORT2 u_errorName(UErrorCode code); #endif /* _UTYPES */ android-audiosystem-1.8+13.10.20130807/include/unicode/uenum.h0000644000015700001700000001412412200324306024247 0ustar pbuserpbgroup00000000000000/* ******************************************************************************* * * Copyright (C) 2002-2010, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: uenum.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:2 * * created on: 2002jul08 * created by: Vladimir Weinstein */ #ifndef __UENUM_H #define __UENUM_H #include "unicode/utypes.h" #include "unicode/localpointer.h" #if U_SHOW_CPLUSPLUS_API #include "unicode/strenum.h" #endif /** * \file * \brief C API: String Enumeration */ /** * An enumeration object. * For usage in C programs. * @stable ICU 2.2 */ struct UEnumeration; /** structure representing an enumeration object instance @stable ICU 2.2 */ typedef struct UEnumeration UEnumeration; /** * Disposes of resources in use by the iterator. If en is NULL, * does nothing. After this call, any char* or UChar* pointer * returned by uenum_unext() or uenum_next() is invalid. * @param en UEnumeration structure pointer * @stable ICU 2.2 */ U_STABLE void U_EXPORT2 uenum_close(UEnumeration* en); #if U_SHOW_CPLUSPLUS_API U_NAMESPACE_BEGIN /** * \class LocalUEnumerationPointer * "Smart pointer" class, closes a UEnumeration via uenum_close(). * For most methods see the LocalPointerBase base class. * * @see LocalPointerBase * @see LocalPointer * @stable ICU 4.4 */ U_DEFINE_LOCAL_OPEN_POINTER(LocalUEnumerationPointer, UEnumeration, uenum_close); U_NAMESPACE_END #endif /** * Returns the number of elements that the iterator traverses. If * the iterator is out-of-sync with its service, status is set to * U_ENUM_OUT_OF_SYNC_ERROR. * This is a convenience function. It can end up being very * expensive as all the items might have to be pre-fetched (depending * on the type of data being traversed). Use with caution and only * when necessary. * @param en UEnumeration structure pointer * @param status error code, can be U_ENUM_OUT_OF_SYNC_ERROR if the * iterator is out of sync. * @return number of elements in the iterator * @stable ICU 2.2 */ U_STABLE int32_t U_EXPORT2 uenum_count(UEnumeration* en, UErrorCode* status); /** * Returns the next element in the iterator's list. If there are * no more elements, returns NULL. If the iterator is out-of-sync * with its service, status is set to U_ENUM_OUT_OF_SYNC_ERROR and * NULL is returned. If the native service string is a char* string, * it is converted to UChar* with the invariant converter. * The result is terminated by (UChar)0. * @param en the iterator object * @param resultLength pointer to receive the length of the result * (not including the terminating \\0). * If the pointer is NULL it is ignored. * @param status the error code, set to U_ENUM_OUT_OF_SYNC_ERROR if * the iterator is out of sync with its service. * @return a pointer to the string. The string will be * zero-terminated. The return pointer is owned by this iterator * and must not be deleted by the caller. The pointer is valid * until the next call to any uenum_... method, including * uenum_next() or uenum_unext(). When all strings have been * traversed, returns NULL. * @stable ICU 2.2 */ U_STABLE const UChar* U_EXPORT2 uenum_unext(UEnumeration* en, int32_t* resultLength, UErrorCode* status); /** * Returns the next element in the iterator's list. If there are * no more elements, returns NULL. If the iterator is out-of-sync * with its service, status is set to U_ENUM_OUT_OF_SYNC_ERROR and * NULL is returned. If the native service string is a UChar* * string, it is converted to char* with the invariant converter. * The result is terminated by (char)0. If the conversion fails * (because a character cannot be converted) then status is set to * U_INVARIANT_CONVERSION_ERROR and the return value is undefined * (but non-NULL). * @param en the iterator object * @param resultLength pointer to receive the length of the result * (not including the terminating \\0). * If the pointer is NULL it is ignored. * @param status the error code, set to U_ENUM_OUT_OF_SYNC_ERROR if * the iterator is out of sync with its service. Set to * U_INVARIANT_CONVERSION_ERROR if the underlying native string is * UChar* and conversion to char* with the invariant converter * fails. This error pertains only to current string, so iteration * might be able to continue successfully. * @return a pointer to the string. The string will be * zero-terminated. The return pointer is owned by this iterator * and must not be deleted by the caller. The pointer is valid * until the next call to any uenum_... method, including * uenum_next() or uenum_unext(). When all strings have been * traversed, returns NULL. * @stable ICU 2.2 */ U_STABLE const char* U_EXPORT2 uenum_next(UEnumeration* en, int32_t* resultLength, UErrorCode* status); /** * Resets the iterator to the current list of service IDs. This * re-establishes sync with the service and rewinds the iterator * to start at the first element. * @param en the iterator object * @param status the error code, set to U_ENUM_OUT_OF_SYNC_ERROR if * the iterator is out of sync with its service. * @stable ICU 2.2 */ U_STABLE void U_EXPORT2 uenum_reset(UEnumeration* en, UErrorCode* status); #if U_SHOW_CPLUSPLUS_API /** * Given a StringEnumeration, wrap it in a UEnumeration. The * StringEnumeration is adopted; after this call, the caller must not * delete it (regardless of error status). * @param adopted the C++ StringEnumeration to be wrapped in a UEnumeration. * @param ec the error code. * @return a UEnumeration wrapping the adopted StringEnumeration. * @draft ICU 4.2 */ U_CAPI UEnumeration* U_EXPORT2 uenum_openFromStringEnumeration(U_NAMESPACE_QUALIFIER StringEnumeration* adopted, UErrorCode* ec); #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/0000755000015700001700000000000012200324404022453 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/linux/dma-mapping.h0000644000015700001700000000317012200324306025020 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _ASM_LINUX_DMA_MAPPING_H #define _ASM_LINUX_DMA_MAPPING_H #include #include enum dma_data_direction { DMA_BIDIRECTIONAL = 0, DMA_TO_DEVICE = 1, DMA_FROM_DEVICE = 2, DMA_NONE = 3, }; #define DMA_64BIT_MASK 0xffffffffffffffffULL #define DMA_48BIT_MASK 0x0000ffffffffffffULL #define DMA_40BIT_MASK 0x000000ffffffffffULL #define DMA_39BIT_MASK 0x0000007fffffffffULL #define DMA_32BIT_MASK 0x00000000ffffffffULL #define DMA_31BIT_MASK 0x000000007fffffffULL #define DMA_30BIT_MASK 0x000000003fffffffULL #define DMA_29BIT_MASK 0x000000001fffffffULL #define DMA_28BIT_MASK 0x000000000fffffffULL #define DMA_24BIT_MASK 0x0000000000ffffffULL #include #define dma_sync_single dma_sync_single_for_cpu #define dma_sync_sg dma_sync_sg_for_cpu #define DMA_MEMORY_MAP 0x01 #define DMA_MEMORY_IO 0x02 #define DMA_MEMORY_INCLUDES_CHILDREN 0x04 #define DMA_MEMORY_EXCLUSIVE 0x08 #ifndef ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/clk.h0000644000015700001700000000152412200324306023400 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_CLK_H #define __LINUX_CLK_H struct device; struct clk; struct clk *clk_get(struct device *dev, const char *id); struct clk *clk_get_parent(struct clk *clk); #endif android-audiosystem-1.8+13.10.20130807/include/linux/plist.h0000644000015700001700000000344012200324306023761 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_PLIST_H_ #define _LINUX_PLIST_H_ #include #include #include struct plist_head { struct list_head prio_list; struct list_head node_list; }; struct plist_node { int prio; struct plist_head plist; }; #define PLIST_HEAD_LOCK_INIT(_lock) #define PLIST_HEAD_INIT(head, _lock) { .prio_list = LIST_HEAD_INIT((head).prio_list), .node_list = LIST_HEAD_INIT((head).node_list), PLIST_HEAD_LOCK_INIT(&(_lock)) } #define PLIST_NODE_INIT(node, __prio) { .prio = (__prio), .plist = PLIST_HEAD_INIT((node).plist, NULL), } #define plist_for_each(pos, head) list_for_each_entry(pos, &(head)->node_list, plist.node_list) #define plist_for_each_safe(pos, n, head) list_for_each_entry_safe(pos, n, &(head)->node_list, plist.node_list) #define plist_for_each_entry(pos, head, mem) list_for_each_entry(pos, &(head)->node_list, mem.plist.node_list) #define plist_for_each_entry_safe(pos, n, head, m) list_for_each_entry_safe(pos, n, &(head)->node_list, m.plist.node_list) #define plist_first_entry(head, type, member) container_of(plist_first(head), type, member) #endif android-audiosystem-1.8+13.10.20130807/include/linux/mmc/0000755000015700001700000000000012200324404023227 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/linux/mmc/mmc.h0000644000015700001700000000505212200324306024157 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef MMC_H #define MMC_H #include #include #include struct request; struct mmc_data; struct mmc_request; struct mmc_command { u32 opcode; u32 arg; u32 resp[4]; unsigned int flags; #define MMC_RSP_PRESENT (1 << 0) #define MMC_RSP_136 (1 << 1) #define MMC_RSP_CRC (1 << 2) #define MMC_RSP_BUSY (1 << 3) #define MMC_RSP_OPCODE (1 << 4) #define MMC_CMD_MASK (3 << 5) #define MMC_CMD_AC (0 << 5) #define MMC_CMD_ADTC (1 << 5) #define MMC_CMD_BC (2 << 5) #define MMC_CMD_BCR (3 << 5) #define MMC_RSP_NONE (0) #define MMC_RSP_R1 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE) #define MMC_RSP_R1B (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE|MMC_RSP_BUSY) #define MMC_RSP_R2 (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC) #define MMC_RSP_R3 (MMC_RSP_PRESENT) #define MMC_RSP_R6 (MMC_RSP_PRESENT|MMC_RSP_CRC) #define mmc_resp_type(cmd) ((cmd)->flags & (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC|MMC_RSP_BUSY|MMC_RSP_OPCODE)) #define mmc_cmd_type(cmd) ((cmd)->flags & MMC_CMD_MASK) unsigned int retries; unsigned int error; #define MMC_ERR_NONE 0 #define MMC_ERR_TIMEOUT 1 #define MMC_ERR_BADCRC 2 #define MMC_ERR_FIFO 3 #define MMC_ERR_FAILED 4 #define MMC_ERR_INVALID 5 struct mmc_data *data; struct mmc_request *mrq; }; struct mmc_data { unsigned int timeout_ns; unsigned int timeout_clks; unsigned int blksz_bits; unsigned int blksz; unsigned int blocks; unsigned int error; unsigned int flags; #define MMC_DATA_WRITE (1 << 8) #define MMC_DATA_READ (1 << 9) #define MMC_DATA_STREAM (1 << 10) #define MMC_DATA_MULTI (1 << 11) unsigned int bytes_xfered; struct mmc_command *stop; struct mmc_request *mrq; unsigned int sg_len; struct scatterlist *sg; }; struct mmc_request { struct mmc_command *cmd; struct mmc_data *data; struct mmc_command *stop; void *done_data; void (*done)(struct mmc_request *); }; struct mmc_host; struct mmc_card; #endif android-audiosystem-1.8+13.10.20130807/include/linux/mmc/host.h0000644000015700001700000000524312200324306024362 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef LINUX_MMC_HOST_H #define LINUX_MMC_HOST_H #include struct mmc_ios { unsigned int clock; unsigned short vdd; #define MMC_VDD_150 0 #define MMC_VDD_155 1 #define MMC_VDD_160 2 #define MMC_VDD_165 3 #define MMC_VDD_170 4 #define MMC_VDD_180 5 #define MMC_VDD_190 6 #define MMC_VDD_200 7 #define MMC_VDD_210 8 #define MMC_VDD_220 9 #define MMC_VDD_230 10 #define MMC_VDD_240 11 #define MMC_VDD_250 12 #define MMC_VDD_260 13 #define MMC_VDD_270 14 #define MMC_VDD_280 15 #define MMC_VDD_290 16 #define MMC_VDD_300 17 #define MMC_VDD_310 18 #define MMC_VDD_320 19 #define MMC_VDD_330 20 #define MMC_VDD_340 21 #define MMC_VDD_350 22 #define MMC_VDD_360 23 unsigned char bus_mode; #define MMC_BUSMODE_OPENDRAIN 1 #define MMC_BUSMODE_PUSHPULL 2 unsigned char chip_select; #define MMC_CS_DONTCARE 0 #define MMC_CS_HIGH 1 #define MMC_CS_LOW 2 unsigned char power_mode; #define MMC_POWER_OFF 0 #define MMC_POWER_UP 1 #define MMC_POWER_ON 2 unsigned char bus_width; #define MMC_BUS_WIDTH_1 0 #define MMC_BUS_WIDTH_4 2 }; struct mmc_host_ops { void (*request)(struct mmc_host *host, struct mmc_request *req); void (*set_ios)(struct mmc_host *host, struct mmc_ios *ios); int (*get_ro)(struct mmc_host *host); }; struct mmc_card; struct device; struct mmc_host { struct device *dev; struct class_device class_dev; int index; const struct mmc_host_ops *ops; unsigned int f_min; unsigned int f_max; u32 ocr_avail; unsigned long caps; #define MMC_CAP_4_BIT_DATA (1 << 0) unsigned int max_seg_size; unsigned short max_hw_segs; unsigned short max_phys_segs; unsigned short max_sectors; unsigned short unused; struct mmc_ios ios; u32 ocr; unsigned int mode; #define MMC_MODE_MMC 0 #define MMC_MODE_SD 1 struct list_head cards; wait_queue_head_t wq; spinlock_t lock; struct mmc_card *card_busy; struct mmc_card *card_selected; struct work_struct detect; unsigned long private[0] ____cacheline_aligned; }; #define mmc_dev(x) ((x)->dev) #define mmc_hostname(x) ((x)->class_dev.class_id) #endif android-audiosystem-1.8+13.10.20130807/include/linux/mmc/card.h0000644000015700001700000000565712200324306024327 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef LINUX_MMC_CARD_H #define LINUX_MMC_CARD_H #include struct mmc_cid { unsigned int manfid; char prod_name[8]; unsigned int serial; unsigned short oemid; unsigned short year; unsigned char hwrev; unsigned char fwrev; unsigned char month; }; struct mmc_csd { unsigned char mmca_vsn; unsigned short cmdclass; unsigned short tacc_clks; unsigned int tacc_ns; unsigned int r2w_factor; unsigned int max_dtr; unsigned int read_blkbits; unsigned int write_blkbits; unsigned int capacity; unsigned int read_partial:1, read_misalign:1, write_partial:1, write_misalign:1; }; struct sd_scr { unsigned char sda_vsn; unsigned char bus_widths; #define SD_SCR_BUS_WIDTH_1 (1<<0) #define SD_SCR_BUS_WIDTH_4 (1<<2) }; struct mmc_host; struct mmc_card { struct list_head node; struct mmc_host *host; struct device dev; unsigned int rca; unsigned int state; #define MMC_STATE_PRESENT (1<<0) #define MMC_STATE_DEAD (1<<1) #define MMC_STATE_BAD (1<<2) #define MMC_STATE_SDCARD (1<<3) #define MMC_STATE_READONLY (1<<4) u32 raw_cid[4]; u32 raw_csd[4]; u32 raw_scr[2]; struct mmc_cid cid; struct mmc_csd csd; struct sd_scr scr; }; #define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) #define mmc_card_dead(c) ((c)->state & MMC_STATE_DEAD) #define mmc_card_bad(c) ((c)->state & MMC_STATE_BAD) #define mmc_card_sd(c) ((c)->state & MMC_STATE_SDCARD) #define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY) #define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) #define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD) #define mmc_card_set_bad(c) ((c)->state |= MMC_STATE_BAD) #define mmc_card_set_sd(c) ((c)->state |= MMC_STATE_SDCARD) #define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) #define mmc_card_name(c) ((c)->cid.prod_name) #define mmc_card_id(c) ((c)->dev.bus_id) #define mmc_list_to_card(l) container_of(l, struct mmc_card, node) #define mmc_get_drvdata(c) dev_get_drvdata(&(c)->dev) #define mmc_set_drvdata(c,d) dev_set_drvdata(&(c)->dev, d) struct mmc_driver { struct device_driver drv; int (*probe)(struct mmc_card *); void (*remove)(struct mmc_card *); int (*suspend)(struct mmc_card *, pm_message_t); int (*resume)(struct mmc_card *); }; #define mmc_card_release_host(c) mmc_release_host((c)->host) #endif android-audiosystem-1.8+13.10.20130807/include/linux/klist.h0000644000015700001700000000227412200324306023760 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_KLIST_H #define _LINUX_KLIST_H #include #include #include #include struct klist_node; struct klist { spinlock_t k_lock; struct list_head k_list; void (*get)(struct klist_node *); void (*put)(struct klist_node *); }; struct klist_node { struct klist * n_klist; struct list_head n_node; struct kref n_ref; struct completion n_removed; }; struct klist_iter { struct klist * i_klist; struct list_head * i_head; struct klist_node * i_cur; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/msm_adsp.h0000644000015700001700000000350512200324306024433 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_MSM_ADSP_H #define __LINUX_MSM_ADSP_H #include #include #define ADSP_IOCTL_MAGIC 'q' struct adsp_command_t { uint16_t queue; uint32_t len; uint8_t *data; }; struct adsp_event_t { uint16_t type; uint32_t timeout_ms; uint16_t msg_id; uint16_t flags; uint32_t len; uint8_t *data; }; #define ADSP_IOCTL_ENABLE _IOR(ADSP_IOCTL_MAGIC, 1, unsigned) #define ADSP_IOCTL_DISABLE _IOR(ADSP_IOCTL_MAGIC, 2, unsigned) #define ADSP_IOCTL_DISABLE_ACK _IOR(ADSP_IOCTL_MAGIC, 3, unsigned) #define ADSP_IOCTL_WRITE_COMMAND _IOR(ADSP_IOCTL_MAGIC, 4, struct adsp_command_t *) #define ADSP_IOCTL_GET_EVENT _IOWR(ADSP_IOCTL_MAGIC, 5, struct adsp_event_data_t *) #define ADSP_IOCTL_SET_CLKRATE _IOR(ADSP_IOCTL_MAGIC, 6, unsigned) #define ADSP_IOCTL_DISABLE_EVENT_RSP _IOR(ADSP_IOCTL_MAGIC, 10, unsigned) struct adsp_pmem_info { int fd; void *vaddr; }; #define ADSP_IOCTL_REGISTER_PMEM _IOW(ADSP_IOCTL_MAGIC, 13, unsigned) #define ADSP_IOCTL_UNREGISTER_PMEM _IOW(ADSP_IOCTL_MAGIC, 14, unsigned) #define ADSP_IOCTL_ABORT_EVENT_READ _IOW(ADSP_IOCTL_MAGIC, 15, unsigned) #define ADSP_IOCTL_LINK_TASK _IOW(ADSP_IOCTL_MAGIC, 16, unsigned) #endif android-audiosystem-1.8+13.10.20130807/include/linux/vmalloc.h0000644000015700001700000000227312200324306024266 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_VMALLOC_H #define _LINUX_VMALLOC_H #include #include struct vm_area_struct; #define VM_IOREMAP 0x00000001 #define VM_ALLOC 0x00000002 #define VM_MAP 0x00000004 #define VM_USERMAP 0x00000008 #define VM_VPAGES 0x00000010 #ifndef IOREMAP_MAX_ORDER #define IOREMAP_MAX_ORDER (7 + PAGE_SHIFT) #endif struct vm_struct { void *addr; unsigned long size; unsigned long flags; struct page **pages; unsigned int nr_pages; unsigned long phys_addr; struct vm_struct *next; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/zconf.h0000644000015700001700000000205512200324306023746 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _ZCONF_H #define _ZCONF_H #ifndef MAX_MEM_LEVEL #define MAX_MEM_LEVEL 8 #endif #ifndef MAX_WBITS #define MAX_WBITS 15 #endif #ifndef DEF_WBITS #define DEF_WBITS MAX_WBITS #endif #if MAX_MEM_LEVEL >= 8 #define DEF_MEM_LEVEL 8 #else #define DEF_MEM_LEVEL MAX_MEM_LEVEL #endif typedef unsigned char Byte; typedef unsigned int uInt; typedef unsigned long uLong; typedef void *voidp; #endif android-audiosystem-1.8+13.10.20130807/include/linux/ufs_fs_i.h0000644000015700001700000000200412200324306024416 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_UFS_FS_I_H #define _LINUX_UFS_FS_I_H struct ufs_inode_info { union { __fs32 i_data[15]; __u8 i_symlink[4*15]; __fs64 u2_i_data[15]; } i_u1; __u32 i_flags; __u32 i_gen; __u32 i_shadow; __u32 i_unused1; __u32 i_unused2; __u32 i_oeftflag; __u16 i_osync; __u32 i_lastfrag; __u32 i_dir_start_lookup; struct inode vfs_inode; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/lightsensor.h0000644000015700001700000000172012200324306025166 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_LIGHTSENSOR_H #define __LINUX_LIGHTSENSOR_H #include #include #define LIGHTSENSOR_IOCTL_MAGIC 'l' #define LIGHTSENSOR_IOCTL_GET_ENABLED _IOR(LIGHTSENSOR_IOCTL_MAGIC, 1, int *) #define LIGHTSENSOR_IOCTL_ENABLE _IOW(LIGHTSENSOR_IOCTL_MAGIC, 2, int *) #endif android-audiosystem-1.8+13.10.20130807/include/linux/ncp_mount.h0000644000015700001700000000335112200324306024631 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_NCP_MOUNT_H #define _LINUX_NCP_MOUNT_H #include #include #define NCP_MOUNT_VERSION 3 #define NCP_MOUNT_SOFT 0x0001 #define NCP_MOUNT_INTR 0x0002 #define NCP_MOUNT_STRONG 0x0004 #define NCP_MOUNT_NO_OS2 0x0008 #define NCP_MOUNT_NO_NFS 0x0010 #define NCP_MOUNT_EXTRAS 0x0020 #define NCP_MOUNT_SYMLINKS 0x0040 #define NCP_MOUNT_NFS_EXTRAS 0x0080 struct ncp_mount_data { int version; unsigned int ncp_fd; __kernel_uid_t mounted_uid; __kernel_pid_t wdog_pid; unsigned char mounted_vol[NCP_VOLNAME_LEN + 1]; unsigned int time_out; unsigned int retry_count; unsigned int flags; __kernel_uid_t uid; __kernel_gid_t gid; __kernel_mode_t file_mode; __kernel_mode_t dir_mode; }; #define NCP_MOUNT_VERSION_V4 (4) struct ncp_mount_data_v4 { int version; unsigned long flags; unsigned long mounted_uid; long wdog_pid; unsigned int ncp_fd; unsigned int time_out; unsigned int retry_count; unsigned long uid; unsigned long gid; unsigned long file_mode; unsigned long dir_mode; }; #define NCP_MOUNT_VERSION_V5 (5) #endif android-audiosystem-1.8+13.10.20130807/include/linux/vt_buffer.h0000644000015700001700000000211312200324306024604 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_VT_BUFFER_H_ #define _LINUX_VT_BUFFER_H_ #ifndef VT_BUF_HAVE_RW #define scr_writew(val, addr) (*(addr) = (val)) #define scr_readw(addr) (*(addr)) #define scr_memcpyw(d, s, c) memcpy(d, s, c) #define scr_memmovew(d, s, c) memmove(d, s, c) #define VT_BUF_HAVE_MEMCPYW #define VT_BUF_HAVE_MEMMOVEW #endif #ifndef VT_BUF_HAVE_MEMSETW #endif #ifndef VT_BUF_HAVE_MEMCPYW #endif #ifndef VT_BUF_HAVE_MEMMOVEW #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/mtd/0000755000015700001700000000000012200324404023237 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/linux/mtd/blktrans.h0000644000015700001700000000333412200324306025234 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __MTD_TRANS_H__ #define __MTD_TRANS_H__ #include struct hd_geometry; struct mtd_info; struct mtd_blktrans_ops; struct file; struct inode; struct mtd_blktrans_dev { struct mtd_blktrans_ops *tr; struct list_head list; struct mtd_info *mtd; struct mutex lock; int devnum; int blksize; unsigned long size; int readonly; void *blkcore_priv; }; struct blkcore_priv; struct mtd_blktrans_ops { char *name; int major; int part_bits; int (*readsect)(struct mtd_blktrans_dev *dev, unsigned long block, char *buffer); int (*writesect)(struct mtd_blktrans_dev *dev, unsigned long block, char *buffer); int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo); int (*flush)(struct mtd_blktrans_dev *dev); int (*open)(struct mtd_blktrans_dev *dev); int (*release)(struct mtd_blktrans_dev *dev); void (*add_mtd)(struct mtd_blktrans_ops *tr, struct mtd_info *mtd); void (*remove_dev)(struct mtd_blktrans_dev *dev); struct list_head devs; struct list_head list; struct module *owner; struct mtd_blkcore_priv *blkcore_priv; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/mtd/partitions.h0000644000015700001700000000234212200324306025606 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef MTD_PARTITIONS_H #define MTD_PARTITIONS_H #include struct mtd_partition { char *name; u_int32_t size; u_int32_t offset; u_int32_t mask_flags; struct nand_ecclayout *ecclayout; struct mtd_info **mtdp; }; #define MTDPART_OFS_NXTBLK (-2) #define MTDPART_OFS_APPEND (-1) #define MTDPART_SIZ_FULL (0) struct mtd_part_parser { struct list_head list; struct module *owner; const char *name; int (*parse_fn)(struct mtd_info *, struct mtd_partition **, unsigned long); }; #define put_partition_parser(p) do { module_put((p)->owner); } while(0) #endif android-audiosystem-1.8+13.10.20130807/include/linux/mtd/cfi_endian.h0000644000015700001700000000316412200324306025474 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #include #define CFI_HOST_ENDIAN #ifdef CFI_LITTLE_ENDIAN #define cpu_to_cfi8(x) (x) #define cfi8_to_cpu(x) (x) #define cpu_to_cfi16(x) cpu_to_le16(x) #define cpu_to_cfi32(x) cpu_to_le32(x) #define cpu_to_cfi64(x) cpu_to_le64(x) #define cfi16_to_cpu(x) le16_to_cpu(x) #define cfi32_to_cpu(x) le32_to_cpu(x) #define cfi64_to_cpu(x) le64_to_cpu(x) #elif defined (CFI_BIG_ENDIAN) #define cpu_to_cfi8(x) (x) #define cfi8_to_cpu(x) (x) #define cpu_to_cfi16(x) cpu_to_be16(x) #define cpu_to_cfi32(x) cpu_to_be32(x) #define cpu_to_cfi64(x) cpu_to_be64(x) #define cfi16_to_cpu(x) be16_to_cpu(x) #define cfi32_to_cpu(x) be32_to_cpu(x) #define cfi64_to_cpu(x) be64_to_cpu(x) #elif defined (CFI_HOST_ENDIAN) #define cpu_to_cfi8(x) (x) #define cfi8_to_cpu(x) (x) #define cpu_to_cfi16(x) (x) #define cpu_to_cfi32(x) (x) #define cpu_to_cfi64(x) (x) #define cfi16_to_cpu(x) (x) #define cfi32_to_cpu(x) (x) #define cfi64_to_cpu(x) (x) #else #error No CFI endianness defined #endif android-audiosystem-1.8+13.10.20130807/include/linux/mtd/bbm.h0000644000015700001700000000344512200324306024157 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_MTD_BBM_H #define __LINUX_MTD_BBM_H #define NAND_MAX_CHIPS 8 struct nand_bbt_descr { int options; int pages[NAND_MAX_CHIPS]; int offs; int veroffs; uint8_t version[NAND_MAX_CHIPS]; int len; int maxblocks; int reserved_block_code; uint8_t *pattern; }; #define NAND_BBT_NRBITS_MSK 0x0000000F #define NAND_BBT_1BIT 0x00000001 #define NAND_BBT_2BIT 0x00000002 #define NAND_BBT_4BIT 0x00000004 #define NAND_BBT_8BIT 0x00000008 #define NAND_BBT_LASTBLOCK 0x00000010 #define NAND_BBT_ABSPAGE 0x00000020 #define NAND_BBT_SEARCH 0x00000040 #define NAND_BBT_PERCHIP 0x00000080 #define NAND_BBT_VERSION 0x00000100 #define NAND_BBT_CREATE 0x00000200 #define NAND_BBT_SCANALLPAGES 0x00000400 #define NAND_BBT_SCANEMPTY 0x00000800 #define NAND_BBT_WRITE 0x00001000 #define NAND_BBT_SAVECONTENT 0x00002000 #define NAND_BBT_SCAN2NDPAGE 0x00004000 #define NAND_BBT_SCAN_MAXBLOCKS 4 #define ONENAND_BADBLOCK_POS 0 struct bbm_info { int bbt_erase_shift; int badblockpos; int options; uint8_t *bbt; int (*isbad_bbt)(struct mtd_info *mtd, loff_t ofs, int allowbbt); struct nand_bbt_descr *badblock_pattern; void *priv; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/mtd/nand_ecc.h0000644000015700001700000000135312200324306025145 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __MTD_NAND_ECC_H__ #define __MTD_NAND_ECC_H__ struct mtd_info; #endif android-audiosystem-1.8+13.10.20130807/include/linux/mtd/onenand_regs.h0000644000015700001700000001257412200324306026064 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __ONENAND_REG_H #define __ONENAND_REG_H #define ONENAND_MEMORY_MAP(x) ((x) << 1) #define ONENAND_BOOTRAM ONENAND_MEMORY_MAP(0x0000) #define ONENAND_DATARAM ONENAND_MEMORY_MAP(0x0200) #define ONENAND_SPARERAM ONENAND_MEMORY_MAP(0x8010) #define ONENAND_REG_MANUFACTURER_ID ONENAND_MEMORY_MAP(0xF000) #define ONENAND_REG_DEVICE_ID ONENAND_MEMORY_MAP(0xF001) #define ONENAND_REG_VERSION_ID ONENAND_MEMORY_MAP(0xF002) #define ONENAND_REG_DATA_BUFFER_SIZE ONENAND_MEMORY_MAP(0xF003) #define ONENAND_REG_BOOT_BUFFER_SIZE ONENAND_MEMORY_MAP(0xF004) #define ONENAND_REG_NUM_BUFFERS ONENAND_MEMORY_MAP(0xF005) #define ONENAND_REG_TECHNOLOGY ONENAND_MEMORY_MAP(0xF006) #define ONENAND_REG_START_ADDRESS1 ONENAND_MEMORY_MAP(0xF100) #define ONENAND_REG_START_ADDRESS2 ONENAND_MEMORY_MAP(0xF101) #define ONENAND_REG_START_ADDRESS3 ONENAND_MEMORY_MAP(0xF102) #define ONENAND_REG_START_ADDRESS4 ONENAND_MEMORY_MAP(0xF103) #define ONENAND_REG_START_ADDRESS5 ONENAND_MEMORY_MAP(0xF104) #define ONENAND_REG_START_ADDRESS6 ONENAND_MEMORY_MAP(0xF105) #define ONENAND_REG_START_ADDRESS7 ONENAND_MEMORY_MAP(0xF106) #define ONENAND_REG_START_ADDRESS8 ONENAND_MEMORY_MAP(0xF107) #define ONENAND_REG_START_BUFFER ONENAND_MEMORY_MAP(0xF200) #define ONENAND_REG_COMMAND ONENAND_MEMORY_MAP(0xF220) #define ONENAND_REG_SYS_CFG1 ONENAND_MEMORY_MAP(0xF221) #define ONENAND_REG_SYS_CFG2 ONENAND_MEMORY_MAP(0xF222) #define ONENAND_REG_CTRL_STATUS ONENAND_MEMORY_MAP(0xF240) #define ONENAND_REG_INTERRUPT ONENAND_MEMORY_MAP(0xF241) #define ONENAND_REG_START_BLOCK_ADDRESS ONENAND_MEMORY_MAP(0xF24C) #define ONENAND_REG_END_BLOCK_ADDRESS ONENAND_MEMORY_MAP(0xF24D) #define ONENAND_REG_WP_STATUS ONENAND_MEMORY_MAP(0xF24E) #define ONENAND_REG_ECC_STATUS ONENAND_MEMORY_MAP(0xFF00) #define ONENAND_REG_ECC_M0 ONENAND_MEMORY_MAP(0xFF01) #define ONENAND_REG_ECC_S0 ONENAND_MEMORY_MAP(0xFF02) #define ONENAND_REG_ECC_M1 ONENAND_MEMORY_MAP(0xFF03) #define ONENAND_REG_ECC_S1 ONENAND_MEMORY_MAP(0xFF04) #define ONENAND_REG_ECC_M2 ONENAND_MEMORY_MAP(0xFF05) #define ONENAND_REG_ECC_S2 ONENAND_MEMORY_MAP(0xFF06) #define ONENAND_REG_ECC_M3 ONENAND_MEMORY_MAP(0xFF07) #define ONENAND_REG_ECC_S3 ONENAND_MEMORY_MAP(0xFF08) #define ONENAND_DEVICE_DENSITY_SHIFT (4) #define ONENAND_DEVICE_IS_DDP (1 << 3) #define ONENAND_DEVICE_IS_DEMUX (1 << 2) #define ONENAND_DEVICE_VCC_MASK (0x3) #define ONENAND_DEVICE_DENSITY_512Mb (0x002) #define ONENAND_VERSION_PROCESS_SHIFT (8) #define ONENAND_DDP_SHIFT (15) #define ONENAND_FPA_MASK (0x3f) #define ONENAND_FPA_SHIFT (2) #define ONENAND_FSA_MASK (0x03) #define ONENAND_BSA_MASK (0x03) #define ONENAND_BSA_SHIFT (8) #define ONENAND_BSA_BOOTRAM (0 << 2) #define ONENAND_BSA_DATARAM0 (2 << 2) #define ONENAND_BSA_DATARAM1 (3 << 2) #define ONENAND_BSC_MASK (0x03) #define ONENAND_CMD_READ (0x00) #define ONENAND_CMD_READOOB (0x13) #define ONENAND_CMD_PROG (0x80) #define ONENAND_CMD_PROGOOB (0x1A) #define ONENAND_CMD_UNLOCK (0x23) #define ONENAND_CMD_LOCK (0x2A) #define ONENAND_CMD_LOCK_TIGHT (0x2C) #define ONENAND_CMD_ERASE (0x94) #define ONENAND_CMD_RESET (0xF0) #define ONENAND_CMD_OTP_ACCESS (0x65) #define ONENAND_CMD_READID (0x90) #define ONENAND_CMD_BUFFERRAM (0x1978) #define ONENAND_SYS_CFG1_SYNC_READ (1 << 15) #define ONENAND_SYS_CFG1_BRL_7 (7 << 12) #define ONENAND_SYS_CFG1_BRL_6 (6 << 12) #define ONENAND_SYS_CFG1_BRL_5 (5 << 12) #define ONENAND_SYS_CFG1_BRL_4 (4 << 12) #define ONENAND_SYS_CFG1_BRL_3 (3 << 12) #define ONENAND_SYS_CFG1_BRL_10 (2 << 12) #define ONENAND_SYS_CFG1_BRL_9 (1 << 12) #define ONENAND_SYS_CFG1_BRL_8 (0 << 12) #define ONENAND_SYS_CFG1_BRL_SHIFT (12) #define ONENAND_SYS_CFG1_BL_32 (4 << 9) #define ONENAND_SYS_CFG1_BL_16 (3 << 9) #define ONENAND_SYS_CFG1_BL_8 (2 << 9) #define ONENAND_SYS_CFG1_BL_4 (1 << 9) #define ONENAND_SYS_CFG1_BL_CONT (0 << 9) #define ONENAND_SYS_CFG1_BL_SHIFT (9) #define ONENAND_SYS_CFG1_NO_ECC (1 << 8) #define ONENAND_SYS_CFG1_RDY (1 << 7) #define ONENAND_SYS_CFG1_INT (1 << 6) #define ONENAND_SYS_CFG1_IOBE (1 << 5) #define ONENAND_SYS_CFG1_RDY_CONF (1 << 4) #define ONENAND_CTRL_ONGO (1 << 15) #define ONENAND_CTRL_LOCK (1 << 14) #define ONENAND_CTRL_LOAD (1 << 13) #define ONENAND_CTRL_PROGRAM (1 << 12) #define ONENAND_CTRL_ERASE (1 << 11) #define ONENAND_CTRL_ERROR (1 << 10) #define ONENAND_CTRL_RSTB (1 << 7) #define ONENAND_CTRL_OTP_L (1 << 6) #define ONENAND_CTRL_OTP_BL (1 << 5) #define ONENAND_INT_MASTER (1 << 15) #define ONENAND_INT_READ (1 << 7) #define ONENAND_INT_WRITE (1 << 6) #define ONENAND_INT_ERASE (1 << 5) #define ONENAND_INT_RESET (1 << 4) #define ONENAND_INT_CLEAR (0 << 0) #define ONENAND_WP_US (1 << 2) #define ONENAND_WP_LS (1 << 1) #define ONENAND_WP_LTS (1 << 0) #define ONENAND_ECC_1BIT (1 << 0) #define ONENAND_ECC_2BIT (1 << 1) #define ONENAND_ECC_2BIT_ALL (0xAAAA) #define ONENAND_OTP_LOCK_OFFSET (14) #endif android-audiosystem-1.8+13.10.20130807/include/linux/mtd/nftl.h0000644000015700001700000000300112200324306024346 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __MTD_NFTL_H__ #define __MTD_NFTL_H__ #include #include #include #define BLOCK_NIL 0xffff #define BLOCK_FREE 0xfffe #define BLOCK_NOTEXPLORED 0xfffd #define BLOCK_RESERVED 0xfffc struct NFTLrecord { struct mtd_blktrans_dev mbd; __u16 MediaUnit, SpareMediaUnit; __u32 EraseSize; struct NFTLMediaHeader MediaHdr; int usecount; unsigned char heads; unsigned char sectors; unsigned short cylinders; __u16 numvunits; __u16 lastEUN; __u16 numfreeEUNs; __u16 LastFreeEUN; int head,sect,cyl; __u16 *EUNtable; __u16 *ReplUnitTable; unsigned int nb_blocks; unsigned int nb_boot_blocks; struct erase_info instr; struct nand_ecclayout oobinfo; }; #ifndef NFTL_MAJOR #define NFTL_MAJOR 93 #endif #define MAX_NFTLS 16 #define MAX_SECTORS_PER_UNIT 64 #define NFTL_PARTN_BITS 4 #endif android-audiosystem-1.8+13.10.20130807/include/linux/mtd/map.h0000644000015700001700000000570712200324306024177 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_MTD_MAP_H__ #define __LINUX_MTD_MAP_H__ #include #include #include #include #include #include #include #define map_bankwidth_is_1(map) (0) #define map_bankwidth_is_2(map) (0) #define map_bankwidth_is_4(map) (0) #define map_calc_words(map) ((map_bankwidth(map) + (sizeof(unsigned long)-1))/ sizeof(unsigned long)) #define map_bankwidth_is_8(map) (0) #define map_bankwidth_is_16(map) (0) #define map_bankwidth_is_32(map) (0) #ifndef map_bankwidth #error "No bus width supported. What's the point?" #endif #define MAX_MAP_LONGS ( ((MAX_MAP_BANKWIDTH*8) + BITS_PER_LONG - 1) / BITS_PER_LONG ) struct map_info { char *name; unsigned long size; unsigned long phys; #define NO_XIP (-1UL) void __iomem *virt; void *cached; int bankwidth; void (*inval_cache)(struct map_info *, unsigned long, ssize_t); void (*set_vpp)(struct map_info *, int); unsigned long map_priv_1; unsigned long map_priv_2; void *fldrv_priv; struct mtd_chip_driver *fldrv; }; struct mtd_chip_driver { struct mtd_info *(*probe)(struct map_info *map); void (*destroy)(struct mtd_info *); struct module *module; char *name; struct list_head list; }; struct mtd_info *do_map_probe(const char *name, struct map_info *map); #define ENABLE_VPP(map) do { if(map->set_vpp) map->set_vpp(map, 1); } while(0) #define DISABLE_VPP(map) do { if(map->set_vpp) map->set_vpp(map, 0); } while(0) #define INVALIDATE_CACHED_RANGE(map, from, size) do { if(map->inval_cache) map->inval_cache(map, from, size); } while(0) #define map_word_andequal(m, a, b, z) map_word_equal(m, z, map_word_and(m, a, b)) #if BITS_PER_LONG >= 64 #endif #ifdef __LITTLE_ENDIAN #else #endif #if BITS_PER_LONG < 64 #define MAP_FF_LIMIT 4 #else #define MAP_FF_LIMIT 8 #endif #if BITS_PER_LONG >= 64 #endif #if BITS_PER_LONG >= 64 #endif #define map_read(map, ofs) inline_map_read(map, ofs) #define map_copy_from(map, to, from, len) inline_map_copy_from(map, to, from, len) #define map_write(map, datum, ofs) inline_map_write(map, datum, ofs) #define map_copy_to(map, to, from, len) inline_map_copy_to(map, to, from, len) #define simple_map_init(map) BUG_ON(!map_bankwidth_supported((map)->bankwidth)) #define map_is_linear(map) ({ (void)(map); 1; }) #endif android-audiosystem-1.8+13.10.20130807/include/linux/mtd/mtd.h0000644000015700001700000001024012200324306024172 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __MTD_MTD_H__ #define __MTD_MTD_H__ #error This is a kernel header. Perhaps include mtd-user.h instead? #include #include #include #include #include #include #define MTD_CHAR_MAJOR 90 #define MTD_BLOCK_MAJOR 31 #define MAX_MTD_DEVICES 16 #define MTD_ERASE_PENDING 0x01 #define MTD_ERASING 0x02 #define MTD_ERASE_SUSPEND 0x04 #define MTD_ERASE_DONE 0x08 #define MTD_ERASE_FAILED 0x10 struct erase_info { struct mtd_info *mtd; u_int32_t addr; u_int32_t len; u_int32_t fail_addr; u_long time; u_long retries; u_int dev; u_int cell; void (*callback) (struct erase_info *self); u_long priv; u_char state; struct erase_info *next; }; struct mtd_erase_region_info { u_int32_t offset; u_int32_t erasesize; u_int32_t numblocks; }; typedef enum { MTD_OOB_PLACE, MTD_OOB_AUTO, MTD_OOB_RAW, } mtd_oob_mode_t; struct mtd_oob_ops { mtd_oob_mode_t mode; size_t len; size_t retlen; size_t ooblen; uint32_t ooboffs; uint8_t *datbuf; uint8_t *oobbuf; }; struct mtd_info { u_char type; u_int32_t flags; u_int32_t size; u_int32_t erasesize; u_int32_t writesize; u_int32_t oobsize; u_int32_t ecctype; u_int32_t eccsize; #define MTD_PROGREGION_CTRLMODE_VALID(mtd) (mtd)->oobsize #define MTD_PROGREGION_CTRLMODE_INVALID(mtd) (mtd)->ecctype char *name; int index; struct nand_ecclayout *ecclayout; int numeraseregions; struct mtd_erase_region_info *eraseregions; u_int32_t bank_size; int (*erase) (struct mtd_info *mtd, struct erase_info *instr); int (*point) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf); void (*unpoint) (struct mtd_info *mtd, u_char * addr, loff_t from, size_t len); int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); int (*read_oob) (struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops); int (*write_oob) (struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops); int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len); int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen); void (*sync) (struct mtd_info *mtd); int (*lock) (struct mtd_info *mtd, loff_t ofs, size_t len); int (*unlock) (struct mtd_info *mtd, loff_t ofs, size_t len); int (*suspend) (struct mtd_info *mtd); void (*resume) (struct mtd_info *mtd); int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); struct notifier_block reboot_notifier; struct mtd_ecc_stats ecc_stats; void *priv; struct module *owner; int usecount; }; struct mtd_notifier { void (*add)(struct mtd_info *mtd); void (*remove)(struct mtd_info *mtd); struct list_head list; }; #define MTD_DEBUG_LEVEL0 (0) #define MTD_DEBUG_LEVEL1 (1) #define MTD_DEBUG_LEVEL2 (2) #define MTD_DEBUG_LEVEL3 (3) #define DEBUG(n, args...) do { } while(0) #endif android-audiosystem-1.8+13.10.20130807/include/linux/mtd/compatmac.h0000644000015700001700000000134712200324306025362 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_MTD_COMPATMAC_H__ #define __LINUX_MTD_COMPATMAC_H__ #endif android-audiosystem-1.8+13.10.20130807/include/linux/mtd/flashchip.h0000644000015700001700000000306112200324306025352 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __MTD_FLASHCHIP_H__ #define __MTD_FLASHCHIP_H__ #include typedef enum { FL_READY, FL_STATUS, FL_CFI_QUERY, FL_JEDEC_QUERY, FL_ERASING, FL_ERASE_SUSPENDING, FL_ERASE_SUSPENDED, FL_WRITING, FL_WRITING_TO_BUFFER, FL_OTP_WRITE, FL_WRITE_SUSPENDING, FL_WRITE_SUSPENDED, FL_PM_SUSPENDED, FL_SYNCING, FL_UNLOADING, FL_LOCKING, FL_UNLOCKING, FL_POINT, FL_XIP_WHILE_ERASING, FL_XIP_WHILE_WRITING, FL_UNKNOWN } flstate_t; struct flchip { unsigned long start; int ref_point_counter; flstate_t state; flstate_t oldstate; unsigned int write_suspended:1; unsigned int erase_suspended:1; unsigned long in_progress_block_addr; spinlock_t *mutex; spinlock_t _spinlock; wait_queue_head_t wq; int word_write_time; int buffer_write_time; int erase_time; void *priv; }; struct flchip_shared { spinlock_t lock; struct flchip *writing; struct flchip *erasing; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/mtd/cfi.h0000644000015700001700000001070312200324306024153 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __MTD_CFI_H__ #define __MTD_CFI_H__ #include #include #include #include #include #include #define cfi_interleave_is_1(cfi) (0) #define cfi_interleave_is_2(cfi) (0) #define cfi_interleave_is_4(cfi) (0) #define cfi_interleave_is_8(cfi) (0) #define CFI_DEVICETYPE_X8 (8 / 8) #define CFI_DEVICETYPE_X16 (16 / 8) #define CFI_DEVICETYPE_X32 (32 / 8) #define CFI_DEVICETYPE_X64 (64 / 8) struct cfi_extquery { uint8_t pri[3]; uint8_t MajorVersion; uint8_t MinorVersion; } __attribute__((packed)); struct cfi_pri_intelext { uint8_t pri[3]; uint8_t MajorVersion; uint8_t MinorVersion; uint32_t FeatureSupport; uint8_t SuspendCmdSupport; uint16_t BlkStatusRegMask; uint8_t VccOptimal; uint8_t VppOptimal; uint8_t NumProtectionFields; uint16_t ProtRegAddr; uint8_t FactProtRegSize; uint8_t UserProtRegSize; uint8_t extra[0]; } __attribute__((packed)); struct cfi_intelext_otpinfo { uint32_t ProtRegAddr; uint16_t FactGroups; uint8_t FactProtRegSize; uint16_t UserGroups; uint8_t UserProtRegSize; } __attribute__((packed)); struct cfi_intelext_blockinfo { uint16_t NumIdentBlocks; uint16_t BlockSize; uint16_t MinBlockEraseCycles; uint8_t BitsPerCell; uint8_t BlockCap; } __attribute__((packed)); struct cfi_intelext_regioninfo { uint16_t NumIdentPartitions; uint8_t NumOpAllowed; uint8_t NumOpAllowedSimProgMode; uint8_t NumOpAllowedSimEraMode; uint8_t NumBlockTypes; struct cfi_intelext_blockinfo BlockTypes[1]; } __attribute__((packed)); struct cfi_intelext_programming_regioninfo { uint8_t ProgRegShift; uint8_t Reserved1; uint8_t ControlValid; uint8_t Reserved2; uint8_t ControlInvalid; uint8_t Reserved3; } __attribute__((packed)); struct cfi_pri_amdstd { uint8_t pri[3]; uint8_t MajorVersion; uint8_t MinorVersion; uint8_t SiliconRevision; uint8_t EraseSuspend; uint8_t BlkProt; uint8_t TmpBlkUnprotect; uint8_t BlkProtUnprot; uint8_t SimultaneousOps; uint8_t BurstMode; uint8_t PageMode; uint8_t VppMin; uint8_t VppMax; uint8_t TopBottom; } __attribute__((packed)); struct cfi_pri_atmel { uint8_t pri[3]; uint8_t MajorVersion; uint8_t MinorVersion; uint8_t Features; uint8_t BottomBoot; uint8_t BurstMode; uint8_t PageMode; } __attribute__((packed)); struct cfi_pri_query { uint8_t NumFields; uint32_t ProtField[1]; } __attribute__((packed)); struct cfi_bri_query { uint8_t PageModeReadCap; uint8_t NumFields; uint32_t ConfField[1]; } __attribute__((packed)); #define P_ID_NONE 0x0000 #define P_ID_INTEL_EXT 0x0001 #define P_ID_AMD_STD 0x0002 #define P_ID_INTEL_STD 0x0003 #define P_ID_AMD_EXT 0x0004 #define P_ID_WINBOND 0x0006 #define P_ID_ST_ADV 0x0020 #define P_ID_MITSUBISHI_STD 0x0100 #define P_ID_MITSUBISHI_EXT 0x0101 #define P_ID_SST_PAGE 0x0102 #define P_ID_INTEL_PERFORMANCE 0x0200 #define P_ID_INTEL_DATA 0x0210 #define P_ID_RESERVED 0xffff #define CFI_MODE_CFI 1 #define CFI_MODE_JEDEC 0 struct cfi_private { uint16_t cmdset; void *cmdset_priv; int interleave; int device_type; int cfi_mode; int addr_unlock1; int addr_unlock2; struct mtd_info *(*cmdset_setup)(struct map_info *); struct cfi_ident *cfiq; int mfr, id; int numchips; unsigned long chipshift; const char *im_name; struct flchip chips[0]; }; #if BITS_PER_LONG >= 64 #endif #define CMD(x) cfi_build_cmd((x), map, cfi) #if BITS_PER_LONG >= 64 #endif #define MERGESTATUS(x) cfi_merge_status((x), map, cfi) struct cfi_fixup { uint16_t mfr; uint16_t id; void (*fixup)(struct mtd_info *mtd, void* param); void* param; }; #define CFI_MFR_ANY 0xffff #define CFI_ID_ANY 0xffff #define CFI_MFR_AMD 0x0001 #define CFI_MFR_ATMEL 0x001F #define CFI_MFR_ST 0x0020 typedef int (*varsize_frob_t)(struct map_info *map, struct flchip *chip, unsigned long adr, int len, void *thunk); #endif android-audiosystem-1.8+13.10.20130807/include/linux/mtd/nand.h0000644000015700001700000001671112200324306024337 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_MTD_NAND_H #define __LINUX_MTD_NAND_H #include #include #include struct mtd_info; #define NAND_MAX_CHIPS 8 #define NAND_MAX_OOBSIZE 64 #define NAND_MAX_PAGESIZE 2048 #define NAND_NCE 0x01 #define NAND_CLE 0x02 #define NAND_ALE 0x04 #define NAND_CTRL_CLE (NAND_NCE | NAND_CLE) #define NAND_CTRL_ALE (NAND_NCE | NAND_ALE) #define NAND_CTRL_CHANGE 0x80 #define NAND_CMD_READ0 0 #define NAND_CMD_READ1 1 #define NAND_CMD_RNDOUT 5 #define NAND_CMD_PAGEPROG 0x10 #define NAND_CMD_READOOB 0x50 #define NAND_CMD_ERASE1 0x60 #define NAND_CMD_STATUS 0x70 #define NAND_CMD_STATUS_MULTI 0x71 #define NAND_CMD_SEQIN 0x80 #define NAND_CMD_RNDIN 0x85 #define NAND_CMD_READID 0x90 #define NAND_CMD_ERASE2 0xd0 #define NAND_CMD_RESET 0xff #define NAND_CMD_READSTART 0x30 #define NAND_CMD_RNDOUTSTART 0xE0 #define NAND_CMD_CACHEDPROG 0x15 #define NAND_CMD_DEPLETE1 0x100 #define NAND_CMD_DEPLETE2 0x38 #define NAND_CMD_STATUS_MULTI 0x71 #define NAND_CMD_STATUS_ERROR 0x72 #define NAND_CMD_STATUS_ERROR0 0x73 #define NAND_CMD_STATUS_ERROR1 0x74 #define NAND_CMD_STATUS_ERROR2 0x75 #define NAND_CMD_STATUS_ERROR3 0x76 #define NAND_CMD_STATUS_RESET 0x7f #define NAND_CMD_STATUS_CLEAR 0xff #define NAND_CMD_NONE -1 #define NAND_STATUS_FAIL 0x01 #define NAND_STATUS_FAIL_N1 0x02 #define NAND_STATUS_TRUE_READY 0x20 #define NAND_STATUS_READY 0x40 #define NAND_STATUS_WP 0x80 typedef enum { NAND_ECC_NONE, NAND_ECC_SOFT, NAND_ECC_HW, NAND_ECC_HW_SYNDROME, } nand_ecc_modes_t; #define NAND_ECC_READ 0 #define NAND_ECC_WRITE 1 #define NAND_ECC_READSYN 2 #define NAND_GET_DEVICE 0x80 #define NAND_NO_AUTOINCR 0x00000001 #define NAND_BUSWIDTH_16 0x00000002 #define NAND_NO_PADDING 0x00000004 #define NAND_CACHEPRG 0x00000008 #define NAND_COPYBACK 0x00000010 #define NAND_IS_AND 0x00000020 #define NAND_4PAGE_ARRAY 0x00000040 #define BBT_AUTO_REFRESH 0x00000080 #define NAND_NO_READRDY 0x00000100 #define NAND_SAMSUNG_LP_OPTIONS (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) #define NAND_CANAUTOINCR(chip) (!(chip->options & NAND_NO_AUTOINCR)) #define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING)) #define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG)) #define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK)) #define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR) #define NAND_USE_FLASH_BBT 0x00010000 #define NAND_SKIP_BBTSCAN 0x00020000 #define NAND_CONTROLLER_ALLOC 0x80000000 typedef enum { FL_READY, FL_READING, FL_WRITING, FL_ERASING, FL_SYNCING, FL_CACHEDPRG, FL_PM_SUSPENDED, } nand_state_t; struct nand_chip; struct nand_hw_control { spinlock_t lock; struct nand_chip *active; wait_queue_head_t wq; }; struct nand_ecc_ctrl { nand_ecc_modes_t mode; int steps; int size; int bytes; int total; int prepad; int postpad; struct nand_ecclayout *layout; void (*hwctl)(struct mtd_info *mtd, int mode); int (*calculate)(struct mtd_info *mtd, const uint8_t *dat, uint8_t *ecc_code); int (*correct)(struct mtd_info *mtd, uint8_t *dat, uint8_t *read_ecc, uint8_t *calc_ecc); int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, uint8_t *buf); void (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, const uint8_t *buf); int (*read_oob)(struct mtd_info *mtd, struct nand_chip *chip, int page, int sndcmd); int (*write_oob)(struct mtd_info *mtd, struct nand_chip *chip, int page); }; struct nand_buffers { uint8_t ecccalc[NAND_MAX_OOBSIZE]; uint8_t ecccode[NAND_MAX_OOBSIZE]; uint8_t oobwbuf[NAND_MAX_OOBSIZE]; uint8_t databuf[NAND_MAX_PAGESIZE]; uint8_t oobrbuf[NAND_MAX_OOBSIZE]; }; struct nand_chip { void __iomem *IO_ADDR_R; void __iomem *IO_ADDR_W; uint8_t (*read_byte)(struct mtd_info *mtd); u16 (*read_word)(struct mtd_info *mtd); void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len); int (*verify_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); void (*select_chip)(struct mtd_info *mtd, int chip); int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip); int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); void (*cmd_ctrl)(struct mtd_info *mtd, int dat, unsigned int ctrl); int (*dev_ready)(struct mtd_info *mtd); void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column, int page_addr); int (*waitfunc)(struct mtd_info *mtd, struct nand_chip *this); void (*erase_cmd)(struct mtd_info *mtd, int page); int (*scan_bbt)(struct mtd_info *mtd); int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page); int chip_delay; unsigned int options; int page_shift; int phys_erase_shift; int bbt_erase_shift; int chip_shift; int numchips; unsigned long chipsize; int pagemask; int pagebuf; int badblockpos; nand_state_t state; uint8_t *oob_poi; struct nand_hw_control *controller; struct nand_ecclayout *ecclayout; struct nand_ecc_ctrl ecc; struct nand_buffers buffers; struct nand_hw_control hwcontrol; struct mtd_oob_ops ops; uint8_t *bbt; struct nand_bbt_descr *bbt_td; struct nand_bbt_descr *bbt_md; struct nand_bbt_descr *badblock_pattern; void *priv; }; #define NAND_MFR_TOSHIBA 0x98 #define NAND_MFR_SAMSUNG 0xec #define NAND_MFR_FUJITSU 0x04 #define NAND_MFR_NATIONAL 0x8f #define NAND_MFR_RENESAS 0x07 #define NAND_MFR_STMICRO 0x20 #define NAND_MFR_HYNIX 0xad struct nand_flash_dev { char *name; int id; unsigned long pagesize; unsigned long chipsize; unsigned long erasesize; unsigned long options; }; struct nand_manufacturers { int id; char * name; }; struct nand_bbt_descr { int options; int pages[NAND_MAX_CHIPS]; int offs; int veroffs; uint8_t version[NAND_MAX_CHIPS]; int len; int maxblocks; int reserved_block_code; uint8_t *pattern; }; #define NAND_BBT_NRBITS_MSK 0x0000000F #define NAND_BBT_1BIT 0x00000001 #define NAND_BBT_2BIT 0x00000002 #define NAND_BBT_4BIT 0x00000004 #define NAND_BBT_8BIT 0x00000008 #define NAND_BBT_LASTBLOCK 0x00000010 #define NAND_BBT_ABSPAGE 0x00000020 #define NAND_BBT_SEARCH 0x00000040 #define NAND_BBT_PERCHIP 0x00000080 #define NAND_BBT_VERSION 0x00000100 #define NAND_BBT_CREATE 0x00000200 #define NAND_BBT_SCANALLPAGES 0x00000400 #define NAND_BBT_SCANEMPTY 0x00000800 #define NAND_BBT_WRITE 0x00001000 #define NAND_BBT_SAVECONTENT 0x00002000 #define NAND_BBT_SCAN2NDPAGE 0x00004000 #define NAND_BBT_SCAN_MAXBLOCKS 4 #define NAND_SMALL_BADBLOCK_POS 5 #define NAND_LARGE_BADBLOCK_POS 0 struct platform_nand_chip { int nr_chips; int chip_offset; int nr_partitions; struct mtd_partition *partitions; struct nand_ecclayout *ecclayout; int chip_delay; unsigned int options; void *priv; }; struct platform_nand_ctrl { void (*hwcontrol)(struct mtd_info *mtd, int cmd); int (*dev_ready)(struct mtd_info *mtd); void (*select_chip)(struct mtd_info *mtd, int chip); void *priv; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/capability.h0000644000015700001700000000353112200324306024750 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_CAPABILITY_H #define _LINUX_CAPABILITY_H #include #include #define _LINUX_CAPABILITY_VERSION 0x19980330 typedef struct __user_cap_header_struct { __u32 version; int pid; } __user *cap_user_header_t; typedef struct __user_cap_data_struct { __u32 effective; __u32 permitted; __u32 inheritable; } __user *cap_user_data_t; #define CAP_CHOWN 0 #define CAP_DAC_OVERRIDE 1 #define CAP_DAC_READ_SEARCH 2 #define CAP_FOWNER 3 #define CAP_FSETID 4 #define CAP_FS_MASK 0x1f #define CAP_KILL 5 #define CAP_SETGID 6 #define CAP_SETUID 7 #define CAP_SETPCAP 8 #define CAP_LINUX_IMMUTABLE 9 #define CAP_NET_BIND_SERVICE 10 #define CAP_NET_BROADCAST 11 #define CAP_NET_ADMIN 12 #define CAP_NET_RAW 13 #define CAP_IPC_LOCK 14 #define CAP_IPC_OWNER 15 #define CAP_SYS_MODULE 16 #define CAP_SYS_RAWIO 17 #define CAP_SYS_CHROOT 18 #define CAP_SYS_PTRACE 19 #define CAP_SYS_PACCT 20 #define CAP_SYS_ADMIN 21 #define CAP_SYS_BOOT 22 #define CAP_SYS_NICE 23 #define CAP_SYS_RESOURCE 24 #define CAP_SYS_TIME 25 #define CAP_SYS_TTY_CONFIG 26 #define CAP_MKNOD 27 #define CAP_LEASE 28 #define CAP_AUDIT_WRITE 29 #define CAP_AUDIT_CONTROL 30 #endif android-audiosystem-1.8+13.10.20130807/include/linux/android_power.h0000644000015700001700000000344512200324306025467 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ANDROID_POWER_H #define _LINUX_ANDROID_POWER_H #include typedef struct { struct list_head link; int lock_count; int flags; const char *name; int expires; } android_suspend_lock_t; #define ANDROID_SUSPEND_LOCK_FLAG_COUNTED (1U << 0) #define ANDROID_SUSPEND_LOCK_FLAG_USER_READABLE (1U << 1) #define ANDROID_SUSPEND_LOCK_FLAG_USER_SET (1U << 2) #define ANDROID_SUSPEND_LOCK_FLAG_USER_CLEAR (1U << 3) #define ANDROID_SUSPEND_LOCK_FLAG_USER_INC (1U << 4) #define ANDROID_SUSPEND_LOCK_FLAG_USER_DEC (1U << 5) #define ANDROID_SUSPEND_LOCK_FLAG_USER_VISIBLE_MASK (0x1fU << 1) #define ANDROID_SUSPEND_LOCK_AUTO_EXPIRE (1U << 6) typedef struct android_early_suspend android_early_suspend_t; struct android_early_suspend { struct list_head link; int level; void (*suspend)(android_early_suspend_t *h); void (*resume)(android_early_suspend_t *h); }; typedef enum { ANDROID_CHARGING_STATE_UNKNOWN, ANDROID_CHARGING_STATE_DISCHARGE, ANDROID_CHARGING_STATE_MAINTAIN, ANDROID_CHARGING_STATE_SLOW, ANDROID_CHARGING_STATE_NORMAL, ANDROID_CHARGING_STATE_FAST, ANDROID_CHARGING_STATE_OVERHEAT } android_charging_state_t; #endif android-audiosystem-1.8+13.10.20130807/include/linux/zorro_ids.h0000644000015700001700000007015412200324306024646 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #define ZORRO_MANUF_PACIFIC_PERIPHERALS 0x00D3 #define ZORRO_PROD_PACIFIC_PERIPHERALS_SE_2000_A500 ZORRO_ID(PACIFIC_PERIPHERALS, 0x00, 0) #define ZORRO_PROD_PACIFIC_PERIPHERALS_SCSI ZORRO_ID(PACIFIC_PERIPHERALS, 0x0A, 0) #define ZORRO_MANUF_MACROSYSTEMS_USA_2 0x0100 #define ZORRO_PROD_MACROSYSTEMS_WARP_ENGINE ZORRO_ID(MACROSYSTEMS_USA_2, 0x13, 0) #define ZORRO_MANUF_KUPKE_1 0x00DD #define ZORRO_PROD_KUPKE_GOLEM_RAM_BOX_2MB ZORRO_ID(KUPKE_1, 0x00, 0) #define ZORRO_MANUF_MEMPHIS 0x0100 #define ZORRO_PROD_MEMPHIS_STORMBRINGER ZORRO_ID(MEMPHIS, 0x00, 0) #define ZORRO_MANUF_3_STATE 0x0200 #define ZORRO_PROD_3_STATE_MEGAMIX_2000 ZORRO_ID(3_STATE, 0x02, 0) #define ZORRO_MANUF_COMMODORE_BRAUNSCHWEIG 0x0201 #define ZORRO_PROD_CBM_A2088_A2286 ZORRO_ID(COMMODORE_BRAUNSCHWEIG, 0x01, 0) #define ZORRO_PROD_CBM_A2286 ZORRO_ID(COMMODORE_BRAUNSCHWEIG, 0x02, 0) #define ZORRO_PROD_CBM_A4091_1 ZORRO_ID(COMMODORE_BRAUNSCHWEIG, 0x54, 0) #define ZORRO_PROD_CBM_A2386SX_1 ZORRO_ID(COMMODORE_BRAUNSCHWEIG, 0x67, 0) #define ZORRO_MANUF_COMMODORE_WEST_CHESTER_1 0x0202 #define ZORRO_PROD_CBM_A2090A ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x01, 0) #define ZORRO_PROD_CBM_A590_A2091_1 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x02, 0) #define ZORRO_PROD_CBM_A590_A2091_2 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x03, 0) #define ZORRO_PROD_CBM_A2090B ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x04, 0) #define ZORRO_PROD_CBM_A2060 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x09, 0) #define ZORRO_PROD_CBM_A590_A2052_A2058_A2091 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x0A, 0) #define ZORRO_PROD_CBM_A560_RAM ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x20, 0) #define ZORRO_PROD_CBM_A2232_PROTOTYPE ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x45, 0) #define ZORRO_PROD_CBM_A2232 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x46, 0) #define ZORRO_PROD_CBM_A2620 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x50, 0) #define ZORRO_PROD_CBM_A2630 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x51, 0) #define ZORRO_PROD_CBM_A4091_2 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x54, 0) #define ZORRO_PROD_CBM_A2065_1 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x5A, 0) #define ZORRO_PROD_CBM_ROMULATOR ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x60, 0) #define ZORRO_PROD_CBM_A3000_TEST_FIXTURE ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x61, 0) #define ZORRO_PROD_CBM_A2386SX_2 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x67, 0) #define ZORRO_PROD_CBM_A2065_2 ZORRO_ID(COMMODORE_WEST_CHESTER_1, 0x70, 0) #define ZORRO_MANUF_COMMODORE_WEST_CHESTER_2 0x0203 #define ZORRO_PROD_CBM_A2090A_CM ZORRO_ID(COMMODORE_WEST_CHESTER_2, 0x03, 0) #define ZORRO_MANUF_PROGRESSIVE_PERIPHERALS_AND_SYSTEMS_2 0x02F4 #define ZORRO_PROD_PPS_EXP8000 ZORRO_ID(PROGRESSIVE_PERIPHERALS_AND_SYSTEMS_2, 0x02, 0) #define ZORRO_MANUF_KOLFF_COMPUTER_SUPPLIES 0x02FF #define ZORRO_PROD_KCS_POWER_PC_BOARD ZORRO_ID(KOLFF_COMPUTER_SUPPLIES, 0x00, 0) #define ZORRO_MANUF_CARDCO_1 0x03EC #define ZORRO_PROD_CARDCO_KRONOS_2000_1 ZORRO_ID(CARDCO_1, 0x04, 0) #define ZORRO_PROD_CARDCO_A1000_1 ZORRO_ID(CARDCO_1, 0x0C, 0) #define ZORRO_PROD_CARDCO_ESCORT ZORRO_ID(CARDCO_1, 0x0E, 0) #define ZORRO_PROD_CARDCO_A2410 ZORRO_ID(CARDCO_1, 0xF5, 0) #define ZORRO_MANUF_A_SQUARED 0x03ED #define ZORRO_PROD_A_SQUARED_LIVE_2000 ZORRO_ID(A_SQUARED, 0x01, 0) #define ZORRO_MANUF_COMSPEC_COMMUNICATIONS 0x03EE #define ZORRO_PROD_COMSPEC_COMMUNICATIONS_AX2000 ZORRO_ID(COMSPEC_COMMUNICATIONS, 0x01, 0) #define ZORRO_MANUF_ANAKIN_RESEARCH 0x03F1 #define ZORRO_PROD_ANAKIN_RESEARCH_EASYL ZORRO_ID(ANAKIN_RESEARCH, 0x01, 0) #define ZORRO_MANUF_MICROBOTICS 0x03F2 #define ZORRO_PROD_MICROBOTICS_STARBOARD_II ZORRO_ID(MICROBOTICS, 0x00, 0) #define ZORRO_PROD_MICROBOTICS_STARDRIVE ZORRO_ID(MICROBOTICS, 0x02, 0) #define ZORRO_PROD_MICROBOTICS_8_UP_A ZORRO_ID(MICROBOTICS, 0x03, 0) #define ZORRO_PROD_MICROBOTICS_8_UP_Z ZORRO_ID(MICROBOTICS, 0x04, 0) #define ZORRO_PROD_MICROBOTICS_DELTA_RAM ZORRO_ID(MICROBOTICS, 0x20, 0) #define ZORRO_PROD_MICROBOTICS_8_STAR_RAM ZORRO_ID(MICROBOTICS, 0x40, 0) #define ZORRO_PROD_MICROBOTICS_8_STAR ZORRO_ID(MICROBOTICS, 0x41, 0) #define ZORRO_PROD_MICROBOTICS_VXL_RAM_32 ZORRO_ID(MICROBOTICS, 0x44, 0) #define ZORRO_PROD_MICROBOTICS_VXL_68030 ZORRO_ID(MICROBOTICS, 0x45, 0) #define ZORRO_PROD_MICROBOTICS_DELTA ZORRO_ID(MICROBOTICS, 0x60, 0) #define ZORRO_PROD_MICROBOTICS_MBX_1200_1200Z_RAM ZORRO_ID(MICROBOTICS, 0x81, 0) #define ZORRO_PROD_MICROBOTICS_HARDFRAME_2000_1 ZORRO_ID(MICROBOTICS, 0x96, 0) #define ZORRO_PROD_MICROBOTICS_HARDFRAME_2000_2 ZORRO_ID(MICROBOTICS, 0x9E, 0) #define ZORRO_PROD_MICROBOTICS_MBX_1200_1200Z ZORRO_ID(MICROBOTICS, 0xC1, 0) #define ZORRO_MANUF_ACCESS_ASSOCIATES_ALEGRA 0x03F4 #define ZORRO_MANUF_EXPANSION_TECHNOLOGIES 0x03F6 #define ZORRO_MANUF_ASDG 0x03FF #define ZORRO_PROD_ASDG_MEMORY_1 ZORRO_ID(ASDG, 0x01, 0) #define ZORRO_PROD_ASDG_MEMORY_2 ZORRO_ID(ASDG, 0x02, 0) #define ZORRO_PROD_ASDG_EB920_LAN_ROVER ZORRO_ID(ASDG, 0xFE, 0) #define ZORRO_PROD_ASDG_GPIB_DUALIEEE488_TWIN_X ZORRO_ID(ASDG, 0xFF, 0) #define ZORRO_MANUF_IMTRONICS_1 0x0404 #define ZORRO_PROD_IMTRONICS_HURRICANE_2800_1 ZORRO_ID(IMTRONICS_1, 0x39, 0) #define ZORRO_PROD_IMTRONICS_HURRICANE_2800_2 ZORRO_ID(IMTRONICS_1, 0x57, 0) #define ZORRO_MANUF_CBM_UNIVERSITY_OF_LOWELL 0x0406 #define ZORRO_PROD_CBM_A2410 ZORRO_ID(CBM_UNIVERSITY_OF_LOWELL, 0x00, 0) #define ZORRO_MANUF_AMERISTAR 0x041D #define ZORRO_PROD_AMERISTAR_A2065 ZORRO_ID(AMERISTAR, 0x01, 0) #define ZORRO_PROD_AMERISTAR_A560 ZORRO_ID(AMERISTAR, 0x09, 0) #define ZORRO_PROD_AMERISTAR_A4066 ZORRO_ID(AMERISTAR, 0x0A, 0) #define ZORRO_MANUF_SUPRA 0x0420 #define ZORRO_PROD_SUPRA_SUPRADRIVE_4x4 ZORRO_ID(SUPRA, 0x01, 0) #define ZORRO_PROD_SUPRA_1000_RAM ZORRO_ID(SUPRA, 0x02, 0) #define ZORRO_PROD_SUPRA_2000_DMA ZORRO_ID(SUPRA, 0x03, 0) #define ZORRO_PROD_SUPRA_500 ZORRO_ID(SUPRA, 0x05, 0) #define ZORRO_PROD_SUPRA_500_SCSI ZORRO_ID(SUPRA, 0x08, 0) #define ZORRO_PROD_SUPRA_500XP_2000_RAM ZORRO_ID(SUPRA, 0x09, 0) #define ZORRO_PROD_SUPRA_500RX_2000_RAM ZORRO_ID(SUPRA, 0x0A, 0) #define ZORRO_PROD_SUPRA_2400ZI ZORRO_ID(SUPRA, 0x0B, 0) #define ZORRO_PROD_SUPRA_500XP_SUPRADRIVE_WORDSYNC ZORRO_ID(SUPRA, 0x0C, 0) #define ZORRO_PROD_SUPRA_SUPRADRIVE_WORDSYNC_II ZORRO_ID(SUPRA, 0x0D, 0) #define ZORRO_PROD_SUPRA_2400ZIPLUS ZORRO_ID(SUPRA, 0x10, 0) #define ZORRO_MANUF_COMPUTER_SYSTEMS_ASSOCIATES 0x0422 #define ZORRO_PROD_CSA_MAGNUM ZORRO_ID(COMPUTER_SYSTEMS_ASSOCIATES, 0x11, 0) #define ZORRO_PROD_CSA_12_GAUGE ZORRO_ID(COMPUTER_SYSTEMS_ASSOCIATES, 0x15, 0) #define ZORRO_MANUF_MARC_MICHAEL_GROTH 0x0439 #define ZORRO_MANUF_M_TECH 0x0502 #define ZORRO_PROD_MTEC_AT500_1 ZORRO_ID(M_TECH, 0x03, 0) #define ZORRO_MANUF_GREAT_VALLEY_PRODUCTS_1 0x06E1 #define ZORRO_PROD_GVP_IMPACT_SERIES_I ZORRO_ID(GREAT_VALLEY_PRODUCTS_1, 0x08, 0) #define ZORRO_MANUF_BYTEBOX 0x07DA #define ZORRO_PROD_BYTEBOX_A500 ZORRO_ID(BYTEBOX, 0x00, 0) #define ZORRO_MANUF_DKB_POWER_COMPUTING 0x07DC #define ZORRO_PROD_DKB_POWER_COMPUTING_SECUREKEY ZORRO_ID(DKB_POWER_COMPUTING, 0x09, 0) #define ZORRO_PROD_DKB_POWER_COMPUTING_DKM_3128 ZORRO_ID(DKB_POWER_COMPUTING, 0x0E, 0) #define ZORRO_PROD_DKB_POWER_COMPUTING_RAPID_FIRE ZORRO_ID(DKB_POWER_COMPUTING, 0x0F, 0) #define ZORRO_PROD_DKB_POWER_COMPUTING_DKM_1202 ZORRO_ID(DKB_POWER_COMPUTING, 0x10, 0) #define ZORRO_PROD_DKB_POWER_COMPUTING_COBRA_VIPER_II_68EC030 ZORRO_ID(DKB_POWER_COMPUTING, 0x12, 0) #define ZORRO_PROD_DKB_POWER_COMPUTING_WILDFIRE_060_1 ZORRO_ID(DKB_POWER_COMPUTING, 0x17, 0) #define ZORRO_PROD_DKB_POWER_COMPUTING_WILDFIRE_060_2 ZORRO_ID(DKB_POWER_COMPUTING, 0xFF, 0) #define ZORRO_MANUF_GREAT_VALLEY_PRODUCTS_2 0x07E1 #define ZORRO_PROD_GVP_IMPACT_SERIES_I_4K ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x01, 0) #define ZORRO_PROD_GVP_IMPACT_SERIES_I_16K_2 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x02, 0) #define ZORRO_PROD_GVP_IMPACT_SERIES_I_16K_3 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x03, 0) #define ZORRO_PROD_GVP_IMPACT_3001_IDE_1 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x08, 0) #define ZORRO_PROD_GVP_IMPACT_3001_RAM ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x09, 0) #define ZORRO_PROD_GVP_IMPACT_SERIES_II_RAM_1 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0A, 0) #define ZORRO_PROD_GVP_EPC_BASE ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0) #define ZORRO_PROD_GVP_GFORCE_040_1 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x20) #define ZORRO_PROD_GVP_GFORCE_040_SCSI_1 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x30) #define ZORRO_PROD_GVP_A1291 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x40) #define ZORRO_PROD_GVP_COMBO_030_R4 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x60) #define ZORRO_PROD_GVP_COMBO_030_R4_SCSI ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x70) #define ZORRO_PROD_GVP_PHONEPAK ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x78) #define ZORRO_PROD_GVP_IO_EXTENDER ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0x98) #define ZORRO_PROD_GVP_GFORCE_030 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xa0) #define ZORRO_PROD_GVP_GFORCE_030_SCSI ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xb0) #define ZORRO_PROD_GVP_A530 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xc0) #define ZORRO_PROD_GVP_A530_SCSI ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xd0) #define ZORRO_PROD_GVP_COMBO_030_R3 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xe0) #define ZORRO_PROD_GVP_COMBO_030_R3_SCSI ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xf0) #define ZORRO_PROD_GVP_SERIES_II ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0B, 0xf8) #define ZORRO_PROD_GVP_IMPACT_3001_IDE_2 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x0D, 0) #define ZORRO_PROD_GVP_GFORCE_040_060 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x16, 0) #define ZORRO_PROD_GVP_IMPACT_VISION_24 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0x20, 0) #define ZORRO_PROD_GVP_GFORCE_040_2 ZORRO_ID(GREAT_VALLEY_PRODUCTS_2, 0xFF, 0) #define ZORRO_MANUF_CALIFORNIA_ACCESS_SYNERGY 0x07E5 #define ZORRO_PROD_CALIFORNIA_ACCESS_SYNERGY_MALIBU ZORRO_ID(CALIFORNIA_ACCESS_SYNERGY, 0x01, 0) #define ZORRO_MANUF_XETEC 0x07E6 #define ZORRO_PROD_XETEC_FASTCARD ZORRO_ID(XETEC, 0x01, 0) #define ZORRO_PROD_XETEC_FASTCARD_RAM ZORRO_ID(XETEC, 0x02, 0) #define ZORRO_PROD_XETEC_FASTCARD_PLUS ZORRO_ID(XETEC, 0x03, 0) #define ZORRO_MANUF_PROGRESSIVE_PERIPHERALS_AND_SYSTEMS 0x07EA #define ZORRO_PROD_PPS_MERCURY ZORRO_ID(PROGRESSIVE_PERIPHERALS_AND_SYSTEMS, 0x00, 0) #define ZORRO_PROD_PPS_A3000_68040 ZORRO_ID(PROGRESSIVE_PERIPHERALS_AND_SYSTEMS, 0x01, 0) #define ZORRO_PROD_PPS_A2000_68040 ZORRO_ID(PROGRESSIVE_PERIPHERALS_AND_SYSTEMS, 0x69, 0) #define ZORRO_PROD_PPS_ZEUS ZORRO_ID(PROGRESSIVE_PERIPHERALS_AND_SYSTEMS, 0x96, 0) #define ZORRO_PROD_PPS_A500_68040 ZORRO_ID(PROGRESSIVE_PERIPHERALS_AND_SYSTEMS, 0xBB, 0) #define ZORRO_MANUF_XEBEC 0x07EC #define ZORRO_MANUF_SPIRIT_TECHNOLOGY 0x07F2 #define ZORRO_PROD_SPIRIT_TECHNOLOGY_INSIDER_IN1000 ZORRO_ID(SPIRIT_TECHNOLOGY, 0x01, 0) #define ZORRO_PROD_SPIRIT_TECHNOLOGY_INSIDER_IN500 ZORRO_ID(SPIRIT_TECHNOLOGY, 0x02, 0) #define ZORRO_PROD_SPIRIT_TECHNOLOGY_SIN500 ZORRO_ID(SPIRIT_TECHNOLOGY, 0x03, 0) #define ZORRO_PROD_SPIRIT_TECHNOLOGY_HDA_506 ZORRO_ID(SPIRIT_TECHNOLOGY, 0x04, 0) #define ZORRO_PROD_SPIRIT_TECHNOLOGY_AX_S ZORRO_ID(SPIRIT_TECHNOLOGY, 0x05, 0) #define ZORRO_PROD_SPIRIT_TECHNOLOGY_OCTABYTE ZORRO_ID(SPIRIT_TECHNOLOGY, 0x06, 0) #define ZORRO_PROD_SPIRIT_TECHNOLOGY_INMATE ZORRO_ID(SPIRIT_TECHNOLOGY, 0x08, 0) #define ZORRO_MANUF_SPIRIT_TECHNOLOGY_2 0x07F3 #define ZORRO_MANUF_BSC_ALFADATA_1 0x07FE #define ZORRO_PROD_BSC_ALF_3_1 ZORRO_ID(BSC_ALFADATA_1, 0x03, 0) #define ZORRO_MANUF_BSC_ALFADATA_2 0x0801 #define ZORRO_PROD_BSC_ALF_2_1 ZORRO_ID(BSC_ALFADATA_2, 0x01, 0) #define ZORRO_PROD_BSC_ALF_2_2 ZORRO_ID(BSC_ALFADATA_2, 0x02, 0) #define ZORRO_PROD_BSC_ALF_3_2 ZORRO_ID(BSC_ALFADATA_2, 0x03, 0) #define ZORRO_MANUF_CARDCO_2 0x0802 #define ZORRO_PROD_CARDCO_KRONOS_2000_2 ZORRO_ID(CARDCO_2, 0x04, 0) #define ZORRO_PROD_CARDCO_A1000_2 ZORRO_ID(CARDCO_2, 0x0C, 0) #define ZORRO_MANUF_JOCHHEIM 0x0804 #define ZORRO_PROD_JOCHHEIM_RAM ZORRO_ID(JOCHHEIM, 0x01, 0) #define ZORRO_MANUF_CHECKPOINT_TECHNOLOGIES 0x0807 #define ZORRO_PROD_CHECKPOINT_TECHNOLOGIES_SERIAL_SOLUTION ZORRO_ID(CHECKPOINT_TECHNOLOGIES, 0x00, 0) #define ZORRO_MANUF_EDOTRONIK 0x0810 #define ZORRO_PROD_EDOTRONIK_IEEE_488 ZORRO_ID(EDOTRONIK, 0x01, 0) #define ZORRO_PROD_EDOTRONIK_8032 ZORRO_ID(EDOTRONIK, 0x02, 0) #define ZORRO_PROD_EDOTRONIK_MULTISERIAL ZORRO_ID(EDOTRONIK, 0x03, 0) #define ZORRO_PROD_EDOTRONIK_VIDEODIGITIZER ZORRO_ID(EDOTRONIK, 0x04, 0) #define ZORRO_PROD_EDOTRONIK_PARALLEL_IO ZORRO_ID(EDOTRONIK, 0x05, 0) #define ZORRO_PROD_EDOTRONIK_PIC_PROTOYPING ZORRO_ID(EDOTRONIK, 0x06, 0) #define ZORRO_PROD_EDOTRONIK_ADC ZORRO_ID(EDOTRONIK, 0x07, 0) #define ZORRO_PROD_EDOTRONIK_VME ZORRO_ID(EDOTRONIK, 0x08, 0) #define ZORRO_PROD_EDOTRONIK_DSP96000 ZORRO_ID(EDOTRONIK, 0x09, 0) #define ZORRO_MANUF_NES_INC 0x0813 #define ZORRO_PROD_NES_INC_RAM ZORRO_ID(NES_INC, 0x00, 0) #define ZORRO_MANUF_ICD 0x0817 #define ZORRO_PROD_ICD_ADVANTAGE_2000_SCSI ZORRO_ID(ICD, 0x01, 0) #define ZORRO_PROD_ICD_ADVANTAGE_IDE ZORRO_ID(ICD, 0x03, 0) #define ZORRO_PROD_ICD_ADVANTAGE_2080_RAM ZORRO_ID(ICD, 0x04, 0) #define ZORRO_MANUF_KUPKE_2 0x0819 #define ZORRO_PROD_KUPKE_OMTI ZORRO_ID(KUPKE_2, 0x01, 0) #define ZORRO_PROD_KUPKE_SCSI_II ZORRO_ID(KUPKE_2, 0x02, 0) #define ZORRO_PROD_KUPKE_GOLEM_BOX ZORRO_ID(KUPKE_2, 0x03, 0) #define ZORRO_PROD_KUPKE_030_882 ZORRO_ID(KUPKE_2, 0x04, 0) #define ZORRO_PROD_KUPKE_SCSI_AT ZORRO_ID(KUPKE_2, 0x05, 0) #define ZORRO_MANUF_GREAT_VALLEY_PRODUCTS_3 0x081D #define ZORRO_PROD_GVP_A2000_RAM8 ZORRO_ID(GREAT_VALLEY_PRODUCTS_3, 0x09, 0) #define ZORRO_PROD_GVP_IMPACT_SERIES_II_RAM_2 ZORRO_ID(GREAT_VALLEY_PRODUCTS_3, 0x0A, 0) #define ZORRO_MANUF_INTERWORKS_NETWORK 0x081E #define ZORRO_MANUF_HARDITAL_SYNTHESIS 0x0820 #define ZORRO_PROD_HARDITAL_SYNTHESIS_TQM_68030_68882 ZORRO_ID(HARDITAL_SYNTHESIS, 0x14, 0) #define ZORRO_MANUF_APPLIED_ENGINEERING 0x0828 #define ZORRO_PROD_APPLIED_ENGINEERING_DL2000 ZORRO_ID(APPLIED_ENGINEERING, 0x10, 0) #define ZORRO_PROD_APPLIED_ENGINEERING_RAM_WORKS ZORRO_ID(APPLIED_ENGINEERING, 0xE0, 0) #define ZORRO_MANUF_BSC_ALFADATA_3 0x082C #define ZORRO_PROD_BSC_OKTAGON_2008 ZORRO_ID(BSC_ALFADATA_3, 0x05, 0) #define ZORRO_PROD_BSC_TANDEM_AT_2008_508 ZORRO_ID(BSC_ALFADATA_3, 0x06, 0) #define ZORRO_PROD_BSC_ALFA_RAM_1200 ZORRO_ID(BSC_ALFADATA_3, 0x07, 0) #define ZORRO_PROD_BSC_OKTAGON_2008_RAM ZORRO_ID(BSC_ALFADATA_3, 0x08, 0) #define ZORRO_PROD_BSC_MULTIFACE_I ZORRO_ID(BSC_ALFADATA_3, 0x10, 0) #define ZORRO_PROD_BSC_MULTIFACE_II ZORRO_ID(BSC_ALFADATA_3, 0x11, 0) #define ZORRO_PROD_BSC_MULTIFACE_III ZORRO_ID(BSC_ALFADATA_3, 0x12, 0) #define ZORRO_PROD_BSC_FRAMEMASTER_II ZORRO_ID(BSC_ALFADATA_3, 0x20, 0) #define ZORRO_PROD_BSC_GRAFFITI_RAM ZORRO_ID(BSC_ALFADATA_3, 0x21, 0) #define ZORRO_PROD_BSC_GRAFFITI_REG ZORRO_ID(BSC_ALFADATA_3, 0x22, 0) #define ZORRO_PROD_BSC_ISDN_MASTERCARD ZORRO_ID(BSC_ALFADATA_3, 0x40, 0) #define ZORRO_PROD_BSC_ISDN_MASTERCARD_II ZORRO_ID(BSC_ALFADATA_3, 0x41, 0) #define ZORRO_MANUF_PHOENIX 0x0835 #define ZORRO_PROD_PHOENIX_ST506 ZORRO_ID(PHOENIX, 0x21, 0) #define ZORRO_PROD_PHOENIX_SCSI ZORRO_ID(PHOENIX, 0x22, 0) #define ZORRO_PROD_PHOENIX_RAM ZORRO_ID(PHOENIX, 0xBE, 0) #define ZORRO_MANUF_ADVANCED_STORAGE_SYSTEMS 0x0836 #define ZORRO_PROD_ADVANCED_STORAGE_SYSTEMS_NEXUS ZORRO_ID(ADVANCED_STORAGE_SYSTEMS, 0x01, 0) #define ZORRO_PROD_ADVANCED_STORAGE_SYSTEMS_NEXUS_RAM ZORRO_ID(ADVANCED_STORAGE_SYSTEMS, 0x08, 0) #define ZORRO_MANUF_IMPULSE 0x0838 #define ZORRO_PROD_IMPULSE_FIRECRACKER_24 ZORRO_ID(IMPULSE, 0x00, 0) #define ZORRO_MANUF_IVS 0x0840 #define ZORRO_PROD_IVS_GRANDSLAM_PIC_2 ZORRO_ID(IVS, 0x02, 0) #define ZORRO_PROD_IVS_GRANDSLAM_PIC_1 ZORRO_ID(IVS, 0x04, 0) #define ZORRO_PROD_IVS_OVERDRIVE ZORRO_ID(IVS, 0x10, 0) #define ZORRO_PROD_IVS_TRUMPCARD_CLASSIC ZORRO_ID(IVS, 0x30, 0) #define ZORRO_PROD_IVS_TRUMPCARD_PRO_GRANDSLAM ZORRO_ID(IVS, 0x34, 0) #define ZORRO_PROD_IVS_META_4 ZORRO_ID(IVS, 0x40, 0) #define ZORRO_PROD_IVS_WAVETOOLS ZORRO_ID(IVS, 0xBF, 0) #define ZORRO_PROD_IVS_VECTOR_1 ZORRO_ID(IVS, 0xF3, 0) #define ZORRO_PROD_IVS_VECTOR_2 ZORRO_ID(IVS, 0xF4, 0) #define ZORRO_MANUF_VECTOR_1 0x0841 #define ZORRO_PROD_VECTOR_CONNECTION_1 ZORRO_ID(VECTOR_1, 0xE3, 0) #define ZORRO_MANUF_XPERT_PRODEV 0x0845 #define ZORRO_PROD_XPERT_PRODEV_VISIONA_RAM ZORRO_ID(XPERT_PRODEV, 0x01, 0) #define ZORRO_PROD_XPERT_PRODEV_VISIONA_REG ZORRO_ID(XPERT_PRODEV, 0x02, 0) #define ZORRO_PROD_XPERT_PRODEV_MERLIN_RAM ZORRO_ID(XPERT_PRODEV, 0x03, 0) #define ZORRO_PROD_XPERT_PRODEV_MERLIN_REG_1 ZORRO_ID(XPERT_PRODEV, 0x04, 0) #define ZORRO_PROD_XPERT_PRODEV_MERLIN_REG_2 ZORRO_ID(XPERT_PRODEV, 0xC9, 0) #define ZORRO_MANUF_HYDRA_SYSTEMS 0x0849 #define ZORRO_PROD_HYDRA_SYSTEMS_AMIGANET ZORRO_ID(HYDRA_SYSTEMS, 0x01, 0) #define ZORRO_MANUF_SUNRIZE_INDUSTRIES 0x084F #define ZORRO_PROD_SUNRIZE_INDUSTRIES_AD1012 ZORRO_ID(SUNRIZE_INDUSTRIES, 0x01, 0) #define ZORRO_PROD_SUNRIZE_INDUSTRIES_AD516 ZORRO_ID(SUNRIZE_INDUSTRIES, 0x02, 0) #define ZORRO_PROD_SUNRIZE_INDUSTRIES_DD512 ZORRO_ID(SUNRIZE_INDUSTRIES, 0x03, 0) #define ZORRO_MANUF_TRICERATOPS 0x0850 #define ZORRO_PROD_TRICERATOPS_MULTI_IO ZORRO_ID(TRICERATOPS, 0x01, 0) #define ZORRO_MANUF_APPLIED_MAGIC 0x0851 #define ZORRO_PROD_APPLIED_MAGIC_DMI_RESOLVER ZORRO_ID(APPLIED_MAGIC, 0x01, 0) #define ZORRO_PROD_APPLIED_MAGIC_DIGITAL_BROADCASTER ZORRO_ID(APPLIED_MAGIC, 0x06, 0) #define ZORRO_MANUF_GFX_BASE 0x085E #define ZORRO_PROD_GFX_BASE_GDA_1_VRAM ZORRO_ID(GFX_BASE, 0x00, 0) #define ZORRO_PROD_GFX_BASE_GDA_1 ZORRO_ID(GFX_BASE, 0x01, 0) #define ZORRO_MANUF_ROCTEC 0x0860 #define ZORRO_PROD_ROCTEC_RH_800C ZORRO_ID(ROCTEC, 0x01, 0) #define ZORRO_PROD_ROCTEC_RH_800C_RAM ZORRO_ID(ROCTEC, 0x01, 0) #define ZORRO_MANUF_KATO 0x0861 #define ZORRO_PROD_KATO_MELODY ZORRO_ID(KATO, 0x80, 0) #define ZORRO_MANUF_HELFRICH_1 0x0861 #define ZORRO_PROD_HELFRICH_RAINBOW_II ZORRO_ID(HELFRICH_1, 0x20, 0) #define ZORRO_PROD_HELFRICH_RAINBOW_III ZORRO_ID(HELFRICH_1, 0x21, 0) #define ZORRO_MANUF_ATLANTIS 0x0862 #define ZORRO_MANUF_PROTAR 0x0864 #define ZORRO_MANUF_ACS 0x0865 #define ZORRO_MANUF_SOFTWARE_RESULTS_ENTERPRISES 0x0866 #define ZORRO_PROD_SOFTWARE_RESULTS_ENTERPRISES_GOLDEN_GATE_2_BUS_PLUS ZORRO_ID(SOFTWARE_RESULTS_ENTERPRISES, 0x01, 0) #define ZORRO_MANUF_MASOBOSHI 0x086D #define ZORRO_PROD_MASOBOSHI_MASTER_CARD_SC201 ZORRO_ID(MASOBOSHI, 0x03, 0) #define ZORRO_PROD_MASOBOSHI_MASTER_CARD_MC702 ZORRO_ID(MASOBOSHI, 0x04, 0) #define ZORRO_PROD_MASOBOSHI_MVD_819 ZORRO_ID(MASOBOSHI, 0x07, 0) #define ZORRO_MANUF_MAINHATTAN_DATA 0x086F #define ZORRO_PROD_MAINHATTAN_DATA_IDE ZORRO_ID(MAINHATTAN_DATA, 0x01, 0) #define ZORRO_MANUF_VILLAGE_TRONIC 0x0877 #define ZORRO_PROD_VILLAGE_TRONIC_DOMINO_RAM ZORRO_ID(VILLAGE_TRONIC, 0x01, 0) #define ZORRO_PROD_VILLAGE_TRONIC_DOMINO_REG ZORRO_ID(VILLAGE_TRONIC, 0x02, 0) #define ZORRO_PROD_VILLAGE_TRONIC_DOMINO_16M_PROTOTYPE ZORRO_ID(VILLAGE_TRONIC, 0x03, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_RAM ZORRO_ID(VILLAGE_TRONIC, 0x0B, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_REG ZORRO_ID(VILLAGE_TRONIC, 0x0C, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_SEGMENTED_MODE ZORRO_ID(VILLAGE_TRONIC, 0x0D, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_MEM1 ZORRO_ID(VILLAGE_TRONIC, 0x15, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_MEM2 ZORRO_ID(VILLAGE_TRONIC, 0x16, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_REG ZORRO_ID(VILLAGE_TRONIC, 0x17, 0) #define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z3 ZORRO_ID(VILLAGE_TRONIC, 0x18, 0) #define ZORRO_PROD_VILLAGE_TRONIC_ARIADNE ZORRO_ID(VILLAGE_TRONIC, 0xC9, 0) #define ZORRO_PROD_VILLAGE_TRONIC_ARIADNE2 ZORRO_ID(VILLAGE_TRONIC, 0xCA, 0) #define ZORRO_MANUF_UTILITIES_UNLIMITED 0x087B #define ZORRO_PROD_UTILITIES_UNLIMITED_EMPLANT_DELUXE ZORRO_ID(UTILITIES_UNLIMITED, 0x15, 0) #define ZORRO_PROD_UTILITIES_UNLIMITED_EMPLANT_DELUXE2 ZORRO_ID(UTILITIES_UNLIMITED, 0x20, 0) #define ZORRO_MANUF_AMITRIX 0x0880 #define ZORRO_PROD_AMITRIX_MULTI_IO ZORRO_ID(AMITRIX, 0x01, 0) #define ZORRO_PROD_AMITRIX_CD_RAM ZORRO_ID(AMITRIX, 0x02, 0) #define ZORRO_MANUF_ARMAX 0x0885 #define ZORRO_PROD_ARMAX_OMNIBUS ZORRO_ID(ARMAX, 0x00, 0) #define ZORRO_MANUF_ZEUS 0x088D #define ZORRO_PROD_ZEUS_SPIDER ZORRO_ID(ZEUS, 0x04, 0) #define ZORRO_MANUF_NEWTEK 0x088F #define ZORRO_PROD_NEWTEK_VIDEOTOASTER ZORRO_ID(NEWTEK, 0x00, 0) #define ZORRO_MANUF_M_TECH_GERMANY 0x0890 #define ZORRO_PROD_MTEC_AT500_2 ZORRO_ID(M_TECH_GERMANY, 0x01, 0) #define ZORRO_PROD_MTEC_68030 ZORRO_ID(M_TECH_GERMANY, 0x03, 0) #define ZORRO_PROD_MTEC_68020I ZORRO_ID(M_TECH_GERMANY, 0x06, 0) #define ZORRO_PROD_MTEC_A1200_T68030_RTC ZORRO_ID(M_TECH_GERMANY, 0x20, 0) #define ZORRO_PROD_MTEC_VIPER_MK_V_E_MATRIX_530 ZORRO_ID(M_TECH_GERMANY, 0x21, 0) #define ZORRO_PROD_MTEC_8_MB_RAM ZORRO_ID(M_TECH_GERMANY, 0x22, 0) #define ZORRO_PROD_MTEC_VIPER_MK_V_E_MATRIX_530_SCSI_IDE ZORRO_ID(M_TECH_GERMANY, 0x24, 0) #define ZORRO_MANUF_GREAT_VALLEY_PRODUCTS_4 0x0891 #define ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_RAM ZORRO_ID(GREAT_VALLEY_PRODUCTS_4, 0x01, 0) #define ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_REG ZORRO_ID(GREAT_VALLEY_PRODUCTS_4, 0x02, 0) #define ZORRO_MANUF_APOLLO_1 0x0892 #define ZORRO_PROD_APOLLO_A1200 ZORRO_ID(APOLLO_1, 0x01, 0) #define ZORRO_MANUF_HELFRICH_2 0x0893 #define ZORRO_PROD_HELFRICH_PICCOLO_RAM ZORRO_ID(HELFRICH_2, 0x05, 0) #define ZORRO_PROD_HELFRICH_PICCOLO_REG ZORRO_ID(HELFRICH_2, 0x06, 0) #define ZORRO_PROD_HELFRICH_PEGGY_PLUS_MPEG ZORRO_ID(HELFRICH_2, 0x07, 0) #define ZORRO_PROD_HELFRICH_VIDEOCRUNCHER ZORRO_ID(HELFRICH_2, 0x08, 0) #define ZORRO_PROD_HELFRICH_SD64_RAM ZORRO_ID(HELFRICH_2, 0x0A, 0) #define ZORRO_PROD_HELFRICH_SD64_REG ZORRO_ID(HELFRICH_2, 0x0B, 0) #define ZORRO_MANUF_MACROSYSTEMS_USA 0x089B #define ZORRO_PROD_MACROSYSTEMS_WARP_ENGINE_40xx ZORRO_ID(MACROSYSTEMS_USA, 0x13, 0) #define ZORRO_MANUF_ELBOX_COMPUTER 0x089E #define ZORRO_PROD_ELBOX_COMPUTER_1200_4 ZORRO_ID(ELBOX_COMPUTER, 0x06, 0) #define ZORRO_MANUF_HARMS_PROFESSIONAL 0x0A00 #define ZORRO_PROD_HARMS_PROFESSIONAL_030_PLUS ZORRO_ID(HARMS_PROFESSIONAL, 0x10, 0) #define ZORRO_PROD_HARMS_PROFESSIONAL_3500 ZORRO_ID(HARMS_PROFESSIONAL, 0xD0, 0) #define ZORRO_MANUF_MICRONIK 0x0A50 #define ZORRO_PROD_MICRONIK_RCA_120 ZORRO_ID(MICRONIK, 0x0A, 0) #define ZORRO_MANUF_MICRONIK2 0x0F0F #define ZORRO_PROD_MICRONIK2_Z3I ZORRO_ID(MICRONIK2, 0x01, 0) #define ZORRO_MANUF_MEGAMICRO 0x1000 #define ZORRO_PROD_MEGAMICRO_SCRAM_500 ZORRO_ID(MEGAMICRO, 0x03, 0) #define ZORRO_PROD_MEGAMICRO_SCRAM_500_RAM ZORRO_ID(MEGAMICRO, 0x04, 0) #define ZORRO_MANUF_IMTRONICS_2 0x1028 #define ZORRO_PROD_IMTRONICS_HURRICANE_2800_3 ZORRO_ID(IMTRONICS_2, 0x39, 0) #define ZORRO_PROD_IMTRONICS_HURRICANE_2800_4 ZORRO_ID(IMTRONICS_2, 0x57, 0) #define ZORRO_MANUF_INDIVIDUAL_COMPUTERS 0x1212 #define ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA ZORRO_ID(INDIVIDUAL_COMPUTERS, 0x00, 0) #define ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF ZORRO_ID(INDIVIDUAL_COMPUTERS, 0x17, 0) #define ZORRO_PROD_INDIVIDUAL_COMPUTERS_CATWEASEL ZORRO_ID(INDIVIDUAL_COMPUTERS, 0x2A, 0) #define ZORRO_MANUF_KUPKE_3 0x1248 #define ZORRO_PROD_KUPKE_GOLEM_HD_3000 ZORRO_ID(KUPKE_3, 0x01, 0) #define ZORRO_MANUF_ITH 0x1388 #define ZORRO_PROD_ITH_ISDN_MASTER_II ZORRO_ID(ITH, 0x01, 0) #define ZORRO_MANUF_VMC 0x1389 #define ZORRO_PROD_VMC_ISDN_BLASTER_Z2 ZORRO_ID(VMC, 0x01, 0) #define ZORRO_PROD_VMC_HYPERCOM_4 ZORRO_ID(VMC, 0x02, 0) #define ZORRO_MANUF_INFORMATION 0x157C #define ZORRO_PROD_INFORMATION_ISDN_ENGINE_I ZORRO_ID(INFORMATION, 0x64, 0) #define ZORRO_MANUF_VORTEX 0x2017 #define ZORRO_PROD_VORTEX_GOLDEN_GATE_80386SX ZORRO_ID(VORTEX, 0x07, 0) #define ZORRO_PROD_VORTEX_GOLDEN_GATE_RAM ZORRO_ID(VORTEX, 0x08, 0) #define ZORRO_PROD_VORTEX_GOLDEN_GATE_80486 ZORRO_ID(VORTEX, 0x09, 0) #define ZORRO_MANUF_EXPANSION_SYSTEMS 0x2062 #define ZORRO_PROD_EXPANSION_SYSTEMS_DATAFLYER_4000SX ZORRO_ID(EXPANSION_SYSTEMS, 0x01, 0) #define ZORRO_PROD_EXPANSION_SYSTEMS_DATAFLYER_4000SX_RAM ZORRO_ID(EXPANSION_SYSTEMS, 0x02, 0) #define ZORRO_MANUF_READYSOFT 0x2100 #define ZORRO_PROD_READYSOFT_AMAX_II_IV ZORRO_ID(READYSOFT, 0x01, 0) #define ZORRO_MANUF_PHASE5 0x2140 #define ZORRO_PROD_PHASE5_BLIZZARD_RAM ZORRO_ID(PHASE5, 0x01, 0) #define ZORRO_PROD_PHASE5_BLIZZARD ZORRO_ID(PHASE5, 0x02, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_1220_IV ZORRO_ID(PHASE5, 0x06, 0) #define ZORRO_PROD_PHASE5_FASTLANE_Z3_RAM ZORRO_ID(PHASE5, 0x0A, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_1230_II_FASTLANE_Z3_CYBERSCSI_CYBERSTORM060 ZORRO_ID(PHASE5, 0x0B, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_1220_CYBERSTORM ZORRO_ID(PHASE5, 0x0C, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_1230 ZORRO_ID(PHASE5, 0x0D, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_1230_IV_1260 ZORRO_ID(PHASE5, 0x11, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_2060 ZORRO_ID(PHASE5, 0x18, 0) #define ZORRO_PROD_PHASE5_CYBERSTORM_MK_II ZORRO_ID(PHASE5, 0x19, 0) #define ZORRO_PROD_PHASE5_CYBERVISION64 ZORRO_ID(PHASE5, 0x22, 0) #define ZORRO_PROD_PHASE5_CYBERVISION64_3D_PROTOTYPE ZORRO_ID(PHASE5, 0x32, 0) #define ZORRO_PROD_PHASE5_CYBERVISION64_3D ZORRO_ID(PHASE5, 0x43, 0) #define ZORRO_PROD_PHASE5_CYBERSTORM_MK_III ZORRO_ID(PHASE5, 0x64, 0) #define ZORRO_PROD_PHASE5_BLIZZARD_603E_PLUS ZORRO_ID(PHASE5, 0x6e, 0) #define ZORRO_MANUF_DPS 0x2169 #define ZORRO_PROD_DPS_PERSONAL_ANIMATION_RECORDER ZORRO_ID(DPS, 0x01, 0) #define ZORRO_MANUF_APOLLO_2 0x2200 #define ZORRO_PROD_APOLLO_A620_68020_1 ZORRO_ID(APOLLO_2, 0x00, 0) #define ZORRO_PROD_APOLLO_A620_68020_2 ZORRO_ID(APOLLO_2, 0x01, 0) #define ZORRO_MANUF_APOLLO_3 0x2222 #define ZORRO_PROD_APOLLO_AT_APOLLO ZORRO_ID(APOLLO_3, 0x22, 0) #define ZORRO_PROD_APOLLO_1230_1240_1260_2030_4040_4060 ZORRO_ID(APOLLO_3, 0x23, 0) #define ZORRO_MANUF_PETSOFF_LP 0x38A5 #define ZORRO_PROD_PETSOFF_LP_DELFINA ZORRO_ID(PETSOFF_LP, 0x00, 0) #define ZORRO_PROD_PETSOFF_LP_DELFINA_LITE ZORRO_ID(PETSOFF_LP, 0x01, 0) #define ZORRO_MANUF_UWE_GERLACH 0x3FF7 #define ZORRO_PROD_UWE_GERLACH_RAM_ROM ZORRO_ID(UWE_GERLACH, 0xd4, 0) #define ZORRO_MANUF_ACT 0x4231 #define ZORRO_PROD_ACT_PRELUDE ZORRO_ID(ACT, 0x01, 0) #define ZORRO_MANUF_MACROSYSTEMS_GERMANY 0x4754 #define ZORRO_PROD_MACROSYSTEMS_MAESTRO ZORRO_ID(MACROSYSTEMS_GERMANY, 0x03, 0) #define ZORRO_PROD_MACROSYSTEMS_VLAB ZORRO_ID(MACROSYSTEMS_GERMANY, 0x04, 0) #define ZORRO_PROD_MACROSYSTEMS_MAESTRO_PRO ZORRO_ID(MACROSYSTEMS_GERMANY, 0x05, 0) #define ZORRO_PROD_MACROSYSTEMS_RETINA ZORRO_ID(MACROSYSTEMS_GERMANY, 0x06, 0) #define ZORRO_PROD_MACROSYSTEMS_MULTI_EVOLUTION ZORRO_ID(MACROSYSTEMS_GERMANY, 0x08, 0) #define ZORRO_PROD_MACROSYSTEMS_TOCCATA ZORRO_ID(MACROSYSTEMS_GERMANY, 0x0C, 0) #define ZORRO_PROD_MACROSYSTEMS_RETINA_Z3 ZORRO_ID(MACROSYSTEMS_GERMANY, 0x10, 0) #define ZORRO_PROD_MACROSYSTEMS_VLAB_MOTION ZORRO_ID(MACROSYSTEMS_GERMANY, 0x12, 0) #define ZORRO_PROD_MACROSYSTEMS_ALTAIS ZORRO_ID(MACROSYSTEMS_GERMANY, 0x13, 0) #define ZORRO_PROD_MACROSYSTEMS_FALCON_040 ZORRO_ID(MACROSYSTEMS_GERMANY, 0xFD, 0) #define ZORRO_MANUF_COMBITEC 0x6766 #define ZORRO_MANUF_SKI_PERIPHERALS 0x8000 #define ZORRO_PROD_SKI_PERIPHERALS_MAST_FIREBALL ZORRO_ID(SKI_PERIPHERALS, 0x08, 0) #define ZORRO_PROD_SKI_PERIPHERALS_SCSI_DUAL_SERIAL ZORRO_ID(SKI_PERIPHERALS, 0x80, 0) #define ZORRO_MANUF_REIS_WARE_2 0xA9AD #define ZORRO_PROD_REIS_WARE_SCAN_KING ZORRO_ID(REIS_WARE_2, 0x11, 0) #define ZORRO_MANUF_CAMERON 0xAA01 #define ZORRO_PROD_CAMERON_PERSONAL_A4 ZORRO_ID(CAMERON, 0x10, 0) #define ZORRO_MANUF_REIS_WARE 0xAA11 #define ZORRO_PROD_REIS_WARE_HANDYSCANNER ZORRO_ID(REIS_WARE, 0x11, 0) #define ZORRO_MANUF_PHOENIX_2 0xB5A8 #define ZORRO_PROD_PHOENIX_ST506_2 ZORRO_ID(PHOENIX_2, 0x21, 0) #define ZORRO_PROD_PHOENIX_SCSI_2 ZORRO_ID(PHOENIX_2, 0x22, 0) #define ZORRO_PROD_PHOENIX_RAM_2 ZORRO_ID(PHOENIX_2, 0xBE, 0) #define ZORRO_MANUF_COMBITEC_2 0xC008 #define ZORRO_PROD_COMBITEC_HD ZORRO_ID(COMBITEC_2, 0x2A, 0) #define ZORRO_PROD_COMBITEC_SRAM ZORRO_ID(COMBITEC_2, 0x2B, 0) #define ZORRO_MANUF_HACKER 0x07DB #define ZORRO_PROD_GENERAL_PROTOTYPE ZORRO_ID(HACKER, 0x00, 0) #define ZORRO_PROD_HACKER_SCSI ZORRO_ID(HACKER, 0x01, 0) #define ZORRO_PROD_RESOURCE_MANAGEMENT_FORCE_QUICKNET_QN2000 ZORRO_ID(HACKER, 0x02, 0) #define ZORRO_PROD_VECTOR_CONNECTION_2 ZORRO_ID(HACKER, 0xE0, 0) #define ZORRO_PROD_VECTOR_CONNECTION_3 ZORRO_ID(HACKER, 0xE1, 0) #define ZORRO_PROD_VECTOR_CONNECTION_4 ZORRO_ID(HACKER, 0xE2, 0) #define ZORRO_PROD_VECTOR_CONNECTION_5 ZORRO_ID(HACKER, 0xE3, 0) android-audiosystem-1.8+13.10.20130807/include/linux/mroute6.h0000644000015700001700000000540612200324306024233 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_MROUTE6_H #define __LINUX_MROUTE6_H #include #include #define MRT6_BASE 200 #define MRT6_INIT (MRT6_BASE) #define MRT6_DONE (MRT6_BASE+1) #define MRT6_ADD_MIF (MRT6_BASE+2) #define MRT6_DEL_MIF (MRT6_BASE+3) #define MRT6_ADD_MFC (MRT6_BASE+4) #define MRT6_DEL_MFC (MRT6_BASE+5) #define MRT6_VERSION (MRT6_BASE+6) #define MRT6_ASSERT (MRT6_BASE+7) #define MRT6_PIM (MRT6_BASE+8) #define MRT6_TABLE (MRT6_BASE+9) #define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE #define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1) #define SIOCGETRPF (SIOCPROTOPRIVATE+2) #define MAXMIFS 32 typedef unsigned long mifbitmap_t; typedef unsigned short mifi_t; #define ALL_MIFS ((mifi_t)(-1)) #ifndef IF_SETSIZE #define IF_SETSIZE 256 #endif typedef __u32 if_mask; #define NIFBITS (sizeof(if_mask) * 8) #ifndef DIV_ROUND_UP #define DIV_ROUND_UP(x,y) (((x) + ((y) - 1)) / (y)) #endif typedef struct if_set { if_mask ifs_bits[DIV_ROUND_UP(IF_SETSIZE, NIFBITS)]; } if_set; #define IF_SET(n, p) ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS))) #define IF_CLR(n, p) ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS))) #define IF_ISSET(n, p) ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS))) #define IF_COPY(f, t) bcopy(f, t, sizeof(*(f))) #define IF_ZERO(p) bzero(p, sizeof(*(p))) struct mif6ctl { mifi_t mif6c_mifi; unsigned char mif6c_flags; unsigned char vifc_threshold; __u16 mif6c_pifi; unsigned int vifc_rate_limit; }; #define MIFF_REGISTER 0x1 struct mf6cctl { struct sockaddr_in6 mf6cc_origin; struct sockaddr_in6 mf6cc_mcastgrp; mifi_t mf6cc_parent; struct if_set mf6cc_ifset; }; struct sioc_sg_req6 { struct sockaddr_in6 src; struct sockaddr_in6 grp; unsigned long pktcnt; unsigned long bytecnt; unsigned long wrong_if; }; struct sioc_mif_req6 { mifi_t mifi; unsigned long icount; unsigned long ocount; unsigned long ibytes; unsigned long obytes; }; struct mrt6msg { #define MRT6MSG_NOCACHE 1 #define MRT6MSG_WRONGMIF 2 #define MRT6MSG_WHOLEPKT 3 __u8 im6_mbz; __u8 im6_msgtype; __u16 im6_mif; __u32 im6_pad; struct in6_addr im6_src, im6_dst; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/tiocl.h0000644000015700001700000000267712200324306023753 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_TIOCL_H #define _LINUX_TIOCL_H #define TIOCL_SETSEL 2 #define TIOCL_SELCHAR 0 #define TIOCL_SELWORD 1 #define TIOCL_SELLINE 2 #define TIOCL_SELPOINTER 3 #define TIOCL_SELCLEAR 4 #define TIOCL_SELMOUSEREPORT 16 #define TIOCL_SELBUTTONMASK 15 struct tiocl_selection { unsigned short xs; unsigned short ys; unsigned short xe; unsigned short ye; unsigned short sel_mode; }; #define TIOCL_PASTESEL 3 #define TIOCL_UNBLANKSCREEN 4 #define TIOCL_SELLOADLUT 5 #define TIOCL_GETSHIFTSTATE 6 #define TIOCL_GETMOUSEREPORTING 7 #define TIOCL_SETVESABLANK 10 #define TIOCL_SETKMSGREDIRECT 11 #define TIOCL_GETFGCONSOLE 12 #define TIOCL_SCROLLCONSOLE 13 #define TIOCL_BLANKSCREEN 14 #define TIOCL_BLANKEDSCREEN 15 #define TIOCL_GETKMSGREDIRECT 17 #endif android-audiosystem-1.8+13.10.20130807/include/linux/inotify.h0000644000015700001700000000341612200324306024312 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_INOTIFY_H #define _LINUX_INOTIFY_H #include struct inotify_event { __s32 wd; __u32 mask; __u32 cookie; __u32 len; char name[0]; }; #define IN_ACCESS 0x00000001 #define IN_MODIFY 0x00000002 #define IN_ATTRIB 0x00000004 #define IN_CLOSE_WRITE 0x00000008 #define IN_CLOSE_NOWRITE 0x00000010 #define IN_OPEN 0x00000020 #define IN_MOVED_FROM 0x00000040 #define IN_MOVED_TO 0x00000080 #define IN_CREATE 0x00000100 #define IN_DELETE 0x00000200 #define IN_DELETE_SELF 0x00000400 #define IN_MOVE_SELF 0x00000800 #define IN_UNMOUNT 0x00002000 #define IN_Q_OVERFLOW 0x00004000 #define IN_IGNORED 0x00008000 #define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) #define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) #define IN_ONLYDIR 0x01000000 #define IN_DONT_FOLLOW 0x02000000 #define IN_MASK_ADD 0x20000000 #define IN_ISDIR 0x40000000 #define IN_ONESHOT 0x80000000 #define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | IN_MOVE_SELF) #endif android-audiosystem-1.8+13.10.20130807/include/linux/vfs.h0000644000015700001700000000135012200324306023422 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_VFS_H #define _LINUX_VFS_H #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/ptrace.h0000644000015700001700000000325012200324306024103 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_PTRACE_H #define _LINUX_PTRACE_H #define PTRACE_TRACEME 0 #define PTRACE_PEEKTEXT 1 #define PTRACE_PEEKDATA 2 #define PTRACE_PEEKUSR 3 #define PTRACE_POKETEXT 4 #define PTRACE_POKEDATA 5 #define PTRACE_POKEUSR 6 #define PTRACE_CONT 7 #define PTRACE_KILL 8 #define PTRACE_SINGLESTEP 9 #define PTRACE_ATTACH 0x10 #define PTRACE_DETACH 0x11 #define PTRACE_SYSCALL 24 #define PTRACE_SETOPTIONS 0x4200 #define PTRACE_GETEVENTMSG 0x4201 #define PTRACE_GETSIGINFO 0x4202 #define PTRACE_SETSIGINFO 0x4203 #define PTRACE_O_TRACESYSGOOD 0x00000001 #define PTRACE_O_TRACEFORK 0x00000002 #define PTRACE_O_TRACEVFORK 0x00000004 #define PTRACE_O_TRACECLONE 0x00000008 #define PTRACE_O_TRACEEXEC 0x00000010 #define PTRACE_O_TRACEVFORKDONE 0x00000020 #define PTRACE_O_TRACEEXIT 0x00000040 #define PTRACE_O_MASK 0x0000007f #define PTRACE_EVENT_FORK 1 #define PTRACE_EVENT_VFORK 2 #define PTRACE_EVENT_CLONE 3 #define PTRACE_EVENT_EXEC 4 #define PTRACE_EVENT_VFORK_DONE 5 #define PTRACE_EVENT_EXIT 6 #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_bridge.h0000644000015700001700000000170312200324306026136 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_BRIDGE_NETFILTER_H #define __LINUX_BRIDGE_NETFILTER_H #include #define NF_BR_PRE_ROUTING 0 #define NF_BR_LOCAL_IN 1 #define NF_BR_FORWARD 2 #define NF_BR_LOCAL_OUT 3 #define NF_BR_POST_ROUTING 4 #define NF_BR_BROUTING 5 #define NF_BR_NUMHOOKS 6 #endif android-audiosystem-1.8+13.10.20130807/include/linux/msm_q6venc.h0000755000015700001700000001537012200324306024714 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _MSM_VENC_H_ #define _MSM_VENC_H_ #include #define VENC_MAX_RECON_BUFFERS 2 #define VENC_FLAG_EOS 0x00000001 #define VENC_FLAG_END_OF_FRAME 0x00000010 #define VENC_FLAG_SYNC_FRAME 0x00000020 #define VENC_FLAG_EXTRA_DATA 0x00000040 #define VENC_FLAG_CODEC_CONFIG 0x00000080 enum venc_flush_type { VENC_FLUSH_INPUT, VENC_FLUSH_OUTPUT, VENC_FLUSH_ALL }; enum venc_state_type { VENC_STATE_PAUSE = 0x1, VENC_STATE_START = 0x2, VENC_STATE_STOP = 0x4 }; enum venc_event_type_enum { VENC_EVENT_START_STATUS, VENC_EVENT_STOP_STATUS, VENC_EVENT_SUSPEND_STATUS, VENC_EVENT_RESUME_STATUS, VENC_EVENT_FLUSH_STATUS, VENC_EVENT_RELEASE_INPUT, VENC_EVENT_DELIVER_OUTPUT, VENC_EVENT_UNKNOWN_STATUS }; enum venc_status_code { VENC_STATUS_SUCCESS, VENC_STATUS_ERROR, VENC_STATUS_INVALID_STATE, VENC_STATUS_FLUSHING, VENC_STATUS_INVALID_PARAM, VENC_STATUS_CMD_QUEUE_FULL, VENC_STATUS_CRITICAL, VENC_STATUS_INSUFFICIENT_RESOURCES, VENC_STATUS_TIMEOUT }; enum venc_msg_code { VENC_MSG_INDICATION, VENC_MSG_INPUT_BUFFER_DONE, VENC_MSG_OUTPUT_BUFFER_DONE, VENC_MSG_NEED_OUTPUT_BUFFER, VENC_MSG_FLUSH, VENC_MSG_START, VENC_MSG_STOP, VENC_MSG_PAUSE, VENC_MSG_RESUME, VENC_MSG_STOP_READING_MSG }; enum venc_error_code { VENC_S_SUCCESS, VENC_S_EFAIL, VENC_S_EFATAL, VENC_S_EBADPARAM, VENC_S_EINVALSTATE, VENC_S_ENOSWRES, VENC_S_ENOHWRES, VENC_S_EBUFFREQ, VENC_S_EINVALCMD, VENC_S_ETIMEOUT, VENC_S_ENOREATMPT, VENC_S_ENOPREREQ, VENC_S_ECMDQFULL, VENC_S_ENOTSUPP, VENC_S_ENOTIMPL, VENC_S_ENOTPMEM, VENC_S_EFLUSHED, VENC_S_EINSUFBUF, VENC_S_ESAMESTATE, VENC_S_EINVALTRANS }; enum venc_mem_region_enum { VENC_PMEM_EBI1, VENC_PMEM_SMI }; struct venc_buf_type { unsigned int region; unsigned int phys; unsigned int size; int offset; }; struct venc_qp_range { unsigned int min_qp; unsigned int max_qp; }; struct venc_frame_rate { unsigned int frame_rate_num; unsigned int frame_rate_den; }; struct venc_slice_info { unsigned int slice_mode; unsigned int units_per_slice; }; struct venc_extra_data { unsigned int slice_extra_data_flag; unsigned int slice_client_data1; unsigned int slice_client_data2; unsigned int slice_client_data3; unsigned int none_extra_data_flag; unsigned int none_client_data1; unsigned int none_client_data2; unsigned int none_client_data3; }; struct venc_common_config { unsigned int standard; unsigned int input_frame_height; unsigned int input_frame_width; unsigned int output_frame_height; unsigned int output_frame_width; unsigned int rotation_angle; unsigned int intra_period; unsigned int rate_control; struct venc_frame_rate frame_rate; unsigned int bitrate; struct venc_qp_range qp_range; unsigned int iframe_qp; unsigned int pframe_qp; struct venc_slice_info slice_config; struct venc_extra_data extra_data; }; struct venc_nonio_buf_config { struct venc_buf_type recon_buf1; struct venc_buf_type recon_buf2; struct venc_buf_type wb_buf; struct venc_buf_type cmd_buf; struct venc_buf_type vlc_buf; }; struct venc_mpeg4_config { unsigned int profile; unsigned int level; unsigned int time_resolution; unsigned int ac_prediction; unsigned int hec_interval; unsigned int data_partition; unsigned int short_header; unsigned int rvlc_enable; }; struct venc_h263_config { unsigned int profile; unsigned int level; }; struct venc_h264_config { unsigned int profile; unsigned int level; unsigned int max_nal; unsigned int idr_period; }; struct venc_pmem { int src; int fd; unsigned int offset; void *virt; void *phys; unsigned int size; }; struct venc_buffer { unsigned char *ptr_buffer; unsigned int size; unsigned int len; unsigned int offset; long long time_stamp; unsigned int flags; unsigned int client_data; }; struct venc_buffers { struct venc_pmem recon_buf[VENC_MAX_RECON_BUFFERS]; struct venc_pmem wb_buf; struct venc_pmem cmd_buf; struct venc_pmem vlc_buf; }; struct venc_buffer_flush { unsigned int flush_mode; }; union venc_msg_data { struct venc_buffer buf; struct venc_buffer_flush flush_ret; }; struct venc_msg { unsigned int status_code; unsigned int msg_code; union venc_msg_data msg_data; unsigned int msg_data_size; }; union venc_codec_config { struct venc_mpeg4_config mpeg4_params; struct venc_h263_config h263_params; struct venc_h264_config h264_params; }; struct venc_q6_config { struct venc_common_config config_params; union venc_codec_config codec_params; struct venc_nonio_buf_config buf_params; void *callback_event; }; struct venc_hdr_config { struct venc_common_config config_params; union venc_codec_config codec_params; }; struct venc_init_config { struct venc_q6_config q6_config; struct venc_buffers q6_bufs; }; struct venc_seq_config { int size; struct venc_pmem buf; struct venc_q6_config q6_config; }; #define VENC_IOCTL_MAGIC 'V' #define VENC_IOCTL_CMD_READ_NEXT_MSG _IOWR(VENC_IOCTL_MAGIC, 1, struct venc_msg) #define VENC_IOCTL_CMD_STOP_READ_MSG _IO(VENC_IOCTL_MAGIC, 2) #define VENC_IOCTL_SET_INPUT_BUFFER _IOW(VENC_IOCTL_MAGIC, 3, struct venc_pmem) #define VENC_IOCTL_SET_OUTPUT_BUFFER _IOW(VENC_IOCTL_MAGIC, 4, struct venc_pmem) #define VENC_IOCTL_CMD_START _IOW(VENC_IOCTL_MAGIC, 5, struct venc_init_config) #define VENC_IOCTL_CMD_ENCODE_FRAME _IOW(VENC_IOCTL_MAGIC, 6, struct venc_buffer) #define VENC_IOCTL_CMD_FILL_OUTPUT_BUFFER _IOW(VENC_IOCTL_MAGIC, 7, struct venc_buffer) #define VENC_IOCTL_CMD_FLUSH _IOW(VENC_IOCTL_MAGIC, 8, struct venc_buffer_flush) #define VENC_IOCTL_CMD_PAUSE _IO(VENC_IOCTL_MAGIC, 9) #define VENC_IOCTL_CMD_RESUME _IO(VENC_IOCTL_MAGIC, 10) #define VENC_IOCTL_CMD_STOP _IO(VENC_IOCTL_MAGIC, 11) #define VENC_IOCTL_SET_INTRA_PERIOD _IOW(VENC_IOCTL_MAGIC, 12, int) #define VENC_IOCTL_CMD_REQUEST_IFRAME _IO(VENC_IOCTL_MAGIC, 13) #define VENC_IOCTL_GET_SEQUENCE_HDR _IOWR(VENC_IOCTL_MAGIC, 14, struct venc_seq_config) #define VENC_IOCTL_SET_INTRA_REFRESH _IOW(VENC_IOCTL_MAGIC, 15, int) #define VENC_IOCTL_SET_FRAME_RATE _IOW(VENC_IOCTL_MAGIC, 16, struct venc_frame_rate) #define VENC_IOCTL_SET_TARGET_BITRATE _IOW(VENC_IOCTL_MAGIC, 17, int) #define VENC_IOCTL_SET_QP_RANGE _IOW(VENC_IOCTL_MAGIC, 18, struct venc_qp_range) #endif android-audiosystem-1.8+13.10.20130807/include/linux/omap_ion.h0000644000015700001700000000427412200324306024435 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** *** To edit the content of this header, modify the corresponding *** source file (e.g. under external/kernel-headers/original/) then *** run bionic/libc/kernel/tools/update_all.py *** *** Any manual change here will be lost the next time this script will *** be run. You've been warned! *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_OMAP_ION_H #define _LINUX_OMAP_ION_H #include struct omap_ion_tiler_alloc_data { /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ size_t w; size_t h; int fmt; unsigned int flags; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct ion_handle *handle; size_t stride; size_t offset; }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ enum { OMAP_ION_HEAP_TYPE_TILER = ION_HEAP_TYPE_CUSTOM + 1, }; #define OMAP_ION_HEAP_TILER_MASK (1 << OMAP_ION_HEAP_TYPE_TILER) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ enum { OMAP_ION_TILER_ALLOC, }; enum { /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ TILER_PIXEL_FMT_MIN = 0, TILER_PIXEL_FMT_8BIT = 0, TILER_PIXEL_FMT_16BIT = 1, TILER_PIXEL_FMT_32BIT = 2, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ TILER_PIXEL_FMT_PAGE = 3, TILER_PIXEL_FMT_MAX = 3 }; enum { /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ OMAP_ION_HEAP_LARGE_SURFACES, OMAP_ION_HEAP_TILER, OMAP_ION_HEAP_SECURE_INPUT, }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #endif android-audiosystem-1.8+13.10.20130807/include/linux/tegra_sema.h0000644000015700001700000000201712200324306024734 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_TEGRA_SEMA_H #define __LINUX_TEGRA_SEMA_H #define TEGRA_SEMA_IOCTL_MAGIC 'r' #define TEGRA_SEMA_IOCTL_WAIT _IOW(TEGRA_SEMA_IOCTL_MAGIC, 0x30, long *) #define TEGRA_SEMA_IOCTL_SIGNAL _IO(TEGRA_SEMA_IOCTL_MAGIC, 0x31) #define TEGRA_SEMA_IOCTL_MIN_NR _IOC_NR(TEGRA_SEMA_IOCTL_WAIT) #define TEGRA_SEMA_IOCTL_MAX_NR _IOC_NR(TEGRA_SEMA_IOCTL_SIGNAL) #endif android-audiosystem-1.8+13.10.20130807/include/linux/pci.h0000644000015700001700000000224612200324306023404 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef LINUX_PCI_H #define LINUX_PCI_H #include #include #define PCI_DEVFN(slot,func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) #define PCI_FUNC(devfn) ((devfn) & 0x07) #define PCIIOC_BASE ('P' << 24 | 'C' << 16 | 'I' << 8) #define PCIIOC_CONTROLLER (PCIIOC_BASE | 0x00) #define PCIIOC_MMAP_IS_IO (PCIIOC_BASE | 0x01) #define PCIIOC_MMAP_IS_MEM (PCIIOC_BASE | 0x02) #define PCIIOC_WRITE_COMBINE (PCIIOC_BASE | 0x03) #endif android-audiosystem-1.8+13.10.20130807/include/linux/pfkeyv2.h0000644000015700001700000001777112200324306024230 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_PFKEY2_H #define _LINUX_PFKEY2_H #include #define PF_KEY_V2 2 #define PFKEYV2_REVISION 199806L struct sadb_msg { uint8_t sadb_msg_version; uint8_t sadb_msg_type; uint8_t sadb_msg_errno; uint8_t sadb_msg_satype; uint16_t sadb_msg_len; uint16_t sadb_msg_reserved; uint32_t sadb_msg_seq; uint32_t sadb_msg_pid; } __attribute__((packed)); struct sadb_ext { uint16_t sadb_ext_len; uint16_t sadb_ext_type; } __attribute__((packed)); struct sadb_sa { uint16_t sadb_sa_len; uint16_t sadb_sa_exttype; uint32_t sadb_sa_spi; uint8_t sadb_sa_replay; uint8_t sadb_sa_state; uint8_t sadb_sa_auth; uint8_t sadb_sa_encrypt; uint32_t sadb_sa_flags; } __attribute__((packed)); struct sadb_lifetime { uint16_t sadb_lifetime_len; uint16_t sadb_lifetime_exttype; uint32_t sadb_lifetime_allocations; uint64_t sadb_lifetime_bytes; uint64_t sadb_lifetime_addtime; uint64_t sadb_lifetime_usetime; } __attribute__((packed)); struct sadb_address { uint16_t sadb_address_len; uint16_t sadb_address_exttype; uint8_t sadb_address_proto; uint8_t sadb_address_prefixlen; uint16_t sadb_address_reserved; } __attribute__((packed)); struct sadb_key { uint16_t sadb_key_len; uint16_t sadb_key_exttype; uint16_t sadb_key_bits; uint16_t sadb_key_reserved; } __attribute__((packed)); struct sadb_ident { uint16_t sadb_ident_len; uint16_t sadb_ident_exttype; uint16_t sadb_ident_type; uint16_t sadb_ident_reserved; uint64_t sadb_ident_id; } __attribute__((packed)); struct sadb_sens { uint16_t sadb_sens_len; uint16_t sadb_sens_exttype; uint32_t sadb_sens_dpd; uint8_t sadb_sens_sens_level; uint8_t sadb_sens_sens_len; uint8_t sadb_sens_integ_level; uint8_t sadb_sens_integ_len; uint32_t sadb_sens_reserved; } __attribute__((packed)); struct sadb_prop { uint16_t sadb_prop_len; uint16_t sadb_prop_exttype; uint8_t sadb_prop_replay; uint8_t sadb_prop_reserved[3]; } __attribute__((packed)); struct sadb_comb { uint8_t sadb_comb_auth; uint8_t sadb_comb_encrypt; uint16_t sadb_comb_flags; uint16_t sadb_comb_auth_minbits; uint16_t sadb_comb_auth_maxbits; uint16_t sadb_comb_encrypt_minbits; uint16_t sadb_comb_encrypt_maxbits; uint32_t sadb_comb_reserved; uint32_t sadb_comb_soft_allocations; uint32_t sadb_comb_hard_allocations; uint64_t sadb_comb_soft_bytes; uint64_t sadb_comb_hard_bytes; uint64_t sadb_comb_soft_addtime; uint64_t sadb_comb_hard_addtime; uint64_t sadb_comb_soft_usetime; uint64_t sadb_comb_hard_usetime; } __attribute__((packed)); struct sadb_supported { uint16_t sadb_supported_len; uint16_t sadb_supported_exttype; uint32_t sadb_supported_reserved; } __attribute__((packed)); struct sadb_alg { uint8_t sadb_alg_id; uint8_t sadb_alg_ivlen; uint16_t sadb_alg_minbits; uint16_t sadb_alg_maxbits; uint16_t sadb_alg_reserved; } __attribute__((packed)); struct sadb_spirange { uint16_t sadb_spirange_len; uint16_t sadb_spirange_exttype; uint32_t sadb_spirange_min; uint32_t sadb_spirange_max; uint32_t sadb_spirange_reserved; } __attribute__((packed)); struct sadb_x_kmprivate { uint16_t sadb_x_kmprivate_len; uint16_t sadb_x_kmprivate_exttype; uint32_t sadb_x_kmprivate_reserved; } __attribute__((packed)); struct sadb_x_sa2 { uint16_t sadb_x_sa2_len; uint16_t sadb_x_sa2_exttype; uint8_t sadb_x_sa2_mode; uint8_t sadb_x_sa2_reserved1; uint16_t sadb_x_sa2_reserved2; uint32_t sadb_x_sa2_sequence; uint32_t sadb_x_sa2_reqid; } __attribute__((packed)); struct sadb_x_policy { uint16_t sadb_x_policy_len; uint16_t sadb_x_policy_exttype; uint16_t sadb_x_policy_type; uint8_t sadb_x_policy_dir; uint8_t sadb_x_policy_reserved; uint32_t sadb_x_policy_id; uint32_t sadb_x_policy_priority; } __attribute__((packed)); struct sadb_x_ipsecrequest { uint16_t sadb_x_ipsecrequest_len; uint16_t sadb_x_ipsecrequest_proto; uint8_t sadb_x_ipsecrequest_mode; uint8_t sadb_x_ipsecrequest_level; uint16_t sadb_x_ipsecrequest_reserved1; uint32_t sadb_x_ipsecrequest_reqid; uint32_t sadb_x_ipsecrequest_reserved2; } __attribute__((packed)); struct sadb_x_nat_t_type { uint16_t sadb_x_nat_t_type_len; uint16_t sadb_x_nat_t_type_exttype; uint8_t sadb_x_nat_t_type_type; uint8_t sadb_x_nat_t_type_reserved[3]; } __attribute__((packed)); struct sadb_x_nat_t_port { uint16_t sadb_x_nat_t_port_len; uint16_t sadb_x_nat_t_port_exttype; uint16_t sadb_x_nat_t_port_port; uint16_t sadb_x_nat_t_port_reserved; } __attribute__((packed)); struct sadb_x_sec_ctx { uint16_t sadb_x_sec_len; uint16_t sadb_x_sec_exttype; uint8_t sadb_x_ctx_alg; uint8_t sadb_x_ctx_doi; uint16_t sadb_x_ctx_len; } __attribute__((packed)); #define SADB_RESERVED 0 #define SADB_GETSPI 1 #define SADB_UPDATE 2 #define SADB_ADD 3 #define SADB_DELETE 4 #define SADB_GET 5 #define SADB_ACQUIRE 6 #define SADB_REGISTER 7 #define SADB_EXPIRE 8 #define SADB_FLUSH 9 #define SADB_DUMP 10 #define SADB_X_PROMISC 11 #define SADB_X_PCHANGE 12 #define SADB_X_SPDUPDATE 13 #define SADB_X_SPDADD 14 #define SADB_X_SPDDELETE 15 #define SADB_X_SPDGET 16 #define SADB_X_SPDACQUIRE 17 #define SADB_X_SPDDUMP 18 #define SADB_X_SPDFLUSH 19 #define SADB_X_SPDSETIDX 20 #define SADB_X_SPDEXPIRE 21 #define SADB_X_SPDDELETE2 22 #define SADB_X_NAT_T_NEW_MAPPING 23 #define SADB_MAX 23 #define SADB_SAFLAGS_PFS 1 #define SADB_SAFLAGS_NOPMTUDISC 0x20000000 #define SADB_SAFLAGS_DECAP_DSCP 0x40000000 #define SADB_SAFLAGS_NOECN 0x80000000 #define SADB_SASTATE_LARVAL 0 #define SADB_SASTATE_MATURE 1 #define SADB_SASTATE_DYING 2 #define SADB_SASTATE_DEAD 3 #define SADB_SASTATE_MAX 3 #define SADB_SATYPE_UNSPEC 0 #define SADB_SATYPE_AH 2 #define SADB_SATYPE_ESP 3 #define SADB_SATYPE_RSVP 5 #define SADB_SATYPE_OSPFV2 6 #define SADB_SATYPE_RIPV2 7 #define SADB_SATYPE_MIP 8 #define SADB_X_SATYPE_IPCOMP 9 #define SADB_SATYPE_MAX 9 #define SADB_AALG_NONE 0 #define SADB_AALG_MD5HMAC 2 #define SADB_AALG_SHA1HMAC 3 #define SADB_X_AALG_SHA2_256HMAC 5 #define SADB_X_AALG_SHA2_384HMAC 6 #define SADB_X_AALG_SHA2_512HMAC 7 #define SADB_X_AALG_RIPEMD160HMAC 8 #define SADB_X_AALG_NULL 251 #define SADB_AALG_MAX 251 #define SADB_EALG_NONE 0 #define SADB_EALG_DESCBC 2 #define SADB_EALG_3DESCBC 3 #define SADB_X_EALG_CASTCBC 6 #define SADB_X_EALG_BLOWFISHCBC 7 #define SADB_EALG_NULL 11 #define SADB_X_EALG_AESCBC 12 #define SADB_EALG_MAX 253 #define SADB_X_EALG_SERPENTCBC 252 #define SADB_X_EALG_TWOFISHCBC 253 #define SADB_X_CALG_NONE 0 #define SADB_X_CALG_OUI 1 #define SADB_X_CALG_DEFLATE 2 #define SADB_X_CALG_LZS 3 #define SADB_X_CALG_LZJH 4 #define SADB_X_CALG_MAX 4 #define SADB_EXT_RESERVED 0 #define SADB_EXT_SA 1 #define SADB_EXT_LIFETIME_CURRENT 2 #define SADB_EXT_LIFETIME_HARD 3 #define SADB_EXT_LIFETIME_SOFT 4 #define SADB_EXT_ADDRESS_SRC 5 #define SADB_EXT_ADDRESS_DST 6 #define SADB_EXT_ADDRESS_PROXY 7 #define SADB_EXT_KEY_AUTH 8 #define SADB_EXT_KEY_ENCRYPT 9 #define SADB_EXT_IDENTITY_SRC 10 #define SADB_EXT_IDENTITY_DST 11 #define SADB_EXT_SENSITIVITY 12 #define SADB_EXT_PROPOSAL 13 #define SADB_EXT_SUPPORTED_AUTH 14 #define SADB_EXT_SUPPORTED_ENCRYPT 15 #define SADB_EXT_SPIRANGE 16 #define SADB_X_EXT_KMPRIVATE 17 #define SADB_X_EXT_POLICY 18 #define SADB_X_EXT_SA2 19 #define SADB_X_EXT_NAT_T_TYPE 20 #define SADB_X_EXT_NAT_T_SPORT 21 #define SADB_X_EXT_NAT_T_DPORT 22 #define SADB_X_EXT_NAT_T_OA 23 #define SADB_X_EXT_SEC_CTX 24 #define SADB_EXT_MAX 24 #define SADB_IDENTTYPE_RESERVED 0 #define SADB_IDENTTYPE_PREFIX 1 #define SADB_IDENTTYPE_FQDN 2 #define SADB_IDENTTYPE_USERFQDN 3 #define SADB_IDENTTYPE_MAX 3 #endif android-audiosystem-1.8+13.10.20130807/include/linux/smp.h0000644000015700001700000000235112200324306023425 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_SMP_H #define __LINUX_SMP_H #define raw_smp_processor_id() 0 #define hard_smp_processor_id() 0 #define smp_call_function(func,info,retry,wait) (up_smp_call_function()) #define on_each_cpu(func,info,retry,wait) ({ local_irq_disable(); func(info); local_irq_enable(); 0; }) #define num_booting_cpus() 1 #define smp_prepare_boot_cpu() do {} while (0) #define smp_processor_id() raw_smp_processor_id() #define get_cpu() ({ preempt_disable(); smp_processor_id(); }) #define put_cpu() preempt_enable() #define put_cpu_no_resched() preempt_enable_no_resched() #endif android-audiosystem-1.8+13.10.20130807/include/linux/serio.h0000644000015700001700000000333312200324306023750 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _SERIO_H #define _SERIO_H #include #define SPIOCSTYPE _IOW('q', 0x01, unsigned long) #define SERIO_TIMEOUT 1 #define SERIO_PARITY 2 #define SERIO_FRAME 4 #define SERIO_XT 0x00 #define SERIO_8042 0x01 #define SERIO_RS232 0x02 #define SERIO_HIL_MLC 0x03 #define SERIO_PS_PSTHRU 0x05 #define SERIO_8042_XL 0x06 #define SERIO_UNKNOWN 0x00 #define SERIO_MSC 0x01 #define SERIO_SUN 0x02 #define SERIO_MS 0x03 #define SERIO_MP 0x04 #define SERIO_MZ 0x05 #define SERIO_MZP 0x06 #define SERIO_MZPP 0x07 #define SERIO_VSXXXAA 0x08 #define SERIO_SUNKBD 0x10 #define SERIO_WARRIOR 0x18 #define SERIO_SPACEORB 0x19 #define SERIO_MAGELLAN 0x1a #define SERIO_SPACEBALL 0x1b #define SERIO_GUNZE 0x1c #define SERIO_IFORCE 0x1d #define SERIO_STINGER 0x1e #define SERIO_NEWTON 0x1f #define SERIO_STOWAWAY 0x20 #define SERIO_H3600 0x21 #define SERIO_PS2SER 0x22 #define SERIO_TWIDKBD 0x23 #define SERIO_TWIDJOY 0x24 #define SERIO_HIL 0x25 #define SERIO_SNES232 0x26 #define SERIO_SEMTECH 0x27 #define SERIO_LKKBD 0x28 #define SERIO_ELO 0x29 #define SERIO_MICROTOUCH 0x30 #endif android-audiosystem-1.8+13.10.20130807/include/linux/ktime.h0000644000015700001700000000322112200324306023734 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_KTIME_H #define _LINUX_KTIME_H #include #include typedef union { s64 tv64; #if BITS_PER_LONG != (64 && !defined(CONFIG_KTIME_SCALAR)) struct { #ifdef __BIG_ENDIAN s32 sec, nsec; #else s32 nsec, sec; #endif } tv; #endif } ktime_t; #define KTIME_MAX ((s64)~((u64)1 << 63)) #define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) #if BITS_PER_LONG == 64 #if BITS_PER_LONG == 64 #endif #define ktime_sub(lhs, rhs) ({ (ktime_t){ .tv64 = (lhs).tv64 - (rhs).tv64 }; }) #define ktime_add(lhs, rhs) ({ (ktime_t){ .tv64 = (lhs).tv64 + (rhs).tv64 }; }) #define ktime_add_ns(kt, nsval) ({ (ktime_t){ .tv64 = (kt).tv64 + (nsval) }; }) #define ktime_to_timespec(kt) ns_to_timespec((kt).tv64) #define ktime_to_timeval(kt) ns_to_timeval((kt).tv64) #define ktime_to_ns(kt) ((kt).tv64) #else #endif #define KTIME_REALTIME_RES (ktime_t){ .tv64 = TICK_NSEC } #define KTIME_MONOTONIC_RES (ktime_t){ .tv64 = TICK_NSEC } #define ktime_get_real_ts(ts) getnstimeofday(ts) #endif android-audiosystem-1.8+13.10.20130807/include/linux/zlib.h0000644000015700001700000000370512200324306023572 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _ZLIB_H #define _ZLIB_H #include struct internal_state; typedef struct z_stream_s { Byte *next_in; uInt avail_in; uLong total_in; Byte *next_out; uInt avail_out; uLong total_out; char *msg; struct internal_state *state; void *workspace; int data_type; uLong adler; uLong reserved; } z_stream; typedef z_stream *z_streamp; #define Z_NO_FLUSH 0 #define Z_PARTIAL_FLUSH 1 #define Z_PACKET_FLUSH 2 #define Z_SYNC_FLUSH 3 #define Z_FULL_FLUSH 4 #define Z_FINISH 5 #define Z_BLOCK 6 #define Z_OK 0 #define Z_STREAM_END 1 #define Z_NEED_DICT 2 #define Z_ERRNO (-1) #define Z_STREAM_ERROR (-2) #define Z_DATA_ERROR (-3) #define Z_MEM_ERROR (-4) #define Z_BUF_ERROR (-5) #define Z_VERSION_ERROR (-6) #define Z_NO_COMPRESSION 0 #define Z_BEST_SPEED 1 #define Z_BEST_COMPRESSION 9 #define Z_DEFAULT_COMPRESSION (-1) #define Z_FILTERED 1 #define Z_HUFFMAN_ONLY 2 #define Z_DEFAULT_STRATEGY 0 #define Z_BINARY 0 #define Z_ASCII 1 #define Z_UNKNOWN 2 #define Z_DEFLATED 8 #define zlib_deflateInit(strm, level) zlib_deflateInit2((strm), (level), Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY) #define zlib_inflateInit(strm) zlib_inflateInit2((strm), DEF_WBITS) #if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL) struct internal_state {int dummy;}; #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/textsearch.h0000644000015700001700000000133512200324306025001 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_TEXTSEARCH_H #define __LINUX_TEXTSEARCH_H #endif android-audiosystem-1.8+13.10.20130807/include/linux/qnxtypes.h0000644000015700001700000000173112200324306024522 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _QNX4TYPES_H #define _QNX4TYPES_H typedef __le16 qnx4_nxtnt_t; typedef __u8 qnx4_ftype_t; typedef struct { __le32 xtnt_blk; __le32 xtnt_size; } qnx4_xtnt_t; typedef __le16 qnx4_mode_t; typedef __le16 qnx4_muid_t; typedef __le16 qnx4_mgid_t; typedef __le32 qnx4_off_t; typedef __le16 qnx4_nlink_t; #endif android-audiosystem-1.8+13.10.20130807/include/linux/mount.h0000644000015700001700000000132012200324306023763 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_MOUNT_H #define _LINUX_MOUNT_H #endif android-audiosystem-1.8+13.10.20130807/include/linux/usb/0000755000015700001700000000000012200324404023244 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/linux/usb/f_mtp.h0000644000015700001700000000332212200324306024523 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** *** To edit the content of this header, modify the corresponding *** source file (e.g. under external/kernel-headers/original/) then *** run bionic/libc/kernel/tools/update_all.py *** *** Any manual change here will be lost the next time this script will *** be run. You've been warned! *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_USB_F_MTP_H #define __LINUX_USB_F_MTP_H struct mtp_file_range { int fd; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ loff_t offset; int64_t length; uint16_t command; uint32_t transaction_id; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ }; struct mtp_event { size_t length; void *data; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ }; #define MTP_SEND_FILE _IOW('M', 0, struct mtp_file_range) #define MTP_RECEIVE_FILE _IOW('M', 1, struct mtp_file_range) #define MTP_SEND_EVENT _IOW('M', 3, struct mtp_event) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define MTP_SEND_FILE_WITH_HEADER _IOW('M', 4, struct mtp_file_range) #endif android-audiosystem-1.8+13.10.20130807/include/linux/usb/f_accessory.h0000644000015700001700000000422412200324306025720 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** *** To edit the content of this header, modify the corresponding *** source file (e.g. under external/kernel-headers/original/) then *** run bionic/libc/kernel/tools/update_all.py *** *** Any manual change here will be lost the next time this script will *** be run. You've been warned! *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_USB_F_ACCESSORY_H #define __LINUX_USB_F_ACCESSORY_H #define USB_ACCESSORY_VENDOR_ID 0x18D1 #define USB_ACCESSORY_PRODUCT_ID 0x2D00 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define USB_ACCESSORY_ADB_PRODUCT_ID 0x2D01 #define ACCESSORY_STRING_MANUFACTURER 0 #define ACCESSORY_STRING_MODEL 1 #define ACCESSORY_STRING_DESCRIPTION 2 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ACCESSORY_STRING_VERSION 3 #define ACCESSORY_STRING_URI 4 #define ACCESSORY_STRING_SERIAL 5 #define ACCESSORY_GET_PROTOCOL 51 #define ACCESSORY_SEND_STRING 52 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ACCESSORY_START 53 #define ACCESSORY_GET_STRING_MANUFACTURER _IOW('M', 1, char[256]) #define ACCESSORY_GET_STRING_MODEL _IOW('M', 2, char[256]) #define ACCESSORY_GET_STRING_DESCRIPTION _IOW('M', 3, char[256]) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ACCESSORY_GET_STRING_VERSION _IOW('M', 4, char[256]) #define ACCESSORY_GET_STRING_URI _IOW('M', 5, char[256]) #define ACCESSORY_GET_STRING_SERIAL _IOW('M', 6, char[256]) #define ACCESSORY_IS_START_REQUESTED _IO('M', 7) #endif android-audiosystem-1.8+13.10.20130807/include/linux/percpu_counter.h0000644000015700001700000000161512200324306025665 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_PERCPU_COUNTER_H #define _LINUX_PERCPU_COUNTER_H #include #include #include #include #include struct percpu_counter { s64 count; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/leds-an30259a.h0000644000015700001700000000402412200324306024714 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** *** To edit the content of this header, modify the corresponding *** source file (e.g. under external/kernel-headers/original/) then *** run bionic/libc/kernel/tools/update_all.py *** *** Any manual change here will be lost the next time this script will *** be run. You've been warned! *** **************************************************************************** ****************************************************************************/ #ifndef _LEDS_AN30259A_H #define _LEDS_AN30259A_H #include #include /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define LED_LIGHT_OFF 0 #define LED_LIGHT_ON 1 #define LED_LIGHT_PULSE 2 #define LED_LIGHT_SLOPE 3 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct an30259a_pr_control { __u32 color; __u32 state; __u16 start_delay; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u16 time_slope_up_1; __u16 time_slope_up_2; __u16 time_on; __u16 time_slope_down_1; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u16 time_slope_down_2; __u16 time_off; __u8 mid_brightness; } __packed; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define AN30259A_PR_SET_LED _IOW('S', 42, struct an30259a_pr_control) #define AN30259A_PR_SET_LEDS _IOW('S', 43, struct an30259a_pr_control[3]) #define AN30259A_PR_SET_IMAX _IOW('S', 44, __u8) #endif /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ android-audiosystem-1.8+13.10.20130807/include/linux/hil.h0000644000015700001700000002736212200324306023413 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _HIL_H_ #define _HIL_H_ #include #define HIL_CLOCK 8MHZ #define HIL_EK1_CLOCK 30HZ #define HIL_EK2_CLOCK 60HZ #define HIL_TIMEOUT_DEV 5 #define HIL_TIMEOUT_DEVS 10 #define HIL_TIMEOUT_NORESP 10 #define HIL_TIMEOUT_DEVS_DATA 16 #define HIL_TIMEOUT_SELFTEST 200 #define HIL_WIRE_PACKET_LEN 15 enum hil_wire_bitpos { HIL_WIRE_START = 0, HIL_WIRE_ADDR2, HIL_WIRE_ADDR1, HIL_WIRE_ADDR0, HIL_WIRE_COMMAND, HIL_WIRE_DATA7, HIL_WIRE_DATA6, HIL_WIRE_DATA5, HIL_WIRE_DATA4, HIL_WIRE_DATA3, HIL_WIRE_DATA2, HIL_WIRE_DATA1, HIL_WIRE_DATA0, HIL_WIRE_PARITY, HIL_WIRE_STOP }; enum hil_pkt_bitpos { HIL_PKT_CMD = 0x00000800, HIL_PKT_ADDR2 = 0x00000400, HIL_PKT_ADDR1 = 0x00000200, HIL_PKT_ADDR0 = 0x00000100, HIL_PKT_ADDR_MASK = 0x00000700, HIL_PKT_ADDR_SHIFT = 8, HIL_PKT_DATA7 = 0x00000080, HIL_PKT_DATA6 = 0x00000040, HIL_PKT_DATA5 = 0x00000020, HIL_PKT_DATA4 = 0x00000010, HIL_PKT_DATA3 = 0x00000008, HIL_PKT_DATA2 = 0x00000004, HIL_PKT_DATA1 = 0x00000002, HIL_PKT_DATA0 = 0x00000001, HIL_PKT_DATA_MASK = 0x000000FF, HIL_PKT_DATA_SHIFT = 0 }; enum hil_error_bitpos { HIL_ERR_OB = 0x00000800, HIL_ERR_INT = 0x00010000, HIL_ERR_NMI = 0x00020000, HIL_ERR_LERR = 0x00040000, HIL_ERR_PERR = 0x01000000, HIL_ERR_FERR = 0x02000000, HIL_ERR_FOF = 0x04000000 }; enum hil_control_bitpos { HIL_CTRL_TEST = 0x00010000, HIL_CTRL_IPF = 0x00040000, HIL_CTRL_APE = 0x02000000 }; #define HIL_DO_ALTER_CTRL 0x40000000 #define HIL_CTRL_ONLY 0xc0000000 typedef u32 hil_packet; enum hil_command { HIL_CMD_IFC = 0x00, HIL_CMD_EPT = 0x01, HIL_CMD_ELB = 0x02, HIL_CMD_IDD = 0x03, HIL_CMD_DSR = 0x04, HIL_CMD_PST = 0x05, HIL_CMD_RRG = 0x06, HIL_CMD_WRG = 0x07, HIL_CMD_ACF = 0x08, HIL_CMDID_ACF = 0x07, HIL_CMD_POL = 0x10, HIL_CMDCT_POL = 0x0f, HIL_CMD_RPL = 0x20, HIL_CMDCT_RPL = 0x0f, HIL_CMD_RNM = 0x30, HIL_CMD_RST = 0x31, HIL_CMD_EXD = 0x32, HIL_CMD_RSC = 0x33, HIL_CMD_DKA = 0x3d, HIL_CMD_EK1 = 0x3e, HIL_CMD_EK2 = 0x3f, HIL_CMD_PR1 = 0x40, HIL_CMD_PR2 = 0x41, HIL_CMD_PR3 = 0x42, HIL_CMD_PR4 = 0x43, HIL_CMD_PR5 = 0x44, HIL_CMD_PR6 = 0x45, HIL_CMD_PR7 = 0x46, HIL_CMD_PRM = 0x47, HIL_CMD_AK1 = 0x48, HIL_CMD_AK2 = 0x49, HIL_CMD_AK3 = 0x4a, HIL_CMD_AK4 = 0x4b, HIL_CMD_AK5 = 0x4c, HIL_CMD_AK6 = 0x4d, HIL_CMD_AK7 = 0x4e, HIL_CMD_ACK = 0x4f, HIL_CMD_RIO = 0xfa, HIL_CMD_SHR = 0xfb, HIL_CMD_TER = 0xfc, HIL_CMD_CAE = 0xfd, HIL_CMD_DHR = 0xfe, }; #define HIL_IDD_DID_TYPE_MASK 0xe0 #define HIL_IDD_DID_TYPE_KB_INTEGRAL 0xa0 #define HIL_IDD_DID_TYPE_KB_ITF 0xc0 #define HIL_IDD_DID_TYPE_KB_RSVD 0xe0 #define HIL_IDD_DID_TYPE_KB_LANG_MASK 0x1f #define HIL_IDD_DID_KBLANG_USE_ESD 0x00 #define HIL_IDD_DID_TYPE_ABS 0x80 #define HIL_IDD_DID_ABS_RSVD1_MASK 0xf8 #define HIL_IDD_DID_ABS_RSVD1 0x98 #define HIL_IDD_DID_ABS_TABLET_MASK 0xf8 #define HIL_IDD_DID_ABS_TABLET 0x90 #define HIL_IDD_DID_ABS_TSCREEN_MASK 0xfc #define HIL_IDD_DID_ABS_TSCREEN 0x8c #define HIL_IDD_DID_ABS_RSVD2_MASK 0xfc #define HIL_IDD_DID_ABS_RSVD2 0x88 #define HIL_IDD_DID_ABS_RSVD3_MASK 0xfc #define HIL_IDD_DID_ABS_RSVD3 0x80 #define HIL_IDD_DID_TYPE_REL 0x60 #define HIL_IDD_DID_REL_RSVD1_MASK 0xf0 #define HIL_IDD_DID_REL_RSVD1 0x70 #define HIL_IDD_DID_REL_RSVD2_MASK 0xfc #define HIL_IDD_DID_REL_RSVD2 0x6c #define HIL_IDD_DID_REL_MOUSE_MASK 0xfc #define HIL_IDD_DID_REL_MOUSE 0x68 #define HIL_IDD_DID_REL_QUAD_MASK 0xf8 #define HIL_IDD_DID_REL_QUAD 0x60 #define HIL_IDD_DID_TYPE_CHAR 0x40 #define HIL_IDD_DID_CHAR_BARCODE_MASK 0xfc #define HIL_IDD_DID_CHAR_BARCODE 0x5c #define HIL_IDD_DID_CHAR_RSVD1_MASK 0xfc #define HIL_IDD_DID_CHAR_RSVD1 0x58 #define HIL_IDD_DID_CHAR_RSVD2_MASK 0xf8 #define HIL_IDD_DID_CHAR_RSVD2 0x50 #define HIL_IDD_DID_CHAR_RSVD3_MASK 0xf0 #define HIL_IDD_DID_CHAR_RSVD3 0x40 #define HIL_IDD_DID_TYPE_OTHER 0x20 #define HIL_IDD_DID_OTHER_RSVD1_MASK 0xf0 #define HIL_IDD_DID_OTHER_RSVD1 0x30 #define HIL_IDD_DID_OTHER_BARCODE_MASK 0xfc #define HIL_IDD_DID_OTHER_BARCODE 0x2c #define HIL_IDD_DID_OTHER_RSVD2_MASK 0xfc #define HIL_IDD_DID_OTHER_RSVD2 0x28 #define HIL_IDD_DID_OTHER_RSVD3_MASK 0xf8 #define HIL_IDD_DID_OTHER_RSVD3 0x20 #define HIL_IDD_DID_TYPE_KEYPAD 0x00 #define HIL_IDD_HEADER_AXSET_MASK 0x03 #define HIL_IDD_HEADER_RSC 0x04 #define HIL_IDD_HEADER_EXD 0x08 #define HIL_IDD_HEADER_IOD 0x10 #define HIL_IDD_HEADER_16BIT 0x20 #define HIL_IDD_HEADER_ABS 0x40 #define HIL_IDD_HEADER_2X_AXIS 0x80 #define HIL_IDD_IOD_NBUTTON_MASK 0x07 #define HIL_IDD_IOD_PROXIMITY 0x08 #define HIL_IDD_IOD_PROMPT_MASK 0x70 #define HIL_IDD_IOD_PROMPT_SHIFT 4 #define HIL_IDD_IOD_PROMPT 0x80 #define HIL_IDD_NUM_AXES_PER_SET(header_packet) ((header_packet) & HIL_IDD_HEADER_AXSET_MASK) #define HIL_IDD_NUM_AXSETS(header_packet) (2 - !((header_packet) & HIL_IDD_HEADER_2X_AXIS)) #define HIL_IDD_LEN(header_packet) ((4 - !(header_packet & HIL_IDD_HEADER_IOD) - 2 * !(HIL_IDD_NUM_AXES_PER_SET(header_packet))) + 2 * HIL_IDD_NUM_AXES_PER_SET(header_packet) * !!((header_packet) & HIL_IDD_HEADER_ABS)) #define HIL_IDD_AXIS_COUNTS_PER_M(header_ptr) (!(HIL_IDD_NUM_AXSETS(*(header_ptr))) ? -1 : (((*(header_ptr + 1) & HIL_PKT_DATA_MASK) + ((*(header_ptr + 2) & HIL_PKT_DATA_MASK)) << 8) * ((*(header_ptr) & HIL_IDD_HEADER_16BIT) ? 100 : 1))) #define HIL_IDD_AXIS_MAX(header_ptr, __axnum) ((!(*(header_ptr) & HIL_IDD_HEADER_ABS) || (HIL_IDD_NUM_AXES_PER_SET(*(header_ptr)) <= __axnum)) ? 0 : ((HIL_PKT_DATA_MASK & *((header_ptr) + 3 + 2 * __axnum)) + ((HIL_PKT_DATA_MASK & *((header_ptr) + 4 + 2 * __axnum)) << 8))) #define HIL_IDD_IOD(header_ptr) (*(header_ptr + HIL_IDD_LEN((*header_ptr)) - 1)) #define HIL_IDD_HAS_GEN_PROMPT(header_ptr) ((*header_ptr & HIL_IDD_HEADER_IOD) && (HIL_IDD_IOD(header_ptr) & HIL_IDD_IOD_PROMPT)) #define HIL_IDD_HAS_GEN_PROXIMITY(header_ptr) ((*header_ptr & HIL_IDD_HEADER_IOD) && (HIL_IDD_IOD(header_ptr) & HIL_IDD_IOD_PROXIMITY)) #define HIL_IDD_NUM_BUTTONS(header_ptr) ((*header_ptr & HIL_IDD_HEADER_IOD) ? (HIL_IDD_IOD(header_ptr) & HIL_IDD_IOD_NBUTTON_MASK) : 0) #define HIL_IDD_NUM_PROMPTS(header_ptr) ((*header_ptr & HIL_IDD_HEADER_IOD) ? ((HIL_IDD_IOD(header_ptr) & HIL_IDD_IOD_NPROMPT_MASK) >> HIL_IDD_IOD_PROMPT_SHIFT) : 0) #define HIL_EXD_HEADER_WRG 0x03 #define HIL_EXD_HEADER_WRG_TYPE1 0x01 #define HIL_EXD_HEADER_WRG_TYPE2 0x02 #define HIL_EXD_HEADER_RRG 0x04 #define HIL_EXD_HEADER_RNM 0x10 #define HIL_EXD_HEADER_RST 0x20 #define HIL_EXD_HEADER_LOCALE 0x40 #define HIL_EXD_NUM_RRG(header_ptr) ((*header_ptr & HIL_EXD_HEADER_RRG) ? (*(header_ptr + 1) & HIL_PKT_DATA_MASK) : 0) #define HIL_EXD_NUM_WWG(header_ptr) ((*header_ptr & HIL_EXD_HEADER_WRG) ? (*(header_ptr + 2 - !(*header_ptr & HIL_EXD_HEADER_RRG)) & HIL_PKT_DATA_MASK) : 0) #define HIL_EXD_LEN(header_ptr) (!!(*header_ptr & HIL_EXD_HEADER_RRG) + !!(*header_ptr & HIL_EXD_HEADER_WRG) + !!(*header_ptr & HIL_EXD_HEADER_LOCALE) + 2 * !!(*header_ptr & HIL_EXD_HEADER_WRG_TYPE2) + 1) #define HIL_EXD_LOCALE(header_ptr) (!(*header_ptr & HIL_EXD_HEADER_LOCALE) ? -1 : (*(header_ptr + HIL_EXD_LEN(header_ptr) - 1) & HIL_PKT_DATA_MASK)) #define HIL_EXD_WRG_TYPE2_LEN(header_ptr) (!(*header_ptr & HIL_EXD_HEADER_WRG_TYPE2) ? -1 : (*(header_ptr + HIL_EXD_LEN(header_ptr) - 2 - !!(*header_ptr & HIL_EXD_HEADER_LOCALE)) & HIL_PKT_DATA_MASK) + ((*(header_ptr + HIL_EXD_LEN(header_ptr) - 1 - !!(*header_ptr & HIL_EXD_HEADER_LOCALE)) & HIL_PKT_DATA_MASK) << 8)) #define HIL_LOCALE_MAX 0x1f #define HIL_LOCALE_MAP "", "", "", "swiss.french", "portuguese", "arabic", "hebrew", "english.canadian", "turkish", "greek", "thai", "italian", "korean", "dutch", "swedish", "german", "chinese", "chinese", "swiss.french", "spanish", "swiss.german", "flemish", "finnish", "english.uk", "french.canadian", "swiss.german", "norwegian", "french", "danish", "japanese", "spanish", "english.us" #define HIL_KEYCODES_SET1_TBLSIZE 128 #define HIL_KEYCODES_SET1 KEY_5, KEY_RESERVED, KEY_RIGHTALT, KEY_LEFTALT, KEY_RIGHTSHIFT, KEY_LEFTSHIFT, KEY_LEFTCTRL, KEY_SYSRQ, KEY_KP4, KEY_KP8, KEY_KP5, KEY_KP9, KEY_KP6, KEY_KP7, KEY_KPCOMMA, KEY_KPENTER, KEY_KP1, KEY_KPSLASH, KEY_KP2, KEY_KPPLUS, KEY_KP3, KEY_KPASTERISK, KEY_KP0, KEY_KPMINUS, KEY_B, KEY_V, KEY_C, KEY_X, KEY_Z, KEY_RESERVED, KEY_RESERVED, KEY_ESC, KEY_6, KEY_F10, KEY_3, KEY_F11, KEY_KPDOT, KEY_F9, KEY_TAB , KEY_F12, KEY_H, KEY_G, KEY_F, KEY_D, KEY_S, KEY_A, KEY_RESERVED, KEY_CAPSLOCK, KEY_U, KEY_Y, KEY_T, KEY_R, KEY_E, KEY_W, KEY_Q, KEY_TAB, KEY_7, KEY_6, KEY_5, KEY_4, KEY_3, KEY_2, KEY_1, KEY_GRAVE, KEY_F13, KEY_F14, KEY_F15, KEY_F16, KEY_F17, KEY_F18, KEY_F19, KEY_F20, KEY_MENU, KEY_F4, KEY_F3, KEY_F2, KEY_F1, KEY_VOLUMEUP, KEY_STOP, KEY_SENDFILE, KEY_SYSRQ, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_VOLUMEDOWN, KEY_DEL_EOL, KEY_DEL_EOS, KEY_8, KEY_9, KEY_0, KEY_MINUS, KEY_EQUAL, KEY_BACKSPACE, KEY_INS_LINE, KEY_DEL_LINE, KEY_I, KEY_O, KEY_P, KEY_LEFTBRACE, KEY_RIGHTBRACE, KEY_BACKSLASH, KEY_INSERT, KEY_DELETE, KEY_J, KEY_K, KEY_L, KEY_SEMICOLON, KEY_APOSTROPHE, KEY_ENTER, KEY_HOME, KEY_PAGEUP, KEY_M, KEY_COMMA, KEY_DOT, KEY_SLASH, KEY_BACKSLASH, KEY_SELECT, KEY_102ND, KEY_PAGEDOWN, KEY_N, KEY_SPACE, KEY_NEXT, KEY_RESERVED, KEY_LEFT, KEY_DOWN, KEY_UP, KEY_RIGHT #define HIL_KEYCODES_SET3_TBLSIZE 128 #define HIL_KEYCODES_SET3 KEY_RESERVED, KEY_ESC, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_0, KEY_MINUS, KEY_EQUAL, KEY_BACKSPACE, KEY_TAB, KEY_Q, KEY_W, KEY_E, KEY_R, KEY_T, KEY_Y, KEY_U, KEY_I, KEY_O, KEY_P, KEY_LEFTBRACE, KEY_RIGHTBRACE, KEY_ENTER, KEY_LEFTCTRL, KEY_A, KEY_S, KEY_D, KEY_F, KEY_G, KEY_H, KEY_J, KEY_K, KEY_L, KEY_SEMICOLON, KEY_APOSTROPHE,KEY_GRAVE, KEY_LEFTSHIFT, KEY_BACKSLASH, KEY_Z, KEY_X, KEY_C, KEY_V, KEY_B, KEY_N, KEY_M, KEY_COMMA, KEY_DOT, KEY_SLASH, KEY_RIGHTSHIFT, KEY_KPASTERISK, KEY_LEFTALT, KEY_SPACE, KEY_CAPSLOCK, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_NUMLOCK, KEY_SCROLLLOCK, KEY_KP7, KEY_KP8, KEY_KP9, KEY_KPMINUS, KEY_KP4, KEY_KP5, KEY_KP6, KEY_KPPLUS, KEY_KP1, KEY_KP2, KEY_KP3, KEY_KP0, KEY_KPDOT, KEY_SYSRQ, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_UP, KEY_LEFT, KEY_DOWN, KEY_RIGHT, KEY_HOME, KEY_PAGEUP, KEY_END, KEY_PAGEDOWN, KEY_INSERT, KEY_DELETE, KEY_102ND, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED #define HIL_POL_NUM_AXES_MASK 0x03 #define HIL_POL_CTS 0x04 #define HIL_POL_STATUS_PENDING 0x08 #define HIL_POL_CHARTYPE_MASK 0x70 #define HIL_POL_CHARTYPE_NONE 0x00 #define HIL_POL_CHARTYPE_RSVD1 0x10 #define HIL_POL_CHARTYPE_ASCII 0x20 #define HIL_POL_CHARTYPE_BINARY 0x30 #define HIL_POL_CHARTYPE_SET1 0x40 #define HIL_POL_CHARTYPE_RSVD2 0x50 #define HIL_POL_CHARTYPE_SET2 0x60 #define HIL_POL_CHARTYPE_SET3 0x70 #define HIL_POL_AXIS_ALT 0x80 #endif android-audiosystem-1.8+13.10.20130807/include/linux/mod_devicetable.h0000644000015700001700000001236412200324306025741 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef LINUX_MOD_DEVICETABLE_H #define LINUX_MOD_DEVICETABLE_H #define PCI_ANY_ID (~0) struct pci_device_id { __u32 vendor, device; __u32 subvendor, subdevice; __u32 class, class_mask; kernel_ulong_t driver_data; }; #define IEEE1394_MATCH_VENDOR_ID 0x0001 #define IEEE1394_MATCH_MODEL_ID 0x0002 #define IEEE1394_MATCH_SPECIFIER_ID 0x0004 #define IEEE1394_MATCH_VERSION 0x0008 struct ieee1394_device_id { __u32 match_flags; __u32 vendor_id; __u32 model_id; __u32 specifier_id; __u32 version; kernel_ulong_t driver_data __attribute__((aligned(sizeof(kernel_ulong_t)))); }; struct usb_device_id { __u16 match_flags; __u16 idVendor; __u16 idProduct; __u16 bcdDevice_lo; __u16 bcdDevice_hi; __u8 bDeviceClass; __u8 bDeviceSubClass; __u8 bDeviceProtocol; __u8 bInterfaceClass; __u8 bInterfaceSubClass; __u8 bInterfaceProtocol; kernel_ulong_t driver_info; }; #define USB_DEVICE_ID_MATCH_VENDOR 0x0001 #define USB_DEVICE_ID_MATCH_PRODUCT 0x0002 #define USB_DEVICE_ID_MATCH_DEV_LO 0x0004 #define USB_DEVICE_ID_MATCH_DEV_HI 0x0008 #define USB_DEVICE_ID_MATCH_DEV_CLASS 0x0010 #define USB_DEVICE_ID_MATCH_DEV_SUBCLASS 0x0020 #define USB_DEVICE_ID_MATCH_DEV_PROTOCOL 0x0040 #define USB_DEVICE_ID_MATCH_INT_CLASS 0x0080 #define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100 #define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 struct ccw_device_id { __u16 match_flags; __u16 cu_type; __u16 dev_type; __u8 cu_model; __u8 dev_model; kernel_ulong_t driver_info; }; #define CCW_DEVICE_ID_MATCH_CU_TYPE 0x01 #define CCW_DEVICE_ID_MATCH_CU_MODEL 0x02 #define CCW_DEVICE_ID_MATCH_DEVICE_TYPE 0x04 #define CCW_DEVICE_ID_MATCH_DEVICE_MODEL 0x08 #define PNP_ID_LEN 8 #define PNP_MAX_DEVICES 8 struct pnp_device_id { __u8 id[PNP_ID_LEN]; kernel_ulong_t driver_data; }; struct pnp_card_device_id { __u8 id[PNP_ID_LEN]; kernel_ulong_t driver_data; struct { __u8 id[PNP_ID_LEN]; } devs[PNP_MAX_DEVICES]; }; #define SERIO_ANY 0xff struct serio_device_id { __u8 type; __u8 extra; __u8 id; __u8 proto; }; struct of_device_id { char name[32]; char type[32]; char compatible[128]; kernel_ulong_t data; }; struct vio_device_id { char type[32]; char compat[32]; }; struct pcmcia_device_id { __u16 match_flags; __u16 manf_id; __u16 card_id; __u8 func_id; __u8 function; __u8 device_no; __u32 prod_id_hash[4] __attribute__((aligned(sizeof(__u32)))); kernel_ulong_t prod_id[4] __attribute__((aligned(sizeof(kernel_ulong_t)))); kernel_ulong_t driver_info; kernel_ulong_t cisfile; }; #define PCMCIA_DEV_ID_MATCH_MANF_ID 0x0001 #define PCMCIA_DEV_ID_MATCH_CARD_ID 0x0002 #define PCMCIA_DEV_ID_MATCH_FUNC_ID 0x0004 #define PCMCIA_DEV_ID_MATCH_FUNCTION 0x0008 #define PCMCIA_DEV_ID_MATCH_PROD_ID1 0x0010 #define PCMCIA_DEV_ID_MATCH_PROD_ID2 0x0020 #define PCMCIA_DEV_ID_MATCH_PROD_ID3 0x0040 #define PCMCIA_DEV_ID_MATCH_PROD_ID4 0x0080 #define PCMCIA_DEV_ID_MATCH_DEVICE_NO 0x0100 #define PCMCIA_DEV_ID_MATCH_FAKE_CIS 0x0200 #define PCMCIA_DEV_ID_MATCH_ANONYMOUS 0x0400 struct i2c_device_id { __u16 id; }; #define INPUT_DEVICE_ID_EV_MAX 0x1f #define INPUT_DEVICE_ID_KEY_MAX 0x1ff #define INPUT_DEVICE_ID_REL_MAX 0x0f #define INPUT_DEVICE_ID_ABS_MAX 0x3f #define INPUT_DEVICE_ID_MSC_MAX 0x07 #define INPUT_DEVICE_ID_LED_MAX 0x0f #define INPUT_DEVICE_ID_SND_MAX 0x07 #define INPUT_DEVICE_ID_FF_MAX 0x7f #define INPUT_DEVICE_ID_SW_MAX 0x0f #define INPUT_DEVICE_ID_MATCH_BUS 1 #define INPUT_DEVICE_ID_MATCH_VENDOR 2 #define INPUT_DEVICE_ID_MATCH_PRODUCT 4 #define INPUT_DEVICE_ID_MATCH_VERSION 8 #define INPUT_DEVICE_ID_MATCH_EVBIT 0x0010 #define INPUT_DEVICE_ID_MATCH_KEYBIT 0x0020 #define INPUT_DEVICE_ID_MATCH_RELBIT 0x0040 #define INPUT_DEVICE_ID_MATCH_ABSBIT 0x0080 #define INPUT_DEVICE_ID_MATCH_MSCIT 0x0100 #define INPUT_DEVICE_ID_MATCH_LEDBIT 0x0200 #define INPUT_DEVICE_ID_MATCH_SNDBIT 0x0400 #define INPUT_DEVICE_ID_MATCH_FFBIT 0x0800 #define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000 struct input_device_id { kernel_ulong_t flags; __u16 bustype; __u16 vendor; __u16 product; __u16 version; kernel_ulong_t evbit[INPUT_DEVICE_ID_EV_MAX / BITS_PER_LONG + 1]; kernel_ulong_t keybit[INPUT_DEVICE_ID_KEY_MAX / BITS_PER_LONG + 1]; kernel_ulong_t relbit[INPUT_DEVICE_ID_REL_MAX / BITS_PER_LONG + 1]; kernel_ulong_t absbit[INPUT_DEVICE_ID_ABS_MAX / BITS_PER_LONG + 1]; kernel_ulong_t mscbit[INPUT_DEVICE_ID_MSC_MAX / BITS_PER_LONG + 1]; kernel_ulong_t ledbit[INPUT_DEVICE_ID_LED_MAX / BITS_PER_LONG + 1]; kernel_ulong_t sndbit[INPUT_DEVICE_ID_SND_MAX / BITS_PER_LONG + 1]; kernel_ulong_t ffbit[INPUT_DEVICE_ID_FF_MAX / BITS_PER_LONG + 1]; kernel_ulong_t swbit[INPUT_DEVICE_ID_SW_MAX / BITS_PER_LONG + 1]; kernel_ulong_t driver_info; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/stat.h0000644000015700001700000000314312200324306023601 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_STAT_H #define _LINUX_STAT_H #if !defined(__GLIBC__) || __GLIBC__ < 2 #define S_IFMT 00170000 #define S_IFSOCK 0140000 #define S_IFLNK 0120000 #define S_IFREG 0100000 #define S_IFBLK 0060000 #define S_IFDIR 0040000 #define S_IFCHR 0020000 #define S_IFIFO 0010000 #define S_ISUID 0004000 #define S_ISGID 0002000 #define S_ISVTX 0001000 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) #define S_IRWXU 00700 #define S_IRUSR 00400 #define S_IWUSR 00200 #define S_IXUSR 00100 #define S_IRWXG 00070 #define S_IRGRP 00040 #define S_IWGRP 00020 #define S_IXGRP 00010 #define S_IRWXO 00007 #define S_IROTH 00004 #define S_IWOTH 00002 #define S_IXOTH 00001 #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/jbd.h0000644000015700001700000000573212200324306023373 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_JBD_H #define _LINUX_JBD_H #include "jfs_compat.h" #define JFS_DEBUG #define jfs_debug jbd_debug #define journal_oom_retry 1 #undef JBD_PARANOID_IOFAIL #define JBD_DEFAULT_MAX_COMMIT_AGE 5 #define jbd_debug(f, a...) #define jbd_kmalloc(size, flags) __jbd_kmalloc(__FUNCTION__, (size), (flags), journal_oom_retry) #define jbd_rep_kmalloc(size, flags) __jbd_kmalloc(__FUNCTION__, (size), (flags), 1) #define JFS_MIN_JOURNAL_BLOCKS 1024 #define JFS_MAGIC_NUMBER 0xc03b3998U #define JFS_DESCRIPTOR_BLOCK 1 #define JFS_COMMIT_BLOCK 2 #define JFS_SUPERBLOCK_V1 3 #define JFS_SUPERBLOCK_V2 4 #define JFS_REVOKE_BLOCK 5 typedef struct journal_header_s { __be32 h_magic; __be32 h_blocktype; __be32 h_sequence; } journal_header_t; typedef struct journal_block_tag_s { __be32 t_blocknr; __be32 t_flags; } journal_block_tag_t; typedef struct journal_revoke_header_s { journal_header_t r_header; __be32 r_count; } journal_revoke_header_t; #define JFS_FLAG_ESCAPE 1 #define JFS_FLAG_SAME_UUID 2 #define JFS_FLAG_DELETED 4 #define JFS_FLAG_LAST_TAG 8 typedef struct journal_superblock_s { journal_header_t s_header; __be32 s_blocksize; __be32 s_maxlen; __be32 s_first; __be32 s_sequence; __be32 s_start; __be32 s_errno; __be32 s_feature_compat; __be32 s_feature_incompat; __be32 s_feature_ro_compat; __u8 s_uuid[16]; __be32 s_nr_users; __be32 s_dynsuper; __be32 s_max_transaction; __be32 s_max_trans_data; __u32 s_padding[44]; __u8 s_users[16*48]; } journal_superblock_t; #define JFS_HAS_COMPAT_FEATURE(j,mask) ((j)->j_format_version >= 2 && ((j)->j_superblock->s_feature_compat & cpu_to_be32((mask)))) #define JFS_HAS_RO_COMPAT_FEATURE(j,mask) ((j)->j_format_version >= 2 && ((j)->j_superblock->s_feature_ro_compat & cpu_to_be32((mask)))) #define JFS_HAS_INCOMPAT_FEATURE(j,mask) ((j)->j_format_version >= 2 && ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask)))) #define JFS_FEATURE_INCOMPAT_REVOKE 0x00000001 #define JFS_KNOWN_COMPAT_FEATURES 0 #define JFS_KNOWN_ROCOMPAT_FEATURES 0 #define JFS_KNOWN_INCOMPAT_FEATURES JFS_FEATURE_INCOMPAT_REVOKE #define BJ_None 0 #define BJ_SyncData 1 #define BJ_Metadata 2 #define BJ_Forget 3 #define BJ_IO 4 #define BJ_Shadow 5 #define BJ_LogCtl 6 #define BJ_Reserved 7 #define BJ_Locked 8 #define BJ_Types 9 #endif android-audiosystem-1.8+13.10.20130807/include/linux/genetlink.h0000644000015700001700000000660612200324306024615 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** *** To edit the content of this header, modify the corresponding *** source file (e.g. under external/kernel-headers/original/) then *** run bionic/libc/kernel/tools/update_all.py *** *** Any manual change here will be lost the next time this script will *** be run. You've been warned! *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_GENERIC_NETLINK_H #define __LINUX_GENERIC_NETLINK_H #include #include /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define GENL_NAMSIZ 16 #define GENL_MIN_ID NLMSG_MIN_TYPE #define GENL_MAX_ID 1023 struct genlmsghdr { /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u8 cmd; __u8 version; __u16 reserved; }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr)) #define GENL_ADMIN_PERM 0x01 #define GENL_CMD_CAP_DO 0x02 #define GENL_CMD_CAP_DUMP 0x04 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define GENL_CMD_CAP_HASPOL 0x08 #define GENL_ID_GENERATE 0 #define GENL_ID_CTRL NLMSG_MIN_TYPE enum { /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTRL_CMD_UNSPEC, CTRL_CMD_NEWFAMILY, CTRL_CMD_DELFAMILY, CTRL_CMD_GETFAMILY, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTRL_CMD_NEWOPS, CTRL_CMD_DELOPS, CTRL_CMD_GETOPS, CTRL_CMD_NEWMCAST_GRP, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTRL_CMD_DELMCAST_GRP, CTRL_CMD_GETMCAST_GRP, __CTRL_CMD_MAX, }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1) enum { CTRL_ATTR_UNSPEC, CTRL_ATTR_FAMILY_ID, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTRL_ATTR_FAMILY_NAME, CTRL_ATTR_VERSION, CTRL_ATTR_HDRSIZE, CTRL_ATTR_MAXATTR, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTRL_ATTR_OPS, CTRL_ATTR_MCAST_GROUPS, __CTRL_ATTR_MAX, }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1) enum { CTRL_ATTR_OP_UNSPEC, CTRL_ATTR_OP_ID, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTRL_ATTR_OP_FLAGS, __CTRL_ATTR_OP_MAX, }; #define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ enum { CTRL_ATTR_MCAST_GRP_UNSPEC, CTRL_ATTR_MCAST_GRP_NAME, CTRL_ATTR_MCAST_GRP_ID, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __CTRL_ATTR_MCAST_GRP_MAX, }; #define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1) #endif /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ android-audiosystem-1.8+13.10.20130807/include/linux/sysctl.h0000644000015700001700000004274112200324306024156 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SYSCTL_H #define _LINUX_SYSCTL_H #include #include #include struct file; struct completion; #define CTL_MAXNAME 10 struct __sysctl_args { int __user *name; int nlen; void __user *oldval; size_t __user *oldlenp; void __user *newval; size_t newlen; unsigned long __unused[4]; }; enum { CTL_KERN=1, CTL_VM=2, CTL_NET=3, CTL_FS=5, CTL_DEBUG=6, CTL_DEV=7, CTL_BUS=8, CTL_ABI=9, CTL_CPU=10 }; enum { CTL_BUS_ISA=1 }; enum { INOTIFY_MAX_USER_INSTANCES=1, INOTIFY_MAX_USER_WATCHES=2, INOTIFY_MAX_QUEUED_EVENTS=3 }; enum { KERN_OSTYPE=1, KERN_OSRELEASE=2, KERN_OSREV=3, KERN_VERSION=4, KERN_SECUREMASK=5, KERN_PROF=6, KERN_NODENAME=7, KERN_DOMAINNAME=8, KERN_CAP_BSET=14, KERN_PANIC=15, KERN_REALROOTDEV=16, KERN_SPARC_REBOOT=21, KERN_CTLALTDEL=22, KERN_PRINTK=23, KERN_NAMETRANS=24, KERN_PPC_HTABRECLAIM=25, KERN_PPC_ZEROPAGED=26, KERN_PPC_POWERSAVE_NAP=27, KERN_MODPROBE=28, KERN_SG_BIG_BUFF=29, KERN_ACCT=30, KERN_PPC_L2CR=31, KERN_RTSIGNR=32, KERN_RTSIGMAX=33, KERN_SHMMAX=34, KERN_MSGMAX=35, KERN_MSGMNB=36, KERN_MSGPOOL=37, KERN_SYSRQ=38, KERN_MAX_THREADS=39, KERN_RANDOM=40, KERN_SHMALL=41, KERN_MSGMNI=42, KERN_SEM=43, KERN_SPARC_STOP_A=44, KERN_SHMMNI=45, KERN_OVERFLOWUID=46, KERN_OVERFLOWGID=47, KERN_SHMPATH=48, KERN_HOTPLUG=49, KERN_IEEE_EMULATION_WARNINGS=50, KERN_S390_USER_DEBUG_LOGGING=51, KERN_CORE_USES_PID=52, KERN_TAINTED=53, KERN_CADPID=54, KERN_PIDMAX=55, KERN_CORE_PATTERN=56, KERN_PANIC_ON_OOPS=57, KERN_HPPA_PWRSW=58, KERN_HPPA_UNALIGNED=59, KERN_PRINTK_RATELIMIT=60, KERN_PRINTK_RATELIMIT_BURST=61, KERN_PTY=62, KERN_NGROUPS_MAX=63, KERN_SPARC_SCONS_PWROFF=64, KERN_HZ_TIMER=65, KERN_UNKNOWN_NMI_PANIC=66, KERN_BOOTLOADER_TYPE=67, KERN_RANDOMIZE=68, KERN_SETUID_DUMPABLE=69, KERN_SPIN_RETRY=70, KERN_ACPI_VIDEO_FLAGS=71, KERN_IA64_UNALIGNED=72, KERN_COMPAT_LOG=73, KERN_MAX_LOCK_DEPTH=74, }; enum { VM_UNUSED1=1, VM_UNUSED2=2, VM_UNUSED3=3, VM_UNUSED4=4, VM_OVERCOMMIT_MEMORY=5, VM_UNUSED5=6, VM_UNUSED7=7, VM_UNUSED8=8, VM_UNUSED9=9, VM_PAGE_CLUSTER=10, VM_DIRTY_BACKGROUND=11, VM_DIRTY_RATIO=12, VM_DIRTY_WB_CS=13, VM_DIRTY_EXPIRE_CS=14, VM_NR_PDFLUSH_THREADS=15, VM_OVERCOMMIT_RATIO=16, VM_PAGEBUF=17, VM_HUGETLB_PAGES=18, VM_SWAPPINESS=19, VM_LOWMEM_RESERVE_RATIO=20, VM_MIN_FREE_KBYTES=21, VM_MAX_MAP_COUNT=22, VM_LAPTOP_MODE=23, VM_BLOCK_DUMP=24, VM_HUGETLB_GROUP=25, VM_VFS_CACHE_PRESSURE=26, VM_LEGACY_VA_LAYOUT=27, VM_SWAP_TOKEN_TIMEOUT=28, VM_DROP_PAGECACHE=29, VM_PERCPU_PAGELIST_FRACTION=30, VM_ZONE_RECLAIM_MODE=31, VM_MIN_UNMAPPED=32, VM_PANIC_ON_OOM=33, VM_VDSO_ENABLED=34, }; enum { NET_CORE=1, NET_ETHER=2, NET_802=3, NET_UNIX=4, NET_IPV4=5, NET_IPX=6, NET_ATALK=7, NET_NETROM=8, NET_AX25=9, NET_BRIDGE=10, NET_ROSE=11, NET_IPV6=12, NET_X25=13, NET_TR=14, NET_DECNET=15, NET_ECONET=16, NET_SCTP=17, NET_LLC=18, NET_NETFILTER=19, NET_DCCP=20, }; enum { RANDOM_POOLSIZE=1, RANDOM_ENTROPY_COUNT=2, RANDOM_READ_THRESH=3, RANDOM_WRITE_THRESH=4, RANDOM_BOOT_ID=5, RANDOM_UUID=6 }; enum { PTY_MAX=1, PTY_NR=2 }; enum { BUS_ISA_MEM_BASE=1, BUS_ISA_PORT_BASE=2, BUS_ISA_PORT_SHIFT=3 }; enum { NET_CORE_WMEM_MAX=1, NET_CORE_RMEM_MAX=2, NET_CORE_WMEM_DEFAULT=3, NET_CORE_RMEM_DEFAULT=4, NET_CORE_MAX_BACKLOG=6, NET_CORE_FASTROUTE=7, NET_CORE_MSG_COST=8, NET_CORE_MSG_BURST=9, NET_CORE_OPTMEM_MAX=10, NET_CORE_HOT_LIST_LENGTH=11, NET_CORE_DIVERT_VERSION=12, NET_CORE_NO_CONG_THRESH=13, NET_CORE_NO_CONG=14, NET_CORE_LO_CONG=15, NET_CORE_MOD_CONG=16, NET_CORE_DEV_WEIGHT=17, NET_CORE_SOMAXCONN=18, NET_CORE_BUDGET=19, NET_CORE_AEVENT_ETIME=20, NET_CORE_AEVENT_RSEQTH=21, }; enum { NET_UNIX_DESTROY_DELAY=1, NET_UNIX_DELETE_DELAY=2, NET_UNIX_MAX_DGRAM_QLEN=3, }; enum { NET_NF_CONNTRACK_MAX=1, NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2, NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3, NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4, NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5, NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6, NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7, NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8, NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9, NET_NF_CONNTRACK_UDP_TIMEOUT=10, NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11, NET_NF_CONNTRACK_ICMP_TIMEOUT=12, NET_NF_CONNTRACK_GENERIC_TIMEOUT=13, NET_NF_CONNTRACK_BUCKETS=14, NET_NF_CONNTRACK_LOG_INVALID=15, NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16, NET_NF_CONNTRACK_TCP_LOOSE=17, NET_NF_CONNTRACK_TCP_BE_LIBERAL=18, NET_NF_CONNTRACK_TCP_MAX_RETRANS=19, NET_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20, NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21, NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22, NET_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23, NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24, NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25, NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26, NET_NF_CONNTRACK_COUNT=27, NET_NF_CONNTRACK_ICMPV6_TIMEOUT=28, NET_NF_CONNTRACK_FRAG6_TIMEOUT=29, NET_NF_CONNTRACK_FRAG6_LOW_THRESH=30, NET_NF_CONNTRACK_FRAG6_HIGH_THRESH=31, NET_NF_CONNTRACK_CHECKSUM=32, }; enum { NET_IPV4_FORWARD=8, NET_IPV4_DYNADDR=9, NET_IPV4_CONF=16, NET_IPV4_NEIGH=17, NET_IPV4_ROUTE=18, NET_IPV4_FIB_HASH=19, NET_IPV4_NETFILTER=20, NET_IPV4_TCP_TIMESTAMPS=33, NET_IPV4_TCP_WINDOW_SCALING=34, NET_IPV4_TCP_SACK=35, NET_IPV4_TCP_RETRANS_COLLAPSE=36, NET_IPV4_DEFAULT_TTL=37, NET_IPV4_AUTOCONFIG=38, NET_IPV4_NO_PMTU_DISC=39, NET_IPV4_TCP_SYN_RETRIES=40, NET_IPV4_IPFRAG_HIGH_THRESH=41, NET_IPV4_IPFRAG_LOW_THRESH=42, NET_IPV4_IPFRAG_TIME=43, NET_IPV4_TCP_MAX_KA_PROBES=44, NET_IPV4_TCP_KEEPALIVE_TIME=45, NET_IPV4_TCP_KEEPALIVE_PROBES=46, NET_IPV4_TCP_RETRIES1=47, NET_IPV4_TCP_RETRIES2=48, NET_IPV4_TCP_FIN_TIMEOUT=49, NET_IPV4_IP_MASQ_DEBUG=50, NET_TCP_SYNCOOKIES=51, NET_TCP_STDURG=52, NET_TCP_RFC1337=53, NET_TCP_SYN_TAILDROP=54, NET_TCP_MAX_SYN_BACKLOG=55, NET_IPV4_LOCAL_PORT_RANGE=56, NET_IPV4_ICMP_ECHO_IGNORE_ALL=57, NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS=58, NET_IPV4_ICMP_SOURCEQUENCH_RATE=59, NET_IPV4_ICMP_DESTUNREACH_RATE=60, NET_IPV4_ICMP_TIMEEXCEED_RATE=61, NET_IPV4_ICMP_PARAMPROB_RATE=62, NET_IPV4_ICMP_ECHOREPLY_RATE=63, NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES=64, NET_IPV4_IGMP_MAX_MEMBERSHIPS=65, NET_TCP_TW_RECYCLE=66, NET_IPV4_ALWAYS_DEFRAG=67, NET_IPV4_TCP_KEEPALIVE_INTVL=68, NET_IPV4_INET_PEER_THRESHOLD=69, NET_IPV4_INET_PEER_MINTTL=70, NET_IPV4_INET_PEER_MAXTTL=71, NET_IPV4_INET_PEER_GC_MINTIME=72, NET_IPV4_INET_PEER_GC_MAXTIME=73, NET_TCP_ORPHAN_RETRIES=74, NET_TCP_ABORT_ON_OVERFLOW=75, NET_TCP_SYNACK_RETRIES=76, NET_TCP_MAX_ORPHANS=77, NET_TCP_MAX_TW_BUCKETS=78, NET_TCP_FACK=79, NET_TCP_REORDERING=80, NET_TCP_ECN=81, NET_TCP_DSACK=82, NET_TCP_MEM=83, NET_TCP_WMEM=84, NET_TCP_RMEM=85, NET_TCP_APP_WIN=86, NET_TCP_ADV_WIN_SCALE=87, NET_IPV4_NONLOCAL_BIND=88, NET_IPV4_ICMP_RATELIMIT=89, NET_IPV4_ICMP_RATEMASK=90, NET_TCP_TW_REUSE=91, NET_TCP_FRTO=92, NET_TCP_LOW_LATENCY=93, NET_IPV4_IPFRAG_SECRET_INTERVAL=94, NET_IPV4_IGMP_MAX_MSF=96, NET_TCP_NO_METRICS_SAVE=97, NET_TCP_DEFAULT_WIN_SCALE=105, NET_TCP_MODERATE_RCVBUF=106, NET_TCP_TSO_WIN_DIVISOR=107, NET_TCP_BIC_BETA=108, NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, NET_TCP_CONG_CONTROL=110, NET_TCP_ABC=111, NET_IPV4_IPFRAG_MAX_DIST=112, NET_TCP_MTU_PROBING=113, NET_TCP_BASE_MSS=114, NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115, NET_TCP_DMA_COPYBREAK=116, NET_TCP_SLOW_START_AFTER_IDLE=117, }; enum { NET_IPV4_ROUTE_FLUSH=1, NET_IPV4_ROUTE_MIN_DELAY=2, NET_IPV4_ROUTE_MAX_DELAY=3, NET_IPV4_ROUTE_GC_THRESH=4, NET_IPV4_ROUTE_MAX_SIZE=5, NET_IPV4_ROUTE_GC_MIN_INTERVAL=6, NET_IPV4_ROUTE_GC_TIMEOUT=7, NET_IPV4_ROUTE_GC_INTERVAL=8, NET_IPV4_ROUTE_REDIRECT_LOAD=9, NET_IPV4_ROUTE_REDIRECT_NUMBER=10, NET_IPV4_ROUTE_REDIRECT_SILENCE=11, NET_IPV4_ROUTE_ERROR_COST=12, NET_IPV4_ROUTE_ERROR_BURST=13, NET_IPV4_ROUTE_GC_ELASTICITY=14, NET_IPV4_ROUTE_MTU_EXPIRES=15, NET_IPV4_ROUTE_MIN_PMTU=16, NET_IPV4_ROUTE_MIN_ADVMSS=17, NET_IPV4_ROUTE_SECRET_INTERVAL=18, NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS=19, }; enum { NET_PROTO_CONF_ALL=-2, NET_PROTO_CONF_DEFAULT=-3 }; enum { NET_IPV4_CONF_FORWARDING=1, NET_IPV4_CONF_MC_FORWARDING=2, NET_IPV4_CONF_PROXY_ARP=3, NET_IPV4_CONF_ACCEPT_REDIRECTS=4, NET_IPV4_CONF_SECURE_REDIRECTS=5, NET_IPV4_CONF_SEND_REDIRECTS=6, NET_IPV4_CONF_SHARED_MEDIA=7, NET_IPV4_CONF_RP_FILTER=8, NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE=9, NET_IPV4_CONF_BOOTP_RELAY=10, NET_IPV4_CONF_LOG_MARTIANS=11, NET_IPV4_CONF_TAG=12, NET_IPV4_CONF_ARPFILTER=13, NET_IPV4_CONF_MEDIUM_ID=14, NET_IPV4_CONF_NOXFRM=15, NET_IPV4_CONF_NOPOLICY=16, NET_IPV4_CONF_FORCE_IGMP_VERSION=17, NET_IPV4_CONF_ARP_ANNOUNCE=18, NET_IPV4_CONF_ARP_IGNORE=19, NET_IPV4_CONF_PROMOTE_SECONDARIES=20, NET_IPV4_CONF_ARP_ACCEPT=21, __NET_IPV4_CONF_MAX }; enum { NET_IPV4_NF_CONNTRACK_MAX=1, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9, NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT=10, NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11, NET_IPV4_NF_CONNTRACK_ICMP_TIMEOUT=12, NET_IPV4_NF_CONNTRACK_GENERIC_TIMEOUT=13, NET_IPV4_NF_CONNTRACK_BUCKETS=14, NET_IPV4_NF_CONNTRACK_LOG_INVALID=15, NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16, NET_IPV4_NF_CONNTRACK_TCP_LOOSE=17, NET_IPV4_NF_CONNTRACK_TCP_BE_LIBERAL=18, NET_IPV4_NF_CONNTRACK_TCP_MAX_RETRANS=19, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25, NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26, NET_IPV4_NF_CONNTRACK_COUNT=27, NET_IPV4_NF_CONNTRACK_CHECKSUM=28, }; enum { NET_IPV6_CONF=16, NET_IPV6_NEIGH=17, NET_IPV6_ROUTE=18, NET_IPV6_ICMP=19, NET_IPV6_BINDV6ONLY=20, NET_IPV6_IP6FRAG_HIGH_THRESH=21, NET_IPV6_IP6FRAG_LOW_THRESH=22, NET_IPV6_IP6FRAG_TIME=23, NET_IPV6_IP6FRAG_SECRET_INTERVAL=24, NET_IPV6_MLD_MAX_MSF=25, }; enum { NET_IPV6_ROUTE_FLUSH=1, NET_IPV6_ROUTE_GC_THRESH=2, NET_IPV6_ROUTE_MAX_SIZE=3, NET_IPV6_ROUTE_GC_MIN_INTERVAL=4, NET_IPV6_ROUTE_GC_TIMEOUT=5, NET_IPV6_ROUTE_GC_INTERVAL=6, NET_IPV6_ROUTE_GC_ELASTICITY=7, NET_IPV6_ROUTE_MTU_EXPIRES=8, NET_IPV6_ROUTE_MIN_ADVMSS=9, NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS=10 }; enum { NET_IPV6_FORWARDING=1, NET_IPV6_HOP_LIMIT=2, NET_IPV6_MTU=3, NET_IPV6_ACCEPT_RA=4, NET_IPV6_ACCEPT_REDIRECTS=5, NET_IPV6_AUTOCONF=6, NET_IPV6_DAD_TRANSMITS=7, NET_IPV6_RTR_SOLICITS=8, NET_IPV6_RTR_SOLICIT_INTERVAL=9, NET_IPV6_RTR_SOLICIT_DELAY=10, NET_IPV6_USE_TEMPADDR=11, NET_IPV6_TEMP_VALID_LFT=12, NET_IPV6_TEMP_PREFERED_LFT=13, NET_IPV6_REGEN_MAX_RETRY=14, NET_IPV6_MAX_DESYNC_FACTOR=15, NET_IPV6_MAX_ADDRESSES=16, NET_IPV6_FORCE_MLD_VERSION=17, NET_IPV6_ACCEPT_RA_DEFRTR=18, NET_IPV6_ACCEPT_RA_PINFO=19, NET_IPV6_ACCEPT_RA_RTR_PREF=20, NET_IPV6_RTR_PROBE_INTERVAL=21, NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22, __NET_IPV6_MAX }; enum { NET_IPV6_ICMP_RATELIMIT=1 }; enum { NET_NEIGH_MCAST_SOLICIT=1, NET_NEIGH_UCAST_SOLICIT=2, NET_NEIGH_APP_SOLICIT=3, NET_NEIGH_RETRANS_TIME=4, NET_NEIGH_REACHABLE_TIME=5, NET_NEIGH_DELAY_PROBE_TIME=6, NET_NEIGH_GC_STALE_TIME=7, NET_NEIGH_UNRES_QLEN=8, NET_NEIGH_PROXY_QLEN=9, NET_NEIGH_ANYCAST_DELAY=10, NET_NEIGH_PROXY_DELAY=11, NET_NEIGH_LOCKTIME=12, NET_NEIGH_GC_INTERVAL=13, NET_NEIGH_GC_THRESH1=14, NET_NEIGH_GC_THRESH2=15, NET_NEIGH_GC_THRESH3=16, NET_NEIGH_RETRANS_TIME_MS=17, NET_NEIGH_REACHABLE_TIME_MS=18, __NET_NEIGH_MAX }; enum { NET_DCCP_DEFAULT=1, }; enum { NET_DCCP_DEFAULT_SEQ_WINDOW = 1, NET_DCCP_DEFAULT_RX_CCID = 2, NET_DCCP_DEFAULT_TX_CCID = 3, NET_DCCP_DEFAULT_ACK_RATIO = 4, NET_DCCP_DEFAULT_SEND_ACKVEC = 5, NET_DCCP_DEFAULT_SEND_NDP = 6, }; enum { NET_IPX_PPROP_BROADCASTING=1, NET_IPX_FORWARDING=2 }; enum { NET_LLC2=1, NET_LLC_STATION=2, }; enum { NET_LLC2_TIMEOUT=1, }; enum { NET_LLC_STATION_ACK_TIMEOUT=1, }; enum { NET_LLC2_ACK_TIMEOUT=1, NET_LLC2_P_TIMEOUT=2, NET_LLC2_REJ_TIMEOUT=3, NET_LLC2_BUSY_TIMEOUT=4, }; enum { NET_ATALK_AARP_EXPIRY_TIME=1, NET_ATALK_AARP_TICK_TIME=2, NET_ATALK_AARP_RETRANSMIT_LIMIT=3, NET_ATALK_AARP_RESOLVE_TIME=4 }; enum { NET_NETROM_DEFAULT_PATH_QUALITY=1, NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER=2, NET_NETROM_NETWORK_TTL_INITIALISER=3, NET_NETROM_TRANSPORT_TIMEOUT=4, NET_NETROM_TRANSPORT_MAXIMUM_TRIES=5, NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY=6, NET_NETROM_TRANSPORT_BUSY_DELAY=7, NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE=8, NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT=9, NET_NETROM_ROUTING_CONTROL=10, NET_NETROM_LINK_FAILS_COUNT=11, NET_NETROM_RESET=12 }; enum { NET_AX25_IP_DEFAULT_MODE=1, NET_AX25_DEFAULT_MODE=2, NET_AX25_BACKOFF_TYPE=3, NET_AX25_CONNECT_MODE=4, NET_AX25_STANDARD_WINDOW=5, NET_AX25_EXTENDED_WINDOW=6, NET_AX25_T1_TIMEOUT=7, NET_AX25_T2_TIMEOUT=8, NET_AX25_T3_TIMEOUT=9, NET_AX25_IDLE_TIMEOUT=10, NET_AX25_N2=11, NET_AX25_PACLEN=12, NET_AX25_PROTOCOL=13, NET_AX25_DAMA_SLAVE_TIMEOUT=14 }; enum { NET_ROSE_RESTART_REQUEST_TIMEOUT=1, NET_ROSE_CALL_REQUEST_TIMEOUT=2, NET_ROSE_RESET_REQUEST_TIMEOUT=3, NET_ROSE_CLEAR_REQUEST_TIMEOUT=4, NET_ROSE_ACK_HOLD_BACK_TIMEOUT=5, NET_ROSE_ROUTING_CONTROL=6, NET_ROSE_LINK_FAIL_TIMEOUT=7, NET_ROSE_MAX_VCS=8, NET_ROSE_WINDOW_SIZE=9, NET_ROSE_NO_ACTIVITY_TIMEOUT=10 }; enum { NET_X25_RESTART_REQUEST_TIMEOUT=1, NET_X25_CALL_REQUEST_TIMEOUT=2, NET_X25_RESET_REQUEST_TIMEOUT=3, NET_X25_CLEAR_REQUEST_TIMEOUT=4, NET_X25_ACK_HOLD_BACK_TIMEOUT=5 }; enum { NET_TR_RIF_TIMEOUT=1 }; enum { NET_DECNET_NODE_TYPE = 1, NET_DECNET_NODE_ADDRESS = 2, NET_DECNET_NODE_NAME = 3, NET_DECNET_DEFAULT_DEVICE = 4, NET_DECNET_TIME_WAIT = 5, NET_DECNET_DN_COUNT = 6, NET_DECNET_DI_COUNT = 7, NET_DECNET_DR_COUNT = 8, NET_DECNET_DST_GC_INTERVAL = 9, NET_DECNET_CONF = 10, NET_DECNET_NO_FC_MAX_CWND = 11, NET_DECNET_MEM = 12, NET_DECNET_RMEM = 13, NET_DECNET_WMEM = 14, NET_DECNET_DEBUG_LEVEL = 255 }; enum { NET_DECNET_CONF_LOOPBACK = -2, NET_DECNET_CONF_DDCMP = -3, NET_DECNET_CONF_PPP = -4, NET_DECNET_CONF_X25 = -5, NET_DECNET_CONF_GRE = -6, NET_DECNET_CONF_ETHER = -7 }; enum { NET_DECNET_CONF_DEV_PRIORITY = 1, NET_DECNET_CONF_DEV_T1 = 2, NET_DECNET_CONF_DEV_T2 = 3, NET_DECNET_CONF_DEV_T3 = 4, NET_DECNET_CONF_DEV_FORWARDING = 5, NET_DECNET_CONF_DEV_BLKSIZE = 6, NET_DECNET_CONF_DEV_STATE = 7 }; enum { NET_SCTP_RTO_INITIAL = 1, NET_SCTP_RTO_MIN = 2, NET_SCTP_RTO_MAX = 3, NET_SCTP_RTO_ALPHA = 4, NET_SCTP_RTO_BETA = 5, NET_SCTP_VALID_COOKIE_LIFE = 6, NET_SCTP_ASSOCIATION_MAX_RETRANS = 7, NET_SCTP_PATH_MAX_RETRANS = 8, NET_SCTP_MAX_INIT_RETRANSMITS = 9, NET_SCTP_HB_INTERVAL = 10, NET_SCTP_PRESERVE_ENABLE = 11, NET_SCTP_MAX_BURST = 12, NET_SCTP_ADDIP_ENABLE = 13, NET_SCTP_PRSCTP_ENABLE = 14, NET_SCTP_SNDBUF_POLICY = 15, NET_SCTP_SACK_TIMEOUT = 16, NET_SCTP_RCVBUF_POLICY = 17, }; enum { NET_BRIDGE_NF_CALL_ARPTABLES = 1, NET_BRIDGE_NF_CALL_IPTABLES = 2, NET_BRIDGE_NF_CALL_IP6TABLES = 3, NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4, }; enum { FS_NRINODE=1, FS_STATINODE=2, FS_MAXINODE=3, FS_NRDQUOT=4, FS_MAXDQUOT=5, FS_NRFILE=6, FS_MAXFILE=7, FS_DENTRY=8, FS_NRSUPER=9, FS_MAXSUPER=10, FS_OVERFLOWUID=11, FS_OVERFLOWGID=12, FS_LEASES=13, FS_DIR_NOTIFY=14, FS_LEASE_TIME=15, FS_DQSTATS=16, FS_XFS=17, FS_AIO_NR=18, FS_AIO_MAX_NR=19, FS_INOTIFY=20, }; enum { FS_DQ_LOOKUPS = 1, FS_DQ_DROPS = 2, FS_DQ_READS = 3, FS_DQ_WRITES = 4, FS_DQ_CACHE_HITS = 5, FS_DQ_ALLOCATED = 6, FS_DQ_FREE = 7, FS_DQ_SYNCS = 8, FS_DQ_WARNINGS = 9, }; enum { DEV_CDROM=1, DEV_HWMON=2, DEV_PARPORT=3, DEV_RAID=4, DEV_MAC_HID=5, DEV_SCSI=6, DEV_IPMI=7, }; enum { DEV_CDROM_INFO=1, DEV_CDROM_AUTOCLOSE=2, DEV_CDROM_AUTOEJECT=3, DEV_CDROM_DEBUG=4, DEV_CDROM_LOCK=5, DEV_CDROM_CHECK_MEDIA=6 }; enum { DEV_PARPORT_DEFAULT=-3 }; enum { DEV_RAID_SPEED_LIMIT_MIN=1, DEV_RAID_SPEED_LIMIT_MAX=2 }; enum { DEV_PARPORT_DEFAULT_TIMESLICE=1, DEV_PARPORT_DEFAULT_SPINTIME=2 }; enum { DEV_PARPORT_SPINTIME=1, DEV_PARPORT_BASE_ADDR=2, DEV_PARPORT_IRQ=3, DEV_PARPORT_DMA=4, DEV_PARPORT_MODES=5, DEV_PARPORT_DEVICES=6, DEV_PARPORT_AUTOPROBE=16 }; enum { DEV_PARPORT_DEVICES_ACTIVE=-3, }; enum { DEV_PARPORT_DEVICE_TIMESLICE=1, }; enum { DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES=1, DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES=2, DEV_MAC_HID_MOUSE_BUTTON_EMULATION=3, DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE=4, DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE=5, DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6 }; enum { DEV_SCSI_LOGGING_LEVEL=1, }; enum { DEV_IPMI_POWEROFF_POWERCYCLE=1, }; enum { ABI_DEFHANDLER_COFF=1, ABI_DEFHANDLER_ELF=2, ABI_DEFHANDLER_LCALL7=3, ABI_DEFHANDLER_LIBCSO=4, ABI_TRACE=5, ABI_FAKE_UTSNAME=6, }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv6/0000755000015700001700000000000012200324404025413 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv6/ip6t_hl.h0000644000015700001700000000151312200324306027132 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IP6T_HL_H #define _IP6T_HL_H enum { IP6T_HL_EQ = 0, IP6T_HL_NE, IP6T_HL_LT, IP6T_HL_GT, }; struct ip6t_hl_info { u_int8_t mode; u_int8_t hop_limit; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv6/ip6t_HL.h0000644000015700001700000000154512200324306027037 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IP6T_HL_H #define _IP6T_HL_H enum { IP6T_HL_SET = 0, IP6T_HL_INC, IP6T_HL_DEC }; #define IP6T_HL_MAXMODE IP6T_HL_DEC struct ip6t_HL_info { u_int8_t mode; u_int8_t hop_limit; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv6/ip6t_mac.h0000644000015700001700000000142212200324306027266 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IP6T_MAC_H #define _IP6T_MAC_H #include #define ip6t_mac_info xt_mac_info #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv6/ip6t_ah.h0000644000015700001700000000172612200324306027125 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IP6T_AH_H #define _IP6T_AH_H struct ip6t_ah { u_int32_t spis[2]; u_int32_t hdrlen; u_int8_t hdrres; u_int8_t invflags; }; #define IP6T_AH_SPI 0x01 #define IP6T_AH_LEN 0x02 #define IP6T_AH_RES 0x04 #define IP6T_AH_INV_SPI 0x01 #define IP6T_AH_INV_LEN 0x02 #define IP6T_AH_INV_MASK 0x03 #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv6/ip6t_owner.h0000644000015700001700000000164612200324306027670 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IP6T_OWNER_H #define _IP6T_OWNER_H #define IP6T_OWNER_UID 0x01 #define IP6T_OWNER_GID 0x02 #define IP6T_OWNER_PID 0x04 #define IP6T_OWNER_SID 0x08 struct ip6t_owner_info { uid_t uid; gid_t gid; pid_t pid; pid_t sid; u_int8_t match, invert; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv6/ip6_tables.h0000644000015700001700000001104312200324306027614 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IP6_TABLES_H #define _IP6_TABLES_H #include #include #include #define IP6T_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN #define IP6T_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN #define ip6t_match xt_match #define ip6t_target xt_target #define ip6t_table xt_table #define ip6t_get_revision xt_get_revision struct ip6t_ip6 { struct in6_addr src, dst; struct in6_addr smsk, dmsk; char iniface[IFNAMSIZ], outiface[IFNAMSIZ]; unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ]; u_int16_t proto; u_int8_t tos; u_int8_t flags; u_int8_t invflags; }; #define ip6t_entry_match xt_entry_match #define ip6t_entry_target xt_entry_target #define ip6t_standard_target xt_standard_target #define ip6t_counters xt_counters #define IP6T_F_PROTO 0x01 #define IP6T_F_TOS 0x02 #define IP6T_F_GOTO 0x04 #define IP6T_F_MASK 0x07 #define IP6T_INV_VIA_IN 0x01 #define IP6T_INV_VIA_OUT 0x02 #define IP6T_INV_TOS 0x04 #define IP6T_INV_SRCIP 0x08 #define IP6T_INV_DSTIP 0x10 #define IP6T_INV_FRAG 0x20 #define IP6T_INV_PROTO XT_INV_PROTO #define IP6T_INV_MASK 0x7F struct ip6t_entry { struct ip6t_ip6 ipv6; unsigned int nfcache; u_int16_t target_offset; u_int16_t next_offset; unsigned int comefrom; struct xt_counters counters; unsigned char elems[0]; }; #define IP6T_BASE_CTL XT_BASE_CTL #define IP6T_SO_SET_REPLACE XT_SO_SET_REPLACE #define IP6T_SO_SET_ADD_COUNTERS XT_SO_SET_ADD_COUNTERS #define IP6T_SO_SET_MAX XT_SO_SET_MAX #define IP6T_SO_GET_INFO XT_SO_GET_INFO #define IP6T_SO_GET_ENTRIES XT_SO_GET_ENTRIES #define IP6T_SO_GET_REVISION_MATCH XT_SO_GET_REVISION_MATCH #define IP6T_SO_GET_REVISION_TARGET XT_SO_GET_REVISION_TARGET #define IP6T_SO_GET_MAX XT_SO_GET_REVISION_TARGET #define IP6T_CONTINUE XT_CONTINUE #define IP6T_RETURN XT_RETURN #include #define ip6t_tcp xt_tcp #define ip6t_udp xt_udp #define IP6T_TCP_INV_SRCPT XT_TCP_INV_SRCPT #define IP6T_TCP_INV_DSTPT XT_TCP_INV_DSTPT #define IP6T_TCP_INV_FLAGS XT_TCP_INV_FLAGS #define IP6T_TCP_INV_OPTION XT_TCP_INV_OPTION #define IP6T_TCP_INV_MASK XT_TCP_INV_MASK #define IP6T_UDP_INV_SRCPT XT_UDP_INV_SRCPT #define IP6T_UDP_INV_DSTPT XT_UDP_INV_DSTPT #define IP6T_UDP_INV_MASK XT_UDP_INV_MASK struct ip6t_icmp { u_int8_t type; u_int8_t code[2]; u_int8_t invflags; }; #define IP6T_ICMP_INV 0x01 struct ip6t_getinfo { char name[IP6T_TABLE_MAXNAMELEN]; unsigned int valid_hooks; unsigned int hook_entry[NF_IP6_NUMHOOKS]; unsigned int underflow[NF_IP6_NUMHOOKS]; unsigned int num_entries; unsigned int size; }; struct ip6t_replace { char name[IP6T_TABLE_MAXNAMELEN]; unsigned int valid_hooks; unsigned int num_entries; unsigned int size; unsigned int hook_entry[NF_IP6_NUMHOOKS]; unsigned int underflow[NF_IP6_NUMHOOKS]; unsigned int num_counters; struct xt_counters __user *counters; struct ip6t_entry entries[0]; }; #define ip6t_counters_info xt_counters_info struct ip6t_get_entries { char name[IP6T_TABLE_MAXNAMELEN]; unsigned int size; struct ip6t_entry entrytable[0]; }; #define IP6T_STANDARD_TARGET XT_STANDARD_TARGET #define IP6T_ERROR_TARGET XT_ERROR_TARGET static __inline__ struct ip6t_entry_target * ip6t_get_target(struct ip6t_entry *e) { return (void *)e + e->target_offset; } #define IP6T_MATCH_ITERATE(e, fn, args...) ({ unsigned int __i; int __ret = 0; struct ip6t_entry_match *__m; for (__i = sizeof(struct ip6t_entry); __i < (e)->target_offset; __i += __m->u.match_size) { __m = (void *)(e) + __i; __ret = fn(__m , ## args); if (__ret != 0) break; } __ret; }) #define IP6T_ENTRY_ITERATE(entries, size, fn, args...) ({ unsigned int __i; int __ret = 0; struct ip6t_entry *__e; for (__i = 0; __i < (size); __i += __e->next_offset) { __e = (void *)(entries) + __i; __ret = fn(__e , ## args); if (__ret != 0) break; } __ret; }) #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv6/ip6t_esp.h0000644000015700001700000000153312200324306027320 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IP6T_ESP_H #define _IP6T_ESP_H #include #define ip6t_esp xt_esp #define IP6T_ESP_INV_SPI XT_ESP_INV_SPI #define IP6T_ESP_INV_MASK XT_ESP_INV_MASK #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv6/ip6t_frag.h0000644000015700001700000000206612200324306027452 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IP6T_FRAG_H #define _IP6T_FRAG_H struct ip6t_frag { u_int32_t ids[2]; u_int32_t hdrlen; u_int8_t flags; u_int8_t invflags; }; #define IP6T_FRAG_IDS 0x01 #define IP6T_FRAG_LEN 0x02 #define IP6T_FRAG_RES 0x04 #define IP6T_FRAG_FST 0x08 #define IP6T_FRAG_MF 0x10 #define IP6T_FRAG_NMF 0x20 #define IP6T_FRAG_INV_IDS 0x01 #define IP6T_FRAG_INV_LEN 0x02 #define IP6T_FRAG_INV_MASK 0x03 #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv6/ip6t_rt.h0000644000015700001700000000231612200324306027156 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IP6T_RT_H #define _IP6T_RT_H #define IP6T_RT_HOPS 16 struct ip6t_rt { u_int32_t rt_type; u_int32_t segsleft[2]; u_int32_t hdrlen; u_int8_t flags; u_int8_t invflags; struct in6_addr addrs[IP6T_RT_HOPS]; u_int8_t addrnr; }; #define IP6T_RT_TYP 0x01 #define IP6T_RT_SGS 0x02 #define IP6T_RT_LEN 0x04 #define IP6T_RT_RES 0x08 #define IP6T_RT_FST_MASK 0x30 #define IP6T_RT_FST 0x10 #define IP6T_RT_FST_NSTRICT 0x20 #define IP6T_RT_INV_TYP 0x01 #define IP6T_RT_INV_SGS 0x02 #define IP6T_RT_INV_LEN 0x04 #define IP6T_RT_INV_MASK 0x07 #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv6/ip6t_opts.h0000644000015700001700000000201112200324306027506 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IP6T_OPTS_H #define _IP6T_OPTS_H #define IP6T_OPTS_OPTSNR 16 struct ip6t_opts { u_int32_t hdrlen; u_int8_t flags; u_int8_t invflags; u_int16_t opts[IP6T_OPTS_OPTSNR]; u_int8_t optsnr; }; #define IP6T_OPTS_LEN 0x01 #define IP6T_OPTS_OPTS 0x02 #define IP6T_OPTS_NSTRICT 0x04 #define IP6T_OPTS_INV_LEN 0x01 #define IP6T_OPTS_INV_MASK 0x01 #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv6/ip6t_LOG.h0000644000015700001700000000173112200324306027152 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IP6T_LOG_H #define _IP6T_LOG_H #define IP6T_LOG_TCPSEQ 0x01 #define IP6T_LOG_TCPOPT 0x02 #define IP6T_LOG_IPOPT 0x04 #define IP6T_LOG_UID 0x08 #define IP6T_LOG_NFLOG 0x10 #define IP6T_LOG_MASK 0x1f struct ip6t_log_info { unsigned char level; unsigned char logflags; char prefix[30]; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv6/ip6t_REJECT.h0000644000015700001700000000170412200324306027505 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IP6T_REJECT_H #define _IP6T_REJECT_H enum ip6t_reject_with { IP6T_ICMP6_NO_ROUTE, IP6T_ICMP6_ADM_PROHIBITED, IP6T_ICMP6_NOT_NEIGHBOUR, IP6T_ICMP6_ADDR_UNREACH, IP6T_ICMP6_PORT_UNREACH, IP6T_ICMP6_ECHOREPLY, IP6T_TCP_RESET }; struct ip6t_reject_info { u_int32_t with; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv6/ip6t_physdev.h0000644000015700001700000000211212200324306030205 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IP6T_PHYSDEV_H #define _IP6T_PHYSDEV_H #include #define IP6T_PHYSDEV_OP_IN XT_PHYSDEV_OP_IN #define IP6T_PHYSDEV_OP_OUT XT_PHYSDEV_OP_OUT #define IP6T_PHYSDEV_OP_BRIDGED XT_PHYSDEV_OP_BRIDGED #define IP6T_PHYSDEV_OP_ISIN XT_PHYSDEV_OP_ISIN #define IP6T_PHYSDEV_OP_ISOUT XT_PHYSDEV_OP_ISOUT #define IP6T_PHYSDEV_OP_MASK XT_PHYSDEV_OP_MASK #define ip6t_physdev_info xt_physdev_info #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv6/ip6t_length.h0000644000015700001700000000144212200324306030011 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IP6T_LENGTH_H #define _IP6T_LENGTH_H #include #define ip6t_length_info xt_length_info #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv6/ip6t_ipv6header.h0000644000015700001700000000174212200324306030570 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __IPV6HEADER_H #define __IPV6HEADER_H struct ip6t_ipv6header_info { u_int8_t matchflags; u_int8_t invflags; u_int8_t modeflag; }; #define MASK_HOPOPTS 128 #define MASK_DSTOPTS 64 #define MASK_ROUTING 32 #define MASK_FRAGMENT 16 #define MASK_AH 8 #define MASK_ESP 4 #define MASK_NONE 2 #define MASK_PROTO 1 #endif android-audiosystem-1.8+13.10.20130807/include/linux/msm_kgsl.h0000644000015700001700000001254312200324306024446 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _MSM_KGSL_H #define _MSM_KGSL_H #define KGSL_CONTEXT_SAVE_GMEM 1 #define KGSL_CONTEXT_NO_GMEM_ALLOC 2 #define KGSL_FLAGS_NORMALMODE 0x00000000 #define KGSL_FLAGS_SAFEMODE 0x00000001 #define KGSL_FLAGS_INITIALIZED0 0x00000002 #define KGSL_FLAGS_INITIALIZED 0x00000004 #define KGSL_FLAGS_STARTED 0x00000008 #define KGSL_FLAGS_ACTIVE 0x00000010 #define KGSL_FLAGS_RESERVED0 0x00000020 #define KGSL_FLAGS_RESERVED1 0x00000040 #define KGSL_FLAGS_RESERVED2 0x00000080 enum kgsl_deviceid { KGSL_DEVICE_ANY = 0x00000000, KGSL_DEVICE_YAMATO = 0x00000001, KGSL_DEVICE_G12 = 0x00000002, KGSL_DEVICE_MAX = 0x00000002 }; struct kgsl_devinfo { unsigned int device_id; unsigned int chip_id; unsigned int mmu_enabled; unsigned int gmem_gpubaseaddr; unsigned int gmem_hostbaseaddr; unsigned int gmem_sizebytes; }; struct kgsl_devmemstore { volatile unsigned int soptimestamp; unsigned int sbz; volatile unsigned int eoptimestamp; unsigned int sbz2; volatile unsigned int ts_cmp_enable; unsigned int sbz3; volatile unsigned int ref_wait_ts; unsigned int sbz4; }; #define KGSL_DEVICE_MEMSTORE_OFFSET(field) offsetof(struct kgsl_devmemstore, field) enum kgsl_timestamp_type { KGSL_TIMESTAMP_CONSUMED = 0x00000001, KGSL_TIMESTAMP_RETIRED = 0x00000002, KGSL_TIMESTAMP_MAX = 0x00000002, }; enum kgsl_property_type { KGSL_PROP_DEVICE_INFO = 0x00000001, KGSL_PROP_DEVICE_SHADOW = 0x00000002, KGSL_PROP_DEVICE_POWER = 0x00000003, KGSL_PROP_SHMEM = 0x00000004, KGSL_PROP_SHMEM_APERTURES = 0x00000005, KGSL_PROP_MMU_ENABLE = 0x00000006, KGSL_PROP_INTERRUPT_WAITS = 0x00000007, }; struct kgsl_shadowprop { unsigned int gpuaddr; unsigned int size; unsigned int flags; }; #define KGSL_IOC_TYPE 0x09 struct kgsl_device_getproperty { unsigned int type; void *value; unsigned int sizebytes; }; #define IOCTL_KGSL_DEVICE_GETPROPERTY _IOWR(KGSL_IOC_TYPE, 0x2, struct kgsl_device_getproperty) struct kgsl_device_regread { unsigned int offsetwords; unsigned int value; }; #define IOCTL_KGSL_DEVICE_REGREAD _IOWR(KGSL_IOC_TYPE, 0x3, struct kgsl_device_regread) struct kgsl_device_waittimestamp { unsigned int timestamp; unsigned int timeout; }; #define IOCTL_KGSL_DEVICE_WAITTIMESTAMP _IOW(KGSL_IOC_TYPE, 0x6, struct kgsl_device_waittimestamp) struct kgsl_ringbuffer_issueibcmds { unsigned int drawctxt_id; unsigned int ibaddr; unsigned int sizedwords; unsigned int timestamp; unsigned int flags; }; #define IOCTL_KGSL_RINGBUFFER_ISSUEIBCMDS _IOWR(KGSL_IOC_TYPE, 0x10, struct kgsl_ringbuffer_issueibcmds) struct kgsl_cmdstream_readtimestamp { unsigned int type; unsigned int timestamp; }; #define IOCTL_KGSL_CMDSTREAM_READTIMESTAMP _IOR(KGSL_IOC_TYPE, 0x11, struct kgsl_cmdstream_readtimestamp) struct kgsl_cmdstream_freememontimestamp { unsigned int gpuaddr; unsigned int type; unsigned int timestamp; }; #define IOCTL_KGSL_CMDSTREAM_FREEMEMONTIMESTAMP _IOR(KGSL_IOC_TYPE, 0x12, struct kgsl_cmdstream_freememontimestamp) struct kgsl_drawctxt_create { unsigned int flags; unsigned int drawctxt_id; }; #define IOCTL_KGSL_DRAWCTXT_CREATE _IOWR(KGSL_IOC_TYPE, 0x13, struct kgsl_drawctxt_create) struct kgsl_drawctxt_destroy { unsigned int drawctxt_id; }; #define IOCTL_KGSL_DRAWCTXT_DESTROY _IOW(KGSL_IOC_TYPE, 0x14, struct kgsl_drawctxt_destroy) struct kgsl_sharedmem_from_pmem { int pmem_fd; unsigned int gpuaddr; unsigned int len; unsigned int offset; }; #define IOCTL_KGSL_SHAREDMEM_FROM_PMEM _IOWR(KGSL_IOC_TYPE, 0x20, struct kgsl_sharedmem_from_pmem) struct kgsl_sharedmem_free { unsigned int gpuaddr; }; #define IOCTL_KGSL_SHAREDMEM_FREE _IOW(KGSL_IOC_TYPE, 0x21, struct kgsl_sharedmem_free) struct kgsl_gmem_desc { unsigned int x; unsigned int y; unsigned int width; unsigned int height; unsigned int pitch; }; struct kgsl_buffer_desc { void *hostptr; unsigned int gpuaddr; int size; unsigned int format; unsigned int pitch; unsigned int enabled; }; struct kgsl_bind_gmem_shadow { unsigned int drawctxt_id; struct kgsl_gmem_desc gmem_desc; unsigned int shadow_x; unsigned int shadow_y; struct kgsl_buffer_desc shadow_buffer; unsigned int buffer_id; }; #define IOCTL_KGSL_DRAWCTXT_BIND_GMEM_SHADOW _IOW(KGSL_IOC_TYPE, 0x22, struct kgsl_bind_gmem_shadow) struct kgsl_sharedmem_from_vmalloc { unsigned int gpuaddr; unsigned int hostptr; int force_no_low_watermark; }; #define IOCTL_KGSL_SHAREDMEM_FROM_VMALLOC _IOWR(KGSL_IOC_TYPE, 0x23, struct kgsl_sharedmem_from_vmalloc) #define IOCTL_KGSL_SHAREDMEM_FLUSH_CACHE _IOW(KGSL_IOC_TYPE, 0x24, struct kgsl_sharedmem_free) struct kgsl_drawctxt_set_bin_base_offset { unsigned int drawctxt_id; unsigned int offset; }; #define IOCTL_KGSL_DRAWCTXT_SET_BIN_BASE_OFFSET _IOW(KGSL_IOC_TYPE, 0x25, struct kgsl_drawctxt_set_bin_base_offset) #endif android-audiosystem-1.8+13.10.20130807/include/linux/stringify.h0000644000015700001700000000144012200324306024642 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_STRINGIFY_H #define __LINUX_STRINGIFY_H #define __stringify_1(x) #x #define __stringify(x) __stringify_1(x) #endif android-audiosystem-1.8+13.10.20130807/include/linux/ext3_fs.h0000644000015700001700000003157212200324306024210 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_EXT3_FS_H #define _LINUX_EXT3_FS_H #include #undef EXT3FS_DEBUG #define EXT3_DEFAULT_RESERVE_BLOCKS 8 #define EXT3_MAX_RESERVE_BLOCKS 1027 #define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0 #define CONFIG_EXT3_INDEX #ifdef EXT3FS_DEBUG #define ext3_debug(f, a...) do { printk (KERN_DEBUG "EXT3-fs DEBUG (%s, %d): %s:", __FILE__, __LINE__, __FUNCTION__); printk (KERN_DEBUG f, ## a); } while (0) #else #define ext3_debug(f, a...) do {} while (0) #endif #define EXT3_BAD_INO 1 #define EXT3_ROOT_INO 2 #define EXT3_BOOT_LOADER_INO 5 #define EXT3_UNDEL_DIR_INO 6 #define EXT3_RESIZE_INO 7 #define EXT3_JOURNAL_INO 8 #define EXT3_GOOD_OLD_FIRST_INO 11 #define EXT3_SUPER_MAGIC 0xEF53 #define EXT3_LINK_MAX 32000 #define EXT3_MIN_BLOCK_SIZE 1024 #define EXT3_MAX_BLOCK_SIZE 4096 #define EXT3_MIN_BLOCK_LOG_SIZE 10 #define EXT3_BLOCK_SIZE(s) (EXT3_MIN_BLOCK_SIZE << (s)->s_log_block_size) #define EXT3_ADDR_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (__u32)) #define EXT3_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) #define EXT3_INODE_SIZE(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? EXT3_GOOD_OLD_INODE_SIZE : (s)->s_inode_size) #define EXT3_FIRST_INO(s) (((s)->s_rev_level == EXT3_GOOD_OLD_REV) ? EXT3_GOOD_OLD_FIRST_INO : (s)->s_first_ino) #define EXT3_MIN_FRAG_SIZE 1024 #define EXT3_MAX_FRAG_SIZE 4096 #define EXT3_MIN_FRAG_LOG_SIZE 10 #define EXT3_FRAG_SIZE(s) (EXT3_MIN_FRAG_SIZE << (s)->s_log_frag_size) #define EXT3_FRAGS_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / EXT3_FRAG_SIZE(s)) struct ext3_group_desc { __le32 bg_block_bitmap; __le32 bg_inode_bitmap; __le32 bg_inode_table; __le16 bg_free_blocks_count; __le16 bg_free_inodes_count; __le16 bg_used_dirs_count; __u16 bg_pad; __le32 bg_reserved[3]; }; #define EXT3_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group) #define EXT3_DESC_PER_BLOCK(s) (EXT3_BLOCK_SIZE(s) / sizeof (struct ext3_group_desc)) #define EXT3_INODES_PER_GROUP(s) ((s)->s_inodes_per_group) #define EXT3_NDIR_BLOCKS 12 #define EXT3_IND_BLOCK EXT3_NDIR_BLOCKS #define EXT3_DIND_BLOCK (EXT3_IND_BLOCK + 1) #define EXT3_TIND_BLOCK (EXT3_DIND_BLOCK + 1) #define EXT3_N_BLOCKS (EXT3_TIND_BLOCK + 1) #define EXT3_SECRM_FL 0x00000001 #define EXT3_UNRM_FL 0x00000002 #define EXT3_COMPR_FL 0x00000004 #define EXT3_SYNC_FL 0x00000008 #define EXT3_IMMUTABLE_FL 0x00000010 #define EXT3_APPEND_FL 0x00000020 #define EXT3_NODUMP_FL 0x00000040 #define EXT3_NOATIME_FL 0x00000080 #define EXT3_DIRTY_FL 0x00000100 #define EXT3_COMPRBLK_FL 0x00000200 #define EXT3_NOCOMPR_FL 0x00000400 #define EXT3_ECOMPR_FL 0x00000800 #define EXT3_INDEX_FL 0x00001000 #define EXT3_IMAGIC_FL 0x00002000 #define EXT3_JOURNAL_DATA_FL 0x00004000 #define EXT3_NOTAIL_FL 0x00008000 #define EXT3_DIRSYNC_FL 0x00010000 #define EXT3_TOPDIR_FL 0x00020000 #define EXT3_RESERVED_FL 0x80000000 #define EXT3_FL_USER_VISIBLE 0x0003DFFF #define EXT3_FL_USER_MODIFIABLE 0x000380FF #define EXT3_STATE_JDATA 0x00000001 #define EXT3_STATE_NEW 0x00000002 #define EXT3_STATE_XATTR 0x00000004 struct ext3_new_group_input { __u32 group; __u32 block_bitmap; __u32 inode_bitmap; __u32 inode_table; __u32 blocks_count; __u16 reserved_blocks; __u16 unused; }; struct ext3_new_group_data { __u32 group; __u32 block_bitmap; __u32 inode_bitmap; __u32 inode_table; __u32 blocks_count; __u16 reserved_blocks; __u16 unused; __u32 free_blocks_count; }; #define EXT3_IOC_GETFLAGS _IOR('f', 1, long) #define EXT3_IOC_SETFLAGS _IOW('f', 2, long) #define EXT3_IOC_GETVERSION _IOR('f', 3, long) #define EXT3_IOC_SETVERSION _IOW('f', 4, long) #define EXT3_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long) #define EXT3_IOC_GROUP_ADD _IOW('f', 8,struct ext3_new_group_input) #define EXT3_IOC_GETVERSION_OLD _IOR('v', 1, long) #define EXT3_IOC_SETVERSION_OLD _IOW('v', 2, long) #define EXT3_IOC_GETRSVSZ _IOR('f', 5, long) #define EXT3_IOC_SETRSVSZ _IOW('f', 6, long) struct ext3_mount_options { unsigned long s_mount_opt; uid_t s_resuid; gid_t s_resgid; unsigned long s_commit_interval; }; struct ext3_inode { __le16 i_mode; __le16 i_uid; __le32 i_size; __le32 i_atime; __le32 i_ctime; __le32 i_mtime; __le32 i_dtime; __le16 i_gid; __le16 i_links_count; __le32 i_blocks; __le32 i_flags; union { struct { __u32 l_i_reserved1; } linux1; struct { __u32 h_i_translator; } hurd1; struct { __u32 m_i_reserved1; } masix1; } osd1; __le32 i_block[EXT3_N_BLOCKS]; __le32 i_generation; __le32 i_file_acl; __le32 i_dir_acl; __le32 i_faddr; union { struct { __u8 l_i_frag; __u8 l_i_fsize; __u16 i_pad1; __le16 l_i_uid_high; __le16 l_i_gid_high; __u32 l_i_reserved2; } linux2; struct { __u8 h_i_frag; __u8 h_i_fsize; __u16 h_i_mode_high; __u16 h_i_uid_high; __u16 h_i_gid_high; __u32 h_i_author; } hurd2; struct { __u8 m_i_frag; __u8 m_i_fsize; __u16 m_pad1; __u32 m_i_reserved2[2]; } masix2; } osd2; __le16 i_extra_isize; __le16 i_pad1; }; #define i_size_high i_dir_acl #ifdef __linux__ #define i_reserved1 osd1.linux1.l_i_reserved1 #define i_frag osd2.linux2.l_i_frag #define i_fsize osd2.linux2.l_i_fsize #define i_uid_low i_uid #define i_gid_low i_gid #define i_uid_high osd2.linux2.l_i_uid_high #define i_gid_high osd2.linux2.l_i_gid_high #define i_reserved2 osd2.linux2.l_i_reserved2 #elif defined(__GNU__) #define i_translator osd1.hurd1.h_i_translator #define i_frag osd2.hurd2.h_i_frag; #define i_fsize osd2.hurd2.h_i_fsize; #define i_uid_high osd2.hurd2.h_i_uid_high #define i_gid_high osd2.hurd2.h_i_gid_high #define i_author osd2.hurd2.h_i_author #elif defined(__masix__) #define i_reserved1 osd1.masix1.m_i_reserved1 #define i_frag osd2.masix2.m_i_frag #define i_fsize osd2.masix2.m_i_fsize #define i_reserved2 osd2.masix2.m_i_reserved2 #endif #define EXT3_VALID_FS 0x0001 #define EXT3_ERROR_FS 0x0002 #define EXT3_ORPHAN_FS 0x0004 #define EXT3_MOUNT_CHECK 0x00001 #define EXT3_MOUNT_OLDALLOC 0x00002 #define EXT3_MOUNT_GRPID 0x00004 #define EXT3_MOUNT_DEBUG 0x00008 #define EXT3_MOUNT_ERRORS_CONT 0x00010 #define EXT3_MOUNT_ERRORS_RO 0x00020 #define EXT3_MOUNT_ERRORS_PANIC 0x00040 #define EXT3_MOUNT_MINIX_DF 0x00080 #define EXT3_MOUNT_NOLOAD 0x00100 #define EXT3_MOUNT_ABORT 0x00200 #define EXT3_MOUNT_DATA_FLAGS 0x00C00 #define EXT3_MOUNT_JOURNAL_DATA 0x00400 #define EXT3_MOUNT_ORDERED_DATA 0x00800 #define EXT3_MOUNT_WRITEBACK_DATA 0x00C00 #define EXT3_MOUNT_UPDATE_JOURNAL 0x01000 #define EXT3_MOUNT_NO_UID32 0x02000 #define EXT3_MOUNT_XATTR_USER 0x04000 #define EXT3_MOUNT_POSIX_ACL 0x08000 #define EXT3_MOUNT_RESERVATION 0x10000 #define EXT3_MOUNT_BARRIER 0x20000 #define EXT3_MOUNT_NOBH 0x40000 #define EXT3_MOUNT_QUOTA 0x80000 #define EXT3_MOUNT_USRQUOTA 0x100000 #define EXT3_MOUNT_GRPQUOTA 0x200000 #ifndef _LINUX_EXT2_FS_H #define clear_opt(o, opt) o &= ~EXT3_MOUNT_##opt #define set_opt(o, opt) o |= EXT3_MOUNT_##opt #define test_opt(sb, opt) (EXT3_SB(sb)->s_mount_opt & EXT3_MOUNT_##opt) #else #define EXT2_MOUNT_NOLOAD EXT3_MOUNT_NOLOAD #define EXT2_MOUNT_ABORT EXT3_MOUNT_ABORT #define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS #endif #define ext3_set_bit ext2_set_bit #define ext3_set_bit_atomic ext2_set_bit_atomic #define ext3_clear_bit ext2_clear_bit #define ext3_clear_bit_atomic ext2_clear_bit_atomic #define ext3_test_bit ext2_test_bit #define ext3_find_first_zero_bit ext2_find_first_zero_bit #define ext3_find_next_zero_bit ext2_find_next_zero_bit #define EXT3_DFL_MAX_MNT_COUNT 20 #define EXT3_DFL_CHECKINTERVAL 0 #define EXT3_ERRORS_CONTINUE 1 #define EXT3_ERRORS_RO 2 #define EXT3_ERRORS_PANIC 3 #define EXT3_ERRORS_DEFAULT EXT3_ERRORS_CONTINUE struct ext3_super_block { __le32 s_inodes_count; __le32 s_blocks_count; __le32 s_r_blocks_count; __le32 s_free_blocks_count; __le32 s_free_inodes_count; __le32 s_first_data_block; __le32 s_log_block_size; __le32 s_log_frag_size; __le32 s_blocks_per_group; __le32 s_frags_per_group; __le32 s_inodes_per_group; __le32 s_mtime; __le32 s_wtime; __le16 s_mnt_count; __le16 s_max_mnt_count; __le16 s_magic; __le16 s_state; __le16 s_errors; __le16 s_minor_rev_level; __le32 s_lastcheck; __le32 s_checkinterval; __le32 s_creator_os; __le32 s_rev_level; __le16 s_def_resuid; __le16 s_def_resgid; __le32 s_first_ino; __le16 s_inode_size; __le16 s_block_group_nr; __le32 s_feature_compat; __le32 s_feature_incompat; __le32 s_feature_ro_compat; __u8 s_uuid[16]; char s_volume_name[16]; char s_last_mounted[64]; __le32 s_algorithm_usage_bitmap; __u8 s_prealloc_blocks; __u8 s_prealloc_dir_blocks; __u16 s_reserved_gdt_blocks; __u8 s_journal_uuid[16]; __le32 s_journal_inum; __le32 s_journal_dev; __le32 s_last_orphan; __le32 s_hash_seed[4]; __u8 s_def_hash_version; __u8 s_reserved_char_pad; __u16 s_reserved_word_pad; __le32 s_default_mount_opts; __le32 s_first_meta_bg; __u32 s_reserved[190]; }; #define EXT3_SB(sb) (sb) #define NEXT_ORPHAN(inode) EXT3_I(inode)->i_dtime #define EXT3_OS_LINUX 0 #define EXT3_OS_HURD 1 #define EXT3_OS_MASIX 2 #define EXT3_OS_FREEBSD 3 #define EXT3_OS_LITES 4 #define EXT3_GOOD_OLD_REV 0 #define EXT3_DYNAMIC_REV 1 #define EXT3_CURRENT_REV EXT3_GOOD_OLD_REV #define EXT3_MAX_SUPP_REV EXT3_DYNAMIC_REV #define EXT3_GOOD_OLD_INODE_SIZE 128 #define EXT3_HAS_COMPAT_FEATURE(sb,mask) ( EXT3_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) ) #define EXT3_HAS_RO_COMPAT_FEATURE(sb,mask) ( EXT3_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) ) #define EXT3_HAS_INCOMPAT_FEATURE(sb,mask) ( EXT3_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) ) #define EXT3_SET_COMPAT_FEATURE(sb,mask) EXT3_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask) #define EXT3_SET_RO_COMPAT_FEATURE(sb,mask) EXT3_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask) #define EXT3_SET_INCOMPAT_FEATURE(sb,mask) EXT3_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask) #define EXT3_CLEAR_COMPAT_FEATURE(sb,mask) EXT3_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask) #define EXT3_CLEAR_RO_COMPAT_FEATURE(sb,mask) EXT3_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask) #define EXT3_CLEAR_INCOMPAT_FEATURE(sb,mask) EXT3_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask) #define EXT3_FEATURE_COMPAT_DIR_PREALLOC 0x0001 #define EXT3_FEATURE_COMPAT_IMAGIC_INODES 0x0002 #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 #define EXT3_FEATURE_COMPAT_EXT_ATTR 0x0008 #define EXT3_FEATURE_COMPAT_RESIZE_INODE 0x0010 #define EXT3_FEATURE_COMPAT_DIR_INDEX 0x0020 #define EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 #define EXT3_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 #define EXT3_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 #define EXT3_FEATURE_INCOMPAT_COMPRESSION 0x0001 #define EXT3_FEATURE_INCOMPAT_FILETYPE 0x0002 #define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 #define EXT3_FEATURE_INCOMPAT_META_BG 0x0010 #define EXT3_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR #define EXT3_FEATURE_INCOMPAT_SUPP (EXT3_FEATURE_INCOMPAT_FILETYPE| EXT3_FEATURE_INCOMPAT_RECOVER| EXT3_FEATURE_INCOMPAT_META_BG) #define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| EXT3_FEATURE_RO_COMPAT_LARGE_FILE| EXT3_FEATURE_RO_COMPAT_BTREE_DIR) #define EXT3_DEF_RESUID 0 #define EXT3_DEF_RESGID 0 #define EXT3_DEFM_DEBUG 0x0001 #define EXT3_DEFM_BSDGROUPS 0x0002 #define EXT3_DEFM_XATTR_USER 0x0004 #define EXT3_DEFM_ACL 0x0008 #define EXT3_DEFM_UID16 0x0010 #define EXT3_DEFM_JMODE 0x0060 #define EXT3_DEFM_JMODE_DATA 0x0020 #define EXT3_DEFM_JMODE_ORDERED 0x0040 #define EXT3_DEFM_JMODE_WBACK 0x0060 #define EXT3_NAME_LEN 255 struct ext3_dir_entry { __le32 inode; __le16 rec_len; __le16 name_len; char name[EXT3_NAME_LEN]; }; struct ext3_dir_entry_2 { __le32 inode; __le16 rec_len; __u8 name_len; __u8 file_type; char name[EXT3_NAME_LEN]; }; #define EXT3_FT_UNKNOWN 0 #define EXT3_FT_REG_FILE 1 #define EXT3_FT_DIR 2 #define EXT3_FT_CHRDEV 3 #define EXT3_FT_BLKDEV 4 #define EXT3_FT_FIFO 5 #define EXT3_FT_SOCK 6 #define EXT3_FT_SYMLINK 7 #define EXT3_FT_MAX 8 #define EXT3_DIR_PAD 4 #define EXT3_DIR_ROUND (EXT3_DIR_PAD - 1) #define EXT3_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT3_DIR_ROUND) & ~EXT3_DIR_ROUND) #define is_dx(dir) 0 #define EXT3_DIR_LINK_MAX(dir) ((dir)->i_nlink >= EXT3_LINK_MAX) #define EXT3_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2) #define DX_HASH_LEGACY 0 #define DX_HASH_HALF_MD4 1 #define DX_HASH_TEA 2 #endif android-audiosystem-1.8+13.10.20130807/include/linux/mempolicy.h0000644000015700001700000000206412200324306024625 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_MEMPOLICY_H #define _LINUX_MEMPOLICY_H 1 #include #define MPOL_DEFAULT 0 #define MPOL_PREFERRED 1 #define MPOL_BIND 2 #define MPOL_INTERLEAVE 3 #define MPOL_MAX MPOL_INTERLEAVE #define MPOL_F_NODE (1<<0) #define MPOL_F_ADDR (1<<1) #define MPOL_MF_STRICT (1<<0) #define MPOL_MF_MOVE (1<<1) #define MPOL_MF_MOVE_ALL (1<<2) #define MPOL_MF_INTERNAL (1<<3) #endif android-audiosystem-1.8+13.10.20130807/include/linux/fb.h0000644000015700001700000003445612200324306023230 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** *** To edit the content of this header, modify the corresponding *** source file (e.g. under external/kernel-headers/original/) then *** run bionic/libc/kernel/tools/update_all.py *** *** Any manual change here will be lost the next time this script will *** be run. You've been warned! *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_FB_H #define _LINUX_FB_H #include #include /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_MAX 32 #define FBIOGET_VSCREENINFO 0x4600 #define FBIOPUT_VSCREENINFO 0x4601 #define FBIOGET_FSCREENINFO 0x4602 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FBIOGETCMAP 0x4604 #define FBIOPUTCMAP 0x4605 #define FBIOPAN_DISPLAY 0x4606 #define FBIO_CURSOR _IOWR('F', 0x08, struct fb_cursor) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FBIOGET_CON2FBMAP 0x460F #define FBIOPUT_CON2FBMAP 0x4610 #define FBIOBLANK 0x4611 #define FBIOGET_VBLANK _IOR('F', 0x12, struct fb_vblank) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FBIO_ALLOC 0x4613 #define FBIO_FREE 0x4614 #define FBIOGET_GLYPH 0x4615 #define FBIOGET_HWCINFO 0x4616 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FBIOPUT_MODEINFO 0x4617 #define FBIOGET_DISPINFO 0x4618 #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) #define FB_TYPE_PACKED_PIXELS 0 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_TYPE_PLANES 1 #define FB_TYPE_INTERLEAVED_PLANES 2 #define FB_TYPE_TEXT 3 #define FB_TYPE_VGA_PLANES 4 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_AUX_TEXT_MDA 0 #define FB_AUX_TEXT_CGA 1 #define FB_AUX_TEXT_S3_MMIO 2 #define FB_AUX_TEXT_MGA_STEP16 3 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_AUX_TEXT_MGA_STEP8 4 #define FB_AUX_TEXT_SVGA_GROUP 8 #define FB_AUX_TEXT_SVGA_MASK 7 #define FB_AUX_TEXT_SVGA_STEP2 8 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_AUX_TEXT_SVGA_STEP4 9 #define FB_AUX_TEXT_SVGA_STEP8 10 #define FB_AUX_TEXT_SVGA_STEP16 11 #define FB_AUX_TEXT_SVGA_LAST 15 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_AUX_VGA_PLANES_VGA4 0 #define FB_AUX_VGA_PLANES_CFB4 1 #define FB_AUX_VGA_PLANES_CFB8 2 #define FB_VISUAL_MONO01 0 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_VISUAL_MONO10 1 #define FB_VISUAL_TRUECOLOR 2 #define FB_VISUAL_PSEUDOCOLOR 3 #define FB_VISUAL_DIRECTCOLOR 4 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_VISUAL_STATIC_PSEUDOCOLOR 5 #define FB_ACCEL_NONE 0 #define FB_ACCEL_ATARIBLITT 1 #define FB_ACCEL_AMIGABLITT 2 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_S3_TRIO64 3 #define FB_ACCEL_NCR_77C32BLT 4 #define FB_ACCEL_S3_VIRGE 5 #define FB_ACCEL_ATI_MACH64GX 6 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_DEC_TGA 7 #define FB_ACCEL_ATI_MACH64CT 8 #define FB_ACCEL_ATI_MACH64VT 9 #define FB_ACCEL_ATI_MACH64GT 10 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_SUN_CREATOR 11 #define FB_ACCEL_SUN_CGSIX 12 #define FB_ACCEL_SUN_LEO 13 #define FB_ACCEL_IMS_TWINTURBO 14 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_3DLABS_PERMEDIA2 15 #define FB_ACCEL_MATROX_MGA2064W 16 #define FB_ACCEL_MATROX_MGA1064SG 17 #define FB_ACCEL_MATROX_MGA2164W 18 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_MATROX_MGA2164W_AGP 19 #define FB_ACCEL_MATROX_MGAG100 20 #define FB_ACCEL_MATROX_MGAG200 21 #define FB_ACCEL_SUN_CG14 22 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_SUN_BWTWO 23 #define FB_ACCEL_SUN_CGTHREE 24 #define FB_ACCEL_SUN_TCX 25 #define FB_ACCEL_MATROX_MGAG400 26 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_NV3 27 #define FB_ACCEL_NV4 28 #define FB_ACCEL_NV5 29 #define FB_ACCEL_CT_6555x 30 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_3DFX_BANSHEE 31 #define FB_ACCEL_ATI_RAGE128 32 #define FB_ACCEL_IGS_CYBER2000 33 #define FB_ACCEL_IGS_CYBER2010 34 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_IGS_CYBER5000 35 #define FB_ACCEL_SIS_GLAMOUR 36 #define FB_ACCEL_3DLABS_PERMEDIA3 37 #define FB_ACCEL_ATI_RADEON 38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_I810 39 #define FB_ACCEL_SIS_GLAMOUR_2 40 #define FB_ACCEL_SIS_XABRE 41 #define FB_ACCEL_I830 42 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_NV_10 43 #define FB_ACCEL_NV_20 44 #define FB_ACCEL_NV_30 45 #define FB_ACCEL_NV_40 46 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_XGI_VOLARI_V 47 #define FB_ACCEL_XGI_VOLARI_Z 48 #define FB_ACCEL_OMAP1610 49 #define FB_ACCEL_TRIDENT_TGUI 50 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_TRIDENT_3DIMAGE 51 #define FB_ACCEL_TRIDENT_BLADE3D 52 #define FB_ACCEL_TRIDENT_BLADEXP 53 #define FB_ACCEL_CIRRUS_ALPINE 53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_NEOMAGIC_NM2070 90 #define FB_ACCEL_NEOMAGIC_NM2090 91 #define FB_ACCEL_NEOMAGIC_NM2093 92 #define FB_ACCEL_NEOMAGIC_NM2097 93 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_NEOMAGIC_NM2160 94 #define FB_ACCEL_NEOMAGIC_NM2200 95 #define FB_ACCEL_NEOMAGIC_NM2230 96 #define FB_ACCEL_NEOMAGIC_NM2360 97 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_NEOMAGIC_NM2380 98 #define FB_ACCEL_PXA3XX 99 #define FB_ACCEL_SAVAGE4 0x80 #define FB_ACCEL_SAVAGE3D 0x81 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_SAVAGE3D_MV 0x82 #define FB_ACCEL_SAVAGE2000 0x83 #define FB_ACCEL_SAVAGE_MX_MV 0x84 #define FB_ACCEL_SAVAGE_MX 0x85 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_SAVAGE_IX_MV 0x86 #define FB_ACCEL_SAVAGE_IX 0x87 #define FB_ACCEL_PROSAVAGE_PM 0x88 #define FB_ACCEL_PROSAVAGE_KM 0x89 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_S3TWISTER_P 0x8a #define FB_ACCEL_S3TWISTER_K 0x8b #define FB_ACCEL_SUPERSAVAGE 0x8c #define FB_ACCEL_PROSAVAGE_DDR 0x8d /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACCEL_PROSAVAGE_DDRK 0x8e #define FB_ACCEL_PUV3_UNIGFX 0xa0 struct fb_fix_screeninfo { char id[16]; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ unsigned long smem_start; __u32 smem_len; __u32 type; __u32 type_aux; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 visual; __u16 xpanstep; __u16 ypanstep; __u16 ywrapstep; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 line_length; unsigned long mmio_start; __u32 mmio_len; __u32 accel; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u16 reserved[3]; }; struct fb_bitfield { __u32 offset; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 length; __u32 msb_right; }; #define FB_NONSTD_HAM 1 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_NONSTD_REV_PIX_IN_B 2 #define FB_ACTIVATE_NOW 0 #define FB_ACTIVATE_NXTOPEN 1 #define FB_ACTIVATE_TEST 2 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACTIVATE_MASK 15 #define FB_ACTIVATE_VBL 16 #define FB_CHANGE_CMAP_VBL 32 #define FB_ACTIVATE_ALL 64 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ACTIVATE_FORCE 128 #define FB_ACTIVATE_INV_MODE 256 #define FB_ACCELF_TEXT 1 #define FB_SYNC_HOR_HIGH_ACT 1 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_SYNC_VERT_HIGH_ACT 2 #define FB_SYNC_EXT 4 #define FB_SYNC_COMP_HIGH_ACT 8 #define FB_SYNC_BROADCAST 16 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_SYNC_ON_GREEN 32 #define FB_VMODE_NONINTERLACED 0 #define FB_VMODE_INTERLACED 1 #define FB_VMODE_DOUBLE 2 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_VMODE_ODD_FLD_FIRST 4 #define FB_VMODE_MASK 255 #define FB_VMODE_YWRAP 256 #define FB_VMODE_SMOOTH_XPAN 512 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_VMODE_CONUPDATE 512 #define FB_FLAG_RATIO_4_3 64 #define FB_FLAG_RATIO_16_9 128 #define FB_FLAG_PIXEL_REPEAT 256 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_ROTATE_UR 0 #define FB_ROTATE_CW 1 #define FB_ROTATE_UD 2 #define FB_ROTATE_CCW 3 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define PICOS2KHZ(a) (1000000000UL/(a)) #define KHZ2PICOS(a) (1000000000UL/(a)) struct fb_var_screeninfo { __u32 xres; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 yres; __u32 xres_virtual; __u32 yres_virtual; __u32 xoffset; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 yoffset; __u32 bits_per_pixel; __u32 grayscale; struct fb_bitfield red; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct fb_bitfield green; struct fb_bitfield blue; struct fb_bitfield transp; __u32 nonstd; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 activate; __u32 height; __u32 width; __u32 accel_flags; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 pixclock; __u32 left_margin; __u32 right_margin; __u32 upper_margin; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 lower_margin; __u32 hsync_len; __u32 vsync_len; __u32 sync; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 vmode; __u32 rotate; __u32 reserved[5]; }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct fb_cmap { __u32 start; __u32 len; __u16 *red; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u16 *green; __u16 *blue; __u16 *transp; }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct fb_con2fbmap { __u32 console; __u32 framebuffer; }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define VESA_NO_BLANKING 0 #define VESA_VSYNC_SUSPEND 1 #define VESA_HSYNC_SUSPEND 2 #define VESA_POWERDOWN 3 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ enum { FB_BLANK_UNBLANK = VESA_NO_BLANKING, FB_BLANK_NORMAL = VESA_NO_BLANKING + 1, FB_BLANK_VSYNC_SUSPEND = VESA_VSYNC_SUSPEND + 1, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ FB_BLANK_HSYNC_SUSPEND = VESA_HSYNC_SUSPEND + 1, FB_BLANK_POWERDOWN = VESA_POWERDOWN + 1 }; #define FB_VBLANK_VBLANKING 0x001 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_VBLANK_HBLANKING 0x002 #define FB_VBLANK_HAVE_VBLANK 0x004 #define FB_VBLANK_HAVE_HBLANK 0x008 #define FB_VBLANK_HAVE_COUNT 0x010 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_VBLANK_HAVE_VCOUNT 0x020 #define FB_VBLANK_HAVE_HCOUNT 0x040 #define FB_VBLANK_VSYNCING 0x080 #define FB_VBLANK_HAVE_VSYNC 0x100 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct fb_vblank { __u32 flags; __u32 count; __u32 vcount; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 hcount; __u32 reserved[4]; }; #define ROP_COPY 0 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ROP_XOR 1 struct fb_copyarea { __u32 dx; __u32 dy; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 width; __u32 height; __u32 sx; __u32 sy; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ }; struct fb_fillrect { __u32 dx; __u32 dy; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 width; __u32 height; __u32 color; __u32 rop; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ }; struct fb_image { __u32 dx; __u32 dy; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 width; __u32 height; __u32 fg_color; __u32 bg_color; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u8 depth; const char *data; struct fb_cmap cmap; }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_CUR_SETIMAGE 0x01 #define FB_CUR_SETPOS 0x02 #define FB_CUR_SETHOT 0x04 #define FB_CUR_SETCMAP 0x08 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define FB_CUR_SETSHAPE 0x10 #define FB_CUR_SETSIZE 0x20 #define FB_CUR_SETALL 0xFF struct fbcurpos { /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u16 x, y; }; struct fb_cursor { __u16 set; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u16 enable; __u16 rop; const char *mask; struct fbcurpos hot; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct fb_image image; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/compiler-gcc.h0000644000015700001700000000231012200324306025165 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #define barrier() __asm__ __volatile__("": : :"memory") #define RELOC_HIDE(ptr, off) ({ unsigned long __ptr; __asm__ ("" : "=r"(__ptr) : "0"(ptr)); (typeof(ptr)) (__ptr + (off)); }) #define inline inline __attribute__((always_inline)) #define __inline__ __inline__ __attribute__((always_inline)) #define __inline __inline __attribute__((always_inline)) #define __deprecated __attribute__((deprecated)) #define noinline __attribute__((noinline)) #define __attribute_pure__ __attribute__((pure)) #define __attribute_const__ __attribute__((__const__)) android-audiosystem-1.8+13.10.20130807/include/linux/efs_fs_i.h0000644000015700001700000000276612200324306024415 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __EFS_FS_I_H__ #define __EFS_FS_I_H__ typedef int32_t efs_block_t; typedef uint32_t efs_ino_t; #define EFS_DIRECTEXTENTS 12 typedef union extent_u { unsigned char raw[8]; struct extent_s { unsigned int ex_magic:8; unsigned int ex_bn:24; unsigned int ex_length:8; unsigned int ex_offset:24; } cooked; } efs_extent; typedef struct edevs { __be16 odev; __be32 ndev; } efs_devs; struct efs_dinode { __be16 di_mode; __be16 di_nlink; __be16 di_uid; __be16 di_gid; __be32 di_size; __be32 di_atime; __be32 di_mtime; __be32 di_ctime; __be32 di_gen; __be16 di_numextents; u_char di_version; u_char di_spare; union di_addr { efs_extent di_extents[EFS_DIRECTEXTENTS]; efs_devs di_dev; } di_u; }; struct efs_inode_info { int numextents; int lastextent; efs_extent extents[EFS_DIRECTEXTENTS]; struct inode vfs_inode; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_arp/0000755000015700001700000000000012200324404025311 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_arp/arp_tables.h0000644000015700001700000000754612200324306027613 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _ARPTABLES_H #define _ARPTABLES_H #include #include #include #define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN #define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN #define arpt_target xt_target #define arpt_table xt_table #define ARPT_DEV_ADDR_LEN_MAX 16 struct arpt_devaddr_info { char addr[ARPT_DEV_ADDR_LEN_MAX]; char mask[ARPT_DEV_ADDR_LEN_MAX]; }; struct arpt_arp { struct in_addr src, tgt; struct in_addr smsk, tmsk; u_int8_t arhln, arhln_mask; struct arpt_devaddr_info src_devaddr; struct arpt_devaddr_info tgt_devaddr; u_int16_t arpop, arpop_mask; u_int16_t arhrd, arhrd_mask; u_int16_t arpro, arpro_mask; char iniface[IFNAMSIZ], outiface[IFNAMSIZ]; unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ]; u_int8_t flags; u_int16_t invflags; }; #define arpt_entry_target xt_entry_target #define arpt_standard_target xt_standard_target #define ARPT_F_MASK 0x00 #define ARPT_INV_VIA_IN 0x0001 #define ARPT_INV_VIA_OUT 0x0002 #define ARPT_INV_SRCIP 0x0004 #define ARPT_INV_TGTIP 0x0008 #define ARPT_INV_SRCDEVADDR 0x0010 #define ARPT_INV_TGTDEVADDR 0x0020 #define ARPT_INV_ARPOP 0x0040 #define ARPT_INV_ARPHRD 0x0080 #define ARPT_INV_ARPPRO 0x0100 #define ARPT_INV_ARPHLN 0x0200 #define ARPT_INV_MASK 0x03FF struct arpt_entry { struct arpt_arp arp; u_int16_t target_offset; u_int16_t next_offset; unsigned int comefrom; struct xt_counters counters; unsigned char elems[0]; }; #define ARPT_CTL_OFFSET 32 #define ARPT_BASE_CTL (XT_BASE_CTL+ARPT_CTL_OFFSET) #define ARPT_SO_SET_REPLACE (XT_SO_SET_REPLACE+ARPT_CTL_OFFSET) #define ARPT_SO_SET_ADD_COUNTERS (XT_SO_SET_ADD_COUNTERS+ARPT_CTL_OFFSET) #define ARPT_SO_SET_MAX (XT_SO_SET_MAX+ARPT_CTL_OFFSET) #define ARPT_SO_GET_INFO (XT_SO_GET_INFO+ARPT_CTL_OFFSET) #define ARPT_SO_GET_ENTRIES (XT_SO_GET_ENTRIES+ARPT_CTL_OFFSET) #define ARPT_SO_GET_REVISION_TARGET (XT_SO_GET_REVISION_TARGET+ARPT_CTL_OFFSET) #define ARPT_SO_GET_MAX (XT_SO_GET_REVISION_TARGET+ARPT_CTL_OFFSET) #define ARPT_CONTINUE XT_CONTINUE #define ARPT_RETURN XT_RETURN struct arpt_getinfo { char name[ARPT_TABLE_MAXNAMELEN]; unsigned int valid_hooks; unsigned int hook_entry[NF_ARP_NUMHOOKS]; unsigned int underflow[NF_ARP_NUMHOOKS]; unsigned int num_entries; unsigned int size; }; struct arpt_replace { char name[ARPT_TABLE_MAXNAMELEN]; unsigned int valid_hooks; unsigned int num_entries; unsigned int size; unsigned int hook_entry[NF_ARP_NUMHOOKS]; unsigned int underflow[NF_ARP_NUMHOOKS]; unsigned int num_counters; struct xt_counters __user *counters; struct arpt_entry entries[0]; }; #define arpt_counters_info xt_counters_info struct arpt_get_entries { char name[ARPT_TABLE_MAXNAMELEN]; unsigned int size; struct arpt_entry entrytable[0]; }; #define ARPT_STANDARD_TARGET XT_STANDARD_TARGET #define ARPT_ERROR_TARGET XT_ERROR_TARGET #define ARPT_ENTRY_ITERATE(entries, size, fn, args...) ({ unsigned int __i; int __ret = 0; struct arpt_entry *__entry; for (__i = 0; __i < (size); __i += __entry->next_offset) { __entry = (void *)(entries) + __i; __ret = fn(__entry , ## args); if (__ret != 0) break; } __ret; }) #endif android-audiosystem-1.8+13.10.20130807/include/linux/netlink.h0000644000015700001700000000655212200324306024301 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_NETLINK_H #define __LINUX_NETLINK_H #include #include #define NETLINK_ROUTE 0 #define NETLINK_UNUSED 1 #define NETLINK_USERSOCK 2 #define NETLINK_FIREWALL 3 #define NETLINK_INET_DIAG 4 #define NETLINK_NFLOG 5 #define NETLINK_XFRM 6 #define NETLINK_SELINUX 7 #define NETLINK_ISCSI 8 #define NETLINK_AUDIT 9 #define NETLINK_FIB_LOOKUP 10 #define NETLINK_CONNECTOR 11 #define NETLINK_NETFILTER 12 #define NETLINK_IP6_FW 13 #define NETLINK_DNRTMSG 14 #define NETLINK_KOBJECT_UEVENT 15 #define NETLINK_GENERIC 16 #define NETLINK_SCSITRANSPORT 18 #define NETLINK_ECRYPTFS 19 #define MAX_LINKS 32 struct net; struct sockaddr_nl { sa_family_t nl_family; unsigned short nl_pad; __u32 nl_pid; __u32 nl_groups; }; struct nlmsghdr { __u32 nlmsg_len; __u16 nlmsg_type; __u16 nlmsg_flags; __u32 nlmsg_seq; __u32 nlmsg_pid; }; #define NLM_F_REQUEST 1 #define NLM_F_MULTI 2 #define NLM_F_ACK 4 #define NLM_F_ECHO 8 #define NLM_F_ROOT 0x100 #define NLM_F_MATCH 0x200 #define NLM_F_ATOMIC 0x400 #define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH) #define NLM_F_REPLACE 0x100 #define NLM_F_EXCL 0x200 #define NLM_F_CREATE 0x400 #define NLM_F_APPEND 0x800 #define NLMSG_ALIGNTO 4 #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) ) #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) #define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN)) #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len)) #define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0))) #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len))) #define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && (nlh)->nlmsg_len <= (len)) #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len))) #define NLMSG_NOOP 0x1 #define NLMSG_ERROR 0x2 #define NLMSG_DONE 0x3 #define NLMSG_OVERRUN 0x4 #define NLMSG_MIN_TYPE 0x10 struct nlmsgerr { int error; struct nlmsghdr msg; }; #define NETLINK_ADD_MEMBERSHIP 1 #define NETLINK_DROP_MEMBERSHIP 2 #define NETLINK_PKTINFO 3 #define NETLINK_BROADCAST_ERROR 4 #define NETLINK_NO_ENOBUFS 5 struct nl_pktinfo { __u32 group; }; #define NET_MAJOR 36 enum { NETLINK_UNCONNECTED = 0, NETLINK_CONNECTED, }; struct nlattr { __u16 nla_len; __u16 nla_type; }; #define NLA_F_NESTED (1 << 15) #define NLA_F_NET_BYTEORDER (1 << 14) #define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER) #define NLA_ALIGNTO 4 #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1)) #define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr))) #endif android-audiosystem-1.8+13.10.20130807/include/linux/aio_abi.h0000644000015700001700000000257512200324306024221 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX__AIO_ABI_H #define __LINUX__AIO_ABI_H #include typedef unsigned long aio_context_t; enum { IOCB_CMD_PREAD = 0, IOCB_CMD_PWRITE = 1, IOCB_CMD_FSYNC = 2, IOCB_CMD_FDSYNC = 3, IOCB_CMD_NOOP = 6, }; struct io_event { __u64 data; __u64 obj; __s64 res; __s64 res2; }; #ifdef __LITTLE_ENDIAN #define PADDED(x,y) x, y #elif defined(__BIG_ENDIAN) #define PADDED(x,y) y, x #else #error edit for your odd byteorder. #endif struct iocb { __u64 aio_data; __u32 PADDED(aio_key, aio_reserved1); __u16 aio_lio_opcode; __s16 aio_reqprio; __u32 aio_fildes; __u64 aio_buf; __u64 aio_nbytes; __s64 aio_offset; __u64 aio_reserved2; __u64 aio_reserved3; }; #undef IFBIG #undef IFLITTLE #endif android-audiosystem-1.8+13.10.20130807/include/linux/interrupt.h0000644000015700001700000000665412200324306024674 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_INTERRUPT_H #define _LINUX_INTERRUPT_H #include #include #include #include #include #include #include #include #include #include #include #include #define IRQF_TRIGGER_NONE 0x00000000 #define IRQF_TRIGGER_RISING 0x00000001 #define IRQF_TRIGGER_FALLING 0x00000002 #define IRQF_TRIGGER_HIGH 0x00000004 #define IRQF_TRIGGER_LOW 0x00000008 #define IRQF_TRIGGER_MASK (IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING) #define IRQF_TRIGGER_PROBE 0x00000010 #define IRQF_DISABLED 0x00000020 #define IRQF_SAMPLE_RANDOM 0x00000040 #define IRQF_SHARED 0x00000080 #define IRQF_PROBE_SHARED 0x00000100 #define IRQF_TIMER 0x00000200 #define IRQF_PERCPU 0x00000400 #define SA_INTERRUPT IRQF_DISABLED #define SA_SAMPLE_RANDOM IRQF_SAMPLE_RANDOM #define SA_SHIRQ IRQF_SHARED #define SA_PROBEIRQ IRQF_PROBE_SHARED #define SA_PERCPU IRQF_PERCPU #define SA_TRIGGER_LOW IRQF_TRIGGER_LOW #define SA_TRIGGER_HIGH IRQF_TRIGGER_HIGH #define SA_TRIGGER_FALLING IRQF_TRIGGER_FALLING #define SA_TRIGGER_RISING IRQF_TRIGGER_RISING #define SA_TRIGGER_MASK IRQF_TRIGGER_MASK struct irqaction { irqreturn_t (*handler)(int, void *, struct pt_regs *); unsigned long flags; cpumask_t mask; const char *name; void *dev_id; struct irqaction *next; int irq; struct proc_dir_entry *dir; }; #define local_irq_enable_in_hardirq() local_irq_enable() #define disable_irq_nosync_lockdep(irq) disable_irq_nosync(irq) #define disable_irq_lockdep(irq) disable_irq(irq) #define enable_irq_lockdep(irq) enable_irq(irq) #ifndef __ARCH_SET_SOFTIRQ_PENDING #define set_softirq_pending(x) (local_softirq_pending() = (x)) #define or_softirq_pending(x) (local_softirq_pending() |= (x)) #endif #define save_flags(x) save_flags(&x) #define save_and_cli(x) save_and_cli(&x) enum { HI_SOFTIRQ=0, TIMER_SOFTIRQ, NET_TX_SOFTIRQ, NET_RX_SOFTIRQ, BLOCK_SOFTIRQ, TASKLET_SOFTIRQ }; struct softirq_action { void (*action)(struct softirq_action *); void *data; }; #define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0) struct tasklet_struct { struct tasklet_struct *next; unsigned long state; atomic_t count; void (*func)(unsigned long); unsigned long data; }; #define DECLARE_TASKLET(name, func, data) struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(0), func, data } #define DECLARE_TASKLET_DISABLED(name, func, data) struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), func, data } enum { TASKLET_STATE_SCHED, TASKLET_STATE_RUN }; #define tasklet_trylock(t) 1 #define tasklet_unlock_wait(t) do { } while (0) #define tasklet_unlock(t) do { } while (0) #endif android-audiosystem-1.8+13.10.20130807/include/linux/atmdev.h0000644000015700001700000001120512200324306024104 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef LINUX_ATMDEV_H #define LINUX_ATMDEV_H #include #include #include #define ESI_LEN 6 #define ATM_OC3_PCR (155520000/270*260/8/53) #define ATM_25_PCR ((25600000/8-8000)/54) #define ATM_OC12_PCR (622080000/1080*1040/8/53) #define ATM_DS3_PCR (8000*12) #define __AAL_STAT_ITEMS __HANDLE_ITEM(tx); __HANDLE_ITEM(tx_err); __HANDLE_ITEM(rx); __HANDLE_ITEM(rx_err); __HANDLE_ITEM(rx_drop); struct atm_aal_stats { #define __HANDLE_ITEM(i) int i __AAL_STAT_ITEMS #undef __HANDLE_ITEM }; struct atm_dev_stats { struct atm_aal_stats aal0; struct atm_aal_stats aal34; struct atm_aal_stats aal5; } __ATM_API_ALIGN; #define ATM_GETLINKRATE _IOW('a',ATMIOC_ITF+1,struct atmif_sioc) #define ATM_GETNAMES _IOW('a',ATMIOC_ITF+3,struct atm_iobuf) #define ATM_GETTYPE _IOW('a',ATMIOC_ITF+4,struct atmif_sioc) #define ATM_GETESI _IOW('a',ATMIOC_ITF+5,struct atmif_sioc) #define ATM_GETADDR _IOW('a',ATMIOC_ITF+6,struct atmif_sioc) #define ATM_RSTADDR _IOW('a',ATMIOC_ITF+7,struct atmif_sioc) #define ATM_ADDADDR _IOW('a',ATMIOC_ITF+8,struct atmif_sioc) #define ATM_DELADDR _IOW('a',ATMIOC_ITF+9,struct atmif_sioc) #define ATM_GETCIRANGE _IOW('a',ATMIOC_ITF+10,struct atmif_sioc) #define ATM_SETCIRANGE _IOW('a',ATMIOC_ITF+11,struct atmif_sioc) #define ATM_SETESI _IOW('a',ATMIOC_ITF+12,struct atmif_sioc) #define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc) #define ATM_ADDLECSADDR _IOW('a', ATMIOC_ITF+14, struct atmif_sioc) #define ATM_DELLECSADDR _IOW('a', ATMIOC_ITF+15, struct atmif_sioc) #define ATM_GETLECSADDR _IOW('a', ATMIOC_ITF+16, struct atmif_sioc) #define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc) #define ATM_GETSTATZ _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc) #define ATM_GETLOOP _IOW('a',ATMIOC_SARCOM+2,struct atmif_sioc) #define ATM_SETLOOP _IOW('a',ATMIOC_SARCOM+3,struct atmif_sioc) #define ATM_QUERYLOOP _IOW('a',ATMIOC_SARCOM+4,struct atmif_sioc) #define ATM_SETSC _IOW('a',ATMIOC_SPECIAL+1,int) #define ATM_SETBACKEND _IOW('a',ATMIOC_SPECIAL+2,atm_backend_t) #define ATM_NEWBACKENDIF _IOW('a',ATMIOC_SPECIAL+3,atm_backend_t) #define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf) #define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int) #define ATM_BACKEND_RAW 0 #define ATM_BACKEND_PPP 1 #define ATM_BACKEND_BR2684 2 #define ATM_ITFTYP_LEN 8 #define __ATM_LM_NONE 0 #define __ATM_LM_AAL 1 #define __ATM_LM_ATM 2 #define __ATM_LM_PHY 8 #define __ATM_LM_ANALOG 16 #define __ATM_LM_MKLOC(n) ((n)) #define __ATM_LM_MKRMT(n) ((n) << 8) #define __ATM_LM_XTLOC(n) ((n) & 0xff) #define __ATM_LM_XTRMT(n) (((n) >> 8) & 0xff) #define ATM_LM_NONE 0 #define ATM_LM_LOC_AAL __ATM_LM_MKLOC(__ATM_LM_AAL) #define ATM_LM_LOC_ATM __ATM_LM_MKLOC(__ATM_LM_ATM) #define ATM_LM_LOC_PHY __ATM_LM_MKLOC(__ATM_LM_PHY) #define ATM_LM_LOC_ANALOG __ATM_LM_MKLOC(__ATM_LM_ANALOG) #define ATM_LM_RMT_AAL __ATM_LM_MKRMT(__ATM_LM_AAL) #define ATM_LM_RMT_ATM __ATM_LM_MKRMT(__ATM_LM_ATM) #define ATM_LM_RMT_PHY __ATM_LM_MKRMT(__ATM_LM_PHY) #define ATM_LM_RMT_ANALOG __ATM_LM_MKRMT(__ATM_LM_ANALOG) struct atm_iobuf { int length; void __user *buffer; }; #define ATM_CI_MAX -1 struct atm_cirange { signed char vpi_bits; signed char vci_bits; }; #define ATM_SC_RX 1024 #define ATM_SC_TX 2048 #define ATM_BACKLOG_DEFAULT 32 #define ATM_MF_IMMED 1 #define ATM_MF_INC_RSV 2 #define ATM_MF_INC_SHP 4 #define ATM_MF_DEC_RSV 8 #define ATM_MF_DEC_SHP 16 #define ATM_MF_BWD 32 #define ATM_MF_SET (ATM_MF_INC_RSV | ATM_MF_INC_SHP | ATM_MF_DEC_RSV | ATM_MF_DEC_SHP | ATM_MF_BWD) #define ATM_VS_IDLE 0 #define ATM_VS_CONNECTED 1 #define ATM_VS_CLOSING 2 #define ATM_VS_LISTEN 3 #define ATM_VS_INUSE 4 #define ATM_VS_BOUND 5 #define ATM_VS2TXT_MAP "IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND" #define ATM_VF2TXT_MAP "ADDR", "READY", "PARTIAL", "REGIS", "RELEASED", "HASQOS", "LISTEN", "META", "256", "512", "1024", "2048", "SESSION", "HASSAP", "BOUND", "CLOSE" #endif android-audiosystem-1.8+13.10.20130807/include/linux/if_ppp.h0000644000015700001700000000722612200324306024111 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IF_PPP_H_ #define _IF_PPP_H_ #include #define PPP_MTU 1500 #define PPP_MAXMRU 65000 #define PROTO_IPX 0x002b #define PROTO_DNA_RT 0x0027 #define SC_COMP_PROT 0x00000001 #define SC_COMP_AC 0x00000002 #define SC_COMP_TCP 0x00000004 #define SC_NO_TCP_CCID 0x00000008 #define SC_REJ_COMP_AC 0x00000010 #define SC_REJ_COMP_TCP 0x00000020 #define SC_CCP_OPEN 0x00000040 #define SC_CCP_UP 0x00000080 #define SC_ENABLE_IP 0x00000100 #define SC_LOOP_TRAFFIC 0x00000200 #define SC_MULTILINK 0x00000400 #define SC_MP_SHORTSEQ 0x00000800 #define SC_COMP_RUN 0x00001000 #define SC_DECOMP_RUN 0x00002000 #define SC_MP_XSHORTSEQ 0x00004000 #define SC_DEBUG 0x00010000 #define SC_LOG_INPKT 0x00020000 #define SC_LOG_OUTPKT 0x00040000 #define SC_LOG_RAWIN 0x00080000 #define SC_LOG_FLUSH 0x00100000 #define SC_SYNC 0x00200000 #define SC_MUST_COMP 0x00400000 #define SC_MASK 0x0f600fff #define SC_XMIT_BUSY 0x10000000 #define SC_RCV_ODDP 0x08000000 #define SC_RCV_EVNP 0x04000000 #define SC_RCV_B7_1 0x02000000 #define SC_RCV_B7_0 0x01000000 #define SC_DC_FERROR 0x00800000 #define SC_DC_ERROR 0x00400000 struct npioctl { int protocol; enum NPmode mode; }; struct ppp_option_data { __u8 __user *ptr; __u32 length; int transmit; }; struct ifpppstatsreq { struct ifreq b; struct ppp_stats stats; }; struct ifpppcstatsreq { struct ifreq b; struct ppp_comp_stats stats; }; #define ifr__name b.ifr_ifrn.ifrn_name #define stats_ptr b.ifr_ifru.ifru_data #define PPPIOCGFLAGS _IOR('t', 90, int) #define PPPIOCSFLAGS _IOW('t', 89, int) #define PPPIOCGASYNCMAP _IOR('t', 88, int) #define PPPIOCSASYNCMAP _IOW('t', 87, int) #define PPPIOCGUNIT _IOR('t', 86, int) #define PPPIOCGRASYNCMAP _IOR('t', 85, int) #define PPPIOCSRASYNCMAP _IOW('t', 84, int) #define PPPIOCGMRU _IOR('t', 83, int) #define PPPIOCSMRU _IOW('t', 82, int) #define PPPIOCSMAXCID _IOW('t', 81, int) #define PPPIOCGXASYNCMAP _IOR('t', 80, ext_accm) #define PPPIOCSXASYNCMAP _IOW('t', 79, ext_accm) #define PPPIOCXFERUNIT _IO('t', 78) #define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data) #define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) #define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) #define PPPIOCSPASS _IOW('t', 71, struct sock_fprog) #define PPPIOCSACTIVE _IOW('t', 70, struct sock_fprog) #define PPPIOCGDEBUG _IOR('t', 65, int) #define PPPIOCSDEBUG _IOW('t', 64, int) #define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) #define PPPIOCNEWUNIT _IOWR('t', 62, int) #define PPPIOCATTACH _IOW('t', 61, int) #define PPPIOCDETACH _IOW('t', 60, int) #define PPPIOCSMRRU _IOW('t', 59, int) #define PPPIOCCONNECT _IOW('t', 58, int) #define PPPIOCDISCONN _IO('t', 57) #define PPPIOCATTCHAN _IOW('t', 56, int) #define PPPIOCGCHAN _IOR('t', 55, int) #define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0) #define SIOCGPPPVER (SIOCDEVPRIVATE + 1) #define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2) #ifndef ifr_mtu #define ifr_mtu ifr_ifru.ifru_metric #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/statfs.h0000644000015700001700000000171412200324306024134 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_STATFS_H #define _LINUX_STATFS_H #include #include struct kstatfs { long f_type; long f_bsize; u64 f_blocks; u64 f_bfree; u64 f_bavail; u64 f_files; u64 f_ffree; __kernel_fsid_t f_fsid; long f_namelen; long f_frsize; long f_spare[5]; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv6.h0000644000015700001700000000322712200324306025571 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_IP6_NETFILTER_H #define __LINUX_IP6_NETFILTER_H #include #define NFC_IP6_SRC 0x0001 #define NFC_IP6_DST 0x0002 #define NFC_IP6_IF_IN 0x0004 #define NFC_IP6_IF_OUT 0x0008 #define NFC_IP6_TOS 0x0010 #define NFC_IP6_PROTO 0x0020 #define NFC_IP6_OPTIONS 0x0040 #define NFC_IP6_FRAG 0x0080 #define NFC_IP6_TCPFLAGS 0x0100 #define NFC_IP6_SRC_PT 0x0200 #define NFC_IP6_DST_PT 0x0400 #define NFC_IP6_PROTO_UNKNOWN 0x2000 #define NF_IP6_PRE_ROUTING 0 #define NF_IP6_LOCAL_IN 1 #define NF_IP6_FORWARD 2 #define NF_IP6_LOCAL_OUT 3 #define NF_IP6_POST_ROUTING 4 #define NF_IP6_NUMHOOKS 5 enum nf_ip6_hook_priorities { NF_IP6_PRI_FIRST = INT_MIN, NF_IP6_PRI_CONNTRACK_DEFRAG = -400, NF_IP6_PRI_RAW = -300, NF_IP6_PRI_SELINUX_FIRST = -225, NF_IP6_PRI_CONNTRACK = -200, NF_IP6_PRI_MANGLE = -150, NF_IP6_PRI_NAT_DST = -100, NF_IP6_PRI_FILTER = 0, NF_IP6_PRI_SECURITY = 50, NF_IP6_PRI_NAT_SRC = 100, NF_IP6_PRI_SELINUX_LAST = 225, NF_IP6_PRI_LAST = INT_MAX, }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/calc64.h0000644000015700001700000000161312200324306023702 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_CALC64_H #define _LINUX_CALC64_H #include #include #ifndef div_long_long_rem #define div_long_long_rem(dividend, divisor, remainder) do_div_llr((dividend), divisor, remainder) #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter.h0000644000015700001700000000513512200324306024625 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** *** To edit the content of this header, modify the corresponding *** source file (e.g. under external/kernel-headers/original/) then *** run bionic/libc/kernel/tools/update_all.py *** *** Any manual change here will be lost the next time this script will *** be run. You've been warned! *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_NETFILTER_H #define __LINUX_NETFILTER_H #include #include /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define NF_DROP 0 #define NF_ACCEPT 1 #define NF_STOLEN 2 #define NF_QUEUE 3 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define NF_REPEAT 4 #define NF_STOP 5 #define NF_MAX_VERDICT NF_STOP #define NF_VERDICT_MASK 0x0000ffff /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define NF_VERDICT_BITS 16 #define NF_VERDICT_QMASK 0xffff0000 #define NF_VERDICT_QBITS 16 #define NF_QUEUE_NR(x) ((((x) << NF_VERDICT_BITS) & NF_VERDICT_QMASK) | NF_QUEUE) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define NFC_UNKNOWN 0x4000 #define NFC_ALTERED 0x8000 enum nf_inet_hooks { NF_INET_PRE_ROUTING, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ NF_INET_LOCAL_IN, NF_INET_FORWARD, NF_INET_LOCAL_OUT, NF_INET_POST_ROUTING, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ NF_INET_NUMHOOKS }; enum { NFPROTO_UNSPEC = 0, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ NFPROTO_IPV4 = 2, NFPROTO_ARP = 3, NFPROTO_BRIDGE = 7, NFPROTO_IPV6 = 10, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ NFPROTO_DECNET = 12, NFPROTO_NUMPROTO, }; union nf_inet_addr { /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 all[4]; __be32 ip; __be32 ip6[4]; struct in_addr in; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct in6_addr in6; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/errno.h0000644000015700001700000000135112200324306023752 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ERRNO_H #define _LINUX_ERRNO_H #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/transport_class.h0000644000015700001700000000353312200324306026052 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _TRANSPORT_CLASS_H_ #define _TRANSPORT_CLASS_H_ #include #include struct transport_container; struct transport_class { struct class class; int (*setup)(struct transport_container *, struct device *, struct class_device *); int (*configure)(struct transport_container *, struct device *, struct class_device *); int (*remove)(struct transport_container *, struct device *, struct class_device *); }; #define DECLARE_TRANSPORT_CLASS(cls, nm, su, rm, cfg) struct transport_class cls = { .class = { .name = nm, }, .setup = su, .remove = rm, .configure = cfg, } struct anon_transport_class { struct transport_class tclass; struct attribute_container container; }; #define DECLARE_ANON_TRANSPORT_CLASS(cls, mtch, cfg) struct anon_transport_class cls = { .tclass = { .configure = cfg, }, . container = { .match = mtch, }, } #define class_to_transport_class(x) container_of(x, struct transport_class, class) struct transport_container { struct attribute_container ac; struct attribute_group *statistics; }; #define attribute_container_to_transport_container(x) container_of(x, struct transport_container, ac) #endif android-audiosystem-1.8+13.10.20130807/include/linux/usb_ch9.h0000644000015700001700000002142312200324306024163 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_USB_CH9_H #define __LINUX_USB_CH9_H #include #define USB_DIR_OUT 0 #define USB_DIR_IN 0x80 #define USB_TYPE_MASK (0x03 << 5) #define USB_TYPE_STANDARD (0x00 << 5) #define USB_TYPE_CLASS (0x01 << 5) #define USB_TYPE_VENDOR (0x02 << 5) #define USB_TYPE_RESERVED (0x03 << 5) #define USB_RECIP_MASK 0x1f #define USB_RECIP_DEVICE 0x00 #define USB_RECIP_INTERFACE 0x01 #define USB_RECIP_ENDPOINT 0x02 #define USB_RECIP_OTHER 0x03 #define USB_RECIP_PORT 0x04 #define USB_RECIP_RPIPE 0x05 #define USB_REQ_GET_STATUS 0x00 #define USB_REQ_CLEAR_FEATURE 0x01 #define USB_REQ_SET_FEATURE 0x03 #define USB_REQ_SET_ADDRESS 0x05 #define USB_REQ_GET_DESCRIPTOR 0x06 #define USB_REQ_SET_DESCRIPTOR 0x07 #define USB_REQ_GET_CONFIGURATION 0x08 #define USB_REQ_SET_CONFIGURATION 0x09 #define USB_REQ_GET_INTERFACE 0x0A #define USB_REQ_SET_INTERFACE 0x0B #define USB_REQ_SYNCH_FRAME 0x0C #define USB_REQ_SET_ENCRYPTION 0x0D #define USB_REQ_GET_ENCRYPTION 0x0E #define USB_REQ_RPIPE_ABORT 0x0E #define USB_REQ_SET_HANDSHAKE 0x0F #define USB_REQ_RPIPE_RESET 0x0F #define USB_REQ_GET_HANDSHAKE 0x10 #define USB_REQ_SET_CONNECTION 0x11 #define USB_REQ_SET_SECURITY_DATA 0x12 #define USB_REQ_GET_SECURITY_DATA 0x13 #define USB_REQ_SET_WUSB_DATA 0x14 #define USB_REQ_LOOPBACK_DATA_WRITE 0x15 #define USB_REQ_LOOPBACK_DATA_READ 0x16 #define USB_REQ_SET_INTERFACE_DS 0x17 #define USB_DEVICE_SELF_POWERED 0 #define USB_DEVICE_REMOTE_WAKEUP 1 #define USB_DEVICE_TEST_MODE 2 #define USB_DEVICE_BATTERY 2 #define USB_DEVICE_B_HNP_ENABLE 3 #define USB_DEVICE_WUSB_DEVICE 3 #define USB_DEVICE_A_HNP_SUPPORT 4 #define USB_DEVICE_A_ALT_HNP_SUPPORT 5 #define USB_DEVICE_DEBUG_MODE 6 #define USB_ENDPOINT_HALT 0 struct usb_ctrlrequest { __u8 bRequestType; __u8 bRequest; __le16 wValue; __le16 wIndex; __le16 wLength; } __attribute__ ((packed)); #define USB_DT_DEVICE 0x01 #define USB_DT_CONFIG 0x02 #define USB_DT_STRING 0x03 #define USB_DT_INTERFACE 0x04 #define USB_DT_ENDPOINT 0x05 #define USB_DT_DEVICE_QUALIFIER 0x06 #define USB_DT_OTHER_SPEED_CONFIG 0x07 #define USB_DT_INTERFACE_POWER 0x08 #define USB_DT_OTG 0x09 #define USB_DT_DEBUG 0x0a #define USB_DT_INTERFACE_ASSOCIATION 0x0b #define USB_DT_SECURITY 0x0c #define USB_DT_KEY 0x0d #define USB_DT_ENCRYPTION_TYPE 0x0e #define USB_DT_BOS 0x0f #define USB_DT_DEVICE_CAPABILITY 0x10 #define USB_DT_WIRELESS_ENDPOINT_COMP 0x11 #define USB_DT_WIRE_ADAPTER 0x21 #define USB_DT_RPIPE 0x22 #define USB_DT_CS_DEVICE 0x21 #define USB_DT_CS_CONFIG 0x22 #define USB_DT_CS_STRING 0x23 #define USB_DT_CS_INTERFACE 0x24 #define USB_DT_CS_ENDPOINT 0x25 struct usb_descriptor_header { __u8 bLength; __u8 bDescriptorType; } __attribute__ ((packed)); struct usb_device_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 bcdUSB; __u8 bDeviceClass; __u8 bDeviceSubClass; __u8 bDeviceProtocol; __u8 bMaxPacketSize0; __le16 idVendor; __le16 idProduct; __le16 bcdDevice; __u8 iManufacturer; __u8 iProduct; __u8 iSerialNumber; __u8 bNumConfigurations; } __attribute__ ((packed)); #define USB_DT_DEVICE_SIZE 18 #define USB_CLASS_PER_INTERFACE 0 #define USB_CLASS_AUDIO 1 #define USB_CLASS_COMM 2 #define USB_CLASS_HID 3 #define USB_CLASS_PHYSICAL 5 #define USB_CLASS_STILL_IMAGE 6 #define USB_CLASS_PRINTER 7 #define USB_CLASS_MASS_STORAGE 8 #define USB_CLASS_HUB 9 #define USB_CLASS_CDC_DATA 0x0a #define USB_CLASS_CSCID 0x0b #define USB_CLASS_CONTENT_SEC 0x0d #define USB_CLASS_VIDEO 0x0e #define USB_CLASS_WIRELESS_CONTROLLER 0xe0 #define USB_CLASS_APP_SPEC 0xfe #define USB_CLASS_VENDOR_SPEC 0xff struct usb_config_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wTotalLength; __u8 bNumInterfaces; __u8 bConfigurationValue; __u8 iConfiguration; __u8 bmAttributes; __u8 bMaxPower; } __attribute__ ((packed)); #define USB_DT_CONFIG_SIZE 9 #define USB_CONFIG_ATT_ONE (1 << 7) #define USB_CONFIG_ATT_SELFPOWER (1 << 6) #define USB_CONFIG_ATT_WAKEUP (1 << 5) #define USB_CONFIG_ATT_BATTERY (1 << 4) struct usb_string_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wData[1]; } __attribute__ ((packed)); struct usb_interface_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bInterfaceNumber; __u8 bAlternateSetting; __u8 bNumEndpoints; __u8 bInterfaceClass; __u8 bInterfaceSubClass; __u8 bInterfaceProtocol; __u8 iInterface; } __attribute__ ((packed)); #define USB_DT_INTERFACE_SIZE 9 struct usb_endpoint_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bEndpointAddress; __u8 bmAttributes; __le16 wMaxPacketSize; __u8 bInterval; __u8 bRefresh; __u8 bSynchAddress; } __attribute__ ((packed)); #define USB_DT_ENDPOINT_SIZE 7 #define USB_DT_ENDPOINT_AUDIO_SIZE 9 #define USB_ENDPOINT_NUMBER_MASK 0x0f #define USB_ENDPOINT_DIR_MASK 0x80 #define USB_ENDPOINT_XFERTYPE_MASK 0x03 #define USB_ENDPOINT_XFER_CONTROL 0 #define USB_ENDPOINT_XFER_ISOC 1 #define USB_ENDPOINT_XFER_BULK 2 #define USB_ENDPOINT_XFER_INT 3 #define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 struct usb_qualifier_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 bcdUSB; __u8 bDeviceClass; __u8 bDeviceSubClass; __u8 bDeviceProtocol; __u8 bMaxPacketSize0; __u8 bNumConfigurations; __u8 bRESERVED; } __attribute__ ((packed)); struct usb_otg_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bmAttributes; } __attribute__ ((packed)); #define USB_OTG_SRP (1 << 0) #define USB_OTG_HNP (1 << 1) struct usb_debug_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDebugInEndpoint; __u8 bDebugOutEndpoint; }; struct usb_interface_assoc_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bFirstInterface; __u8 bInterfaceCount; __u8 bFunctionClass; __u8 bFunctionSubClass; __u8 bFunctionProtocol; __u8 iFunction; } __attribute__ ((packed)); struct usb_security_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wTotalLength; __u8 bNumEncryptionTypes; }; struct usb_key_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 tTKID[3]; __u8 bReserved; __u8 bKeyData[0]; }; struct usb_encryption_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bEncryptionType; #define USB_ENC_TYPE_UNSECURE 0 #define USB_ENC_TYPE_WIRED 1 #define USB_ENC_TYPE_CCM_1 2 #define USB_ENC_TYPE_RSA_1 3 __u8 bEncryptionValue; __u8 bAuthKeyIndex; }; struct usb_bos_descriptor { __u8 bLength; __u8 bDescriptorType; __le16 wTotalLength; __u8 bNumDeviceCaps; }; struct usb_dev_cap_header { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; }; #define USB_CAP_TYPE_WIRELESS_USB 1 struct usb_wireless_cap_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bDevCapabilityType; __u8 bmAttributes; #define USB_WIRELESS_P2P_DRD (1 << 1) #define USB_WIRELESS_BEACON_MASK (3 << 2) #define USB_WIRELESS_BEACON_SELF (1 << 2) #define USB_WIRELESS_BEACON_DIRECTED (2 << 2) #define USB_WIRELESS_BEACON_NONE (3 << 2) __le16 wPHYRates; #define USB_WIRELESS_PHY_53 (1 << 0) #define USB_WIRELESS_PHY_80 (1 << 1) #define USB_WIRELESS_PHY_107 (1 << 2) #define USB_WIRELESS_PHY_160 (1 << 3) #define USB_WIRELESS_PHY_200 (1 << 4) #define USB_WIRELESS_PHY_320 (1 << 5) #define USB_WIRELESS_PHY_400 (1 << 6) #define USB_WIRELESS_PHY_480 (1 << 7) __u8 bmTFITXPowerInfo; __u8 bmFFITXPowerInfo; __le16 bmBandGroup; __u8 bReserved; }; struct usb_wireless_ep_comp_descriptor { __u8 bLength; __u8 bDescriptorType; __u8 bMaxBurst; __u8 bMaxSequence; __le16 wMaxStreamDelay; __le16 wOverTheAirPacketSize; __u8 bOverTheAirInterval; __u8 bmCompAttributes; #define USB_ENDPOINT_SWITCH_MASK 0x03 #define USB_ENDPOINT_SWITCH_NO 0 #define USB_ENDPOINT_SWITCH_SWITCH 1 #define USB_ENDPOINT_SWITCH_SCALE 2 }; struct usb_handshake { __u8 bMessageNumber; __u8 bStatus; __u8 tTKID[3]; __u8 bReserved; __u8 CDID[16]; __u8 nonce[16]; __u8 MIC[8]; }; struct usb_connection_context { __u8 CHID[16]; __u8 CDID[16]; __u8 CK[16]; }; enum usb_device_speed { USB_SPEED_UNKNOWN = 0, USB_SPEED_LOW, USB_SPEED_FULL, USB_SPEED_HIGH, USB_SPEED_VARIABLE, }; enum usb_device_state { USB_STATE_NOTATTACHED = 0, USB_STATE_ATTACHED, USB_STATE_POWERED, USB_STATE_UNAUTHENTICATED, USB_STATE_RECONNECTING, USB_STATE_DEFAULT, USB_STATE_ADDRESS, USB_STATE_CONFIGURED, USB_STATE_SUSPENDED }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/filter.h0000644000015700001700000000463712200324306024124 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_FILTER_H__ #define __LINUX_FILTER_H__ #include #include #define BPF_MAJOR_VERSION 1 #define BPF_MINOR_VERSION 1 struct sock_filter { __u16 code; __u8 jt; __u8 jf; __u32 k; }; struct sock_fprog { unsigned short len; struct sock_filter __user *filter; }; #define BPF_CLASS(code) ((code) & 0x07) #define BPF_LD 0x00 #define BPF_LDX 0x01 #define BPF_ST 0x02 #define BPF_STX 0x03 #define BPF_ALU 0x04 #define BPF_JMP 0x05 #define BPF_RET 0x06 #define BPF_MISC 0x07 #define BPF_SIZE(code) ((code) & 0x18) #define BPF_W 0x00 #define BPF_H 0x08 #define BPF_B 0x10 #define BPF_MODE(code) ((code) & 0xe0) #define BPF_IMM 0x00 #define BPF_ABS 0x20 #define BPF_IND 0x40 #define BPF_MEM 0x60 #define BPF_LEN 0x80 #define BPF_MSH 0xa0 #define BPF_OP(code) ((code) & 0xf0) #define BPF_ADD 0x00 #define BPF_SUB 0x10 #define BPF_MUL 0x20 #define BPF_DIV 0x30 #define BPF_OR 0x40 #define BPF_AND 0x50 #define BPF_LSH 0x60 #define BPF_RSH 0x70 #define BPF_NEG 0x80 #define BPF_JA 0x00 #define BPF_JEQ 0x10 #define BPF_JGT 0x20 #define BPF_JGE 0x30 #define BPF_JSET 0x40 #define BPF_SRC(code) ((code) & 0x08) #define BPF_K 0x00 #define BPF_X 0x08 #define BPF_RVAL(code) ((code) & 0x18) #define BPF_A 0x10 #define BPF_MISCOP(code) ((code) & 0xf8) #define BPF_TAX 0x00 #define BPF_TXA 0x80 #ifndef BPF_MAXINSNS #define BPF_MAXINSNS 4096 #endif #ifndef BPF_STMT #define BPF_STMT(code, k) { (unsigned short)(code), 0, 0, k } #endif #ifndef BPF_JUMP #define BPF_JUMP(code, k, jt, jf) { (unsigned short)(code), jt, jf, k } #endif #define BPF_MEMWORDS 16 #define SKF_AD_OFF (-0x1000) #define SKF_AD_PROTOCOL 0 #define SKF_AD_PKTTYPE 4 #define SKF_AD_IFINDEX 8 #define SKF_AD_MAX 12 #define SKF_NET_OFF (-0x100000) #define SKF_LL_OFF (-0x200000) #endif android-audiosystem-1.8+13.10.20130807/include/linux/ppdev.h0000644000015700001700000000444412200324306023751 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #define PP_IOCTL 'p' #define PPSETMODE _IOW(PP_IOCTL, 0x80, int) #define PPRSTATUS _IOR(PP_IOCTL, 0x81, unsigned char) #define PPWSTATUS OBSOLETE__IOW(PP_IOCTL, 0x82, unsigned char) #define PPRCONTROL _IOR(PP_IOCTL, 0x83, unsigned char) #define PPWCONTROL _IOW(PP_IOCTL, 0x84, unsigned char) struct ppdev_frob_struct { unsigned char mask; unsigned char val; }; #define PPFCONTROL _IOW(PP_IOCTL, 0x8e, struct ppdev_frob_struct) #define PPRDATA _IOR(PP_IOCTL, 0x85, unsigned char) #define PPWDATA _IOW(PP_IOCTL, 0x86, unsigned char) #define PPRECONTROL OBSOLETE__IOR(PP_IOCTL, 0x87, unsigned char) #define PPWECONTROL OBSOLETE__IOW(PP_IOCTL, 0x88, unsigned char) #define PPRFIFO OBSOLETE__IOR(PP_IOCTL, 0x89, unsigned char) #define PPWFIFO OBSOLETE__IOW(PP_IOCTL, 0x8a, unsigned char) #define PPCLAIM _IO(PP_IOCTL, 0x8b) #define PPRELEASE _IO(PP_IOCTL, 0x8c) #define PPYIELD _IO(PP_IOCTL, 0x8d) #define PPEXCL _IO(PP_IOCTL, 0x8f) #define PPDATADIR _IOW(PP_IOCTL, 0x90, int) #define PPNEGOT _IOW(PP_IOCTL, 0x91, int) #define PPWCTLONIRQ _IOW(PP_IOCTL, 0x92, unsigned char) #define PPCLRIRQ _IOR(PP_IOCTL, 0x93, int) #define PPSETPHASE _IOW(PP_IOCTL, 0x94, int) #define PPGETTIME _IOR(PP_IOCTL, 0x95, struct timeval) #define PPSETTIME _IOW(PP_IOCTL, 0x96, struct timeval) #define PPGETMODES _IOR(PP_IOCTL, 0x97, unsigned int) #define PPGETMODE _IOR(PP_IOCTL, 0x98, int) #define PPGETPHASE _IOR(PP_IOCTL, 0x99, int) #define PPGETFLAGS _IOR(PP_IOCTL, 0x9a, int) #define PPSETFLAGS _IOW(PP_IOCTL, 0x9b, int) #define PP_FASTWRITE (1<<2) #define PP_FASTREAD (1<<3) #define PP_W91284PIC (1<<4) #define PP_FLAGMASK (PP_FASTWRITE | PP_FASTREAD | PP_W91284PIC) android-audiosystem-1.8+13.10.20130807/include/linux/nfs4.h0000644000015700001700000000645212200324306023506 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_NFS4_H #define _LINUX_NFS4_H #include #define NFS4_VERIFIER_SIZE 8 #define NFS4_FHSIZE 128 #define NFS4_MAXPATHLEN PATH_MAX #define NFS4_MAXNAMLEN NAME_MAX #define NFS4_ACCESS_READ 0x0001 #define NFS4_ACCESS_LOOKUP 0x0002 #define NFS4_ACCESS_MODIFY 0x0004 #define NFS4_ACCESS_EXTEND 0x0008 #define NFS4_ACCESS_DELETE 0x0010 #define NFS4_ACCESS_EXECUTE 0x0020 #define NFS4_FH_PERSISTENT 0x0000 #define NFS4_FH_NOEXPIRE_WITH_OPEN 0x0001 #define NFS4_FH_VOLATILE_ANY 0x0002 #define NFS4_FH_VOL_MIGRATION 0x0004 #define NFS4_FH_VOL_RENAME 0x0008 #define NFS4_OPEN_RESULT_CONFIRM 0x0002 #define NFS4_OPEN_RESULT_LOCKTYPE_POSIX 0x0004 #define NFS4_SHARE_ACCESS_READ 0x0001 #define NFS4_SHARE_ACCESS_WRITE 0x0002 #define NFS4_SHARE_ACCESS_BOTH 0x0003 #define NFS4_SHARE_DENY_READ 0x0001 #define NFS4_SHARE_DENY_WRITE 0x0002 #define NFS4_SHARE_DENY_BOTH 0x0003 #define NFS4_SET_TO_SERVER_TIME 0 #define NFS4_SET_TO_CLIENT_TIME 1 #define NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE 0 #define NFS4_ACE_ACCESS_DENIED_ACE_TYPE 1 #define NFS4_ACE_SYSTEM_AUDIT_ACE_TYPE 2 #define NFS4_ACE_SYSTEM_ALARM_ACE_TYPE 3 #define ACL4_SUPPORT_ALLOW_ACL 0x01 #define ACL4_SUPPORT_DENY_ACL 0x02 #define ACL4_SUPPORT_AUDIT_ACL 0x04 #define ACL4_SUPPORT_ALARM_ACL 0x08 #define NFS4_ACE_FILE_INHERIT_ACE 0x00000001 #define NFS4_ACE_DIRECTORY_INHERIT_ACE 0x00000002 #define NFS4_ACE_NO_PROPAGATE_INHERIT_ACE 0x00000004 #define NFS4_ACE_INHERIT_ONLY_ACE 0x00000008 #define NFS4_ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010 #define NFS4_ACE_FAILED_ACCESS_ACE_FLAG 0x00000020 #define NFS4_ACE_IDENTIFIER_GROUP 0x00000040 #define NFS4_ACE_OWNER 0x00000080 #define NFS4_ACE_GROUP 0x00000100 #define NFS4_ACE_EVERYONE 0x00000200 #define NFS4_ACE_READ_DATA 0x00000001 #define NFS4_ACE_LIST_DIRECTORY 0x00000001 #define NFS4_ACE_WRITE_DATA 0x00000002 #define NFS4_ACE_ADD_FILE 0x00000002 #define NFS4_ACE_APPEND_DATA 0x00000004 #define NFS4_ACE_ADD_SUBDIRECTORY 0x00000004 #define NFS4_ACE_READ_NAMED_ATTRS 0x00000008 #define NFS4_ACE_WRITE_NAMED_ATTRS 0x00000010 #define NFS4_ACE_EXECUTE 0x00000020 #define NFS4_ACE_DELETE_CHILD 0x00000040 #define NFS4_ACE_READ_ATTRIBUTES 0x00000080 #define NFS4_ACE_WRITE_ATTRIBUTES 0x00000100 #define NFS4_ACE_DELETE 0x00010000 #define NFS4_ACE_READ_ACL 0x00020000 #define NFS4_ACE_WRITE_ACL 0x00040000 #define NFS4_ACE_WRITE_OWNER 0x00080000 #define NFS4_ACE_SYNCHRONIZE 0x00100000 #define NFS4_ACE_GENERIC_READ 0x00120081 #define NFS4_ACE_GENERIC_WRITE 0x00160106 #define NFS4_ACE_GENERIC_EXECUTE 0x001200A0 #define NFS4_ACE_MASK_ALL 0x001F01FF enum nfs4_acl_whotype { NFS4_ACL_WHO_NAMED = 0, NFS4_ACL_WHO_OWNER, NFS4_ACL_WHO_GROUP, NFS4_ACL_WHO_EVERYONE, }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/tpa2018d1.h0000644000015700001700000000224712200324306024156 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_TPA2018D1_H #define _LINUX_TPA2018D1_H #include enum tpa2018d1_mode { TPA2018_MODE_OFF, TPA2018_MODE_PLAYBACK, TPA2018_MODE_RINGTONE, TPA2018_MODE_VOICE_CALL, TPA2018_NUM_MODES, }; #define TPA2018_IOCTL_MAGIC 'a' #define TPA2018_SET_CONFIG _IOW(TPA2018_IOCTL_MAGIC, 1, unsigned) #define TPA2018_READ_CONFIG _IOR(TPA2018_IOCTL_MAGIC, 2, unsigned) #define TPA2018_SET_PARAM _IOW(TPA2018_IOCTL_MAGIC, 3, unsigned) #define TPA2018_SET_MODE _IOW(TPA2018_IOCTL_MAGIC, 4, unsigned) #endif android-audiosystem-1.8+13.10.20130807/include/linux/fadvise.h0000644000015700001700000000176512200324306024257 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef FADVISE_H_INCLUDED #define FADVISE_H_INCLUDED #define POSIX_FADV_NORMAL 0 #define POSIX_FADV_RANDOM 1 #define POSIX_FADV_SEQUENTIAL 2 #define POSIX_FADV_WILLNEED 3 #ifdef __s390x__ #define POSIX_FADV_DONTNEED 6 #define POSIX_FADV_NOREUSE 7 #else #define POSIX_FADV_DONTNEED 4 #define POSIX_FADV_NOREUSE 5 #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/irq_cpustat.h0000644000015700001700000000167112200324306025170 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __irq_cpustat_h #define __irq_cpustat_h #ifndef __ARCH_IRQ_STAT #define __IRQ_STAT(cpu, member) (irq_stat[cpu].member) #endif #define local_softirq_pending() __IRQ_STAT(smp_processor_id(), __softirq_pending) #define nmi_count(cpu) __IRQ_STAT((cpu), __nmi_count) #endif android-audiosystem-1.8+13.10.20130807/include/linux/autoconf.h0000644000015700001700000000141212200324306024441 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef LINUX_AUTOCONF_CRAP_GOES_HERE #define LINUX_AUTOCONF_CRAP_GOES_HERE #define AUTOCONF_INCLUDED #endif android-audiosystem-1.8+13.10.20130807/include/linux/pci_ids.h0000644000015700001700000025216112200324306024246 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #define PCI_CLASS_NOT_DEFINED 0x0000 #define PCI_CLASS_NOT_DEFINED_VGA 0x0001 #define PCI_BASE_CLASS_STORAGE 0x01 #define PCI_CLASS_STORAGE_SCSI 0x0100 #define PCI_CLASS_STORAGE_IDE 0x0101 #define PCI_CLASS_STORAGE_FLOPPY 0x0102 #define PCI_CLASS_STORAGE_IPI 0x0103 #define PCI_CLASS_STORAGE_RAID 0x0104 #define PCI_CLASS_STORAGE_SAS 0x0107 #define PCI_CLASS_STORAGE_OTHER 0x0180 #define PCI_BASE_CLASS_NETWORK 0x02 #define PCI_CLASS_NETWORK_ETHERNET 0x0200 #define PCI_CLASS_NETWORK_TOKEN_RING 0x0201 #define PCI_CLASS_NETWORK_FDDI 0x0202 #define PCI_CLASS_NETWORK_ATM 0x0203 #define PCI_CLASS_NETWORK_OTHER 0x0280 #define PCI_BASE_CLASS_DISPLAY 0x03 #define PCI_CLASS_DISPLAY_VGA 0x0300 #define PCI_CLASS_DISPLAY_XGA 0x0301 #define PCI_CLASS_DISPLAY_3D 0x0302 #define PCI_CLASS_DISPLAY_OTHER 0x0380 #define PCI_BASE_CLASS_MULTIMEDIA 0x04 #define PCI_CLASS_MULTIMEDIA_VIDEO 0x0400 #define PCI_CLASS_MULTIMEDIA_AUDIO 0x0401 #define PCI_CLASS_MULTIMEDIA_PHONE 0x0402 #define PCI_CLASS_MULTIMEDIA_OTHER 0x0480 #define PCI_BASE_CLASS_MEMORY 0x05 #define PCI_CLASS_MEMORY_RAM 0x0500 #define PCI_CLASS_MEMORY_FLASH 0x0501 #define PCI_CLASS_MEMORY_OTHER 0x0580 #define PCI_BASE_CLASS_BRIDGE 0x06 #define PCI_CLASS_BRIDGE_HOST 0x0600 #define PCI_CLASS_BRIDGE_ISA 0x0601 #define PCI_CLASS_BRIDGE_EISA 0x0602 #define PCI_CLASS_BRIDGE_MC 0x0603 #define PCI_CLASS_BRIDGE_PCI 0x0604 #define PCI_CLASS_BRIDGE_PCMCIA 0x0605 #define PCI_CLASS_BRIDGE_NUBUS 0x0606 #define PCI_CLASS_BRIDGE_CARDBUS 0x0607 #define PCI_CLASS_BRIDGE_RACEWAY 0x0608 #define PCI_CLASS_BRIDGE_OTHER 0x0680 #define PCI_BASE_CLASS_COMMUNICATION 0x07 #define PCI_CLASS_COMMUNICATION_SERIAL 0x0700 #define PCI_CLASS_COMMUNICATION_PARALLEL 0x0701 #define PCI_CLASS_COMMUNICATION_MULTISERIAL 0x0702 #define PCI_CLASS_COMMUNICATION_MODEM 0x0703 #define PCI_CLASS_COMMUNICATION_OTHER 0x0780 #define PCI_BASE_CLASS_SYSTEM 0x08 #define PCI_CLASS_SYSTEM_PIC 0x0800 #define PCI_CLASS_SYSTEM_PIC_IOAPIC 0x080010 #define PCI_CLASS_SYSTEM_PIC_IOXAPIC 0x080020 #define PCI_CLASS_SYSTEM_DMA 0x0801 #define PCI_CLASS_SYSTEM_TIMER 0x0802 #define PCI_CLASS_SYSTEM_RTC 0x0803 #define PCI_CLASS_SYSTEM_PCI_HOTPLUG 0x0804 #define PCI_CLASS_SYSTEM_SDHCI 0x0805 #define PCI_CLASS_SYSTEM_OTHER 0x0880 #define PCI_BASE_CLASS_INPUT 0x09 #define PCI_CLASS_INPUT_KEYBOARD 0x0900 #define PCI_CLASS_INPUT_PEN 0x0901 #define PCI_CLASS_INPUT_MOUSE 0x0902 #define PCI_CLASS_INPUT_SCANNER 0x0903 #define PCI_CLASS_INPUT_GAMEPORT 0x0904 #define PCI_CLASS_INPUT_OTHER 0x0980 #define PCI_BASE_CLASS_DOCKING 0x0a #define PCI_CLASS_DOCKING_GENERIC 0x0a00 #define PCI_CLASS_DOCKING_OTHER 0x0a80 #define PCI_BASE_CLASS_PROCESSOR 0x0b #define PCI_CLASS_PROCESSOR_386 0x0b00 #define PCI_CLASS_PROCESSOR_486 0x0b01 #define PCI_CLASS_PROCESSOR_PENTIUM 0x0b02 #define PCI_CLASS_PROCESSOR_ALPHA 0x0b10 #define PCI_CLASS_PROCESSOR_POWERPC 0x0b20 #define PCI_CLASS_PROCESSOR_MIPS 0x0b30 #define PCI_CLASS_PROCESSOR_CO 0x0b40 #define PCI_BASE_CLASS_SERIAL 0x0c #define PCI_CLASS_SERIAL_FIREWIRE 0x0c00 #define PCI_CLASS_SERIAL_ACCESS 0x0c01 #define PCI_CLASS_SERIAL_SSA 0x0c02 #define PCI_CLASS_SERIAL_USB 0x0c03 #define PCI_CLASS_SERIAL_USB_UHCI 0x0c0300 #define PCI_CLASS_SERIAL_USB_OHCI 0x0c0310 #define PCI_CLASS_SERIAL_USB_EHCI 0x0c0320 #define PCI_CLASS_SERIAL_FIBER 0x0c04 #define PCI_CLASS_SERIAL_SMBUS 0x0c05 #define PCI_BASE_CLASS_INTELLIGENT 0x0e #define PCI_CLASS_INTELLIGENT_I2O 0x0e00 #define PCI_BASE_CLASS_SATELLITE 0x0f #define PCI_CLASS_SATELLITE_TV 0x0f00 #define PCI_CLASS_SATELLITE_AUDIO 0x0f01 #define PCI_CLASS_SATELLITE_VOICE 0x0f03 #define PCI_CLASS_SATELLITE_DATA 0x0f04 #define PCI_BASE_CLASS_CRYPT 0x10 #define PCI_CLASS_CRYPT_NETWORK 0x1000 #define PCI_CLASS_CRYPT_ENTERTAINMENT 0x1001 #define PCI_CLASS_CRYPT_OTHER 0x1080 #define PCI_BASE_CLASS_SIGNAL_PROCESSING 0x11 #define PCI_CLASS_SP_DPIO 0x1100 #define PCI_CLASS_SP_OTHER 0x1180 #define PCI_CLASS_OTHERS 0xff #define PCI_VENDOR_ID_DYNALINK 0x0675 #define PCI_DEVICE_ID_DYNALINK_IS64PH 0x1702 #define PCI_VENDOR_ID_BERKOM 0x0871 #define PCI_DEVICE_ID_BERKOM_A1T 0xffa1 #define PCI_DEVICE_ID_BERKOM_T_CONCEPT 0xffa2 #define PCI_DEVICE_ID_BERKOM_A4T 0xffa4 #define PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO 0xffa8 #define PCI_VENDOR_ID_COMPAQ 0x0e11 #define PCI_DEVICE_ID_COMPAQ_TOKENRING 0x0508 #define PCI_DEVICE_ID_COMPAQ_TACHYON 0xa0fc #define PCI_DEVICE_ID_COMPAQ_SMART2P 0xae10 #define PCI_DEVICE_ID_COMPAQ_NETEL100 0xae32 #define PCI_DEVICE_ID_COMPAQ_NETEL10 0xae34 #define PCI_DEVICE_ID_COMPAQ_TRIFLEX_IDE 0xae33 #define PCI_DEVICE_ID_COMPAQ_NETFLEX3I 0xae35 #define PCI_DEVICE_ID_COMPAQ_NETEL100D 0xae40 #define PCI_DEVICE_ID_COMPAQ_NETEL100PI 0xae43 #define PCI_DEVICE_ID_COMPAQ_NETEL100I 0xb011 #define PCI_DEVICE_ID_COMPAQ_CISS 0xb060 #define PCI_DEVICE_ID_COMPAQ_CISSB 0xb178 #define PCI_DEVICE_ID_COMPAQ_CISSC 0x46 #define PCI_DEVICE_ID_COMPAQ_THUNDER 0xf130 #define PCI_DEVICE_ID_COMPAQ_NETFLEX3B 0xf150 #define PCI_VENDOR_ID_NCR 0x1000 #define PCI_VENDOR_ID_LSI_LOGIC 0x1000 #define PCI_DEVICE_ID_NCR_53C810 0x0001 #define PCI_DEVICE_ID_NCR_53C820 0x0002 #define PCI_DEVICE_ID_NCR_53C825 0x0003 #define PCI_DEVICE_ID_NCR_53C815 0x0004 #define PCI_DEVICE_ID_LSI_53C810AP 0x0005 #define PCI_DEVICE_ID_NCR_53C860 0x0006 #define PCI_DEVICE_ID_LSI_53C1510 0x000a #define PCI_DEVICE_ID_NCR_53C896 0x000b #define PCI_DEVICE_ID_NCR_53C895 0x000c #define PCI_DEVICE_ID_NCR_53C885 0x000d #define PCI_DEVICE_ID_NCR_53C875 0x000f #define PCI_DEVICE_ID_NCR_53C1510 0x0010 #define PCI_DEVICE_ID_LSI_53C895A 0x0012 #define PCI_DEVICE_ID_LSI_53C875A 0x0013 #define PCI_DEVICE_ID_LSI_53C1010_33 0x0020 #define PCI_DEVICE_ID_LSI_53C1010_66 0x0021 #define PCI_DEVICE_ID_LSI_53C1030 0x0030 #define PCI_DEVICE_ID_LSI_1030_53C1035 0x0032 #define PCI_DEVICE_ID_LSI_53C1035 0x0040 #define PCI_DEVICE_ID_NCR_53C875J 0x008f #define PCI_DEVICE_ID_LSI_FC909 0x0621 #define PCI_DEVICE_ID_LSI_FC929 0x0622 #define PCI_DEVICE_ID_LSI_FC929_LAN 0x0623 #define PCI_DEVICE_ID_LSI_FC919 0x0624 #define PCI_DEVICE_ID_LSI_FC919_LAN 0x0625 #define PCI_DEVICE_ID_LSI_FC929X 0x0626 #define PCI_DEVICE_ID_LSI_FC939X 0x0642 #define PCI_DEVICE_ID_LSI_FC949X 0x0640 #define PCI_DEVICE_ID_LSI_FC949ES 0x0646 #define PCI_DEVICE_ID_LSI_FC919X 0x0628 #define PCI_DEVICE_ID_NCR_YELLOWFIN 0x0701 #define PCI_DEVICE_ID_LSI_61C102 0x0901 #define PCI_DEVICE_ID_LSI_63C815 0x1000 #define PCI_DEVICE_ID_LSI_SAS1064 0x0050 #define PCI_DEVICE_ID_LSI_SAS1064R 0x0411 #define PCI_DEVICE_ID_LSI_SAS1066 0x005E #define PCI_DEVICE_ID_LSI_SAS1068 0x0054 #define PCI_DEVICE_ID_LSI_SAS1064A 0x005C #define PCI_DEVICE_ID_LSI_SAS1064E 0x0056 #define PCI_DEVICE_ID_LSI_SAS1066E 0x005A #define PCI_DEVICE_ID_LSI_SAS1068E 0x0058 #define PCI_DEVICE_ID_LSI_SAS1078 0x0060 #define PCI_VENDOR_ID_ATI 0x1002 #define PCI_DEVICE_ID_ATI_68800 0x4158 #define PCI_DEVICE_ID_ATI_215CT222 0x4354 #define PCI_DEVICE_ID_ATI_210888CX 0x4358 #define PCI_DEVICE_ID_ATI_215ET222 0x4554 #define PCI_DEVICE_ID_ATI_215GB 0x4742 #define PCI_DEVICE_ID_ATI_215GD 0x4744 #define PCI_DEVICE_ID_ATI_215GI 0x4749 #define PCI_DEVICE_ID_ATI_215GP 0x4750 #define PCI_DEVICE_ID_ATI_215GQ 0x4751 #define PCI_DEVICE_ID_ATI_215XL 0x4752 #define PCI_DEVICE_ID_ATI_215GT 0x4754 #define PCI_DEVICE_ID_ATI_215GTB 0x4755 #define PCI_DEVICE_ID_ATI_215_IV 0x4756 #define PCI_DEVICE_ID_ATI_215_IW 0x4757 #define PCI_DEVICE_ID_ATI_215_IZ 0x475A #define PCI_DEVICE_ID_ATI_210888GX 0x4758 #define PCI_DEVICE_ID_ATI_215_LB 0x4c42 #define PCI_DEVICE_ID_ATI_215_LD 0x4c44 #define PCI_DEVICE_ID_ATI_215_LG 0x4c47 #define PCI_DEVICE_ID_ATI_215_LI 0x4c49 #define PCI_DEVICE_ID_ATI_215_LM 0x4c4D #define PCI_DEVICE_ID_ATI_215_LN 0x4c4E #define PCI_DEVICE_ID_ATI_215_LR 0x4c52 #define PCI_DEVICE_ID_ATI_215_LS 0x4c53 #define PCI_DEVICE_ID_ATI_264_LT 0x4c54 #define PCI_DEVICE_ID_ATI_264VT 0x5654 #define PCI_DEVICE_ID_ATI_264VU 0x5655 #define PCI_DEVICE_ID_ATI_264VV 0x5656 #define PCI_DEVICE_ID_ATI_RAGE128_RE 0x5245 #define PCI_DEVICE_ID_ATI_RAGE128_RF 0x5246 #define PCI_DEVICE_ID_ATI_RAGE128_RG 0x5247 #define PCI_DEVICE_ID_ATI_RAGE128_RK 0x524b #define PCI_DEVICE_ID_ATI_RAGE128_RL 0x524c #define PCI_DEVICE_ID_ATI_RAGE128_SE 0x5345 #define PCI_DEVICE_ID_ATI_RAGE128_SF 0x5346 #define PCI_DEVICE_ID_ATI_RAGE128_SG 0x5347 #define PCI_DEVICE_ID_ATI_RAGE128_SH 0x5348 #define PCI_DEVICE_ID_ATI_RAGE128_SK 0x534b #define PCI_DEVICE_ID_ATI_RAGE128_SL 0x534c #define PCI_DEVICE_ID_ATI_RAGE128_SM 0x534d #define PCI_DEVICE_ID_ATI_RAGE128_SN 0x534e #define PCI_DEVICE_ID_ATI_RAGE128_TF 0x5446 #define PCI_DEVICE_ID_ATI_RAGE128_TL 0x544c #define PCI_DEVICE_ID_ATI_RAGE128_TR 0x5452 #define PCI_DEVICE_ID_ATI_RAGE128_TS 0x5453 #define PCI_DEVICE_ID_ATI_RAGE128_TT 0x5454 #define PCI_DEVICE_ID_ATI_RAGE128_TU 0x5455 #define PCI_DEVICE_ID_ATI_RAGE128_LE 0x4c45 #define PCI_DEVICE_ID_ATI_RAGE128_LF 0x4c46 #define PCI_DEVICE_ID_ATI_RAGE128_MF 0x4d46 #define PCI_DEVICE_ID_ATI_RAGE128_ML 0x4d4c #define PCI_DEVICE_ID_ATI_RAGE128_PA 0x5041 #define PCI_DEVICE_ID_ATI_RAGE128_PB 0x5042 #define PCI_DEVICE_ID_ATI_RAGE128_PC 0x5043 #define PCI_DEVICE_ID_ATI_RAGE128_PD 0x5044 #define PCI_DEVICE_ID_ATI_RAGE128_PE 0x5045 #define PCI_DEVICE_ID_ATI_RAGE128_PF 0x5046 #define PCI_DEVICE_ID_ATI_RAGE128_PG 0x5047 #define PCI_DEVICE_ID_ATI_RAGE128_PH 0x5048 #define PCI_DEVICE_ID_ATI_RAGE128_PI 0x5049 #define PCI_DEVICE_ID_ATI_RAGE128_PJ 0x504A #define PCI_DEVICE_ID_ATI_RAGE128_PK 0x504B #define PCI_DEVICE_ID_ATI_RAGE128_PL 0x504C #define PCI_DEVICE_ID_ATI_RAGE128_PM 0x504D #define PCI_DEVICE_ID_ATI_RAGE128_PN 0x504E #define PCI_DEVICE_ID_ATI_RAGE128_PO 0x504F #define PCI_DEVICE_ID_ATI_RAGE128_PP 0x5050 #define PCI_DEVICE_ID_ATI_RAGE128_PQ 0x5051 #define PCI_DEVICE_ID_ATI_RAGE128_PR 0x5052 #define PCI_DEVICE_ID_ATI_RAGE128_PS 0x5053 #define PCI_DEVICE_ID_ATI_RAGE128_PT 0x5054 #define PCI_DEVICE_ID_ATI_RAGE128_PU 0x5055 #define PCI_DEVICE_ID_ATI_RAGE128_PV 0x5056 #define PCI_DEVICE_ID_ATI_RAGE128_PW 0x5057 #define PCI_DEVICE_ID_ATI_RAGE128_PX 0x5058 #define PCI_DEVICE_ID_ATI_RADEON_QD 0x5144 #define PCI_DEVICE_ID_ATI_RADEON_QE 0x5145 #define PCI_DEVICE_ID_ATI_RADEON_QF 0x5146 #define PCI_DEVICE_ID_ATI_RADEON_QG 0x5147 #define PCI_DEVICE_ID_ATI_RADEON_QY 0x5159 #define PCI_DEVICE_ID_ATI_RADEON_QZ 0x515a #define PCI_DEVICE_ID_ATI_RADEON_QL 0x514c #define PCI_DEVICE_ID_ATI_RADEON_QN 0x514e #define PCI_DEVICE_ID_ATI_RADEON_QO 0x514f #define PCI_DEVICE_ID_ATI_RADEON_Ql 0x516c #define PCI_DEVICE_ID_ATI_RADEON_BB 0x4242 #define PCI_DEVICE_ID_ATI_RADEON_QM 0x514d #define PCI_DEVICE_ID_ATI_RADEON_QW 0x5157 #define PCI_DEVICE_ID_ATI_RADEON_QX 0x5158 #define PCI_DEVICE_ID_ATI_RADEON_Id 0x4964 #define PCI_DEVICE_ID_ATI_RADEON_Ie 0x4965 #define PCI_DEVICE_ID_ATI_RADEON_If 0x4966 #define PCI_DEVICE_ID_ATI_RADEON_Ig 0x4967 #define PCI_DEVICE_ID_ATI_RADEON_Ya 0x5961 #define PCI_DEVICE_ID_ATI_RADEON_Yd 0x5964 #define PCI_DEVICE_ID_ATI_RADEON_ND 0x4e44 #define PCI_DEVICE_ID_ATI_RADEON_NE 0x4e45 #define PCI_DEVICE_ID_ATI_RADEON_NF 0x4e46 #define PCI_DEVICE_ID_ATI_RADEON_NG 0x4e47 #define PCI_DEVICE_ID_ATI_RADEON_LY 0x4c59 #define PCI_DEVICE_ID_ATI_RADEON_LZ 0x4c5a #define PCI_DEVICE_ID_ATI_RADEON_LW 0x4c57 #define PCI_DEVICE_ID_ATI_RADEON_LX 0x4c58 #define PCI_DEVICE_ID_ATI_RADEON_Ld 0x4c64 #define PCI_DEVICE_ID_ATI_RADEON_Le 0x4c65 #define PCI_DEVICE_ID_ATI_RADEON_Lf 0x4c66 #define PCI_DEVICE_ID_ATI_RADEON_Lg 0x4c67 #define PCI_DEVICE_ID_ATI_RS100 0xcab0 #define PCI_DEVICE_ID_ATI_RS200 0xcab2 #define PCI_DEVICE_ID_ATI_RS200_B 0xcbb2 #define PCI_DEVICE_ID_ATI_RS250 0xcab3 #define PCI_DEVICE_ID_ATI_RS300_100 0x5830 #define PCI_DEVICE_ID_ATI_RS300_133 0x5831 #define PCI_DEVICE_ID_ATI_RS300_166 0x5832 #define PCI_DEVICE_ID_ATI_RS300_200 0x5833 #define PCI_DEVICE_ID_ATI_RS350_100 0x7830 #define PCI_DEVICE_ID_ATI_RS350_133 0x7831 #define PCI_DEVICE_ID_ATI_RS350_166 0x7832 #define PCI_DEVICE_ID_ATI_RS350_200 0x7833 #define PCI_DEVICE_ID_ATI_RS400_100 0x5a30 #define PCI_DEVICE_ID_ATI_RS400_133 0x5a31 #define PCI_DEVICE_ID_ATI_RS400_166 0x5a32 #define PCI_DEVICE_ID_ATI_RS400_200 0x5a33 #define PCI_DEVICE_ID_ATI_RS480 0x5950 #define PCI_DEVICE_ID_ATI_IXP200_IDE 0x4349 #define PCI_DEVICE_ID_ATI_IXP200_SMBUS 0x4353 #define PCI_DEVICE_ID_ATI_IXP300_SMBUS 0x4363 #define PCI_DEVICE_ID_ATI_IXP300_IDE 0x4369 #define PCI_DEVICE_ID_ATI_IXP300_SATA 0x436e #define PCI_DEVICE_ID_ATI_IXP400_SMBUS 0x4372 #define PCI_DEVICE_ID_ATI_IXP400_IDE 0x4376 #define PCI_DEVICE_ID_ATI_IXP400_SATA 0x4379 #define PCI_DEVICE_ID_ATI_IXP400_SATA2 0x437a #define PCI_DEVICE_ID_ATI_IXP600_SATA 0x4380 #define PCI_DEVICE_ID_ATI_IXP600_SRAID 0x4381 #define PCI_DEVICE_ID_ATI_IXP600_IDE 0x438c #define PCI_VENDOR_ID_VLSI 0x1004 #define PCI_DEVICE_ID_VLSI_82C592 0x0005 #define PCI_DEVICE_ID_VLSI_82C593 0x0006 #define PCI_DEVICE_ID_VLSI_82C594 0x0007 #define PCI_DEVICE_ID_VLSI_82C597 0x0009 #define PCI_DEVICE_ID_VLSI_82C541 0x000c #define PCI_DEVICE_ID_VLSI_82C543 0x000d #define PCI_DEVICE_ID_VLSI_82C532 0x0101 #define PCI_DEVICE_ID_VLSI_82C534 0x0102 #define PCI_DEVICE_ID_VLSI_82C535 0x0104 #define PCI_DEVICE_ID_VLSI_82C147 0x0105 #define PCI_DEVICE_ID_VLSI_VAS96011 0x0702 #define PCI_VENDOR_ID_ADL 0x1005 #define PCI_DEVICE_ID_ADL_2301 0x2301 #define PCI_VENDOR_ID_NS 0x100b #define PCI_DEVICE_ID_NS_87415 0x0002 #define PCI_DEVICE_ID_NS_87560_LIO 0x000e #define PCI_DEVICE_ID_NS_87560_USB 0x0012 #define PCI_DEVICE_ID_NS_83815 0x0020 #define PCI_DEVICE_ID_NS_83820 0x0022 #define PCI_DEVICE_ID_NS_CS5535_ISA 0x002b #define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d #define PCI_DEVICE_ID_NS_CS5535_AUDIO 0x002e #define PCI_DEVICE_ID_NS_CS5535_USB 0x002f #define PCI_DEVICE_ID_NS_CS5535_VIDEO 0x0030 #define PCI_DEVICE_ID_NS_SATURN 0x0035 #define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500 #define PCI_DEVICE_ID_NS_SCx200_SMI 0x0501 #define PCI_DEVICE_ID_NS_SCx200_IDE 0x0502 #define PCI_DEVICE_ID_NS_SCx200_AUDIO 0x0503 #define PCI_DEVICE_ID_NS_SCx200_VIDEO 0x0504 #define PCI_DEVICE_ID_NS_SCx200_XBUS 0x0505 #define PCI_DEVICE_ID_NS_SC1100_BRIDGE 0x0510 #define PCI_DEVICE_ID_NS_SC1100_SMI 0x0511 #define PCI_DEVICE_ID_NS_SC1100_XBUS 0x0515 #define PCI_DEVICE_ID_NS_87410 0xd001 #define PCI_DEVICE_ID_NS_CS5535_HOST_BRIDGE 0x0028 #define PCI_DEVICE_ID_NS_CS5535_ISA_BRIDGE 0x002b #define PCI_VENDOR_ID_TSENG 0x100c #define PCI_DEVICE_ID_TSENG_W32P_2 0x3202 #define PCI_DEVICE_ID_TSENG_W32P_b 0x3205 #define PCI_DEVICE_ID_TSENG_W32P_c 0x3206 #define PCI_DEVICE_ID_TSENG_W32P_d 0x3207 #define PCI_DEVICE_ID_TSENG_ET6000 0x3208 #define PCI_VENDOR_ID_WEITEK 0x100e #define PCI_DEVICE_ID_WEITEK_P9000 0x9001 #define PCI_DEVICE_ID_WEITEK_P9100 0x9100 #define PCI_VENDOR_ID_DEC 0x1011 #define PCI_DEVICE_ID_DEC_BRD 0x0001 #define PCI_DEVICE_ID_DEC_TULIP 0x0002 #define PCI_DEVICE_ID_DEC_TGA 0x0004 #define PCI_DEVICE_ID_DEC_TULIP_FAST 0x0009 #define PCI_DEVICE_ID_DEC_TGA2 0x000D #define PCI_DEVICE_ID_DEC_FDDI 0x000F #define PCI_DEVICE_ID_DEC_TULIP_PLUS 0x0014 #define PCI_DEVICE_ID_DEC_21142 0x0019 #define PCI_DEVICE_ID_DEC_21052 0x0021 #define PCI_DEVICE_ID_DEC_21150 0x0022 #define PCI_DEVICE_ID_DEC_21152 0x0024 #define PCI_DEVICE_ID_DEC_21153 0x0025 #define PCI_DEVICE_ID_DEC_21154 0x0026 #define PCI_DEVICE_ID_DEC_21285 0x1065 #define PCI_DEVICE_ID_COMPAQ_42XX 0x0046 #define PCI_VENDOR_ID_CIRRUS 0x1013 #define PCI_DEVICE_ID_CIRRUS_7548 0x0038 #define PCI_DEVICE_ID_CIRRUS_5430 0x00a0 #define PCI_DEVICE_ID_CIRRUS_5434_4 0x00a4 #define PCI_DEVICE_ID_CIRRUS_5434_8 0x00a8 #define PCI_DEVICE_ID_CIRRUS_5436 0x00ac #define PCI_DEVICE_ID_CIRRUS_5446 0x00b8 #define PCI_DEVICE_ID_CIRRUS_5480 0x00bc #define PCI_DEVICE_ID_CIRRUS_5462 0x00d0 #define PCI_DEVICE_ID_CIRRUS_5464 0x00d4 #define PCI_DEVICE_ID_CIRRUS_5465 0x00d6 #define PCI_DEVICE_ID_CIRRUS_6729 0x1100 #define PCI_DEVICE_ID_CIRRUS_6832 0x1110 #define PCI_DEVICE_ID_CIRRUS_7543 0x1202 #define PCI_DEVICE_ID_CIRRUS_4610 0x6001 #define PCI_DEVICE_ID_CIRRUS_4612 0x6003 #define PCI_DEVICE_ID_CIRRUS_4615 0x6004 #define PCI_VENDOR_ID_IBM 0x1014 #define PCI_DEVICE_ID_IBM_TR 0x0018 #define PCI_DEVICE_ID_IBM_TR_WAKE 0x003e #define PCI_DEVICE_ID_IBM_CPC710_PCI64 0x00fc #define PCI_DEVICE_ID_IBM_SNIPE 0x0180 #define PCI_DEVICE_ID_IBM_CITRINE 0x028C #define PCI_DEVICE_ID_IBM_GEMSTONE 0xB166 #define PCI_DEVICE_ID_IBM_OBSIDIAN 0x02BD #define PCI_DEVICE_ID_IBM_ICOM_DEV_ID_1 0x0031 #define PCI_DEVICE_ID_IBM_ICOM_DEV_ID_2 0x0219 #define PCI_DEVICE_ID_IBM_ICOM_V2_TWO_PORTS_RVX 0x021A #define PCI_DEVICE_ID_IBM_ICOM_V2_ONE_PORT_RVX_ONE_PORT_MDM 0x0251 #define PCI_DEVICE_ID_IBM_ICOM_FOUR_PORT_MODEL 0x252 #define PCI_VENDOR_ID_COMPEX2 0x101a #define PCI_DEVICE_ID_COMPEX2_100VG 0x0005 #define PCI_VENDOR_ID_WD 0x101c #define PCI_DEVICE_ID_WD_90C 0xc24a #define PCI_VENDOR_ID_AMI 0x101e #define PCI_DEVICE_ID_AMI_MEGARAID3 0x1960 #define PCI_DEVICE_ID_AMI_MEGARAID 0x9010 #define PCI_DEVICE_ID_AMI_MEGARAID2 0x9060 #define PCI_VENDOR_ID_AMD 0x1022 #define PCI_DEVICE_ID_AMD_K8_NB 0x1100 #define PCI_DEVICE_ID_AMD_LANCE 0x2000 #define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 #define PCI_DEVICE_ID_AMD_SCSI 0x2020 #define PCI_DEVICE_ID_AMD_SERENADE 0x36c0 #define PCI_DEVICE_ID_AMD_FE_GATE_7006 0x7006 #define PCI_DEVICE_ID_AMD_FE_GATE_7007 0x7007 #define PCI_DEVICE_ID_AMD_FE_GATE_700C 0x700C #define PCI_DEVICE_ID_AMD_FE_GATE_700E 0x700E #define PCI_DEVICE_ID_AMD_COBRA_7401 0x7401 #define PCI_DEVICE_ID_AMD_VIPER_7409 0x7409 #define PCI_DEVICE_ID_AMD_VIPER_740B 0x740B #define PCI_DEVICE_ID_AMD_VIPER_7410 0x7410 #define PCI_DEVICE_ID_AMD_VIPER_7411 0x7411 #define PCI_DEVICE_ID_AMD_VIPER_7413 0x7413 #define PCI_DEVICE_ID_AMD_VIPER_7440 0x7440 #define PCI_DEVICE_ID_AMD_OPUS_7441 0x7441 #define PCI_DEVICE_ID_AMD_OPUS_7443 0x7443 #define PCI_DEVICE_ID_AMD_VIPER_7443 0x7443 #define PCI_DEVICE_ID_AMD_OPUS_7445 0x7445 #define PCI_DEVICE_ID_AMD_8111_LPC 0x7468 #define PCI_DEVICE_ID_AMD_8111_IDE 0x7469 #define PCI_DEVICE_ID_AMD_8111_SMBUS2 0x746a #define PCI_DEVICE_ID_AMD_8111_SMBUS 0x746b #define PCI_DEVICE_ID_AMD_8111_AUDIO 0x746d #define PCI_DEVICE_ID_AMD_8151_0 0x7454 #define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450 #define PCI_DEVICE_ID_AMD_8131_APIC 0x7451 #define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090 #define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091 #define PCI_DEVICE_ID_AMD_CS5536_AUDIO 0x2093 #define PCI_DEVICE_ID_AMD_CS5536_OHC 0x2094 #define PCI_DEVICE_ID_AMD_CS5536_EHC 0x2095 #define PCI_DEVICE_ID_AMD_CS5536_UDC 0x2096 #define PCI_DEVICE_ID_AMD_CS5536_UOC 0x2097 #define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A #define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081 #define PCI_DEVICE_ID_AMD_LX_AES 0x2082 #define PCI_VENDOR_ID_TRIDENT 0x1023 #define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 #define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001 #define PCI_DEVICE_ID_TRIDENT_9320 0x9320 #define PCI_DEVICE_ID_TRIDENT_9388 0x9388 #define PCI_DEVICE_ID_TRIDENT_9397 0x9397 #define PCI_DEVICE_ID_TRIDENT_939A 0x939A #define PCI_DEVICE_ID_TRIDENT_9520 0x9520 #define PCI_DEVICE_ID_TRIDENT_9525 0x9525 #define PCI_DEVICE_ID_TRIDENT_9420 0x9420 #define PCI_DEVICE_ID_TRIDENT_9440 0x9440 #define PCI_DEVICE_ID_TRIDENT_9660 0x9660 #define PCI_DEVICE_ID_TRIDENT_9750 0x9750 #define PCI_DEVICE_ID_TRIDENT_9850 0x9850 #define PCI_DEVICE_ID_TRIDENT_9880 0x9880 #define PCI_DEVICE_ID_TRIDENT_8400 0x8400 #define PCI_DEVICE_ID_TRIDENT_8420 0x8420 #define PCI_DEVICE_ID_TRIDENT_8500 0x8500 #define PCI_VENDOR_ID_AI 0x1025 #define PCI_DEVICE_ID_AI_M1435 0x1435 #define PCI_VENDOR_ID_DELL 0x1028 #define PCI_DEVICE_ID_DELL_RACIII 0x0008 #define PCI_DEVICE_ID_DELL_RAC4 0x0012 #define PCI_DEVICE_ID_DELL_PERC5 0x0015 #define PCI_VENDOR_ID_MATROX 0x102B #define PCI_DEVICE_ID_MATROX_MGA_2 0x0518 #define PCI_DEVICE_ID_MATROX_MIL 0x0519 #define PCI_DEVICE_ID_MATROX_MYS 0x051A #define PCI_DEVICE_ID_MATROX_MIL_2 0x051b #define PCI_DEVICE_ID_MATROX_MYS_AGP 0x051e #define PCI_DEVICE_ID_MATROX_MIL_2_AGP 0x051f #define PCI_DEVICE_ID_MATROX_MGA_IMP 0x0d10 #define PCI_DEVICE_ID_MATROX_G100_MM 0x1000 #define PCI_DEVICE_ID_MATROX_G100_AGP 0x1001 #define PCI_DEVICE_ID_MATROX_G200_PCI 0x0520 #define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521 #define PCI_DEVICE_ID_MATROX_G400 0x0525 #define PCI_DEVICE_ID_MATROX_G550 0x2527 #define PCI_DEVICE_ID_MATROX_VIA 0x4536 #define PCI_VENDOR_ID_CT 0x102c #define PCI_DEVICE_ID_CT_69000 0x00c0 #define PCI_DEVICE_ID_CT_65545 0x00d8 #define PCI_DEVICE_ID_CT_65548 0x00dc #define PCI_DEVICE_ID_CT_65550 0x00e0 #define PCI_DEVICE_ID_CT_65554 0x00e4 #define PCI_DEVICE_ID_CT_65555 0x00e5 #define PCI_VENDOR_ID_MIRO 0x1031 #define PCI_DEVICE_ID_MIRO_36050 0x5601 #define PCI_DEVICE_ID_MIRO_DC10PLUS 0x7efe #define PCI_DEVICE_ID_MIRO_DC30PLUS 0xd801 #define PCI_VENDOR_ID_NEC 0x1033 #define PCI_DEVICE_ID_NEC_CBUS_1 0x0001 #define PCI_DEVICE_ID_NEC_LOCAL 0x0002 #define PCI_DEVICE_ID_NEC_ATM 0x0003 #define PCI_DEVICE_ID_NEC_R4000 0x0004 #define PCI_DEVICE_ID_NEC_486 0x0005 #define PCI_DEVICE_ID_NEC_ACCEL_1 0x0006 #define PCI_DEVICE_ID_NEC_UXBUS 0x0007 #define PCI_DEVICE_ID_NEC_ACCEL_2 0x0008 #define PCI_DEVICE_ID_NEC_GRAPH 0x0009 #define PCI_DEVICE_ID_NEC_VL 0x0016 #define PCI_DEVICE_ID_NEC_STARALPHA2 0x002c #define PCI_DEVICE_ID_NEC_CBUS_2 0x002d #define PCI_DEVICE_ID_NEC_USB 0x0035 #define PCI_DEVICE_ID_NEC_CBUS_3 0x003b #define PCI_DEVICE_ID_NEC_NAPCCARD 0x003e #define PCI_DEVICE_ID_NEC_PCX2 0x0046 #define PCI_DEVICE_ID_NEC_NILE4 0x005a #define PCI_DEVICE_ID_NEC_VRC5476 0x009b #define PCI_DEVICE_ID_NEC_VRC4173 0x00a5 #define PCI_DEVICE_ID_NEC_VRC5477_AC97 0x00a6 #define PCI_DEVICE_ID_NEC_PC9821CS01 0x800c #define PCI_DEVICE_ID_NEC_PC9821NRB06 0x800d #define PCI_VENDOR_ID_FD 0x1036 #define PCI_DEVICE_ID_FD_36C70 0x0000 #define PCI_VENDOR_ID_SI 0x1039 #define PCI_DEVICE_ID_SI_5591_AGP 0x0001 #define PCI_DEVICE_ID_SI_6202 0x0002 #define PCI_DEVICE_ID_SI_503 0x0008 #define PCI_DEVICE_ID_SI_ACPI 0x0009 #define PCI_DEVICE_ID_SI_SMBUS 0x0016 #define PCI_DEVICE_ID_SI_LPC 0x0018 #define PCI_DEVICE_ID_SI_5597_VGA 0x0200 #define PCI_DEVICE_ID_SI_6205 0x0205 #define PCI_DEVICE_ID_SI_501 0x0406 #define PCI_DEVICE_ID_SI_496 0x0496 #define PCI_DEVICE_ID_SI_300 0x0300 #define PCI_DEVICE_ID_SI_315H 0x0310 #define PCI_DEVICE_ID_SI_315 0x0315 #define PCI_DEVICE_ID_SI_315PRO 0x0325 #define PCI_DEVICE_ID_SI_530 0x0530 #define PCI_DEVICE_ID_SI_540 0x0540 #define PCI_DEVICE_ID_SI_550 0x0550 #define PCI_DEVICE_ID_SI_540_VGA 0x5300 #define PCI_DEVICE_ID_SI_550_VGA 0x5315 #define PCI_DEVICE_ID_SI_620 0x0620 #define PCI_DEVICE_ID_SI_630 0x0630 #define PCI_DEVICE_ID_SI_633 0x0633 #define PCI_DEVICE_ID_SI_635 0x0635 #define PCI_DEVICE_ID_SI_640 0x0640 #define PCI_DEVICE_ID_SI_645 0x0645 #define PCI_DEVICE_ID_SI_646 0x0646 #define PCI_DEVICE_ID_SI_648 0x0648 #define PCI_DEVICE_ID_SI_650 0x0650 #define PCI_DEVICE_ID_SI_651 0x0651 #define PCI_DEVICE_ID_SI_655 0x0655 #define PCI_DEVICE_ID_SI_661 0x0661 #define PCI_DEVICE_ID_SI_730 0x0730 #define PCI_DEVICE_ID_SI_733 0x0733 #define PCI_DEVICE_ID_SI_630_VGA 0x6300 #define PCI_DEVICE_ID_SI_735 0x0735 #define PCI_DEVICE_ID_SI_740 0x0740 #define PCI_DEVICE_ID_SI_741 0x0741 #define PCI_DEVICE_ID_SI_745 0x0745 #define PCI_DEVICE_ID_SI_746 0x0746 #define PCI_DEVICE_ID_SI_755 0x0755 #define PCI_DEVICE_ID_SI_760 0x0760 #define PCI_DEVICE_ID_SI_900 0x0900 #define PCI_DEVICE_ID_SI_961 0x0961 #define PCI_DEVICE_ID_SI_962 0x0962 #define PCI_DEVICE_ID_SI_963 0x0963 #define PCI_DEVICE_ID_SI_965 0x0965 #define PCI_DEVICE_ID_SI_966 0x0966 #define PCI_DEVICE_ID_SI_968 0x0968 #define PCI_DEVICE_ID_SI_5511 0x5511 #define PCI_DEVICE_ID_SI_5513 0x5513 #define PCI_DEVICE_ID_SI_5517 0x5517 #define PCI_DEVICE_ID_SI_5518 0x5518 #define PCI_DEVICE_ID_SI_5571 0x5571 #define PCI_DEVICE_ID_SI_5581 0x5581 #define PCI_DEVICE_ID_SI_5582 0x5582 #define PCI_DEVICE_ID_SI_5591 0x5591 #define PCI_DEVICE_ID_SI_5596 0x5596 #define PCI_DEVICE_ID_SI_5597 0x5597 #define PCI_DEVICE_ID_SI_5598 0x5598 #define PCI_DEVICE_ID_SI_5600 0x5600 #define PCI_DEVICE_ID_SI_7012 0x7012 #define PCI_DEVICE_ID_SI_7013 0x7013 #define PCI_DEVICE_ID_SI_7016 0x7016 #define PCI_DEVICE_ID_SI_7018 0x7018 #define PCI_VENDOR_ID_HP 0x103c #define PCI_DEVICE_ID_HP_VISUALIZE_EG 0x1005 #define PCI_DEVICE_ID_HP_VISUALIZE_FX6 0x1006 #define PCI_DEVICE_ID_HP_VISUALIZE_FX4 0x1008 #define PCI_DEVICE_ID_HP_VISUALIZE_FX2 0x100a #define PCI_DEVICE_ID_HP_TACHYON 0x1028 #define PCI_DEVICE_ID_HP_TACHLITE 0x1029 #define PCI_DEVICE_ID_HP_J2585A 0x1030 #define PCI_DEVICE_ID_HP_J2585B 0x1031 #define PCI_DEVICE_ID_HP_J2973A 0x1040 #define PCI_DEVICE_ID_HP_J2970A 0x1042 #define PCI_DEVICE_ID_HP_DIVA 0x1048 #define PCI_DEVICE_ID_HP_DIVA_TOSCA1 0x1049 #define PCI_DEVICE_ID_HP_DIVA_TOSCA2 0x104A #define PCI_DEVICE_ID_HP_DIVA_MAESTRO 0x104B #define PCI_DEVICE_ID_HP_REO_IOC 0x10f1 #define PCI_DEVICE_ID_HP_VISUALIZE_FXE 0x108b #define PCI_DEVICE_ID_HP_DIVA_HALFDOME 0x1223 #define PCI_DEVICE_ID_HP_DIVA_KEYSTONE 0x1226 #define PCI_DEVICE_ID_HP_DIVA_POWERBAR 0x1227 #define PCI_DEVICE_ID_HP_ZX1_IOC 0x122a #define PCI_DEVICE_ID_HP_PCIX_LBA 0x122e #define PCI_DEVICE_ID_HP_SX1000_IOC 0x127c #define PCI_DEVICE_ID_HP_DIVA_EVEREST 0x1282 #define PCI_DEVICE_ID_HP_DIVA_AUX 0x1290 #define PCI_DEVICE_ID_HP_DIVA_RMP3 0x1301 #define PCI_DEVICE_ID_HP_DIVA_HURRICANE 0x132a #define PCI_DEVICE_ID_HP_CISSA 0x3220 #define PCI_DEVICE_ID_HP_CISSC 0x3230 #define PCI_DEVICE_ID_HP_CISSD 0x3238 #define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031 #define PCI_VENDOR_ID_PCTECH 0x1042 #define PCI_DEVICE_ID_PCTECH_RZ1000 0x1000 #define PCI_DEVICE_ID_PCTECH_RZ1001 0x1001 #define PCI_DEVICE_ID_PCTECH_SAMURAI_IDE 0x3020 #define PCI_VENDOR_ID_ASUSTEK 0x1043 #define PCI_DEVICE_ID_ASUSTEK_0675 0x0675 #define PCI_VENDOR_ID_DPT 0x1044 #define PCI_DEVICE_ID_DPT 0xa400 #define PCI_VENDOR_ID_OPTI 0x1045 #define PCI_DEVICE_ID_OPTI_82C558 0xc558 #define PCI_DEVICE_ID_OPTI_82C621 0xc621 #define PCI_DEVICE_ID_OPTI_82C700 0xc700 #define PCI_DEVICE_ID_OPTI_82C825 0xd568 #define PCI_VENDOR_ID_ELSA 0x1048 #define PCI_DEVICE_ID_ELSA_MICROLINK 0x1000 #define PCI_DEVICE_ID_ELSA_QS3000 0x3000 #define PCI_VENDOR_ID_BUSLOGIC 0x104B #define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140 #define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER 0x1040 #define PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT 0x8130 #define PCI_VENDOR_ID_TI 0x104c #define PCI_DEVICE_ID_TI_TVP4020 0x3d07 #define PCI_DEVICE_ID_TI_4450 0x8011 #define PCI_DEVICE_ID_TI_XX21_XX11 0x8031 #define PCI_DEVICE_ID_TI_XX21_XX11_SD 0x8034 #define PCI_DEVICE_ID_TI_X515 0x8036 #define PCI_DEVICE_ID_TI_XX12 0x8039 #define PCI_DEVICE_ID_TI_1130 0xac12 #define PCI_DEVICE_ID_TI_1031 0xac13 #define PCI_DEVICE_ID_TI_1131 0xac15 #define PCI_DEVICE_ID_TI_1250 0xac16 #define PCI_DEVICE_ID_TI_1220 0xac17 #define PCI_DEVICE_ID_TI_1221 0xac19 #define PCI_DEVICE_ID_TI_1210 0xac1a #define PCI_DEVICE_ID_TI_1450 0xac1b #define PCI_DEVICE_ID_TI_1225 0xac1c #define PCI_DEVICE_ID_TI_1251A 0xac1d #define PCI_DEVICE_ID_TI_1211 0xac1e #define PCI_DEVICE_ID_TI_1251B 0xac1f #define PCI_DEVICE_ID_TI_4410 0xac41 #define PCI_DEVICE_ID_TI_4451 0xac42 #define PCI_DEVICE_ID_TI_4510 0xac44 #define PCI_DEVICE_ID_TI_4520 0xac46 #define PCI_DEVICE_ID_TI_7510 0xac47 #define PCI_DEVICE_ID_TI_7610 0xac48 #define PCI_DEVICE_ID_TI_7410 0xac49 #define PCI_DEVICE_ID_TI_1410 0xac50 #define PCI_DEVICE_ID_TI_1420 0xac51 #define PCI_DEVICE_ID_TI_1451A 0xac52 #define PCI_DEVICE_ID_TI_1620 0xac54 #define PCI_DEVICE_ID_TI_1520 0xac55 #define PCI_DEVICE_ID_TI_1510 0xac56 #define PCI_DEVICE_ID_TI_X620 0xac8d #define PCI_DEVICE_ID_TI_X420 0xac8e #define PCI_VENDOR_ID_SONY 0x104d #define PCI_VENDOR_ID_WINBOND2 0x1050 #define PCI_DEVICE_ID_WINBOND2_89C940F 0x5a5a #define PCI_DEVICE_ID_WINBOND2_6692 0x6692 #define PCI_VENDOR_ID_ANIGMA 0x1051 #define PCI_DEVICE_ID_ANIGMA_MC145575 0x0100 #define PCI_VENDOR_ID_EFAR 0x1055 #define PCI_DEVICE_ID_EFAR_SLC90E66_1 0x9130 #define PCI_DEVICE_ID_EFAR_SLC90E66_3 0x9463 #define PCI_VENDOR_ID_MOTOROLA 0x1057 #define PCI_DEVICE_ID_MOTOROLA_MPC105 0x0001 #define PCI_DEVICE_ID_MOTOROLA_MPC106 0x0002 #define PCI_DEVICE_ID_MOTOROLA_MPC107 0x0004 #define PCI_DEVICE_ID_MOTOROLA_RAVEN 0x4801 #define PCI_DEVICE_ID_MOTOROLA_FALCON 0x4802 #define PCI_DEVICE_ID_MOTOROLA_HAWK 0x4803 #define PCI_DEVICE_ID_MOTOROLA_HARRIER 0x480b #define PCI_DEVICE_ID_MOTOROLA_MPC5200 0x5803 #define PCI_DEVICE_ID_MOTOROLA_MPC5200B 0x5809 #define PCI_VENDOR_ID_PROMISE 0x105a #define PCI_DEVICE_ID_PROMISE_20265 0x0d30 #define PCI_DEVICE_ID_PROMISE_20267 0x4d30 #define PCI_DEVICE_ID_PROMISE_20246 0x4d33 #define PCI_DEVICE_ID_PROMISE_20262 0x4d38 #define PCI_DEVICE_ID_PROMISE_20263 0x0D38 #define PCI_DEVICE_ID_PROMISE_20268 0x4d68 #define PCI_DEVICE_ID_PROMISE_20269 0x4d69 #define PCI_DEVICE_ID_PROMISE_20270 0x6268 #define PCI_DEVICE_ID_PROMISE_20271 0x6269 #define PCI_DEVICE_ID_PROMISE_20275 0x1275 #define PCI_DEVICE_ID_PROMISE_20276 0x5275 #define PCI_DEVICE_ID_PROMISE_20277 0x7275 #define PCI_VENDOR_ID_UMC 0x1060 #define PCI_DEVICE_ID_UMC_UM8673F 0x0101 #define PCI_DEVICE_ID_UMC_UM8886BF 0x673a #define PCI_DEVICE_ID_UMC_UM8886A 0x886a #define PCI_VENDOR_ID_MYLEX 0x1069 #define PCI_DEVICE_ID_MYLEX_DAC960_P 0x0001 #define PCI_DEVICE_ID_MYLEX_DAC960_PD 0x0002 #define PCI_DEVICE_ID_MYLEX_DAC960_PG 0x0010 #define PCI_DEVICE_ID_MYLEX_DAC960_LA 0x0020 #define PCI_DEVICE_ID_MYLEX_DAC960_LP 0x0050 #define PCI_DEVICE_ID_MYLEX_DAC960_BA 0xBA56 #define PCI_DEVICE_ID_MYLEX_DAC960_GEM 0xB166 #define PCI_VENDOR_ID_APPLE 0x106b #define PCI_DEVICE_ID_APPLE_BANDIT 0x0001 #define PCI_DEVICE_ID_APPLE_HYDRA 0x000e #define PCI_DEVICE_ID_APPLE_UNI_N_FW 0x0018 #define PCI_DEVICE_ID_APPLE_UNI_N_AGP 0x0020 #define PCI_DEVICE_ID_APPLE_UNI_N_GMAC 0x0021 #define PCI_DEVICE_ID_APPLE_UNI_N_GMACP 0x0024 #define PCI_DEVICE_ID_APPLE_UNI_N_AGP_P 0x0027 #define PCI_DEVICE_ID_APPLE_UNI_N_AGP15 0x002d #define PCI_DEVICE_ID_APPLE_UNI_N_PCI15 0x002e #define PCI_DEVICE_ID_APPLE_UNI_N_GMAC2 0x0032 #define PCI_DEVICE_ID_APPLE_UNI_N_ATA 0x0033 #define PCI_DEVICE_ID_APPLE_UNI_N_AGP2 0x0034 #define PCI_DEVICE_ID_APPLE_IPID_ATA100 0x003b #define PCI_DEVICE_ID_APPLE_K2_ATA100 0x0043 #define PCI_DEVICE_ID_APPLE_U3_AGP 0x004b #define PCI_DEVICE_ID_APPLE_K2_GMAC 0x004c #define PCI_DEVICE_ID_APPLE_SH_ATA 0x0050 #define PCI_DEVICE_ID_APPLE_SH_SUNGEM 0x0051 #define PCI_DEVICE_ID_APPLE_U3L_AGP 0x0058 #define PCI_DEVICE_ID_APPLE_U3H_AGP 0x0059 #define PCI_DEVICE_ID_APPLE_IPID2_AGP 0x0066 #define PCI_DEVICE_ID_APPLE_IPID2_ATA 0x0069 #define PCI_DEVICE_ID_APPLE_IPID2_FW 0x006a #define PCI_DEVICE_ID_APPLE_IPID2_GMAC 0x006b #define PCI_DEVICE_ID_APPLE_TIGON3 0x1645 #define PCI_VENDOR_ID_YAMAHA 0x1073 #define PCI_DEVICE_ID_YAMAHA_724 0x0004 #define PCI_DEVICE_ID_YAMAHA_724F 0x000d #define PCI_DEVICE_ID_YAMAHA_740 0x000a #define PCI_DEVICE_ID_YAMAHA_740C 0x000c #define PCI_DEVICE_ID_YAMAHA_744 0x0010 #define PCI_DEVICE_ID_YAMAHA_754 0x0012 #define PCI_VENDOR_ID_QLOGIC 0x1077 #define PCI_DEVICE_ID_QLOGIC_ISP10160 0x1016 #define PCI_DEVICE_ID_QLOGIC_ISP1020 0x1020 #define PCI_DEVICE_ID_QLOGIC_ISP1080 0x1080 #define PCI_DEVICE_ID_QLOGIC_ISP12160 0x1216 #define PCI_DEVICE_ID_QLOGIC_ISP1240 0x1240 #define PCI_DEVICE_ID_QLOGIC_ISP1280 0x1280 #define PCI_DEVICE_ID_QLOGIC_ISP2100 0x2100 #define PCI_DEVICE_ID_QLOGIC_ISP2200 0x2200 #define PCI_DEVICE_ID_QLOGIC_ISP2300 0x2300 #define PCI_DEVICE_ID_QLOGIC_ISP2312 0x2312 #define PCI_DEVICE_ID_QLOGIC_ISP2322 0x2322 #define PCI_DEVICE_ID_QLOGIC_ISP6312 0x6312 #define PCI_DEVICE_ID_QLOGIC_ISP6322 0x6322 #define PCI_DEVICE_ID_QLOGIC_ISP2422 0x2422 #define PCI_DEVICE_ID_QLOGIC_ISP2432 0x2432 #define PCI_DEVICE_ID_QLOGIC_ISP2512 0x2512 #define PCI_DEVICE_ID_QLOGIC_ISP2522 0x2522 #define PCI_DEVICE_ID_QLOGIC_ISP5422 0x5422 #define PCI_DEVICE_ID_QLOGIC_ISP5432 0x5432 #define PCI_VENDOR_ID_CYRIX 0x1078 #define PCI_DEVICE_ID_CYRIX_5510 0x0000 #define PCI_DEVICE_ID_CYRIX_PCI_MASTER 0x0001 #define PCI_DEVICE_ID_CYRIX_5520 0x0002 #define PCI_DEVICE_ID_CYRIX_5530_LEGACY 0x0100 #define PCI_DEVICE_ID_CYRIX_5530_IDE 0x0102 #define PCI_DEVICE_ID_CYRIX_5530_AUDIO 0x0103 #define PCI_DEVICE_ID_CYRIX_5530_VIDEO 0x0104 #define PCI_VENDOR_ID_CONTAQ 0x1080 #define PCI_DEVICE_ID_CONTAQ_82C693 0xc693 #define PCI_VENDOR_ID_OLICOM 0x108d #define PCI_DEVICE_ID_OLICOM_OC2325 0x0012 #define PCI_DEVICE_ID_OLICOM_OC2183 0x0013 #define PCI_DEVICE_ID_OLICOM_OC2326 0x0014 #define PCI_VENDOR_ID_SUN 0x108e #define PCI_DEVICE_ID_SUN_EBUS 0x1000 #define PCI_DEVICE_ID_SUN_HAPPYMEAL 0x1001 #define PCI_DEVICE_ID_SUN_RIO_EBUS 0x1100 #define PCI_DEVICE_ID_SUN_RIO_GEM 0x1101 #define PCI_DEVICE_ID_SUN_RIO_1394 0x1102 #define PCI_DEVICE_ID_SUN_RIO_USB 0x1103 #define PCI_DEVICE_ID_SUN_GEM 0x2bad #define PCI_DEVICE_ID_SUN_SIMBA 0x5000 #define PCI_DEVICE_ID_SUN_PBM 0x8000 #define PCI_DEVICE_ID_SUN_SCHIZO 0x8001 #define PCI_DEVICE_ID_SUN_SABRE 0xa000 #define PCI_DEVICE_ID_SUN_HUMMINGBIRD 0xa001 #define PCI_DEVICE_ID_SUN_TOMATILLO 0xa801 #define PCI_DEVICE_ID_SUN_CASSINI 0xabba #define PCI_VENDOR_ID_CMD 0x1095 #define PCI_DEVICE_ID_CMD_643 0x0643 #define PCI_DEVICE_ID_CMD_646 0x0646 #define PCI_DEVICE_ID_CMD_648 0x0648 #define PCI_DEVICE_ID_CMD_649 0x0649 #define PCI_DEVICE_ID_SII_680 0x0680 #define PCI_DEVICE_ID_SII_3112 0x3112 #define PCI_DEVICE_ID_SII_1210SA 0x0240 #define PCI_VENDOR_ID_BROOKTREE 0x109e #define PCI_DEVICE_ID_BROOKTREE_878 0x0878 #define PCI_DEVICE_ID_BROOKTREE_879 0x0879 #define PCI_VENDOR_ID_SGI 0x10a9 #define PCI_DEVICE_ID_SGI_IOC3 0x0003 #define PCI_DEVICE_ID_SGI_IOC4 0x100a #define PCI_VENDOR_ID_SGI_LITHIUM 0x1002 #define PCI_VENDOR_ID_WINBOND 0x10ad #define PCI_DEVICE_ID_WINBOND_82C105 0x0105 #define PCI_DEVICE_ID_WINBOND_83C553 0x0565 #define PCI_VENDOR_ID_PLX 0x10b5 #define PCI_DEVICE_ID_PLX_R685 0x1030 #define PCI_DEVICE_ID_PLX_ROMULUS 0x106a #define PCI_DEVICE_ID_PLX_SPCOM800 0x1076 #define PCI_DEVICE_ID_PLX_1077 0x1077 #define PCI_DEVICE_ID_PLX_SPCOM200 0x1103 #define PCI_DEVICE_ID_PLX_DJINN_ITOO 0x1151 #define PCI_DEVICE_ID_PLX_R753 0x1152 #define PCI_DEVICE_ID_PLX_OLITEC 0x1187 #define PCI_DEVICE_ID_PLX_PCI200SYN 0x3196 #define PCI_DEVICE_ID_PLX_9050 0x9050 #define PCI_DEVICE_ID_PLX_9080 0x9080 #define PCI_DEVICE_ID_PLX_GTEK_SERIAL2 0xa001 #define PCI_VENDOR_ID_MADGE 0x10b6 #define PCI_DEVICE_ID_MADGE_MK2 0x0002 #define PCI_VENDOR_ID_3COM 0x10b7 #define PCI_DEVICE_ID_3COM_3C985 0x0001 #define PCI_DEVICE_ID_3COM_3C940 0x1700 #define PCI_DEVICE_ID_3COM_3C339 0x3390 #define PCI_DEVICE_ID_3COM_3C359 0x3590 #define PCI_DEVICE_ID_3COM_3C940B 0x80eb #define PCI_DEVICE_ID_3COM_3CR990 0x9900 #define PCI_DEVICE_ID_3COM_3CR990_TX_95 0x9902 #define PCI_DEVICE_ID_3COM_3CR990_TX_97 0x9903 #define PCI_DEVICE_ID_3COM_3CR990B 0x9904 #define PCI_DEVICE_ID_3COM_3CR990_FX 0x9905 #define PCI_DEVICE_ID_3COM_3CR990SVR95 0x9908 #define PCI_DEVICE_ID_3COM_3CR990SVR97 0x9909 #define PCI_DEVICE_ID_3COM_3CR990SVR 0x990a #define PCI_VENDOR_ID_AL 0x10b9 #define PCI_DEVICE_ID_AL_M1533 0x1533 #define PCI_DEVICE_ID_AL_M1535 0x1535 #define PCI_DEVICE_ID_AL_M1541 0x1541 #define PCI_DEVICE_ID_AL_M1563 0x1563 #define PCI_DEVICE_ID_AL_M1621 0x1621 #define PCI_DEVICE_ID_AL_M1631 0x1631 #define PCI_DEVICE_ID_AL_M1632 0x1632 #define PCI_DEVICE_ID_AL_M1641 0x1641 #define PCI_DEVICE_ID_AL_M1644 0x1644 #define PCI_DEVICE_ID_AL_M1647 0x1647 #define PCI_DEVICE_ID_AL_M1651 0x1651 #define PCI_DEVICE_ID_AL_M1671 0x1671 #define PCI_DEVICE_ID_AL_M1681 0x1681 #define PCI_DEVICE_ID_AL_M1683 0x1683 #define PCI_DEVICE_ID_AL_M1689 0x1689 #define PCI_DEVICE_ID_AL_M5219 0x5219 #define PCI_DEVICE_ID_AL_M5228 0x5228 #define PCI_DEVICE_ID_AL_M5229 0x5229 #define PCI_DEVICE_ID_AL_M5451 0x5451 #define PCI_DEVICE_ID_AL_M7101 0x7101 #define PCI_VENDOR_ID_NEOMAGIC 0x10c8 #define PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO 0x8005 #define PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO 0x8006 #define PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO 0x8016 #define PCI_VENDOR_ID_TCONRAD 0x10da #define PCI_DEVICE_ID_TCONRAD_TOKENRING 0x0508 #define PCI_VENDOR_ID_NVIDIA 0x10de #define PCI_DEVICE_ID_NVIDIA_TNT 0x0020 #define PCI_DEVICE_ID_NVIDIA_TNT2 0x0028 #define PCI_DEVICE_ID_NVIDIA_UTNT2 0x0029 #define PCI_DEVICE_ID_NVIDIA_TNT_UNKNOWN 0x002a #define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C #define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS 0x0034 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE 0x0035 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA 0x0036 #define PCI_DEVICE_ID_NVIDIA_NVENET_10 0x0037 #define PCI_DEVICE_ID_NVIDIA_NVENET_11 0x0038 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2 0x003e #define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_ULTRA 0x0040 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800 0x0041 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_LE 0x0042 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_GT 0x0045 #define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_4000 0x004E #define PCI_DEVICE_ID_NVIDIA_NFORCE4_SMBUS 0x0052 #define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE 0x0053 #define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA 0x0054 #define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2 0x0055 #define PCI_DEVICE_ID_NVIDIA_NVENET_8 0x0056 #define PCI_DEVICE_ID_NVIDIA_NVENET_9 0x0057 #define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO 0x0059 #define PCI_DEVICE_ID_NVIDIA_CK804_PCIE 0x005d #define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS 0x0064 #define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE 0x0065 #define PCI_DEVICE_ID_NVIDIA_NVENET_2 0x0066 #define PCI_DEVICE_ID_NVIDIA_MCP2_MODEM 0x0069 #define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a #define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS 0x0084 #define PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE 0x0085 #define PCI_DEVICE_ID_NVIDIA_NVENET_4 0x0086 #define PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM 0x0089 #define PCI_DEVICE_ID_NVIDIA_CK8_AUDIO 0x008a #define PCI_DEVICE_ID_NVIDIA_NVENET_5 0x008c #define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA 0x008e #define PCI_DEVICE_ID_NVIDIA_GEFORCE_7800_GT 0x0090 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_7800_GTX 0x0091 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_7800 0x0098 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_7800_GTX 0x0099 #define PCI_DEVICE_ID_NVIDIA_ITNT2 0x00A0 #define PCI_DEVICE_ID_GEFORCE_6800A 0x00c1 #define PCI_DEVICE_ID_GEFORCE_6800A_LE 0x00c2 #define PCI_DEVICE_ID_GEFORCE_GO_6800 0x00c8 #define PCI_DEVICE_ID_GEFORCE_GO_6800_ULTRA 0x00c9 #define PCI_DEVICE_ID_QUADRO_FX_GO1400 0x00cc #define PCI_DEVICE_ID_QUADRO_FX_1400 0x00ce #define PCI_DEVICE_ID_NVIDIA_NFORCE3 0x00d1 #define PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS 0x00d4 #define PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE 0x00d5 #define PCI_DEVICE_ID_NVIDIA_NVENET_3 0x00d6 #define PCI_DEVICE_ID_NVIDIA_MCP3_MODEM 0x00d9 #define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da #define PCI_DEVICE_ID_NVIDIA_NVENET_7 0x00df #define PCI_DEVICE_ID_NVIDIA_NFORCE3S 0x00e1 #define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA 0x00e3 #define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS 0x00e4 #define PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE 0x00e5 #define PCI_DEVICE_ID_NVIDIA_NVENET_6 0x00e6 #define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea #define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee #define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_ALT1 0x00f0 #define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT1 0x00f1 #define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT2 0x00f2 #define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6200_ALT1 0x00f3 #define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_GT 0x00f9 #define PCIE_DEVICE_ID_NVIDIA_QUADRO_NVS280 0x00fd #define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101 #define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103 #define PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX 0x0110 #define PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX2 0x0111 #define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GO 0x0112 #define PCI_DEVICE_ID_NVIDIA_QUADRO2_MXR 0x0113 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_6600_GT 0x0140 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_6600 0x0141 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_6610_XL 0x0145 #define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_540 0x014E #define PCI_DEVICE_ID_NVIDIA_GEFORCE_6200 0x014F #define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS 0x0150 #define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS2 0x0151 #define PCI_DEVICE_ID_NVIDIA_GEFORCE2_ULTRA 0x0152 #define PCI_DEVICE_ID_NVIDIA_QUADRO2_PRO 0x0153 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_6200_TURBOCACHE 0x0161 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6200 0x0164 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6250 0x0166 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6200_1 0x0167 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6250_1 0x0168 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_460 0x0170 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440 0x0171 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_420 0x0172 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440_SE 0x0173 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_440_GO 0x0174 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_420_GO 0x0175 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_420_GO_M32 0x0176 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_460_GO 0x0177 #define PCI_DEVICE_ID_NVIDIA_QUADRO4_500XGL 0x0178 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_440_GO_M64 0x0179 #define PCI_DEVICE_ID_NVIDIA_QUADRO4_200 0x017A #define PCI_DEVICE_ID_NVIDIA_QUADRO4_550XGL 0x017B #define PCI_DEVICE_ID_NVIDIA_QUADRO4_500_GOGL 0x017C #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_410_GO_M16 0x017D #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440_8X 0x0181 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440SE_8X 0x0182 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_420_8X 0x0183 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_4000 0x0185 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_448_GO 0x0186 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_488_GO 0x0187 #define PCI_DEVICE_ID_NVIDIA_QUADRO4_580_XGL 0x0188 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_MAC 0x0189 #define PCI_DEVICE_ID_NVIDIA_QUADRO4_280_NVS 0x018A #define PCI_DEVICE_ID_NVIDIA_QUADRO4_380_XGL 0x018B #define PCI_DEVICE_ID_NVIDIA_IGEFORCE2 0x01a0 #define PCI_DEVICE_ID_NVIDIA_NFORCE 0x01a4 #define PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO 0x01b1 #define PCI_DEVICE_ID_NVIDIA_NFORCE_SMBUS 0x01b4 #define PCI_DEVICE_ID_NVIDIA_NFORCE_IDE 0x01bc #define PCI_DEVICE_ID_NVIDIA_MCP1_MODEM 0x01c1 #define PCI_DEVICE_ID_NVIDIA_NVENET_1 0x01c3 #define PCI_DEVICE_ID_NVIDIA_NFORCE2 0x01e0 #define PCI_DEVICE_ID_NVIDIA_GEFORCE3 0x0200 #define PCI_DEVICE_ID_NVIDIA_GEFORCE3_1 0x0201 #define PCI_DEVICE_ID_NVIDIA_GEFORCE3_2 0x0202 #define PCI_DEVICE_ID_NVIDIA_QUADRO_DDC 0x0203 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800B 0x0211 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800B_LE 0x0212 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800B_GT 0x0215 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4600 0x0250 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4400 0x0251 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4200 0x0253 #define PCI_DEVICE_ID_NVIDIA_QUADRO4_900XGL 0x0258 #define PCI_DEVICE_ID_NVIDIA_QUADRO4_750XGL 0x0259 #define PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL 0x025B #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SMBUS 0x0264 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE 0x0265 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SMBUS 0x0368 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA 0x037E #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2 0x037F #define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268 #define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800 0x0280 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800_8X 0x0281 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800SE 0x0282 #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_4200_GO 0x0286 #define PCI_DEVICE_ID_NVIDIA_QUADRO4_980_XGL 0x0288 #define PCI_DEVICE_ID_NVIDIA_QUADRO4_780_XGL 0x0289 #define PCI_DEVICE_ID_NVIDIA_QUADRO4_700_GOGL 0x028C #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5800_ULTRA 0x0301 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5800 0x0302 #define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_2000 0x0308 #define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1000 0x0309 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5600_ULTRA 0x0311 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5600 0x0312 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5600SE 0x0314 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5600 0x031A #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5650 0x031B #define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO700 0x031C #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200 0x0320 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200_ULTRA 0x0321 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200_1 0x0322 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200SE 0x0323 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5200 0x0324 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5250 0x0325 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5500 0x0326 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5100 0x0327 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5250_32 0x0328 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO_5200 0x0329 #define PCI_DEVICE_ID_NVIDIA_QUADRO_NVS_280_PCI 0x032A #define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_500 0x032B #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5300 0x032C #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5100 0x032D #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900_ULTRA 0x0330 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900 0x0331 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900XT 0x0332 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5950_ULTRA 0x0333 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900ZT 0x0334 #define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_3000 0x0338 #define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_700 0x033F #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700_ULTRA 0x0341 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700 0x0342 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700LE 0x0343 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700VE 0x0344 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_1 0x0347 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_2 0x0348 #define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO1000 0x034C #define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1100 0x034E #define PCI_DEVICE_ID_NVIDIA_NVENET_14 0x0372 #define PCI_DEVICE_ID_NVIDIA_NVENET_15 0x0373 #define PCI_DEVICE_ID_NVIDIA_NVENET_16 0x03E5 #define PCI_DEVICE_ID_NVIDIA_NVENET_17 0x03E6 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA 0x03E7 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE 0x03EC #define PCI_DEVICE_ID_NVIDIA_NVENET_18 0x03EE #define PCI_DEVICE_ID_NVIDIA_NVENET_19 0x03EF #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2 0x03F6 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3 0x03F7 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE 0x0448 #define PCI_DEVICE_ID_NVIDIA_NVENET_20 0x0450 #define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451 #define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452 #define PCI_DEVICE_ID_NVIDIA_NVENET_23 0x0453 #define PCI_VENDOR_ID_IMS 0x10e0 #define PCI_DEVICE_ID_IMS_TT128 0x9128 #define PCI_DEVICE_ID_IMS_TT3D 0x9135 #define PCI_VENDOR_ID_INTERG 0x10ea #define PCI_DEVICE_ID_INTERG_1682 0x1682 #define PCI_DEVICE_ID_INTERG_2000 0x2000 #define PCI_DEVICE_ID_INTERG_2010 0x2010 #define PCI_DEVICE_ID_INTERG_5000 0x5000 #define PCI_DEVICE_ID_INTERG_5050 0x5050 #define PCI_VENDOR_ID_REALTEK 0x10ec #define PCI_DEVICE_ID_REALTEK_8139 0x8139 #define PCI_VENDOR_ID_XILINX 0x10ee #define PCI_DEVICE_ID_RME_DIGI96 0x3fc0 #define PCI_DEVICE_ID_RME_DIGI96_8 0x3fc1 #define PCI_DEVICE_ID_RME_DIGI96_8_PRO 0x3fc2 #define PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST 0x3fc3 #define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP 0x3fc5 #define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP_MADI 0x3fc6 #define PCI_VENDOR_ID_INIT 0x1101 #define PCI_VENDOR_ID_CREATIVE 0x1102 #define PCI_DEVICE_ID_CREATIVE_EMU10K1 0x0002 #define PCI_VENDOR_ID_ECTIVA 0x1102 #define PCI_DEVICE_ID_ECTIVA_EV1938 0x8938 #define PCI_VENDOR_ID_TTI 0x1103 #define PCI_DEVICE_ID_TTI_HPT343 0x0003 #define PCI_DEVICE_ID_TTI_HPT366 0x0004 #define PCI_DEVICE_ID_TTI_HPT372 0x0005 #define PCI_DEVICE_ID_TTI_HPT302 0x0006 #define PCI_DEVICE_ID_TTI_HPT371 0x0007 #define PCI_DEVICE_ID_TTI_HPT374 0x0008 #define PCI_DEVICE_ID_TTI_HPT372N 0x0009 #define PCI_VENDOR_ID_VIA 0x1106 #define PCI_DEVICE_ID_VIA_8763_0 0x0198 #define PCI_DEVICE_ID_VIA_8380_0 0x0204 #define PCI_DEVICE_ID_VIA_3238_0 0x0238 #define PCI_DEVICE_ID_VIA_PT880 0x0258 #define PCI_DEVICE_ID_VIA_PT880ULTRA 0x0308 #define PCI_DEVICE_ID_VIA_PX8X0_0 0x0259 #define PCI_DEVICE_ID_VIA_3269_0 0x0269 #define PCI_DEVICE_ID_VIA_K8T800PRO_0 0x0282 #define PCI_DEVICE_ID_VIA_3296_0 0x0296 #define PCI_DEVICE_ID_VIA_8363_0 0x0305 #define PCI_DEVICE_ID_VIA_P4M800CE 0x0314 #define PCI_DEVICE_ID_VIA_8371_0 0x0391 #define PCI_DEVICE_ID_VIA_8501_0 0x0501 #define PCI_DEVICE_ID_VIA_82C561 0x0561 #define PCI_DEVICE_ID_VIA_82C586_1 0x0571 #define PCI_DEVICE_ID_VIA_82C576 0x0576 #define PCI_DEVICE_ID_VIA_SATA_EIDE 0x0581 #define PCI_DEVICE_ID_VIA_82C586_0 0x0586 #define PCI_DEVICE_ID_VIA_82C596 0x0596 #define PCI_DEVICE_ID_VIA_82C597_0 0x0597 #define PCI_DEVICE_ID_VIA_82C598_0 0x0598 #define PCI_DEVICE_ID_VIA_8601_0 0x0601 #define PCI_DEVICE_ID_VIA_8605_0 0x0605 #define PCI_DEVICE_ID_VIA_82C686 0x0686 #define PCI_DEVICE_ID_VIA_82C691_0 0x0691 #define PCI_DEVICE_ID_VIA_82C576_1 0x1571 #define PCI_DEVICE_ID_VIA_82C586_2 0x3038 #define PCI_DEVICE_ID_VIA_82C586_3 0x3040 #define PCI_DEVICE_ID_VIA_82C596_3 0x3050 #define PCI_DEVICE_ID_VIA_82C596B_3 0x3051 #define PCI_DEVICE_ID_VIA_82C686_4 0x3057 #define PCI_DEVICE_ID_VIA_82C686_5 0x3058 #define PCI_DEVICE_ID_VIA_8233_5 0x3059 #define PCI_DEVICE_ID_VIA_8233_0 0x3074 #define PCI_DEVICE_ID_VIA_8633_0 0x3091 #define PCI_DEVICE_ID_VIA_8367_0 0x3099 #define PCI_DEVICE_ID_VIA_8653_0 0x3101 #define PCI_DEVICE_ID_VIA_8622 0x3102 #define PCI_DEVICE_ID_VIA_8235_USB_2 0x3104 #define PCI_DEVICE_ID_VIA_8233C_0 0x3109 #define PCI_DEVICE_ID_VIA_8361 0x3112 #define PCI_DEVICE_ID_VIA_XM266 0x3116 #define PCI_DEVICE_ID_VIA_612X 0x3119 #define PCI_DEVICE_ID_VIA_862X_0 0x3123 #define PCI_DEVICE_ID_VIA_8753_0 0x3128 #define PCI_DEVICE_ID_VIA_8233A 0x3147 #define PCI_DEVICE_ID_VIA_8703_51_0 0x3148 #define PCI_DEVICE_ID_VIA_8237_SATA 0x3149 #define PCI_DEVICE_ID_VIA_XN266 0x3156 #define PCI_DEVICE_ID_VIA_6410 0x3164 #define PCI_DEVICE_ID_VIA_8754C_0 0x3168 #define PCI_DEVICE_ID_VIA_8235 0x3177 #define PCI_DEVICE_ID_VIA_8385_0 0x3188 #define PCI_DEVICE_ID_VIA_8377_0 0x3189 #define PCI_DEVICE_ID_VIA_8378_0 0x3205 #define PCI_DEVICE_ID_VIA_8783_0 0x3208 #define PCI_DEVICE_ID_VIA_8237 0x3227 #define PCI_DEVICE_ID_VIA_8251 0x3287 #define PCI_DEVICE_ID_VIA_8237A 0x3337 #define PCI_DEVICE_ID_VIA_8231 0x8231 #define PCI_DEVICE_ID_VIA_8231_4 0x8235 #define PCI_DEVICE_ID_VIA_8365_1 0x8305 #define PCI_DEVICE_ID_VIA_CX700 0x8324 #define PCI_DEVICE_ID_VIA_8371_1 0x8391 #define PCI_DEVICE_ID_VIA_82C598_1 0x8598 #define PCI_DEVICE_ID_VIA_838X_1 0xB188 #define PCI_DEVICE_ID_VIA_83_87XX_1 0xB198 #define PCI_VENDOR_ID_SIEMENS 0x110A #define PCI_DEVICE_ID_SIEMENS_DSCC4 0x2102 #define PCI_VENDOR_ID_VORTEX 0x1119 #define PCI_DEVICE_ID_VORTEX_GDT60x0 0x0000 #define PCI_DEVICE_ID_VORTEX_GDT6000B 0x0001 #define PCI_DEVICE_ID_VORTEX_GDT6x10 0x0002 #define PCI_DEVICE_ID_VORTEX_GDT6x20 0x0003 #define PCI_DEVICE_ID_VORTEX_GDT6530 0x0004 #define PCI_DEVICE_ID_VORTEX_GDT6550 0x0005 #define PCI_DEVICE_ID_VORTEX_GDT6x17 0x0006 #define PCI_DEVICE_ID_VORTEX_GDT6x27 0x0007 #define PCI_DEVICE_ID_VORTEX_GDT6537 0x0008 #define PCI_DEVICE_ID_VORTEX_GDT6557 0x0009 #define PCI_DEVICE_ID_VORTEX_GDT6x15 0x000a #define PCI_DEVICE_ID_VORTEX_GDT6x25 0x000b #define PCI_DEVICE_ID_VORTEX_GDT6535 0x000c #define PCI_DEVICE_ID_VORTEX_GDT6555 0x000d #define PCI_DEVICE_ID_VORTEX_GDT6x17RP 0x0100 #define PCI_DEVICE_ID_VORTEX_GDT6x27RP 0x0101 #define PCI_DEVICE_ID_VORTEX_GDT6537RP 0x0102 #define PCI_DEVICE_ID_VORTEX_GDT6557RP 0x0103 #define PCI_DEVICE_ID_VORTEX_GDT6x11RP 0x0104 #define PCI_DEVICE_ID_VORTEX_GDT6x21RP 0x0105 #define PCI_VENDOR_ID_EF 0x111a #define PCI_DEVICE_ID_EF_ATM_FPGA 0x0000 #define PCI_DEVICE_ID_EF_ATM_ASIC 0x0002 #define PCI_VENDOR_ID_EF_ATM_LANAI2 0x0003 #define PCI_VENDOR_ID_EF_ATM_LANAIHB 0x0005 #define PCI_VENDOR_ID_IDT 0x111d #define PCI_DEVICE_ID_IDT_IDT77201 0x0001 #define PCI_VENDOR_ID_FORE 0x1127 #define PCI_DEVICE_ID_FORE_PCA200E 0x0300 #define PCI_VENDOR_ID_PHILIPS 0x1131 #define PCI_DEVICE_ID_PHILIPS_SAA7146 0x7146 #define PCI_DEVICE_ID_PHILIPS_SAA9730 0x9730 #define PCI_VENDOR_ID_EICON 0x1133 #define PCI_DEVICE_ID_EICON_DIVA20 0xe002 #define PCI_DEVICE_ID_EICON_DIVA20_U 0xe004 #define PCI_DEVICE_ID_EICON_DIVA201 0xe005 #define PCI_DEVICE_ID_EICON_DIVA202 0xe00b #define PCI_DEVICE_ID_EICON_MAESTRA 0xe010 #define PCI_DEVICE_ID_EICON_MAESTRAQ 0xe012 #define PCI_DEVICE_ID_EICON_MAESTRAQ_U 0xe013 #define PCI_DEVICE_ID_EICON_MAESTRAP 0xe014 #define PCI_VENDOR_ID_ZIATECH 0x1138 #define PCI_DEVICE_ID_ZIATECH_5550_HC 0x5550 #define PCI_VENDOR_ID_SYSKONNECT 0x1148 #define PCI_DEVICE_ID_SYSKONNECT_TR 0x4200 #define PCI_DEVICE_ID_SYSKONNECT_GE 0x4300 #define PCI_DEVICE_ID_SYSKONNECT_YU 0x4320 #define PCI_DEVICE_ID_SYSKONNECT_9DXX 0x4400 #define PCI_DEVICE_ID_SYSKONNECT_9MXX 0x4500 #define PCI_VENDOR_ID_DIGI 0x114f #define PCI_DEVICE_ID_DIGI_DF_M_IOM2_E 0x0070 #define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071 #define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072 #define PCI_DEVICE_ID_DIGI_DF_M_A 0x0073 #define PCI_DEVICE_ID_NEO_2DB9 0x00C8 #define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9 #define PCI_DEVICE_ID_NEO_2RJ45 0x00CA #define PCI_DEVICE_ID_NEO_2RJ45PRI 0x00CB #define PCI_VENDOR_ID_XIRCOM 0x115d #define PCI_DEVICE_ID_XIRCOM_RBM56G 0x0101 #define PCI_DEVICE_ID_XIRCOM_X3201_MDM 0x0103 #define PCI_VENDOR_ID_SERVERWORKS 0x1166 #define PCI_DEVICE_ID_SERVERWORKS_HE 0x0008 #define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 #define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017 #define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103 #define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 #define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 #define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203 #define PCI_DEVICE_ID_SERVERWORKS_HT1000SB 0x0205 #define PCI_DEVICE_ID_SERVERWORKS_OSB4IDE 0x0211 #define PCI_DEVICE_ID_SERVERWORKS_CSB5IDE 0x0212 #define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE 0x0213 #define PCI_DEVICE_ID_SERVERWORKS_HT1000IDE 0x0214 #define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 0x0217 #define PCI_DEVICE_ID_SERVERWORKS_CSB6LPC 0x0227 #define PCI_VENDOR_ID_SBE 0x1176 #define PCI_DEVICE_ID_SBE_WANXL100 0x0301 #define PCI_DEVICE_ID_SBE_WANXL200 0x0302 #define PCI_DEVICE_ID_SBE_WANXL400 0x0104 #define PCI_VENDOR_ID_TOSHIBA 0x1179 #define PCI_DEVICE_ID_TOSHIBA_PICCOLO 0x0102 #define PCI_DEVICE_ID_TOSHIBA_PICCOLO_1 0x0103 #define PCI_DEVICE_ID_TOSHIBA_PICCOLO_2 0x0105 #define PCI_DEVICE_ID_TOSHIBA_TOPIC95 0x060a #define PCI_DEVICE_ID_TOSHIBA_TOPIC97 0x060f #define PCI_DEVICE_ID_TOSHIBA_TOPIC100 0x0617 #define PCI_VENDOR_ID_TOSHIBA_2 0x102f #define PCI_DEVICE_ID_TOSHIBA_TC35815CF 0x0030 #define PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC 0x0108 #define PCI_DEVICE_ID_TOSHIBA_SPIDER_NET 0x01b3 #define PCI_VENDOR_ID_RICOH 0x1180 #define PCI_DEVICE_ID_RICOH_RL5C465 0x0465 #define PCI_DEVICE_ID_RICOH_RL5C466 0x0466 #define PCI_DEVICE_ID_RICOH_RL5C475 0x0475 #define PCI_DEVICE_ID_RICOH_RL5C476 0x0476 #define PCI_DEVICE_ID_RICOH_RL5C478 0x0478 #define PCI_DEVICE_ID_RICOH_R5C822 0x0822 #define PCI_VENDOR_ID_DLINK 0x1186 #define PCI_DEVICE_ID_DLINK_DGE510T 0x4c00 #define PCI_VENDOR_ID_ARTOP 0x1191 #define PCI_DEVICE_ID_ARTOP_ATP850UF 0x0005 #define PCI_DEVICE_ID_ARTOP_ATP860 0x0006 #define PCI_DEVICE_ID_ARTOP_ATP860R 0x0007 #define PCI_DEVICE_ID_ARTOP_ATP865 0x0008 #define PCI_DEVICE_ID_ARTOP_ATP865R 0x0009 #define PCI_DEVICE_ID_ARTOP_AEC7610 0x8002 #define PCI_DEVICE_ID_ARTOP_AEC7612UW 0x8010 #define PCI_DEVICE_ID_ARTOP_AEC7612U 0x8020 #define PCI_DEVICE_ID_ARTOP_AEC7612S 0x8030 #define PCI_DEVICE_ID_ARTOP_AEC7612D 0x8040 #define PCI_DEVICE_ID_ARTOP_AEC7612SUW 0x8050 #define PCI_DEVICE_ID_ARTOP_8060 0x8060 #define PCI_VENDOR_ID_ZEITNET 0x1193 #define PCI_DEVICE_ID_ZEITNET_1221 0x0001 #define PCI_DEVICE_ID_ZEITNET_1225 0x0002 #define PCI_VENDOR_ID_FUJITSU_ME 0x119e #define PCI_DEVICE_ID_FUJITSU_FS155 0x0001 #define PCI_DEVICE_ID_FUJITSU_FS50 0x0003 #define PCI_SUBVENDOR_ID_KEYSPAN 0x11a9 #define PCI_SUBDEVICE_ID_KEYSPAN_SX2 0x5334 #define PCI_VENDOR_ID_MARVELL 0x11ab #define PCI_DEVICE_ID_MARVELL_GT64111 0x4146 #define PCI_DEVICE_ID_MARVELL_GT64260 0x6430 #define PCI_DEVICE_ID_MARVELL_MV64360 0x6460 #define PCI_DEVICE_ID_MARVELL_MV64460 0x6480 #define PCI_DEVICE_ID_MARVELL_GT96100 0x9652 #define PCI_DEVICE_ID_MARVELL_GT96100A 0x9653 #define PCI_VENDOR_ID_V3 0x11b0 #define PCI_DEVICE_ID_V3_V960 0x0001 #define PCI_DEVICE_ID_V3_V351 0x0002 #define PCI_VENDOR_ID_ATT 0x11c1 #define PCI_DEVICE_ID_ATT_VENUS_MODEM 0x480 #define PCI_VENDOR_ID_SPECIALIX 0x11cb #define PCI_DEVICE_ID_SPECIALIX_IO8 0x2000 #define PCI_DEVICE_ID_SPECIALIX_RIO 0x8000 #define PCI_SUBDEVICE_ID_SPECIALIX_SPEED4 0xa004 #define PCI_VENDOR_ID_ANALOG_DEVICES 0x11d4 #define PCI_DEVICE_ID_AD1889JS 0x1889 #define PCI_DEVICE_ID_SEGA_BBA 0x1234 #define PCI_VENDOR_ID_ZORAN 0x11de #define PCI_DEVICE_ID_ZORAN_36057 0x6057 #define PCI_DEVICE_ID_ZORAN_36120 0x6120 #define PCI_VENDOR_ID_COMPEX 0x11f6 #define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112 #define PCI_VENDOR_ID_RP 0x11fe #define PCI_DEVICE_ID_RP32INTF 0x0001 #define PCI_DEVICE_ID_RP8INTF 0x0002 #define PCI_DEVICE_ID_RP16INTF 0x0003 #define PCI_DEVICE_ID_RP4QUAD 0x0004 #define PCI_DEVICE_ID_RP8OCTA 0x0005 #define PCI_DEVICE_ID_RP8J 0x0006 #define PCI_DEVICE_ID_RP4J 0x0007 #define PCI_DEVICE_ID_RP8SNI 0x0008 #define PCI_DEVICE_ID_RP16SNI 0x0009 #define PCI_DEVICE_ID_RPP4 0x000A #define PCI_DEVICE_ID_RPP8 0x000B #define PCI_DEVICE_ID_RP4M 0x000D #define PCI_DEVICE_ID_RP2_232 0x000E #define PCI_DEVICE_ID_RP2_422 0x000F #define PCI_DEVICE_ID_URP32INTF 0x0801 #define PCI_DEVICE_ID_URP8INTF 0x0802 #define PCI_DEVICE_ID_URP16INTF 0x0803 #define PCI_DEVICE_ID_URP8OCTA 0x0805 #define PCI_DEVICE_ID_UPCI_RM3_8PORT 0x080C #define PCI_DEVICE_ID_UPCI_RM3_4PORT 0x080D #define PCI_DEVICE_ID_CRP16INTF 0x0903 #define PCI_VENDOR_ID_CYCLADES 0x120e #define PCI_DEVICE_ID_CYCLOM_Y_Lo 0x0100 #define PCI_DEVICE_ID_CYCLOM_Y_Hi 0x0101 #define PCI_DEVICE_ID_CYCLOM_4Y_Lo 0x0102 #define PCI_DEVICE_ID_CYCLOM_4Y_Hi 0x0103 #define PCI_DEVICE_ID_CYCLOM_8Y_Lo 0x0104 #define PCI_DEVICE_ID_CYCLOM_8Y_Hi 0x0105 #define PCI_DEVICE_ID_CYCLOM_Z_Lo 0x0200 #define PCI_DEVICE_ID_CYCLOM_Z_Hi 0x0201 #define PCI_DEVICE_ID_PC300_RX_2 0x0300 #define PCI_DEVICE_ID_PC300_RX_1 0x0301 #define PCI_DEVICE_ID_PC300_TE_2 0x0310 #define PCI_DEVICE_ID_PC300_TE_1 0x0311 #define PCI_DEVICE_ID_PC300_TE_M_2 0x0320 #define PCI_DEVICE_ID_PC300_TE_M_1 0x0321 #define PCI_VENDOR_ID_ESSENTIAL 0x120f #define PCI_DEVICE_ID_ESSENTIAL_ROADRUNNER 0x0001 #define PCI_VENDOR_ID_O2 0x1217 #define PCI_DEVICE_ID_O2_6729 0x6729 #define PCI_DEVICE_ID_O2_6730 0x673a #define PCI_DEVICE_ID_O2_6832 0x6832 #define PCI_DEVICE_ID_O2_6836 0x6836 #define PCI_VENDOR_ID_3DFX 0x121a #define PCI_DEVICE_ID_3DFX_VOODOO 0x0001 #define PCI_DEVICE_ID_3DFX_VOODOO2 0x0002 #define PCI_DEVICE_ID_3DFX_BANSHEE 0x0003 #define PCI_DEVICE_ID_3DFX_VOODOO3 0x0005 #define PCI_DEVICE_ID_3DFX_VOODOO5 0x0009 #define PCI_VENDOR_ID_AVM 0x1244 #define PCI_DEVICE_ID_AVM_B1 0x0700 #define PCI_DEVICE_ID_AVM_C4 0x0800 #define PCI_DEVICE_ID_AVM_A1 0x0a00 #define PCI_DEVICE_ID_AVM_A1_V2 0x0e00 #define PCI_DEVICE_ID_AVM_C2 0x1100 #define PCI_DEVICE_ID_AVM_T1 0x1200 #define PCI_VENDOR_ID_STALLION 0x124d #define PCI_VENDOR_ID_AT 0x1259 #define PCI_SUBDEVICE_ID_AT_2700FX 0x2701 #define PCI_SUBDEVICE_ID_AT_2701FX 0x2703 #define PCI_VENDOR_ID_ESS 0x125d #define PCI_DEVICE_ID_ESS_ESS1968 0x1968 #define PCI_DEVICE_ID_ESS_ESS1978 0x1978 #define PCI_DEVICE_ID_ESS_ALLEGRO_1 0x1988 #define PCI_DEVICE_ID_ESS_ALLEGRO 0x1989 #define PCI_DEVICE_ID_ESS_CANYON3D_2LE 0x1990 #define PCI_DEVICE_ID_ESS_CANYON3D_2 0x1992 #define PCI_DEVICE_ID_ESS_MAESTRO3 0x1998 #define PCI_DEVICE_ID_ESS_MAESTRO3_1 0x1999 #define PCI_DEVICE_ID_ESS_MAESTRO3_HW 0x199a #define PCI_DEVICE_ID_ESS_MAESTRO3_2 0x199b #define PCI_VENDOR_ID_SATSAGEM 0x1267 #define PCI_DEVICE_ID_SATSAGEM_NICCY 0x1016 #define PCI_VENDOR_ID_ENSONIQ 0x1274 #define PCI_DEVICE_ID_ENSONIQ_CT5880 0x5880 #define PCI_DEVICE_ID_ENSONIQ_ES1370 0x5000 #define PCI_DEVICE_ID_ENSONIQ_ES1371 0x1371 #define PCI_VENDOR_ID_TRANSMETA 0x1279 #define PCI_DEVICE_ID_EFFICEON 0x0060 #define PCI_VENDOR_ID_ROCKWELL 0x127A #define PCI_VENDOR_ID_ITE 0x1283 #define PCI_DEVICE_ID_ITE_IT8172G 0x8172 #define PCI_DEVICE_ID_ITE_IT8172G_AUDIO 0x0801 #define PCI_DEVICE_ID_ITE_8211 0x8211 #define PCI_DEVICE_ID_ITE_8212 0x8212 #define PCI_DEVICE_ID_ITE_8872 0x8872 #define PCI_DEVICE_ID_ITE_IT8330G_0 0xe886 #define PCI_DEVICE_ID_ESS_ESS0100 0x0100 #define PCI_VENDOR_ID_ALTEON 0x12ae #define PCI_SUBVENDOR_ID_CONNECT_TECH 0x12c4 #define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232 0x0001 #define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232 0x0002 #define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232 0x0003 #define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485 0x0004 #define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_4_4 0x0005 #define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485 0x0006 #define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485_2_2 0x0007 #define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_485 0x0008 #define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6 0x0009 #define PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1 0x000A #define PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1 0x000B #define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_20MHZ 0x000C #define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_PTM 0x000D #define PCI_SUBDEVICE_ID_CONNECT_TECH_NT960PCI 0x0100 #define PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_2 0x0201 #define PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_4 0x0202 #define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_232 0x0300 #define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_232 0x0301 #define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_232 0x0302 #define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_1_1 0x0310 #define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_2 0x0311 #define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4 0x0312 #define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2 0x0320 #define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4 0x0321 #define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8 0x0322 #define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_485 0x0330 #define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_485 0x0331 #define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485 0x0332 #define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2 #define PCI_DEVICE_ID_NVIDIA_SGS_RIVA128 0x0018 #define PCI_SUBVENDOR_ID_CHASE_PCIFAST 0x12E0 #define PCI_SUBDEVICE_ID_CHASE_PCIFAST4 0x0031 #define PCI_SUBDEVICE_ID_CHASE_PCIFAST8 0x0021 #define PCI_SUBDEVICE_ID_CHASE_PCIFAST16 0x0011 #define PCI_SUBDEVICE_ID_CHASE_PCIFAST16FMC 0x0041 #define PCI_SUBVENDOR_ID_CHASE_PCIRAS 0x124D #define PCI_SUBDEVICE_ID_CHASE_PCIRAS4 0xF001 #define PCI_SUBDEVICE_ID_CHASE_PCIRAS8 0xF010 #define PCI_VENDOR_ID_AUREAL 0x12eb #define PCI_DEVICE_ID_AUREAL_VORTEX_1 0x0001 #define PCI_DEVICE_ID_AUREAL_VORTEX_2 0x0002 #define PCI_DEVICE_ID_AUREAL_ADVANTAGE 0x0003 #define PCI_VENDOR_ID_ELECTRONICDESIGNGMBH 0x12f8 #define PCI_DEVICE_ID_LML_33R10 0x8a02 #define PCI_VENDOR_ID_SIIG 0x131f #define PCI_SUBVENDOR_ID_SIIG 0x131f #define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000 #define PCI_DEVICE_ID_SIIG_1S_10x_650 0x1001 #define PCI_DEVICE_ID_SIIG_1S_10x_850 0x1002 #define PCI_DEVICE_ID_SIIG_1S1P_10x_550 0x1010 #define PCI_DEVICE_ID_SIIG_1S1P_10x_650 0x1011 #define PCI_DEVICE_ID_SIIG_1S1P_10x_850 0x1012 #define PCI_DEVICE_ID_SIIG_1P_10x 0x1020 #define PCI_DEVICE_ID_SIIG_2P_10x 0x1021 #define PCI_DEVICE_ID_SIIG_2S_10x_550 0x1030 #define PCI_DEVICE_ID_SIIG_2S_10x_650 0x1031 #define PCI_DEVICE_ID_SIIG_2S_10x_850 0x1032 #define PCI_DEVICE_ID_SIIG_2S1P_10x_550 0x1034 #define PCI_DEVICE_ID_SIIG_2S1P_10x_650 0x1035 #define PCI_DEVICE_ID_SIIG_2S1P_10x_850 0x1036 #define PCI_DEVICE_ID_SIIG_4S_10x_550 0x1050 #define PCI_DEVICE_ID_SIIG_4S_10x_650 0x1051 #define PCI_DEVICE_ID_SIIG_4S_10x_850 0x1052 #define PCI_DEVICE_ID_SIIG_1S_20x_550 0x2000 #define PCI_DEVICE_ID_SIIG_1S_20x_650 0x2001 #define PCI_DEVICE_ID_SIIG_1S_20x_850 0x2002 #define PCI_DEVICE_ID_SIIG_1P_20x 0x2020 #define PCI_DEVICE_ID_SIIG_2P_20x 0x2021 #define PCI_DEVICE_ID_SIIG_2S_20x_550 0x2030 #define PCI_DEVICE_ID_SIIG_2S_20x_650 0x2031 #define PCI_DEVICE_ID_SIIG_2S_20x_850 0x2032 #define PCI_DEVICE_ID_SIIG_2P1S_20x_550 0x2040 #define PCI_DEVICE_ID_SIIG_2P1S_20x_650 0x2041 #define PCI_DEVICE_ID_SIIG_2P1S_20x_850 0x2042 #define PCI_DEVICE_ID_SIIG_1S1P_20x_550 0x2010 #define PCI_DEVICE_ID_SIIG_1S1P_20x_650 0x2011 #define PCI_DEVICE_ID_SIIG_1S1P_20x_850 0x2012 #define PCI_DEVICE_ID_SIIG_4S_20x_550 0x2050 #define PCI_DEVICE_ID_SIIG_4S_20x_650 0x2051 #define PCI_DEVICE_ID_SIIG_4S_20x_850 0x2052 #define PCI_DEVICE_ID_SIIG_2S1P_20x_550 0x2060 #define PCI_DEVICE_ID_SIIG_2S1P_20x_650 0x2061 #define PCI_DEVICE_ID_SIIG_2S1P_20x_850 0x2062 #define PCI_DEVICE_ID_SIIG_8S_20x_550 0x2080 #define PCI_DEVICE_ID_SIIG_8S_20x_650 0x2081 #define PCI_DEVICE_ID_SIIG_8S_20x_850 0x2082 #define PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL 0x2050 #define PCI_VENDOR_ID_RADISYS 0x1331 #define PCI_VENDOR_ID_DOMEX 0x134a #define PCI_DEVICE_ID_DOMEX_DMX3191D 0x0001 #define PCI_VENDOR_ID_INTASHIELD 0x135a #define PCI_DEVICE_ID_INTASHIELD_IS200 0x0d80 #define PCI_VENDOR_ID_QUATECH 0x135C #define PCI_DEVICE_ID_QUATECH_QSC100 0x0010 #define PCI_DEVICE_ID_QUATECH_DSC100 0x0020 #define PCI_DEVICE_ID_QUATECH_ESC100D 0x0050 #define PCI_DEVICE_ID_QUATECH_ESC100M 0x0060 #define PCI_VENDOR_ID_SEALEVEL 0x135e #define PCI_DEVICE_ID_SEALEVEL_U530 0x7101 #define PCI_DEVICE_ID_SEALEVEL_UCOMM2 0x7201 #define PCI_DEVICE_ID_SEALEVEL_UCOMM422 0x7402 #define PCI_DEVICE_ID_SEALEVEL_UCOMM232 0x7202 #define PCI_DEVICE_ID_SEALEVEL_COMM4 0x7401 #define PCI_DEVICE_ID_SEALEVEL_COMM8 0x7801 #define PCI_DEVICE_ID_SEALEVEL_UCOMM8 0x7804 #define PCI_VENDOR_ID_HYPERCOPE 0x1365 #define PCI_DEVICE_ID_HYPERCOPE_PLX 0x9050 #define PCI_SUBDEVICE_ID_HYPERCOPE_OLD_ERGO 0x0104 #define PCI_SUBDEVICE_ID_HYPERCOPE_ERGO 0x0106 #define PCI_SUBDEVICE_ID_HYPERCOPE_METRO 0x0107 #define PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2 0x0108 #define PCI_VENDOR_ID_KAWASAKI 0x136b #define PCI_DEVICE_ID_MCHIP_KL5A72002 0xff01 #define PCI_VENDOR_ID_CNET 0x1371 #define PCI_DEVICE_ID_CNET_GIGACARD 0x434e #define PCI_VENDOR_ID_LMC 0x1376 #define PCI_DEVICE_ID_LMC_HSSI 0x0003 #define PCI_DEVICE_ID_LMC_DS3 0x0004 #define PCI_DEVICE_ID_LMC_SSI 0x0005 #define PCI_DEVICE_ID_LMC_T1 0x0006 #define PCI_VENDOR_ID_NETGEAR 0x1385 #define PCI_DEVICE_ID_NETGEAR_GA620 0x620a #define PCI_VENDOR_ID_APPLICOM 0x1389 #define PCI_DEVICE_ID_APPLICOM_PCIGENERIC 0x0001 #define PCI_DEVICE_ID_APPLICOM_PCI2000IBS_CAN 0x0002 #define PCI_DEVICE_ID_APPLICOM_PCI2000PFB 0x0003 #define PCI_VENDOR_ID_MOXA 0x1393 #define PCI_DEVICE_ID_MOXA_RC7000 0x0001 #define PCI_DEVICE_ID_MOXA_CP102 0x1020 #define PCI_DEVICE_ID_MOXA_CP102UL 0x1021 #define PCI_DEVICE_ID_MOXA_CP102U 0x1022 #define PCI_DEVICE_ID_MOXA_C104 0x1040 #define PCI_DEVICE_ID_MOXA_CP104U 0x1041 #define PCI_DEVICE_ID_MOXA_CP104JU 0x1042 #define PCI_DEVICE_ID_MOXA_CT114 0x1140 #define PCI_DEVICE_ID_MOXA_CP114 0x1141 #define PCI_DEVICE_ID_MOXA_CP118U 0x1180 #define PCI_DEVICE_ID_MOXA_CP132 0x1320 #define PCI_DEVICE_ID_MOXA_CP132U 0x1321 #define PCI_DEVICE_ID_MOXA_CP134U 0x1340 #define PCI_DEVICE_ID_MOXA_C168 0x1680 #define PCI_DEVICE_ID_MOXA_CP168U 0x1681 #define PCI_VENDOR_ID_CCD 0x1397 #define PCI_DEVICE_ID_CCD_2BD0 0x2bd0 #define PCI_DEVICE_ID_CCD_B000 0xb000 #define PCI_DEVICE_ID_CCD_B006 0xb006 #define PCI_DEVICE_ID_CCD_B007 0xb007 #define PCI_DEVICE_ID_CCD_B008 0xb008 #define PCI_DEVICE_ID_CCD_B009 0xb009 #define PCI_DEVICE_ID_CCD_B00A 0xb00a #define PCI_DEVICE_ID_CCD_B00B 0xb00b #define PCI_DEVICE_ID_CCD_B00C 0xb00c #define PCI_DEVICE_ID_CCD_B100 0xb100 #define PCI_DEVICE_ID_CCD_B700 0xb700 #define PCI_DEVICE_ID_CCD_B701 0xb701 #define PCI_VENDOR_ID_EXAR 0x13a8 #define PCI_DEVICE_ID_EXAR_XR17C152 0x0152 #define PCI_DEVICE_ID_EXAR_XR17C154 0x0154 #define PCI_DEVICE_ID_EXAR_XR17C158 0x0158 #define PCI_VENDOR_ID_MICROGATE 0x13c0 #define PCI_DEVICE_ID_MICROGATE_USC 0x0010 #define PCI_DEVICE_ID_MICROGATE_SCA 0x0030 #define PCI_VENDOR_ID_3WARE 0x13C1 #define PCI_DEVICE_ID_3WARE_1000 0x1000 #define PCI_DEVICE_ID_3WARE_7000 0x1001 #define PCI_DEVICE_ID_3WARE_9000 0x1002 #define PCI_VENDOR_ID_IOMEGA 0x13ca #define PCI_DEVICE_ID_IOMEGA_BUZ 0x4231 #define PCI_VENDOR_ID_ABOCOM 0x13D1 #define PCI_DEVICE_ID_ABOCOM_2BD1 0x2BD1 #define PCI_VENDOR_ID_CMEDIA 0x13f6 #define PCI_DEVICE_ID_CMEDIA_CM8338A 0x0100 #define PCI_DEVICE_ID_CMEDIA_CM8338B 0x0101 #define PCI_DEVICE_ID_CMEDIA_CM8738 0x0111 #define PCI_DEVICE_ID_CMEDIA_CM8738B 0x0112 #define PCI_VENDOR_ID_LAVA 0x1407 #define PCI_DEVICE_ID_LAVA_DSERIAL 0x0100 #define PCI_DEVICE_ID_LAVA_QUATRO_A 0x0101 #define PCI_DEVICE_ID_LAVA_QUATRO_B 0x0102 #define PCI_DEVICE_ID_LAVA_OCTO_A 0x0180 #define PCI_DEVICE_ID_LAVA_OCTO_B 0x0181 #define PCI_DEVICE_ID_LAVA_PORT_PLUS 0x0200 #define PCI_DEVICE_ID_LAVA_QUAD_A 0x0201 #define PCI_DEVICE_ID_LAVA_QUAD_B 0x0202 #define PCI_DEVICE_ID_LAVA_SSERIAL 0x0500 #define PCI_DEVICE_ID_LAVA_PORT_650 0x0600 #define PCI_DEVICE_ID_LAVA_PARALLEL 0x8000 #define PCI_DEVICE_ID_LAVA_DUAL_PAR_A 0x8002 #define PCI_DEVICE_ID_LAVA_DUAL_PAR_B 0x8003 #define PCI_DEVICE_ID_LAVA_BOCA_IOPPAR 0x8800 #define PCI_VENDOR_ID_TIMEDIA 0x1409 #define PCI_DEVICE_ID_TIMEDIA_1889 0x7168 #define PCI_VENDOR_ID_ICE 0x1412 #define PCI_DEVICE_ID_ICE_1712 0x1712 #define PCI_DEVICE_ID_VT1724 0x1724 #define PCI_VENDOR_ID_OXSEMI 0x1415 #define PCI_DEVICE_ID_OXSEMI_12PCI840 0x8403 #define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501 #define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511 #define PCI_DEVICE_ID_OXSEMI_16PCI954PP 0x9513 #define PCI_DEVICE_ID_OXSEMI_16PCI952 0x9521 #define PCI_VENDOR_ID_SAMSUNG 0x144d #define PCI_VENDOR_ID_MYRICOM 0x14c1 #define PCI_VENDOR_ID_TITAN 0x14D2 #define PCI_DEVICE_ID_TITAN_010L 0x8001 #define PCI_DEVICE_ID_TITAN_100L 0x8010 #define PCI_DEVICE_ID_TITAN_110L 0x8011 #define PCI_DEVICE_ID_TITAN_200L 0x8020 #define PCI_DEVICE_ID_TITAN_210L 0x8021 #define PCI_DEVICE_ID_TITAN_400L 0x8040 #define PCI_DEVICE_ID_TITAN_800L 0x8080 #define PCI_DEVICE_ID_TITAN_100 0xA001 #define PCI_DEVICE_ID_TITAN_200 0xA005 #define PCI_DEVICE_ID_TITAN_400 0xA003 #define PCI_DEVICE_ID_TITAN_800B 0xA004 #define PCI_VENDOR_ID_PANACOM 0x14d4 #define PCI_DEVICE_ID_PANACOM_QUADMODEM 0x0400 #define PCI_DEVICE_ID_PANACOM_DUALMODEM 0x0402 #define PCI_VENDOR_ID_AFAVLAB 0x14db #define PCI_DEVICE_ID_AFAVLAB_P028 0x2180 #define PCI_DEVICE_ID_AFAVLAB_P030 0x2182 #define PCI_SUBDEVICE_ID_AFAVLAB_P061 0x2150 #define PCI_VENDOR_ID_BROADCOM 0x14e4 #define PCI_DEVICE_ID_TIGON3_5752 0x1600 #define PCI_DEVICE_ID_TIGON3_5752M 0x1601 #define PCI_DEVICE_ID_TIGON3_5700 0x1644 #define PCI_DEVICE_ID_TIGON3_5701 0x1645 #define PCI_DEVICE_ID_TIGON3_5702 0x1646 #define PCI_DEVICE_ID_TIGON3_5703 0x1647 #define PCI_DEVICE_ID_TIGON3_5704 0x1648 #define PCI_DEVICE_ID_TIGON3_5704S_2 0x1649 #define PCI_DEVICE_ID_NX2_5706 0x164a #define PCI_DEVICE_ID_NX2_5708 0x164c #define PCI_DEVICE_ID_TIGON3_5702FE 0x164d #define PCI_DEVICE_ID_TIGON3_5705 0x1653 #define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 #define PCI_DEVICE_ID_TIGON3_5720 0x1658 #define PCI_DEVICE_ID_TIGON3_5721 0x1659 #define PCI_DEVICE_ID_TIGON3_5705M 0x165d #define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e #define PCI_DEVICE_ID_TIGON3_5714 0x1668 #define PCI_DEVICE_ID_TIGON3_5714S 0x1669 #define PCI_DEVICE_ID_TIGON3_5780 0x166a #define PCI_DEVICE_ID_TIGON3_5780S 0x166b #define PCI_DEVICE_ID_TIGON3_5705F 0x166e #define PCI_DEVICE_ID_TIGON3_5754M 0x1672 #define PCI_DEVICE_ID_TIGON3_5755M 0x1673 #define PCI_DEVICE_ID_TIGON3_5750 0x1676 #define PCI_DEVICE_ID_TIGON3_5751 0x1677 #define PCI_DEVICE_ID_TIGON3_5715 0x1678 #define PCI_DEVICE_ID_TIGON3_5715S 0x1679 #define PCI_DEVICE_ID_TIGON3_5754 0x167a #define PCI_DEVICE_ID_TIGON3_5755 0x167b #define PCI_DEVICE_ID_TIGON3_5750M 0x167c #define PCI_DEVICE_ID_TIGON3_5751M 0x167d #define PCI_DEVICE_ID_TIGON3_5751F 0x167e #define PCI_DEVICE_ID_TIGON3_5787M 0x1693 #define PCI_DEVICE_ID_TIGON3_5782 0x1696 #define PCI_DEVICE_ID_TIGON3_5786 0x169a #define PCI_DEVICE_ID_TIGON3_5787 0x169b #define PCI_DEVICE_ID_TIGON3_5788 0x169c #define PCI_DEVICE_ID_TIGON3_5789 0x169d #define PCI_DEVICE_ID_TIGON3_5702X 0x16a6 #define PCI_DEVICE_ID_TIGON3_5703X 0x16a7 #define PCI_DEVICE_ID_TIGON3_5704S 0x16a8 #define PCI_DEVICE_ID_NX2_5706S 0x16aa #define PCI_DEVICE_ID_NX2_5708S 0x16ac #define PCI_DEVICE_ID_TIGON3_5702A3 0x16c6 #define PCI_DEVICE_ID_TIGON3_5703A3 0x16c7 #define PCI_DEVICE_ID_TIGON3_5781 0x16dd #define PCI_DEVICE_ID_TIGON3_5753 0x16f7 #define PCI_DEVICE_ID_TIGON3_5753M 0x16fd #define PCI_DEVICE_ID_TIGON3_5753F 0x16fe #define PCI_DEVICE_ID_TIGON3_5901 0x170d #define PCI_DEVICE_ID_BCM4401B1 0x170c #define PCI_DEVICE_ID_TIGON3_5901_2 0x170e #define PCI_DEVICE_ID_BCM4401 0x4401 #define PCI_DEVICE_ID_BCM4401B0 0x4402 #define PCI_VENDOR_ID_TOPIC 0x151f #define PCI_DEVICE_ID_TOPIC_TP560 0x0000 #define PCI_VENDOR_ID_ENE 0x1524 #define PCI_DEVICE_ID_ENE_1211 0x1211 #define PCI_DEVICE_ID_ENE_1225 0x1225 #define PCI_DEVICE_ID_ENE_1410 0x1410 #define PCI_DEVICE_ID_ENE_710 0x1411 #define PCI_DEVICE_ID_ENE_712 0x1412 #define PCI_DEVICE_ID_ENE_1420 0x1420 #define PCI_DEVICE_ID_ENE_720 0x1421 #define PCI_DEVICE_ID_ENE_722 0x1422 #define PCI_VENDOR_ID_CHELSIO 0x1425 #define PCI_VENDOR_ID_SYBA 0x1592 #define PCI_DEVICE_ID_SYBA_2P_EPP 0x0782 #define PCI_DEVICE_ID_SYBA_1P_ECP 0x0783 #define PCI_VENDOR_ID_MORETON 0x15aa #define PCI_DEVICE_ID_RASTEL_2PORT 0x2000 #define PCI_VENDOR_ID_ZOLTRIX 0x15b0 #define PCI_DEVICE_ID_ZOLTRIX_2BD0 0x2bd0 #define PCI_VENDOR_ID_MELLANOX 0x15b3 #define PCI_DEVICE_ID_MELLANOX_TAVOR 0x5a44 #define PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE 0x5a46 #define PCI_DEVICE_ID_MELLANOX_ARBEL_COMPAT 0x6278 #define PCI_DEVICE_ID_MELLANOX_ARBEL 0x6282 #define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c #define PCI_DEVICE_ID_MELLANOX_SINAI 0x6274 #define PCI_VENDOR_ID_PDC 0x15e9 #define PCI_VENDOR_ID_FARSITE 0x1619 #define PCI_DEVICE_ID_FARSITE_T2P 0x0400 #define PCI_DEVICE_ID_FARSITE_T4P 0x0440 #define PCI_DEVICE_ID_FARSITE_T1U 0x0610 #define PCI_DEVICE_ID_FARSITE_T2U 0x0620 #define PCI_DEVICE_ID_FARSITE_T4U 0x0640 #define PCI_DEVICE_ID_FARSITE_TE1 0x1610 #define PCI_DEVICE_ID_FARSITE_TE1C 0x1612 #define PCI_VENDOR_ID_SIBYTE 0x166d #define PCI_DEVICE_ID_BCM1250_HT 0x0002 #define PCI_VENDOR_ID_NETCELL 0x169c #define PCI_DEVICE_ID_REVOLUTION 0x0044 #define PCI_VENDOR_ID_VITESSE 0x1725 #define PCI_DEVICE_ID_VITESSE_VSC7174 0x7174 #define PCI_VENDOR_ID_LINKSYS 0x1737 #define PCI_DEVICE_ID_LINKSYS_EG1064 0x1064 #define PCI_VENDOR_ID_ALTIMA 0x173b #define PCI_DEVICE_ID_ALTIMA_AC1000 0x03e8 #define PCI_DEVICE_ID_ALTIMA_AC1001 0x03e9 #define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea #define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb #define PCI_VENDOR_ID_S2IO 0x17d5 #define PCI_DEVICE_ID_S2IO_WIN 0x5731 #define PCI_DEVICE_ID_S2IO_UNI 0x5831 #define PCI_DEVICE_ID_HERC_WIN 0x5732 #define PCI_DEVICE_ID_HERC_UNI 0x5832 #define PCI_VENDOR_ID_SITECOM 0x182d #define PCI_DEVICE_ID_SITECOM_DC105V2 0x3069 #define PCI_VENDOR_ID_TOPSPIN 0x1867 #define PCI_VENDOR_ID_TDI 0x192E #define PCI_DEVICE_ID_TDI_EHCI 0x0101 #define PCI_VENDOR_ID_JMICRON 0x197B #define PCI_DEVICE_ID_JMICRON_JMB360 0x2360 #define PCI_DEVICE_ID_JMICRON_JMB361 0x2361 #define PCI_DEVICE_ID_JMICRON_JMB363 0x2363 #define PCI_DEVICE_ID_JMICRON_JMB365 0x2365 #define PCI_DEVICE_ID_JMICRON_JMB366 0x2366 #define PCI_DEVICE_ID_JMICRON_JMB368 0x2368 #define PCI_VENDOR_ID_TEKRAM 0x1de1 #define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 #define PCI_VENDOR_ID_HINT 0x3388 #define PCI_DEVICE_ID_HINT_VXPROII_IDE 0x8013 #define PCI_VENDOR_ID_3DLABS 0x3d3d #define PCI_DEVICE_ID_3DLABS_PERMEDIA2 0x0007 #define PCI_DEVICE_ID_3DLABS_PERMEDIA2V 0x0009 #define PCI_VENDOR_ID_AKS 0x416c #define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100 #define PCI_VENDOR_ID_S3 0x5333 #define PCI_DEVICE_ID_S3_TRIO 0x8811 #define PCI_DEVICE_ID_S3_868 0x8880 #define PCI_DEVICE_ID_S3_968 0x88f0 #define PCI_DEVICE_ID_S3_SAVAGE4 0x8a25 #define PCI_DEVICE_ID_S3_PROSAVAGE8 0x8d04 #define PCI_DEVICE_ID_S3_SONICVIBES 0xca00 #define PCI_VENDOR_ID_DUNORD 0x5544 #define PCI_DEVICE_ID_DUNORD_I3000 0x0001 #define PCI_VENDOR_ID_DCI 0x6666 #define PCI_DEVICE_ID_DCI_PCCOM4 0x0001 #define PCI_DEVICE_ID_DCI_PCCOM8 0x0002 #define PCI_DEVICE_ID_DCI_PCCOM2 0x0004 #define PCI_VENDOR_ID_INTEL 0x8086 #define PCI_DEVICE_ID_INTEL_EESSC 0x0008 #define PCI_DEVICE_ID_INTEL_PXHD_0 0x0320 #define PCI_DEVICE_ID_INTEL_PXHD_1 0x0321 #define PCI_DEVICE_ID_INTEL_PXH_0 0x0329 #define PCI_DEVICE_ID_INTEL_PXH_1 0x032A #define PCI_DEVICE_ID_INTEL_PXHV 0x032C #define PCI_DEVICE_ID_INTEL_82375 0x0482 #define PCI_DEVICE_ID_INTEL_82424 0x0483 #define PCI_DEVICE_ID_INTEL_82378 0x0484 #define PCI_DEVICE_ID_INTEL_I960 0x0960 #define PCI_DEVICE_ID_INTEL_I960RM 0x0962 #define PCI_DEVICE_ID_INTEL_82815_MC 0x1130 #define PCI_DEVICE_ID_INTEL_82815_CGC 0x1132 #define PCI_DEVICE_ID_INTEL_82092AA_0 0x1221 #define PCI_DEVICE_ID_INTEL_7505_0 0x2550 #define PCI_DEVICE_ID_INTEL_7205_0 0x255d #define PCI_DEVICE_ID_INTEL_82437 0x122d #define PCI_DEVICE_ID_INTEL_82371FB_0 0x122e #define PCI_DEVICE_ID_INTEL_82371FB_1 0x1230 #define PCI_DEVICE_ID_INTEL_82371MX 0x1234 #define PCI_DEVICE_ID_INTEL_82441 0x1237 #define PCI_DEVICE_ID_INTEL_82380FB 0x124b #define PCI_DEVICE_ID_INTEL_82439 0x1250 #define PCI_DEVICE_ID_INTEL_80960_RP 0x1960 #define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21 #define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30 #define PCI_DEVICE_ID_INTEL_IOAT 0x1a38 #define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 #define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 #define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 #define PCI_DEVICE_ID_INTEL_82801AA_5 0x2415 #define PCI_DEVICE_ID_INTEL_82801AA_6 0x2416 #define PCI_DEVICE_ID_INTEL_82801AA_8 0x2418 #define PCI_DEVICE_ID_INTEL_82801AB_0 0x2420 #define PCI_DEVICE_ID_INTEL_82801AB_1 0x2421 #define PCI_DEVICE_ID_INTEL_82801AB_3 0x2423 #define PCI_DEVICE_ID_INTEL_82801AB_5 0x2425 #define PCI_DEVICE_ID_INTEL_82801AB_6 0x2426 #define PCI_DEVICE_ID_INTEL_82801AB_8 0x2428 #define PCI_DEVICE_ID_INTEL_82801BA_0 0x2440 #define PCI_DEVICE_ID_INTEL_82801BA_2 0x2443 #define PCI_DEVICE_ID_INTEL_82801BA_4 0x2445 #define PCI_DEVICE_ID_INTEL_82801BA_6 0x2448 #define PCI_DEVICE_ID_INTEL_82801BA_8 0x244a #define PCI_DEVICE_ID_INTEL_82801BA_9 0x244b #define PCI_DEVICE_ID_INTEL_82801BA_10 0x244c #define PCI_DEVICE_ID_INTEL_82801BA_11 0x244e #define PCI_DEVICE_ID_INTEL_82801E_0 0x2450 #define PCI_DEVICE_ID_INTEL_82801E_11 0x245b #define PCI_DEVICE_ID_INTEL_82801CA_0 0x2480 #define PCI_DEVICE_ID_INTEL_82801CA_3 0x2483 #define PCI_DEVICE_ID_INTEL_82801CA_5 0x2485 #define PCI_DEVICE_ID_INTEL_82801CA_6 0x2486 #define PCI_DEVICE_ID_INTEL_82801CA_10 0x248a #define PCI_DEVICE_ID_INTEL_82801CA_11 0x248b #define PCI_DEVICE_ID_INTEL_82801CA_12 0x248c #define PCI_DEVICE_ID_INTEL_82801DB_0 0x24c0 #define PCI_DEVICE_ID_INTEL_82801DB_1 0x24c1 #define PCI_DEVICE_ID_INTEL_82801DB_3 0x24c3 #define PCI_DEVICE_ID_INTEL_82801DB_5 0x24c5 #define PCI_DEVICE_ID_INTEL_82801DB_6 0x24c6 #define PCI_DEVICE_ID_INTEL_82801DB_9 0x24c9 #define PCI_DEVICE_ID_INTEL_82801DB_10 0x24ca #define PCI_DEVICE_ID_INTEL_82801DB_11 0x24cb #define PCI_DEVICE_ID_INTEL_82801DB_12 0x24cc #define PCI_DEVICE_ID_INTEL_82801EB_0 0x24d0 #define PCI_DEVICE_ID_INTEL_82801EB_1 0x24d1 #define PCI_DEVICE_ID_INTEL_82801EB_3 0x24d3 #define PCI_DEVICE_ID_INTEL_82801EB_5 0x24d5 #define PCI_DEVICE_ID_INTEL_82801EB_6 0x24d6 #define PCI_DEVICE_ID_INTEL_82801EB_11 0x24db #define PCI_DEVICE_ID_INTEL_82801EB_13 0x24dd #define PCI_DEVICE_ID_INTEL_ESB_1 0x25a1 #define PCI_DEVICE_ID_INTEL_ESB_2 0x25a2 #define PCI_DEVICE_ID_INTEL_ESB_4 0x25a4 #define PCI_DEVICE_ID_INTEL_ESB_5 0x25a6 #define PCI_DEVICE_ID_INTEL_ESB_9 0x25ab #define PCI_DEVICE_ID_INTEL_82820_HB 0x2500 #define PCI_DEVICE_ID_INTEL_82820_UP_HB 0x2501 #define PCI_DEVICE_ID_INTEL_82850_HB 0x2530 #define PCI_DEVICE_ID_INTEL_82860_HB 0x2531 #define PCI_DEVICE_ID_INTEL_E7501_MCH 0x254c #define PCI_DEVICE_ID_INTEL_82845G_HB 0x2560 #define PCI_DEVICE_ID_INTEL_82845G_IG 0x2562 #define PCI_DEVICE_ID_INTEL_82865_HB 0x2570 #define PCI_DEVICE_ID_INTEL_82865_IG 0x2572 #define PCI_DEVICE_ID_INTEL_82875_HB 0x2578 #define PCI_DEVICE_ID_INTEL_82915G_HB 0x2580 #define PCI_DEVICE_ID_INTEL_82915G_IG 0x2582 #define PCI_DEVICE_ID_INTEL_82915GM_HB 0x2590 #define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592 #define PCI_DEVICE_ID_INTEL_82945G_HB 0x2770 #define PCI_DEVICE_ID_INTEL_82945G_IG 0x2772 #define PCI_DEVICE_ID_INTEL_82945GM_HB 0x27A0 #define PCI_DEVICE_ID_INTEL_82945GM_IG 0x27A2 #define PCI_DEVICE_ID_INTEL_ICH6_0 0x2640 #define PCI_DEVICE_ID_INTEL_ICH6_1 0x2641 #define PCI_DEVICE_ID_INTEL_ICH6_2 0x2642 #define PCI_DEVICE_ID_INTEL_ICH6_16 0x266a #define PCI_DEVICE_ID_INTEL_ICH6_17 0x266d #define PCI_DEVICE_ID_INTEL_ICH6_18 0x266e #define PCI_DEVICE_ID_INTEL_ICH6_19 0x266f #define PCI_DEVICE_ID_INTEL_ESB2_0 0x2670 #define PCI_DEVICE_ID_INTEL_ESB2_14 0x2698 #define PCI_DEVICE_ID_INTEL_ESB2_17 0x269b #define PCI_DEVICE_ID_INTEL_ESB2_18 0x269e #define PCI_DEVICE_ID_INTEL_ICH7_0 0x27b8 #define PCI_DEVICE_ID_INTEL_ICH7_1 0x27b9 #define PCI_DEVICE_ID_INTEL_ICH7_30 0x27b0 #define PCI_DEVICE_ID_INTEL_ICH7_31 0x27bd #define PCI_DEVICE_ID_INTEL_ICH7_17 0x27da #define PCI_DEVICE_ID_INTEL_ICH7_19 0x27dd #define PCI_DEVICE_ID_INTEL_ICH7_20 0x27de #define PCI_DEVICE_ID_INTEL_ICH7_21 0x27df #define PCI_DEVICE_ID_INTEL_ICH8_0 0x2810 #define PCI_DEVICE_ID_INTEL_ICH8_1 0x2811 #define PCI_DEVICE_ID_INTEL_ICH8_2 0x2812 #define PCI_DEVICE_ID_INTEL_ICH8_3 0x2814 #define PCI_DEVICE_ID_INTEL_ICH8_4 0x2815 #define PCI_DEVICE_ID_INTEL_ICH8_5 0x283e #define PCI_DEVICE_ID_INTEL_ICH8_6 0x2850 #define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 #define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 #define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 #define PCI_DEVICE_ID_INTEL_82855GM_HB 0x3580 #define PCI_DEVICE_ID_INTEL_82855GM_IG 0x3582 #define PCI_DEVICE_ID_INTEL_E7520_MCH 0x3590 #define PCI_DEVICE_ID_INTEL_E7320_MCH 0x3592 #define PCI_DEVICE_ID_INTEL_MCH_PA 0x3595 #define PCI_DEVICE_ID_INTEL_MCH_PA1 0x3596 #define PCI_DEVICE_ID_INTEL_MCH_PB 0x3597 #define PCI_DEVICE_ID_INTEL_MCH_PB1 0x3598 #define PCI_DEVICE_ID_INTEL_MCH_PC 0x3599 #define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a #define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e #define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000 #define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010 #define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020 #define PCI_DEVICE_ID_INTEL_82437VX 0x7030 #define PCI_DEVICE_ID_INTEL_82439TX 0x7100 #define PCI_DEVICE_ID_INTEL_82371AB_0 0x7110 #define PCI_DEVICE_ID_INTEL_82371AB 0x7111 #define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112 #define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113 #define PCI_DEVICE_ID_INTEL_82810_MC1 0x7120 #define PCI_DEVICE_ID_INTEL_82810_IG1 0x7121 #define PCI_DEVICE_ID_INTEL_82810_MC3 0x7122 #define PCI_DEVICE_ID_INTEL_82810_IG3 0x7123 #define PCI_DEVICE_ID_INTEL_82810E_MC 0x7124 #define PCI_DEVICE_ID_INTEL_82810E_IG 0x7125 #define PCI_DEVICE_ID_INTEL_82443LX_0 0x7180 #define PCI_DEVICE_ID_INTEL_82443LX_1 0x7181 #define PCI_DEVICE_ID_INTEL_82443BX_0 0x7190 #define PCI_DEVICE_ID_INTEL_82443BX_1 0x7191 #define PCI_DEVICE_ID_INTEL_82443BX_2 0x7192 #define PCI_DEVICE_ID_INTEL_440MX 0x7195 #define PCI_DEVICE_ID_INTEL_440MX_6 0x7196 #define PCI_DEVICE_ID_INTEL_82443MX_0 0x7198 #define PCI_DEVICE_ID_INTEL_82443MX_1 0x7199 #define PCI_DEVICE_ID_INTEL_82443MX_3 0x719b #define PCI_DEVICE_ID_INTEL_82443GX_0 0x71a0 #define PCI_DEVICE_ID_INTEL_82443GX_2 0x71a2 #define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601 #define PCI_DEVICE_ID_INTEL_82454GX 0x84c4 #define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 #define PCI_DEVICE_ID_INTEL_82451NX 0x84ca #define PCI_DEVICE_ID_INTEL_82454NX 0x84cb #define PCI_DEVICE_ID_INTEL_84460GX 0x84ea #define PCI_DEVICE_ID_INTEL_IXP4XX 0x8500 #define PCI_DEVICE_ID_INTEL_IXP2800 0x9004 #define PCI_DEVICE_ID_INTEL_S21152BB 0xb152 #define PCI_VENDOR_ID_SCALEMP 0x8686 #define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010 #define PCI_VENDOR_ID_COMPUTONE 0x8e0e #define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291 #define PCI_DEVICE_ID_COMPUTONE_PG 0x0302 #define PCI_SUBVENDOR_ID_COMPUTONE 0x8e0e #define PCI_SUBDEVICE_ID_COMPUTONE_PG4 0x0001 #define PCI_SUBDEVICE_ID_COMPUTONE_PG8 0x0002 #define PCI_SUBDEVICE_ID_COMPUTONE_PG6 0x0003 #define PCI_VENDOR_ID_KTI 0x8e2e #define PCI_VENDOR_ID_ADAPTEC 0x9004 #define PCI_DEVICE_ID_ADAPTEC_7810 0x1078 #define PCI_DEVICE_ID_ADAPTEC_7821 0x2178 #define PCI_DEVICE_ID_ADAPTEC_38602 0x3860 #define PCI_DEVICE_ID_ADAPTEC_7850 0x5078 #define PCI_DEVICE_ID_ADAPTEC_7855 0x5578 #define PCI_DEVICE_ID_ADAPTEC_3860 0x6038 #define PCI_DEVICE_ID_ADAPTEC_1480A 0x6075 #define PCI_DEVICE_ID_ADAPTEC_7860 0x6078 #define PCI_DEVICE_ID_ADAPTEC_7861 0x6178 #define PCI_DEVICE_ID_ADAPTEC_7870 0x7078 #define PCI_DEVICE_ID_ADAPTEC_7871 0x7178 #define PCI_DEVICE_ID_ADAPTEC_7872 0x7278 #define PCI_DEVICE_ID_ADAPTEC_7873 0x7378 #define PCI_DEVICE_ID_ADAPTEC_7874 0x7478 #define PCI_DEVICE_ID_ADAPTEC_7895 0x7895 #define PCI_DEVICE_ID_ADAPTEC_7880 0x8078 #define PCI_DEVICE_ID_ADAPTEC_7881 0x8178 #define PCI_DEVICE_ID_ADAPTEC_7882 0x8278 #define PCI_DEVICE_ID_ADAPTEC_7883 0x8378 #define PCI_DEVICE_ID_ADAPTEC_7884 0x8478 #define PCI_DEVICE_ID_ADAPTEC_7885 0x8578 #define PCI_DEVICE_ID_ADAPTEC_7886 0x8678 #define PCI_DEVICE_ID_ADAPTEC_7887 0x8778 #define PCI_DEVICE_ID_ADAPTEC_7888 0x8878 #define PCI_VENDOR_ID_ADAPTEC2 0x9005 #define PCI_DEVICE_ID_ADAPTEC2_2940U2 0x0010 #define PCI_DEVICE_ID_ADAPTEC2_2930U2 0x0011 #define PCI_DEVICE_ID_ADAPTEC2_7890B 0x0013 #define PCI_DEVICE_ID_ADAPTEC2_7890 0x001f #define PCI_DEVICE_ID_ADAPTEC2_3940U2 0x0050 #define PCI_DEVICE_ID_ADAPTEC2_3950U2D 0x0051 #define PCI_DEVICE_ID_ADAPTEC2_7896 0x005f #define PCI_DEVICE_ID_ADAPTEC2_7892A 0x0080 #define PCI_DEVICE_ID_ADAPTEC2_7892B 0x0081 #define PCI_DEVICE_ID_ADAPTEC2_7892D 0x0083 #define PCI_DEVICE_ID_ADAPTEC2_7892P 0x008f #define PCI_DEVICE_ID_ADAPTEC2_7899A 0x00c0 #define PCI_DEVICE_ID_ADAPTEC2_7899B 0x00c1 #define PCI_DEVICE_ID_ADAPTEC2_7899D 0x00c3 #define PCI_DEVICE_ID_ADAPTEC2_7899P 0x00cf #define PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN 0x0500 #define PCI_DEVICE_ID_ADAPTEC2_SCAMP 0x0503 #define PCI_VENDOR_ID_HOLTEK 0x9412 #define PCI_DEVICE_ID_HOLTEK_6565 0x6565 #define PCI_VENDOR_ID_NETMOS 0x9710 #define PCI_DEVICE_ID_NETMOS_9705 0x9705 #define PCI_DEVICE_ID_NETMOS_9715 0x9715 #define PCI_DEVICE_ID_NETMOS_9735 0x9735 #define PCI_DEVICE_ID_NETMOS_9745 0x9745 #define PCI_DEVICE_ID_NETMOS_9755 0x9755 #define PCI_DEVICE_ID_NETMOS_9805 0x9805 #define PCI_DEVICE_ID_NETMOS_9815 0x9815 #define PCI_DEVICE_ID_NETMOS_9835 0x9835 #define PCI_DEVICE_ID_NETMOS_9845 0x9845 #define PCI_DEVICE_ID_NETMOS_9855 0x9855 #define PCI_SUBVENDOR_ID_EXSYS 0xd84d #define PCI_SUBDEVICE_ID_EXSYS_4014 0x4014 #define PCI_SUBDEVICE_ID_EXSYS_4055 0x4055 #define PCI_VENDOR_ID_TIGERJET 0xe159 #define PCI_DEVICE_ID_TIGERJET_300 0x0001 #define PCI_DEVICE_ID_TIGERJET_100 0x0002 #define PCI_VENDOR_ID_TTTECH 0x0357 #define PCI_DEVICE_ID_TTTECH_MC322 0x000A #define PCI_VENDOR_ID_XILINX_RME 0xea60 #define PCI_DEVICE_ID_RME_DIGI32 0x9896 #define PCI_DEVICE_ID_RME_DIGI32_PRO 0x9897 #define PCI_DEVICE_ID_RME_DIGI32_8 0x9898 android-audiosystem-1.8+13.10.20130807/include/linux/skbuff.h0000644000015700001700000000634612200324306024116 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SKBUFF_H #define _LINUX_SKBUFF_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define HAVE_ALLOC_SKB #define HAVE_ALIGNABLE_SKB #define CHECKSUM_NONE 0 #define CHECKSUM_HW 1 #define CHECKSUM_UNNECESSARY 2 #define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & ~(SMP_CACHE_BYTES - 1)) #define SKB_MAX_ORDER(X, ORDER) (((PAGE_SIZE << (ORDER)) - (X) - sizeof(struct skb_shared_info)) & ~(SMP_CACHE_BYTES - 1)) #define SKB_MAX_HEAD(X) (SKB_MAX_ORDER((X), 0)) #define SKB_MAX_ALLOC (SKB_MAX_ORDER(0, 2)) struct net_device; struct sk_buff_head { struct sk_buff *next; struct sk_buff *prev; __u32 qlen; spinlock_t lock; }; struct sk_buff; #define MAX_SKB_FRAGS (65536/PAGE_SIZE + 2) typedef struct skb_frag_struct skb_frag_t; struct skb_frag_struct { struct page *page; __u16 page_offset; __u16 size; }; struct skb_shared_info { atomic_t dataref; unsigned short nr_frags; unsigned short gso_size; unsigned short gso_segs; unsigned short gso_type; unsigned int ip6_frag_id; struct sk_buff *frag_list; skb_frag_t frags[MAX_SKB_FRAGS]; }; #define SKB_DATAREF_SHIFT 16 #define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1) struct skb_timeval { u32 off_sec; u32 off_usec; }; enum { SKB_FCLONE_UNAVAILABLE, SKB_FCLONE_ORIG, SKB_FCLONE_CLONE, }; enum { SKB_GSO_TCPV4 = 1 << 0, SKB_GSO_UDP = 1 << 1, SKB_GSO_DODGY = 1 << 2, SKB_GSO_TCP_ECN = 1 << 3, SKB_GSO_TCPV6 = 1 << 4, }; struct sk_buff { struct sk_buff *next; struct sk_buff *prev; struct sock *sk; struct skb_timeval tstamp; struct net_device *dev; struct net_device *input_dev; union { struct tcphdr *th; struct udphdr *uh; struct icmphdr *icmph; struct igmphdr *igmph; struct iphdr *ipiph; struct ipv6hdr *ipv6h; unsigned char *raw; } h; union { struct iphdr *iph; struct ipv6hdr *ipv6h; struct arphdr *arph; unsigned char *raw; } nh; union { unsigned char *raw; } mac; struct dst_entry *dst; struct sec_path *sp; char cb[48]; unsigned int len, data_len, mac_len, csum; __u32 priority; __u8 local_df:1, cloned:1, ip_summed:2, nohdr:1, nfctinfo:3; __u8 pkt_type:3, fclone:2, ipvs_property:1; __be16 protocol; void (*destructor)(struct sk_buff *skb); unsigned int truesize; atomic_t users; unsigned char *head, *data, *tail, *end; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/stddef.h0000644000015700001700000000177412200324306024107 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_STDDEF_H #define _LINUX_STDDEF_H #include #undef NULL #ifdef __cplusplus #define NULL 0 #else #define NULL ((void *)0) #endif #undef offsetof #ifdef __compiler_offsetof #define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER) #else #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/i2c.h0000644000015700001700000000651412200324306023310 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_I2C_H #define _LINUX_I2C_H #include struct i2c_msg { __u16 addr; __u16 flags; #define I2C_M_TEN 0x10 #define I2C_M_RD 0x01 #define I2C_M_NOSTART 0x4000 #define I2C_M_REV_DIR_ADDR 0x2000 #define I2C_M_IGNORE_NAK 0x1000 #define I2C_M_NO_RD_ACK 0x0800 __u16 len; __u8 *buf; }; #define I2C_FUNC_I2C 0x00000001 #define I2C_FUNC_10BIT_ADDR 0x00000002 #define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 #define I2C_FUNC_SMBUS_HWPEC_CALC 0x00000008 #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 #define I2C_FUNC_SMBUS_QUICK 0x00010000 #define I2C_FUNC_SMBUS_READ_BYTE 0x00020000 #define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000 #define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000 #define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000 #define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000 #define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000 #define I2C_FUNC_SMBUS_PROC_CALL 0x00800000 #define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000 #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 #define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 #define I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 0x10000000 #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2 0x20000000 #define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE) #define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | I2C_FUNC_SMBUS_WRITE_BYTE_DATA) #define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | I2C_FUNC_SMBUS_WRITE_WORD_DATA) #define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA) #define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK) #define I2C_FUNC_SMBUS_I2C_BLOCK_2 (I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2) #define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_PROC_CALL | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | I2C_FUNC_SMBUS_I2C_BLOCK) #define I2C_SMBUS_BLOCK_MAX 32 union i2c_smbus_data { __u8 byte; __u16 word; __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; }; #define I2C_SMBUS_READ 1 #define I2C_SMBUS_WRITE 0 #define I2C_SMBUS_QUICK 0 #define I2C_SMBUS_BYTE 1 #define I2C_SMBUS_BYTE_DATA 2 #define I2C_SMBUS_WORD_DATA 3 #define I2C_SMBUS_PROC_CALL 4 #define I2C_SMBUS_BLOCK_DATA 5 #define I2C_SMBUS_I2C_BLOCK_DATA 6 #define I2C_SMBUS_BLOCK_PROC_CALL 7 #define I2C_RETRIES 0x0701 #define I2C_TIMEOUT 0x0702 #define I2C_SLAVE 0x0703 #define I2C_SLAVE_FORCE 0x0706 #define I2C_TENBIT 0x0704 #define I2C_FUNCS 0x0705 #define I2C_RDWR 0x0707 #define I2C_PEC 0x0708 #define I2C_SMBUS 0x0720 #endif android-audiosystem-1.8+13.10.20130807/include/linux/ncp_no.h0000644000015700001700000000250512200324306024103 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _NCP_NO #define _NCP_NO #define aRONLY (__constant_cpu_to_le32(1)) #define aHIDDEN (__constant_cpu_to_le32(2)) #define aSYSTEM (__constant_cpu_to_le32(4)) #define aEXECUTE (__constant_cpu_to_le32(8)) #define aDIR (__constant_cpu_to_le32(0x10)) #define aARCH (__constant_cpu_to_le32(0x20)) #define aSHARED (__constant_cpu_to_le32(0x80)) #define aDONTSUBALLOCATE (__constant_cpu_to_le32(1L<<11)) #define aTRANSACTIONAL (__constant_cpu_to_le32(1L<<12)) #define aPURGE (__constant_cpu_to_le32(1L<<16)) #define aRENAMEINHIBIT (__constant_cpu_to_le32(1L<<17)) #define aDELETEINHIBIT (__constant_cpu_to_le32(1L<<18)) #define aDONTCOMPRESS (__constant_cpu_to_le32(1L<<27)) #endif android-audiosystem-1.8+13.10.20130807/include/linux/if_hippi.h0000644000015700001700000000435612200324306024424 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IF_HIPPI_H #define _LINUX_IF_HIPPI_H #include #define HIPPI_ALEN 6 #define HIPPI_HLEN sizeof(struct hippi_hdr) #define HIPPI_ZLEN 0 #define HIPPI_DATA_LEN 65280 #define HIPPI_FRAME_LEN (HIPPI_DATA_LEN + HIPPI_HLEN) #define HIPPI_EXTENDED_SAP 0xAA #define HIPPI_UI_CMD 0x03 struct hipnet_statistics { int rx_packets; int tx_packets; int rx_errors; int tx_errors; int rx_dropped; int tx_dropped; int rx_length_errors; int rx_over_errors; int rx_crc_errors; int rx_frame_errors; int rx_fifo_errors; int rx_missed_errors; int tx_aborted_errors; int tx_carrier_errors; int tx_fifo_errors; int tx_heartbeat_errors; int tx_window_errors; }; struct hippi_fp_hdr { __be32 fixed; __be32 d2_size; } __attribute__ ((packed)); struct hippi_le_hdr { #ifdef __BIG_ENDIAN_BITFIELD __u8 fc:3; __u8 double_wide:1; __u8 message_type:4; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 message_type:4; __u8 double_wide:1; __u8 fc:3; #endif __u8 dest_switch_addr[3]; #ifdef __BIG_ENDIAN_BITFIELD __u8 dest_addr_type:4, src_addr_type:4; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 src_addr_type:4, dest_addr_type:4; #endif __u8 src_switch_addr[3]; __u16 reserved; __u8 daddr[HIPPI_ALEN]; __u16 locally_administered; __u8 saddr[HIPPI_ALEN]; } __attribute__ ((packed)); #define HIPPI_OUI_LEN 3 struct hippi_snap_hdr { __u8 dsap; __u8 ssap; __u8 ctrl; __u8 oui[HIPPI_OUI_LEN]; __be16 ethertype; } __attribute__ ((packed)); struct hippi_hdr { struct hippi_fp_hdr fp; struct hippi_le_hdr le; struct hippi_snap_hdr snap; } __attribute__ ((packed)); #endif android-audiosystem-1.8+13.10.20130807/include/linux/if_vlan.h0000644000015700001700000000274112200324306024247 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IF_VLAN_H_ #define _LINUX_IF_VLAN_H_ enum vlan_ioctl_cmds { ADD_VLAN_CMD, DEL_VLAN_CMD, SET_VLAN_INGRESS_PRIORITY_CMD, SET_VLAN_EGRESS_PRIORITY_CMD, GET_VLAN_INGRESS_PRIORITY_CMD, GET_VLAN_EGRESS_PRIORITY_CMD, SET_VLAN_NAME_TYPE_CMD, SET_VLAN_FLAG_CMD, GET_VLAN_REALDEV_NAME_CMD, GET_VLAN_VID_CMD }; enum vlan_flags { VLAN_FLAG_REORDER_HDR = 0x1, VLAN_FLAG_GVRP = 0x2, VLAN_FLAG_LOOSE_BINDING = 0x4, }; enum vlan_name_types { VLAN_NAME_TYPE_PLUS_VID, VLAN_NAME_TYPE_RAW_PLUS_VID, VLAN_NAME_TYPE_PLUS_VID_NO_PAD, VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD, VLAN_NAME_TYPE_HIGHEST }; struct vlan_ioctl_args { int cmd; char device1[24]; union { char device2[24]; int VID; unsigned int skb_priority; unsigned int name_type; unsigned int bind_type; unsigned int flag; } u; short vlan_qos; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/icmp.h0000644000015700001700000000402212200324306023553 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ICMP_H #define _LINUX_ICMP_H #include #define ICMP_ECHOREPLY 0 #define ICMP_DEST_UNREACH 3 #define ICMP_SOURCE_QUENCH 4 #define ICMP_REDIRECT 5 #define ICMP_ECHO 8 #define ICMP_TIME_EXCEEDED 11 #define ICMP_PARAMETERPROB 12 #define ICMP_TIMESTAMP 13 #define ICMP_TIMESTAMPREPLY 14 #define ICMP_INFO_REQUEST 15 #define ICMP_INFO_REPLY 16 #define ICMP_ADDRESS 17 #define ICMP_ADDRESSREPLY 18 #define NR_ICMP_TYPES 18 #define ICMP_NET_UNREACH 0 #define ICMP_HOST_UNREACH 1 #define ICMP_PROT_UNREACH 2 #define ICMP_PORT_UNREACH 3 #define ICMP_FRAG_NEEDED 4 #define ICMP_SR_FAILED 5 #define ICMP_NET_UNKNOWN 6 #define ICMP_HOST_UNKNOWN 7 #define ICMP_HOST_ISOLATED 8 #define ICMP_NET_ANO 9 #define ICMP_HOST_ANO 10 #define ICMP_NET_UNR_TOS 11 #define ICMP_HOST_UNR_TOS 12 #define ICMP_PKT_FILTERED 13 #define ICMP_PREC_VIOLATION 14 #define ICMP_PREC_CUTOFF 15 #define NR_ICMP_UNREACH 15 #define ICMP_REDIR_NET 0 #define ICMP_REDIR_HOST 1 #define ICMP_REDIR_NETTOS 2 #define ICMP_REDIR_HOSTTOS 3 #define ICMP_EXC_TTL 0 #define ICMP_EXC_FRAGTIME 1 struct icmphdr { __u8 type; __u8 code; __u16 checksum; union { struct { __u16 id; __u16 sequence; } echo; __u32 gateway; struct { __u16 __unused_field; __u16 mtu; } frag; } un; }; #define ICMP_FILTER 1 struct icmp_filter { __u32 data; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/swab.h0000644000015700001700000000563112200324306023566 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SWAB_H #define _LINUX_SWAB_H #include #include #include #define ___constant_swab16(x) ((__u16)( (((__u16)(x) & (__u16)0x00ffU) << 8) | (((__u16)(x) & (__u16)0xff00U) >> 8))) #define ___constant_swab32(x) ((__u32)( (((__u32)(x) & (__u32)0x000000ffUL) << 24) | (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(x) & (__u32)0xff000000UL) >> 24))) #define ___constant_swab64(x) ((__u64)( (((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | (((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | (((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | (((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | (((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | (((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | (((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | (((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56))) #define ___constant_swahw32(x) ((__u32)( (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | (((__u32)(x) & (__u32)0xffff0000UL) >> 16))) #define ___constant_swahb32(x) ((__u32)( (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | (((__u32)(x) & (__u32)0xff00ff00UL) >> 8))) #ifdef __arch_swab16 #else #endif #ifdef __arch_swab32 #else #endif #ifdef __arch_swab64 #elif defined(__SWAB_64_THRU_32__) #else #endif #ifdef __arch_swahw32 #else #endif #ifdef __arch_swahb32 #else #endif #define __swab16(x) (__builtin_constant_p((__u16)(x)) ? ___constant_swab16(x) : __fswab16(x)) #define __swab32(x) (__builtin_constant_p((__u32)(x)) ? ___constant_swab32(x) : __fswab32(x)) #define __swab64(x) (__builtin_constant_p((__u64)(x)) ? ___constant_swab64(x) : __fswab64(x)) #define __swahw32(x) (__builtin_constant_p((__u32)(x)) ? ___constant_swahw32(x) : __fswahw32(x)) #define __swahb32(x) (__builtin_constant_p((__u32)(x)) ? ___constant_swahb32(x) : __fswahb32(x)) #ifdef __arch_swab16p #else #endif #ifdef __arch_swab32p #else #endif #ifdef __arch_swab64p #else #endif #ifdef __arch_swahw32p #else #endif #ifdef __arch_swahb32p #else #endif #ifdef __arch_swab16s #else #endif #ifdef __arch_swab32s #else #endif #ifdef __arch_swab64s #else #endif #ifdef __arch_swahw32s #else #endif #ifdef __arch_swahb32s #else #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/nfs2.h0000644000015700001700000000367412200324306023507 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_NFS2_H #define _LINUX_NFS2_H #define NFS2_PORT 2049 #define NFS2_MAXDATA 8192 #define NFS2_MAXPATHLEN 1024 #define NFS2_MAXNAMLEN 255 #define NFS2_MAXGROUPS 16 #define NFS2_FHSIZE 32 #define NFS2_COOKIESIZE 4 #define NFS2_FIFO_DEV (-1) #define NFS2MODE_FMT 0170000 #define NFS2MODE_DIR 0040000 #define NFS2MODE_CHR 0020000 #define NFS2MODE_BLK 0060000 #define NFS2MODE_REG 0100000 #define NFS2MODE_LNK 0120000 #define NFS2MODE_SOCK 0140000 #define NFS2MODE_FIFO 0010000 enum nfs2_ftype { NF2NON = 0, NF2REG = 1, NF2DIR = 2, NF2BLK = 3, NF2CHR = 4, NF2LNK = 5, NF2SOCK = 6, NF2BAD = 7, NF2FIFO = 8 }; struct nfs2_fh { char data[NFS2_FHSIZE]; }; #define NFS2_VERSION 2 #define NFSPROC_NULL 0 #define NFSPROC_GETATTR 1 #define NFSPROC_SETATTR 2 #define NFSPROC_ROOT 3 #define NFSPROC_LOOKUP 4 #define NFSPROC_READLINK 5 #define NFSPROC_READ 6 #define NFSPROC_WRITECACHE 7 #define NFSPROC_WRITE 8 #define NFSPROC_CREATE 9 #define NFSPROC_REMOVE 10 #define NFSPROC_RENAME 11 #define NFSPROC_LINK 12 #define NFSPROC_SYMLINK 13 #define NFSPROC_MKDIR 14 #define NFSPROC_RMDIR 15 #define NFSPROC_READDIR 16 #define NFSPROC_STATFS 17 #define NFS_MNT_PROGRAM 100005 #define NFS_MNT_VERSION 1 #define MNTPROC_NULL 0 #define MNTPROC_MNT 1 #define MNTPROC_UMNT 3 #define MNTPROC_UMNTALL 4 #endif android-audiosystem-1.8+13.10.20130807/include/linux/relay.h0000644000015700001700000000426212200324306023745 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_RELAY_H #define _LINUX_RELAY_H #include #include #include #include #include #include #include #define FIX_SIZE(x) ((((x) - 1) & PAGE_MASK) + PAGE_SIZE) #define RELAYFS_CHANNEL_VERSION 6 struct rchan_buf { void *start; void *data; size_t offset; size_t subbufs_produced; size_t subbufs_consumed; struct rchan *chan; wait_queue_head_t read_wait; struct work_struct wake_readers; struct dentry *dentry; struct kref kref; struct page **page_array; unsigned int page_count; unsigned int finalized; size_t *padding; size_t prev_padding; size_t bytes_consumed; unsigned int cpu; } ____cacheline_aligned; struct rchan { u32 version; size_t subbuf_size; size_t n_subbufs; size_t alloc_size; struct rchan_callbacks *cb; struct kref kref; void *private_data; size_t last_toobig; struct rchan_buf *buf[NR_CPUS]; }; struct rchan_callbacks { int (*subbuf_start) (struct rchan_buf *buf, void *subbuf, void *prev_subbuf, size_t prev_padding); void (*buf_mapped)(struct rchan_buf *buf, struct file *filp); void (*buf_unmapped)(struct rchan_buf *buf, struct file *filp); struct dentry *(*create_buf_file)(const char *filename, struct dentry *parent, int mode, struct rchan_buf *buf, int *is_global); int (*remove_buf_file)(struct dentry *dentry); }; struct rchan *relay_open(const char *base_filename, struct dentry *parent, size_t subbuf_size, size_t n_subbufs, struct rchan_callbacks *cb); #endif android-audiosystem-1.8+13.10.20130807/include/linux/atmioc.h0000644000015700001700000000253012200324306024101 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ATMIOC_H #define _LINUX_ATMIOC_H #include #define ATMIOC_PHYCOM 0x00 #define ATMIOC_PHYCOM_END 0x0f #define ATMIOC_PHYTYP 0x10 #define ATMIOC_PHYTYP_END 0x2f #define ATMIOC_PHYPRV 0x30 #define ATMIOC_PHYPRV_END 0x4f #define ATMIOC_SARCOM 0x50 #define ATMIOC_SARCOM_END 0x50 #define ATMIOC_SARPRV 0x60 #define ATMIOC_SARPRV_END 0x7f #define ATMIOC_ITF 0x80 #define ATMIOC_ITF_END 0x8f #define ATMIOC_BACKEND 0x90 #define ATMIOC_BACKEND_END 0xaf #define ATMIOC_AREQUIPA 0xc0 #define ATMIOC_LANE 0xd0 #define ATMIOC_MPOA 0xd8 #define ATMIOC_CLIP 0xe0 #define ATMIOC_CLIP_END 0xef #define ATMIOC_SPECIAL 0xf0 #define ATMIOC_SPECIAL_END 0xff #endif android-audiosystem-1.8+13.10.20130807/include/linux/ipv6.h0000644000015700001700000000536412200324306023521 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPV6_H #define _IPV6_H #include #include #include #define IPV6_MIN_MTU 1280 struct in6_pktinfo { struct in6_addr ipi6_addr; int ipi6_ifindex; }; struct ip6_mtuinfo { struct sockaddr_in6 ip6m_addr; __u32 ip6m_mtu; }; struct in6_ifreq { struct in6_addr ifr6_addr; __u32 ifr6_prefixlen; int ifr6_ifindex; }; #define IPV6_SRCRT_STRICT 0x01 #define IPV6_SRCRT_TYPE_0 0 #define IPV6_SRCRT_TYPE_2 2 struct ipv6_rt_hdr { __u8 nexthdr; __u8 hdrlen; __u8 type; __u8 segments_left; }; struct ipv6_opt_hdr { __u8 nexthdr; __u8 hdrlen; } __attribute__((packed)); #define ipv6_destopt_hdr ipv6_opt_hdr #define ipv6_hopopt_hdr ipv6_opt_hdr struct rt0_hdr { struct ipv6_rt_hdr rt_hdr; __u32 reserved; struct in6_addr addr[0]; #define rt0_type rt_hdr.type }; struct rt2_hdr { struct ipv6_rt_hdr rt_hdr; __u32 reserved; struct in6_addr addr; #define rt2_type rt_hdr.type }; struct ipv6_destopt_hao { __u8 type; __u8 length; struct in6_addr addr; } __attribute__((packed)); struct ipv6hdr { #ifdef __LITTLE_ENDIAN_BITFIELD __u8 priority:4, version:4; #elif defined(__BIG_ENDIAN_BITFIELD) __u8 version:4, priority:4; #else #error "Please fix " #endif __u8 flow_lbl[3]; __be16 payload_len; __u8 nexthdr; __u8 hop_limit; struct in6_addr saddr; struct in6_addr daddr; }; enum { DEVCONF_FORWARDING = 0, DEVCONF_HOPLIMIT, DEVCONF_MTU6, DEVCONF_ACCEPT_RA, DEVCONF_ACCEPT_REDIRECTS, DEVCONF_AUTOCONF, DEVCONF_DAD_TRANSMITS, DEVCONF_RTR_SOLICITS, DEVCONF_RTR_SOLICIT_INTERVAL, DEVCONF_RTR_SOLICIT_DELAY, DEVCONF_USE_TEMPADDR, DEVCONF_TEMP_VALID_LFT, DEVCONF_TEMP_PREFERED_LFT, DEVCONF_REGEN_MAX_RETRY, DEVCONF_MAX_DESYNC_FACTOR, DEVCONF_MAX_ADDRESSES, DEVCONF_FORCE_MLD_VERSION, DEVCONF_ACCEPT_RA_DEFRTR, DEVCONF_ACCEPT_RA_PINFO, DEVCONF_ACCEPT_RA_RTR_PREF, DEVCONF_RTR_PROBE_INTERVAL, DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, DEVCONF_PROXY_NDP, DEVCONF_OPTIMISTIC_DAD, DEVCONF_ACCEPT_SOURCE_ROUTE, DEVCONF_MC_FORWARDING, DEVCONF_DISABLE_IPV6, DEVCONF_ACCEPT_DAD, DEVCONF_FORCE_TLLAO, DEVCONF_MAX }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/ipmi_msgdefs.h0000644000015700001700000000464612200324306025305 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_IPMI_MSGDEFS_H #define __LINUX_IPMI_MSGDEFS_H #define IPMI_NETFN_SENSOR_EVENT_REQUEST 0x04 #define IPMI_NETFN_SENSOR_EVENT_RESPONSE 0x05 #define IPMI_GET_EVENT_RECEIVER_CMD 0x01 #define IPMI_NETFN_APP_REQUEST 0x06 #define IPMI_NETFN_APP_RESPONSE 0x07 #define IPMI_GET_DEVICE_ID_CMD 0x01 #define IPMI_CLEAR_MSG_FLAGS_CMD 0x30 #define IPMI_GET_DEVICE_GUID_CMD 0x08 #define IPMI_GET_MSG_FLAGS_CMD 0x31 #define IPMI_SEND_MSG_CMD 0x34 #define IPMI_GET_MSG_CMD 0x33 #define IPMI_SET_BMC_GLOBAL_ENABLES_CMD 0x2e #define IPMI_GET_BMC_GLOBAL_ENABLES_CMD 0x2f #define IPMI_READ_EVENT_MSG_BUFFER_CMD 0x35 #define IPMI_GET_CHANNEL_INFO_CMD 0x42 #define IPMI_NETFN_STORAGE_REQUEST 0x0a #define IPMI_NETFN_STORAGE_RESPONSE 0x0b #define IPMI_ADD_SEL_ENTRY_CMD 0x44 #define IPMI_BMC_SLAVE_ADDR 0x20 #define IPMI_MAX_MSG_LENGTH 272 #define IPMI_CC_NO_ERROR 0x00 #define IPMI_NODE_BUSY_ERR 0xc0 #define IPMI_INVALID_COMMAND_ERR 0xc1 #define IPMI_ERR_MSG_TRUNCATED 0xc6 #define IPMI_LOST_ARBITRATION_ERR 0x81 #define IPMI_ERR_UNSPECIFIED 0xff #define IPMI_CHANNEL_PROTOCOL_IPMB 1 #define IPMI_CHANNEL_PROTOCOL_ICMB 2 #define IPMI_CHANNEL_PROTOCOL_SMBUS 4 #define IPMI_CHANNEL_PROTOCOL_KCS 5 #define IPMI_CHANNEL_PROTOCOL_SMIC 6 #define IPMI_CHANNEL_PROTOCOL_BT10 7 #define IPMI_CHANNEL_PROTOCOL_BT15 8 #define IPMI_CHANNEL_PROTOCOL_TMODE 9 #define IPMI_CHANNEL_MEDIUM_IPMB 1 #define IPMI_CHANNEL_MEDIUM_ICMB10 2 #define IPMI_CHANNEL_MEDIUM_ICMB09 3 #define IPMI_CHANNEL_MEDIUM_8023LAN 4 #define IPMI_CHANNEL_MEDIUM_ASYNC 5 #define IPMI_CHANNEL_MEDIUM_OTHER_LAN 6 #define IPMI_CHANNEL_MEDIUM_PCI_SMBUS 7 #define IPMI_CHANNEL_MEDIUM_SMBUS1 8 #define IPMI_CHANNEL_MEDIUM_SMBUS2 9 #define IPMI_CHANNEL_MEDIUM_USB1 10 #define IPMI_CHANNEL_MEDIUM_USB2 11 #define IPMI_CHANNEL_MEDIUM_SYSINTF 12 #endif android-audiosystem-1.8+13.10.20130807/include/linux/auxvec.h0000644000015700001700000000224312200324306024121 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_AUXVEC_H #define _LINUX_AUXVEC_H #include #define AT_NULL 0 #define AT_IGNORE 1 #define AT_EXECFD 2 #define AT_PHDR 3 #define AT_PHENT 4 #define AT_PHNUM 5 #define AT_PAGESZ 6 #define AT_BASE 7 #define AT_FLAGS 8 #define AT_ENTRY 9 #define AT_NOTELF 10 #define AT_UID 11 #define AT_EUID 12 #define AT_GID 13 #define AT_EGID 14 #define AT_PLATFORM 15 #define AT_HWCAP 16 #define AT_CLKTCK 17 #define AT_SECURE 23 #define AT_VECTOR_SIZE 44 #endif android-audiosystem-1.8+13.10.20130807/include/linux/tcp.h0000644000015700001700000000633212200324306023417 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_TCP_H #define _LINUX_TCP_H #include #include struct tcphdr { __u16 source; __u16 dest; __u32 seq; __u32 ack_seq; #ifdef __LITTLE_ENDIAN_BITFIELD __u16 res1:4, doff:4, fin:1, syn:1, rst:1, psh:1, ack:1, urg:1, ece:1, cwr:1; #elif defined(__BIG_ENDIAN_BITFIELD) __u16 doff:4, res1:4, cwr:1, ece:1, urg:1, ack:1, psh:1, rst:1, syn:1, fin:1; #else #error "Adjust your defines" #endif __u16 window; __u16 check; __u16 urg_ptr; }; union tcp_word_hdr { struct tcphdr hdr; __u32 words[5]; }; #define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3]) enum { TCP_FLAG_CWR = __constant_htonl(0x00800000), TCP_FLAG_ECE = __constant_htonl(0x00400000), TCP_FLAG_URG = __constant_htonl(0x00200000), TCP_FLAG_ACK = __constant_htonl(0x00100000), TCP_FLAG_PSH = __constant_htonl(0x00080000), TCP_FLAG_RST = __constant_htonl(0x00040000), TCP_FLAG_SYN = __constant_htonl(0x00020000), TCP_FLAG_FIN = __constant_htonl(0x00010000), TCP_RESERVED_BITS = __constant_htonl(0x0F000000), TCP_DATA_OFFSET = __constant_htonl(0xF0000000) }; #define TCP_NODELAY 1 #define TCP_MAXSEG 2 #define TCP_CORK 3 #define TCP_KEEPIDLE 4 #define TCP_KEEPINTVL 5 #define TCP_KEEPCNT 6 #define TCP_SYNCNT 7 #define TCP_LINGER2 8 #define TCP_DEFER_ACCEPT 9 #define TCP_WINDOW_CLAMP 10 #define TCP_INFO 11 #define TCP_QUICKACK 12 #define TCP_CONGESTION 13 #define TCPI_OPT_TIMESTAMPS 1 #define TCPI_OPT_SACK 2 #define TCPI_OPT_WSCALE 4 #define TCPI_OPT_ECN 8 enum tcp_ca_state { TCP_CA_Open = 0, #define TCPF_CA_Open (1< #define ARC_P_IP 212 #define ARC_P_IPV6 196 #define ARC_P_ARP 213 #define ARC_P_RARP 214 #define ARC_P_IPX 250 #define ARC_P_NOVELL_EC 236 #define ARC_P_IP_RFC1051 240 #define ARC_P_ARP_RFC1051 241 #define ARC_P_ETHER 232 #define ARC_P_DATAPOINT_BOOT 0 #define ARC_P_DATAPOINT_MOUNT 1 #define ARC_P_POWERLAN_BEACON 8 #define ARC_P_POWERLAN_BEACON2 243 #define ARC_P_LANSOFT 251 #define ARC_P_ATALK 0xDD #define ARCNET_ALEN 1 struct arc_rfc1201 { uint8_t proto; uint8_t split_flag; uint16_t sequence; uint8_t payload[0]; }; #define RFC1201_HDR_SIZE 4 struct arc_rfc1051 { uint8_t proto; uint8_t payload[0]; }; #define RFC1051_HDR_SIZE 1 struct arc_eth_encap { uint8_t proto; struct ethhdr eth; uint8_t payload[0]; }; #define ETH_ENCAP_HDR_SIZE 14 struct arc_cap { uint8_t proto; uint8_t cookie[sizeof(int)]; union { uint8_t ack; uint8_t raw[0]; } mes; }; struct arc_hardware { uint8_t source, dest, offset[2]; }; #define ARC_HDR_SIZE 4 struct archdr { struct arc_hardware hard; union { struct arc_rfc1201 rfc1201; struct arc_rfc1051 rfc1051; struct arc_eth_encap eth_encap; struct arc_cap cap; uint8_t raw[0]; } soft; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/fd.h0000644000015700001700000001260712200324306023224 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_FD_H #define _LINUX_FD_H #include #include struct floppy_struct { unsigned int size, sect, head, track, stretch; #define FD_STRETCH 1 #define FD_SWAPSIDES 2 #define FD_ZEROBASED 4 unsigned char gap, rate, #define FD_2M 0x4 #define FD_SIZECODEMASK 0x38 #define FD_SIZECODE(floppy) (((((floppy)->rate&FD_SIZECODEMASK)>> 3)+ 2) %8) #define FD_SECTSIZE(floppy) ( (floppy)->rate & FD_2M ? 512 : 128 << FD_SIZECODE(floppy) ) #define FD_PERP 0x40 spec1, fmt_gap; const char * name; }; #define FDCLRPRM _IO(2, 0x41) #define FDSETPRM _IOW(2, 0x42, struct floppy_struct) #define FDSETMEDIAPRM FDSETPRM #define FDDEFPRM _IOW(2, 0x43, struct floppy_struct) #define FDGETPRM _IOR(2, 0x04, struct floppy_struct) #define FDDEFMEDIAPRM FDDEFPRM #define FDGETMEDIAPRM FDGETPRM #define FDMSGON _IO(2,0x45) #define FDMSGOFF _IO(2,0x46) #define FD_FILL_BYTE 0xF6 struct format_descr { unsigned int device,head,track; }; #define FDFMTBEG _IO(2,0x47) #define FDFMTTRK _IOW(2,0x48, struct format_descr) #define FDFMTEND _IO(2,0x49) struct floppy_max_errors { unsigned int abort, read_track, reset, recal, reporting; }; #define FDSETEMSGTRESH _IO(2,0x4a) #define FDFLUSH _IO(2,0x4b) #define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors) #define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors) typedef char floppy_drive_name[16]; #define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name) struct floppy_drive_params { signed char cmos; unsigned long max_dtr; unsigned long hlt; unsigned long hut; unsigned long srt; unsigned long spinup; unsigned long spindown; unsigned char spindown_offset; unsigned char select_delay; unsigned char rps; unsigned char tracks; unsigned long timeout; unsigned char interleave_sect; struct floppy_max_errors max_errors; char flags; #define FTD_MSG 0x10 #define FD_BROKEN_DCL 0x20 #define FD_DEBUG 0x02 #define FD_SILENT_DCL_CLEAR 0x4 #define FD_INVERTED_DCL 0x80 char read_track; short autodetect[8]; int checkfreq; int native_format; }; enum { FD_NEED_TWADDLE_BIT, FD_VERIFY_BIT, FD_DISK_NEWCHANGE_BIT, FD_UNUSED_BIT, FD_DISK_CHANGED_BIT, FD_DISK_WRITABLE_BIT }; #define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params) #define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params) struct floppy_drive_struct { unsigned long flags; #define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT) #define FD_VERIFY (1 << FD_VERIFY_BIT) #define FD_DISK_NEWCHANGE (1 << FD_DISK_NEWCHANGE_BIT) #define FD_DISK_CHANGED (1 << FD_DISK_CHANGED_BIT) #define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT) unsigned long spinup_date; unsigned long select_date; unsigned long first_read_date; short probed_format; short track; short maxblock; short maxtrack; int generation; int keep_data; int fd_ref; int fd_device; unsigned long last_checked; char *dmabuf; int bufblocks; }; #define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct) #define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct) enum reset_mode { FD_RESET_IF_NEEDED, FD_RESET_IF_RAWCMD, FD_RESET_ALWAYS }; #define FDRESET _IO(2, 0x54) struct floppy_fdc_state { int spec1; int spec2; int dtr; unsigned char version; unsigned char dor; unsigned long address; unsigned int rawcmd:2; unsigned int reset:1; unsigned int need_configure:1; unsigned int perp_mode:2; unsigned int has_fifo:1; unsigned int driver_version; #define FD_DRIVER_VERSION 0x100 unsigned char track[4]; }; #define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state) struct floppy_write_errors { unsigned int write_errors; unsigned long first_error_sector; int first_error_generation; unsigned long last_error_sector; int last_error_generation; unsigned int badness; }; #define FDWERRORCLR _IO(2, 0x56) #define FDWERRORGET _IOR(2, 0x17, struct floppy_write_errors) #define FDHAVEBATCHEDRAWCMD struct floppy_raw_cmd { unsigned int flags; #define FD_RAW_READ 1 #define FD_RAW_WRITE 2 #define FD_RAW_NO_MOTOR 4 #define FD_RAW_DISK_CHANGE 4 #define FD_RAW_INTR 8 #define FD_RAW_SPIN 0x10 #define FD_RAW_NO_MOTOR_AFTER 0x20 #define FD_RAW_NEED_DISK 0x40 #define FD_RAW_NEED_SEEK 0x80 #define FD_RAW_MORE 0x100 #define FD_RAW_STOP_IF_FAILURE 0x200 #define FD_RAW_STOP_IF_SUCCESS 0x400 #define FD_RAW_SOFTFAILURE 0x800 #define FD_RAW_FAILURE 0x10000 #define FD_RAW_HARDFAILURE 0x20000 void __user *data; char *kernel_data; struct floppy_raw_cmd *next; long length; long phys_length; int buffer_length; unsigned char rate; unsigned char cmd_count; unsigned char cmd[16]; unsigned char reply_count; unsigned char reply[16]; int track; int resultcode; int reserved1; int reserved2; }; #define FDRAWCMD _IO(2, 0x58) #define FDTWADDLE _IO(2, 0x59) #define FDEJECT _IO(2, 0x5a) #endif android-audiosystem-1.8+13.10.20130807/include/linux/if_arp.h0000644000015700001700000000610212200324306024064 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IF_ARP_H #define _LINUX_IF_ARP_H #include #define ARPHRD_NETROM 0 #define ARPHRD_ETHER 1 #define ARPHRD_EETHER 2 #define ARPHRD_AX25 3 #define ARPHRD_PRONET 4 #define ARPHRD_CHAOS 5 #define ARPHRD_IEEE802 6 #define ARPHRD_ARCNET 7 #define ARPHRD_APPLETLK 8 #define ARPHRD_DLCI 15 #define ARPHRD_ATM 19 #define ARPHRD_METRICOM 23 #define ARPHRD_IEEE1394 24 #define ARPHRD_EUI64 27 #define ARPHRD_INFINIBAND 32 #define ARPHRD_SLIP 256 #define ARPHRD_CSLIP 257 #define ARPHRD_SLIP6 258 #define ARPHRD_CSLIP6 259 #define ARPHRD_RSRVD 260 #define ARPHRD_ADAPT 264 #define ARPHRD_ROSE 270 #define ARPHRD_X25 271 #define ARPHRD_HWX25 272 #define ARPHRD_CAN 280 #define ARPHRD_PPP 512 #define ARPHRD_CISCO 513 #define ARPHRD_HDLC ARPHRD_CISCO #define ARPHRD_LAPB 516 #define ARPHRD_DDCMP 517 #define ARPHRD_RAWHDLC 518 #define ARPHRD_TUNNEL 768 #define ARPHRD_TUNNEL6 769 #define ARPHRD_FRAD 770 #define ARPHRD_SKIP 771 #define ARPHRD_LOOPBACK 772 #define ARPHRD_LOCALTLK 773 #define ARPHRD_FDDI 774 #define ARPHRD_BIF 775 #define ARPHRD_SIT 776 #define ARPHRD_IPDDP 777 #define ARPHRD_IPGRE 778 #define ARPHRD_PIMREG 779 #define ARPHRD_HIPPI 780 #define ARPHRD_ASH 781 #define ARPHRD_ECONET 782 #define ARPHRD_IRDA 783 #define ARPHRD_FCPP 784 #define ARPHRD_FCAL 785 #define ARPHRD_FCPL 786 #define ARPHRD_FCFABRIC 787 #define ARPHRD_IEEE802_TR 800 #define ARPHRD_IEEE80211 801 #define ARPHRD_IEEE80211_PRISM 802 #define ARPHRD_IEEE80211_RADIOTAP 803 #define ARPHRD_IEEE802154 804 #define ARPHRD_PHONET 820 #define ARPHRD_PHONET_PIPE 821 #define ARPHRD_CAIF 822 #define ARPHRD_VOID 0xFFFF #define ARPHRD_NONE 0xFFFE #define ARPOP_REQUEST 1 #define ARPOP_REPLY 2 #define ARPOP_RREQUEST 3 #define ARPOP_RREPLY 4 #define ARPOP_InREQUEST 8 #define ARPOP_InREPLY 9 #define ARPOP_NAK 10 struct arpreq { struct sockaddr arp_pa; struct sockaddr arp_ha; int arp_flags; struct sockaddr arp_netmask; char arp_dev[16]; }; struct arpreq_old { struct sockaddr arp_pa; struct sockaddr arp_ha; int arp_flags; struct sockaddr arp_netmask; }; #define ATF_COM 0x02 #define ATF_PERM 0x04 #define ATF_PUBL 0x08 #define ATF_USETRAILERS 0x10 #define ATF_NETMASK 0x20 #define ATF_DONTPUB 0x40 struct arphdr { __be16 ar_hrd; __be16 ar_pro; unsigned char ar_hln; unsigned char ar_pln; __be16 ar_op; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/tegra_avp.h0000644000015700001700000000246712200324306024606 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_TEGRA_AVP_H #define __LINUX_TEGRA_AVP_H #include #include #define TEGRA_AVP_LIB_MAX_NAME 32 #define TEGRA_AVP_LIB_MAX_ARGS 220 struct tegra_avp_lib { char name[TEGRA_AVP_LIB_MAX_NAME]; void __user *args; size_t args_len; int greedy; unsigned long handle; }; #define TEGRA_AVP_IOCTL_MAGIC 'r' #define TEGRA_AVP_IOCTL_LOAD_LIB _IOWR(TEGRA_AVP_IOCTL_MAGIC, 0x40, struct tegra_avp_lib) #define TEGRA_AVP_IOCTL_UNLOAD_LIB _IOW(TEGRA_AVP_IOCTL_MAGIC, 0x41, unsigned long) #define TEGRA_AVP_IOCTL_MIN_NR _IOC_NR(TEGRA_AVP_IOCTL_LOAD_LIB) #define TEGRA_AVP_IOCTL_MAX_NR _IOC_NR(TEGRA_AVP_IOCTL_UNLOAD_LIB) #endif android-audiosystem-1.8+13.10.20130807/include/linux/pkt_cls.h0000644000015700001700000001763512200324306024300 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_PKT_CLS_H #define __LINUX_PKT_CLS_H #include #include #define _TC_MAKE32(x) ((x)) #define _TC_MAKEMASK1(n) (_TC_MAKE32(1) << _TC_MAKE32(n)) #define _TC_MAKEMASK(v,n) (_TC_MAKE32((_TC_MAKE32(1)<<(v))-1) << _TC_MAKE32(n)) #define _TC_MAKEVALUE(v,n) (_TC_MAKE32(v) << _TC_MAKE32(n)) #define _TC_GETVALUE(v,n,m) ((_TC_MAKE32(v) & _TC_MAKE32(m)) >> _TC_MAKE32(n)) #define TC_MUNGED _TC_MAKEMASK1(0) #define SET_TC_MUNGED(v) ( TC_MUNGED | (v & ~TC_MUNGED)) #define CLR_TC_MUNGED(v) ( v & ~TC_MUNGED) #define TC_OK2MUNGE _TC_MAKEMASK1(1) #define SET_TC_OK2MUNGE(v) ( TC_OK2MUNGE | (v & ~TC_OK2MUNGE)) #define CLR_TC_OK2MUNGE(v) ( v & ~TC_OK2MUNGE) #define S_TC_VERD _TC_MAKE32(2) #define M_TC_VERD _TC_MAKEMASK(4,S_TC_VERD) #define G_TC_VERD(x) _TC_GETVALUE(x,S_TC_VERD,M_TC_VERD) #define V_TC_VERD(x) _TC_MAKEVALUE(x,S_TC_VERD) #define SET_TC_VERD(v,n) ((V_TC_VERD(n)) | (v & ~M_TC_VERD)) #define S_TC_FROM _TC_MAKE32(6) #define M_TC_FROM _TC_MAKEMASK(2,S_TC_FROM) #define G_TC_FROM(x) _TC_GETVALUE(x,S_TC_FROM,M_TC_FROM) #define V_TC_FROM(x) _TC_MAKEVALUE(x,S_TC_FROM) #define SET_TC_FROM(v,n) ((V_TC_FROM(n)) | (v & ~M_TC_FROM)) #define AT_STACK 0x0 #define AT_INGRESS 0x1 #define AT_EGRESS 0x2 #define TC_NCLS _TC_MAKEMASK1(8) #define SET_TC_NCLS(v) ( TC_NCLS | (v & ~TC_NCLS)) #define CLR_TC_NCLS(v) ( v & ~TC_NCLS) #define S_TC_RTTL _TC_MAKE32(9) #define M_TC_RTTL _TC_MAKEMASK(3,S_TC_RTTL) #define G_TC_RTTL(x) _TC_GETVALUE(x,S_TC_RTTL,M_TC_RTTL) #define V_TC_RTTL(x) _TC_MAKEVALUE(x,S_TC_RTTL) #define SET_TC_RTTL(v,n) ((V_TC_RTTL(n)) | (v & ~M_TC_RTTL)) #define S_TC_AT _TC_MAKE32(12) #define M_TC_AT _TC_MAKEMASK(2,S_TC_AT) #define G_TC_AT(x) _TC_GETVALUE(x,S_TC_AT,M_TC_AT) #define V_TC_AT(x) _TC_MAKEVALUE(x,S_TC_AT) #define SET_TC_AT(v,n) ((V_TC_AT(n)) | (v & ~M_TC_AT)) enum { TCA_ACT_UNSPEC, TCA_ACT_KIND, TCA_ACT_OPTIONS, TCA_ACT_INDEX, TCA_ACT_STATS, __TCA_ACT_MAX }; #define TCA_ACT_MAX __TCA_ACT_MAX #define TCA_OLD_COMPAT (TCA_ACT_MAX+1) #define TCA_ACT_MAX_PRIO 32 #define TCA_ACT_BIND 1 #define TCA_ACT_NOBIND 0 #define TCA_ACT_UNBIND 1 #define TCA_ACT_NOUNBIND 0 #define TCA_ACT_REPLACE 1 #define TCA_ACT_NOREPLACE 0 #define MAX_REC_LOOP 4 #define MAX_RED_LOOP 4 #define TC_ACT_UNSPEC (-1) #define TC_ACT_OK 0 #define TC_ACT_RECLASSIFY 1 #define TC_ACT_SHOT 2 #define TC_ACT_PIPE 3 #define TC_ACT_STOLEN 4 #define TC_ACT_QUEUED 5 #define TC_ACT_REPEAT 6 #define TC_ACT_JUMP 0x10000000 enum { TCA_ID_UNSPEC=0, TCA_ID_POLICE=1, __TCA_ID_MAX=255 }; #define TCA_ID_MAX __TCA_ID_MAX struct tc_police { __u32 index; int action; #define TC_POLICE_UNSPEC TC_ACT_UNSPEC #define TC_POLICE_OK TC_ACT_OK #define TC_POLICE_RECLASSIFY TC_ACT_RECLASSIFY #define TC_POLICE_SHOT TC_ACT_SHOT #define TC_POLICE_PIPE TC_ACT_PIPE __u32 limit; __u32 burst; __u32 mtu; struct tc_ratespec rate; struct tc_ratespec peakrate; int refcnt; int bindcnt; __u32 capab; }; struct tcf_t { __u64 install; __u64 lastuse; __u64 expires; }; struct tc_cnt { int refcnt; int bindcnt; }; #define tc_gen __u32 index; __u32 capab; int action; int refcnt; int bindcnt enum { TCA_POLICE_UNSPEC, TCA_POLICE_TBF, TCA_POLICE_RATE, TCA_POLICE_PEAKRATE, TCA_POLICE_AVRATE, TCA_POLICE_RESULT, __TCA_POLICE_MAX #define TCA_POLICE_RESULT TCA_POLICE_RESULT }; #define TCA_POLICE_MAX (__TCA_POLICE_MAX - 1) #define TC_U32_HTID(h) ((h)&0xFFF00000) #define TC_U32_USERHTID(h) (TC_U32_HTID(h)>>20) #define TC_U32_HASH(h) (((h)>>12)&0xFF) #define TC_U32_NODE(h) ((h)&0xFFF) #define TC_U32_KEY(h) ((h)&0xFFFFF) #define TC_U32_UNSPEC 0 #define TC_U32_ROOT (0xFFF00000) enum { TCA_U32_UNSPEC, TCA_U32_CLASSID, TCA_U32_HASH, TCA_U32_LINK, TCA_U32_DIVISOR, TCA_U32_SEL, TCA_U32_POLICE, TCA_U32_ACT, TCA_U32_INDEV, TCA_U32_PCNT, TCA_U32_MARK, __TCA_U32_MAX }; #define TCA_U32_MAX (__TCA_U32_MAX - 1) struct tc_u32_key { __be32 mask; __be32 val; int off; int offmask; }; struct tc_u32_sel { unsigned char flags; unsigned char offshift; unsigned char nkeys; __be16 offmask; __u16 off; short offoff; short hoff; __be32 hmask; struct tc_u32_key keys[0]; }; struct tc_u32_mark { __u32 val; __u32 mask; __u32 success; }; struct tc_u32_pcnt { __u64 rcnt; __u64 rhit; __u64 kcnts[0]; }; #define TC_U32_TERMINAL 1 #define TC_U32_OFFSET 2 #define TC_U32_VAROFFSET 4 #define TC_U32_EAT 8 #define TC_U32_MAXDEPTH 8 enum { TCA_RSVP_UNSPEC, TCA_RSVP_CLASSID, TCA_RSVP_DST, TCA_RSVP_SRC, TCA_RSVP_PINFO, TCA_RSVP_POLICE, TCA_RSVP_ACT, __TCA_RSVP_MAX }; #define TCA_RSVP_MAX (__TCA_RSVP_MAX - 1 ) struct tc_rsvp_gpi { __u32 key; __u32 mask; int offset; }; struct tc_rsvp_pinfo { struct tc_rsvp_gpi dpi; struct tc_rsvp_gpi spi; __u8 protocol; __u8 tunnelid; __u8 tunnelhdr; __u8 pad; }; enum { TCA_ROUTE4_UNSPEC, TCA_ROUTE4_CLASSID, TCA_ROUTE4_TO, TCA_ROUTE4_FROM, TCA_ROUTE4_IIF, TCA_ROUTE4_POLICE, TCA_ROUTE4_ACT, __TCA_ROUTE4_MAX }; #define TCA_ROUTE4_MAX (__TCA_ROUTE4_MAX - 1) enum { TCA_FW_UNSPEC, TCA_FW_CLASSID, TCA_FW_POLICE, TCA_FW_INDEV, TCA_FW_ACT, TCA_FW_MASK, __TCA_FW_MAX }; #define TCA_FW_MAX (__TCA_FW_MAX - 1) enum { TCA_TCINDEX_UNSPEC, TCA_TCINDEX_HASH, TCA_TCINDEX_MASK, TCA_TCINDEX_SHIFT, TCA_TCINDEX_FALL_THROUGH, TCA_TCINDEX_CLASSID, TCA_TCINDEX_POLICE, TCA_TCINDEX_ACT, __TCA_TCINDEX_MAX }; #define TCA_TCINDEX_MAX (__TCA_TCINDEX_MAX - 1) enum { FLOW_KEY_SRC, FLOW_KEY_DST, FLOW_KEY_PROTO, FLOW_KEY_PROTO_SRC, FLOW_KEY_PROTO_DST, FLOW_KEY_IIF, FLOW_KEY_PRIORITY, FLOW_KEY_MARK, FLOW_KEY_NFCT, FLOW_KEY_NFCT_SRC, FLOW_KEY_NFCT_DST, FLOW_KEY_NFCT_PROTO_SRC, FLOW_KEY_NFCT_PROTO_DST, FLOW_KEY_RTCLASSID, FLOW_KEY_SKUID, FLOW_KEY_SKGID, FLOW_KEY_VLAN_TAG, __FLOW_KEY_MAX, }; #define FLOW_KEY_MAX (__FLOW_KEY_MAX - 1) enum { FLOW_MODE_MAP, FLOW_MODE_HASH, }; enum { TCA_FLOW_UNSPEC, TCA_FLOW_KEYS, TCA_FLOW_MODE, TCA_FLOW_BASECLASS, TCA_FLOW_RSHIFT, TCA_FLOW_ADDEND, TCA_FLOW_MASK, TCA_FLOW_XOR, TCA_FLOW_DIVISOR, TCA_FLOW_ACT, TCA_FLOW_POLICE, TCA_FLOW_EMATCHES, TCA_FLOW_PERTURB, __TCA_FLOW_MAX }; #define TCA_FLOW_MAX (__TCA_FLOW_MAX - 1) enum { TCA_BASIC_UNSPEC, TCA_BASIC_CLASSID, TCA_BASIC_EMATCHES, TCA_BASIC_ACT, TCA_BASIC_POLICE, __TCA_BASIC_MAX }; #define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1) enum { TCA_CGROUP_UNSPEC, TCA_CGROUP_ACT, TCA_CGROUP_POLICE, TCA_CGROUP_EMATCHES, __TCA_CGROUP_MAX, }; #define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1) struct tcf_ematch_tree_hdr { __u16 nmatches; __u16 progid; }; enum { TCA_EMATCH_TREE_UNSPEC, TCA_EMATCH_TREE_HDR, TCA_EMATCH_TREE_LIST, __TCA_EMATCH_TREE_MAX }; #define TCA_EMATCH_TREE_MAX (__TCA_EMATCH_TREE_MAX - 1) struct tcf_ematch_hdr { __u16 matchid; __u16 kind; __u16 flags; __u16 pad; }; #define TCF_EM_REL_END 0 #define TCF_EM_REL_AND (1<<0) #define TCF_EM_REL_OR (1<<1) #define TCF_EM_INVERT (1<<2) #define TCF_EM_SIMPLE (1<<3) #define TCF_EM_REL_MASK 3 #define TCF_EM_REL_VALID(v) (((v) & TCF_EM_REL_MASK) != TCF_EM_REL_MASK) enum { TCF_LAYER_LINK, TCF_LAYER_NETWORK, TCF_LAYER_TRANSPORT, __TCF_LAYER_MAX }; #define TCF_LAYER_MAX (__TCF_LAYER_MAX - 1) #define TCF_EM_CONTAINER 0 #define TCF_EM_CMP 1 #define TCF_EM_NBYTE 2 #define TCF_EM_U32 3 #define TCF_EM_META 4 #define TCF_EM_TEXT 5 #define TCF_EM_VLAN 6 #define TCF_EM_MAX 6 enum { TCF_EM_PROG_TC }; enum { TCF_EM_OPND_EQ, TCF_EM_OPND_GT, TCF_EM_OPND_LT }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/mc146818rtc.h0000644000015700001700000000356012200324306024435 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _MC146818RTC_H #define _MC146818RTC_H #include #include #include #define RTC_SECONDS 0 #define RTC_SECONDS_ALARM 1 #define RTC_MINUTES 2 #define RTC_MINUTES_ALARM 3 #define RTC_HOURS 4 #define RTC_HOURS_ALARM 5 #define RTC_ALARM_DONT_CARE 0xC0 #define RTC_DAY_OF_WEEK 6 #define RTC_DAY_OF_MONTH 7 #define RTC_MONTH 8 #define RTC_YEAR 9 #define RTC_REG_A 10 #define RTC_REG_B 11 #define RTC_REG_C 12 #define RTC_REG_D 13 #define RTC_FREQ_SELECT RTC_REG_A #define RTC_UIP 0x80 #define RTC_DIV_CTL 0x70 #define RTC_REF_CLCK_4MHZ 0x00 #define RTC_REF_CLCK_1MHZ 0x10 #define RTC_REF_CLCK_32KHZ 0x20 #define RTC_DIV_RESET1 0x60 #define RTC_DIV_RESET2 0x70 #define RTC_RATE_SELECT 0x0F #define RTC_CONTROL RTC_REG_B #define RTC_SET 0x80 #define RTC_PIE 0x40 #define RTC_AIE 0x20 #define RTC_UIE 0x10 #define RTC_SQWE 0x08 #define RTC_DM_BINARY 0x04 #define RTC_24H 0x02 #define RTC_DST_EN 0x01 #define RTC_INTR_FLAGS RTC_REG_C #define RTC_IRQF 0x80 #define RTC_PF 0x40 #define RTC_AF 0x20 #define RTC_UF 0x10 #define RTC_VALID RTC_REG_D #define RTC_VRT 0x80 #ifndef ARCH_RTC_LOCATION #define RTC_IO_EXTENT 0x8 #define RTC_IOMAPPED 1 #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/genhd.h0000644000015700001700000000301112200324306023705 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_GENHD_H #define _LINUX_GENHD_H #include enum { DOS_EXTENDED_PARTITION = 5, LINUX_EXTENDED_PARTITION = 0x85, WIN98_EXTENDED_PARTITION = 0x0f, LINUX_SWAP_PARTITION = 0x82, LINUX_RAID_PARTITION = 0xfd, SOLARIS_X86_PARTITION = LINUX_SWAP_PARTITION, NEW_SOLARIS_X86_PARTITION = 0xbf, DM6_AUX1PARTITION = 0x51, DM6_AUX3PARTITION = 0x53, DM6_PARTITION = 0x54, EZD_PARTITION = 0x55, FREEBSD_PARTITION = 0xa5, OPENBSD_PARTITION = 0xa6, NETBSD_PARTITION = 0xa9, BSDI_PARTITION = 0xb7, MINIX_PARTITION = 0x81, UNIXWARE_PARTITION = 0x63, }; struct partition { unsigned char boot_ind; unsigned char head; unsigned char sector; unsigned char cyl; unsigned char sys_ind; unsigned char end_head; unsigned char end_sector; unsigned char end_cyl; unsigned int start_sect; unsigned int nr_sects; } __attribute__((packed)); #endif android-audiosystem-1.8+13.10.20130807/include/linux/ufs_fs_sb.h0000644000015700001700000000227312200324306024602 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_UFS_FS_SB_H #define __LINUX_UFS_FS_SB_H #define UFS_MAX_GROUP_LOADED 8 #define UFS_CGNO_EMPTY ((unsigned)-1) struct ufs_sb_private_info; struct ufs_cg_private_info; struct ufs_csum; #define UFS_MAXCSBUFS 31 struct ufs_sb_info { struct ufs_sb_private_info * s_uspi; struct ufs_csum * s_csp; unsigned s_bytesex; unsigned s_flags; struct buffer_head ** s_ucg; struct ufs_cg_private_info * s_ucpi[UFS_MAX_GROUP_LOADED]; unsigned s_cgno[UFS_MAX_GROUP_LOADED]; unsigned short s_cg_loaded; unsigned s_mount_opt; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/times.h0000644000015700001700000000151612200324306023751 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_TIMES_H #define _LINUX_TIMES_H #include struct tms { clock_t tms_utime; clock_t tms_stime; clock_t tms_cutime; clock_t tms_cstime; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/futex.h0000644000015700001700000000331612200324306023763 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_FUTEX_H #define _LINUX_FUTEX_H #include #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 #define FUTEX_FD 2 #define FUTEX_REQUEUE 3 #define FUTEX_CMP_REQUEUE 4 #define FUTEX_WAKE_OP 5 #define FUTEX_LOCK_PI 6 #define FUTEX_UNLOCK_PI 7 #define FUTEX_TRYLOCK_PI 8 struct robust_list { struct robust_list __user *next; }; struct robust_list_head { struct robust_list list; long futex_offset; struct robust_list __user *list_op_pending; }; #define FUTEX_WAITERS 0x80000000 #define FUTEX_OWNER_DIED 0x40000000 #define FUTEX_TID_MASK 0x3fffffff #define ROBUST_LIST_LIMIT 2048 #define FUTEX_OP_SET 0 #define FUTEX_OP_ADD 1 #define FUTEX_OP_OR 2 #define FUTEX_OP_ANDN 3 #define FUTEX_OP_XOR 4 #define FUTEX_OP_OPARG_SHIFT 8 #define FUTEX_OP_CMP_EQ 0 #define FUTEX_OP_CMP_NE 1 #define FUTEX_OP_CMP_LT 2 #define FUTEX_OP_CMP_LE 3 #define FUTEX_OP_CMP_GT 4 #define FUTEX_OP_CMP_GE 5 #define FUTEX_OP(op, oparg, cmp, cmparg) (((op & 0xf) << 28) | ((cmp & 0xf) << 24) | ((oparg & 0xfff) << 12) | (cmparg & 0xfff)) #endif android-audiosystem-1.8+13.10.20130807/include/linux/ublock.h0000644000015700001700000000300712200324306024104 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __UBLOCK_H_ #define __UBLOCK_H_ #include #define UBLOCK_VERSION 0 enum { UBLOCK_INIT_IN = 0, UBLOCK_INIT_OUT = 1, UBLOCK_READY_IN = 2, UBLOCK_READY_OUT = 3, UBLOCK_READ_IN = 4, UBLOCK_READ_OUT = 5, UBLOCK_WRITE_IN = 6, UBLOCK_WRITE_OUT = 7, }; struct ublock_in_header { __u32 seq; __u32 opcode; }; struct ublock_out_header { __u32 seq; __u32 opcode; }; struct ublock_init_in { __u32 version; __u32 max_buf; __u32 index; }; struct ublock_init_out { __u32 version; __u32 max_buf; __u64 size; }; struct ublock_ready_in { __u32 _unused; }; struct ublock_ready_out { __u32 _unused; }; struct ublock_read_in { __u64 offset; __u64 length; }; struct ublock_read_out { __s32 status; __u8 data[]; }; struct ublock_write_in { __u64 offset; __u64 length; __u8 data[]; }; struct ublock_write_out { __s32 status; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/irqreturn.h0000644000015700001700000000150212200324306024656 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IRQRETURN_H #define _LINUX_IRQRETURN_H typedef int irqreturn_t; #define IRQ_NONE (0) #define IRQ_HANDLED (1) #define IRQ_RETVAL(x) ((x) != 0) #endif android-audiosystem-1.8+13.10.20130807/include/linux/lockdep.h0000644000015700001700000000404012200324306024244 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_LOCKDEP_H #define __LINUX_LOCKDEP_H #include #include #include #include #define lock_acquire(l, s, t, r, c, i) do { } while (0) #define lock_release(l, n, i) do { } while (0) #define lockdep_init() do { } while (0) #define lockdep_info() do { } while (0) #define lockdep_init_map(lock, name, key) do { (void)(key); } while (0) #define lockdep_set_class(lock, key) do { (void)(key); } while (0) #define lockdep_set_class_and_name(lock, key, name) do { (void)(key); } while (0) #define INIT_LOCKDEP #define lockdep_reset() do { debug_locks = 1; } while (0) #define lockdep_free_key_range(start, size) do { } while (0) #define early_init_irq_lock_class() do { } while (0) #define early_boot_irqs_off() do { } while (0) #define early_boot_irqs_on() do { } while (0) #define SINGLE_DEPTH_NESTING 1 #define spin_acquire(l, s, t, i) do { } while (0) #define spin_release(l, n, i) do { } while (0) #define rwlock_acquire(l, s, t, i) do { } while (0) #define rwlock_acquire_read(l, s, t, i) do { } while (0) #define rwlock_release(l, n, i) do { } while (0) #define mutex_acquire(l, s, t, i) do { } while (0) #define mutex_release(l, n, i) do { } while (0) #define rwsem_acquire(l, s, t, i) do { } while (0) #define rwsem_acquire_read(l, s, t, i) do { } while (0) #define rwsem_release(l, n, i) do { } while (0) #endif android-audiosystem-1.8+13.10.20130807/include/linux/mca.h0000644000015700001700000000366612200324306023400 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_MCA_H #define _LINUX_MCA_H #include #define MCA_bus 0 typedef int (*MCA_ProcFn)(char* buf, int slot, void* dev); enum MCA_AdapterStatus { MCA_ADAPTER_NORMAL = 0, MCA_ADAPTER_NONE = 1, MCA_ADAPTER_DISABLED = 2, MCA_ADAPTER_ERROR = 3 }; struct mca_device { u64 dma_mask; int pos_id; int slot; int index; int driver_loaded; unsigned char pos[8]; short pos_register; enum MCA_AdapterStatus status; struct device dev; char name[32]; }; #define to_mca_device(mdev) container_of(mdev, struct mca_device, dev) struct mca_bus_accessor_functions { unsigned char (*mca_read_pos)(struct mca_device *, int reg); void (*mca_write_pos)(struct mca_device *, int reg, unsigned char byte); int (*mca_transform_irq)(struct mca_device *, int irq); int (*mca_transform_ioport)(struct mca_device *, int region); void * (*mca_transform_memory)(struct mca_device *, void *memory); }; struct mca_bus { u64 default_dma_mask; int number; struct mca_bus_accessor_functions f; struct device dev; char name[32]; }; #define to_mca_bus(mdev) container_of(mdev, struct mca_bus, dev) struct mca_driver { const short *id_table; void *driver_data; struct device_driver driver; }; #define to_mca_driver(mdriver) container_of(mdriver, struct mca_driver, driver) #endif android-audiosystem-1.8+13.10.20130807/include/linux/nfsd/0000755000015700001700000000000012200324404023405 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/linux/nfsd/xdr.h0000644000015700001700000000501312200324306024353 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef LINUX_NFSD_H #define LINUX_NFSD_H #include #include #include struct nfsd_fhandle { struct svc_fh fh; }; struct nfsd_sattrargs { struct svc_fh fh; struct iattr attrs; }; struct nfsd_diropargs { struct svc_fh fh; char * name; int len; }; struct nfsd_readargs { struct svc_fh fh; __u32 offset; __u32 count; struct kvec vec[RPCSVC_MAXPAGES]; int vlen; }; struct nfsd_writeargs { svc_fh fh; __u32 offset; int len; struct kvec vec[RPCSVC_MAXPAGES]; int vlen; }; struct nfsd_createargs { struct svc_fh fh; char * name; int len; struct iattr attrs; }; struct nfsd_renameargs { struct svc_fh ffh; char * fname; int flen; struct svc_fh tfh; char * tname; int tlen; }; struct nfsd_readlinkargs { struct svc_fh fh; char * buffer; }; struct nfsd_linkargs { struct svc_fh ffh; struct svc_fh tfh; char * tname; int tlen; }; struct nfsd_symlinkargs { struct svc_fh ffh; char * fname; int flen; char * tname; int tlen; struct iattr attrs; }; struct nfsd_readdirargs { struct svc_fh fh; __u32 cookie; __u32 count; u32 * buffer; }; struct nfsd_attrstat { struct svc_fh fh; struct kstat stat; }; struct nfsd_diropres { struct svc_fh fh; struct kstat stat; }; struct nfsd_readlinkres { int len; }; struct nfsd_readres { struct svc_fh fh; unsigned long count; struct kstat stat; }; struct nfsd_readdirres { int count; struct readdir_cd common; u32 * buffer; int buflen; u32 * offset; }; struct nfsd_statfsres { struct kstatfs stats; }; union nfsd_xdrstore { struct nfsd_sattrargs sattr; struct nfsd_diropargs dirop; struct nfsd_readargs read; struct nfsd_writeargs write; struct nfsd_createargs create; struct nfsd_renameargs rename; struct nfsd_linkargs link; struct nfsd_symlinkargs symlink; struct nfsd_readdirargs readdir; }; #define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore) #endif android-audiosystem-1.8+13.10.20130807/include/linux/nfsd/nfsfh.h0000644000015700001700000000343212200324306024665 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_NFSD_FH_H #define _LINUX_NFSD_FH_H #include #include #include struct nfs_fhbase_old { __u32 fb_dcookie; __u32 fb_ino; __u32 fb_dirino; __u32 fb_dev; __u32 fb_xdev; __u32 fb_xino; __u32 fb_generation; }; struct nfs_fhbase_new { __u8 fb_version; __u8 fb_auth_type; __u8 fb_fsid_type; __u8 fb_fileid_type; __u32 fb_auth[1]; }; struct knfsd_fh { unsigned int fh_size; union { struct nfs_fhbase_old fh_old; __u32 fh_pad[NFS4_FHSIZE/4]; struct nfs_fhbase_new fh_new; } fh_base; }; #define ofh_dcookie fh_base.fh_old.fb_dcookie #define ofh_ino fh_base.fh_old.fb_ino #define ofh_dirino fh_base.fh_old.fb_dirino #define ofh_dev fh_base.fh_old.fb_dev #define ofh_xdev fh_base.fh_old.fb_xdev #define ofh_xino fh_base.fh_old.fb_xino #define ofh_generation fh_base.fh_old.fb_generation #define fh_version fh_base.fh_new.fb_version #define fh_fsid_type fh_base.fh_new.fb_fsid_type #define fh_auth_type fh_base.fh_new.fb_auth_type #define fh_fileid_type fh_base.fh_new.fb_fileid_type #define fh_auth fh_base.fh_new.fb_auth #define fh_fsid fh_base.fh_new.fb_auth #endif android-audiosystem-1.8+13.10.20130807/include/linux/nfsd/export.h0000644000015700001700000000237412200324306025106 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef NFSD_EXPORT_H #define NFSD_EXPORT_H #include #define NFSCLNT_IDMAX 1024 #define NFSCLNT_ADDRMAX 16 #define NFSCLNT_KEYMAX 32 #define NFSEXP_READONLY 0x0001 #define NFSEXP_INSECURE_PORT 0x0002 #define NFSEXP_ROOTSQUASH 0x0004 #define NFSEXP_ALLSQUASH 0x0008 #define NFSEXP_ASYNC 0x0010 #define NFSEXP_GATHERED_WRITES 0x0020 #define NFSEXP_NOHIDE 0x0200 #define NFSEXP_NOSUBTREECHECK 0x0400 #define NFSEXP_NOAUTHNLM 0x0800 #define NFSEXP_MSNFS 0x1000 #define NFSEXP_FSID 0x2000 #define NFSEXP_CROSSMOUNT 0x4000 #define NFSEXP_NOACL 0x8000 #define NFSEXP_ALLFLAGS 0xFE3F #endif android-audiosystem-1.8+13.10.20130807/include/linux/nfsd/debug.h0000644000015700001700000000220112200324306024640 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef LINUX_NFSD_DEBUG_H #define LINUX_NFSD_DEBUG_H #include #ifdef RPC_DEBUG #define NFSD_DEBUG 1 #endif #define NFSDDBG_SOCK 0x0001 #define NFSDDBG_FH 0x0002 #define NFSDDBG_EXPORT 0x0004 #define NFSDDBG_SVC 0x0008 #define NFSDDBG_PROC 0x0010 #define NFSDDBG_FILEOP 0x0020 #define NFSDDBG_AUTH 0x0040 #define NFSDDBG_REPCACHE 0x0080 #define NFSDDBG_XDR 0x0100 #define NFSDDBG_LOCKD 0x0200 #define NFSDDBG_ALL 0x7FFF #define NFSDDBG_NOCHANGE 0xFFFF #endif android-audiosystem-1.8+13.10.20130807/include/linux/nfsd/auth.h0000644000015700001700000000132712200324306024523 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef LINUX_NFSD_AUTH_H #define LINUX_NFSD_AUTH_H #endif android-audiosystem-1.8+13.10.20130807/include/linux/nfsd/interface.h0000644000015700001700000000134112200324306025516 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef LINUX_NFSD_INTERFACE_H #define LINUX_NFSD_INTERFACE_H #endif android-audiosystem-1.8+13.10.20130807/include/linux/nfsd/stats.h0000644000015700001700000000225512200324306024721 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef LINUX_NFSD_STATS_H #define LINUX_NFSD_STATS_H #include struct nfsd_stats { unsigned int rchits; unsigned int rcmisses; unsigned int rcnocache; unsigned int fh_stale; unsigned int fh_lookup; unsigned int fh_anon; unsigned int fh_nocache_dir; unsigned int fh_nocache_nondir; unsigned int io_read; unsigned int io_write; unsigned int th_cnt; unsigned int th_usage[10]; unsigned int th_fullcnt; unsigned int ra_size; unsigned int ra_depth[11]; }; #define NFSD_USAGE_WRAP (HZ*1000000) #endif android-audiosystem-1.8+13.10.20130807/include/linux/nfsd/const.h0000644000015700001700000000157212200324306024712 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_NFSD_CONST_H #define _LINUX_NFSD_CONST_H #include #include #include #include #define NFSSVC_MAXVERS 3 #define NFSSVC_MAXBLKSIZE (32*1024) #endif android-audiosystem-1.8+13.10.20130807/include/linux/kobject.h0000644000015700001700000000131312200324306024244 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _KOBJECT_H_ #define _KOBJECT_H_ #endif android-audiosystem-1.8+13.10.20130807/include/linux/kref.h0000644000015700001700000000130512200324306023553 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _KREF_H_ #define _KREF_H_ #endif android-audiosystem-1.8+13.10.20130807/include/linux/circ_buf.h0000644000015700001700000000226012200324306024401 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_CIRC_BUF_H #define _LINUX_CIRC_BUF_H 1 struct circ_buf { char *buf; int head; int tail; }; #define CIRC_CNT(head,tail,size) (((head) - (tail)) & ((size)-1)) #define CIRC_SPACE(head,tail,size) CIRC_CNT((tail),((head)+1),(size)) #define CIRC_CNT_TO_END(head,tail,size) ({int end = (size) - (tail); int n = ((head) + end) & ((size)-1); n < end ? n : end;}) #define CIRC_SPACE_TO_END(head,tail,size) ({int end = (size) - 1 - (head); int n = (end + (tail)) & ((size)-1); n <= end ? n : end+1;}) #endif android-audiosystem-1.8+13.10.20130807/include/linux/nodemask.h0000644000015700001700000001200612200324306024425 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_NODEMASK_H #define __LINUX_NODEMASK_H #include #include #include #include typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t; #define node_set(node, dst) __node_set((node), &(dst)) #define node_clear(node, dst) __node_clear((node), &(dst)) #define nodes_setall(dst) __nodes_setall(&(dst), MAX_NUMNODES) #define nodes_clear(dst) __nodes_clear(&(dst), MAX_NUMNODES) #define node_isset(node, nodemask) test_bit((node), (nodemask).bits) #define node_test_and_set(node, nodemask) __node_test_and_set((node), &(nodemask)) #define nodes_and(dst, src1, src2) __nodes_and(&(dst), &(src1), &(src2), MAX_NUMNODES) #define nodes_or(dst, src1, src2) __nodes_or(&(dst), &(src1), &(src2), MAX_NUMNODES) #define nodes_xor(dst, src1, src2) __nodes_xor(&(dst), &(src1), &(src2), MAX_NUMNODES) #define nodes_andnot(dst, src1, src2) __nodes_andnot(&(dst), &(src1), &(src2), MAX_NUMNODES) #define nodes_complement(dst, src) __nodes_complement(&(dst), &(src), MAX_NUMNODES) #define nodes_equal(src1, src2) __nodes_equal(&(src1), &(src2), MAX_NUMNODES) #define nodes_intersects(src1, src2) __nodes_intersects(&(src1), &(src2), MAX_NUMNODES) #define nodes_subset(src1, src2) __nodes_subset(&(src1), &(src2), MAX_NUMNODES) #define nodes_empty(src) __nodes_empty(&(src), MAX_NUMNODES) #define nodes_full(nodemask) __nodes_full(&(nodemask), MAX_NUMNODES) #define nodes_weight(nodemask) __nodes_weight(&(nodemask), MAX_NUMNODES) #define nodes_shift_right(dst, src, n) __nodes_shift_right(&(dst), &(src), (n), MAX_NUMNODES) #define nodes_shift_left(dst, src, n) __nodes_shift_left(&(dst), &(src), (n), MAX_NUMNODES) #define first_node(src) __first_node(&(src)) #define next_node(n, src) __next_node((n), &(src)) #define nodemask_of_node(node) ({ typeof(_unused_nodemask_arg_) m; if (sizeof(m) == sizeof(unsigned long)) { m.bits[0] = 1UL<<(node); } else { nodes_clear(m); node_set((node), m); } m; }) #define first_unset_node(mask) __first_unset_node(&(mask)) #define NODE_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(MAX_NUMNODES) #if MAX_NUMNODES <= BITS_PER_LONG #define NODE_MASK_ALL ((nodemask_t) { { [BITS_TO_LONGS(MAX_NUMNODES)-1] = NODE_MASK_LAST_WORD } }) #else #define NODE_MASK_ALL ((nodemask_t) { { [0 ... BITS_TO_LONGS(MAX_NUMNODES)-2] = ~0UL, [BITS_TO_LONGS(MAX_NUMNODES)-1] = NODE_MASK_LAST_WORD } }) #endif #define NODE_MASK_NONE ((nodemask_t) { { [0 ... BITS_TO_LONGS(MAX_NUMNODES)-1] = 0UL } }) #define nodes_addr(src) ((src).bits) #define nodemask_scnprintf(buf, len, src) __nodemask_scnprintf((buf), (len), &(src), MAX_NUMNODES) #define nodemask_parse(ubuf, ulen, dst) __nodemask_parse((ubuf), (ulen), &(dst), MAX_NUMNODES) #define nodelist_scnprintf(buf, len, src) __nodelist_scnprintf((buf), (len), &(src), MAX_NUMNODES) #define nodelist_parse(buf, dst) __nodelist_parse((buf), &(dst), MAX_NUMNODES) #define node_remap(oldbit, old, new) __node_remap((oldbit), &(old), &(new), MAX_NUMNODES) #define nodes_remap(dst, src, old, new) __nodes_remap(&(dst), &(src), &(old), &(new), MAX_NUMNODES) #if MAX_NUMNODES > 1 #define for_each_node_mask(node, mask) for ((node) = first_node(mask); (node) < MAX_NUMNODES; (node) = next_node((node), (mask))) #else #define for_each_node_mask(node, mask) if (!nodes_empty(mask)) for ((node) = 0; (node) < 1; (node)++) #endif #if MAX_NUMNODES > 1 #define num_online_nodes() nodes_weight(node_online_map) #define num_possible_nodes() nodes_weight(node_possible_map) #define node_online(node) node_isset((node), node_online_map) #define node_possible(node) node_isset((node), node_possible_map) #define first_online_node first_node(node_online_map) #define next_online_node(nid) next_node((nid), node_online_map) #else #define num_online_nodes() 1 #define num_possible_nodes() 1 #define node_online(node) ((node) == 0) #define node_possible(node) ((node) == 0) #define first_online_node 0 #define next_online_node(nid) (MAX_NUMNODES) #endif #define any_online_node(mask) ({ int node; for_each_node_mask(node, (mask)) if (node_online(node)) break; node; }) #define node_set_online(node) set_bit((node), node_online_map.bits) #define node_set_offline(node) clear_bit((node), node_online_map.bits) #define for_each_node(node) for_each_node_mask((node), node_possible_map) #define for_each_online_node(node) for_each_node_mask((node), node_online_map) #endif android-audiosystem-1.8+13.10.20130807/include/linux/atmppp.h0000644000015700001700000000162512200324306024132 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ATMPPP_H #define _LINUX_ATMPPP_H #include #define PPPOATM_ENCAPS_AUTODETECT (0) #define PPPOATM_ENCAPS_VC (1) #define PPPOATM_ENCAPS_LLC (2) struct atm_backend_ppp { atm_backend_t backend_num; int encaps; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/nfs.h0000644000015700001700000000617112200324306023420 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_NFS_H #define _LINUX_NFS_H #define NFS_PROGRAM 100003 #define NFS_PORT 2049 #define NFS_MAXDATA 8192 #define NFS_MAXPATHLEN 1024 #define NFS_MAXNAMLEN 255 #define NFS_MAXGROUPS 16 #define NFS_FHSIZE 32 #define NFS_COOKIESIZE 4 #define NFS_FIFO_DEV (-1) #define NFSMODE_FMT 0170000 #define NFSMODE_DIR 0040000 #define NFSMODE_CHR 0020000 #define NFSMODE_BLK 0060000 #define NFSMODE_REG 0100000 #define NFSMODE_LNK 0120000 #define NFSMODE_SOCK 0140000 #define NFSMODE_FIFO 0010000 #define NFS_MNT_PROGRAM 100005 #define NFS_MNT_PORT 627 enum nfs_stat { NFS_OK = 0, NFSERR_PERM = 1, NFSERR_NOENT = 2, NFSERR_IO = 5, NFSERR_NXIO = 6, NFSERR_EAGAIN = 11, NFSERR_ACCES = 13, NFSERR_EXIST = 17, NFSERR_XDEV = 18, NFSERR_NODEV = 19, NFSERR_NOTDIR = 20, NFSERR_ISDIR = 21, NFSERR_INVAL = 22, NFSERR_FBIG = 27, NFSERR_NOSPC = 28, NFSERR_ROFS = 30, NFSERR_MLINK = 31, NFSERR_OPNOTSUPP = 45, NFSERR_NAMETOOLONG = 63, NFSERR_NOTEMPTY = 66, NFSERR_DQUOT = 69, NFSERR_STALE = 70, NFSERR_REMOTE = 71, NFSERR_WFLUSH = 99, NFSERR_BADHANDLE = 10001, NFSERR_NOT_SYNC = 10002, NFSERR_BAD_COOKIE = 10003, NFSERR_NOTSUPP = 10004, NFSERR_TOOSMALL = 10005, NFSERR_SERVERFAULT = 10006, NFSERR_BADTYPE = 10007, NFSERR_JUKEBOX = 10008, NFSERR_SAME = 10009, NFSERR_DENIED = 10010, NFSERR_EXPIRED = 10011, NFSERR_LOCKED = 10012, NFSERR_GRACE = 10013, NFSERR_FHEXPIRED = 10014, NFSERR_SHARE_DENIED = 10015, NFSERR_WRONGSEC = 10016, NFSERR_CLID_INUSE = 10017, NFSERR_RESOURCE = 10018, NFSERR_MOVED = 10019, NFSERR_NOFILEHANDLE = 10020, NFSERR_MINOR_VERS_MISMATCH = 10021, NFSERR_STALE_CLIENTID = 10022, NFSERR_STALE_STATEID = 10023, NFSERR_OLD_STATEID = 10024, NFSERR_BAD_STATEID = 10025, NFSERR_BAD_SEQID = 10026, NFSERR_NOT_SAME = 10027, NFSERR_LOCK_RANGE = 10028, NFSERR_SYMLINK = 10029, NFSERR_RESTOREFH = 10030, NFSERR_LEASE_MOVED = 10031, NFSERR_ATTRNOTSUPP = 10032, NFSERR_NO_GRACE = 10033, NFSERR_RECLAIM_BAD = 10034, NFSERR_RECLAIM_CONFLICT = 10035, NFSERR_BAD_XDR = 10036, NFSERR_LOCKS_HELD = 10037, NFSERR_OPENMODE = 10038, NFSERR_BADOWNER = 10039, NFSERR_BADCHAR = 10040, NFSERR_BADNAME = 10041, NFSERR_BAD_RANGE = 10042, NFSERR_LOCK_NOTSUPP = 10043, NFSERR_OP_ILLEGAL = 10044, NFSERR_DEADLOCK = 10045, NFSERR_FILE_OPEN = 10046, NFSERR_ADMIN_REVOKED = 10047, NFSERR_CB_PATH_DOWN = 10048, NFSERR_REPLAY_ME = 10049 }; enum nfs_ftype { NFNON = 0, NFREG = 1, NFDIR = 2, NFBLK = 3, NFCHR = 4, NFLNK = 5, NFSOCK = 6, NFBAD = 7, NFFIFO = 8 }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/signal.h0000644000015700001700000000140512200324306024102 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SIGNAL_H #define _LINUX_SIGNAL_H #include #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/irq.h0000644000015700001700000000564612200324306023433 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IRQ_H #define _LINUX_IRQ_H #include #include #include #include #include #include #include #include #define IRQ_TYPE_NONE 0x00000000 #define IRQ_TYPE_EDGE_RISING 0x00000001 #define IRQ_TYPE_EDGE_FALLING 0x00000002 #define IRQ_TYPE_EDGE_BOTH (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING) #define IRQ_TYPE_LEVEL_HIGH 0x00000004 #define IRQ_TYPE_LEVEL_LOW 0x00000008 #define IRQ_TYPE_SENSE_MASK 0x0000000f #define IRQ_TYPE_PROBE 0x00000010 #define IRQ_INPROGRESS 0x00010000 #define IRQ_DISABLED 0x00020000 #define IRQ_PENDING 0x00040000 #define IRQ_REPLAY 0x00080000 #define IRQ_AUTODETECT 0x00100000 #define IRQ_WAITING 0x00200000 #define IRQ_LEVEL 0x00400000 #define IRQ_MASKED 0x00800000 #define IRQ_PER_CPU 0x01000000 #define CHECK_IRQ_PER_CPU(var) 0 #define IRQ_NOPROBE 0x02000000 #define IRQ_NOREQUEST 0x04000000 #define IRQ_NOAUTOEN 0x08000000 #define IRQ_DELAYED_DISABLE 0x10000000 #define IRQ_WAKEUP 0x20000000 struct proc_dir_entry; struct irq_chip { const char *name; unsigned int (*startup)(unsigned int irq); void (*shutdown)(unsigned int irq); void (*enable)(unsigned int irq); void (*disable)(unsigned int irq); void (*ack)(unsigned int irq); void (*mask)(unsigned int irq); void (*mask_ack)(unsigned int irq); void (*unmask)(unsigned int irq); void (*eoi)(unsigned int irq); void (*end)(unsigned int irq); void (*set_affinity)(unsigned int irq, cpumask_t dest); int (*retrigger)(unsigned int irq); int (*set_type)(unsigned int irq, unsigned int flow_type); int (*set_wake)(unsigned int irq, unsigned int on); const char *typename; }; struct irq_desc { void fastcall (*handle_irq)(unsigned int irq, struct irq_desc *desc, struct pt_regs *regs); struct irq_chip *chip; void *handler_data; void *chip_data; struct irqaction *action; unsigned int status; unsigned int depth; unsigned int wake_depth; unsigned int irq_count; unsigned int irqs_unhandled; spinlock_t lock; } ____cacheline_aligned; #define hw_interrupt_type irq_chip typedef struct irq_chip hw_irq_controller; #define no_irq_type no_irq_chip typedef struct irq_desc irq_desc_t; #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/compat.h0000644000015700001700000000132312200324306024107 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_COMPAT_H #define _LINUX_COMPAT_H #endif android-audiosystem-1.8+13.10.20130807/include/linux/prctl.h0000644000015700001700000000336112200324306023754 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_PRCTL_H #define _LINUX_PRCTL_H #define PR_SET_PDEATHSIG 1 #define PR_GET_PDEATHSIG 2 #define PR_GET_DUMPABLE 3 #define PR_SET_DUMPABLE 4 #define PR_GET_UNALIGN 5 #define PR_SET_UNALIGN 6 #define PR_UNALIGN_NOPRINT 1 #define PR_UNALIGN_SIGBUS 2 #define PR_GET_KEEPCAPS 7 #define PR_SET_KEEPCAPS 8 #define PR_GET_FPEMU 9 #define PR_SET_FPEMU 10 #define PR_FPEMU_NOPRINT 1 #define PR_FPEMU_SIGFPE 2 #define PR_GET_FPEXC 11 #define PR_SET_FPEXC 12 #define PR_FP_EXC_SW_ENABLE 0x80 #define PR_FP_EXC_DIV 0x010000 #define PR_FP_EXC_OVF 0x020000 #define PR_FP_EXC_UND 0x040000 #define PR_FP_EXC_RES 0x080000 #define PR_FP_EXC_INV 0x100000 #define PR_FP_EXC_DISABLED 0 #define PR_FP_EXC_NONRECOV 1 #define PR_FP_EXC_ASYNC 2 #define PR_FP_EXC_PRECISE 3 #define PR_GET_TIMING 13 #define PR_SET_TIMING 14 #define PR_TIMING_STATISTICAL 0 #define PR_TIMING_TIMESTAMP 1 #define PR_SET_NAME 15 #define PR_GET_NAME 16 #define PR_GET_ENDIAN 19 #define PR_SET_ENDIAN 20 #define PR_ENDIAN_BIG 0 #define PR_ENDIAN_LITTLE 1 #define PR_ENDIAN_PPC_LITTLE 2 #endif android-audiosystem-1.8+13.10.20130807/include/linux/patchkey.h0000644000015700001700000000203612200324306024436 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_PATCHKEY_H_INDIRECT #error "patchkey.h included directly" #endif #ifndef _LINUX_PATCHKEY_H #define _LINUX_PATCHKEY_H #include #ifdef __BYTE_ORDER #if __BYTE_ORDER == __BIG_ENDIAN #define _PATCHKEY(id) (0xfd00|id) #elif __BYTE_ORDER == __LITTLE_ENDIAN #define _PATCHKEY(id) ((id<<8)|0x00fd) #else #error "could not determine byte order" #endif #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/coda.h0000644000015700001700000002602612200324306023541 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _CODA_HEADER_ #define _CODA_HEADER_ #if defined(__NetBSD__) || (defined(DJGPP) || defined(__CYGWIN32__)) && !defined(KERNEL) #include #endif #ifndef CODA_MAXSYMLINKS #define CODA_MAXSYMLINKS 10 #endif #if defined(DJGPP) || defined(__CYGWIN32__) #ifdef KERNEL typedef unsigned long u_long; typedef unsigned int u_int; typedef unsigned short u_short; typedef u_long ino_t; typedef u_long dev_t; typedef void * caddr_t; #ifdef DOS typedef unsigned __int64 u_quad_t; #else typedef unsigned long long u_quad_t; #endif #define inline struct timespec { long ts_sec; long ts_nsec; }; #else #include typedef unsigned long long u_quad_t; #endif #endif #ifdef __linux__ #include #define cdev_t u_quad_t #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2) #define _UQUAD_T_ 1 typedef unsigned long long u_quad_t; #endif #else #define cdev_t dev_t #endif #ifdef __CYGWIN32__ struct timespec { time_t tv_sec; long tv_nsec; }; #endif #ifndef __BIT_TYPES_DEFINED__ #define __BIT_TYPES_DEFINED__ typedef signed char int8_t; typedef unsigned char u_int8_t; typedef short int16_t; typedef unsigned short u_int16_t; typedef int int32_t; typedef unsigned int u_int32_t; #endif #define CODA_MAXNAMLEN 255 #define CODA_MAXPATHLEN 1024 #define CODA_MAXSYMLINK 10 #define C_O_READ 0x001 #define C_O_WRITE 0x002 #define C_O_TRUNC 0x010 #define C_O_EXCL 0x100 #define C_O_CREAT 0x200 #define C_M_READ 00400 #define C_M_WRITE 00200 #define C_A_C_OK 8 #define C_A_R_OK 4 #define C_A_W_OK 2 #define C_A_X_OK 1 #define C_A_F_OK 0 #ifndef _VENUS_DIRENT_T_ #define _VENUS_DIRENT_T_ 1 struct venus_dirent { u_int32_t d_fileno; u_int16_t d_reclen; u_int8_t d_type; u_int8_t d_namlen; char d_name[CODA_MAXNAMLEN + 1]; }; #undef DIRSIZ #define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3)) #define CDT_UNKNOWN 0 #define CDT_FIFO 1 #define CDT_CHR 2 #define CDT_DIR 4 #define CDT_BLK 6 #define CDT_REG 8 #define CDT_LNK 10 #define CDT_SOCK 12 #define CDT_WHT 14 #define IFTOCDT(mode) (((mode) & 0170000) >> 12) #define CDTTOIF(dirtype) ((dirtype) << 12) #endif #ifndef _VUID_T_ #define _VUID_T_ typedef u_int32_t vuid_t; typedef u_int32_t vgid_t; #endif struct CodaFid { u_int32_t opaque[4]; }; #define coda_f2i(fid) (fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0) #ifndef _VENUS_VATTR_T_ #define _VENUS_VATTR_T_ enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD }; struct coda_vattr { long va_type; u_short va_mode; short va_nlink; vuid_t va_uid; vgid_t va_gid; long va_fileid; u_quad_t va_size; long va_blocksize; struct timespec va_atime; struct timespec va_mtime; struct timespec va_ctime; u_long va_gen; u_long va_flags; cdev_t va_rdev; u_quad_t va_bytes; u_quad_t va_filerev; }; #endif struct coda_statfs { int32_t f_blocks; int32_t f_bfree; int32_t f_bavail; int32_t f_files; int32_t f_ffree; }; #define CODA_ROOT 2 #define CODA_OPEN_BY_FD 3 #define CODA_OPEN 4 #define CODA_CLOSE 5 #define CODA_IOCTL 6 #define CODA_GETATTR 7 #define CODA_SETATTR 8 #define CODA_ACCESS 9 #define CODA_LOOKUP 10 #define CODA_CREATE 11 #define CODA_REMOVE 12 #define CODA_LINK 13 #define CODA_RENAME 14 #define CODA_MKDIR 15 #define CODA_RMDIR 16 #define CODA_SYMLINK 18 #define CODA_READLINK 19 #define CODA_FSYNC 20 #define CODA_VGET 22 #define CODA_SIGNAL 23 #define CODA_REPLACE 24 #define CODA_FLUSH 25 #define CODA_PURGEUSER 26 #define CODA_ZAPFILE 27 #define CODA_ZAPDIR 28 #define CODA_PURGEFID 30 #define CODA_OPEN_BY_PATH 31 #define CODA_RESOLVE 32 #define CODA_REINTEGRATE 33 #define CODA_STATFS 34 #define CODA_STORE 35 #define CODA_RELEASE 36 #define CODA_NCALLS 37 #define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID) #define VC_MAXDATASIZE 8192 #define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) + VC_MAXDATASIZE #define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t) #define CODA_KERNEL_VERSION 3 struct coda_in_hdr { u_int32_t opcode; u_int32_t unique; pid_t pid; pid_t pgid; vuid_t uid; }; struct coda_out_hdr { u_int32_t opcode; u_int32_t unique; u_int32_t result; }; struct coda_root_out { struct coda_out_hdr oh; struct CodaFid VFid; }; struct coda_root_in { struct coda_in_hdr in; }; struct coda_open_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_open_out { struct coda_out_hdr oh; cdev_t dev; ino_t inode; }; struct coda_store_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_store_out { struct coda_out_hdr out; }; struct coda_release_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_release_out { struct coda_out_hdr out; }; struct coda_close_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_close_out { struct coda_out_hdr out; }; struct coda_ioctl_in { struct coda_in_hdr ih; struct CodaFid VFid; int cmd; int len; int rwflag; char *data; }; struct coda_ioctl_out { struct coda_out_hdr oh; int len; caddr_t data; }; struct coda_getattr_in { struct coda_in_hdr ih; struct CodaFid VFid; }; struct coda_getattr_out { struct coda_out_hdr oh; struct coda_vattr attr; }; struct coda_setattr_in { struct coda_in_hdr ih; struct CodaFid VFid; struct coda_vattr attr; }; struct coda_setattr_out { struct coda_out_hdr out; }; struct coda_access_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_access_out { struct coda_out_hdr out; }; #define CLU_CASE_SENSITIVE 0x01 #define CLU_CASE_INSENSITIVE 0x02 struct coda_lookup_in { struct coda_in_hdr ih; struct CodaFid VFid; int name; int flags; }; struct coda_lookup_out { struct coda_out_hdr oh; struct CodaFid VFid; int vtype; }; struct coda_create_in { struct coda_in_hdr ih; struct CodaFid VFid; struct coda_vattr attr; int excl; int mode; int name; }; struct coda_create_out { struct coda_out_hdr oh; struct CodaFid VFid; struct coda_vattr attr; }; struct coda_remove_in { struct coda_in_hdr ih; struct CodaFid VFid; int name; }; struct coda_remove_out { struct coda_out_hdr out; }; struct coda_link_in { struct coda_in_hdr ih; struct CodaFid sourceFid; struct CodaFid destFid; int tname; }; struct coda_link_out { struct coda_out_hdr out; }; struct coda_rename_in { struct coda_in_hdr ih; struct CodaFid sourceFid; int srcname; struct CodaFid destFid; int destname; }; struct coda_rename_out { struct coda_out_hdr out; }; struct coda_mkdir_in { struct coda_in_hdr ih; struct CodaFid VFid; struct coda_vattr attr; int name; }; struct coda_mkdir_out { struct coda_out_hdr oh; struct CodaFid VFid; struct coda_vattr attr; }; struct coda_rmdir_in { struct coda_in_hdr ih; struct CodaFid VFid; int name; }; struct coda_rmdir_out { struct coda_out_hdr out; }; struct coda_symlink_in { struct coda_in_hdr ih; struct CodaFid VFid; int srcname; struct coda_vattr attr; int tname; }; struct coda_symlink_out { struct coda_out_hdr out; }; struct coda_readlink_in { struct coda_in_hdr ih; struct CodaFid VFid; }; struct coda_readlink_out { struct coda_out_hdr oh; int count; caddr_t data; }; struct coda_fsync_in { struct coda_in_hdr ih; struct CodaFid VFid; }; struct coda_fsync_out { struct coda_out_hdr out; }; struct coda_vget_in { struct coda_in_hdr ih; struct CodaFid VFid; }; struct coda_vget_out { struct coda_out_hdr oh; struct CodaFid VFid; int vtype; }; struct coda_purgeuser_out { struct coda_out_hdr oh; vuid_t uid; }; struct coda_zapfile_out { struct coda_out_hdr oh; struct CodaFid CodaFid; }; struct coda_zapdir_out { struct coda_out_hdr oh; struct CodaFid CodaFid; }; struct coda_purgefid_out { struct coda_out_hdr oh; struct CodaFid CodaFid; }; struct coda_replace_out { struct coda_out_hdr oh; struct CodaFid NewFid; struct CodaFid OldFid; }; struct coda_open_by_fd_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_open_by_fd_out { struct coda_out_hdr oh; int fd; }; struct coda_open_by_path_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_open_by_path_out { struct coda_out_hdr oh; int path; }; struct coda_statfs_in { struct coda_in_hdr in; }; struct coda_statfs_out { struct coda_out_hdr oh; struct coda_statfs stat; }; #define CODA_NOCACHE 0x80000000 union inputArgs { struct coda_in_hdr ih; struct coda_open_in coda_open; struct coda_store_in coda_store; struct coda_release_in coda_release; struct coda_close_in coda_close; struct coda_ioctl_in coda_ioctl; struct coda_getattr_in coda_getattr; struct coda_setattr_in coda_setattr; struct coda_access_in coda_access; struct coda_lookup_in coda_lookup; struct coda_create_in coda_create; struct coda_remove_in coda_remove; struct coda_link_in coda_link; struct coda_rename_in coda_rename; struct coda_mkdir_in coda_mkdir; struct coda_rmdir_in coda_rmdir; struct coda_symlink_in coda_symlink; struct coda_readlink_in coda_readlink; struct coda_fsync_in coda_fsync; struct coda_vget_in coda_vget; struct coda_open_by_fd_in coda_open_by_fd; struct coda_open_by_path_in coda_open_by_path; struct coda_statfs_in coda_statfs; }; union outputArgs { struct coda_out_hdr oh; struct coda_root_out coda_root; struct coda_open_out coda_open; struct coda_ioctl_out coda_ioctl; struct coda_getattr_out coda_getattr; struct coda_lookup_out coda_lookup; struct coda_create_out coda_create; struct coda_mkdir_out coda_mkdir; struct coda_readlink_out coda_readlink; struct coda_vget_out coda_vget; struct coda_purgeuser_out coda_purgeuser; struct coda_zapfile_out coda_zapfile; struct coda_zapdir_out coda_zapdir; struct coda_purgefid_out coda_purgefid; struct coda_replace_out coda_replace; struct coda_open_by_fd_out coda_open_by_fd; struct coda_open_by_path_out coda_open_by_path; struct coda_statfs_out coda_statfs; }; union coda_downcalls { struct coda_purgeuser_out purgeuser; struct coda_zapfile_out zapfile; struct coda_zapdir_out zapdir; struct coda_purgefid_out purgefid; struct coda_replace_out replace; }; #define PIOCPARM_MASK 0x0000ffff struct ViceIoctl { void __user *in; void __user *out; u_short in_size; u_short out_size; }; struct PioctlData { const char __user *path; int follow; struct ViceIoctl vi; }; #define CODA_CONTROL ".CONTROL" #define CODA_CONTROLLEN 8 #define CTL_INO -1 #define CODA_MOUNT_VERSION 1 struct coda_mount_data { int version; int fd; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/mempool.h0000644000015700001700000000211112200324306024270 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_MEMPOOL_H #define _LINUX_MEMPOOL_H #include struct kmem_cache; typedef void * (mempool_alloc_t)(gfp_t gfp_mask, void *pool_data); typedef void (mempool_free_t)(void *element, void *pool_data); typedef struct mempool_s { spinlock_t lock; int min_nr; int curr_nr; void **elements; void *pool_data; mempool_alloc_t *alloc; mempool_free_t *free; wait_queue_head_t wait; } mempool_t; #endif android-audiosystem-1.8+13.10.20130807/include/linux/rbtree.h0000644000015700001700000000310312200324306024105 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_RBTREE_H #define _LINUX_RBTREE_H #include #include struct rb_node { unsigned long rb_parent_color; #define RB_RED 0 #define RB_BLACK 1 struct rb_node *rb_right; struct rb_node *rb_left; } __attribute__((aligned(sizeof(long)))); struct rb_root { struct rb_node *rb_node; }; #define rb_parent(r) ((struct rb_node *)((r)->rb_parent_color & ~3)) #define rb_color(r) ((r)->rb_parent_color & 1) #define rb_is_red(r) (!rb_color(r)) #define rb_is_black(r) rb_color(r) #define rb_set_red(r) do { (r)->rb_parent_color &= ~1; } while (0) #define rb_set_black(r) do { (r)->rb_parent_color |= 1; } while (0) #define RB_ROOT (struct rb_root) { NULL, } #define rb_entry(ptr, type, member) container_of(ptr, type, member) #define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL) #define RB_EMPTY_NODE(node) (rb_parent(node) != node) #define RB_CLEAR_NODE(node) (rb_set_parent(node, node)) #endif android-audiosystem-1.8+13.10.20130807/include/linux/atm.h0000644000015700001700000000753512200324306023420 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ATM_H #define _LINUX_ATM_H #include #include #include #include #define ATM_CELL_SIZE 53 #define ATM_CELL_PAYLOAD 48 #define ATM_AAL0_SDU 52 #define ATM_MAX_AAL34_PDU 65535 #define ATM_AAL5_TRAILER 8 #define ATM_MAX_AAL5_PDU 65535 #define ATM_MAX_CDV 9999 #define ATM_NOT_RSV_VCI 32 #define ATM_MAX_VPI 255 #define ATM_MAX_VPI_NNI 4096 #define ATM_MAX_VCI 65535 #define ATM_NO_AAL 0 #define ATM_AAL0 13 #define ATM_AAL1 1 #define ATM_AAL2 2 #define ATM_AAL34 3 #define ATM_AAL5 5 #define __SO_ENCODE(l,n,t) ((((l) & 0x1FF) << 22) | ((n) << 16) | sizeof(t)) #define __SO_LEVEL_MATCH(c,m) (((c) >> 22) == ((m) & 0x1FF)) #define __SO_NUMBER(c) (((c) >> 16) & 0x3f) #define __SO_SIZE(c) ((c) & 0x3fff) #define SO_SETCLP __SO_ENCODE(SOL_ATM,0,int) #define SO_CIRANGE __SO_ENCODE(SOL_ATM,1,struct atm_cirange) #define SO_ATMQOS __SO_ENCODE(SOL_ATM,2,struct atm_qos) #define SO_ATMSAP __SO_ENCODE(SOL_ATM,3,struct atm_sap) #define SO_ATMPVC __SO_ENCODE(SOL_ATM,4,struct sockaddr_atmpvc) #define SO_MULTIPOINT __SO_ENCODE(SOL_ATM, 5, int) #define ATM_HDR_GFC_MASK 0xf0000000 #define ATM_HDR_GFC_SHIFT 28 #define ATM_HDR_VPI_MASK 0x0ff00000 #define ATM_HDR_VPI_SHIFT 20 #define ATM_HDR_VCI_MASK 0x000ffff0 #define ATM_HDR_VCI_SHIFT 4 #define ATM_HDR_PTI_MASK 0x0000000e #define ATM_HDR_PTI_SHIFT 1 #define ATM_HDR_CLP 0x00000001 #define ATM_PTI_US0 0 #define ATM_PTI_US1 1 #define ATM_PTI_UCES0 2 #define ATM_PTI_UCES1 3 #define ATM_PTI_SEGF5 4 #define ATM_PTI_E2EF5 5 #define ATM_PTI_RSV_RM 6 #define ATM_PTI_RSV 7 #define ATM_NONE 0 #define ATM_UBR 1 #define ATM_CBR 2 #define ATM_VBR 3 #define ATM_ABR 4 #define ATM_ANYCLASS 5 #define ATM_MAX_PCR -1 struct atm_trafprm { unsigned char traffic_class; int max_pcr; int pcr; int min_pcr; int max_cdv; int max_sdu; unsigned int icr; unsigned int tbe; unsigned int frtt : 24; unsigned int rif : 4; unsigned int rdf : 4; unsigned int nrm_pres :1; unsigned int trm_pres :1; unsigned int adtf_pres :1; unsigned int cdf_pres :1; unsigned int nrm :3; unsigned int trm :3; unsigned int adtf :10; unsigned int cdf :3; unsigned int spare :9; }; struct atm_qos { struct atm_trafprm txtp; struct atm_trafprm rxtp __ATM_API_ALIGN; unsigned char aal __ATM_API_ALIGN; }; #define ATM_ITF_ANY -1 #define ATM_VPI_ANY -1 #define ATM_VCI_ANY -1 #define ATM_VPI_UNSPEC -2 #define ATM_VCI_UNSPEC -2 struct sockaddr_atmpvc { unsigned short sap_family; struct { short itf; short vpi; int vci; } sap_addr __ATM_API_ALIGN; }; #define ATM_ESA_LEN 20 #define ATM_E164_LEN 12 #define ATM_AFI_DCC 0x39 #define ATM_AFI_ICD 0x47 #define ATM_AFI_E164 0x45 #define ATM_AFI_LOCAL 0x49 #define ATM_AFI_DCC_GROUP 0xBD #define ATM_AFI_ICD_GROUP 0xC5 #define ATM_AFI_E164_GROUP 0xC3 #define ATM_AFI_LOCAL_GROUP 0xC7 #define ATM_LIJ_NONE 0 #define ATM_LIJ 1 #define ATM_LIJ_RPJ 2 #define ATM_LIJ_NJ 3 struct sockaddr_atmsvc { unsigned short sas_family; struct { unsigned char prv[ATM_ESA_LEN]; char pub[ATM_E164_LEN+1]; char lij_type; uint32_t lij_id; } sas_addr __ATM_API_ALIGN; }; typedef unsigned short atm_backend_t; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/0000755000015700001700000000000012200324404025411 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_TTL.h0000644000015700001700000000153712200324306027110 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_TTL_H #define _IPT_TTL_H enum { IPT_TTL_SET = 0, IPT_TTL_INC, IPT_TTL_DEC }; #define IPT_TTL_MAXMODE IPT_TTL_DEC struct ipt_TTL_info { u_int8_t mode; u_int8_t ttl; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_string.h0000644000015700001700000000164112200324306027747 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_STRING_H #define _IPT_STRING_H #include #define IPT_STRING_MAX_PATTERN_SIZE XT_STRING_MAX_PATTERN_SIZE #define IPT_STRING_MAX_ALGO_NAME_SIZE XT_STRING_MAX_ALGO_NAME_SIZE #define ipt_string_info xt_string_info #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_NFQUEUE.h0000644000015700001700000000144212200324306027550 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_NFQ_TARGET_H #define _IPT_NFQ_TARGET_H #include #define ipt_NFQ_info xt_NFQ_info #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_CLASSIFY.h0000644000015700001700000000146612200324306027663 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_CLASSIFY_H #define _IPT_CLASSIFY_H #include #define ipt_classify_target_info xt_classify_target_info #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_TCPMSS.h0000644000015700001700000000144212200324306027451 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_TCPMSS_H #define _IPT_TCPMSS_H struct ipt_tcpmss_info { u_int16_t mss; }; #define IPT_TCPMSS_CLAMP_PMTU 0xffff #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_DSCP.h0000644000015700001700000000145712200324306027177 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_DSCP_TARGET_H #define _IPT_DSCP_TARGET_H #include struct ipt_DSCP_info { u_int8_t dscp; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_dccp.h0000644000015700001700000000176012200324306027354 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_DCCP_H_ #define _IPT_DCCP_H_ #include #define IPT_DCCP_SRC_PORTS XT_DCCP_SRC_PORTS #define IPT_DCCP_DEST_PORTS XT_DCCP_DEST_PORTS #define IPT_DCCP_TYPE XT_DCCP_TYPE #define IPT_DCCP_OPTION XT_DCCP_OPTION #define IPT_DCCP_VALID_FLAGS XT_DCCP_VALID_FLAGS #define ipt_dccp_info xt_dccp_info #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_connbytes.h0000644000015700001700000000231212200324306030441 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_CONNBYTES_H #define _IPT_CONNBYTES_H #include #define ipt_connbytes_what xt_connbytes_what #define IPT_CONNBYTES_PKTS XT_CONNBYTES_PKTS #define IPT_CONNBYTES_BYTES XT_CONNBYTES_BYTES #define IPT_CONNBYTES_AVGPKT XT_CONNBYTES_AVGPKT #define ipt_connbytes_direction xt_connbytes_direction #define IPT_CONNBYTES_DIR_ORIGINAL XT_CONNBYTES_DIR_ORIGINAL #define IPT_CONNBYTES_DIR_REPLY XT_CONNBYTES_DIR_REPLY #define IPT_CONNBYTES_DIR_BOTH XT_CONNBYTES_DIR_BOTH #define ipt_connbytes_info xt_connbytes_info #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_recent.h0000644000015700001700000000221312200324306027715 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_RECENT_H #define _IPT_RECENT_H #define RECENT_NAME "ipt_recent" #define RECENT_VER "v0.3.1" #define IPT_RECENT_CHECK 1 #define IPT_RECENT_SET 2 #define IPT_RECENT_UPDATE 4 #define IPT_RECENT_REMOVE 8 #define IPT_RECENT_TTL 16 #define IPT_RECENT_SOURCE 0 #define IPT_RECENT_DEST 1 #define IPT_RECENT_NAME_LEN 200 struct ipt_recent_info { u_int32_t seconds; u_int32_t hit_count; u_int8_t check_set; u_int8_t invert; char name[IPT_RECENT_NAME_LEN]; u_int8_t side; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_ah.h0000644000015700001700000000150112200324306027024 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_AH_H #define _IPT_AH_H struct ipt_ah { u_int32_t spis[2]; u_int8_t invflags; }; #define IPT_AH_INV_SPI 0x01 #define IPT_AH_INV_MASK 0x01 #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_dscp_.h0000644000015700001700000000153312200324306027531 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_DSCP_H #define _IPT_DSCP_H #define IPT_DSCP_MASK 0xfc #define IPT_DSCP_SHIFT 2 #define IPT_DSCP_MAX 0x3f struct ipt_dscp_info { u_int8_t dscp; u_int8_t invert; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_helper.h0000644000015700001700000000143612200324306027722 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_HELPER_H #define _IPT_HELPER_H #include #define ipt_helper_info xt_helper_info #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_hashlimit.h0000644000015700001700000000240012200324306030415 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_HASHLIMIT_H #define _IPT_HASHLIMIT_H #define IPT_HASHLIMIT_SCALE 10000 struct ipt_hashlimit_htable; #define IPT_HASHLIMIT_HASH_DIP 0x0001 #define IPT_HASHLIMIT_HASH_DPT 0x0002 #define IPT_HASHLIMIT_HASH_SIP 0x0004 #define IPT_HASHLIMIT_HASH_SPT 0x0008 struct hashlimit_cfg { u_int32_t mode; u_int32_t avg; u_int32_t burst; u_int32_t size; u_int32_t max; u_int32_t gc_interval; u_int32_t expire; }; struct ipt_hashlimit_info { char name [IFNAMSIZ]; struct hashlimit_cfg cfg; struct ipt_hashlimit_htable *hinfo; union { void *ptr; struct ipt_hashlimit_info *master; } u; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_physdev.h0000644000015700001700000000210112200324306030113 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_PHYSDEV_H #define _IPT_PHYSDEV_H #include #define IPT_PHYSDEV_OP_IN XT_PHYSDEV_OP_IN #define IPT_PHYSDEV_OP_OUT XT_PHYSDEV_OP_OUT #define IPT_PHYSDEV_OP_BRIDGED XT_PHYSDEV_OP_BRIDGED #define IPT_PHYSDEV_OP_ISIN XT_PHYSDEV_OP_ISIN #define IPT_PHYSDEV_OP_ISOUT XT_PHYSDEV_OP_ISOUT #define IPT_PHYSDEV_OP_MASK XT_PHYSDEV_OP_MASK #define ipt_physdev_info xt_physdev_info #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_mac.h0000644000015700001700000000141712200324306027202 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_MAC_H #define _IPT_MAC_H #include #define ipt_mac_info xt_mac_info #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_length.h0000644000015700001700000000143612200324306027724 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_LENGTH_H #define _IPT_LENGTH_H #include #define ipt_length_info xt_length_info #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ip_queue.h0000644000015700001700000000327112200324306027402 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IP_QUEUE_H #define _IP_QUEUE_H #include typedef struct ipq_packet_msg { unsigned long packet_id; unsigned long mark; long timestamp_sec; long timestamp_usec; unsigned int hook; char indev_name[IFNAMSIZ]; char outdev_name[IFNAMSIZ]; unsigned short hw_protocol; unsigned short hw_type; unsigned char hw_addrlen; unsigned char hw_addr[8]; size_t data_len; unsigned char payload[0]; } ipq_packet_msg_t; typedef struct ipq_mode_msg { unsigned char value; size_t range; } ipq_mode_msg_t; typedef struct ipq_verdict_msg { unsigned int value; unsigned long id; size_t data_len; unsigned char payload[0]; } ipq_verdict_msg_t; typedef struct ipq_peer_msg { union { ipq_verdict_msg_t verdict; ipq_mode_msg_t mode; } msg; } ipq_peer_msg_t; enum { IPQ_COPY_NONE, IPQ_COPY_META, IPQ_COPY_PACKET }; #define IPQ_COPY_MAX IPQ_COPY_PACKET #define IPQM_BASE 0x10 #define IPQM_MODE (IPQM_BASE + 1) #define IPQM_VERDICT (IPQM_BASE + 2) #define IPQM_PACKET (IPQM_BASE + 3) #define IPQM_MAX (IPQM_BASE + 4) #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_ULOG.h0000644000015700001700000000252512200324306027211 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_ULOG_H #define _IPT_ULOG_H #ifndef NETLINK_NFLOG #define NETLINK_NFLOG 5 #endif #define ULOG_DEFAULT_NLGROUP 1 #define ULOG_DEFAULT_QTHRESHOLD 1 #define ULOG_MAC_LEN 80 #define ULOG_PREFIX_LEN 32 #define ULOG_MAX_QLEN 50 struct ipt_ulog_info { unsigned int nl_group; size_t copy_range; size_t qthreshold; char prefix[ULOG_PREFIX_LEN]; }; typedef struct ulog_packet_msg { unsigned long mark; long timestamp_sec; long timestamp_usec; unsigned int hook; char indev_name[IFNAMSIZ]; char outdev_name[IFNAMSIZ]; size_t data_len; char prefix[ULOG_PREFIX_LEN]; unsigned char mac_len; unsigned char mac[ULOG_MAC_LEN]; unsigned char payload[0]; } ulog_packet_msg_t; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ip_tables.h0000644000015700001700000001070712200324306027532 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPTABLES_H #define _IPTABLES_H #include #include #include #define IPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN #define IPT_TABLE_MAXNAMELEN XT_FUNCTION_MAXNAMELEN #define ipt_match xt_match #define ipt_target xt_target #define ipt_table xt_table #define ipt_get_revision xt_get_revision struct ipt_ip { struct in_addr src, dst; struct in_addr smsk, dmsk; char iniface[IFNAMSIZ], outiface[IFNAMSIZ]; unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ]; u_int16_t proto; u_int8_t flags; u_int8_t invflags; }; #define ipt_entry_match xt_entry_match #define ipt_entry_target xt_entry_target #define ipt_standard_target xt_standard_target #define ipt_counters xt_counters #define IPT_F_FRAG 0x01 #define IPT_F_GOTO 0x02 #define IPT_F_MASK 0x03 #define IPT_INV_VIA_IN 0x01 #define IPT_INV_VIA_OUT 0x02 #define IPT_INV_TOS 0x04 #define IPT_INV_SRCIP 0x08 #define IPT_INV_DSTIP 0x10 #define IPT_INV_FRAG 0x20 #define IPT_INV_PROTO XT_INV_PROTO #define IPT_INV_MASK 0x7F struct ipt_entry { struct ipt_ip ip; unsigned int nfcache; u_int16_t target_offset; u_int16_t next_offset; unsigned int comefrom; struct xt_counters counters; unsigned char elems[0]; }; #define IPT_BASE_CTL XT_BASE_CTL #define IPT_SO_SET_REPLACE XT_SO_SET_REPLACE #define IPT_SO_SET_ADD_COUNTERS XT_SO_SET_ADD_COUNTERS #define IPT_SO_SET_MAX XT_SO_SET_MAX #define IPT_SO_GET_INFO XT_SO_GET_INFO #define IPT_SO_GET_ENTRIES XT_SO_GET_ENTRIES #define IPT_SO_GET_REVISION_MATCH XT_SO_GET_REVISION_MATCH #define IPT_SO_GET_REVISION_TARGET XT_SO_GET_REVISION_TARGET #define IPT_SO_GET_MAX XT_SO_GET_REVISION_TARGET #define IPT_CONTINUE XT_CONTINUE #define IPT_RETURN XT_RETURN #include #define ipt_udp xt_udp #define ipt_tcp xt_tcp #define IPT_TCP_INV_SRCPT XT_TCP_INV_SRCPT #define IPT_TCP_INV_DSTPT XT_TCP_INV_DSTPT #define IPT_TCP_INV_FLAGS XT_TCP_INV_FLAGS #define IPT_TCP_INV_OPTION XT_TCP_INV_OPTION #define IPT_TCP_INV_MASK XT_TCP_INV_MASK #define IPT_UDP_INV_SRCPT XT_UDP_INV_SRCPT #define IPT_UDP_INV_DSTPT XT_UDP_INV_DSTPT #define IPT_UDP_INV_MASK XT_UDP_INV_MASK struct ipt_icmp { u_int8_t type; u_int8_t code[2]; u_int8_t invflags; }; #define IPT_ICMP_INV 0x01 struct ipt_getinfo { char name[IPT_TABLE_MAXNAMELEN]; unsigned int valid_hooks; unsigned int hook_entry[NF_IP_NUMHOOKS]; unsigned int underflow[NF_IP_NUMHOOKS]; unsigned int num_entries; unsigned int size; }; struct ipt_replace { char name[IPT_TABLE_MAXNAMELEN]; unsigned int valid_hooks; unsigned int num_entries; unsigned int size; unsigned int hook_entry[NF_IP_NUMHOOKS]; unsigned int underflow[NF_IP_NUMHOOKS]; unsigned int num_counters; struct xt_counters __user *counters; struct ipt_entry entries[0]; }; #define ipt_counters_info xt_counters_info struct ipt_get_entries { char name[IPT_TABLE_MAXNAMELEN]; unsigned int size; struct ipt_entry entrytable[0]; }; #define IPT_STANDARD_TARGET XT_STANDARD_TARGET #define IPT_ERROR_TARGET XT_ERROR_TARGET static __inline__ struct ipt_entry_target * ipt_get_target(struct ipt_entry *e) { return (void *)e + e->target_offset; } #define IPT_MATCH_ITERATE(e, fn, args...) ({ unsigned int __i; int __ret = 0; struct ipt_entry_match *__match; for (__i = sizeof(struct ipt_entry); __i < (e)->target_offset; __i += __match->u.match_size) { __match = (void *)(e) + __i; __ret = fn(__match , ## args); if (__ret != 0) break; } __ret; }) #define IPT_ENTRY_ITERATE(entries, size, fn, args...) ({ unsigned int __i; int __ret = 0; struct ipt_entry *__entry; for (__i = 0; __i < (size); __i += __entry->next_offset) { __entry = (void *)(entries) + __i; __ret = fn(__entry , ## args); if (__ret != 0) break; } __ret; }) #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_LOG.h0000644000015700001700000000172012200324306027060 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_LOG_H #define _IPT_LOG_H #define IPT_LOG_TCPSEQ 0x01 #define IPT_LOG_TCPOPT 0x02 #define IPT_LOG_IPOPT 0x04 #define IPT_LOG_UID 0x08 #define IPT_LOG_NFLOG 0x10 #define IPT_LOG_MASK 0x1f struct ipt_log_info { unsigned char level; unsigned char logflags; char prefix[30]; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_iprange.h0000644000015700001700000000173512200324306030072 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_IPRANGE_H #define _IPT_IPRANGE_H #define IPRANGE_SRC 0x01 #define IPRANGE_DST 0x02 #define IPRANGE_SRC_INV 0x10 #define IPRANGE_DST_INV 0x20 struct ipt_iprange { u_int32_t min_ip, max_ip; }; struct ipt_iprange_info { struct ipt_iprange src; struct ipt_iprange dst; u_int8_t flags; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_REJECT.h0000644000015700001700000000200712200324306027412 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_REJECT_H #define _IPT_REJECT_H enum ipt_reject_with { IPT_ICMP_NET_UNREACHABLE, IPT_ICMP_HOST_UNREACHABLE, IPT_ICMP_PROT_UNREACHABLE, IPT_ICMP_PORT_UNREACHABLE, IPT_ICMP_ECHOREPLY, IPT_ICMP_NET_PROHIBITED, IPT_ICMP_HOST_PROHIBITED, IPT_TCP_RESET, IPT_ICMP_ADMIN_PROHIBITED }; struct ipt_reject_info { enum ipt_reject_with with; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_TOS.h0000644000015700001700000000150112200324306027101 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_TOS_H_target #define _IPT_TOS_H_target #ifndef IPTOS_NORMALSVC #define IPTOS_NORMALSVC 0 #endif struct ipt_tos_target_info { u_int8_t tos; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_owner.h0000644000015700001700000000171312200324306027573 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_OWNER_H #define _IPT_OWNER_H #define IPT_OWNER_UID 0x01 #define IPT_OWNER_GID 0x02 #define IPT_OWNER_PID 0x04 #define IPT_OWNER_SID 0x08 #define IPT_OWNER_COMM 0x10 struct ipt_owner_info { uid_t uid; gid_t gid; pid_t pid; pid_t sid; char comm[16]; u_int8_t match, invert; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_sctp.h0000644000015700001700000000503012200324306027406 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_SCTP_H_ #define _IPT_SCTP_H_ #define IPT_SCTP_SRC_PORTS 0x01 #define IPT_SCTP_DEST_PORTS 0x02 #define IPT_SCTP_CHUNK_TYPES 0x04 #define IPT_SCTP_VALID_FLAGS 0x07 struct ipt_sctp_flag_info { u_int8_t chunktype; u_int8_t flag; u_int8_t flag_mask; }; #define IPT_NUM_SCTP_FLAGS 4 struct ipt_sctp_info { u_int16_t dpts[2]; u_int16_t spts[2]; u_int32_t chunkmap[256 / sizeof (u_int32_t)]; #define SCTP_CHUNK_MATCH_ANY 0x01 #define SCTP_CHUNK_MATCH_ALL 0x02 #define SCTP_CHUNK_MATCH_ONLY 0x04 u_int32_t chunk_match_type; struct ipt_sctp_flag_info flag_info[IPT_NUM_SCTP_FLAGS]; int flag_count; u_int32_t flags; u_int32_t invflags; }; #define bytes(type) (sizeof(type) * 8) #define SCTP_CHUNKMAP_SET(chunkmap, type) do { chunkmap[type / bytes(u_int32_t)] |= 1 << (type % bytes(u_int32_t)); } while (0) #define SCTP_CHUNKMAP_CLEAR(chunkmap, type) do { chunkmap[type / bytes(u_int32_t)] &= ~(1 << (type % bytes(u_int32_t))); } while (0) #define SCTP_CHUNKMAP_IS_SET(chunkmap, type) ({ (chunkmap[type / bytes (u_int32_t)] & (1 << (type % bytes (u_int32_t)))) ? 1: 0; }) #define SCTP_CHUNKMAP_RESET(chunkmap) do { int i; for (i = 0; i < ARRAY_SIZE(chunkmap); i++) chunkmap[i] = 0; } while (0) #define SCTP_CHUNKMAP_SET_ALL(chunkmap) do { int i; for (i = 0; i < ARRAY_SIZE(chunkmap); i++) chunkmap[i] = ~0; } while (0) #define SCTP_CHUNKMAP_COPY(destmap, srcmap) do { int i; for (i = 0; i < ARRAY_SIZE(chunkmap); i++) destmap[i] = srcmap[i]; } while (0) #define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) ({ int i; int flag = 1; for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { if (chunkmap[i]) { flag = 0; break; } } flag; }) #define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) ({ int i; int flag = 1; for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { if (chunkmap[i] != ~0) { flag = 0; break; } } flag; }) #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_addrtype.h0000644000015700001700000000151012200324306030250 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_ADDRTYPE_H #define _IPT_ADDRTYPE_H struct ipt_addrtype_info { u_int16_t source; u_int16_t dest; u_int32_t invert_source; u_int32_t invert_dest; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_comment.h0000644000015700001700000000152412200324306030103 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_COMMENT_H #define _IPT_COMMENT_H #include #define IPT_MAX_COMMENT_LEN XT_MAX_COMMENT_LEN #define ipt_comment_info xt_comment_info #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ip_conntrack_tuple.h0000644000015700001700000000305012200324306031444 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IP_CONNTRACK_TUPLE_H #define _IP_CONNTRACK_TUPLE_H #include #include union ip_conntrack_manip_proto { u_int16_t all; struct { __be16 port; } tcp; struct { u_int16_t port; } udp; struct { u_int16_t id; } icmp; struct { u_int16_t port; } sctp; struct { __be16 key; } gre; }; struct ip_conntrack_manip { u_int32_t ip; union ip_conntrack_manip_proto u; }; struct ip_conntrack_tuple { struct ip_conntrack_manip src; struct { u_int32_t ip; union { u_int16_t all; struct { u_int16_t port; } tcp; struct { u_int16_t port; } udp; struct { u_int8_t type, code; } icmp; struct { u_int16_t port; } sctp; struct { __be16 key; } gre; } u; u_int8_t protonum; u_int8_t dir; } dst; }; #define IP_CT_TUPLE_U_BLANK(tuple) do { (tuple)->src.u.all = 0; (tuple)->dst.u.all = 0; } while (0) #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ip_nat_rule.h0000644000015700001700000000152512200324306030067 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IP_NAT_RULE_H #define _IP_NAT_RULE_H #include #include #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ip_nat.h0000644000015700001700000000263012200324306027036 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IP_NAT_H #define _IP_NAT_H #include #include #define IP_NAT_MAPPING_TYPE_MAX_NAMELEN 16 enum ip_nat_manip_type { IP_NAT_MANIP_SRC, IP_NAT_MANIP_DST }; #define HOOK2MANIP(hooknum) ((hooknum) != NF_IP_POST_ROUTING && (hooknum) != NF_IP_LOCAL_IN) #define IP_NAT_RANGE_MAP_IPS 1 #define IP_NAT_RANGE_PROTO_SPECIFIED 2 struct ip_nat_seq { u_int32_t correction_pos; int16_t offset_before, offset_after; }; struct ip_nat_range { unsigned int flags; u_int32_t min_ip, max_ip; union ip_conntrack_manip_proto min, max; }; struct ip_nat_multi_range_compat { unsigned int rangesize; struct ip_nat_range range[1]; }; #define ip_nat_multi_range ip_nat_multi_range_compat #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ip_conntrack.h0000644000015700001700000000140512200324306030235 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IP_CONNTRACK_H #define _IP_CONNTRACK_H #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_tos_.h0000644000015700001700000000147612200324306027413 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_TOS_H #define _IPT_TOS_H struct ipt_tos_info { u_int8_t tos; u_int8_t invert; }; #ifndef IPTOS_NORMALSVC #define IPTOS_NORMALSVC 0 #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_pkttype.h0000644000015700001700000000144312200324306030141 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_PKTTYPE_H #define _IPT_PKTTYPE_H #include #define ipt_pkttype_info xt_pkttype_info #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_realm.h0000644000015700001700000000143112200324306027536 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_REALM_H #define _IPT_REALM_H #include #define ipt_realm_info xt_realm_info #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_esp.h0000644000015700001700000000152612200324306027232 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_ESP_H #define _IPT_ESP_H #include #define ipt_esp xt_esp #define IPT_ESP_INV_SPI XT_ESP_INV_SPI #define IPT_ESP_INV_MASK XT_ESP_INV_MASK #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_state.h0000644000015700001700000000163112200324306027560 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_STATE_H #define _IPT_STATE_H #include #define IPT_STATE_BIT XT_STATE_BIT #define IPT_STATE_INVALID XT_STATE_INVALID #define IPT_STATE_UNTRACKED XT_STATE_UNTRACKED #define ipt_state_info xt_state_info #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4/ipt_ECN.h0000644000015700001700000000205612200324306027047 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPT_ECN_TARGET_H #define _IPT_ECN_TARGET_H #include #define IPT_ECN_IP_MASK (~IPT_DSCP_MASK) #define IPT_ECN_OP_SET_IP 0x01 #define IPT_ECN_OP_SET_ECE 0x10 #define IPT_ECN_OP_SET_CWR 0x20 #define IPT_ECN_OP_MASK 0xce struct ipt_ECN_info { u_int8_t operation; u_int8_t ip_ect; union { struct { u_int8_t ece:1, cwr:1; } tcp; } proto; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/poll.h0000644000015700001700000000134612200324306023577 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_POLL_H #define _LINUX_POLL_H #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/kernel_stat.h0000644000015700001700000000233512200324306025143 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_KERNEL_STAT_H #define _LINUX_KERNEL_STAT_H #include #include #include #include #include #include struct cpu_usage_stat { cputime64_t user; cputime64_t nice; cputime64_t system; cputime64_t softirq; cputime64_t irq; cputime64_t idle; cputime64_t iowait; cputime64_t steal; }; struct kernel_stat { struct cpu_usage_stat cpustat; unsigned int irqs[NR_IRQS]; }; #define kstat_cpu(cpu) per_cpu(kstat, cpu) #define kstat_this_cpu __get_cpu_var(kstat) #endif android-audiosystem-1.8+13.10.20130807/include/linux/blkpg.h0000644000015700001700000000217412200324306023730 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_BLKPG_H #define _LINUX_BLKPG_H #include #include #define BLKPG _IO(0x12,105) struct blkpg_ioctl_arg { int op; int flags; int datalen; void __user *data; }; #define BLKPG_ADD_PARTITION 1 #define BLKPG_DEL_PARTITION 2 #define BLKPG_DEVNAMELTH 64 #define BLKPG_VOLNAMELTH 64 struct blkpg_partition { long long start; long long length; int pno; char devname[BLKPG_DEVNAMELTH]; char volname[BLKPG_VOLNAMELTH]; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/sem.h0000644000015700001700000000344612200324306023420 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SEM_H #define _LINUX_SEM_H #include #define SEM_UNDO 0x1000 #define GETPID 11 #define GETVAL 12 #define GETALL 13 #define GETNCNT 14 #define GETZCNT 15 #define SETVAL 16 #define SETALL 17 #define SEM_STAT 18 #define SEM_INFO 19 struct semid_ds { struct ipc_perm sem_perm; __kernel_time_t sem_otime; __kernel_time_t sem_ctime; struct sem *sem_base; struct sem_queue *sem_pending; struct sem_queue **sem_pending_last; struct sem_undo *undo; unsigned short sem_nsems; }; #include struct sembuf { unsigned short sem_num; short sem_op; short sem_flg; }; union semun { int val; struct semid_ds __user *buf; unsigned short __user *array; struct seminfo __user *__buf; void __user *__pad; }; struct seminfo { int semmap; int semmni; int semmns; int semmnu; int semmsl; int semopm; int semume; int semusz; int semvmx; int semaem; }; #define SEMMNI 128 #define SEMMSL 250 #define SEMMNS (SEMMNI*SEMMSL) #define SEMOPM 32 #define SEMVMX 32767 #define SEMAEM SEMVMX #define SEMUME SEMOPM #define SEMMNU SEMMNS #define SEMMAP SEMMNS #define SEMUSZ 20 #endif android-audiosystem-1.8+13.10.20130807/include/linux/rtc.h0000644000015700001700000000415212200324306023417 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_RTC_H_ #define _LINUX_RTC_H_ struct rtc_time { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; }; struct rtc_wkalrm { unsigned char enabled; unsigned char pending; struct rtc_time time; }; struct rtc_pll_info { int pll_ctrl; int pll_value; int pll_max; int pll_min; int pll_posmult; int pll_negmult; long pll_clock; }; #define RTC_AIE_ON _IO('p', 0x01) #define RTC_AIE_OFF _IO('p', 0x02) #define RTC_UIE_ON _IO('p', 0x03) #define RTC_UIE_OFF _IO('p', 0x04) #define RTC_PIE_ON _IO('p', 0x05) #define RTC_PIE_OFF _IO('p', 0x06) #define RTC_WIE_ON _IO('p', 0x0f) #define RTC_WIE_OFF _IO('p', 0x10) #define RTC_ALM_SET _IOW('p', 0x07, struct rtc_time) #define RTC_ALM_READ _IOR('p', 0x08, struct rtc_time) #define RTC_RD_TIME _IOR('p', 0x09, struct rtc_time) #define RTC_SET_TIME _IOW('p', 0x0a, struct rtc_time) #define RTC_IRQP_READ _IOR('p', 0x0b, unsigned long) #define RTC_IRQP_SET _IOW('p', 0x0c, unsigned long) #define RTC_EPOCH_READ _IOR('p', 0x0d, unsigned long) #define RTC_EPOCH_SET _IOW('p', 0x0e, unsigned long) #define RTC_WKALM_SET _IOW('p', 0x0f, struct rtc_wkalrm) #define RTC_WKALM_RD _IOR('p', 0x10, struct rtc_wkalrm) #define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info) #define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info) #define RTC_IRQF 0x80 #define RTC_PF 0x40 #define RTC_AF 0x20 #define RTC_UF 0x10 #endif android-audiosystem-1.8+13.10.20130807/include/linux/ctype.h0000644000015700001700000000311512200324306023751 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_CTYPE_H #define _LINUX_CTYPE_H #define _U 0x01 #define _L 0x02 #define _D 0x04 #define _C 0x08 #define _P 0x10 #define _S 0x20 #define _X 0x40 #define _SP 0x80 #define __ismask(x) (_ctype[(int)(unsigned char)(x)]) #define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0) #define isalpha(c) ((__ismask(c)&(_U|_L)) != 0) #define iscntrl(c) ((__ismask(c)&(_C)) != 0) #define isdigit(c) ((__ismask(c)&(_D)) != 0) #define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0) #define islower(c) ((__ismask(c)&(_L)) != 0) #define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0) #define ispunct(c) ((__ismask(c)&(_P)) != 0) #define isspace(c) ((__ismask(c)&(_S)) != 0) #define isupper(c) ((__ismask(c)&(_U)) != 0) #define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0) #define isascii(c) (((unsigned char)(c))<=0x7f) #define toascii(c) (((unsigned char)(c))&0x7f) #define tolower(c) __tolower(c) #define toupper(c) __toupper(c) #endif android-audiosystem-1.8+13.10.20130807/include/linux/hdreg.h0000644000015700001700000002655412200324306023732 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_HDREG_H #define _LINUX_HDREG_H #define HDIO_DRIVE_CMD_HDR_SIZE (4 * sizeof(u8)) #define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(u8)) #define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(u8)) #define IDE_DRIVE_TASK_INVALID -1 #define IDE_DRIVE_TASK_NO_DATA 0 #define IDE_DRIVE_TASK_SET_XFER 1 #define IDE_DRIVE_TASK_IN 2 #define IDE_DRIVE_TASK_OUT 3 #define IDE_DRIVE_TASK_RAW_WRITE 4 #define IDE_TASKFILE_STD_IN_FLAGS 0xFE #define IDE_HOB_STD_IN_FLAGS 0x3C #define IDE_TASKFILE_STD_OUT_FLAGS 0xFE #define IDE_HOB_STD_OUT_FLAGS 0x3C typedef unsigned char task_ioreg_t; typedef unsigned long sata_ioreg_t; typedef union ide_reg_valid_s { unsigned all : 16; struct { unsigned data : 1; unsigned error_feature : 1; unsigned sector : 1; unsigned nsector : 1; unsigned lcyl : 1; unsigned hcyl : 1; unsigned select : 1; unsigned status_command : 1; unsigned data_hob : 1; unsigned error_feature_hob : 1; unsigned sector_hob : 1; unsigned nsector_hob : 1; unsigned lcyl_hob : 1; unsigned hcyl_hob : 1; unsigned select_hob : 1; unsigned control_hob : 1; } b; } ide_reg_valid_t; typedef struct ide_task_request_s { task_ioreg_t io_ports[8]; task_ioreg_t hob_ports[8]; ide_reg_valid_t out_flags; ide_reg_valid_t in_flags; int data_phase; int req_cmd; unsigned long out_size; unsigned long in_size; } ide_task_request_t; typedef struct ide_ioctl_request_s { ide_task_request_t *task_request; unsigned char *out_buffer; unsigned char *in_buffer; } ide_ioctl_request_t; struct hd_drive_cmd_hdr { task_ioreg_t command; task_ioreg_t sector_number; task_ioreg_t feature; task_ioreg_t sector_count; }; typedef struct hd_drive_task_hdr { task_ioreg_t data; task_ioreg_t feature; task_ioreg_t sector_count; task_ioreg_t sector_number; task_ioreg_t low_cylinder; task_ioreg_t high_cylinder; task_ioreg_t device_head; task_ioreg_t command; } task_struct_t; typedef struct hd_drive_hob_hdr { task_ioreg_t data; task_ioreg_t feature; task_ioreg_t sector_count; task_ioreg_t sector_number; task_ioreg_t low_cylinder; task_ioreg_t high_cylinder; task_ioreg_t device_head; task_ioreg_t control; } hob_struct_t; #define TASKFILE_INVALID 0x7fff #define TASKFILE_48 0x8000 #define TASKFILE_NO_DATA 0x0000 #define TASKFILE_IN 0x0001 #define TASKFILE_MULTI_IN 0x0002 #define TASKFILE_OUT 0x0004 #define TASKFILE_MULTI_OUT 0x0008 #define TASKFILE_IN_OUT 0x0010 #define TASKFILE_IN_DMA 0x0020 #define TASKFILE_OUT_DMA 0x0040 #define TASKFILE_IN_DMAQ 0x0080 #define TASKFILE_OUT_DMAQ 0x0100 #define TASKFILE_P_IN 0x0200 #define TASKFILE_P_OUT 0x0400 #define TASKFILE_P_IN_DMA 0x0800 #define TASKFILE_P_OUT_DMA 0x1000 #define TASKFILE_P_IN_DMAQ 0x2000 #define TASKFILE_P_OUT_DMAQ 0x4000 #define WIN_NOP 0x00 #define CFA_REQ_EXT_ERROR_CODE 0x03 #define WIN_SRST 0x08 #define WIN_DEVICE_RESET 0x08 #define WIN_RECAL 0x10 #define WIN_RESTORE WIN_RECAL #define WIN_READ 0x20 #define WIN_READ_ONCE 0x21 #define WIN_READ_LONG 0x22 #define WIN_READ_LONG_ONCE 0x23 #define WIN_READ_EXT 0x24 #define WIN_READDMA_EXT 0x25 #define WIN_READDMA_QUEUED_EXT 0x26 #define WIN_READ_NATIVE_MAX_EXT 0x27 #define WIN_MULTREAD_EXT 0x29 #define WIN_WRITE 0x30 #define WIN_WRITE_ONCE 0x31 #define WIN_WRITE_LONG 0x32 #define WIN_WRITE_LONG_ONCE 0x33 #define WIN_WRITE_EXT 0x34 #define WIN_WRITEDMA_EXT 0x35 #define WIN_WRITEDMA_QUEUED_EXT 0x36 #define WIN_SET_MAX_EXT 0x37 #define CFA_WRITE_SECT_WO_ERASE 0x38 #define WIN_MULTWRITE_EXT 0x39 #define WIN_WRITE_VERIFY 0x3C #define WIN_VERIFY 0x40 #define WIN_VERIFY_ONCE 0x41 #define WIN_VERIFY_EXT 0x42 #define WIN_FORMAT 0x50 #define WIN_INIT 0x60 #define WIN_SEEK 0x70 #define CFA_TRANSLATE_SECTOR 0x87 #define WIN_DIAGNOSE 0x90 #define WIN_SPECIFY 0x91 #define WIN_DOWNLOAD_MICROCODE 0x92 #define WIN_STANDBYNOW2 0x94 #define WIN_STANDBY2 0x96 #define WIN_SETIDLE2 0x97 #define WIN_CHECKPOWERMODE2 0x98 #define WIN_SLEEPNOW2 0x99 #define WIN_PACKETCMD 0xA0 #define WIN_PIDENTIFY 0xA1 #define WIN_QUEUED_SERVICE 0xA2 #define WIN_SMART 0xB0 #define CFA_ERASE_SECTORS 0xC0 #define WIN_MULTREAD 0xC4 #define WIN_MULTWRITE 0xC5 #define WIN_SETMULT 0xC6 #define WIN_READDMA_QUEUED 0xC7 #define WIN_READDMA 0xC8 #define WIN_READDMA_ONCE 0xC9 #define WIN_WRITEDMA 0xCA #define WIN_WRITEDMA_ONCE 0xCB #define WIN_WRITEDMA_QUEUED 0xCC #define CFA_WRITE_MULTI_WO_ERASE 0xCD #define WIN_GETMEDIASTATUS 0xDA #define WIN_ACKMEDIACHANGE 0xDB #define WIN_POSTBOOT 0xDC #define WIN_PREBOOT 0xDD #define WIN_DOORLOCK 0xDE #define WIN_DOORUNLOCK 0xDF #define WIN_STANDBYNOW1 0xE0 #define WIN_IDLEIMMEDIATE 0xE1 #define WIN_STANDBY 0xE2 #define WIN_SETIDLE1 0xE3 #define WIN_READ_BUFFER 0xE4 #define WIN_CHECKPOWERMODE1 0xE5 #define WIN_SLEEPNOW1 0xE6 #define WIN_FLUSH_CACHE 0xE7 #define WIN_WRITE_BUFFER 0xE8 #define WIN_WRITE_SAME 0xE9 #define WIN_FLUSH_CACHE_EXT 0xEA #define WIN_IDENTIFY 0xEC #define WIN_MEDIAEJECT 0xED #define WIN_IDENTIFY_DMA 0xEE #define WIN_SETFEATURES 0xEF #define EXABYTE_ENABLE_NEST 0xF0 #define WIN_SECURITY_SET_PASS 0xF1 #define WIN_SECURITY_UNLOCK 0xF2 #define WIN_SECURITY_ERASE_PREPARE 0xF3 #define WIN_SECURITY_ERASE_UNIT 0xF4 #define WIN_SECURITY_FREEZE_LOCK 0xF5 #define WIN_SECURITY_DISABLE 0xF6 #define WIN_READ_NATIVE_MAX 0xF8 #define WIN_SET_MAX 0xF9 #define DISABLE_SEAGATE 0xFB #define SMART_READ_VALUES 0xD0 #define SMART_READ_THRESHOLDS 0xD1 #define SMART_AUTOSAVE 0xD2 #define SMART_SAVE 0xD3 #define SMART_IMMEDIATE_OFFLINE 0xD4 #define SMART_READ_LOG_SECTOR 0xD5 #define SMART_WRITE_LOG_SECTOR 0xD6 #define SMART_WRITE_THRESHOLDS 0xD7 #define SMART_ENABLE 0xD8 #define SMART_DISABLE 0xD9 #define SMART_STATUS 0xDA #define SMART_AUTO_OFFLINE 0xDB #define SMART_LCYL_PASS 0x4F #define SMART_HCYL_PASS 0xC2 #define SETFEATURES_EN_8BIT 0x01 #define SETFEATURES_EN_WCACHE 0x02 #define SETFEATURES_DIS_DEFECT 0x04 #define SETFEATURES_EN_APM 0x05 #define SETFEATURES_EN_SAME_R 0x22 #define SETFEATURES_DIS_MSN 0x31 #define SETFEATURES_DIS_RETRY 0x33 #define SETFEATURES_EN_AAM 0x42 #define SETFEATURES_RW_LONG 0x44 #define SETFEATURES_SET_CACHE 0x54 #define SETFEATURES_DIS_RLA 0x55 #define SETFEATURES_EN_RI 0x5D #define SETFEATURES_EN_SI 0x5E #define SETFEATURES_DIS_RPOD 0x66 #define SETFEATURES_DIS_ECC 0x77 #define SETFEATURES_DIS_8BIT 0x81 #define SETFEATURES_DIS_WCACHE 0x82 #define SETFEATURES_EN_DEFECT 0x84 #define SETFEATURES_DIS_APM 0x85 #define SETFEATURES_EN_ECC 0x88 #define SETFEATURES_EN_MSN 0x95 #define SETFEATURES_EN_RETRY 0x99 #define SETFEATURES_EN_RLA 0xAA #define SETFEATURES_PREFETCH 0xAB #define SETFEATURES_EN_REST 0xAC #define SETFEATURES_4B_RW_LONG 0xBB #define SETFEATURES_DIS_AAM 0xC2 #define SETFEATURES_EN_RPOD 0xCC #define SETFEATURES_DIS_RI 0xDD #define SETFEATURES_EN_SAME_M 0xDD #define SETFEATURES_DIS_SI 0xDE #define SECURITY_SET_PASSWORD 0xBA #define SECURITY_UNLOCK 0xBB #define SECURITY_ERASE_PREPARE 0xBC #define SECURITY_ERASE_UNIT 0xBD #define SECURITY_FREEZE_LOCK 0xBE #define SECURITY_DISABLE_PASSWORD 0xBF struct hd_geometry { unsigned char heads; unsigned char sectors; unsigned short cylinders; unsigned long start; }; #define HDIO_GETGEO 0x0301 #define HDIO_GET_UNMASKINTR 0x0302 #define HDIO_GET_MULTCOUNT 0x0304 #define HDIO_GET_QDMA 0x0305 #define HDIO_SET_XFER 0x0306 #define HDIO_OBSOLETE_IDENTITY 0x0307 #define HDIO_GET_KEEPSETTINGS 0x0308 #define HDIO_GET_32BIT 0x0309 #define HDIO_GET_NOWERR 0x030a #define HDIO_GET_DMA 0x030b #define HDIO_GET_NICE 0x030c #define HDIO_GET_IDENTITY 0x030d #define HDIO_GET_WCACHE 0x030e #define HDIO_GET_ACOUSTIC 0x030f #define HDIO_GET_ADDRESS 0x0310 #define HDIO_GET_BUSSTATE 0x031a #define HDIO_TRISTATE_HWIF 0x031b #define HDIO_DRIVE_RESET 0x031c #define HDIO_DRIVE_TASKFILE 0x031d #define HDIO_DRIVE_TASK 0x031e #define HDIO_DRIVE_CMD 0x031f #define HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK #define HDIO_SET_MULTCOUNT 0x0321 #define HDIO_SET_UNMASKINTR 0x0322 #define HDIO_SET_KEEPSETTINGS 0x0323 #define HDIO_SET_32BIT 0x0324 #define HDIO_SET_NOWERR 0x0325 #define HDIO_SET_DMA 0x0326 #define HDIO_SET_PIO_MODE 0x0327 #define HDIO_SCAN_HWIF 0x0328 #define HDIO_SET_NICE 0x0329 #define HDIO_UNREGISTER_HWIF 0x032a #define HDIO_SET_WCACHE 0x032b #define HDIO_SET_ACOUSTIC 0x032c #define HDIO_SET_BUSSTATE 0x032d #define HDIO_SET_QDMA 0x032e #define HDIO_SET_ADDRESS 0x032f enum { BUSSTATE_OFF = 0, BUSSTATE_ON, BUSSTATE_TRISTATE }; #define __NEW_HD_DRIVE_ID struct hd_driveid { unsigned short config; unsigned short cyls; unsigned short reserved2; unsigned short heads; unsigned short track_bytes; unsigned short sector_bytes; unsigned short sectors; unsigned short vendor0; unsigned short vendor1; unsigned short vendor2; unsigned char serial_no[20]; unsigned short buf_type; unsigned short buf_size; unsigned short ecc_bytes; unsigned char fw_rev[8]; unsigned char model[40]; unsigned char max_multsect; unsigned char vendor3; unsigned short dword_io; unsigned char vendor4; unsigned char capability; unsigned short reserved50; unsigned char vendor5; unsigned char tPIO; unsigned char vendor6; unsigned char tDMA; unsigned short field_valid; unsigned short cur_cyls; unsigned short cur_heads; unsigned short cur_sectors; unsigned short cur_capacity0; unsigned short cur_capacity1; unsigned char multsect; unsigned char multsect_valid; unsigned int lba_capacity; unsigned short dma_1word; unsigned short dma_mword; unsigned short eide_pio_modes; unsigned short eide_dma_min; unsigned short eide_dma_time; unsigned short eide_pio; unsigned short eide_pio_iordy; unsigned short words69_70[2]; unsigned short words71_74[4]; unsigned short queue_depth; unsigned short words76_79[4]; unsigned short major_rev_num; unsigned short minor_rev_num; unsigned short command_set_1; unsigned short command_set_2; unsigned short cfsse; unsigned short cfs_enable_1; unsigned short cfs_enable_2; unsigned short csf_default; unsigned short dma_ultra; unsigned short trseuc; unsigned short trsEuc; unsigned short CurAPMvalues; unsigned short mprc; unsigned short hw_config; unsigned short acoustic; unsigned short msrqs; unsigned short sxfert; unsigned short sal; unsigned int spg; unsigned long long lba_capacity_2; unsigned short words104_125[22]; unsigned short last_lun; unsigned short word127; unsigned short dlf; unsigned short csfo; unsigned short words130_155[26]; unsigned short word156; unsigned short words157_159[3]; unsigned short cfa_power; unsigned short words161_175[15]; unsigned short words176_205[30]; unsigned short words206_254[49]; unsigned short integrity_word; }; #define IDE_NICE_DSC_OVERLAP (0) #define IDE_NICE_ATAPI_OVERLAP (1) #define IDE_NICE_0 (2) #define IDE_NICE_1 (3) #define IDE_NICE_2 (4) #endif android-audiosystem-1.8+13.10.20130807/include/linux/sockios.h0000644000015700001700000000563512200324306024310 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SOCKIOS_H #define _LINUX_SOCKIOS_H #include #define SIOCINQ FIONREAD #define SIOCOUTQ TIOCOUTQ #define SIOCADDRT 0x890B #define SIOCDELRT 0x890C #define SIOCRTMSG 0x890D #define SIOCGIFNAME 0x8910 #define SIOCSIFLINK 0x8911 #define SIOCGIFCONF 0x8912 #define SIOCGIFFLAGS 0x8913 #define SIOCSIFFLAGS 0x8914 #define SIOCGIFADDR 0x8915 #define SIOCSIFADDR 0x8916 #define SIOCGIFDSTADDR 0x8917 #define SIOCSIFDSTADDR 0x8918 #define SIOCGIFBRDADDR 0x8919 #define SIOCSIFBRDADDR 0x891a #define SIOCGIFNETMASK 0x891b #define SIOCSIFNETMASK 0x891c #define SIOCGIFMETRIC 0x891d #define SIOCSIFMETRIC 0x891e #define SIOCGIFMEM 0x891f #define SIOCSIFMEM 0x8920 #define SIOCGIFMTU 0x8921 #define SIOCSIFMTU 0x8922 #define SIOCSIFNAME 0x8923 #define SIOCSIFHWADDR 0x8924 #define SIOCGIFENCAP 0x8925 #define SIOCSIFENCAP 0x8926 #define SIOCGIFHWADDR 0x8927 #define SIOCGIFSLAVE 0x8929 #define SIOCSIFSLAVE 0x8930 #define SIOCADDMULTI 0x8931 #define SIOCDELMULTI 0x8932 #define SIOCGIFINDEX 0x8933 #define SIOGIFINDEX SIOCGIFINDEX #define SIOCSIFPFLAGS 0x8934 #define SIOCGIFPFLAGS 0x8935 #define SIOCDIFADDR 0x8936 #define SIOCSIFHWBROADCAST 0x8937 #define SIOCGIFCOUNT 0x8938 #define SIOCKILLADDR 0x8939 #define SIOCGIFBR 0x8940 #define SIOCSIFBR 0x8941 #define SIOCGIFTXQLEN 0x8942 #define SIOCSIFTXQLEN 0x8943 #define SIOCETHTOOL 0x8946 #define SIOCGMIIPHY 0x8947 #define SIOCGMIIREG 0x8948 #define SIOCSMIIREG 0x8949 #define SIOCWANDEV 0x894A #define SIOCDARP 0x8953 #define SIOCGARP 0x8954 #define SIOCSARP 0x8955 #define SIOCDRARP 0x8960 #define SIOCGRARP 0x8961 #define SIOCSRARP 0x8962 #define SIOCGIFMAP 0x8970 #define SIOCSIFMAP 0x8971 #define SIOCADDDLCI 0x8980 #define SIOCDELDLCI 0x8981 #define SIOCGIFVLAN 0x8982 #define SIOCSIFVLAN 0x8983 #define SIOCBONDENSLAVE 0x8990 #define SIOCBONDRELEASE 0x8991 #define SIOCBONDSETHWADDR 0x8992 #define SIOCBONDSLAVEINFOQUERY 0x8993 #define SIOCBONDINFOQUERY 0x8994 #define SIOCBONDCHANGEACTIVE 0x8995 #define SIOCBRADDBR 0x89a0 #define SIOCBRDELBR 0x89a1 #define SIOCBRADDIF 0x89a2 #define SIOCBRDELIF 0x89a3 #define SIOCDEVPRIVATE 0x89F0 #define SIOCPROTOPRIVATE 0x89E0 #endif android-audiosystem-1.8+13.10.20130807/include/linux/personality.h0000644000015700001700000000515112200324306025200 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_PERSONALITY_H #define _LINUX_PERSONALITY_H struct exec_domain; struct pt_regs; enum { ADDR_NO_RANDOMIZE = 0x0040000, FDPIC_FUNCPTRS = 0x0080000, MMAP_PAGE_ZERO = 0x0100000, ADDR_COMPAT_LAYOUT = 0x0200000, READ_IMPLIES_EXEC = 0x0400000, ADDR_LIMIT_32BIT = 0x0800000, SHORT_INODE = 0x1000000, WHOLE_SECONDS = 0x2000000, STICKY_TIMEOUTS = 0x4000000, ADDR_LIMIT_3GB = 0x8000000, }; #define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC|ADDR_NO_RANDOMIZE) enum { PER_LINUX = 0x0000, PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT, PER_LINUX_FDPIC = 0x0000 | FDPIC_FUNCPTRS, PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE, PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE, PER_OSR5 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS, PER_WYSEV386 = 0x0004 | STICKY_TIMEOUTS | SHORT_INODE, PER_ISCR4 = 0x0005 | STICKY_TIMEOUTS, PER_BSD = 0x0006, PER_SUNOS = 0x0006 | STICKY_TIMEOUTS, PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE, PER_LINUX32 = 0x0008, PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB, PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS, PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS, PER_IRIX64 = 0x000b | STICKY_TIMEOUTS, PER_RISCOS = 0x000c, PER_SOLARIS = 0x000d | STICKY_TIMEOUTS, PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, PER_OSF4 = 0x000f, PER_HPUX = 0x0010, PER_MASK = 0x00ff, }; typedef void (*handler_t)(int, struct pt_regs *); struct exec_domain { const char *name; handler_t handler; unsigned char pers_low; unsigned char pers_high; unsigned long *signal_map; unsigned long *signal_invmap; struct map_segment *err_map; struct map_segment *socktype_map; struct map_segment *sockopt_map; struct map_segment *af_map; struct module *module; struct exec_domain *next; }; #define personality(pers) (pers & PER_MASK) #define get_personality (current->personality) #define set_personality(pers) ((current->personality == pers) ? 0 : __set_personality(pers)) #endif android-audiosystem-1.8+13.10.20130807/include/linux/blockgroup_lock.h0000644000015700001700000000204712200324306026007 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_BLOCKGROUP_LOCK_H #define _LINUX_BLOCKGROUP_LOCK_H #include #include #define NR_BG_LOCKS 1 struct bgl_lock { spinlock_t lock; } ____cacheline_aligned_in_smp; struct blockgroup_lock { struct bgl_lock locks[NR_BG_LOCKS]; }; #define sb_bgl_lock(sb, block_group) (&(sb)->s_blockgroup_lock.locks[(block_group) & (NR_BG_LOCKS-1)].lock) #endif android-audiosystem-1.8+13.10.20130807/include/linux/ipsec.h0000644000015700001700000000256512200324306023740 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IPSEC_H #define _LINUX_IPSEC_H #include #define IPSEC_PORT_ANY 0 #define IPSEC_ULPROTO_ANY 255 #define IPSEC_PROTO_ANY 255 enum { IPSEC_MODE_ANY = 0, IPSEC_MODE_TRANSPORT = 1, IPSEC_MODE_TUNNEL = 2, IPSEC_MODE_BEET = 3 }; enum { IPSEC_DIR_ANY = 0, IPSEC_DIR_INBOUND = 1, IPSEC_DIR_OUTBOUND = 2, IPSEC_DIR_FWD = 3, IPSEC_DIR_MAX = 4, IPSEC_DIR_INVALID = 5 }; enum { IPSEC_POLICY_DISCARD = 0, IPSEC_POLICY_NONE = 1, IPSEC_POLICY_IPSEC = 2, IPSEC_POLICY_ENTRUST = 3, IPSEC_POLICY_BYPASS = 4 }; enum { IPSEC_LEVEL_DEFAULT = 0, IPSEC_LEVEL_USE = 1, IPSEC_LEVEL_REQUIRE = 2, IPSEC_LEVEL_UNIQUE = 3 }; #define IPSEC_MANUAL_REQID_MAX 0x3fff #define IPSEC_REPLAYWSIZE 32 #endif android-audiosystem-1.8+13.10.20130807/include/linux/attribute_container.h0000644000015700001700000000262412200324306026676 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _ATTRIBUTE_CONTAINER_H_ #define _ATTRIBUTE_CONTAINER_H_ #include #include #include #include struct attribute_container { struct list_head node; struct klist containers; struct class *class; struct class_device_attribute **attrs; int (*match)(struct attribute_container *, struct device *); #define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01 unsigned long flags; }; struct attribute_container *attribute_container_classdev_to_container(struct class_device *); struct class_device *attribute_container_find_class_device(struct attribute_container *, struct device *); struct class_device_attribute **attribute_container_classdev_to_attrs(const struct class_device *classdev); #endif android-audiosystem-1.8+13.10.20130807/include/linux/backing-dev.h0000644000015700001700000000402212200324306024775 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_BACKING_DEV_H #define _LINUX_BACKING_DEV_H #include enum bdi_state { BDI_pdflush, BDI_write_congested, BDI_read_congested, BDI_unused, }; typedef int (congested_fn)(void *, int); struct backing_dev_info { unsigned long ra_pages; unsigned long state; unsigned int capabilities; congested_fn *congested_fn; void *congested_data; void (*unplug_io_fn)(struct backing_dev_info *, struct page *); void *unplug_io_data; }; #define BDI_CAP_NO_ACCT_DIRTY 0x00000001 #define BDI_CAP_NO_WRITEBACK 0x00000002 #define BDI_CAP_MAP_COPY 0x00000004 #define BDI_CAP_MAP_DIRECT 0x00000008 #define BDI_CAP_READ_MAP 0x00000010 #define BDI_CAP_WRITE_MAP 0x00000020 #define BDI_CAP_EXEC_MAP 0x00000040 #define BDI_CAP_VMFLAGS (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) #if defined(VM_MAYREAD) && BDI_CAP_READ_MAP != (VM_MAYREAD || BDI_CAP_WRITE_MAP != (VM_MAYWRITE || BDI_CAP_EXEC_MAP != VM_MAYEXEC)) #error please change backing_dev_info::capabilities flags #endif #define bdi_cap_writeback_dirty(bdi) (!((bdi)->capabilities & BDI_CAP_NO_WRITEBACK)) #define bdi_cap_account_dirty(bdi) (!((bdi)->capabilities & BDI_CAP_NO_ACCT_DIRTY)) #define mapping_cap_writeback_dirty(mapping) bdi_cap_writeback_dirty((mapping)->backing_dev_info) #define mapping_cap_account_dirty(mapping) bdi_cap_account_dirty((mapping)->backing_dev_info) #endif android-audiosystem-1.8+13.10.20130807/include/linux/akm8976.h0000644000015700001700000000603412200324306023736 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef AKM8976_H #define AKM8976_H #include #define AKECS_MODE_MEASURE 0x00 #define AKECS_MODE_PFFD 0x01 #define AKECS_MODE_E2P_READ 0x02 #define AKECS_MODE_POWERDOWN 0x03 #define AKECS_MODE_MEASURE_SNG 0x10 #define AKECS_MODE_MEASURE_SEQ 0x11 #define CSPEC_AINT 0x01 #define CSPEC_SNG_NUM 0x01 #define CSPEC_SEQ_NUM 0x02 #define CSPEC_SFRQ_32 0x00 #define CSPEC_SFRQ_64 0x01 #define CSPEC_MCS 0x07 #define CSPEC_MKS 0x01 #define CSPEC_INTEN 0x01 #define RBUFF_SIZE 31 #define MAX_CALI_SIZE 0x1000U #define AKECS_REG_ST 0xC0 #define AKECS_REG_TMPS 0xC1 #define AKECS_REG_MS1 0xE0 #define AKECS_REG_MS2 0xE1 #define AKECS_REG_MS3 0xE2 #define AKMIO 0xA1 #define ECS_IOCTL_INIT _IO(AKMIO, 0x01) #define ECS_IOCTL_WRITE _IOW(AKMIO, 0x02, char[5]) #define ECS_IOCTL_READ _IOWR(AKMIO, 0x03, char[5]) #define ECS_IOCTL_RESET _IO(AKMIO, 0x04) #define ECS_IOCTL_INT_STATUS _IO(AKMIO, 0x05) #define ECS_IOCTL_FFD_STATUS _IO(AKMIO, 0x06) #define ECS_IOCTL_SET_MODE _IOW(AKMIO, 0x07, short) #define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x08, char[RBUFF_SIZE+1]) #define ECS_IOCTL_GET_NUMFRQ _IOR(AKMIO, 0x09, char[2]) #define ECS_IOCTL_SET_PERST _IO(AKMIO, 0x0A) #define ECS_IOCTL_SET_G0RST _IO(AKMIO, 0x0B) #define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x0C, short[12]) #define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x0D, int) #define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x0E, int) #define ECS_IOCTL_GET_CALI_DATA _IOR(AKMIO, 0x0F, char[MAX_CALI_SIZE]) #define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x30, short) #define ECS_IOCTL_APP_SET_MODE _IOW(AKMIO, 0x10, short) #define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short) #define ECS_IOCTL_APP_GET_MFLAG _IOW(AKMIO, 0x12, short) #define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short) #define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short) #define ECS_IOCTL_APP_SET_TFLAG _IOR(AKMIO, 0x15, short) #define ECS_IOCTL_APP_GET_TFLAG _IOR(AKMIO, 0x16, short) #define ECS_IOCTL_APP_RESET_PEDOMETER _IO(AKMIO, 0x17) #define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, short) #define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY #define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short) #define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short) #define ECS_IOCTL_SET_STEP_CNT _IOW(AKMIO, 0x20, short) #define ECS_RST 146 #define ECS_CLK_ON 155 #define ECS_INTR 161 struct akm8976_platform_data { int reset; int clk_on; int intr; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/max9635.h0000644000015700001700000000166712200324306023753 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_MAX9635_H__ #define _LINUX_MAX9635_H__ #define MAX9635_NAME "MAX9635_als" #define FOPS_MAX9635_NAME "MAX9635" #define MAX9635_IO 0xA3 #define MAX9635_IOCTL_GET_ENABLE _IOR(MAX9635_IO, 0x00, char) #define MAX9635_IOCTL_SET_ENABLE _IOW(MAX9635_IO, 0x01, char) #endif android-audiosystem-1.8+13.10.20130807/include/linux/uinput.h0000644000015700001700000000433612200324306024157 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __UINPUT_H_ #define __UINPUT_H_ #include #define UINPUT_VERSION 3 struct uinput_ff_upload { int request_id; int retval; struct ff_effect effect; struct ff_effect old; }; struct uinput_ff_erase { int request_id; int retval; int effect_id; }; #define UINPUT_IOCTL_BASE 'U' #define UI_DEV_CREATE _IO(UINPUT_IOCTL_BASE, 1) #define UI_DEV_DESTROY _IO(UINPUT_IOCTL_BASE, 2) #define UI_SET_EVBIT _IOW(UINPUT_IOCTL_BASE, 100, int) #define UI_SET_KEYBIT _IOW(UINPUT_IOCTL_BASE, 101, int) #define UI_SET_RELBIT _IOW(UINPUT_IOCTL_BASE, 102, int) #define UI_SET_ABSBIT _IOW(UINPUT_IOCTL_BASE, 103, int) #define UI_SET_MSCBIT _IOW(UINPUT_IOCTL_BASE, 104, int) #define UI_SET_LEDBIT _IOW(UINPUT_IOCTL_BASE, 105, int) #define UI_SET_SNDBIT _IOW(UINPUT_IOCTL_BASE, 106, int) #define UI_SET_FFBIT _IOW(UINPUT_IOCTL_BASE, 107, int) #define UI_SET_PHYS _IOW(UINPUT_IOCTL_BASE, 108, char*) #define UI_SET_SWBIT _IOW(UINPUT_IOCTL_BASE, 109, int) #define UI_BEGIN_FF_UPLOAD _IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload) #define UI_END_FF_UPLOAD _IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload) #define UI_BEGIN_FF_ERASE _IOWR(UINPUT_IOCTL_BASE, 202, struct uinput_ff_erase) #define UI_END_FF_ERASE _IOW(UINPUT_IOCTL_BASE, 203, struct uinput_ff_erase) #define EV_UINPUT 0x0101 #define UI_FF_UPLOAD 1 #define UI_FF_ERASE 2 #define UINPUT_MAX_NAME_SIZE 80 struct uinput_user_dev { char name[UINPUT_MAX_NAME_SIZE]; struct input_id id; int ff_effects_max; int absmax[ABS_MAX + 1]; int absmin[ABS_MAX + 1]; int absfuzz[ABS_MAX + 1]; int absflat[ABS_MAX + 1]; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/serial_core.h0000644000015700001700000000365312200324306025123 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef LINUX_SERIAL_CORE_H #define LINUX_SERIAL_CORE_H #define PORT_UNKNOWN 0 #define PORT_8250 1 #define PORT_16450 2 #define PORT_16550 3 #define PORT_16550A 4 #define PORT_CIRRUS 5 #define PORT_16650 6 #define PORT_16650V2 7 #define PORT_16750 8 #define PORT_STARTECH 9 #define PORT_16C950 10 #define PORT_16654 11 #define PORT_16850 12 #define PORT_RSA 13 #define PORT_NS16550A 14 #define PORT_XSCALE 15 #define PORT_MAX_8250 15 #define PORT_PXA 31 #define PORT_AMBA 32 #define PORT_CLPS711X 33 #define PORT_SA1100 34 #define PORT_UART00 35 #define PORT_21285 37 #define PORT_SUNZILOG 38 #define PORT_SUNSAB 39 #define PORT_V850E_UART 40 #define PORT_DZ 47 #define PORT_MUX 48 #define PORT_AT91 49 #define PORT_MAC_ZILOG 50 #define PORT_PMAC_ZILOG 51 #define PORT_SCI 52 #define PORT_SCIF 53 #define PORT_IRDA 54 #define PORT_S3C2410 55 #define PORT_IP22ZILOG 56 #define PORT_LH7A40X 57 #define PORT_CPM 58 #define PORT_MPC52xx 59 #define PORT_ICOM 60 #define PORT_S3C2440 61 #define PORT_IMX 62 #define PORT_MPSC 63 #define PORT_TXX9 64 #define PORT_VR41XX_SIU 65 #define PORT_VR41XX_DSIU 66 #define PORT_S3C2400 67 #define PORT_M32R_SIO 68 #define PORT_JSM 69 #define PORT_IP3106 70 #define PORT_NETX 71 #define PORT_SUNHV 72 #define PORT_S3C2412 73 #endif android-audiosystem-1.8+13.10.20130807/include/linux/if_ether.h0000644000015700001700000000545012200324306024416 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IF_ETHER_H #define _LINUX_IF_ETHER_H #include #define ETH_ALEN 6 #define ETH_HLEN 14 #define ETH_ZLEN 60 #define ETH_DATA_LEN 1500 #define ETH_FRAME_LEN 1514 #define ETH_FCS_LEN 4 #define ETH_P_LOOP 0x0060 #define ETH_P_PUP 0x0200 #define ETH_P_PUPAT 0x0201 #define ETH_P_IP 0x0800 #define ETH_P_X25 0x0805 #define ETH_P_ARP 0x0806 #define ETH_P_BPQ 0x08FF #define ETH_P_IEEEPUP 0x0a00 #define ETH_P_IEEEPUPAT 0x0a01 #define ETH_P_DEC 0x6000 #define ETH_P_DNA_DL 0x6001 #define ETH_P_DNA_RC 0x6002 #define ETH_P_DNA_RT 0x6003 #define ETH_P_LAT 0x6004 #define ETH_P_DIAG 0x6005 #define ETH_P_CUST 0x6006 #define ETH_P_SCA 0x6007 #define ETH_P_TEB 0x6558 #define ETH_P_RARP 0x8035 #define ETH_P_ATALK 0x809B #define ETH_P_AARP 0x80F3 #define ETH_P_8021Q 0x8100 #define ETH_P_IPX 0x8137 #define ETH_P_IPV6 0x86DD #define ETH_P_PAUSE 0x8808 #define ETH_P_SLOW 0x8809 #define ETH_P_WCCP 0x883E #define ETH_P_PPP_DISC 0x8863 #define ETH_P_PPP_SES 0x8864 #define ETH_P_MPLS_UC 0x8847 #define ETH_P_MPLS_MC 0x8848 #define ETH_P_ATMMPOA 0x884c #define ETH_P_ATMFATE 0x8884 #define ETH_P_PAE 0x888E #define ETH_P_AOE 0x88A2 #define ETH_P_TIPC 0x88CA #define ETH_P_1588 0x88F7 #define ETH_P_FCOE 0x8906 #define ETH_P_FIP 0x8914 #define ETH_P_EDSA 0xDADA #define ETH_P_802_3 0x0001 #define ETH_P_AX25 0x0002 #define ETH_P_ALL 0x0003 #define ETH_P_802_2 0x0004 #define ETH_P_SNAP 0x0005 #define ETH_P_DDCMP 0x0006 #define ETH_P_WAN_PPP 0x0007 #define ETH_P_PPP_MP 0x0008 #define ETH_P_LOCALTALK 0x0009 #define ETH_P_CAN 0x000C #define ETH_P_PPPTALK 0x0010 #define ETH_P_TR_802_2 0x0011 #define ETH_P_MOBITEX 0x0015 #define ETH_P_CONTROL 0x0016 #define ETH_P_IRDA 0x0017 #define ETH_P_ECONET 0x0018 #define ETH_P_HDLC 0x0019 #define ETH_P_ARCNET 0x001A #define ETH_P_DSA 0x001B #define ETH_P_TRAILER 0x001C #define ETH_P_PHONET 0x00F5 #define ETH_P_IEEE802154 0x00F6 #define ETH_P_CAIF 0x00F7 struct ethhdr { unsigned char h_dest[ETH_ALEN]; unsigned char h_source[ETH_ALEN]; __be16 h_proto; } __attribute__((packed)); #endif android-audiosystem-1.8+13.10.20130807/include/linux/in6.h0000644000015700001700000001043612200324306023325 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IN6_H #define _LINUX_IN6_H #include struct in6_addr { union { __u8 u6_addr8[16]; __be16 u6_addr16[8]; __be32 u6_addr32[4]; } in6_u; #define s6_addr in6_u.u6_addr8 #define s6_addr16 in6_u.u6_addr16 #define s6_addr32 in6_u.u6_addr32 }; struct sockaddr_in6 { unsigned short int sin6_family; __be16 sin6_port; __be32 sin6_flowinfo; struct in6_addr sin6_addr; __u32 sin6_scope_id; }; struct ipv6_mreq { struct in6_addr ipv6mr_multiaddr; int ipv6mr_ifindex; }; #define ipv6mr_acaddr ipv6mr_multiaddr struct in6_flowlabel_req { struct in6_addr flr_dst; __be32 flr_label; __u8 flr_action; __u8 flr_share; __u16 flr_flags; __u16 flr_expires; __u16 flr_linger; __u32 __flr_pad; }; #define IPV6_FL_A_GET 0 #define IPV6_FL_A_PUT 1 #define IPV6_FL_A_RENEW 2 #define IPV6_FL_F_CREATE 1 #define IPV6_FL_F_EXCL 2 #define IPV6_FL_S_NONE 0 #define IPV6_FL_S_EXCL 1 #define IPV6_FL_S_PROCESS 2 #define IPV6_FL_S_USER 3 #define IPV6_FL_S_ANY 255 #define IPV6_FLOWINFO_FLOWLABEL 0x000fffff #define IPV6_FLOWINFO_PRIORITY 0x0ff00000 #define IPV6_PRIORITY_UNCHARACTERIZED 0x0000 #define IPV6_PRIORITY_FILLER 0x0100 #define IPV6_PRIORITY_UNATTENDED 0x0200 #define IPV6_PRIORITY_RESERVED1 0x0300 #define IPV6_PRIORITY_BULK 0x0400 #define IPV6_PRIORITY_RESERVED2 0x0500 #define IPV6_PRIORITY_INTERACTIVE 0x0600 #define IPV6_PRIORITY_CONTROL 0x0700 #define IPV6_PRIORITY_8 0x0800 #define IPV6_PRIORITY_9 0x0900 #define IPV6_PRIORITY_10 0x0a00 #define IPV6_PRIORITY_11 0x0b00 #define IPV6_PRIORITY_12 0x0c00 #define IPV6_PRIORITY_13 0x0d00 #define IPV6_PRIORITY_14 0x0e00 #define IPV6_PRIORITY_15 0x0f00 #define IPPROTO_HOPOPTS 0 #define IPPROTO_ROUTING 43 #define IPPROTO_FRAGMENT 44 #define IPPROTO_ICMPV6 58 #define IPPROTO_NONE 59 #define IPPROTO_DSTOPTS 60 #define IPPROTO_MH 135 #define IPV6_TLV_PAD0 0 #define IPV6_TLV_PADN 1 #define IPV6_TLV_ROUTERALERT 5 #define IPV6_TLV_JUMBO 194 #define IPV6_TLV_HAO 201 #define IPV6_ADDRFORM 1 #define IPV6_2292PKTINFO 2 #define IPV6_2292HOPOPTS 3 #define IPV6_2292DSTOPTS 4 #define IPV6_2292RTHDR 5 #define IPV6_2292PKTOPTIONS 6 #define IPV6_CHECKSUM 7 #define IPV6_2292HOPLIMIT 8 #define IPV6_NEXTHOP 9 #define IPV6_AUTHHDR 10 #define IPV6_FLOWINFO 11 #define IPV6_UNICAST_HOPS 16 #define IPV6_MULTICAST_IF 17 #define IPV6_MULTICAST_HOPS 18 #define IPV6_MULTICAST_LOOP 19 #define IPV6_ADD_MEMBERSHIP 20 #define IPV6_DROP_MEMBERSHIP 21 #define IPV6_ROUTER_ALERT 22 #define IPV6_MTU_DISCOVER 23 #define IPV6_MTU 24 #define IPV6_RECVERR 25 #define IPV6_V6ONLY 26 #define IPV6_JOIN_ANYCAST 27 #define IPV6_LEAVE_ANYCAST 28 #define IPV6_PMTUDISC_DONT 0 #define IPV6_PMTUDISC_WANT 1 #define IPV6_PMTUDISC_DO 2 #define IPV6_PMTUDISC_PROBE 3 #define IPV6_FLOWLABEL_MGR 32 #define IPV6_FLOWINFO_SEND 33 #define IPV6_IPSEC_POLICY 34 #define IPV6_XFRM_POLICY 35 #define IPV6_RECVPKTINFO 49 #define IPV6_PKTINFO 50 #define IPV6_RECVHOPLIMIT 51 #define IPV6_HOPLIMIT 52 #define IPV6_RECVHOPOPTS 53 #define IPV6_HOPOPTS 54 #define IPV6_RTHDRDSTOPTS 55 #define IPV6_RECVRTHDR 56 #define IPV6_RTHDR 57 #define IPV6_RECVDSTOPTS 58 #define IPV6_DSTOPTS 59 #define IPV6_RECVPATHMTU 60 #define IPV6_PATHMTU 61 #define IPV6_DONTFRAG 62 #define IPV6_RECVTCLASS 66 #define IPV6_TCLASS 67 #define IPV6_ADDR_PREFERENCES 72 #define IPV6_PREFER_SRC_TMP 0x0001 #define IPV6_PREFER_SRC_PUBLIC 0x0002 #define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100 #define IPV6_PREFER_SRC_COA 0x0004 #define IPV6_PREFER_SRC_HOME 0x0400 #define IPV6_PREFER_SRC_CGA 0x0008 #define IPV6_PREFER_SRC_NONCGA 0x0800 #define IPV6_MINHOPCOUNT 73 #define IPV6_ORIGDSTADDR 74 #define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR #define IPV6_TRANSPARENT 75 #endif android-audiosystem-1.8+13.10.20130807/include/linux/posix_types.h0000644000015700001700000000236312200324306025217 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_POSIX_TYPES_H #define _LINUX_POSIX_TYPES_H #include #undef __NFDBITS #define __NFDBITS (8 * sizeof(unsigned long)) #undef __FD_SETSIZE #define __FD_SETSIZE 1024 #undef __FDSET_LONGS #define __FDSET_LONGS (__FD_SETSIZE/__NFDBITS) #undef __FDELT #define __FDELT(d) ((d) / __NFDBITS) #undef __FDMASK #define __FDMASK(d) (1UL << ((d) % __NFDBITS)) typedef struct { unsigned long fds_bits [__FDSET_LONGS]; } __kernel_fd_set; typedef void (*__kernel_sighandler_t)(int); typedef int __kernel_key_t; typedef int __kernel_mqd_t; #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/tegrafb.h0000644000015700001700000000506712200324306024247 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_TEGRAFB_H_ #define _LINUX_TEGRAFB_H_ #include #include #include #define TEGRA_FB_WIN_FMT_P1 0 #define TEGRA_FB_WIN_FMT_P2 1 #define TEGRA_FB_WIN_FMT_P4 2 #define TEGRA_FB_WIN_FMT_P8 3 #define TEGRA_FB_WIN_FMT_B4G4R4A4 4 #define TEGRA_FB_WIN_FMT_B5G5R5A 5 #define TEGRA_FB_WIN_FMT_B5G6R5 6 #define TEGRA_FB_WIN_FMT_AB5G5R5 7 #define TEGRA_FB_WIN_FMT_B8G8R8A8 12 #define TEGRA_FB_WIN_FMT_R8G8B8A8 13 #define TEGRA_FB_WIN_FMT_B6x2G6x2R6x2A8 14 #define TEGRA_FB_WIN_FMT_R6x2G6x2B6x2A8 15 #define TEGRA_FB_WIN_FMT_YCbCr422 16 #define TEGRA_FB_WIN_FMT_YUV422 17 #define TEGRA_FB_WIN_FMT_YCbCr420P 18 #define TEGRA_FB_WIN_FMT_YUV420P 19 #define TEGRA_FB_WIN_FMT_YCbCr422P 20 #define TEGRA_FB_WIN_FMT_YUV422P 21 #define TEGRA_FB_WIN_FMT_YCbCr422R 22 #define TEGRA_FB_WIN_FMT_YUV422R 23 #define TEGRA_FB_WIN_FMT_YCbCr422RA 24 #define TEGRA_FB_WIN_FMT_YUV422RA 25 #define TEGRA_FB_WIN_BLEND_NONE 0 #define TEGRA_FB_WIN_BLEND_PREMULT 1 #define TEGRA_FB_WIN_BLEND_COVERAGE 2 #define TEGRA_FB_WIN_FLAG_INVERT_H (1<<0) #define TEGRA_FB_WIN_FLAG_INVERT_V (1<<1) #define TEGRA_FB_WIN_FLAG_TILED (1<<2) struct tegra_fb_windowattr { __s32 index; __u32 buff_id; __u32 flags; __u32 blend; __u32 offset; __u32 offset_u; __u32 offset_v; __u32 stride; __u32 stride_uv; __u32 pixformat; __u32 x; __u32 y; __u32 w; __u32 h; __u32 out_x; __u32 out_y; __u32 out_w; __u32 out_h; __u32 z; __u32 pre_syncpt_id; __u32 pre_syncpt_val; }; #define TEGRA_FB_FLIP_N_WINDOWS 3 struct tegra_fb_flip_args { struct tegra_fb_windowattr win[TEGRA_FB_FLIP_N_WINDOWS]; __u32 post_syncpt_id; __u32 post_syncpt_val; }; struct tegra_fb_modedb { struct fb_var_screeninfo *modedb; __u32 modedb_len; }; #define FBIO_TEGRA_SET_NVMAP_FD _IOW('F', 0x40, __u32) #define FBIO_TEGRA_FLIP _IOW('F', 0x41, struct tegra_fb_flip_args) #define FBIO_TEGRA_GET_MODEDB _IOWR('F', 0x42, struct tegra_fb_modedb) #endif android-audiosystem-1.8+13.10.20130807/include/linux/auto_fs.h0000644000015700001700000000332712200324306024272 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_AUTO_FS_H #define _LINUX_AUTO_FS_H #include #define AUTOFS_PROTO_VERSION 3 #define AUTOFS_MAX_PROTO_VERSION AUTOFS_PROTO_VERSION #define AUTOFS_MIN_PROTO_VERSION AUTOFS_PROTO_VERSION #if defined(__sparc__) || defined(__mips__) || defined(__x86_64__) || defined(__powerpc__) || defined(__s390__) typedef unsigned int autofs_wqt_t; #else typedef unsigned long autofs_wqt_t; #endif #define autofs_ptype_missing 0 #define autofs_ptype_expire 1 struct autofs_packet_hdr { int proto_version; int type; }; struct autofs_packet_missing { struct autofs_packet_hdr hdr; autofs_wqt_t wait_queue_token; int len; char name[NAME_MAX+1]; }; struct autofs_packet_expire { struct autofs_packet_hdr hdr; int len; char name[NAME_MAX+1]; }; #define AUTOFS_IOC_READY _IO(0x93,0x60) #define AUTOFS_IOC_FAIL _IO(0x93,0x61) #define AUTOFS_IOC_CATATONIC _IO(0x93,0x62) #define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int) #define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long) #define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire) #endif android-audiosystem-1.8+13.10.20130807/include/linux/if_packet.h0000644000015700001700000000452712200324306024562 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_IF_PACKET_H #define __LINUX_IF_PACKET_H struct sockaddr_pkt { unsigned short spkt_family; unsigned char spkt_device[14]; unsigned short spkt_protocol; }; struct sockaddr_ll { unsigned short sll_family; unsigned short sll_protocol; int sll_ifindex; unsigned short sll_hatype; unsigned char sll_pkttype; unsigned char sll_halen; unsigned char sll_addr[8]; }; #define PACKET_HOST 0 #define PACKET_BROADCAST 1 #define PACKET_MULTICAST 2 #define PACKET_OTHERHOST 3 #define PACKET_OUTGOING 4 #define PACKET_LOOPBACK 5 #define PACKET_FASTROUTE 6 #define PACKET_ADD_MEMBERSHIP 1 #define PACKET_DROP_MEMBERSHIP 2 #define PACKET_RECV_OUTPUT 3 #define PACKET_RX_RING 5 #define PACKET_STATISTICS 6 #define PACKET_COPY_THRESH 7 struct tpacket_stats { unsigned int tp_packets; unsigned int tp_drops; }; struct tpacket_hdr { unsigned long tp_status; #define TP_STATUS_KERNEL 0 #define TP_STATUS_USER 1 #define TP_STATUS_COPY 2 #define TP_STATUS_LOSING 4 #define TP_STATUS_CSUMNOTREADY 8 unsigned int tp_len; unsigned int tp_snaplen; unsigned short tp_mac; unsigned short tp_net; unsigned int tp_sec; unsigned int tp_usec; }; #define TPACKET_ALIGNMENT 16 #define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1)&~(TPACKET_ALIGNMENT-1)) #define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll)) struct tpacket_req { unsigned int tp_block_size; unsigned int tp_block_nr; unsigned int tp_frame_size; unsigned int tp_frame_nr; }; struct packet_mreq { int mr_ifindex; unsigned short mr_type; unsigned short mr_alen; unsigned char mr_address[8]; }; #define PACKET_MR_MULTICAST 0 #define PACKET_MR_PROMISC 1 #define PACKET_MR_ALLMULTI 2 #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/0000755000015700001700000000000012200324404024447 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_connbytes.h0000644000015700001700000000203112200324306027334 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_CONNBYTES_H #define _XT_CONNBYTES_H enum xt_connbytes_what { XT_CONNBYTES_PKTS, XT_CONNBYTES_BYTES, XT_CONNBYTES_AVGPKT, }; enum xt_connbytes_direction { XT_CONNBYTES_DIR_ORIGINAL, XT_CONNBYTES_DIR_REPLY, XT_CONNBYTES_DIR_BOTH, }; struct xt_connbytes_info { struct { aligned_u64 from; aligned_u64 to; } count; u_int8_t what; u_int8_t direction; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/nfnetlink.h0000644000015700001700000000650612200324306026620 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _NFNETLINK_H #define _NFNETLINK_H #include #define NF_NETLINK_CONNTRACK_NEW 0x00000001 #define NF_NETLINK_CONNTRACK_UPDATE 0x00000002 #define NF_NETLINK_CONNTRACK_DESTROY 0x00000004 #define NF_NETLINK_CONNTRACK_EXP_NEW 0x00000008 #define NF_NETLINK_CONNTRACK_EXP_UPDATE 0x00000010 #define NF_NETLINK_CONNTRACK_EXP_DESTROY 0x00000020 enum nfnetlink_groups { NFNLGRP_NONE, #define NFNLGRP_NONE NFNLGRP_NONE NFNLGRP_CONNTRACK_NEW, #define NFNLGRP_CONNTRACK_NEW NFNLGRP_CONNTRACK_NEW NFNLGRP_CONNTRACK_UPDATE, #define NFNLGRP_CONNTRACK_UPDATE NFNLGRP_CONNTRACK_UPDATE NFNLGRP_CONNTRACK_DESTROY, #define NFNLGRP_CONNTRACK_DESTROY NFNLGRP_CONNTRACK_DESTROY NFNLGRP_CONNTRACK_EXP_NEW, #define NFNLGRP_CONNTRACK_EXP_NEW NFNLGRP_CONNTRACK_EXP_NEW NFNLGRP_CONNTRACK_EXP_UPDATE, #define NFNLGRP_CONNTRACK_EXP_UPDATE NFNLGRP_CONNTRACK_EXP_UPDATE NFNLGRP_CONNTRACK_EXP_DESTROY, #define NFNLGRP_CONNTRACK_EXP_DESTROY NFNLGRP_CONNTRACK_EXP_DESTROY __NFNLGRP_MAX, }; #define NFNLGRP_MAX (__NFNLGRP_MAX - 1) struct nfattr { u_int16_t nfa_len; u_int16_t nfa_type; } __attribute__ ((packed)); #define NFNL_NFA_NEST 0x8000 #define NFA_TYPE(attr) ((attr)->nfa_type & 0x7fff) #define NFA_ALIGNTO 4 #define NFA_ALIGN(len) (((len) + NFA_ALIGNTO - 1) & ~(NFA_ALIGNTO - 1)) #define NFA_OK(nfa,len) ((len) > 0 && (nfa)->nfa_len >= sizeof(struct nfattr) && (nfa)->nfa_len <= (len)) #define NFA_NEXT(nfa,attrlen) ((attrlen) -= NFA_ALIGN((nfa)->nfa_len), (struct nfattr *)(((char *)(nfa)) + NFA_ALIGN((nfa)->nfa_len))) #define NFA_LENGTH(len) (NFA_ALIGN(sizeof(struct nfattr)) + (len)) #define NFA_SPACE(len) NFA_ALIGN(NFA_LENGTH(len)) #define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) #define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) #define NFA_NEST(skb, type) ({ struct nfattr *__start = (struct nfattr *) (skb)->tail; NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); __start; }) #define NFA_NEST_END(skb, start) ({ (start)->nfa_len = ((skb)->tail - (unsigned char *) (start)); (skb)->len; }) #define NFA_NEST_CANCEL(skb, start) ({ if (start) skb_trim(skb, (unsigned char *) (start) - (skb)->data); -1; }) struct nfgenmsg { u_int8_t nfgen_family; u_int8_t version; u_int16_t res_id; } __attribute__ ((packed)); #define NFNETLINK_V0 0 #define NFM_NFA(n) ((struct nfattr *)(((char *)(n)) + NLMSG_ALIGN(sizeof(struct nfgenmsg)))) #define NFM_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct nfgenmsg)) #define NFNL_SUBSYS_ID(x) ((x & 0xff00) >> 8) #define NFNL_MSG_TYPE(x) (x & 0x00ff) #define NFNL_SUBSYS_NONE 0 #define NFNL_SUBSYS_CTNETLINK 1 #define NFNL_SUBSYS_CTNETLINK_EXP 2 #define NFNL_SUBSYS_QUEUE 3 #define NFNL_SUBSYS_ULOG 4 #define NFNL_SUBSYS_COUNT 5 #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/nfnetlink_conntrack.h0000644000015700001700000001603012200324306030653 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** *** To edit the content of this header, modify the corresponding *** source file (e.g. under external/kernel-headers/original/) then *** run bionic/libc/kernel/tools/update_all.py *** *** Any manual change here will be lost the next time this script will *** be run. You've been warned! *** **************************************************************************** ****************************************************************************/ #ifndef _IPCONNTRACK_NETLINK_H #define _IPCONNTRACK_NETLINK_H #include enum cntl_msg_types { /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ IPCTNL_MSG_CT_NEW, IPCTNL_MSG_CT_GET, IPCTNL_MSG_CT_DELETE, IPCTNL_MSG_CT_GET_CTRZERO, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ IPCTNL_MSG_MAX }; enum ctnl_exp_msg_types { IPCTNL_MSG_EXP_NEW, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ IPCTNL_MSG_EXP_GET, IPCTNL_MSG_EXP_DELETE, IPCTNL_MSG_EXP_MAX }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ enum ctattr_type { CTA_UNSPEC, CTA_TUPLE_ORIG, CTA_TUPLE_REPLY, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTA_STATUS, CTA_PROTOINFO, CTA_HELP, CTA_NAT_SRC, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define CTA_NAT CTA_NAT_SRC CTA_TIMEOUT, CTA_MARK, CTA_COUNTERS_ORIG, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTA_COUNTERS_REPLY, CTA_USE, CTA_ID, CTA_NAT_DST, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTA_TUPLE_MASTER, CTA_NAT_SEQ_ADJ_ORIG, CTA_NAT_SEQ_ADJ_REPLY, CTA_SECMARK, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTA_ZONE, __CTA_MAX }; #define CTA_MAX (__CTA_MAX - 1) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ enum ctattr_tuple { CTA_TUPLE_UNSPEC, CTA_TUPLE_IP, CTA_TUPLE_PROTO, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __CTA_TUPLE_MAX }; #define CTA_TUPLE_MAX (__CTA_TUPLE_MAX - 1) enum ctattr_ip { /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTA_IP_UNSPEC, CTA_IP_V4_SRC, CTA_IP_V4_DST, CTA_IP_V6_SRC, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTA_IP_V6_DST, __CTA_IP_MAX }; #define CTA_IP_MAX (__CTA_IP_MAX - 1) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ enum ctattr_l4proto { CTA_PROTO_UNSPEC, CTA_PROTO_NUM, CTA_PROTO_SRC_PORT, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTA_PROTO_DST_PORT, CTA_PROTO_ICMP_ID, CTA_PROTO_ICMP_TYPE, CTA_PROTO_ICMP_CODE, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTA_PROTO_ICMPV6_ID, CTA_PROTO_ICMPV6_TYPE, CTA_PROTO_ICMPV6_CODE, __CTA_PROTO_MAX /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ }; #define CTA_PROTO_MAX (__CTA_PROTO_MAX - 1) enum ctattr_protoinfo { CTA_PROTOINFO_UNSPEC, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTA_PROTOINFO_TCP, CTA_PROTOINFO_DCCP, CTA_PROTOINFO_SCTP, __CTA_PROTOINFO_MAX /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ }; #define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1) enum ctattr_protoinfo_tcp { CTA_PROTOINFO_TCP_UNSPEC, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTA_PROTOINFO_TCP_STATE, CTA_PROTOINFO_TCP_WSCALE_ORIGINAL, CTA_PROTOINFO_TCP_WSCALE_REPLY, CTA_PROTOINFO_TCP_FLAGS_ORIGINAL, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTA_PROTOINFO_TCP_FLAGS_REPLY, __CTA_PROTOINFO_TCP_MAX }; #define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ enum ctattr_protoinfo_dccp { CTA_PROTOINFO_DCCP_UNSPEC, CTA_PROTOINFO_DCCP_STATE, CTA_PROTOINFO_DCCP_ROLE, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTA_PROTOINFO_DCCP_HANDSHAKE_SEQ, __CTA_PROTOINFO_DCCP_MAX, }; #define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ enum ctattr_protoinfo_sctp { CTA_PROTOINFO_SCTP_UNSPEC, CTA_PROTOINFO_SCTP_STATE, CTA_PROTOINFO_SCTP_VTAG_ORIGINAL, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTA_PROTOINFO_SCTP_VTAG_REPLY, __CTA_PROTOINFO_SCTP_MAX }; #define CTA_PROTOINFO_SCTP_MAX (__CTA_PROTOINFO_SCTP_MAX - 1) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ enum ctattr_counters { CTA_COUNTERS_UNSPEC, CTA_COUNTERS_PACKETS, CTA_COUNTERS_BYTES, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTA_COUNTERS32_PACKETS, CTA_COUNTERS32_BYTES, __CTA_COUNTERS_MAX }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1) enum ctattr_nat { CTA_NAT_UNSPEC, CTA_NAT_MINIP, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTA_NAT_MAXIP, CTA_NAT_PROTO, __CTA_NAT_MAX }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define CTA_NAT_MAX (__CTA_NAT_MAX - 1) enum ctattr_protonat { CTA_PROTONAT_UNSPEC, CTA_PROTONAT_PORT_MIN, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTA_PROTONAT_PORT_MAX, __CTA_PROTONAT_MAX }; #define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ enum ctattr_natseq { CTA_NAT_SEQ_UNSPEC, CTA_NAT_SEQ_CORRECTION_POS, CTA_NAT_SEQ_OFFSET_BEFORE, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTA_NAT_SEQ_OFFSET_AFTER, __CTA_NAT_SEQ_MAX }; #define CTA_NAT_SEQ_MAX (__CTA_NAT_SEQ_MAX - 1) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ enum ctattr_expect { CTA_EXPECT_UNSPEC, CTA_EXPECT_MASTER, CTA_EXPECT_TUPLE, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTA_EXPECT_MASK, CTA_EXPECT_TIMEOUT, CTA_EXPECT_ID, CTA_EXPECT_HELP_NAME, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ CTA_EXPECT_ZONE, __CTA_EXPECT_MAX }; #define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ enum ctattr_help { CTA_HELP_UNSPEC, CTA_HELP_NAME, __CTA_HELP_MAX /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ }; #define CTA_HELP_MAX (__CTA_HELP_MAX - 1) #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_SECMARK.h0000644000015700001700000000175512200324306026431 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_SECMARK_H_target #define _XT_SECMARK_H_target #define SECMARK_MODE_SEL 0x01 #define SECMARK_SELCTX_MAX 256 struct xt_secmark_target_selinux_info { u_int32_t selsid; char selctx[SECMARK_SELCTX_MAX]; }; struct xt_secmark_target_info { u_int8_t mode; union { struct xt_secmark_target_selinux_info sel; } u; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_realm.h0000644000015700001700000000143012200324306026432 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_REALM_H #define _XT_REALM_H struct xt_realm_info { u_int32_t id; u_int32_t mask; u_int8_t invert; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/nf_conntrack_sctp.h0000644000015700001700000000224012200324306030315 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _NF_CONNTRACK_SCTP_H #define _NF_CONNTRACK_SCTP_H #include enum sctp_conntrack { SCTP_CONNTRACK_NONE, SCTP_CONNTRACK_CLOSED, SCTP_CONNTRACK_COOKIE_WAIT, SCTP_CONNTRACK_COOKIE_ECHOED, SCTP_CONNTRACK_ESTABLISHED, SCTP_CONNTRACK_SHUTDOWN_SENT, SCTP_CONNTRACK_SHUTDOWN_RECD, SCTP_CONNTRACK_SHUTDOWN_ACK_SENT, SCTP_CONNTRACK_MAX }; struct ip_ct_sctp { enum sctp_conntrack state; u_int32_t vtag[IP_CT_DIR_MAX]; u_int32_t ttag[IP_CT_DIR_MAX]; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_comment.h0000644000015700001700000000147012200324306027000 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_COMMENT_H #define _XT_COMMENT_H #define XT_MAX_COMMENT_LEN 256 struct xt_comment_info { unsigned char comment[XT_MAX_COMMENT_LEN]; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_conntrack.h0000644000015700001700000000340712200324306027322 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_CONNTRACK_H #define _XT_CONNTRACK_H #include #include #define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) #define XT_CONNTRACK_STATE_INVALID (1 << 0) #define XT_CONNTRACK_STATE_SNAT (1 << (IP_CT_NUMBER + 1)) #define XT_CONNTRACK_STATE_DNAT (1 << (IP_CT_NUMBER + 2)) #define XT_CONNTRACK_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 3)) #define XT_CONNTRACK_STATE 0x01 #define XT_CONNTRACK_PROTO 0x02 #define XT_CONNTRACK_ORIGSRC 0x04 #define XT_CONNTRACK_ORIGDST 0x08 #define XT_CONNTRACK_REPLSRC 0x10 #define XT_CONNTRACK_REPLDST 0x20 #define XT_CONNTRACK_STATUS 0x40 #define XT_CONNTRACK_EXPIRES 0x80 struct ip_conntrack_old_tuple { struct { __u32 ip; union { __u16 all; } u; } src; struct { __u32 ip; union { __u16 all; } u; __u16 protonum; } dst; }; struct xt_conntrack_info { unsigned int statemask, statusmask; struct ip_conntrack_old_tuple tuple[IP_CT_DIR_MAX]; struct in_addr sipmsk[IP_CT_DIR_MAX], dipmsk[IP_CT_DIR_MAX]; unsigned long expires_min, expires_max; u_int8_t flags; u_int8_t invflags; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_mac.h0000644000015700001700000000141612200324306026076 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_MAC_H #define _XT_MAC_H struct xt_mac_info { unsigned char srcaddr[ETH_ALEN]; int invert; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/x_tables.h0000644000015700001700000000477112200324306026433 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _X_TABLES_H #define _X_TABLES_H #define XT_FUNCTION_MAXNAMELEN 30 #define XT_TABLE_MAXNAMELEN 32 struct xt_entry_match { union { struct { u_int16_t match_size; char name[XT_FUNCTION_MAXNAMELEN-1]; u_int8_t revision; } user; struct { u_int16_t match_size; struct xt_match *match; } kernel; u_int16_t match_size; } u; unsigned char data[0]; }; struct xt_entry_target { union { struct { u_int16_t target_size; char name[XT_FUNCTION_MAXNAMELEN-1]; u_int8_t revision; } user; struct { u_int16_t target_size; struct xt_target *target; } kernel; u_int16_t target_size; } u; unsigned char data[0]; }; struct xt_standard_target { struct xt_entry_target target; int verdict; }; struct xt_get_revision { char name[XT_FUNCTION_MAXNAMELEN-1]; u_int8_t revision; }; #define XT_CONTINUE 0xFFFFFFFF #define XT_RETURN (-NF_REPEAT - 1) struct _xt_align { u_int8_t u8; u_int16_t u16; u_int32_t u32; u_int64_t u64; }; #define XT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) & ~(__alignof__(struct _xt_align)-1)) #define XT_STANDARD_TARGET "" #define XT_ERROR_TARGET "ERROR" #define XT_BASE_CTL 64 #define XT_SO_SET_REPLACE (XT_BASE_CTL) #define XT_SO_SET_ADD_COUNTERS (XT_BASE_CTL + 1) #define XT_SO_SET_MAX XT_SO_SET_ADD_COUNTERS #define XT_SO_GET_INFO (XT_BASE_CTL) #define XT_SO_GET_ENTRIES (XT_BASE_CTL + 1) #define XT_SO_GET_REVISION_MATCH (XT_BASE_CTL + 2) #define XT_SO_GET_REVISION_TARGET (XT_BASE_CTL + 3) #define XT_SO_GET_MAX XT_SO_GET_REVISION_TARGET #define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0) #define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0) struct xt_counters { u_int64_t pcnt, bcnt; }; struct xt_counters_info { char name[XT_TABLE_MAXNAMELEN]; unsigned int num_counters; struct xt_counters counters[0]; }; #define XT_INV_PROTO 0x40 #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_CONNMARK.h0000644000015700001700000000160712200324306026550 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_CONNMARK_H_target #define _XT_CONNMARK_H_target enum { XT_CONNMARK_SET = 0, XT_CONNMARK_SAVE, XT_CONNMARK_RESTORE }; struct xt_connmark_target_info { unsigned long mark; unsigned long mask; u_int8_t mode; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_MARK.h0000644000015700001700000000161412200324306026070 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_MARK_H_target #define _XT_MARK_H_target struct xt_mark_target_info { unsigned long mark; }; enum { XT_MARK_SET=0, XT_MARK_AND, XT_MARK_OR, }; struct xt_mark_target_info_v1 { unsigned long mark; u_int8_t mode; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_dccp.h0000644000015700001700000000176612200324306026257 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_DCCP_H_ #define _XT_DCCP_H_ #define XT_DCCP_SRC_PORTS 0x01 #define XT_DCCP_DEST_PORTS 0x02 #define XT_DCCP_TYPE 0x04 #define XT_DCCP_OPTION 0x08 #define XT_DCCP_VALID_FLAGS 0x0f struct xt_dccp_info { u_int16_t dpts[2]; u_int16_t spts[2]; u_int16_t flags; u_int16_t invflags; u_int16_t typemask; u_int8_t option; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_length.h0000644000015700001700000000142012200324306026612 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_LENGTH_H #define _XT_LENGTH_H struct xt_length_info { u_int16_t min, max; u_int8_t invert; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_statistic.h0000644000015700001700000000232612200324306027346 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_STATISTIC_H #define _XT_STATISTIC_H enum xt_statistic_mode { XT_STATISTIC_MODE_RANDOM, XT_STATISTIC_MODE_NTH, __XT_STATISTIC_MODE_MAX }; #define XT_STATISTIC_MODE_MAX (__XT_STATISTIC_MODE_MAX - 1) enum xt_statistic_flags { XT_STATISTIC_INVERT = 0x1, }; #define XT_STATISTIC_MASK 0x1 struct xt_statistic_info { u_int16_t mode; u_int16_t flags; union { struct { u_int32_t probability; } random; struct { u_int32_t every; u_int32_t packet; u_int32_t count; } nth; } u; struct xt_statistic_info *master __attribute__((aligned(8))); }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/nf_conntrack_ftp.h0000644000015700001700000000147512200324306030146 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _NF_CONNTRACK_FTP_H #define _NF_CONNTRACK_FTP_H enum ip_ct_ftp_type { IP_CT_FTP_PORT, IP_CT_FTP_PASV, IP_CT_FTP_EPRT, IP_CT_FTP_EPSV, }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_mark.h0000644000015700001700000000142012200324306026263 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_MARK_H #define _XT_MARK_H struct xt_mark_info { unsigned long mark, mask; u_int8_t invert; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_helper.h0000644000015700001700000000140512200324306026613 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_HELPER_H #define _XT_HELPER_H struct xt_helper_info { int invert; char name[30]; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_pkttype.h0000644000015700001700000000140612200324306027035 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_PKTTYPE_H #define _XT_PKTTYPE_H struct xt_pkttype_info { int pkttype; int invert; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_state.h0000644000015700001700000000162712200324306026462 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_STATE_H #define _XT_STATE_H #define XT_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) #define XT_STATE_INVALID (1 << 0) #define XT_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 1)) struct xt_state_info { unsigned int statemask; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_sctp.h0000644000015700001700000000506712200324306026315 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_SCTP_H_ #define _XT_SCTP_H_ #define XT_SCTP_SRC_PORTS 0x01 #define XT_SCTP_DEST_PORTS 0x02 #define XT_SCTP_CHUNK_TYPES 0x04 #define XT_SCTP_VALID_FLAGS 0x07 #define ELEMCOUNT(x) (sizeof(x)/sizeof(x[0])) struct xt_sctp_flag_info { u_int8_t chunktype; u_int8_t flag; u_int8_t flag_mask; }; #define XT_NUM_SCTP_FLAGS 4 struct xt_sctp_info { u_int16_t dpts[2]; u_int16_t spts[2]; u_int32_t chunkmap[256 / sizeof (u_int32_t)]; #define SCTP_CHUNK_MATCH_ANY 0x01 #define SCTP_CHUNK_MATCH_ALL 0x02 #define SCTP_CHUNK_MATCH_ONLY 0x04 u_int32_t chunk_match_type; struct xt_sctp_flag_info flag_info[XT_NUM_SCTP_FLAGS]; int flag_count; u_int32_t flags; u_int32_t invflags; }; #define bytes(type) (sizeof(type) * 8) #define SCTP_CHUNKMAP_SET(chunkmap, type) do { chunkmap[type / bytes(u_int32_t)] |= 1 << (type % bytes(u_int32_t)); } while (0) #define SCTP_CHUNKMAP_CLEAR(chunkmap, type) do { chunkmap[type / bytes(u_int32_t)] &= ~(1 << (type % bytes(u_int32_t))); } while (0) #define SCTP_CHUNKMAP_IS_SET(chunkmap, type) ({ (chunkmap[type / bytes (u_int32_t)] & (1 << (type % bytes (u_int32_t)))) ? 1: 0; }) #define SCTP_CHUNKMAP_RESET(chunkmap) do { int i; for (i = 0; i < ELEMCOUNT(chunkmap); i++) chunkmap[i] = 0; } while (0) #define SCTP_CHUNKMAP_SET_ALL(chunkmap) do { int i; for (i = 0; i < ELEMCOUNT(chunkmap); i++) chunkmap[i] = ~0; } while (0) #define SCTP_CHUNKMAP_COPY(destmap, srcmap) do { int i; for (i = 0; i < ELEMCOUNT(chunkmap); i++) destmap[i] = srcmap[i]; } while (0) #define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) ({ int i; int flag = 1; for (i = 0; i < ELEMCOUNT(chunkmap); i++) { if (chunkmap[i]) { flag = 0; break; } } flag; }) #define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) ({ int i; int flag = 1; for (i = 0; i < ELEMCOUNT(chunkmap); i++) { if (chunkmap[i] != ~0) { flag = 0; break; } } flag; }) #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_multiport.h0000644000015700001700000000210512200324306027371 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_MULTIPORT_H #define _XT_MULTIPORT_H enum xt_multiport_flags { XT_MULTIPORT_SOURCE, XT_MULTIPORT_DESTINATION, XT_MULTIPORT_EITHER }; #define XT_MULTI_PORTS 15 struct xt_multiport { u_int8_t flags; u_int8_t count; u_int16_t ports[XT_MULTI_PORTS]; }; struct xt_multiport_v1 { u_int8_t flags; u_int8_t count; u_int16_t ports[XT_MULTI_PORTS]; u_int8_t pflags[XT_MULTI_PORTS]; u_int8_t invert; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_connmark.h0000644000015700001700000000143412200324306027146 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_CONNMARK_H #define _XT_CONNMARK_H struct xt_connmark_info { unsigned long mark, mask; u_int8_t invert; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_physdev.h0000644000015700001700000000210312200324306027012 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_PHYSDEV_H #define _XT_PHYSDEV_H #define XT_PHYSDEV_OP_IN 0x01 #define XT_PHYSDEV_OP_OUT 0x02 #define XT_PHYSDEV_OP_BRIDGED 0x04 #define XT_PHYSDEV_OP_ISIN 0x08 #define XT_PHYSDEV_OP_ISOUT 0x10 #define XT_PHYSDEV_OP_MASK (0x20 - 1) struct xt_physdev_info { char physindev[IFNAMSIZ]; char in_mask[IFNAMSIZ]; char physoutdev[IFNAMSIZ]; char out_mask[IFNAMSIZ]; u_int8_t invert; u_int8_t bitmask; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_tcpmss.h0000644000015700001700000000145212200324306026647 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_TCPMSS_MATCH_H #define _XT_TCPMSS_MATCH_H struct xt_tcpmss_match_info { u_int16_t mss_min, mss_max; u_int8_t invert; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/nf_conntrack_common.h0000644000015700001700000000527512200324306030647 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _NF_CONNTRACK_COMMON_H #define _NF_CONNTRACK_COMMON_H enum ip_conntrack_info { IP_CT_ESTABLISHED, IP_CT_RELATED, IP_CT_NEW, IP_CT_IS_REPLY, IP_CT_NUMBER = IP_CT_IS_REPLY * 2 - 1 }; enum ip_conntrack_status { IPS_EXPECTED_BIT = 0, IPS_EXPECTED = (1 << IPS_EXPECTED_BIT), IPS_SEEN_REPLY_BIT = 1, IPS_SEEN_REPLY = (1 << IPS_SEEN_REPLY_BIT), IPS_ASSURED_BIT = 2, IPS_ASSURED = (1 << IPS_ASSURED_BIT), IPS_CONFIRMED_BIT = 3, IPS_CONFIRMED = (1 << IPS_CONFIRMED_BIT), IPS_SRC_NAT_BIT = 4, IPS_SRC_NAT = (1 << IPS_SRC_NAT_BIT), IPS_DST_NAT_BIT = 5, IPS_DST_NAT = (1 << IPS_DST_NAT_BIT), IPS_NAT_MASK = (IPS_DST_NAT | IPS_SRC_NAT), IPS_SEQ_ADJUST_BIT = 6, IPS_SEQ_ADJUST = (1 << IPS_SEQ_ADJUST_BIT), IPS_SRC_NAT_DONE_BIT = 7, IPS_SRC_NAT_DONE = (1 << IPS_SRC_NAT_DONE_BIT), IPS_DST_NAT_DONE_BIT = 8, IPS_DST_NAT_DONE = (1 << IPS_DST_NAT_DONE_BIT), IPS_NAT_DONE_MASK = (IPS_DST_NAT_DONE | IPS_SRC_NAT_DONE), IPS_DYING_BIT = 9, IPS_DYING = (1 << IPS_DYING_BIT), IPS_FIXED_TIMEOUT_BIT = 10, IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT), }; enum ip_conntrack_events { IPCT_NEW_BIT = 0, IPCT_NEW = (1 << IPCT_NEW_BIT), IPCT_RELATED_BIT = 1, IPCT_RELATED = (1 << IPCT_RELATED_BIT), IPCT_DESTROY_BIT = 2, IPCT_DESTROY = (1 << IPCT_DESTROY_BIT), IPCT_REFRESH_BIT = 3, IPCT_REFRESH = (1 << IPCT_REFRESH_BIT), IPCT_STATUS_BIT = 4, IPCT_STATUS = (1 << IPCT_STATUS_BIT), IPCT_PROTOINFO_BIT = 5, IPCT_PROTOINFO = (1 << IPCT_PROTOINFO_BIT), IPCT_PROTOINFO_VOLATILE_BIT = 6, IPCT_PROTOINFO_VOLATILE = (1 << IPCT_PROTOINFO_VOLATILE_BIT), IPCT_HELPER_BIT = 7, IPCT_HELPER = (1 << IPCT_HELPER_BIT), IPCT_HELPINFO_BIT = 8, IPCT_HELPINFO = (1 << IPCT_HELPINFO_BIT), IPCT_HELPINFO_VOLATILE_BIT = 9, IPCT_HELPINFO_VOLATILE = (1 << IPCT_HELPINFO_VOLATILE_BIT), IPCT_NATINFO_BIT = 10, IPCT_NATINFO = (1 << IPCT_NATINFO_BIT), IPCT_COUNTER_FILLING_BIT = 11, IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT), }; enum ip_conntrack_expect_events { IPEXP_NEW_BIT = 0, IPEXP_NEW = (1 << IPEXP_NEW_BIT), }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_CLASSIFY.h0000644000015700001700000000141312200324306026550 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_CLASSIFY_H #define _XT_CLASSIFY_H struct xt_classify_target_info { u_int32_t priority; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_CONNSECMARK.h0000644000015700001700000000152512200324306027102 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_CONNSECMARK_H_target #define _XT_CONNSECMARK_H_target enum { CONNSECMARK_SAVE = 1, CONNSECMARK_RESTORE, }; struct xt_connsecmark_target_info { u_int8_t mode; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_tcpudp.h0000644000015700001700000000224712200324306026640 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_TCPUDP_H #define _XT_TCPUDP_H struct xt_tcp { u_int16_t spts[2]; u_int16_t dpts[2]; u_int8_t option; u_int8_t flg_mask; u_int8_t flg_cmp; u_int8_t invflags; }; #define XT_TCP_INV_SRCPT 0x01 #define XT_TCP_INV_DSTPT 0x02 #define XT_TCP_INV_FLAGS 0x04 #define XT_TCP_INV_OPTION 0x08 #define XT_TCP_INV_MASK 0x0F struct xt_udp { u_int16_t spts[2]; u_int16_t dpts[2]; u_int8_t invflags; }; #define XT_UDP_INV_SRCPT 0x01 #define XT_UDP_INV_DSTPT 0x02 #define XT_UDP_INV_MASK 0x03 #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_esp.h0000644000015700001700000000150112200324306026120 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_ESP_H #define _XT_ESP_H struct xt_esp { u_int32_t spis[2]; u_int8_t invflags; }; #define XT_ESP_INV_SPI 0x01 #define XT_ESP_INV_MASK 0x01 #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_string.h0000644000015700001700000000202712200324306026643 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_STRING_H #define _XT_STRING_H #define XT_STRING_MAX_PATTERN_SIZE 128 #define XT_STRING_MAX_ALGO_NAME_SIZE 16 struct xt_string_info { u_int16_t from_offset; u_int16_t to_offset; char algo[XT_STRING_MAX_ALGO_NAME_SIZE]; char pattern[XT_STRING_MAX_PATTERN_SIZE]; u_int8_t patlen; u_int8_t invert; struct ts_config __attribute__((aligned(8))) *config; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_NFQUEUE.h0000644000015700001700000000140312200324306026442 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_NFQ_TARGET_H #define _XT_NFQ_TARGET_H struct xt_NFQ_info { u_int16_t queuenum; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_quota.h0000644000015700001700000000160712200324306026471 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_QUOTA_H #define _XT_QUOTA_H enum xt_quota_flags { XT_QUOTA_INVERT = 0x1, }; #define XT_QUOTA_MASK 0x1 struct xt_quota_info { u_int32_t flags; u_int32_t pad; aligned_u64 quota; struct xt_quota_info *master; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/nf_conntrack_tuple_common.h0000644000015700001700000000163712200324306032056 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _NF_CONNTRACK_TUPLE_COMMON_H #define _NF_CONNTRACK_TUPLE_COMMON_H enum ip_conntrack_dir { IP_CT_DIR_ORIGINAL, IP_CT_DIR_REPLY, IP_CT_DIR_MAX }; #define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL) #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/nf_conntrack_tcp.h0000644000015700001700000000221612200324306030135 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _NF_CONNTRACK_TCP_H #define _NF_CONNTRACK_TCP_H enum tcp_conntrack { TCP_CONNTRACK_NONE, TCP_CONNTRACK_SYN_SENT, TCP_CONNTRACK_SYN_RECV, TCP_CONNTRACK_ESTABLISHED, TCP_CONNTRACK_FIN_WAIT, TCP_CONNTRACK_CLOSE_WAIT, TCP_CONNTRACK_LAST_ACK, TCP_CONNTRACK_TIME_WAIT, TCP_CONNTRACK_CLOSE, TCP_CONNTRACK_LISTEN, TCP_CONNTRACK_MAX, TCP_CONNTRACK_IGNORE }; #define IP_CT_TCP_FLAG_WINDOW_SCALE 0x01 #define IP_CT_TCP_FLAG_SACK_PERM 0x02 #define IP_CT_TCP_FLAG_CLOSE_INIT 0x03 #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter/xt_limit.h0000644000015700001700000000160512200324306026454 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XT_RATE_H #define _XT_RATE_H #define XT_LIMIT_SCALE 10000 struct xt_rateinfo { u_int32_t avg; u_int32_t burst; unsigned long prev; u_int32_t credit; u_int32_t credit_cap, cost; struct xt_rateinfo *master; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/major.h0000644000015700001700000001046112200324306023737 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_MAJOR_H #define _LINUX_MAJOR_H #define UNNAMED_MAJOR 0 #define MEM_MAJOR 1 #define RAMDISK_MAJOR 1 #define FLOPPY_MAJOR 2 #define PTY_MASTER_MAJOR 2 #define IDE0_MAJOR 3 #define HD_MAJOR IDE0_MAJOR #define PTY_SLAVE_MAJOR 3 #define TTY_MAJOR 4 #define TTYAUX_MAJOR 5 #define LP_MAJOR 6 #define VCS_MAJOR 7 #define LOOP_MAJOR 7 #define SCSI_DISK0_MAJOR 8 #define SCSI_TAPE_MAJOR 9 #define MD_MAJOR 9 #define MISC_MAJOR 10 #define SCSI_CDROM_MAJOR 11 #define MUX_MAJOR 11 #define XT_DISK_MAJOR 13 #define INPUT_MAJOR 13 #define SOUND_MAJOR 14 #define CDU31A_CDROM_MAJOR 15 #define JOYSTICK_MAJOR 15 #define GOLDSTAR_CDROM_MAJOR 16 #define OPTICS_CDROM_MAJOR 17 #define SANYO_CDROM_MAJOR 18 #define CYCLADES_MAJOR 19 #define CYCLADESAUX_MAJOR 20 #define MITSUMI_X_CDROM_MAJOR 20 #define MFM_ACORN_MAJOR 21 #define SCSI_GENERIC_MAJOR 21 #define IDE1_MAJOR 22 #define DIGICU_MAJOR 22 #define DIGI_MAJOR 23 #define MITSUMI_CDROM_MAJOR 23 #define CDU535_CDROM_MAJOR 24 #define STL_SERIALMAJOR 24 #define MATSUSHITA_CDROM_MAJOR 25 #define STL_CALLOUTMAJOR 25 #define MATSUSHITA_CDROM2_MAJOR 26 #define QIC117_TAPE_MAJOR 27 #define MATSUSHITA_CDROM3_MAJOR 27 #define MATSUSHITA_CDROM4_MAJOR 28 #define STL_SIOMEMMAJOR 28 #define ACSI_MAJOR 28 #define AZTECH_CDROM_MAJOR 29 #define GRAPHDEV_MAJOR 29 #define CM206_CDROM_MAJOR 32 #define IDE2_MAJOR 33 #define IDE3_MAJOR 34 #define Z8530_MAJOR 34 #define XPRAM_MAJOR 35 #define NETLINK_MAJOR 36 #define PS2ESDI_MAJOR 36 #define IDETAPE_MAJOR 37 #define Z2RAM_MAJOR 37 #define APBLOCK_MAJOR 38 #define DDV_MAJOR 39 #define NBD_MAJOR 43 #define RISCOM8_NORMAL_MAJOR 48 #define DAC960_MAJOR 48 #define RISCOM8_CALLOUT_MAJOR 49 #define MKISS_MAJOR 55 #define DSP56K_MAJOR 55 #define IDE4_MAJOR 56 #define IDE5_MAJOR 57 #define SCSI_DISK1_MAJOR 65 #define SCSI_DISK2_MAJOR 66 #define SCSI_DISK3_MAJOR 67 #define SCSI_DISK4_MAJOR 68 #define SCSI_DISK5_MAJOR 69 #define SCSI_DISK6_MAJOR 70 #define SCSI_DISK7_MAJOR 71 #define COMPAQ_SMART2_MAJOR 72 #define COMPAQ_SMART2_MAJOR1 73 #define COMPAQ_SMART2_MAJOR2 74 #define COMPAQ_SMART2_MAJOR3 75 #define COMPAQ_SMART2_MAJOR4 76 #define COMPAQ_SMART2_MAJOR5 77 #define COMPAQ_SMART2_MAJOR6 78 #define COMPAQ_SMART2_MAJOR7 79 #define SPECIALIX_NORMAL_MAJOR 75 #define SPECIALIX_CALLOUT_MAJOR 76 #define AURORA_MAJOR 79 #define I2O_MAJOR 80 #define SHMIQ_MAJOR 85 #define SCSI_CHANGER_MAJOR 86 #define IDE6_MAJOR 88 #define IDE7_MAJOR 89 #define IDE8_MAJOR 90 #define IDE9_MAJOR 91 #define DASD_MAJOR 94 #define MDISK_MAJOR 95 #define UBD_MAJOR 98 #define PP_MAJOR 99 #define JSFD_MAJOR 99 #define PHONE_MAJOR 100 #define COMPAQ_CISS_MAJOR 104 #define COMPAQ_CISS_MAJOR1 105 #define COMPAQ_CISS_MAJOR2 106 #define COMPAQ_CISS_MAJOR3 107 #define COMPAQ_CISS_MAJOR4 108 #define COMPAQ_CISS_MAJOR5 109 #define COMPAQ_CISS_MAJOR6 110 #define COMPAQ_CISS_MAJOR7 111 #define VIODASD_MAJOR 112 #define VIOCD_MAJOR 113 #define ATARAID_MAJOR 114 #define SCSI_DISK8_MAJOR 128 #define SCSI_DISK9_MAJOR 129 #define SCSI_DISK10_MAJOR 130 #define SCSI_DISK11_MAJOR 131 #define SCSI_DISK12_MAJOR 132 #define SCSI_DISK13_MAJOR 133 #define SCSI_DISK14_MAJOR 134 #define SCSI_DISK15_MAJOR 135 #define UNIX98_PTY_MASTER_MAJOR 128 #define UNIX98_PTY_MAJOR_COUNT 8 #define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT) #define RTF_MAJOR 150 #define RAW_MAJOR 162 #define USB_ACM_MAJOR 166 #define USB_ACM_AUX_MAJOR 167 #define USB_CHAR_MAJOR 180 #define VXVM_MAJOR 199 #define VXSPEC_MAJOR 200 #define VXDMP_MAJOR 201 #define MSR_MAJOR 202 #define CPUID_MAJOR 203 #define OSST_MAJOR 206 #define IBM_TTY3270_MAJOR 227 #define IBM_FS3270_MAJOR 228 #define VIOTAPE_MAJOR 230 #endif android-audiosystem-1.8+13.10.20130807/include/linux/in.h0000644000015700001700000001206712200324306023241 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IN_H #define _LINUX_IN_H #include #include enum { IPPROTO_IP = 0, IPPROTO_ICMP = 1, IPPROTO_IGMP = 2, IPPROTO_IPIP = 4, IPPROTO_TCP = 6, IPPROTO_EGP = 8, IPPROTO_PUP = 12, IPPROTO_UDP = 17, IPPROTO_IDP = 22, IPPROTO_DCCP = 33, IPPROTO_RSVP = 46, IPPROTO_GRE = 47, IPPROTO_IPV6 = 41, IPPROTO_ESP = 50, IPPROTO_AH = 51, IPPROTO_PIM = 103, IPPROTO_COMP = 108, IPPROTO_SCTP = 132, IPPROTO_RAW = 255, IPPROTO_MAX }; struct in_addr { __u32 s_addr; }; #define IP_TOS 1 #define IP_TTL 2 #define IP_HDRINCL 3 #define IP_OPTIONS 4 #define IP_ROUTER_ALERT 5 #define IP_RECVOPTS 6 #define IP_RETOPTS 7 #define IP_PKTINFO 8 #define IP_PKTOPTIONS 9 #define IP_MTU_DISCOVER 10 #define IP_RECVERR 11 #define IP_RECVTTL 12 #define IP_RECVTOS 13 #define IP_MTU 14 #define IP_FREEBIND 15 #define IP_IPSEC_POLICY 16 #define IP_XFRM_POLICY 17 #define IP_PASSSEC 18 #define IP_RECVRETOPTS IP_RETOPTS #define IP_PMTUDISC_DONT 0 #define IP_PMTUDISC_WANT 1 #define IP_PMTUDISC_DO 2 #define IP_MULTICAST_IF 32 #define IP_MULTICAST_TTL 33 #define IP_MULTICAST_LOOP 34 #define IP_ADD_MEMBERSHIP 35 #define IP_DROP_MEMBERSHIP 36 #define IP_UNBLOCK_SOURCE 37 #define IP_BLOCK_SOURCE 38 #define IP_ADD_SOURCE_MEMBERSHIP 39 #define IP_DROP_SOURCE_MEMBERSHIP 40 #define IP_MSFILTER 41 #define MCAST_JOIN_GROUP 42 #define MCAST_BLOCK_SOURCE 43 #define MCAST_UNBLOCK_SOURCE 44 #define MCAST_LEAVE_GROUP 45 #define MCAST_JOIN_SOURCE_GROUP 46 #define MCAST_LEAVE_SOURCE_GROUP 47 #define MCAST_MSFILTER 48 #define MCAST_EXCLUDE 0 #define MCAST_INCLUDE 1 #define IP_DEFAULT_MULTICAST_TTL 1 #define IP_DEFAULT_MULTICAST_LOOP 1 struct ip_mreq { struct in_addr imr_multiaddr; struct in_addr imr_interface; }; struct ip_mreqn { struct in_addr imr_multiaddr; struct in_addr imr_address; int imr_ifindex; }; struct ip_mreq_source { __u32 imr_multiaddr; __u32 imr_interface; __u32 imr_sourceaddr; }; struct ip_msfilter { __u32 imsf_multiaddr; __u32 imsf_interface; __u32 imsf_fmode; __u32 imsf_numsrc; __u32 imsf_slist[1]; }; #define IP_MSFILTER_SIZE(numsrc) (sizeof(struct ip_msfilter) - sizeof(__u32) + (numsrc) * sizeof(__u32)) struct group_req { __u32 gr_interface; struct __kernel_sockaddr_storage gr_group; }; struct group_source_req { __u32 gsr_interface; struct __kernel_sockaddr_storage gsr_group; struct __kernel_sockaddr_storage gsr_source; }; struct group_filter { __u32 gf_interface; struct __kernel_sockaddr_storage gf_group; __u32 gf_fmode; __u32 gf_numsrc; struct __kernel_sockaddr_storage gf_slist[1]; }; #define GROUP_FILTER_SIZE(numsrc) (sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage) + (numsrc) * sizeof(struct __kernel_sockaddr_storage)) struct in_pktinfo { int ipi_ifindex; struct in_addr ipi_spec_dst; struct in_addr ipi_addr; }; #define __SOCK_SIZE__ 16 struct sockaddr_in { sa_family_t sin_family; unsigned short int sin_port; struct in_addr sin_addr; unsigned char __pad[__SOCK_SIZE__ - sizeof(short int) - sizeof(unsigned short int) - sizeof(struct in_addr)]; }; #define sin_zero __pad #define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0) #define IN_CLASSA_NET 0xff000000 #define IN_CLASSA_NSHIFT 24 #define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) #define IN_CLASSA_MAX 128 #define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000) #define IN_CLASSB_NET 0xffff0000 #define IN_CLASSB_NSHIFT 16 #define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) #define IN_CLASSB_MAX 65536 #define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000) #define IN_CLASSC_NET 0xffffff00 #define IN_CLASSC_NSHIFT 8 #define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) #define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000) #define IN_MULTICAST(a) IN_CLASSD(a) #define IN_MULTICAST_NET 0xF0000000 #define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) #define IN_BADCLASS(a) IN_EXPERIMENTAL((a)) #define INADDR_ANY ((unsigned long int) 0x00000000) #define INADDR_BROADCAST ((unsigned long int) 0xffffffff) #define INADDR_NONE ((unsigned long int) 0xffffffff) #define IN_LOOPBACKNET 127 #define INADDR_LOOPBACK 0x7f000001 #define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000) #define INADDR_UNSPEC_GROUP 0xe0000000U #define INADDR_ALLHOSTS_GROUP 0xe0000001U #define INADDR_ALLRTRS_GROUP 0xe0000002U #define INADDR_MAX_LOCAL_GROUP 0xe00000ffU #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/ipc.h0000644000015700001700000000235212200324306023402 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IPC_H #define _LINUX_IPC_H #include #define IPC_PRIVATE ((__kernel_key_t) 0) struct ipc_perm { __kernel_key_t key; __kernel_uid_t uid; __kernel_gid_t gid; __kernel_uid_t cuid; __kernel_gid_t cgid; __kernel_mode_t mode; unsigned short seq; }; #include #define IPC_CREAT 00001000 #define IPC_EXCL 00002000 #define IPC_NOWAIT 00004000 #define IPC_DIPC 00010000 #define IPC_OWN 00020000 #define IPC_RMID 0 #define IPC_SET 1 #define IPC_STAT 2 #define IPC_INFO 3 #define IPC_OLD 0 #define IPC_64 0x0100 #endif android-audiosystem-1.8+13.10.20130807/include/linux/ip.h0000644000015700001700000000564312200324306023245 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IP_H #define _LINUX_IP_H #include #include #define IPTOS_TOS_MASK 0x1E #define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK) #define IPTOS_LOWDELAY 0x10 #define IPTOS_THROUGHPUT 0x08 #define IPTOS_RELIABILITY 0x04 #define IPTOS_MINCOST 0x02 #define IPTOS_PREC_MASK 0xE0 #define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK) #define IPTOS_PREC_NETCONTROL 0xe0 #define IPTOS_PREC_INTERNETCONTROL 0xc0 #define IPTOS_PREC_CRITIC_ECP 0xa0 #define IPTOS_PREC_FLASHOVERRIDE 0x80 #define IPTOS_PREC_FLASH 0x60 #define IPTOS_PREC_IMMEDIATE 0x40 #define IPTOS_PREC_PRIORITY 0x20 #define IPTOS_PREC_ROUTINE 0x00 #define IPOPT_COPY 0x80 #define IPOPT_CLASS_MASK 0x60 #define IPOPT_NUMBER_MASK 0x1f #define IPOPT_COPIED(o) ((o)&IPOPT_COPY) #define IPOPT_CLASS(o) ((o)&IPOPT_CLASS_MASK) #define IPOPT_NUMBER(o) ((o)&IPOPT_NUMBER_MASK) #define IPOPT_CONTROL 0x00 #define IPOPT_RESERVED1 0x20 #define IPOPT_MEASUREMENT 0x40 #define IPOPT_RESERVED2 0x60 #define IPOPT_END (0 |IPOPT_CONTROL) #define IPOPT_NOOP (1 |IPOPT_CONTROL) #define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY) #define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY) #define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT) #define IPOPT_RR (7 |IPOPT_CONTROL) #define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY) #define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY) #define IPOPT_RA (20|IPOPT_CONTROL|IPOPT_COPY) #define IPVERSION 4 #define MAXTTL 255 #define IPDEFTTL 64 #define IPOPT_OPTVAL 0 #define IPOPT_OLEN 1 #define IPOPT_OFFSET 2 #define IPOPT_MINOFF 4 #define MAX_IPOPTLEN 40 #define IPOPT_NOP IPOPT_NOOP #define IPOPT_EOL IPOPT_END #define IPOPT_TS IPOPT_TIMESTAMP #define IPOPT_TS_TSONLY 0 #define IPOPT_TS_TSANDADDR 1 #define IPOPT_TS_PRESPEC 3 struct iphdr { #ifdef __LITTLE_ENDIAN_BITFIELD __u8 ihl:4, version:4; #elif defined (__BIG_ENDIAN_BITFIELD) __u8 version:4, ihl:4; #else #error "Please fix " #endif __u8 tos; __be16 tot_len; __be16 id; __be16 frag_off; __u8 ttl; __u8 protocol; __u16 check; __be32 saddr; __be32 daddr; }; struct ip_auth_hdr { __u8 nexthdr; __u8 hdrlen; __u16 reserved; __u32 spi; __u32 seq_no; __u8 auth_data[0]; }; struct ip_esp_hdr { __u32 spi; __u32 seq_no; __u8 enc_data[0]; }; struct ip_comp_hdr { __u8 nexthdr; __u8 flags; __u16 cpi; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/platform_device.h0000644000015700001700000000256712200324306026002 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _PLATFORM_DEVICE_H_ #define _PLATFORM_DEVICE_H_ #include struct platform_device { const char * name; u32 id; struct device dev; u32 num_resources; struct resource * resource; }; #define to_platform_device(x) container_of((x), struct platform_device, dev) struct platform_driver { int (*probe)(struct platform_device *); int (*remove)(struct platform_device *); void (*shutdown)(struct platform_device *); int (*suspend)(struct platform_device *, pm_message_t state); int (*resume)(struct platform_device *); struct device_driver driver; }; #define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev) #define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data)) #endif android-audiosystem-1.8+13.10.20130807/include/linux/msm_vidc_enc.h0000644000015700001700000003013112200324306025251 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _MSM_VIDC_ENC_H_ #define _MSM_VIDC_ENC_H_ #include #include #define VEN_S_BASE 0x00000000 #define VEN_S_SUCCESS (VEN_S_BASE) #define VEN_S_EFAIL (VEN_S_BASE+1) #define VEN_S_EFATAL (VEN_S_BASE+2) #define VEN_S_EBADPARAM (VEN_S_BASE+3) #define VEN_S_EINVALSTATE (VEN_S_BASE+4) #define VEN_S_ENOSWRES (VEN_S_BASE+5) #define VEN_S_ENOHWRES (VEN_S_BASE+6) #define VEN_S_EBUFFREQ (VEN_S_BASE+7) #define VEN_S_EINVALCMD (VEN_S_BASE+8) #define VEN_S_ETIMEOUT (VEN_S_BASE+9) #define VEN_S_ENOREATMPT (VEN_S_BASE+10) #define VEN_S_ENOPREREQ (VEN_S_BASE+11) #define VEN_S_ECMDQFULL (VEN_S_BASE+12) #define VEN_S_ENOTSUPP (VEN_S_BASE+13) #define VEN_S_ENOTIMPL (VEN_S_BASE+14) #define VEN_S_ENOTPMEM (VEN_S_BASE+15) #define VEN_S_EFLUSHED (VEN_S_BASE+16) #define VEN_S_EINSUFBUF (VEN_S_BASE+17) #define VEN_S_ESAMESTATE (VEN_S_BASE+18) #define VEN_S_EINVALTRANS (VEN_S_BASE+19) #define VEN_INTF_VER 1 #define VEN_MSG_INDICATION 0 #define VEN_MSG_INPUT_BUFFER_DONE 1 #define VEN_MSG_OUTPUT_BUFFER_DONE 2 #define VEN_MSG_NEED_OUTPUT_BUFFER 3 #define VEN_MSG_FLUSH_INPUT_DONE 4 #define VEN_MSG_FLUSH_OUPUT_DONE 5 #define VEN_MSG_START 6 #define VEN_MSG_STOP 7 #define VEN_MSG_PAUSE 8 #define VEN_MSG_RESUME 9 #define VEN_MSG_STOP_READING_MSG 10 #define VEN_BUFFLAG_EOS 0x00000001 #define VEN_BUFFLAG_ENDOFFRAME 0x00000010 #define VEN_BUFFLAG_SYNCFRAME 0x00000020 #define VEN_BUFFLAG_EXTRADATA 0x00000040 #define VEN_BUFFLAG_CODECCONFIG 0x00000080 #define VEN_FRAME_TYPE_I 1 #define VEN_FRAME_TYPE_P 2 #define VEN_FRAME_TYPE_B 3 #define VEN_CODEC_MPEG4 1 #define VEN_CODEC_H264 2 #define VEN_CODEC_H263 3 #define VEN_PROFILE_MPEG4_SP 1 #define VEN_PROFILE_MPEG4_ASP 2 #define VEN_PROFILE_H264_BASELINE 3 #define VEN_PROFILE_H264_MAIN 4 #define VEN_PROFILE_H264_HIGH 5 #define VEN_PROFILE_H263_BASELINE 6 #define VEN_LEVEL_MPEG4_0 0x1 #define VEN_LEVEL_MPEG4_1 0x2 #define VEN_LEVEL_MPEG4_2 0x3 #define VEN_LEVEL_MPEG4_3 0x4 #define VEN_LEVEL_MPEG4_4 0x5 #define VEN_LEVEL_MPEG4_5 0x6 #define VEN_LEVEL_MPEG4_3b 0x7 #define VEN_LEVEL_MPEG4_6 0x8 #define VEN_LEVEL_H264_1 0x9 #define VEN_LEVEL_H264_1b 0xA #define VEN_LEVEL_H264_1p1 0xB #define VEN_LEVEL_H264_1p2 0xC #define VEN_LEVEL_H264_1p3 0xD #define VEN_LEVEL_H264_2 0xE #define VEN_LEVEL_H264_2p1 0xF #define VEN_LEVEL_H264_2p2 0x10 #define VEN_LEVEL_H264_3 0x11 #define VEN_LEVEL_H264_3p1 0x12 #define VEN_LEVEL_H263_10 0x13 #define VEN_LEVEL_H263_20 0x14 #define VEN_LEVEL_H263_30 0x15 #define VEN_LEVEL_H263_40 0x16 #define VEN_LEVEL_H263_45 0x17 #define VEN_LEVEL_H263_50 0x18 #define VEN_LEVEL_H263_60 0x19 #define VEN_LEVEL_H263_70 0x1A #define VEN_ENTROPY_MODEL_CAVLC 1 #define VEN_ENTROPY_MODEL_CABAC 2 #define VEN_CABAC_MODEL_0 1 #define VEN_CABAC_MODEL_1 2 #define VEN_CABAC_MODEL_2 3 #define VEN_DB_DISABLE 1 #define VEN_DB_ALL_BLKG_BNDRY 2 #define VEN_DB_SKIP_SLICE_BNDRY 3 #define VEN_MSLICE_OFF 1 #define VEN_MSLICE_CNT_MB 2 #define VEN_MSLICE_CNT_BYTE 3 #define VEN_MSLICE_GOB 4 #define VEN_RC_OFF 1 #define VEN_RC_VBR_VFR 2 #define VEN_RC_VBR_CFR 3 #define VEN_RC_CBR_VFR 4 #define VEN_FLUSH_INPUT 1 #define VEN_FLUSH_OUTPUT 2 #define VEN_FLUSH_ALL 3 #define VEN_INPUTFMT_NV12 1 #define VEN_INPUTFMT_NV21 2 #define VEN_ROTATION_0 1 #define VEN_ROTATION_90 2 #define VEN_ROTATION_180 3 #define VEN_ROTATION_270 4 #define VEN_TIMEOUT_INFINITE 0xffffffff #define VEN_IR_OFF 1 #define VEN_IR_CYCLIC 2 #define VEN_IR_RANDOM 3 #define VEN_IOCTLBASE_NENC 0x800 #define VEN_IOCTLBASE_ENC 0x850 struct venc_ioctl_msg{ void *inputparam; void *outputparam; }; #define VEN_IOCTL_SET_INTF_VERSION _IOW(VEN_IOCTLBASE_NENC, 0, struct venc_ioctl_msg) #define VEN_IOCTL_CMD_READ_NEXT_MSG _IOWR(VEN_IOCTLBASE_NENC, 1, struct venc_ioctl_msg) #define VEN_IOCTL_CMD_STOP_READ_MSG _IO(VEN_IOCTLBASE_NENC, 2) #define VEN_IOCTL_SET_INPUT_BUFFER_REQ _IOW(VEN_IOCTLBASE_NENC, 3, struct venc_ioctl_msg) #define VEN_IOCTL_GET_INPUT_BUFFER_REQ _IOR(VEN_IOCTLBASE_NENC, 4, struct venc_ioctl_msg) #define VEN_IOCTL_CMD_ALLOC_INPUT_BUFFER _IOW(VEN_IOCTLBASE_NENC, 5, struct venc_ioctl_msg) #define VEN_IOCTL_SET_INPUT_BUFFER _IOW(VEN_IOCTLBASE_NENC, 6, struct venc_ioctl_msg) #define VEN_IOCTL_CMD_FREE_INPUT_BUFFER _IOW(VEN_IOCTLBASE_NENC, 7, struct venc_ioctl_msg) #define VEN_IOCTL_SET_OUTPUT_BUFFER_REQ _IOW(VEN_IOCTLBASE_NENC, 8, struct venc_ioctl_msg) #define VEN_IOCTL_GET_OUTPUT_BUFFER_REQ _IOR(VEN_IOCTLBASE_NENC, 9, struct venc_ioctl_msg) #define VEN_IOCTL_CMD_ALLOC_OUTPUT_BUFFER _IOW(VEN_IOCTLBASE_NENC, 10, struct venc_ioctl_msg) #define VEN_IOCTL_SET_OUTPUT_BUFFER _IOW(VEN_IOCTLBASE_NENC, 11, struct venc_ioctl_msg) #define VEN_IOCTL_CMD_FREE_OUTPUT_BUFFER _IOW(VEN_IOCTLBASE_NENC, 12, struct venc_ioctl_msg) #define VEN_IOCTL_CMD_START _IO(VEN_IOCTLBASE_NENC, 13) #define VEN_IOCTL_CMD_ENCODE_FRAME _IOW(VEN_IOCTLBASE_NENC, 14, struct venc_ioctl_msg) #define VEN_IOCTL_CMD_FILL_OUTPUT_BUFFER _IOW(VEN_IOCTLBASE_NENC, 15, struct venc_ioctl_msg) #define VEN_IOCTL_CMD_FLUSH _IOW(VEN_IOCTLBASE_NENC, 16, struct venc_ioctl_msg) #define VEN_IOCTL_CMD_PAUSE _IO(VEN_IOCTLBASE_NENC, 17) #define VEN_IOCTL_CMD_RESUME _IO(VEN_IOCTLBASE_NENC, 18) #define VEN_IOCTL_CMD_STOP _IO(VEN_IOCTLBASE_NENC, 19) #define VEN_IOCTL_SET_BASE_CFG _IOW(VEN_IOCTLBASE_ENC, 1, struct venc_ioctl_msg) #define VEN_IOCTL_GET_BASE_CFG _IOR(VEN_IOCTLBASE_ENC, 2, struct venc_ioctl_msg) #define VEN_IOCTL_SET_LIVE_MODE _IOW(VEN_IOCTLBASE_ENC, 3, struct venc_ioctl_msg) #define VEN_IOCTL_GET_LIVE_MODE _IOR(VEN_IOCTLBASE_ENC, 4, struct venc_ioctl_msg) #define VEN_IOCTL_SET_CODEC_PROFILE _IOW(VEN_IOCTLBASE_ENC, 5, struct venc_ioctl_msg) #define VEN_IOCTL_GET_CODEC_PROFILE _IOR(VEN_IOCTLBASE_ENC, 6, struct venc_ioctl_msg) #define VEN_IOCTL_SET_PROFILE_LEVEL _IOW(VEN_IOCTLBASE_ENC, 7, struct venc_ioctl_msg) #define VEN_IOCTL_GET_PROFILE_LEVEL _IOR(VEN_IOCTLBASE_ENC, 8, struct venc_ioctl_msg) #define VEN_IOCTL_SET_SHORT_HDR _IOW(VEN_IOCTLBASE_ENC, 9, struct venc_ioctl_msg) #define VEN_IOCTL_GET_SHORT_HDR _IOR(VEN_IOCTLBASE_ENC, 10, struct venc_ioctl_msg) #define VEN_IOCTL_SET_SESSION_QP _IOW(VEN_IOCTLBASE_ENC, 11, struct venc_ioctl_msg) #define VEN_IOCTL_GET_SESSION_QP _IOR(VEN_IOCTLBASE_ENC, 12, struct venc_ioctl_msg) #define VEN_IOCTL_SET_INTRA_PERIOD _IOW(VEN_IOCTLBASE_ENC, 13, struct venc_ioctl_msg) #define VEN_IOCTL_GET_INTRA_PERIOD _IOR(VEN_IOCTLBASE_ENC, 14, struct venc_ioctl_msg) #define VEN_IOCTL_CMD_REQUEST_IFRAME _IO(VEN_IOCTLBASE_ENC, 15) #define VEN_IOCTL_GET_CAPABILITY _IOR(VEN_IOCTLBASE_ENC, 16, struct venc_ioctl_msg) #define VEN_IOCTL_GET_SEQUENCE_HDR _IOR(VEN_IOCTLBASE_ENC, 17, struct venc_ioctl_msg) #define VEN_IOCTL_SET_ENTROPY_CFG _IOW(VEN_IOCTLBASE_ENC, 18, struct venc_ioctl_msg) #define VEN_IOCTL_GET_ENTROPY_CFG _IOR(VEN_IOCTLBASE_ENC, 19, struct venc_ioctl_msg) #define VEN_IOCTL_SET_DEBLOCKING_CFG _IOW(VEN_IOCTLBASE_ENC, 20, struct venc_ioctl_msg) #define VEN_IOCTL_GET_DEBLOCKING_CFG _IOR(VEN_IOCTLBASE_ENC, 21, struct venc_ioctl_msg) #define VEN_IOCTL_SET_INTRA_REFRESH _IOW(VEN_IOCTLBASE_ENC, 22, struct venc_ioctl_msg) #define VEN_IOCTL_GET_INTRA_REFRESH _IOR(VEN_IOCTLBASE_ENC, 23, struct venc_ioctl_msg) #define VEN_IOCTL_SET_MULTI_SLICE_CFG _IOW(VEN_IOCTLBASE_ENC, 24, struct venc_ioctl_msg) #define VEN_IOCTL_GET_MULTI_SLICE_CFG _IOR(VEN_IOCTLBASE_ENC, 25, struct venc_ioctl_msg) #define VEN_IOCTL_SET_RATE_CTRL_CFG _IOW(VEN_IOCTLBASE_ENC, 26, struct venc_ioctl_msg) #define VEN_IOCTL_GET_RATE_CTRL_CFG _IOR(VEN_IOCTLBASE_ENC, 27, struct venc_ioctl_msg) #define VEN_IOCTL_SET_VOP_TIMING_CFG _IOW(VEN_IOCTLBASE_ENC, 28, struct venc_ioctl_msg) #define VEN_IOCTL_GET_VOP_TIMING_CFG _IOR(VEN_IOCTLBASE_ENC, 29, struct venc_ioctl_msg) #define VEN_IOCTL_SET_FRAME_RATE _IOW(VEN_IOCTLBASE_ENC, 30, struct venc_ioctl_msg) #define VEN_IOCTL_GET_FRAME_RATE _IOR(VEN_IOCTLBASE_ENC, 31, struct venc_ioctl_msg) #define VEN_IOCTL_SET_TARGET_BITRATE _IOW(VEN_IOCTLBASE_ENC, 32, struct venc_ioctl_msg) #define VEN_IOCTL_GET_TARGET_BITRATE _IOR(VEN_IOCTLBASE_ENC, 33, struct venc_ioctl_msg) #define VEN_IOCTL_SET_ROTATION _IOW(VEN_IOCTLBASE_ENC, 34, struct venc_ioctl_msg) #define VEN_IOCTL_GET_ROTATION _IOR(VEN_IOCTLBASE_ENC, 35, struct venc_ioctl_msg) #define VEN_IOCTL_SET_HEC _IOW(VEN_IOCTLBASE_ENC, 36, struct venc_ioctl_msg) #define VEN_IOCTL_GET_HEC _IOR(VEN_IOCTLBASE_ENC, 37, struct venc_ioctl_msg) #define VEN_IOCTL_SET_DATA_PARTITION _IOW(VEN_IOCTLBASE_ENC, 38, struct venc_ioctl_msg) #define VEN_IOCTL_GET_DATA_PARTITION _IOR(VEN_IOCTLBASE_ENC, 39, struct venc_ioctl_msg) #define VEN_IOCTL_SET_RVLC _IOW(VEN_IOCTLBASE_ENC, 40, struct venc_ioctl_msg) #define VEN_IOCTL_GET_RVLC _IOR(VEN_IOCTLBASE_ENC, 41, struct venc_ioctl_msg) #define VEN_IOCTL_SET_AC_PREDICTION _IOW(VEN_IOCTLBASE_ENC, 42, struct venc_ioctl_msg) #define VEN_IOCTL_GET_AC_PREDICTION _IOR(VEN_IOCTLBASE_ENC, 43, struct venc_ioctl_msg) #define VEN_IOCTL_SET_QP_RANGE _IOW(VEN_IOCTLBASE_ENC, 44, struct venc_ioctl_msg) #define VEN_IOCTL_GET_QP_RANGE _IOR(VEN_IOCTLBASE_ENC, 45, struct venc_ioctl_msg) struct venc_switch{ unsigned char status; }; struct venc_allocatorproperty{ unsigned long mincount; unsigned long maxcount; unsigned long actualcount; unsigned long datasize; unsigned long suffixsize; unsigned long alignment; unsigned long bufpoolid; }; struct venc_bufferpayload{ unsigned char *pbuffer; unsigned long nsize; int fd; unsigned int offset; unsigned int maped_size; unsigned long filled_len; }; struct venc_buffer{ unsigned char *ptrbuffer; unsigned long size; unsigned long len; unsigned long offset; long long timestamp; unsigned long flags; void *clientdata; }; struct venc_basecfg{ unsigned long input_width; unsigned long input_height; unsigned long dvs_width; unsigned long dvs_height; unsigned long codectype; unsigned long fps_num; unsigned long fps_den; unsigned long targetbitrate; unsigned long inputformat; }; struct venc_profile{ unsigned long profile; }; struct ven_profilelevel{ unsigned long level; }; struct venc_sessionqp{ unsigned long iframeqp; unsigned long pframqp; }; struct venc_qprange{ unsigned long maxqp; unsigned long minqp; }; struct venc_intraperiod{ unsigned long num_pframes; }; struct venc_seqheader{ unsigned char *hdrbufptr; unsigned long bufsize; unsigned long hdrlen; }; struct venc_capability{ unsigned long codec_types; unsigned long maxframe_width; unsigned long maxframe_height; unsigned long maxtarget_bitrate; unsigned long maxframe_rate; unsigned long input_formats; unsigned char dvs; }; struct venc_entropycfg{ unsigned longentropysel; unsigned long cabacmodel; }; struct venc_dbcfg{ unsigned long db_mode; unsigned long slicealpha_offset; unsigned long slicebeta_offset; }; struct venc_intrarefresh{ unsigned long irmode; unsigned long mbcount; }; struct venc_multiclicecfg{ unsigned long mslice_mode; unsigned long mslice_size; }; struct venc_bufferflush{ unsigned long flush_mode; }; struct venc_ratectrlcfg{ unsigned long rcmode; }; struct venc_voptimingcfg{ unsigned long voptime_resolution; }; struct venc_framerate{ unsigned long fps_denominator; unsigned long fps_numerator; }; struct venc_targetbitrate{ unsigned long target_bitrate; }; struct venc_rotation{ unsigned long rotation; }; struct venc_timeout{ unsigned long millisec; }; struct venc_headerextension{ unsigned long header_extension; }; struct venc_msg{ unsigned long statuscode; unsigned long msgcode; struct venc_buffer buf; unsigned long msgdata_size; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/input.h0000644000015700001700000005004612200324306023771 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** *** To edit the content of this header, modify the corresponding *** source file (e.g. under external/kernel-headers/original/) then *** run bionic/libc/kernel/tools/update_all.py *** *** Any manual change here will be lost the next time this script will *** be run. You've been warned! *** **************************************************************************** ****************************************************************************/ #ifndef _INPUT_H #define _INPUT_H #include #include #include #include struct input_event { struct timeval time; __u16 type; __u16 code; __s32 value; }; #define EV_VERSION 0x010001 struct input_id { __u16 bustype; __u16 vendor; __u16 product; __u16 version; }; struct input_absinfo { __s32 value; __s32 minimum; __s32 maximum; __s32 fuzz; __s32 flat; __s32 resolution; }; struct input_keymap_entry { #define INPUT_KEYMAP_BY_INDEX (1 << 0) __u8 flags; __u8 len; __u16 index; __u32 keycode; __u8 scancode[32]; }; #define EVIOCGVERSION _IOR('E', 0x01, int) #define EVIOCGID _IOR('E', 0x02, struct input_id) #define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) #define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) #define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2]) #define EVIOCGKEYCODE_V2 _IOR('E', 0x04, struct input_keymap_entry) #define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2]) #define EVIOCSKEYCODE_V2 _IOW('E', 0x04, struct input_keymap_entry) #define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) #define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) #define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) #define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len) #define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) #define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) #define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) #define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len) #define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len) #define EVIOCGABS(abs) _IOR('E', 0x40 + abs, struct input_absinfo) #define EVIOCSABS(abs) _IOW('E', 0xc0 + abs, struct input_absinfo) #define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect)) #define EVIOCRMFF _IOW('E', 0x81, int) #define EVIOCGEFFECTS _IOR('E', 0x84, int) #define EVIOCGRAB _IOW('E', 0x90, int) #define INPUT_PROP_POINTER 0x00 #define INPUT_PROP_DIRECT 0x01 #define INPUT_PROP_BUTTONPAD 0x02 #define INPUT_PROP_SEMI_MT 0x03 #define INPUT_PROP_MAX 0x1f #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) #define EV_SYN 0x00 #define EV_KEY 0x01 #define EV_REL 0x02 #define EV_ABS 0x03 #define EV_MSC 0x04 #define EV_SW 0x05 #define EV_LED 0x11 #define EV_SND 0x12 #define EV_REP 0x14 #define EV_FF 0x15 #define EV_PWR 0x16 #define EV_FF_STATUS 0x17 #define EV_MAX 0x1f #define EV_CNT (EV_MAX+1) #define SYN_REPORT 0 #define SYN_CONFIG 1 #define SYN_MT_REPORT 2 #define SYN_DROPPED 3 #define KEY_RESERVED 0 #define KEY_ESC 1 #define KEY_1 2 #define KEY_2 3 #define KEY_3 4 #define KEY_4 5 #define KEY_5 6 #define KEY_6 7 #define KEY_7 8 #define KEY_8 9 #define KEY_9 10 #define KEY_0 11 #define KEY_MINUS 12 #define KEY_EQUAL 13 #define KEY_BACKSPACE 14 #define KEY_TAB 15 #define KEY_Q 16 #define KEY_W 17 #define KEY_E 18 #define KEY_R 19 #define KEY_T 20 #define KEY_Y 21 #define KEY_U 22 #define KEY_I 23 #define KEY_O 24 #define KEY_P 25 #define KEY_LEFTBRACE 26 #define KEY_RIGHTBRACE 27 #define KEY_ENTER 28 #define KEY_LEFTCTRL 29 #define KEY_A 30 #define KEY_S 31 #define KEY_D 32 #define KEY_F 33 #define KEY_G 34 #define KEY_H 35 #define KEY_J 36 #define KEY_K 37 #define KEY_L 38 #define KEY_SEMICOLON 39 #define KEY_APOSTROPHE 40 #define KEY_GRAVE 41 #define KEY_LEFTSHIFT 42 #define KEY_BACKSLASH 43 #define KEY_Z 44 #define KEY_X 45 #define KEY_C 46 #define KEY_V 47 #define KEY_B 48 #define KEY_N 49 #define KEY_M 50 #define KEY_COMMA 51 #define KEY_DOT 52 #define KEY_SLASH 53 #define KEY_RIGHTSHIFT 54 #define KEY_KPASTERISK 55 #define KEY_LEFTALT 56 #define KEY_SPACE 57 #define KEY_CAPSLOCK 58 #define KEY_F1 59 #define KEY_F2 60 #define KEY_F3 61 #define KEY_F4 62 #define KEY_F5 63 #define KEY_F6 64 #define KEY_F7 65 #define KEY_F8 66 #define KEY_F9 67 #define KEY_F10 68 #define KEY_NUMLOCK 69 #define KEY_SCROLLLOCK 70 #define KEY_KP7 71 #define KEY_KP8 72 #define KEY_KP9 73 #define KEY_KPMINUS 74 #define KEY_KP4 75 #define KEY_KP5 76 #define KEY_KP6 77 #define KEY_KPPLUS 78 #define KEY_KP1 79 #define KEY_KP2 80 #define KEY_KP3 81 #define KEY_KP0 82 #define KEY_KPDOT 83 #define KEY_ZENKAKUHANKAKU 85 #define KEY_102ND 86 #define KEY_F11 87 #define KEY_F12 88 #define KEY_RO 89 #define KEY_KATAKANA 90 #define KEY_HIRAGANA 91 #define KEY_HENKAN 92 #define KEY_KATAKANAHIRAGANA 93 #define KEY_MUHENKAN 94 #define KEY_KPJPCOMMA 95 #define KEY_KPENTER 96 #define KEY_RIGHTCTRL 97 #define KEY_KPSLASH 98 #define KEY_SYSRQ 99 #define KEY_RIGHTALT 100 #define KEY_LINEFEED 101 #define KEY_HOME 102 #define KEY_UP 103 #define KEY_PAGEUP 104 #define KEY_LEFT 105 #define KEY_RIGHT 106 #define KEY_END 107 #define KEY_DOWN 108 #define KEY_PAGEDOWN 109 #define KEY_INSERT 110 #define KEY_DELETE 111 #define KEY_MACRO 112 #define KEY_MUTE 113 #define KEY_VOLUMEDOWN 114 #define KEY_VOLUMEUP 115 #define KEY_POWER 116 #define KEY_KPEQUAL 117 #define KEY_KPPLUSMINUS 118 #define KEY_PAUSE 119 #define KEY_SCALE 120 #define KEY_KPCOMMA 121 #define KEY_HANGEUL 122 #define KEY_HANGUEL KEY_HANGEUL #define KEY_HANJA 123 #define KEY_YEN 124 #define KEY_LEFTMETA 125 #define KEY_RIGHTMETA 126 #define KEY_COMPOSE 127 #define KEY_STOP 128 #define KEY_AGAIN 129 #define KEY_PROPS 130 #define KEY_UNDO 131 #define KEY_FRONT 132 #define KEY_COPY 133 #define KEY_OPEN 134 #define KEY_PASTE 135 #define KEY_FIND 136 #define KEY_CUT 137 #define KEY_HELP 138 #define KEY_MENU 139 #define KEY_CALC 140 #define KEY_SETUP 141 #define KEY_SLEEP 142 #define KEY_WAKEUP 143 #define KEY_FILE 144 #define KEY_SENDFILE 145 #define KEY_DELETEFILE 146 #define KEY_XFER 147 #define KEY_PROG1 148 #define KEY_PROG2 149 #define KEY_WWW 150 #define KEY_MSDOS 151 #define KEY_COFFEE 152 #define KEY_SCREENLOCK KEY_COFFEE #define KEY_DIRECTION 153 #define KEY_CYCLEWINDOWS 154 #define KEY_MAIL 155 #define KEY_BOOKMARKS 156 #define KEY_COMPUTER 157 #define KEY_BACK 158 #define KEY_FORWARD 159 #define KEY_CLOSECD 160 #define KEY_EJECTCD 161 #define KEY_EJECTCLOSECD 162 #define KEY_NEXTSONG 163 #define KEY_PLAYPAUSE 164 #define KEY_PREVIOUSSONG 165 #define KEY_STOPCD 166 #define KEY_RECORD 167 #define KEY_REWIND 168 #define KEY_PHONE 169 #define KEY_ISO 170 #define KEY_CONFIG 171 #define KEY_HOMEPAGE 172 #define KEY_REFRESH 173 #define KEY_EXIT 174 #define KEY_MOVE 175 #define KEY_EDIT 176 #define KEY_SCROLLUP 177 #define KEY_SCROLLDOWN 178 #define KEY_KPLEFTPAREN 179 #define KEY_KPRIGHTPAREN 180 #define KEY_NEW 181 #define KEY_REDO 182 #define KEY_F13 183 #define KEY_F14 184 #define KEY_F15 185 #define KEY_F16 186 #define KEY_F17 187 #define KEY_F18 188 #define KEY_F19 189 #define KEY_F20 190 #define KEY_F21 191 #define KEY_F22 192 #define KEY_F23 193 #define KEY_F24 194 #define KEY_PLAYCD 200 #define KEY_PAUSECD 201 #define KEY_PROG3 202 #define KEY_PROG4 203 #define KEY_DASHBOARD 204 #define KEY_SUSPEND 205 #define KEY_CLOSE 206 #define KEY_PLAY 207 #define KEY_FASTFORWARD 208 #define KEY_BASSBOOST 209 #define KEY_PRINT 210 #define KEY_HP 211 #define KEY_CAMERA 212 #define KEY_SOUND 213 #define KEY_QUESTION 214 #define KEY_EMAIL 215 #define KEY_CHAT 216 #define KEY_SEARCH 217 #define KEY_CONNECT 218 #define KEY_FINANCE 219 #define KEY_SPORT 220 #define KEY_SHOP 221 #define KEY_ALTERASE 222 #define KEY_CANCEL 223 #define KEY_BRIGHTNESSDOWN 224 #define KEY_BRIGHTNESSUP 225 #define KEY_MEDIA 226 #define KEY_SWITCHVIDEOMODE 227 #define KEY_KBDILLUMTOGGLE 228 #define KEY_KBDILLUMDOWN 229 #define KEY_KBDILLUMUP 230 #define KEY_SEND 231 #define KEY_REPLY 232 #define KEY_FORWARDMAIL 233 #define KEY_SAVE 234 #define KEY_DOCUMENTS 235 #define KEY_BATTERY 236 #define KEY_BLUETOOTH 237 #define KEY_WLAN 238 #define KEY_UWB 239 #define KEY_UNKNOWN 240 #define KEY_VIDEO_NEXT 241 #define KEY_VIDEO_PREV 242 #define KEY_BRIGHTNESS_CYCLE 243 #define KEY_BRIGHTNESS_ZERO 244 #define KEY_DISPLAY_OFF 245 #define KEY_WIMAX 246 #define KEY_RFKILL 247 #define BTN_MISC 0x100 #define BTN_0 0x100 #define BTN_1 0x101 #define BTN_2 0x102 #define BTN_3 0x103 #define BTN_4 0x104 #define BTN_5 0x105 #define BTN_6 0x106 #define BTN_7 0x107 #define BTN_8 0x108 #define BTN_9 0x109 #define BTN_MOUSE 0x110 #define BTN_LEFT 0x110 #define BTN_RIGHT 0x111 #define BTN_MIDDLE 0x112 #define BTN_SIDE 0x113 #define BTN_EXTRA 0x114 #define BTN_FORWARD 0x115 #define BTN_BACK 0x116 #define BTN_TASK 0x117 #define BTN_JOYSTICK 0x120 #define BTN_TRIGGER 0x120 #define BTN_THUMB 0x121 #define BTN_THUMB2 0x122 #define BTN_TOP 0x123 #define BTN_TOP2 0x124 #define BTN_PINKIE 0x125 #define BTN_BASE 0x126 #define BTN_BASE2 0x127 #define BTN_BASE3 0x128 #define BTN_BASE4 0x129 #define BTN_BASE5 0x12a #define BTN_BASE6 0x12b #define BTN_DEAD 0x12f #define BTN_GAMEPAD 0x130 #define BTN_A 0x130 #define BTN_B 0x131 #define BTN_C 0x132 #define BTN_X 0x133 #define BTN_Y 0x134 #define BTN_Z 0x135 #define BTN_TL 0x136 #define BTN_TR 0x137 #define BTN_TL2 0x138 #define BTN_TR2 0x139 #define BTN_SELECT 0x13a #define BTN_START 0x13b #define BTN_MODE 0x13c #define BTN_THUMBL 0x13d #define BTN_THUMBR 0x13e #define BTN_DIGI 0x140 #define BTN_TOOL_PEN 0x140 #define BTN_TOOL_RUBBER 0x141 #define BTN_TOOL_BRUSH 0x142 #define BTN_TOOL_PENCIL 0x143 #define BTN_TOOL_AIRBRUSH 0x144 #define BTN_TOOL_FINGER 0x145 #define BTN_TOOL_MOUSE 0x146 #define BTN_TOOL_LENS 0x147 #define BTN_TOUCH 0x14a #define BTN_STYLUS 0x14b #define BTN_STYLUS2 0x14c #define BTN_TOOL_DOUBLETAP 0x14d #define BTN_TOOL_TRIPLETAP 0x14e #define BTN_TOOL_QUADTAP 0x14f #define BTN_WHEEL 0x150 #define BTN_GEAR_DOWN 0x150 #define BTN_GEAR_UP 0x151 #define KEY_OK 0x160 #define KEY_SELECT 0x161 #define KEY_GOTO 0x162 #define KEY_CLEAR 0x163 #define KEY_POWER2 0x164 #define KEY_OPTION 0x165 #define KEY_INFO 0x166 #define KEY_TIME 0x167 #define KEY_VENDOR 0x168 #define KEY_ARCHIVE 0x169 #define KEY_PROGRAM 0x16a #define KEY_CHANNEL 0x16b #define KEY_FAVORITES 0x16c #define KEY_EPG 0x16d #define KEY_PVR 0x16e #define KEY_MHP 0x16f #define KEY_LANGUAGE 0x170 #define KEY_TITLE 0x171 #define KEY_SUBTITLE 0x172 #define KEY_ANGLE 0x173 #define KEY_ZOOM 0x174 #define KEY_MODE 0x175 #define KEY_KEYBOARD 0x176 #define KEY_SCREEN 0x177 #define KEY_PC 0x178 #define KEY_TV 0x179 #define KEY_TV2 0x17a #define KEY_VCR 0x17b #define KEY_VCR2 0x17c #define KEY_SAT 0x17d #define KEY_SAT2 0x17e #define KEY_CD 0x17f #define KEY_TAPE 0x180 #define KEY_RADIO 0x181 #define KEY_TUNER 0x182 #define KEY_PLAYER 0x183 #define KEY_TEXT 0x184 #define KEY_DVD 0x185 #define KEY_AUX 0x186 #define KEY_MP3 0x187 #define KEY_AUDIO 0x188 #define KEY_VIDEO 0x189 #define KEY_DIRECTORY 0x18a #define KEY_LIST 0x18b #define KEY_MEMO 0x18c #define KEY_CALENDAR 0x18d #define KEY_RED 0x18e #define KEY_GREEN 0x18f #define KEY_YELLOW 0x190 #define KEY_BLUE 0x191 #define KEY_CHANNELUP 0x192 #define KEY_CHANNELDOWN 0x193 #define KEY_FIRST 0x194 #define KEY_LAST 0x195 #define KEY_AB 0x196 #define KEY_NEXT 0x197 #define KEY_RESTART 0x198 #define KEY_SLOW 0x199 #define KEY_SHUFFLE 0x19a #define KEY_BREAK 0x19b #define KEY_PREVIOUS 0x19c #define KEY_DIGITS 0x19d #define KEY_TEEN 0x19e #define KEY_TWEN 0x19f #define KEY_VIDEOPHONE 0x1a0 #define KEY_GAMES 0x1a1 #define KEY_ZOOMIN 0x1a2 #define KEY_ZOOMOUT 0x1a3 #define KEY_ZOOMRESET 0x1a4 #define KEY_WORDPROCESSOR 0x1a5 #define KEY_EDITOR 0x1a6 #define KEY_SPREADSHEET 0x1a7 #define KEY_GRAPHICSEDITOR 0x1a8 #define KEY_PRESENTATION 0x1a9 #define KEY_DATABASE 0x1aa #define KEY_NEWS 0x1ab #define KEY_VOICEMAIL 0x1ac #define KEY_ADDRESSBOOK 0x1ad #define KEY_MESSENGER 0x1ae #define KEY_DISPLAYTOGGLE 0x1af #define KEY_SPELLCHECK 0x1b0 #define KEY_LOGOFF 0x1b1 #define KEY_DOLLAR 0x1b2 #define KEY_EURO 0x1b3 #define KEY_FRAMEBACK 0x1b4 #define KEY_FRAMEFORWARD 0x1b5 #define KEY_CONTEXT_MENU 0x1b6 #define KEY_MEDIA_REPEAT 0x1b7 #define KEY_10CHANNELSUP 0x1b8 #define KEY_10CHANNELSDOWN 0x1b9 #define KEY_IMAGES 0x1ba #define KEY_DEL_EOL 0x1c0 #define KEY_DEL_EOS 0x1c1 #define KEY_INS_LINE 0x1c2 #define KEY_DEL_LINE 0x1c3 #define KEY_FN 0x1d0 #define KEY_FN_ESC 0x1d1 #define KEY_FN_F1 0x1d2 #define KEY_FN_F2 0x1d3 #define KEY_FN_F3 0x1d4 #define KEY_FN_F4 0x1d5 #define KEY_FN_F5 0x1d6 #define KEY_FN_F6 0x1d7 #define KEY_FN_F7 0x1d8 #define KEY_FN_F8 0x1d9 #define KEY_FN_F9 0x1da #define KEY_FN_F10 0x1db #define KEY_FN_F11 0x1dc #define KEY_FN_F12 0x1dd #define KEY_FN_1 0x1de #define KEY_FN_2 0x1df #define KEY_FN_D 0x1e0 #define KEY_FN_E 0x1e1 #define KEY_FN_F 0x1e2 #define KEY_FN_S 0x1e3 #define KEY_FN_B 0x1e4 #define KEY_BRL_DOT1 0x1f1 #define KEY_BRL_DOT2 0x1f2 #define KEY_BRL_DOT3 0x1f3 #define KEY_BRL_DOT4 0x1f4 #define KEY_BRL_DOT5 0x1f5 #define KEY_BRL_DOT6 0x1f6 #define KEY_BRL_DOT7 0x1f7 #define KEY_BRL_DOT8 0x1f8 #define KEY_BRL_DOT9 0x1f9 #define KEY_BRL_DOT10 0x1fa #define KEY_NUMERIC_0 0x200 #define KEY_NUMERIC_1 0x201 #define KEY_NUMERIC_2 0x202 #define KEY_NUMERIC_3 0x203 #define KEY_NUMERIC_4 0x204 #define KEY_NUMERIC_5 0x205 #define KEY_NUMERIC_6 0x206 #define KEY_NUMERIC_7 0x207 #define KEY_NUMERIC_8 0x208 #define KEY_NUMERIC_9 0x209 #define KEY_NUMERIC_STAR 0x20a #define KEY_NUMERIC_POUND 0x20b #define KEY_CAMERA_FOCUS 0x210 #define KEY_WPS_BUTTON 0x211 #define KEY_TOUCHPAD_TOGGLE 0x212 #define KEY_TOUCHPAD_ON 0x213 #define KEY_TOUCHPAD_OFF 0x214 #define KEY_CAMERA_ZOOMIN 0x215 #define KEY_CAMERA_ZOOMOUT 0x216 #define KEY_CAMERA_UP 0x217 #define KEY_CAMERA_DOWN 0x218 #define KEY_CAMERA_LEFT 0x219 #define KEY_CAMERA_RIGHT 0x21a #define BTN_TRIGGER_HAPPY 0x2c0 #define BTN_TRIGGER_HAPPY1 0x2c0 #define BTN_TRIGGER_HAPPY2 0x2c1 #define BTN_TRIGGER_HAPPY3 0x2c2 #define BTN_TRIGGER_HAPPY4 0x2c3 #define BTN_TRIGGER_HAPPY5 0x2c4 #define BTN_TRIGGER_HAPPY6 0x2c5 #define BTN_TRIGGER_HAPPY7 0x2c6 #define BTN_TRIGGER_HAPPY8 0x2c7 #define BTN_TRIGGER_HAPPY9 0x2c8 #define BTN_TRIGGER_HAPPY10 0x2c9 #define BTN_TRIGGER_HAPPY11 0x2ca #define BTN_TRIGGER_HAPPY12 0x2cb #define BTN_TRIGGER_HAPPY13 0x2cc #define BTN_TRIGGER_HAPPY14 0x2cd #define BTN_TRIGGER_HAPPY15 0x2ce #define BTN_TRIGGER_HAPPY16 0x2cf #define BTN_TRIGGER_HAPPY17 0x2d0 #define BTN_TRIGGER_HAPPY18 0x2d1 #define BTN_TRIGGER_HAPPY19 0x2d2 #define BTN_TRIGGER_HAPPY20 0x2d3 #define BTN_TRIGGER_HAPPY21 0x2d4 #define BTN_TRIGGER_HAPPY22 0x2d5 #define BTN_TRIGGER_HAPPY23 0x2d6 #define BTN_TRIGGER_HAPPY24 0x2d7 #define BTN_TRIGGER_HAPPY25 0x2d8 #define BTN_TRIGGER_HAPPY26 0x2d9 #define BTN_TRIGGER_HAPPY27 0x2da #define BTN_TRIGGER_HAPPY28 0x2db #define BTN_TRIGGER_HAPPY29 0x2dc #define BTN_TRIGGER_HAPPY30 0x2dd #define BTN_TRIGGER_HAPPY31 0x2de #define BTN_TRIGGER_HAPPY32 0x2df #define BTN_TRIGGER_HAPPY33 0x2e0 #define BTN_TRIGGER_HAPPY34 0x2e1 #define BTN_TRIGGER_HAPPY35 0x2e2 #define BTN_TRIGGER_HAPPY36 0x2e3 #define BTN_TRIGGER_HAPPY37 0x2e4 #define BTN_TRIGGER_HAPPY38 0x2e5 #define BTN_TRIGGER_HAPPY39 0x2e6 #define BTN_TRIGGER_HAPPY40 0x2e7 #define KEY_MIN_INTERESTING KEY_MUTE #define KEY_MAX 0x2ff #define KEY_CNT (KEY_MAX+1) #define REL_X 0x00 #define REL_Y 0x01 #define REL_Z 0x02 #define REL_RX 0x03 #define REL_RY 0x04 #define REL_RZ 0x05 #define REL_HWHEEL 0x06 #define REL_DIAL 0x07 #define REL_WHEEL 0x08 #define REL_MISC 0x09 #define REL_MAX 0x0f #define REL_CNT (REL_MAX+1) #define ABS_X 0x00 #define ABS_Y 0x01 #define ABS_Z 0x02 #define ABS_RX 0x03 #define ABS_RY 0x04 #define ABS_RZ 0x05 #define ABS_THROTTLE 0x06 #define ABS_RUDDER 0x07 #define ABS_WHEEL 0x08 #define ABS_GAS 0x09 #define ABS_BRAKE 0x0a #define ABS_HAT0X 0x10 #define ABS_HAT0Y 0x11 #define ABS_HAT1X 0x12 #define ABS_HAT1Y 0x13 #define ABS_HAT2X 0x14 #define ABS_HAT2Y 0x15 #define ABS_HAT3X 0x16 #define ABS_HAT3Y 0x17 #define ABS_PRESSURE 0x18 #define ABS_DISTANCE 0x19 #define ABS_TILT_X 0x1a #define ABS_TILT_Y 0x1b #define ABS_TOOL_WIDTH 0x1c #define ABS_VOLUME 0x20 #define ABS_MISC 0x28 #define ABS_MT_SLOT 0x2f #define ABS_MT_TOUCH_MAJOR 0x30 #define ABS_MT_TOUCH_MINOR 0x31 #define ABS_MT_WIDTH_MAJOR 0x32 #define ABS_MT_WIDTH_MINOR 0x33 #define ABS_MT_ORIENTATION 0x34 #define ABS_MT_POSITION_X 0x35 #define ABS_MT_POSITION_Y 0x36 #define ABS_MT_TOOL_TYPE 0x37 #define ABS_MT_BLOB_ID 0x38 #define ABS_MT_TRACKING_ID 0x39 #define ABS_MT_PRESSURE 0x3a #define ABS_MT_DISTANCE 0x3b #define ABS_MAX 0x3f #define ABS_CNT (ABS_MAX+1) #define SW_LID 0x00 #define SW_TABLET_MODE 0x01 #define SW_HEADPHONE_INSERT 0x02 #define SW_RFKILL_ALL 0x03 #define SW_RADIO SW_RFKILL_ALL #define SW_MICROPHONE_INSERT 0x04 #define SW_DOCK 0x05 #define SW_LINEOUT_INSERT 0x06 #define SW_JACK_PHYSICAL_INSERT 0x07 #define SW_VIDEOOUT_INSERT 0x08 #define SW_CAMERA_LENS_COVER 0x09 #define SW_KEYPAD_SLIDE 0x0a #define SW_FRONT_PROXIMITY 0x0b #define SW_ROTATE_LOCK 0x0c #define SW_MAX 0x0f #define SW_CNT (SW_MAX+1) #define MSC_SERIAL 0x00 #define MSC_PULSELED 0x01 #define MSC_GESTURE 0x02 #define MSC_RAW 0x03 #define MSC_SCAN 0x04 #define MSC_MAX 0x07 #define MSC_CNT (MSC_MAX+1) #define LED_NUML 0x00 #define LED_CAPSL 0x01 #define LED_SCROLLL 0x02 #define LED_COMPOSE 0x03 #define LED_KANA 0x04 #define LED_SLEEP 0x05 #define LED_SUSPEND 0x06 #define LED_MUTE 0x07 #define LED_MISC 0x08 #define LED_MAIL 0x09 #define LED_CHARGING 0x0a #define LED_MAX 0x0f #define LED_CNT (LED_MAX+1) #define REP_DELAY 0x00 #define REP_PERIOD 0x01 #define REP_MAX 0x01 #define REP_CNT (REP_MAX+1) #define SND_CLICK 0x00 #define SND_BELL 0x01 #define SND_TONE 0x02 #define SND_MAX 0x07 #define SND_CNT (SND_MAX+1) #define ID_BUS 0 #define ID_VENDOR 1 #define ID_PRODUCT 2 #define ID_VERSION 3 #define BUS_PCI 0x01 #define BUS_ISAPNP 0x02 #define BUS_USB 0x03 #define BUS_HIL 0x04 #define BUS_BLUETOOTH 0x05 #define BUS_VIRTUAL 0x06 #define BUS_ISA 0x10 #define BUS_I8042 0x11 #define BUS_XTKBD 0x12 #define BUS_RS232 0x13 #define BUS_GAMEPORT 0x14 #define BUS_PARPORT 0x15 #define BUS_AMIGA 0x16 #define BUS_ADB 0x17 #define BUS_I2C 0x18 #define BUS_HOST 0x19 #define BUS_GSC 0x1A #define BUS_ATARI 0x1B #define BUS_SPI 0x1C #define MT_TOOL_FINGER 0 #define MT_TOOL_PEN 1 #define MT_TOOL_MAX 1 #define FF_STATUS_STOPPED 0x00 #define FF_STATUS_PLAYING 0x01 #define FF_STATUS_MAX 0x01 struct ff_replay { __u16 length; __u16 delay; }; struct ff_trigger { __u16 button; __u16 interval; }; struct ff_envelope { __u16 attack_length; __u16 attack_level; __u16 fade_length; __u16 fade_level; }; struct ff_constant_effect { __s16 level; struct ff_envelope envelope; }; struct ff_ramp_effect { __s16 start_level; __s16 end_level; struct ff_envelope envelope; }; struct ff_condition_effect { __u16 right_saturation; __u16 left_saturation; __s16 right_coeff; __s16 left_coeff; __u16 deadband; __s16 center; }; struct ff_periodic_effect { __u16 waveform; __u16 period; __s16 magnitude; __s16 offset; __u16 phase; struct ff_envelope envelope; __u32 custom_len; __s16 *custom_data; }; struct ff_rumble_effect { __u16 strong_magnitude; __u16 weak_magnitude; }; struct ff_effect { __u16 type; __s16 id; __u16 direction; struct ff_trigger trigger; struct ff_replay replay; union { struct ff_constant_effect constant; struct ff_ramp_effect ramp; struct ff_periodic_effect periodic; struct ff_condition_effect condition[2]; struct ff_rumble_effect rumble; } u; }; #define FF_RUMBLE 0x50 #define FF_PERIODIC 0x51 #define FF_CONSTANT 0x52 #define FF_SPRING 0x53 #define FF_FRICTION 0x54 #define FF_DAMPER 0x55 #define FF_INERTIA 0x56 #define FF_RAMP 0x57 #define FF_EFFECT_MIN FF_RUMBLE #define FF_EFFECT_MAX FF_RAMP #define FF_SQUARE 0x58 #define FF_TRIANGLE 0x59 #define FF_SINE 0x5a #define FF_SAW_UP 0x5b #define FF_SAW_DOWN 0x5c #define FF_CUSTOM 0x5d #define FF_WAVEFORM_MIN FF_SQUARE #define FF_WAVEFORM_MAX FF_CUSTOM #define FF_GAIN 0x60 #define FF_AUTOCENTER 0x61 #define FF_MAX 0x7f #define FF_CNT (FF_MAX+1) #endif android-audiosystem-1.8+13.10.20130807/include/linux/shm.h0000644000015700001700000000336312200324306023421 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SHM_H_ #define _LINUX_SHM_H_ #include #include #include #define SHMMAX 0x2000000 #define SHMMIN 1 #define SHMMNI 4096 #define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) #define SHMSEG SHMMNI #include struct shmid_ds { struct ipc_perm shm_perm; int shm_segsz; __kernel_time_t shm_atime; __kernel_time_t shm_dtime; __kernel_time_t shm_ctime; __kernel_ipc_pid_t shm_cpid; __kernel_ipc_pid_t shm_lpid; unsigned short shm_nattch; unsigned short shm_unused; void *shm_unused2; void *shm_unused3; }; #include #define SHM_R 0400 #define SHM_W 0200 #define SHM_RDONLY 010000 #define SHM_RND 020000 #define SHM_REMAP 040000 #define SHM_EXEC 0100000 #define SHM_LOCK 11 #define SHM_UNLOCK 12 #define SHM_STAT 13 #define SHM_INFO 14 struct shminfo { int shmmax; int shmmin; int shmmni; int shmseg; int shmall; }; struct shm_info { int used_ids; unsigned long shm_tot; unsigned long shm_rss; unsigned long shm_swp; unsigned long swap_attempts; unsigned long swap_successes; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/binfmts.h0000644000015700001700000000147412200324306024275 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_BINFMTS_H #define _LINUX_BINFMTS_H #include struct pt_regs; #define MAX_ARG_PAGES 32 #define BINPRM_BUF_SIZE 128 #endif android-audiosystem-1.8+13.10.20130807/include/linux/tegra_audio.h0000644000015700001700000000337512200324306025120 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _TEGRA_AUDIO_H #define _TEGRA_AUDIO_H #include #define TEGRA_AUDIO_MAGIC 't' #define TEGRA_AUDIO_IN_START _IO(TEGRA_AUDIO_MAGIC, 0) #define TEGRA_AUDIO_IN_STOP _IO(TEGRA_AUDIO_MAGIC, 1) struct tegra_audio_in_config { int rate; int stereo; }; #define TEGRA_AUDIO_IN_SET_CONFIG _IOW(TEGRA_AUDIO_MAGIC, 2, const struct tegra_audio_in_config *) #define TEGRA_AUDIO_IN_GET_CONFIG _IOR(TEGRA_AUDIO_MAGIC, 3, struct tegra_audio_in_config *) #define TEGRA_AUDIO_IN_SET_NUM_BUFS _IOW(TEGRA_AUDIO_MAGIC, 4, const unsigned int *) #define TEGRA_AUDIO_IN_GET_NUM_BUFS _IOW(TEGRA_AUDIO_MAGIC, 5, unsigned int *) #define TEGRA_AUDIO_OUT_SET_NUM_BUFS _IOW(TEGRA_AUDIO_MAGIC, 6, const unsigned int *) #define TEGRA_AUDIO_OUT_GET_NUM_BUFS _IOW(TEGRA_AUDIO_MAGIC, 7, unsigned int *) #define TEGRA_AUDIO_OUT_FLUSH _IO(TEGRA_AUDIO_MAGIC, 10) #define TEGRA_AUDIO_BIT_FORMAT_DEFAULT 0 #define TEGRA_AUDIO_BIT_FORMAT_DSP 1 #define TEGRA_AUDIO_SET_BIT_FORMAT _IOW(TEGRA_AUDIO_MAGIC, 11, const unsigned int *) #define TEGRA_AUDIO_GET_BIT_FORMAT _IOR(TEGRA_AUDIO_MAGIC, 12, unsigned int *) #endif android-audiosystem-1.8+13.10.20130807/include/linux/in_route.h0000644000015700001700000000254212200324306024454 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IN_ROUTE_H #define _LINUX_IN_ROUTE_H #define RTCF_DEAD RTNH_F_DEAD #define RTCF_ONLINK RTNH_F_ONLINK #define RTCF_NOPMTUDISC RTM_F_NOPMTUDISC #define RTCF_NOTIFY 0x00010000 #define RTCF_DIRECTDST 0x00020000 #define RTCF_REDIRECTED 0x00040000 #define RTCF_TPROXY 0x00080000 #define RTCF_FAST 0x00200000 #define RTCF_MASQ 0x00400000 #define RTCF_SNAT 0x00800000 #define RTCF_DOREDIRECT 0x01000000 #define RTCF_DIRECTSRC 0x04000000 #define RTCF_DNAT 0x08000000 #define RTCF_BROADCAST 0x10000000 #define RTCF_MULTICAST 0x20000000 #define RTCF_REJECT 0x40000000 #define RTCF_LOCAL 0x80000000 #define RTCF_NAT (RTCF_DNAT|RTCF_SNAT) #define RT_TOS(tos) ((tos)&IPTOS_TOS_MASK) #endif android-audiosystem-1.8+13.10.20130807/include/linux/udp.h0000644000015700001700000000164612200324306023424 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_UDP_H #define _LINUX_UDP_H #include struct udphdr { __u16 source; __u16 dest; __u16 len; __u16 check; }; #define UDP_CORK 1 #define UDP_ENCAP 100 #define UDP_ENCAP_ESPINUDP_NON_IKE 1 #define UDP_ENCAP_ESPINUDP 2 #endif android-audiosystem-1.8+13.10.20130807/include/linux/tegra_rpc.h0000644000015700001700000000255712200324306024604 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_TEGRA_RPC_H #define __LINUX_TEGRA_RPC_H #define TEGRA_RPC_MAX_MSG_LEN 256 #define TEGRA_RPC_MAX_NAME_LEN 17 struct tegra_rpc_port_desc { char name[TEGRA_RPC_MAX_NAME_LEN]; int notify_fd; }; #define TEGRA_RPC_IOCTL_MAGIC 'r' #define TEGRA_RPC_IOCTL_PORT_CREATE _IOW(TEGRA_RPC_IOCTL_MAGIC, 0x20, struct tegra_rpc_port_desc) #define TEGRA_RPC_IOCTL_PORT_GET_NAME _IOR(TEGRA_RPC_IOCTL_MAGIC, 0x21, char *) #define TEGRA_RPC_IOCTL_PORT_CONNECT _IOR(TEGRA_RPC_IOCTL_MAGIC, 0x22, long) #define TEGRA_RPC_IOCTL_PORT_LISTEN _IOR(TEGRA_RPC_IOCTL_MAGIC, 0x23, long) #define TEGRA_RPC_IOCTL_MIN_NR _IOC_NR(TEGRA_RPC_IOCTL_PORT_CREATE) #define TEGRA_RPC_IOCTL_MAX_NR _IOC_NR(TEGRA_RPC_IOCTL_PORT_LISTEN) #endif android-audiosystem-1.8+13.10.20130807/include/linux/compiler.h0000644000015700001700000000220412200324306024435 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_COMPILER_H #define __LINUX_COMPILER_H #ifndef __ASSEMBLY__ #define __user #define __kernel #define __safe #define __force #define __nocast #define __iomem #define __chk_user_ptr(x) (void)0 #define __chk_io_ptr(x) (void)0 #define __builtin_warning(x, y...) (1) #define __acquires(x) #define __releases(x) #define __acquire(x) (void)0 #define __release(x) (void)0 #define __cond_lock(x) (x) #endif #ifndef __attribute_const__ #define __attribute_const__ #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/ppp_defs.h0000644000015700001700000000512512200324306024430 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _PPP_DEFS_H_ #define _PPP_DEFS_H_ #define PPP_HDRLEN 4 #define PPP_FCSLEN 2 #define PPP_MRU 1500 #define PPP_ADDRESS(p) (((__u8 *)(p))[0]) #define PPP_CONTROL(p) (((__u8 *)(p))[1]) #define PPP_PROTOCOL(p) ((((__u8 *)(p))[2] << 8) + ((__u8 *)(p))[3]) #define PPP_ALLSTATIONS 0xff #define PPP_UI 0x03 #define PPP_FLAG 0x7e #define PPP_ESCAPE 0x7d #define PPP_TRANS 0x20 #define PPP_IP 0x21 #define PPP_AT 0x29 #define PPP_IPX 0x2b #define PPP_VJC_COMP 0x2d #define PPP_VJC_UNCOMP 0x2f #define PPP_MP 0x3d #define PPP_IPV6 0x57 #define PPP_COMPFRAG 0xfb #define PPP_COMP 0xfd #define PPP_MPLS_UC 0x0281 #define PPP_MPLS_MC 0x0283 #define PPP_IPCP 0x8021 #define PPP_ATCP 0x8029 #define PPP_IPXCP 0x802b #define PPP_IPV6CP 0x8057 #define PPP_CCPFRAG 0x80fb #define PPP_CCP 0x80fd #define PPP_MPLSCP 0x80fd #define PPP_LCP 0xc021 #define PPP_PAP 0xc023 #define PPP_LQR 0xc025 #define PPP_CHAP 0xc223 #define PPP_CBCP 0xc029 #define PPP_INITFCS 0xffff #define PPP_GOODFCS 0xf0b8 typedef __u32 ext_accm[8]; enum NPmode { NPMODE_PASS, NPMODE_DROP, NPMODE_ERROR, NPMODE_QUEUE }; struct pppstat { __u32 ppp_discards; __u32 ppp_ibytes; __u32 ppp_ioctects; __u32 ppp_ipackets; __u32 ppp_ierrors; __u32 ppp_ilqrs; __u32 ppp_obytes; __u32 ppp_ooctects; __u32 ppp_opackets; __u32 ppp_oerrors; __u32 ppp_olqrs; }; struct vjstat { __u32 vjs_packets; __u32 vjs_compressed; __u32 vjs_searches; __u32 vjs_misses; __u32 vjs_uncompressedin; __u32 vjs_compressedin; __u32 vjs_errorin; __u32 vjs_tossed; }; struct compstat { __u32 unc_bytes; __u32 unc_packets; __u32 comp_bytes; __u32 comp_packets; __u32 inc_bytes; __u32 inc_packets; __u32 in_count; __u32 bytes_out; double ratio; }; struct ppp_stats { struct pppstat p; struct vjstat vj; }; struct ppp_comp_stats { struct compstat c; struct compstat d; }; struct ppp_idle { time_t xmit_idle; time_t recv_idle; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/vt.h0000644000015700001700000000333212200324306023257 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_VT_H #define _LINUX_VT_H #define MIN_NR_CONSOLES 1 #define MAX_NR_CONSOLES 63 #define MAX_NR_USER_CONSOLES 63 #define VT_OPENQRY 0x5600 struct vt_mode { char mode; char waitv; short relsig; short acqsig; short frsig; }; #define VT_GETMODE 0x5601 #define VT_SETMODE 0x5602 #define VT_AUTO 0x00 #define VT_PROCESS 0x01 #define VT_ACKACQ 0x02 struct vt_stat { unsigned short v_active; unsigned short v_signal; unsigned short v_state; }; #define VT_GETSTATE 0x5603 #define VT_SENDSIG 0x5604 #define VT_RELDISP 0x5605 #define VT_ACTIVATE 0x5606 #define VT_WAITACTIVE 0x5607 #define VT_DISALLOCATE 0x5608 struct vt_sizes { unsigned short v_rows; unsigned short v_cols; unsigned short v_scrollsize; }; #define VT_RESIZE 0x5609 struct vt_consize { unsigned short v_rows; unsigned short v_cols; unsigned short v_vlin; unsigned short v_clin; unsigned short v_vcol; unsigned short v_ccol; }; #define VT_RESIZEX 0x560A #define VT_LOCKSWITCH 0x560B #define VT_UNLOCKSWITCH 0x560C #define VT_GETHIFONTMASK 0x560D #endif android-audiosystem-1.8+13.10.20130807/include/linux/debug_locks.h0000644000015700001700000000216312200324306025110 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_DEBUG_LOCKING_H #define __LINUX_DEBUG_LOCKING_H struct task_struct; #define _RET_IP_ (unsigned long)__builtin_return_address(0) #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) #define DEBUG_LOCKS_WARN_ON(c) ({ int __ret = 0; if (unlikely(c)) { if (debug_locks_off()) WARN_ON(1); __ret = 1; } __ret; }) #define SMP_DEBUG_LOCKS_WARN_ON(c) do { } while (0) #define locking_selftest() do { } while (0) #endif android-audiosystem-1.8+13.10.20130807/include/linux/capi.h0000644000015700001700000000457612200324306023555 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_CAPI_H__ #define __LINUX_CAPI_H__ #include #include #include typedef struct capi_register_params { __u32 level3cnt; __u32 datablkcnt; __u32 datablklen; } capi_register_params; #define CAPI_REGISTER _IOW('C',0x01,struct capi_register_params) #define CAPI_MANUFACTURER_LEN 64 #define CAPI_GET_MANUFACTURER _IOWR('C',0x06,int) typedef struct capi_version { __u32 majorversion; __u32 minorversion; __u32 majormanuversion; __u32 minormanuversion; } capi_version; #define CAPI_GET_VERSION _IOWR('C',0x07,struct capi_version) #define CAPI_SERIAL_LEN 8 #define CAPI_GET_SERIAL _IOWR('C',0x08,int) typedef struct capi_profile { __u16 ncontroller; __u16 nbchannel; __u32 goptions; __u32 support1; __u32 support2; __u32 support3; __u32 reserved[6]; __u32 manu[5]; } capi_profile; #define CAPI_GET_PROFILE _IOWR('C',0x09,struct capi_profile) typedef struct capi_manufacturer_cmd { unsigned long cmd; void __user *data; } capi_manufacturer_cmd; #define CAPI_MANUFACTURER_CMD _IOWR('C',0x20, struct capi_manufacturer_cmd) #define CAPI_GET_ERRCODE _IOR('C',0x21, __u16) #define CAPI_INSTALLED _IOR('C',0x22, __u16) typedef union capi_ioctl_struct { __u32 contr; capi_register_params rparams; __u8 manufacturer[CAPI_MANUFACTURER_LEN]; capi_version version; __u8 serial[CAPI_SERIAL_LEN]; capi_profile profile; capi_manufacturer_cmd cmd; __u16 errcode; } capi_ioctl_struct; #define CAPIFLAG_HIGHJACKING 0x0001 #define CAPI_GET_FLAGS _IOR('C',0x23, unsigned) #define CAPI_SET_FLAGS _IOR('C',0x24, unsigned) #define CAPI_CLR_FLAGS _IOR('C',0x25, unsigned) #define CAPI_NCCI_OPENCOUNT _IOR('C',0x26, unsigned) #define CAPI_NCCI_GETUNIT _IOR('C',0x27, unsigned) #endif android-audiosystem-1.8+13.10.20130807/include/linux/kdev_t.h0000644000015700001700000000147112200324306024104 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_KDEV_T_H #define _LINUX_KDEV_T_H #define MAJOR(dev) ((dev)>>8) #define MINOR(dev) ((dev) & 0xff) #define MKDEV(ma,mi) ((ma)<<8 | (mi)) #endif android-audiosystem-1.8+13.10.20130807/include/linux/file.h0000644000015700001700000000334212200324306023546 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_FILE_H #define __LINUX_FILE_H #include #include #include #include #include #include #define NR_OPEN_DEFAULT BITS_PER_LONG struct embedded_fd_set { unsigned long fds_bits[1]; }; #define EMBEDDED_FD_SET_SIZE (BITS_PER_BYTE * sizeof(struct embedded_fd_set)) struct fdtable { unsigned int max_fds; int max_fdset; struct file ** fd; fd_set *close_on_exec; fd_set *open_fds; struct rcu_head rcu; struct files_struct *free_files; struct fdtable *next; }; struct files_struct { atomic_t count; struct fdtable *fdt; struct fdtable fdtab; spinlock_t file_lock ____cacheline_aligned_in_smp; int next_fd; struct embedded_fd_set close_on_exec_init; struct embedded_fd_set open_fds_init; struct file * fd_array[NR_OPEN_DEFAULT]; }; #define files_fdtable(files) (rcu_dereference((files)->fdt)) struct kmem_cache; #define fcheck(fd) fcheck_files(current->files, fd) struct task_struct; struct files_struct *get_files_struct(struct task_struct *); #endif android-audiosystem-1.8+13.10.20130807/include/linux/spinlock_up.h0000644000015700001700000000235312200324306025156 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_SPINLOCK_UP_H #define __LINUX_SPINLOCK_UP_H #ifndef __LINUX_SPINLOCK_H #error "please don't include this file directly" #endif #define __raw_spin_is_locked(lock) ((void)(lock), 0) #define __raw_spin_lock(lock) do { (void)(lock); } while (0) #define __raw_spin_unlock(lock) do { (void)(lock); } while (0) #define __raw_spin_trylock(lock) ({ (void)(lock); 1; }) #define __raw_read_can_lock(lock) (((void)(lock), 1)) #define __raw_write_can_lock(lock) (((void)(lock), 1)) #define __raw_spin_unlock_wait(lock) do { cpu_relax(); } while (__raw_spin_is_locked(lock)) #endif android-audiosystem-1.8+13.10.20130807/include/linux/threads.h0000644000015700001700000000170212200324306024257 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_THREADS_H #define _LINUX_THREADS_H #define NR_CPUS 1 #define MIN_THREADS_LEFT_FOR_ROOT 4 #define PID_MAX_DEFAULT (CONFIG_BASE_SMALL ? 0x1000 : 0x8000) #define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT)) #endif android-audiosystem-1.8+13.10.20130807/include/linux/a1026.h0000644000015700001700000000415212200324306023360 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_A1026_H #define __LINUX_A1026_H #include #define A1026_MAX_FW_SIZE (32*1024) struct a1026img { unsigned char *buf; unsigned img_size; }; enum A1026_PathID { A1026_PATH_SUSPEND, A1026_PATH_INCALL_RECEIVER, A1026_PATH_INCALL_HEADSET, A1026_PATH_INCALL_SPEAKER, A1026_PATH_INCALL_BT, A1026_PATH_VR_NO_NS_RECEIVER, A1026_PATH_VR_NO_NS_HEADSET, A1026_PATH_VR_NO_NS_SPEAKER, A1026_PATH_VR_NO_NS_BT, A1026_PATH_VR_NS_RECEIVER, A1026_PATH_VR_NS_HEADSET, A1026_PATH_VR_NS_SPEAKER, A1026_PATH_VR_NS_BT, A1026_PATH_RECORD_RECEIVER, A1026_PATH_RECORD_HEADSET, A1026_PATH_RECORD_SPEAKER, A1026_PATH_RECORD_BT, A1026_PATH_CAMCORDER, A1026_PATH_INCALL_TTY }; enum A1026_NS_states { A1026_NS_STATE_AUTO, A1026_NS_STATE_OFF, A1026_NS_STATE_CT, A1026_NS_STATE_FT, A1026_NS_NUM_STATES }; #define A1026_IOCTL_MAGIC 'u' #define A1026_BOOTUP_INIT _IOW(A1026_IOCTL_MAGIC, 0x01, struct a1026img *) #define A1026_SET_CONFIG _IOW(A1026_IOCTL_MAGIC, 0x02, enum A1026_PathID) #define A1026_SET_NS_STATE _IOW(A1026_IOCTL_MAGIC, 0x03, enum A1026_NS_states) #define A1026_SET_MIC_ONOFF _IOW(A1026_IOCTL_MAGIC, 0x50, unsigned) #define A1026_SET_MICSEL_ONOFF _IOW(A1026_IOCTL_MAGIC, 0x51, unsigned) #define A1026_READ_DATA _IOR(A1026_IOCTL_MAGIC, 0x52, unsigned) #define A1026_WRITE_MSG _IOW(A1026_IOCTL_MAGIC, 0x53, unsigned) #define A1026_SYNC_CMD _IO(A1026_IOCTL_MAGIC, 0x54) #define A1026_SET_CMD_FILE _IOW(A1026_IOCTL_MAGIC, 0x55, unsigned) #endif android-audiosystem-1.8+13.10.20130807/include/linux/percpu.h0000644000015700001700000000221612200324306024124 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_PERCPU_H #define __LINUX_PERCPU_H #include #include #include #include #include #ifndef PERCPU_ENOUGH_ROOM #define PERCPU_ENOUGH_ROOM 32768 #endif #define get_cpu_var(var) (*({ preempt_disable(); &__get_cpu_var(var); })) #define put_cpu_var(var) preempt_enable() #define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) #define alloc_percpu(type) ((type *)(__alloc_percpu(sizeof(type)))) #endif android-audiosystem-1.8+13.10.20130807/include/linux/if_bridge.h0000644000015700001700000000510212200324306024535 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IF_BRIDGE_H #define _LINUX_IF_BRIDGE_H #include #define SYSFS_BRIDGE_ATTR "bridge" #define SYSFS_BRIDGE_FDB "brforward" #define SYSFS_BRIDGE_PORT_SUBDIR "brif" #define SYSFS_BRIDGE_PORT_ATTR "brport" #define SYSFS_BRIDGE_PORT_LINK "bridge" #define BRCTL_VERSION 1 #define BRCTL_GET_VERSION 0 #define BRCTL_GET_BRIDGES 1 #define BRCTL_ADD_BRIDGE 2 #define BRCTL_DEL_BRIDGE 3 #define BRCTL_ADD_IF 4 #define BRCTL_DEL_IF 5 #define BRCTL_GET_BRIDGE_INFO 6 #define BRCTL_GET_PORT_LIST 7 #define BRCTL_SET_BRIDGE_FORWARD_DELAY 8 #define BRCTL_SET_BRIDGE_HELLO_TIME 9 #define BRCTL_SET_BRIDGE_MAX_AGE 10 #define BRCTL_SET_AGEING_TIME 11 #define BRCTL_SET_GC_INTERVAL 12 #define BRCTL_GET_PORT_INFO 13 #define BRCTL_SET_BRIDGE_STP_STATE 14 #define BRCTL_SET_BRIDGE_PRIORITY 15 #define BRCTL_SET_PORT_PRIORITY 16 #define BRCTL_SET_PATH_COST 17 #define BRCTL_GET_FDB_ENTRIES 18 #define BR_STATE_DISABLED 0 #define BR_STATE_LISTENING 1 #define BR_STATE_LEARNING 2 #define BR_STATE_FORWARDING 3 #define BR_STATE_BLOCKING 4 struct __bridge_info { __u64 designated_root; __u64 bridge_id; __u32 root_path_cost; __u32 max_age; __u32 hello_time; __u32 forward_delay; __u32 bridge_max_age; __u32 bridge_hello_time; __u32 bridge_forward_delay; __u8 topology_change; __u8 topology_change_detected; __u8 root_port; __u8 stp_enabled; __u32 ageing_time; __u32 gc_interval; __u32 hello_timer_value; __u32 tcn_timer_value; __u32 topology_change_timer_value; __u32 gc_timer_value; }; struct __port_info { __u64 designated_root; __u64 designated_bridge; __u16 port_id; __u16 designated_port; __u32 path_cost; __u32 designated_cost; __u8 state; __u8 top_change_ack; __u8 config_pending; __u8 unused0; __u32 message_age_timer_value; __u32 forward_delay_timer_value; __u32 hold_timer_value; }; struct __fdb_entry { __u8 mac_addr[6]; __u8 port_no; __u8 is_local; __u32 ageing_timer_value; __u32 unused; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/sfh7743.h0000644000015700001700000000160712200324306023736 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SFH7743_H_ #define _LINUX_SFH7743_H_ #include #define SFH7743_IO 0xA2 #define SFH7743_IOCTL_GET_ENABLE _IOR(SFH7743_IO, 0x00, char) #define SFH7743_IOCTL_SET_ENABLE _IOW(SFH7743_IO, 0x01, char) #endif android-audiosystem-1.8+13.10.20130807/include/linux/if_pppopns.h0000644000015700001700000000267212200324306025011 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** *** To edit the content of this header, modify the corresponding *** source file (e.g. under external/kernel-headers/original/) then *** run bionic/libc/kernel/tools/update_all.py *** *** Any manual change here will be lost the next time this script will *** be run. You've been warned! *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_IF_PPPOPNS_H #define __LINUX_IF_PPPOPNS_H #include #include /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct sockaddr_pppopns { sa_family_t sa_family; unsigned int sa_protocol; int tcp_socket; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u16 local; __u16 remote; } __attribute__((packed)); #endif /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ android-audiosystem-1.8+13.10.20130807/include/linux/ion.h0000644000015700001700000000534712200324306023423 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** *** To edit the content of this header, modify the corresponding *** source file (e.g. under external/kernel-headers/original/) then *** run bionic/libc/kernel/tools/update_all.py *** *** Any manual change here will be lost the next time this script will *** be run. You've been warned! *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ION_H #define _LINUX_ION_H #include struct ion_handle; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ enum ion_heap_type { ION_HEAP_TYPE_SYSTEM, ION_HEAP_TYPE_SYSTEM_CONTIG, ION_HEAP_TYPE_CARVEOUT, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ ION_HEAP_TYPE_CUSTOM, ION_NUM_HEAPS, }; #define ION_HEAP_SYSTEM_MASK (1 << ION_HEAP_TYPE_SYSTEM) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ION_HEAP_SYSTEM_CONTIG_MASK (1 << ION_HEAP_TYPE_SYSTEM_CONTIG) #define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT) struct ion_allocation_data { size_t len; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ size_t align; unsigned int flags; struct ion_handle *handle; }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct ion_fd_data { struct ion_handle *handle; int fd; }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct ion_handle_data { struct ion_handle *handle; }; struct ion_custom_data { /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ unsigned int cmd; unsigned long arg; }; #define ION_IOC_MAGIC 'I' /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, struct ion_allocation_data) #define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data) #define ION_IOC_MAP _IOWR(ION_IOC_MAGIC, 2, struct ion_fd_data) #define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, int) #define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data) #endif android-audiosystem-1.8+13.10.20130807/include/linux/rcupdate.h0000644000015700001700000000133112200324306024432 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_RCUPDATE_H #define __LINUX_RCUPDATE_H #endif android-audiosystem-1.8+13.10.20130807/include/linux/elevator.h0000644000015700001700000000677112200324306024461 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ELEVATOR_H #define _LINUX_ELEVATOR_H typedef int (elevator_merge_fn) (request_queue_t *, struct request **, struct bio *); typedef void (elevator_merge_req_fn) (request_queue_t *, struct request *, struct request *); typedef void (elevator_merged_fn) (request_queue_t *, struct request *); typedef int (elevator_dispatch_fn) (request_queue_t *, int); typedef void (elevator_add_req_fn) (request_queue_t *, struct request *); typedef int (elevator_queue_empty_fn) (request_queue_t *); typedef struct request *(elevator_request_list_fn) (request_queue_t *, struct request *); typedef void (elevator_completed_req_fn) (request_queue_t *, struct request *); typedef int (elevator_may_queue_fn) (request_queue_t *, int, struct bio *); typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, struct bio *, gfp_t); typedef void (elevator_put_req_fn) (request_queue_t *, struct request *); typedef void (elevator_activate_req_fn) (request_queue_t *, struct request *); typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *); typedef void *(elevator_init_fn) (request_queue_t *, elevator_t *); typedef void (elevator_exit_fn) (elevator_t *); struct elevator_ops { elevator_merge_fn *elevator_merge_fn; elevator_merged_fn *elevator_merged_fn; elevator_merge_req_fn *elevator_merge_req_fn; elevator_dispatch_fn *elevator_dispatch_fn; elevator_add_req_fn *elevator_add_req_fn; elevator_activate_req_fn *elevator_activate_req_fn; elevator_deactivate_req_fn *elevator_deactivate_req_fn; elevator_queue_empty_fn *elevator_queue_empty_fn; elevator_completed_req_fn *elevator_completed_req_fn; elevator_request_list_fn *elevator_former_req_fn; elevator_request_list_fn *elevator_latter_req_fn; elevator_set_req_fn *elevator_set_req_fn; elevator_put_req_fn *elevator_put_req_fn; elevator_may_queue_fn *elevator_may_queue_fn; elevator_init_fn *elevator_init_fn; elevator_exit_fn *elevator_exit_fn; void (*trim)(struct io_context *); }; #define ELV_NAME_MAX (16) struct elv_fs_entry { struct attribute attr; ssize_t (*show)(elevator_t *, char *); ssize_t (*store)(elevator_t *, const char *, size_t); }; struct elevator_type { struct list_head list; struct elevator_ops ops; struct elevator_type *elevator_type; struct elv_fs_entry *elevator_attrs; char elevator_name[ELV_NAME_MAX]; struct module *elevator_owner; }; struct elevator_queue { struct elevator_ops *ops; void *elevator_data; struct kobject kobj; struct elevator_type *elevator_type; struct mutex sysfs_lock; }; #define ELEVATOR_NO_MERGE 0 #define ELEVATOR_FRONT_MERGE 1 #define ELEVATOR_BACK_MERGE 2 #define ELEVATOR_INSERT_FRONT 1 #define ELEVATOR_INSERT_BACK 2 #define ELEVATOR_INSERT_SORT 3 #define ELEVATOR_INSERT_REQUEUE 4 enum { ELV_MQUEUE_MAY, ELV_MQUEUE_NO, ELV_MQUEUE_MUST, }; #define rq_end_sector(rq) ((rq)->sector + (rq)->nr_sectors) #endif android-audiosystem-1.8+13.10.20130807/include/linux/spi/0000755000015700001700000000000012200324404023246 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/linux/spi/cpcap.h0000644000015700001700000003022012200324306024503 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SPI_CPCAP_H #define _LINUX_SPI_CPCAP_H #include #define CPCAP_DEV_NAME "cpcap" #define CPCAP_NUM_REG_CPCAP (CPCAP_REG_END - CPCAP_REG_START + 1) #define CPCAP_IRQ_INT1_INDEX 0 #define CPCAP_IRQ_INT2_INDEX 16 #define CPCAP_IRQ_INT3_INDEX 32 #define CPCAP_IRQ_INT4_INDEX 48 #define CPCAP_IRQ_INT5_INDEX 64 #define CPCAP_HWCFG_NUM 2 #define CPCAP_HWCFG0_SEC_STBY_SW1 0x0001 #define CPCAP_HWCFG0_SEC_STBY_SW2 0x0002 #define CPCAP_HWCFG0_SEC_STBY_SW3 0x0004 #define CPCAP_HWCFG0_SEC_STBY_SW4 0x0008 #define CPCAP_HWCFG0_SEC_STBY_SW5 0x0010 #define CPCAP_HWCFG0_SEC_STBY_VAUDIO 0x0020 #define CPCAP_HWCFG0_SEC_STBY_VCAM 0x0040 #define CPCAP_HWCFG0_SEC_STBY_VCSI 0x0080 #define CPCAP_HWCFG0_SEC_STBY_VDAC 0x0100 #define CPCAP_HWCFG0_SEC_STBY_VDIG 0x0200 #define CPCAP_HWCFG0_SEC_STBY_VHVIO 0x0400 #define CPCAP_HWCFG0_SEC_STBY_VPLL 0x0800 #define CPCAP_HWCFG0_SEC_STBY_VRF1 0x1000 #define CPCAP_HWCFG0_SEC_STBY_VRF2 0x2000 #define CPCAP_HWCFG0_SEC_STBY_VRFREF 0x4000 #define CPCAP_HWCFG0_SEC_STBY_VSDIO 0x8000 #define CPCAP_HWCFG1_SEC_STBY_VWLAN1 0x0001 #define CPCAP_HWCFG1_SEC_STBY_VWLAN2 0x0002 #define CPCAP_HWCFG1_SEC_STBY_VSIM 0x0004 #define CPCAP_HWCFG1_SEC_STBY_VSIMCARD 0x0008 #define CPCAP_WHISPER_MODE_PU 0x00000001 #define CPCAP_WHISPER_ENABLE_UART 0x00000002 #define CPCAP_WHISPER_ACCY_MASK 0xF8000000 #define CPCAP_WHISPER_ACCY_SHFT 27 #define CPCAP_WHISPER_ID_SIZE 16 #define CPCAP_WHISPER_PROP_SIZE 7 enum cpcap_regulator_id { CPCAP_SW2, CPCAP_SW4, CPCAP_SW5, CPCAP_VCAM, CPCAP_VCSI, CPCAP_VDAC, CPCAP_VDIG, CPCAP_VFUSE, CPCAP_VHVIO, CPCAP_VSDIO, CPCAP_VPLL, CPCAP_VRF1, CPCAP_VRF2, CPCAP_VRFREF, CPCAP_VWLAN1, CPCAP_VWLAN2, CPCAP_VSIM, CPCAP_VSIMCARD, CPCAP_VVIB, CPCAP_VUSB, CPCAP_VAUDIO, CPCAP_NUM_REGULATORS }; enum cpcap_reg { CPCAP_REG_START, CPCAP_REG_INT1 = CPCAP_REG_START, CPCAP_REG_INT2, CPCAP_REG_INT3, CPCAP_REG_INT4, CPCAP_REG_INTM1, CPCAP_REG_INTM2, CPCAP_REG_INTM3, CPCAP_REG_INTM4, CPCAP_REG_INTS1, CPCAP_REG_INTS2, CPCAP_REG_INTS3, CPCAP_REG_INTS4, CPCAP_REG_ASSIGN1, CPCAP_REG_ASSIGN2, CPCAP_REG_ASSIGN3, CPCAP_REG_ASSIGN4, CPCAP_REG_ASSIGN5, CPCAP_REG_ASSIGN6, CPCAP_REG_VERSC1, CPCAP_REG_VERSC2, CPCAP_REG_MI1, CPCAP_REG_MIM1, CPCAP_REG_MI2, CPCAP_REG_MIM2, CPCAP_REG_UCC1, CPCAP_REG_UCC2, CPCAP_REG_PC1, CPCAP_REG_PC2, CPCAP_REG_BPEOL, CPCAP_REG_PGC, CPCAP_REG_MT1, CPCAP_REG_MT2, CPCAP_REG_MT3, CPCAP_REG_PF, CPCAP_REG_SCC, CPCAP_REG_SW1, CPCAP_REG_SW2, CPCAP_REG_UCTM, CPCAP_REG_TOD1, CPCAP_REG_TOD2, CPCAP_REG_TODA1, CPCAP_REG_TODA2, CPCAP_REG_DAY, CPCAP_REG_DAYA, CPCAP_REG_VAL1, CPCAP_REG_VAL2, CPCAP_REG_SDVSPLL, CPCAP_REG_SI2CC1, CPCAP_REG_Si2CC2, CPCAP_REG_S1C1, CPCAP_REG_S1C2, CPCAP_REG_S2C1, CPCAP_REG_S2C2, CPCAP_REG_S3C, CPCAP_REG_S4C1, CPCAP_REG_S4C2, CPCAP_REG_S5C, CPCAP_REG_S6C, CPCAP_REG_VCAMC, CPCAP_REG_VCSIC, CPCAP_REG_VDACC, CPCAP_REG_VDIGC, CPCAP_REG_VFUSEC, CPCAP_REG_VHVIOC, CPCAP_REG_VSDIOC, CPCAP_REG_VPLLC, CPCAP_REG_VRF1C, CPCAP_REG_VRF2C, CPCAP_REG_VRFREFC, CPCAP_REG_VWLAN1C, CPCAP_REG_VWLAN2C, CPCAP_REG_VSIMC, CPCAP_REG_VVIBC, CPCAP_REG_VUSBC, CPCAP_REG_VUSBINT1C, CPCAP_REG_VUSBINT2C, CPCAP_REG_URT, CPCAP_REG_URM1, CPCAP_REG_URM2, CPCAP_REG_VAUDIOC, CPCAP_REG_CC, CPCAP_REG_CDI, CPCAP_REG_SDAC, CPCAP_REG_SDACDI, CPCAP_REG_TXI, CPCAP_REG_TXMP, CPCAP_REG_RXOA, CPCAP_REG_RXVC, CPCAP_REG_RXCOA, CPCAP_REG_RXSDOA, CPCAP_REG_RXEPOA, CPCAP_REG_RXLL, CPCAP_REG_A2LA, CPCAP_REG_MIPIS1, CPCAP_REG_MIPIS2, CPCAP_REG_MIPIS3, CPCAP_REG_LVAB, CPCAP_REG_CCC1, CPCAP_REG_CRM, CPCAP_REG_CCCC2, CPCAP_REG_CCS1, CPCAP_REG_CCS2, CPCAP_REG_CCA1, CPCAP_REG_CCA2, CPCAP_REG_CCM, CPCAP_REG_CCO, CPCAP_REG_CCI, CPCAP_REG_ADCC1, CPCAP_REG_ADCC2, CPCAP_REG_ADCD0, CPCAP_REG_ADCD1, CPCAP_REG_ADCD2, CPCAP_REG_ADCD3, CPCAP_REG_ADCD4, CPCAP_REG_ADCD5, CPCAP_REG_ADCD6, CPCAP_REG_ADCD7, CPCAP_REG_ADCAL1, CPCAP_REG_ADCAL2, CPCAP_REG_USBC1, CPCAP_REG_USBC2, CPCAP_REG_USBC3, CPCAP_REG_UVIDL, CPCAP_REG_UVIDH, CPCAP_REG_UPIDL, CPCAP_REG_UPIDH, CPCAP_REG_UFC1, CPCAP_REG_UFC2, CPCAP_REG_UFC3, CPCAP_REG_UIC1, CPCAP_REG_UIC2, CPCAP_REG_UIC3, CPCAP_REG_USBOTG1, CPCAP_REG_USBOTG2, CPCAP_REG_USBOTG3, CPCAP_REG_UIER1, CPCAP_REG_UIER2, CPCAP_REG_UIER3, CPCAP_REG_UIEF1, CPCAP_REG_UIEF2, CPCAP_REG_UIEF3, CPCAP_REG_UIS, CPCAP_REG_UIL, CPCAP_REG_USBD, CPCAP_REG_SCR1, CPCAP_REG_SCR2, CPCAP_REG_SCR3, CPCAP_REG_VMC, CPCAP_REG_OWDC, CPCAP_REG_GPIO0, CPCAP_REG_GPIO1, CPCAP_REG_GPIO2, CPCAP_REG_GPIO3, CPCAP_REG_GPIO4, CPCAP_REG_GPIO5, CPCAP_REG_GPIO6, CPCAP_REG_MDLC, CPCAP_REG_KLC, CPCAP_REG_ADLC, CPCAP_REG_REDC, CPCAP_REG_GREENC, CPCAP_REG_BLUEC, CPCAP_REG_CFC, CPCAP_REG_ABC, CPCAP_REG_BLEDC, CPCAP_REG_CLEDC, CPCAP_REG_OW1C, CPCAP_REG_OW1D, CPCAP_REG_OW1I, CPCAP_REG_OW1IE, CPCAP_REG_OW1, CPCAP_REG_OW2C, CPCAP_REG_OW2D, CPCAP_REG_OW2I, CPCAP_REG_OW2IE, CPCAP_REG_OW2, CPCAP_REG_OW3C, CPCAP_REG_OW3D, CPCAP_REG_OW3I, CPCAP_REG_OW3IE, CPCAP_REG_OW3, CPCAP_REG_GCAIC, CPCAP_REG_GCAIM, CPCAP_REG_LGDIR, CPCAP_REG_LGPU, CPCAP_REG_LGPIN, CPCAP_REG_LGMASK, CPCAP_REG_LDEB, CPCAP_REG_LGDET, CPCAP_REG_LMISC, CPCAP_REG_LMACE, CPCAP_REG_END = CPCAP_REG_LMACE, CPCAP_REG_MAX = CPCAP_REG_END, CPCAP_REG_SIZE = CPCAP_REG_MAX + 1, CPCAP_REG_UNUSED = CPCAP_REG_MAX + 2, }; enum { CPCAP_IOCTL_NUM_TEST__START, CPCAP_IOCTL_NUM_TEST_READ_REG, CPCAP_IOCTL_NUM_TEST_WRITE_REG, CPCAP_IOCTL_NUM_TEST__END, CPCAP_IOCTL_NUM_ADC__START, CPCAP_IOCTL_NUM_ADC_PHASE, CPCAP_IOCTL_NUM_ADC__END, CPCAP_IOCTL_NUM_BATT__START, CPCAP_IOCTL_NUM_BATT_DISPLAY_UPDATE, CPCAP_IOCTL_NUM_BATT_ATOD_ASYNC, CPCAP_IOCTL_NUM_BATT_ATOD_SYNC, CPCAP_IOCTL_NUM_BATT_ATOD_READ, CPCAP_IOCTL_NUM_BATT__END, CPCAP_IOCTL_NUM_UC__START, CPCAP_IOCTL_NUM_UC_MACRO_START, CPCAP_IOCTL_NUM_UC_MACRO_STOP, CPCAP_IOCTL_NUM_UC_GET_VENDOR, CPCAP_IOCTL_NUM_UC_SET_TURBO_MODE, CPCAP_IOCTL_NUM_UC__END, CPCAP_IOCTL_NUM_ACCY__START, CPCAP_IOCTL_NUM_ACCY_WHISPER, CPCAP_IOCTL_NUM_ACCY__END, }; enum cpcap_irqs { CPCAP_IRQ__START, CPCAP_IRQ_HSCLK = CPCAP_IRQ_INT1_INDEX, CPCAP_IRQ_PRIMAC, CPCAP_IRQ_SECMAC, CPCAP_IRQ_LOWBPL, CPCAP_IRQ_SEC2PRI, CPCAP_IRQ_LOWBPH, CPCAP_IRQ_EOL, CPCAP_IRQ_TS, CPCAP_IRQ_ADCDONE, CPCAP_IRQ_HS, CPCAP_IRQ_MB2, CPCAP_IRQ_VBUSOV, CPCAP_IRQ_RVRS_CHRG, CPCAP_IRQ_CHRG_DET, CPCAP_IRQ_IDFLOAT, CPCAP_IRQ_IDGND, CPCAP_IRQ_SE1 = CPCAP_IRQ_INT2_INDEX, CPCAP_IRQ_SESSEND, CPCAP_IRQ_SESSVLD, CPCAP_IRQ_VBUSVLD, CPCAP_IRQ_CHRG_CURR1, CPCAP_IRQ_CHRG_CURR2, CPCAP_IRQ_RVRS_MODE, CPCAP_IRQ_ON, CPCAP_IRQ_ON2, CPCAP_IRQ_CLK, CPCAP_IRQ_1HZ, CPCAP_IRQ_PTT, CPCAP_IRQ_SE0CONN, CPCAP_IRQ_CHRG_SE1B, CPCAP_IRQ_UART_ECHO_OVERRUN, CPCAP_IRQ_EXTMEMHD, CPCAP_IRQ_WARM = CPCAP_IRQ_INT3_INDEX, CPCAP_IRQ_SYSRSTR, CPCAP_IRQ_SOFTRST, CPCAP_IRQ_DIEPWRDWN, CPCAP_IRQ_DIETEMPH, CPCAP_IRQ_PC, CPCAP_IRQ_OFLOWSW, CPCAP_IRQ_TODA, CPCAP_IRQ_OPT_SEL_DTCH, CPCAP_IRQ_OPT_SEL_STATE, CPCAP_IRQ_ONEWIRE1, CPCAP_IRQ_ONEWIRE2, CPCAP_IRQ_ONEWIRE3, CPCAP_IRQ_UCRESET, CPCAP_IRQ_PWRGOOD, CPCAP_IRQ_USBDPLLCLK, CPCAP_IRQ_DPI = CPCAP_IRQ_INT4_INDEX, CPCAP_IRQ_DMI, CPCAP_IRQ_UCBUSY, CPCAP_IRQ_GCAI_CURR1, CPCAP_IRQ_GCAI_CURR2, CPCAP_IRQ_SB_MAX_RETRANSMIT_ERR, CPCAP_IRQ_BATTDETB, CPCAP_IRQ_PRIHALT, CPCAP_IRQ_SECHALT, CPCAP_IRQ_CC_CAL, CPCAP_IRQ_UC_PRIROMR = CPCAP_IRQ_INT5_INDEX, CPCAP_IRQ_UC_PRIRAMW, CPCAP_IRQ_UC_PRIRAMR, CPCAP_IRQ_UC_USEROFF, CPCAP_IRQ_UC_PRIMACRO_4, CPCAP_IRQ_UC_PRIMACRO_5, CPCAP_IRQ_UC_PRIMACRO_6, CPCAP_IRQ_UC_PRIMACRO_7, CPCAP_IRQ_UC_PRIMACRO_8, CPCAP_IRQ_UC_PRIMACRO_9, CPCAP_IRQ_UC_PRIMACRO_10, CPCAP_IRQ_UC_PRIMACRO_11, CPCAP_IRQ_UC_PRIMACRO_12, CPCAP_IRQ_UC_PRIMACRO_13, CPCAP_IRQ_UC_PRIMACRO_14, CPCAP_IRQ_UC_PRIMACRO_15, CPCAP_IRQ__NUM }; enum cpcap_adc_bank0 { CPCAP_ADC_AD0_BATTDETB, CPCAP_ADC_BATTP, CPCAP_ADC_VBUS, CPCAP_ADC_AD3, CPCAP_ADC_BPLUS_AD4, CPCAP_ADC_CHG_ISENSE, CPCAP_ADC_BATTI_ADC, CPCAP_ADC_USB_ID, CPCAP_ADC_BANK0_NUM, }; enum cpcap_adc_bank1 { CPCAP_ADC_AD8, CPCAP_ADC_AD9, CPCAP_ADC_LICELL, CPCAP_ADC_HV_BATTP, CPCAP_ADC_TSX1_AD12, CPCAP_ADC_TSX2_AD13, CPCAP_ADC_TSY1_AD14, CPCAP_ADC_TSY2_AD15, CPCAP_ADC_BANK1_NUM, }; enum cpcap_adc_format { CPCAP_ADC_FORMAT_RAW, CPCAP_ADC_FORMAT_PHASED, CPCAP_ADC_FORMAT_CONVERTED, }; enum cpcap_adc_timing { CPCAP_ADC_TIMING_IMM, CPCAP_ADC_TIMING_IN, CPCAP_ADC_TIMING_OUT, }; enum cpcap_adc_type { CPCAP_ADC_TYPE_BANK_0, CPCAP_ADC_TYPE_BANK_1, CPCAP_ADC_TYPE_BATT_PI, }; enum cpcap_macro { CPCAP_MACRO_ROMR, CPCAP_MACRO_RAMW, CPCAP_MACRO_RAMR, CPCAP_MACRO_USEROFF, CPCAP_MACRO_4, CPCAP_MACRO_5, CPCAP_MACRO_6, CPCAP_MACRO_7, CPCAP_MACRO_8, CPCAP_MACRO_9, CPCAP_MACRO_10, CPCAP_MACRO_11, CPCAP_MACRO_12, CPCAP_MACRO_13, CPCAP_MACRO_14, CPCAP_MACRO_15, CPCAP_MACRO__END, }; enum cpcap_vendor { CPCAP_VENDOR_ST, CPCAP_VENDOR_TI, }; enum cpcap_revision { CPCAP_REVISION_1_0 = 0x08, CPCAP_REVISION_1_1 = 0x09, CPCAP_REVISION_2_0 = 0x10, CPCAP_REVISION_2_1 = 0x11, }; enum cpcap_batt_usb_model { CPCAP_BATT_USB_MODEL_NONE, CPCAP_BATT_USB_MODEL_USB, CPCAP_BATT_USB_MODEL_FACTORY, }; struct cpcap_spi_init_data { enum cpcap_reg reg; unsigned short data; }; struct cpcap_adc_ato { unsigned short ato_in; unsigned short atox_in; unsigned short adc_ps_factor_in; unsigned short atox_ps_factor_in; unsigned short ato_out; unsigned short atox_out; unsigned short adc_ps_factor_out; unsigned short atox_ps_factor_out; }; struct cpcap_batt_data { int status; int health; int present; int capacity; int batt_volt; int batt_temp; }; struct cpcap_batt_ac_data { int online; }; struct cpcap_batt_usb_data { int online; int current_now; enum cpcap_batt_usb_model model; }; struct cpcap_device; struct cpcap_adc_us_request { enum cpcap_adc_format format; enum cpcap_adc_timing timing; enum cpcap_adc_type type; int status; int result[CPCAP_ADC_BANK0_NUM]; }; struct cpcap_adc_phase { signed char offset_batti; unsigned char slope_batti; signed char offset_chrgi; unsigned char slope_chrgi; signed char offset_battp; unsigned char slope_battp; signed char offset_bp; unsigned char slope_bp; signed char offset_battt; unsigned char slope_battt; signed char offset_chrgv; unsigned char slope_chrgv; }; struct cpcap_regacc { unsigned short reg; unsigned short value; unsigned short mask; }; struct cpcap_whisper_request { unsigned int cmd; char dock_id[CPCAP_WHISPER_ID_SIZE]; char dock_prop[CPCAP_WHISPER_PROP_SIZE]; }; #define CPCAP_IOCTL_TEST_READ_REG _IOWR(0, CPCAP_IOCTL_NUM_TEST_READ_REG, struct cpcap_regacc*) #define CPCAP_IOCTL_TEST_WRITE_REG _IOWR(0, CPCAP_IOCTL_NUM_TEST_WRITE_REG, struct cpcap_regacc*) #define CPCAP_IOCTL_ADC_PHASE _IOWR(0, CPCAP_IOCTL_NUM_ADC_PHASE, struct cpcap_adc_phase*) #define CPCAP_IOCTL_BATT_DISPLAY_UPDATE _IOW(0, CPCAP_IOCTL_NUM_BATT_DISPLAY_UPDATE, struct cpcap_batt_data*) #define CPCAP_IOCTL_BATT_ATOD_ASYNC _IOW(0, CPCAP_IOCTL_NUM_BATT_ATOD_ASYNC, struct cpcap_adc_us_request*) #define CPCAP_IOCTL_BATT_ATOD_SYNC _IOWR(0, CPCAP_IOCTL_NUM_BATT_ATOD_SYNC, struct cpcap_adc_us_request*) #define CPCAP_IOCTL_BATT_ATOD_READ _IOWR(0, CPCAP_IOCTL_NUM_BATT_ATOD_READ, struct cpcap_adc_us_request*) #define CPCAP_IOCTL_UC_MACRO_START _IOWR(0, CPCAP_IOCTL_NUM_UC_MACRO_START, enum cpcap_macro) #define CPCAP_IOCTL_UC_MACRO_STOP _IOWR(0, CPCAP_IOCTL_NUM_UC_MACRO_STOP, enum cpcap_macro) #define CPCAP_IOCTL_UC_GET_VENDOR _IOWR(0, CPCAP_IOCTL_NUM_UC_GET_VENDOR, enum cpcap_vendor) #define CPCAP_IOCTL_UC_SET_TURBO_MODE _IOW(0, CPCAP_IOCTL_NUM_UC_SET_TURBO_MODE, unsigned short) #define CPCAP_IOCTL_ACCY_WHISPER _IOW(0, CPCAP_IOCTL_NUM_ACCY_WHISPER, struct cpcap_whisper_request*) #endif android-audiosystem-1.8+13.10.20130807/include/linux/route.h0000644000015700001700000000262012200324306023763 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ROUTE_H #define _LINUX_ROUTE_H #include #include struct rtentry { unsigned long rt_pad1; struct sockaddr rt_dst; struct sockaddr rt_gateway; struct sockaddr rt_genmask; unsigned short rt_flags; short rt_pad2; unsigned long rt_pad3; void *rt_pad4; short rt_metric; char __user *rt_dev; unsigned long rt_mtu; #define rt_mss rt_mtu unsigned long rt_window; unsigned short rt_irtt; }; #define RTF_UP 0x0001 #define RTF_GATEWAY 0x0002 #define RTF_HOST 0x0004 #define RTF_REINSTATE 0x0008 #define RTF_DYNAMIC 0x0010 #define RTF_MODIFIED 0x0020 #define RTF_MTU 0x0040 #define RTF_MSS RTF_MTU #define RTF_WINDOW 0x0080 #define RTF_IRTT 0x0100 #define RTF_REJECT 0x0200 #endif android-audiosystem-1.8+13.10.20130807/include/linux/un.h0000644000015700001700000000146712200324306023257 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_UN_H #define _LINUX_UN_H #define UNIX_PATH_MAX 108 struct sockaddr_un { sa_family_t sun_family; char sun_path[UNIX_PATH_MAX]; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/mtio.h0000644000015700001700000001572512200324306023607 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_MTIO_H #define _LINUX_MTIO_H #include #include #include struct mtop { short mt_op; int mt_count; }; #define MTRESET 0 #define MTFSF 1 #define MTBSF 2 #define MTFSR 3 #define MTBSR 4 #define MTWEOF 5 #define MTREW 6 #define MTOFFL 7 #define MTNOP 8 #define MTRETEN 9 #define MTBSFM 10 #define MTFSFM 11 #define MTEOM 12 #define MTERASE 13 #define MTRAS1 14 #define MTRAS2 15 #define MTRAS3 16 #define MTSETBLK 20 #define MTSETDENSITY 21 #define MTSEEK 22 #define MTTELL 23 #define MTSETDRVBUFFER 24 #define MTFSS 25 #define MTBSS 26 #define MTWSM 27 #define MTLOCK 28 #define MTUNLOCK 29 #define MTLOAD 30 #define MTUNLOAD 31 #define MTCOMPRESSION 32 #define MTSETPART 33 #define MTMKPART 34 struct mtget { long mt_type; long mt_resid; long mt_dsreg; long mt_gstat; long mt_erreg; __kernel_daddr_t mt_fileno; __kernel_daddr_t mt_blkno; }; #define MT_ISUNKNOWN 0x01 #define MT_ISQIC02 0x02 #define MT_ISWT5150 0x03 #define MT_ISARCHIVE_5945L2 0x04 #define MT_ISCMSJ500 0x05 #define MT_ISTDC3610 0x06 #define MT_ISARCHIVE_VP60I 0x07 #define MT_ISARCHIVE_2150L 0x08 #define MT_ISARCHIVE_2060L 0x09 #define MT_ISARCHIVESC499 0x0A #define MT_ISQIC02_ALL_FEATURES 0x0F #define MT_ISWT5099EEN24 0x11 #define MT_ISTEAC_MT2ST 0x12 #define MT_ISEVEREX_FT40A 0x32 #define MT_ISDDS1 0x51 #define MT_ISDDS2 0x52 #define MT_ISONSTREAM_SC 0x61 #define MT_ISSCSI1 0x71 #define MT_ISSCSI2 0x72 #define MT_ISFTAPE_UNKNOWN 0x800000 #define MT_ISFTAPE_FLAG 0x800000 struct mt_tape_info { long t_type; char *t_name; }; #define MT_TAPE_INFO { {MT_ISUNKNOWN, "Unknown type of tape device"}, {MT_ISQIC02, "Generic QIC-02 tape streamer"}, {MT_ISWT5150, "Wangtek 5150, QIC-150"}, {MT_ISARCHIVE_5945L2, "Archive 5945L-2"}, {MT_ISCMSJ500, "CMS Jumbo 500"}, {MT_ISTDC3610, "Tandberg TDC 3610, QIC-24"}, {MT_ISARCHIVE_VP60I, "Archive VP60i, QIC-02"}, {MT_ISARCHIVE_2150L, "Archive Viper 2150L"}, {MT_ISARCHIVE_2060L, "Archive Viper 2060L"}, {MT_ISARCHIVESC499, "Archive SC-499 QIC-36 controller"}, {MT_ISQIC02_ALL_FEATURES, "Generic QIC-02 tape, all features"}, {MT_ISWT5099EEN24, "Wangtek 5099-een24, 60MB"}, {MT_ISTEAC_MT2ST, "Teac MT-2ST 155mb data cassette drive"}, {MT_ISEVEREX_FT40A, "Everex FT40A, QIC-40"}, {MT_ISONSTREAM_SC, "OnStream SC-, DI-, DP-, or USB tape drive"}, {MT_ISSCSI1, "Generic SCSI-1 tape"}, {MT_ISSCSI2, "Generic SCSI-2 tape"}, {0, NULL} } struct mtpos { long mt_blkno; }; struct mtvolinfo { unsigned int mt_volno; unsigned int mt_blksz; unsigned int mt_rawsize; unsigned int mt_size; unsigned int mt_cmpr:1; }; #define MT_FT_RD_SINGLE 0 #define MT_FT_RD_AHEAD 1 #define MT_FT_WR_ASYNC 0 #define MT_FT_WR_MULTI 1 #define MT_FT_WR_SINGLE 2 #define MT_FT_WR_DELETE 3 struct mtftseg { unsigned mt_segno; unsigned mt_mode; int mt_result; void __user *mt_data; }; struct mttapesize { unsigned long mt_capacity; unsigned long mt_used; }; #define FTFMT_SET_PARMS 1 #define FTFMT_GET_PARMS 2 #define FTFMT_FORMAT_TRACK 3 #define FTFMT_STATUS 4 #define FTFMT_VERIFY 5 struct ftfmtparms { unsigned char ft_qicstd; unsigned char ft_fmtcode; unsigned char ft_fhm; unsigned char ft_ftm; unsigned short ft_spt; unsigned short ft_tpc; }; struct ftfmttrack { unsigned int ft_track; unsigned char ft_gap3; }; struct ftfmtstatus { unsigned int ft_segment; }; struct ftfmtverify { unsigned int ft_segment; unsigned long ft_bsm; }; struct mtftformat { unsigned int fmt_op; union fmt_arg { struct ftfmtparms fmt_parms; struct ftfmttrack fmt_track; struct ftfmtstatus fmt_status; struct ftfmtverify fmt_verify; } fmt_arg; }; struct mtftcmd { unsigned int ft_wait_before; qic117_cmd_t ft_cmd; unsigned char ft_parm_cnt; unsigned char ft_parms[3]; unsigned int ft_result_bits; unsigned int ft_result; unsigned int ft_wait_after; int ft_status; int ft_error; }; #define MTIOCTOP _IOW('m', 1, struct mtop) #define MTIOCGET _IOR('m', 2, struct mtget) #define MTIOCPOS _IOR('m', 3, struct mtpos) #define MTIOCGETCONFIG _IOR('m', 4, struct mtconfiginfo) #define MTIOCSETCONFIG _IOW('m', 5, struct mtconfiginfo) #define MTIOCRDFTSEG _IOWR('m', 6, struct mtftseg) #define MTIOCWRFTSEG _IOWR('m', 7, struct mtftseg) #define MTIOCVOLINFO _IOR('m', 8, struct mtvolinfo) #define MTIOCGETSIZE _IOR('m', 9, struct mttapesize) #define MTIOCFTFORMAT _IOWR('m', 10, struct mtftformat) #define MTIOCFTCMD _IOWR('m', 11, struct mtftcmd) #define GMT_EOF(x) ((x) & 0x80000000) #define GMT_BOT(x) ((x) & 0x40000000) #define GMT_EOT(x) ((x) & 0x20000000) #define GMT_SM(x) ((x) & 0x10000000) #define GMT_EOD(x) ((x) & 0x08000000) #define GMT_WR_PROT(x) ((x) & 0x04000000) #define GMT_ONLINE(x) ((x) & 0x01000000) #define GMT_D_6250(x) ((x) & 0x00800000) #define GMT_D_1600(x) ((x) & 0x00400000) #define GMT_D_800(x) ((x) & 0x00200000) #define GMT_DR_OPEN(x) ((x) & 0x00040000) #define GMT_IM_REP_EN(x) ((x) & 0x00010000) #define GMT_CLN(x) ((x) & 0x00008000) #define MT_ST_BLKSIZE_SHIFT 0 #define MT_ST_BLKSIZE_MASK 0xffffff #define MT_ST_DENSITY_SHIFT 24 #define MT_ST_DENSITY_MASK 0xff000000 #define MT_ST_SOFTERR_SHIFT 0 #define MT_ST_SOFTERR_MASK 0xffff #define MT_ST_OPTIONS 0xf0000000 #define MT_ST_BOOLEANS 0x10000000 #define MT_ST_SETBOOLEANS 0x30000000 #define MT_ST_CLEARBOOLEANS 0x40000000 #define MT_ST_WRITE_THRESHOLD 0x20000000 #define MT_ST_DEF_BLKSIZE 0x50000000 #define MT_ST_DEF_OPTIONS 0x60000000 #define MT_ST_TIMEOUTS 0x70000000 #define MT_ST_SET_TIMEOUT (MT_ST_TIMEOUTS | 0x000000) #define MT_ST_SET_LONG_TIMEOUT (MT_ST_TIMEOUTS | 0x100000) #define MT_ST_SET_CLN 0x80000000 #define MT_ST_BUFFER_WRITES 0x1 #define MT_ST_ASYNC_WRITES 0x2 #define MT_ST_READ_AHEAD 0x4 #define MT_ST_DEBUGGING 0x8 #define MT_ST_TWO_FM 0x10 #define MT_ST_FAST_MTEOM 0x20 #define MT_ST_AUTO_LOCK 0x40 #define MT_ST_DEF_WRITES 0x80 #define MT_ST_CAN_BSR 0x100 #define MT_ST_NO_BLKLIMS 0x200 #define MT_ST_CAN_PARTITIONS 0x400 #define MT_ST_SCSI2LOGICAL 0x800 #define MT_ST_SYSV 0x1000 #define MT_ST_NOWAIT 0x2000 #define MT_ST_CLEAR_DEFAULT 0xfffff #define MT_ST_DEF_DENSITY (MT_ST_DEF_OPTIONS | 0x100000) #define MT_ST_DEF_COMPRESSION (MT_ST_DEF_OPTIONS | 0x200000) #define MT_ST_DEF_DRVBUFFER (MT_ST_DEF_OPTIONS | 0x300000) #define MT_ST_HPLOADER_OFFSET 10000 #endif android-audiosystem-1.8+13.10.20130807/include/linux/highmem.h0000644000015700001700000000227312200324306024247 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_HIGHMEM_H #define _LINUX_HIGHMEM_H #include #include #include #ifndef ARCH_HAS_FLUSH_ANON_PAGE #endif #ifndef ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE #endif #define kunmap(page) do { (void) (page); } while (0) #define kmap_atomic(page, idx) page_address(page) #define kunmap_atomic(addr, idx) do { } while (0) #define kmap_atomic_pfn(pfn, idx) page_address(pfn_to_page(pfn)) #define kmap_atomic_to_page(ptr) virt_to_page(ptr) #ifndef __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/if_pppol2tp.h0000644000015700001700000000413212200324306025063 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** *** To edit the content of this header, modify the corresponding *** source file (e.g. under external/kernel-headers/original/) then *** run bionic/libc/kernel/tools/update_all.py *** *** Any manual change here will be lost the next time this script will *** be run. You've been warned! *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_IF_PPPOL2TP_H #define __LINUX_IF_PPPOL2TP_H #include struct pppol2tp_addr { /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __kernel_pid_t pid; int fd; struct sockaddr_in addr; __u16 s_tunnel, s_session; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u16 d_tunnel, d_session; }; struct pppol2tpv3_addr { pid_t pid; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ int fd; struct sockaddr_in addr; __u32 s_tunnel, s_session; __u32 d_tunnel, d_session; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ }; enum { PPPOL2TP_SO_DEBUG = 1, PPPOL2TP_SO_RECVSEQ = 2, /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ PPPOL2TP_SO_SENDSEQ = 3, PPPOL2TP_SO_LNSMODE = 4, PPPOL2TP_SO_REORDERTO = 5, }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ enum { PPPOL2TP_MSG_DEBUG = (1 << 0), PPPOL2TP_MSG_CONTROL = (1 << 1), PPPOL2TP_MSG_SEQ = (1 << 2), /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ PPPOL2TP_MSG_DATA = (1 << 3), }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/keyboard.h0000644000015700001700000002755212200324306024440 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_KEYBOARD_H #define __LINUX_KEYBOARD_H #include #define KG_SHIFT 0 #define KG_CTRL 2 #define KG_ALT 3 #define KG_ALTGR 1 #define KG_SHIFTL 4 #define KG_KANASHIFT 4 #define KG_SHIFTR 5 #define KG_CTRLL 6 #define KG_CTRLR 7 #define KG_CAPSSHIFT 8 #define NR_SHIFT 9 #define NR_KEYS 256 #define MAX_NR_KEYMAPS 256 #define MAX_NR_OF_USER_KEYMAPS 256 #define MAX_NR_FUNC 256 #define KT_LATIN 0 #define KT_LETTER 11 #define KT_FN 1 #define KT_SPEC 2 #define KT_PAD 3 #define KT_DEAD 4 #define KT_CONS 5 #define KT_CUR 6 #define KT_SHIFT 7 #define KT_META 8 #define KT_ASCII 9 #define KT_LOCK 10 #define KT_SLOCK 12 #define KT_BRL 14 #define K(t,v) (((t)<<8)|(v)) #define KTYP(x) ((x) >> 8) #define KVAL(x) ((x) & 0xff) #define K_F1 K(KT_FN,0) #define K_F2 K(KT_FN,1) #define K_F3 K(KT_FN,2) #define K_F4 K(KT_FN,3) #define K_F5 K(KT_FN,4) #define K_F6 K(KT_FN,5) #define K_F7 K(KT_FN,6) #define K_F8 K(KT_FN,7) #define K_F9 K(KT_FN,8) #define K_F10 K(KT_FN,9) #define K_F11 K(KT_FN,10) #define K_F12 K(KT_FN,11) #define K_F13 K(KT_FN,12) #define K_F14 K(KT_FN,13) #define K_F15 K(KT_FN,14) #define K_F16 K(KT_FN,15) #define K_F17 K(KT_FN,16) #define K_F18 K(KT_FN,17) #define K_F19 K(KT_FN,18) #define K_F20 K(KT_FN,19) #define K_FIND K(KT_FN,20) #define K_INSERT K(KT_FN,21) #define K_REMOVE K(KT_FN,22) #define K_SELECT K(KT_FN,23) #define K_PGUP K(KT_FN,24) #define K_PGDN K(KT_FN,25) #define K_MACRO K(KT_FN,26) #define K_HELP K(KT_FN,27) #define K_DO K(KT_FN,28) #define K_PAUSE K(KT_FN,29) #define K_F21 K(KT_FN,30) #define K_F22 K(KT_FN,31) #define K_F23 K(KT_FN,32) #define K_F24 K(KT_FN,33) #define K_F25 K(KT_FN,34) #define K_F26 K(KT_FN,35) #define K_F27 K(KT_FN,36) #define K_F28 K(KT_FN,37) #define K_F29 K(KT_FN,38) #define K_F30 K(KT_FN,39) #define K_F31 K(KT_FN,40) #define K_F32 K(KT_FN,41) #define K_F33 K(KT_FN,42) #define K_F34 K(KT_FN,43) #define K_F35 K(KT_FN,44) #define K_F36 K(KT_FN,45) #define K_F37 K(KT_FN,46) #define K_F38 K(KT_FN,47) #define K_F39 K(KT_FN,48) #define K_F40 K(KT_FN,49) #define K_F41 K(KT_FN,50) #define K_F42 K(KT_FN,51) #define K_F43 K(KT_FN,52) #define K_F44 K(KT_FN,53) #define K_F45 K(KT_FN,54) #define K_F46 K(KT_FN,55) #define K_F47 K(KT_FN,56) #define K_F48 K(KT_FN,57) #define K_F49 K(KT_FN,58) #define K_F50 K(KT_FN,59) #define K_F51 K(KT_FN,60) #define K_F52 K(KT_FN,61) #define K_F53 K(KT_FN,62) #define K_F54 K(KT_FN,63) #define K_F55 K(KT_FN,64) #define K_F56 K(KT_FN,65) #define K_F57 K(KT_FN,66) #define K_F58 K(KT_FN,67) #define K_F59 K(KT_FN,68) #define K_F60 K(KT_FN,69) #define K_F61 K(KT_FN,70) #define K_F62 K(KT_FN,71) #define K_F63 K(KT_FN,72) #define K_F64 K(KT_FN,73) #define K_F65 K(KT_FN,74) #define K_F66 K(KT_FN,75) #define K_F67 K(KT_FN,76) #define K_F68 K(KT_FN,77) #define K_F69 K(KT_FN,78) #define K_F70 K(KT_FN,79) #define K_F71 K(KT_FN,80) #define K_F72 K(KT_FN,81) #define K_F73 K(KT_FN,82) #define K_F74 K(KT_FN,83) #define K_F75 K(KT_FN,84) #define K_F76 K(KT_FN,85) #define K_F77 K(KT_FN,86) #define K_F78 K(KT_FN,87) #define K_F79 K(KT_FN,88) #define K_F80 K(KT_FN,89) #define K_F81 K(KT_FN,90) #define K_F82 K(KT_FN,91) #define K_F83 K(KT_FN,92) #define K_F84 K(KT_FN,93) #define K_F85 K(KT_FN,94) #define K_F86 K(KT_FN,95) #define K_F87 K(KT_FN,96) #define K_F88 K(KT_FN,97) #define K_F89 K(KT_FN,98) #define K_F90 K(KT_FN,99) #define K_F91 K(KT_FN,100) #define K_F92 K(KT_FN,101) #define K_F93 K(KT_FN,102) #define K_F94 K(KT_FN,103) #define K_F95 K(KT_FN,104) #define K_F96 K(KT_FN,105) #define K_F97 K(KT_FN,106) #define K_F98 K(KT_FN,107) #define K_F99 K(KT_FN,108) #define K_F100 K(KT_FN,109) #define K_F101 K(KT_FN,110) #define K_F102 K(KT_FN,111) #define K_F103 K(KT_FN,112) #define K_F104 K(KT_FN,113) #define K_F105 K(KT_FN,114) #define K_F106 K(KT_FN,115) #define K_F107 K(KT_FN,116) #define K_F108 K(KT_FN,117) #define K_F109 K(KT_FN,118) #define K_F110 K(KT_FN,119) #define K_F111 K(KT_FN,120) #define K_F112 K(KT_FN,121) #define K_F113 K(KT_FN,122) #define K_F114 K(KT_FN,123) #define K_F115 K(KT_FN,124) #define K_F116 K(KT_FN,125) #define K_F117 K(KT_FN,126) #define K_F118 K(KT_FN,127) #define K_F119 K(KT_FN,128) #define K_F120 K(KT_FN,129) #define K_F121 K(KT_FN,130) #define K_F122 K(KT_FN,131) #define K_F123 K(KT_FN,132) #define K_F124 K(KT_FN,133) #define K_F125 K(KT_FN,134) #define K_F126 K(KT_FN,135) #define K_F127 K(KT_FN,136) #define K_F128 K(KT_FN,137) #define K_F129 K(KT_FN,138) #define K_F130 K(KT_FN,139) #define K_F131 K(KT_FN,140) #define K_F132 K(KT_FN,141) #define K_F133 K(KT_FN,142) #define K_F134 K(KT_FN,143) #define K_F135 K(KT_FN,144) #define K_F136 K(KT_FN,145) #define K_F137 K(KT_FN,146) #define K_F138 K(KT_FN,147) #define K_F139 K(KT_FN,148) #define K_F140 K(KT_FN,149) #define K_F141 K(KT_FN,150) #define K_F142 K(KT_FN,151) #define K_F143 K(KT_FN,152) #define K_F144 K(KT_FN,153) #define K_F145 K(KT_FN,154) #define K_F146 K(KT_FN,155) #define K_F147 K(KT_FN,156) #define K_F148 K(KT_FN,157) #define K_F149 K(KT_FN,158) #define K_F150 K(KT_FN,159) #define K_F151 K(KT_FN,160) #define K_F152 K(KT_FN,161) #define K_F153 K(KT_FN,162) #define K_F154 K(KT_FN,163) #define K_F155 K(KT_FN,164) #define K_F156 K(KT_FN,165) #define K_F157 K(KT_FN,166) #define K_F158 K(KT_FN,167) #define K_F159 K(KT_FN,168) #define K_F160 K(KT_FN,169) #define K_F161 K(KT_FN,170) #define K_F162 K(KT_FN,171) #define K_F163 K(KT_FN,172) #define K_F164 K(KT_FN,173) #define K_F165 K(KT_FN,174) #define K_F166 K(KT_FN,175) #define K_F167 K(KT_FN,176) #define K_F168 K(KT_FN,177) #define K_F169 K(KT_FN,178) #define K_F170 K(KT_FN,179) #define K_F171 K(KT_FN,180) #define K_F172 K(KT_FN,181) #define K_F173 K(KT_FN,182) #define K_F174 K(KT_FN,183) #define K_F175 K(KT_FN,184) #define K_F176 K(KT_FN,185) #define K_F177 K(KT_FN,186) #define K_F178 K(KT_FN,187) #define K_F179 K(KT_FN,188) #define K_F180 K(KT_FN,189) #define K_F181 K(KT_FN,190) #define K_F182 K(KT_FN,191) #define K_F183 K(KT_FN,192) #define K_F184 K(KT_FN,193) #define K_F185 K(KT_FN,194) #define K_F186 K(KT_FN,195) #define K_F187 K(KT_FN,196) #define K_F188 K(KT_FN,197) #define K_F189 K(KT_FN,198) #define K_F190 K(KT_FN,199) #define K_F191 K(KT_FN,200) #define K_F192 K(KT_FN,201) #define K_F193 K(KT_FN,202) #define K_F194 K(KT_FN,203) #define K_F195 K(KT_FN,204) #define K_F196 K(KT_FN,205) #define K_F197 K(KT_FN,206) #define K_F198 K(KT_FN,207) #define K_F199 K(KT_FN,208) #define K_F200 K(KT_FN,209) #define K_F201 K(KT_FN,210) #define K_F202 K(KT_FN,211) #define K_F203 K(KT_FN,212) #define K_F204 K(KT_FN,213) #define K_F205 K(KT_FN,214) #define K_F206 K(KT_FN,215) #define K_F207 K(KT_FN,216) #define K_F208 K(KT_FN,217) #define K_F209 K(KT_FN,218) #define K_F210 K(KT_FN,219) #define K_F211 K(KT_FN,220) #define K_F212 K(KT_FN,221) #define K_F213 K(KT_FN,222) #define K_F214 K(KT_FN,223) #define K_F215 K(KT_FN,224) #define K_F216 K(KT_FN,225) #define K_F217 K(KT_FN,226) #define K_F218 K(KT_FN,227) #define K_F219 K(KT_FN,228) #define K_F220 K(KT_FN,229) #define K_F221 K(KT_FN,230) #define K_F222 K(KT_FN,231) #define K_F223 K(KT_FN,232) #define K_F224 K(KT_FN,233) #define K_F225 K(KT_FN,234) #define K_F226 K(KT_FN,235) #define K_F227 K(KT_FN,236) #define K_F228 K(KT_FN,237) #define K_F229 K(KT_FN,238) #define K_F230 K(KT_FN,239) #define K_F231 K(KT_FN,240) #define K_F232 K(KT_FN,241) #define K_F233 K(KT_FN,242) #define K_F234 K(KT_FN,243) #define K_F235 K(KT_FN,244) #define K_F236 K(KT_FN,245) #define K_F237 K(KT_FN,246) #define K_F238 K(KT_FN,247) #define K_F239 K(KT_FN,248) #define K_F240 K(KT_FN,249) #define K_F241 K(KT_FN,250) #define K_F242 K(KT_FN,251) #define K_F243 K(KT_FN,252) #define K_F244 K(KT_FN,253) #define K_F245 K(KT_FN,254) #define K_UNDO K(KT_FN,255) #define K_HOLE K(KT_SPEC,0) #define K_ENTER K(KT_SPEC,1) #define K_SH_REGS K(KT_SPEC,2) #define K_SH_MEM K(KT_SPEC,3) #define K_SH_STAT K(KT_SPEC,4) #define K_BREAK K(KT_SPEC,5) #define K_CONS K(KT_SPEC,6) #define K_CAPS K(KT_SPEC,7) #define K_NUM K(KT_SPEC,8) #define K_HOLD K(KT_SPEC,9) #define K_SCROLLFORW K(KT_SPEC,10) #define K_SCROLLBACK K(KT_SPEC,11) #define K_BOOT K(KT_SPEC,12) #define K_CAPSON K(KT_SPEC,13) #define K_COMPOSE K(KT_SPEC,14) #define K_SAK K(KT_SPEC,15) #define K_DECRCONSOLE K(KT_SPEC,16) #define K_INCRCONSOLE K(KT_SPEC,17) #define K_SPAWNCONSOLE K(KT_SPEC,18) #define K_BARENUMLOCK K(KT_SPEC,19) #define K_ALLOCATED K(KT_SPEC,126) #define K_NOSUCHMAP K(KT_SPEC,127) #define K_P0 K(KT_PAD,0) #define K_P1 K(KT_PAD,1) #define K_P2 K(KT_PAD,2) #define K_P3 K(KT_PAD,3) #define K_P4 K(KT_PAD,4) #define K_P5 K(KT_PAD,5) #define K_P6 K(KT_PAD,6) #define K_P7 K(KT_PAD,7) #define K_P8 K(KT_PAD,8) #define K_P9 K(KT_PAD,9) #define K_PPLUS K(KT_PAD,10) #define K_PMINUS K(KT_PAD,11) #define K_PSTAR K(KT_PAD,12) #define K_PSLASH K(KT_PAD,13) #define K_PENTER K(KT_PAD,14) #define K_PCOMMA K(KT_PAD,15) #define K_PDOT K(KT_PAD,16) #define K_PPLUSMINUS K(KT_PAD,17) #define K_PPARENL K(KT_PAD,18) #define K_PPARENR K(KT_PAD,19) #define NR_PAD 20 #define K_DGRAVE K(KT_DEAD,0) #define K_DACUTE K(KT_DEAD,1) #define K_DCIRCM K(KT_DEAD,2) #define K_DTILDE K(KT_DEAD,3) #define K_DDIERE K(KT_DEAD,4) #define K_DCEDIL K(KT_DEAD,5) #define NR_DEAD 6 #define K_DOWN K(KT_CUR,0) #define K_LEFT K(KT_CUR,1) #define K_RIGHT K(KT_CUR,2) #define K_UP K(KT_CUR,3) #define K_SHIFT K(KT_SHIFT,KG_SHIFT) #define K_CTRL K(KT_SHIFT,KG_CTRL) #define K_ALT K(KT_SHIFT,KG_ALT) #define K_ALTGR K(KT_SHIFT,KG_ALTGR) #define K_SHIFTL K(KT_SHIFT,KG_SHIFTL) #define K_SHIFTR K(KT_SHIFT,KG_SHIFTR) #define K_CTRLL K(KT_SHIFT,KG_CTRLL) #define K_CTRLR K(KT_SHIFT,KG_CTRLR) #define K_CAPSSHIFT K(KT_SHIFT,KG_CAPSSHIFT) #define K_ASC0 K(KT_ASCII,0) #define K_ASC1 K(KT_ASCII,1) #define K_ASC2 K(KT_ASCII,2) #define K_ASC3 K(KT_ASCII,3) #define K_ASC4 K(KT_ASCII,4) #define K_ASC5 K(KT_ASCII,5) #define K_ASC6 K(KT_ASCII,6) #define K_ASC7 K(KT_ASCII,7) #define K_ASC8 K(KT_ASCII,8) #define K_ASC9 K(KT_ASCII,9) #define K_HEX0 K(KT_ASCII,10) #define K_HEX1 K(KT_ASCII,11) #define K_HEX2 K(KT_ASCII,12) #define K_HEX3 K(KT_ASCII,13) #define K_HEX4 K(KT_ASCII,14) #define K_HEX5 K(KT_ASCII,15) #define K_HEX6 K(KT_ASCII,16) #define K_HEX7 K(KT_ASCII,17) #define K_HEX8 K(KT_ASCII,18) #define K_HEX9 K(KT_ASCII,19) #define K_HEXa K(KT_ASCII,20) #define K_HEXb K(KT_ASCII,21) #define K_HEXc K(KT_ASCII,22) #define K_HEXd K(KT_ASCII,23) #define K_HEXe K(KT_ASCII,24) #define K_HEXf K(KT_ASCII,25) #define NR_ASCII 26 #define K_SHIFTLOCK K(KT_LOCK,KG_SHIFT) #define K_CTRLLOCK K(KT_LOCK,KG_CTRL) #define K_ALTLOCK K(KT_LOCK,KG_ALT) #define K_ALTGRLOCK K(KT_LOCK,KG_ALTGR) #define K_SHIFTLLOCK K(KT_LOCK,KG_SHIFTL) #define K_SHIFTRLOCK K(KT_LOCK,KG_SHIFTR) #define K_CTRLLLOCK K(KT_LOCK,KG_CTRLL) #define K_CTRLRLOCK K(KT_LOCK,KG_CTRLR) #define K_SHIFT_SLOCK K(KT_SLOCK,KG_SHIFT) #define K_CTRL_SLOCK K(KT_SLOCK,KG_CTRL) #define K_ALT_SLOCK K(KT_SLOCK,KG_ALT) #define K_ALTGR_SLOCK K(KT_SLOCK,KG_ALTGR) #define K_SHIFTL_SLOCK K(KT_SLOCK,KG_SHIFTL) #define K_SHIFTR_SLOCK K(KT_SLOCK,KG_SHIFTR) #define K_CTRLL_SLOCK K(KT_SLOCK,KG_CTRLL) #define K_CTRLR_SLOCK K(KT_SLOCK,KG_CTRLR) #define NR_LOCK 8 #define K_BRL_BLANK K(KT_BRL, 0) #define K_BRL_DOT1 K(KT_BRL, 1) #define K_BRL_DOT2 K(KT_BRL, 2) #define K_BRL_DOT3 K(KT_BRL, 3) #define K_BRL_DOT4 K(KT_BRL, 4) #define K_BRL_DOT5 K(KT_BRL, 5) #define K_BRL_DOT6 K(KT_BRL, 6) #define K_BRL_DOT7 K(KT_BRL, 7) #define K_BRL_DOT8 K(KT_BRL, 8) #define NR_BRL 9 #define MAX_DIACR 256 #endif android-audiosystem-1.8+13.10.20130807/include/linux/dirent.h0000644000015700001700000000165612200324306024122 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_DIRENT_H #define _LINUX_DIRENT_H struct dirent { long d_ino; __kernel_off_t d_off; unsigned short d_reclen; char d_name[256]; }; struct dirent64 { __u64 d_ino; __s64 d_off; unsigned short d_reclen; unsigned char d_type; char d_name[256]; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/nvhdcp.h0000644000015700001700000000715112200324306024113 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** *** To edit the content of this header, modify the corresponding *** source file (e.g. under external/kernel-headers/original/) then *** run bionic/libc/kernel/tools/update_all.py *** *** Any manual change here will be lost the next time this script will *** be run. You've been warned! *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_NVHDCP_H_ #define _LINUX_NVHDCP_H_ #include #include /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #include #define TEGRA_NVHDCP_MAX_DEVS 127 #define TEGRA_NVHDCP_FLAG_AN 0x0001 #define TEGRA_NVHDCP_FLAG_AKSV 0x0002 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define TEGRA_NVHDCP_FLAG_BKSV 0x0004 #define TEGRA_NVHDCP_FLAG_BSTATUS 0x0008 #define TEGRA_NVHDCP_FLAG_CN 0x0010 #define TEGRA_NVHDCP_FLAG_CKSV 0x0020 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define TEGRA_NVHDCP_FLAG_DKSV 0x0040 #define TEGRA_NVHDCP_FLAG_KP 0x0080 #define TEGRA_NVHDCP_FLAG_S 0x0100 #define TEGRA_NVHDCP_FLAG_CS 0x0200 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define TEGRA_NVHDCP_FLAG_V 0x0400 #define TEGRA_NVHDCP_FLAG_MP 0x0800 #define TEGRA_NVHDCP_FLAG_BKSVLIST 0x1000 #define TEGRA_NVHDCP_RESULT_SUCCESS 0 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define TEGRA_NVHDCP_RESULT_UNSUCCESSFUL 1 #define TEGRA_NVHDCP_RESULT_PENDING 0x103 #define TEGRA_NVHDCP_RESULT_LINK_FAILED 0xc0000013 #define TEGRA_NVHDCP_RESULT_INVALID_PARAMETER 0xc000000d /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define TEGRA_NVHDCP_RESULT_INVALID_PARAMETER_MIX 0xc0000030 #define TEGRA_NVHDCP_RESULT_NO_MEMORY 0xc0000017 struct tegra_nvhdcp_packet { __u32 value_flags; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u32 packet_results; __u64 c_n; __u64 c_ksv; __u32 b_status; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u64 hdcp_status; __u64 cs; __u64 k_prime; __u64 a_n; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u64 a_ksv; __u64 b_ksv; __u64 d_ksv; __u8 v_prime[20]; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u64 m_prime; __u32 num_bksv_list; __u64 bksv_list[TEGRA_NVHDCP_MAX_DEVS]; }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define TEGRA_NVHDCP_POLICY_ON_DEMAND 0 #define TEGRA_NVHDCP_POLICY_ALWAYS_ON 1 #define TEGRAIO_NVHDCP_ON _IO('F', 0x70) #define TEGRAIO_NVHDCP_OFF _IO('F', 0x71) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define TEGRAIO_NVHDCP_SET_POLICY _IOW('F', 0x72, __u32) #define TEGRAIO_NVHDCP_READ_M _IOWR('F', 0x73, struct tegra_nvhdcp_packet) #define TEGRAIO_NVHDCP_READ_S _IOWR('F', 0x74, struct tegra_nvhdcp_packet) #define TEGRAIO_NVHDCP_RENEGOTIATE _IO('F', 0x75) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #endif android-audiosystem-1.8+13.10.20130807/include/linux/resource.h0000644000015700001700000000263312200324306024460 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_RESOURCE_H #define _LINUX_RESOURCE_H #include struct task_struct; #define RUSAGE_SELF 0 #define RUSAGE_CHILDREN (-1) #define RUSAGE_BOTH (-2) struct rusage { struct timeval ru_utime; struct timeval ru_stime; long ru_maxrss; long ru_ixrss; long ru_idrss; long ru_isrss; long ru_minflt; long ru_majflt; long ru_nswap; long ru_inblock; long ru_oublock; long ru_msgsnd; long ru_msgrcv; long ru_nsignals; long ru_nvcsw; long ru_nivcsw; }; struct rlimit { unsigned long rlim_cur; unsigned long rlim_max; }; #define PRIO_MIN (-20) #define PRIO_MAX 20 #define PRIO_PROCESS 0 #define PRIO_PGRP 1 #define PRIO_USER 2 #define _STK_LIM (8*1024*1024) #define MLOCK_LIMIT (8 * PAGE_SIZE) #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/ipx.h0000644000015700001700000000426112200324306023430 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _IPX_H_ #define _IPX_H_ #include #include #define IPX_NODE_LEN 6 #define IPX_MTU 576 struct sockaddr_ipx { sa_family_t sipx_family; __u16 sipx_port; __u32 sipx_network; unsigned char sipx_node[IPX_NODE_LEN]; __u8 sipx_type; unsigned char sipx_zero; }; #define sipx_special sipx_port #define sipx_action sipx_zero #define IPX_DLTITF 0 #define IPX_CRTITF 1 struct ipx_route_definition { __u32 ipx_network; __u32 ipx_router_network; unsigned char ipx_router_node[IPX_NODE_LEN]; }; struct ipx_interface_definition { __u32 ipx_network; unsigned char ipx_device[16]; unsigned char ipx_dlink_type; #define IPX_FRAME_NONE 0 #define IPX_FRAME_SNAP 1 #define IPX_FRAME_8022 2 #define IPX_FRAME_ETHERII 3 #define IPX_FRAME_8023 4 #define IPX_FRAME_TR_8022 5 unsigned char ipx_special; #define IPX_SPECIAL_NONE 0 #define IPX_PRIMARY 1 #define IPX_INTERNAL 2 unsigned char ipx_node[IPX_NODE_LEN]; }; struct ipx_config_data { unsigned char ipxcfg_auto_select_primary; unsigned char ipxcfg_auto_create_interfaces; }; struct ipx_route_def { __u32 ipx_network; __u32 ipx_router_network; #define IPX_ROUTE_NO_ROUTER 0 unsigned char ipx_router_node[IPX_NODE_LEN]; unsigned char ipx_device[16]; unsigned short ipx_flags; #define IPX_RT_SNAP 8 #define IPX_RT_8022 4 #define IPX_RT_BLUEBOOK 2 #define IPX_RT_ROUTED 1 }; #define SIOCAIPXITFCRT (SIOCPROTOPRIVATE) #define SIOCAIPXPRISLT (SIOCPROTOPRIVATE + 1) #define SIOCIPXCFGDATA (SIOCPROTOPRIVATE + 2) #define SIOCIPXNCPCONN (SIOCPROTOPRIVATE + 3) #endif android-audiosystem-1.8+13.10.20130807/include/linux/err.h0000644000015700001700000000153612200324306023422 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ERR_H #define _LINUX_ERR_H #include #include #define MAX_ERRNO 4095 #define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) #endif android-audiosystem-1.8+13.10.20130807/include/linux/cpu.h0000644000015700001700000000233512200324306023417 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_CPU_H_ #define _LINUX_CPU_H_ #include #include #include #include #include struct cpu { int node_id; int no_control; struct sys_device sysdev; }; struct notifier_block; #define lock_cpu_hotplug() do { } while (0) #define unlock_cpu_hotplug() do { } while (0) #define lock_cpu_hotplug_interruptible() 0 #define hotcpu_notifier(fn, pri) do { } while (0) #define register_hotcpu_notifier(nb) do { } while (0) #define unregister_hotcpu_notifier(nb) do { } while (0) #endif android-audiosystem-1.8+13.10.20130807/include/linux/gfp.h0000644000015700001700000000553412200324306023410 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_GFP_H #define __LINUX_GFP_H #include #include #include struct vm_area_struct; #define __GFP_DMA ((__force gfp_t)0x01u) #define __GFP_HIGHMEM ((__force gfp_t)0x02u) #if BITS_PER_LONG < 64 #define __GFP_DMA32 ((__force gfp_t)0x00) #else #define __GFP_DMA32 ((__force gfp_t)0x04) #endif #define __GFP_WAIT ((__force gfp_t)0x10u) #define __GFP_HIGH ((__force gfp_t)0x20u) #define __GFP_IO ((__force gfp_t)0x40u) #define __GFP_FS ((__force gfp_t)0x80u) #define __GFP_COLD ((__force gfp_t)0x100u) #define __GFP_NOWARN ((__force gfp_t)0x200u) #define __GFP_REPEAT ((__force gfp_t)0x400u) #define __GFP_NOFAIL ((__force gfp_t)0x800u) #define __GFP_NORETRY ((__force gfp_t)0x1000u) #define __GFP_NO_GROW ((__force gfp_t)0x2000u) #define __GFP_COMP ((__force gfp_t)0x4000u) #define __GFP_ZERO ((__force gfp_t)0x8000u) #define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) #define __GFP_HARDWALL ((__force gfp_t)0x20000u) #define __GFP_BITS_SHIFT 20 #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) #define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| __GFP_COLD|__GFP_NOWARN|__GFP_REPEAT| __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| __GFP_NOMEMALLOC|__GFP_HARDWALL) #define GFP_NOWAIT (GFP_ATOMIC & ~__GFP_HIGH) #define GFP_ATOMIC (__GFP_HIGH) #define GFP_NOIO (__GFP_WAIT) #define GFP_NOFS (__GFP_WAIT | __GFP_IO) #define GFP_KERNEL (__GFP_WAIT | __GFP_IO | __GFP_FS) #define GFP_USER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL) #define GFP_HIGHUSER (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_HARDWALL | __GFP_HIGHMEM) #define GFP_DMA __GFP_DMA #define GFP_DMA32 __GFP_DMA32 #ifndef HAVE_ARCH_FREE_PAGE #endif #define alloc_pages(gfp_mask, order) alloc_pages_node(numa_node_id(), gfp_mask, order) #define alloc_page_vma(gfp_mask, vma, addr) alloc_pages(gfp_mask, 0) #define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) #define __get_free_page(gfp_mask) __get_free_pages((gfp_mask),0) #define __get_dma_pages(gfp_mask, order) __get_free_pages((gfp_mask) | GFP_DMA,(order)) #define __free_page(page) __free_pages((page), 0) #define free_page(addr) free_pages((addr),0) #endif android-audiosystem-1.8+13.10.20130807/include/linux/taskstats_kern.h0000644000015700001700000000146512200324306025673 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_TASKSTATS_KERN_H #define _LINUX_TASKSTATS_KERN_H #include #include #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/linux-syscalls.h0000644000015700001700000004565112200324306025632 0ustar pbuserpbgroup00000000000000/* auto-generated by gensyscalls.py, do not touch */ #ifndef _BIONIC_LINUX_SYSCALLS_H_ #if !defined __ASM_ARM_UNISTD_H && !defined __ASM_I386_UNISTD_H #if defined __arm__ && !defined __ARM_EABI__ && !defined __thumb__ # define __NR_SYSCALL_BASE 0x900000 #else # define __NR_SYSCALL_BASE 0 #endif #define __NR_exit (__NR_SYSCALL_BASE + 1) #define __NR_fork (__NR_SYSCALL_BASE + 2) #define __NR_clone (__NR_SYSCALL_BASE + 120) #define __NR_execve (__NR_SYSCALL_BASE + 11) #define __NR_setuid32 (__NR_SYSCALL_BASE + 213) #define __NR_getuid32 (__NR_SYSCALL_BASE + 199) #define __NR_getgid32 (__NR_SYSCALL_BASE + 200) #define __NR_geteuid32 (__NR_SYSCALL_BASE + 201) #define __NR_getegid32 (__NR_SYSCALL_BASE + 202) #define __NR_getresuid32 (__NR_SYSCALL_BASE + 209) #define __NR_getresgid32 (__NR_SYSCALL_BASE + 211) #define __NR_gettid (__NR_SYSCALL_BASE + 224) #define __NR_getgroups32 (__NR_SYSCALL_BASE + 205) #define __NR_getpgid (__NR_SYSCALL_BASE + 132) #define __NR_getppid (__NR_SYSCALL_BASE + 64) #define __NR_setsid (__NR_SYSCALL_BASE + 66) #define __NR_setgid32 (__NR_SYSCALL_BASE + 214) #define __NR_setreuid32 (__NR_SYSCALL_BASE + 203) #define __NR_setresuid32 (__NR_SYSCALL_BASE + 208) #define __NR_setresgid32 (__NR_SYSCALL_BASE + 210) #define __NR_brk (__NR_SYSCALL_BASE + 45) #define __NR_ptrace (__NR_SYSCALL_BASE + 26) #define __NR_getpriority (__NR_SYSCALL_BASE + 96) #define __NR_setpriority (__NR_SYSCALL_BASE + 97) #define __NR_setrlimit (__NR_SYSCALL_BASE + 75) #define __NR_ugetrlimit (__NR_SYSCALL_BASE + 191) #define __NR_getrusage (__NR_SYSCALL_BASE + 77) #define __NR_setgroups32 (__NR_SYSCALL_BASE + 206) #define __NR_setpgid (__NR_SYSCALL_BASE + 57) #define __NR_setregid32 (__NR_SYSCALL_BASE + 204) #define __NR_chroot (__NR_SYSCALL_BASE + 61) #define __NR_prctl (__NR_SYSCALL_BASE + 172) #define __NR_capget (__NR_SYSCALL_BASE + 184) #define __NR_capset (__NR_SYSCALL_BASE + 185) #define __NR_sigaltstack (__NR_SYSCALL_BASE + 186) #define __NR_acct (__NR_SYSCALL_BASE + 51) #define __NR_read (__NR_SYSCALL_BASE + 3) #define __NR_write (__NR_SYSCALL_BASE + 4) #define __NR_pread64 (__NR_SYSCALL_BASE + 180) #define __NR_pwrite64 (__NR_SYSCALL_BASE + 181) #define __NR_open (__NR_SYSCALL_BASE + 5) #define __NR_close (__NR_SYSCALL_BASE + 6) #define __NR_lseek (__NR_SYSCALL_BASE + 19) #define __NR__llseek (__NR_SYSCALL_BASE + 140) #define __NR_getpid (__NR_SYSCALL_BASE + 20) #define __NR_mmap2 (__NR_SYSCALL_BASE + 192) #define __NR_munmap (__NR_SYSCALL_BASE + 91) #define __NR_mremap (__NR_SYSCALL_BASE + 163) #define __NR_msync (__NR_SYSCALL_BASE + 144) #define __NR_mprotect (__NR_SYSCALL_BASE + 125) #define __NR_mlock (__NR_SYSCALL_BASE + 150) #define __NR_munlock (__NR_SYSCALL_BASE + 151) #define __NR_ioctl (__NR_SYSCALL_BASE + 54) #define __NR_readv (__NR_SYSCALL_BASE + 145) #define __NR_writev (__NR_SYSCALL_BASE + 146) #define __NR_fcntl (__NR_SYSCALL_BASE + 55) #define __NR_flock (__NR_SYSCALL_BASE + 143) #define __NR_fchmod (__NR_SYSCALL_BASE + 94) #define __NR_dup (__NR_SYSCALL_BASE + 41) #define __NR_pipe (__NR_SYSCALL_BASE + 42) #define __NR_dup2 (__NR_SYSCALL_BASE + 63) #define __NR__newselect (__NR_SYSCALL_BASE + 142) #define __NR_ftruncate (__NR_SYSCALL_BASE + 93) #define __NR_ftruncate64 (__NR_SYSCALL_BASE + 194) #define __NR_fsync (__NR_SYSCALL_BASE + 118) #define __NR_fdatasync (__NR_SYSCALL_BASE + 148) #define __NR_fchown32 (__NR_SYSCALL_BASE + 207) #define __NR_sync (__NR_SYSCALL_BASE + 36) #define __NR_fcntl64 (__NR_SYSCALL_BASE + 221) #define __NR_sendfile (__NR_SYSCALL_BASE + 187) #define __NR_link (__NR_SYSCALL_BASE + 9) #define __NR_unlink (__NR_SYSCALL_BASE + 10) #define __NR_chdir (__NR_SYSCALL_BASE + 12) #define __NR_mknod (__NR_SYSCALL_BASE + 14) #define __NR_chmod (__NR_SYSCALL_BASE + 15) #define __NR_chown32 (__NR_SYSCALL_BASE + 212) #define __NR_lchown32 (__NR_SYSCALL_BASE + 198) #define __NR_mount (__NR_SYSCALL_BASE + 21) #define __NR_umount2 (__NR_SYSCALL_BASE + 52) #define __NR_fstat64 (__NR_SYSCALL_BASE + 197) #define __NR_stat64 (__NR_SYSCALL_BASE + 195) #define __NR_lstat64 (__NR_SYSCALL_BASE + 196) #define __NR_mkdir (__NR_SYSCALL_BASE + 39) #define __NR_readlink (__NR_SYSCALL_BASE + 85) #define __NR_rmdir (__NR_SYSCALL_BASE + 40) #define __NR_rename (__NR_SYSCALL_BASE + 38) #define __NR_getcwd (__NR_SYSCALL_BASE + 183) #define __NR_access (__NR_SYSCALL_BASE + 33) #define __NR_symlink (__NR_SYSCALL_BASE + 83) #define __NR_fchdir (__NR_SYSCALL_BASE + 133) #define __NR_truncate (__NR_SYSCALL_BASE + 92) #define __NR_pause (__NR_SYSCALL_BASE + 29) #define __NR_gettimeofday (__NR_SYSCALL_BASE + 78) #define __NR_settimeofday (__NR_SYSCALL_BASE + 79) #define __NR_times (__NR_SYSCALL_BASE + 43) #define __NR_nanosleep (__NR_SYSCALL_BASE + 162) #define __NR_getitimer (__NR_SYSCALL_BASE + 105) #define __NR_setitimer (__NR_SYSCALL_BASE + 104) #define __NR_sigaction (__NR_SYSCALL_BASE + 67) #define __NR_sigprocmask (__NR_SYSCALL_BASE + 126) #define __NR_sigsuspend (__NR_SYSCALL_BASE + 72) #define __NR_rt_sigaction (__NR_SYSCALL_BASE + 174) #define __NR_rt_sigprocmask (__NR_SYSCALL_BASE + 175) #define __NR_rt_sigtimedwait (__NR_SYSCALL_BASE + 177) #define __NR_sigpending (__NR_SYSCALL_BASE + 73) #define __NR_sched_setscheduler (__NR_SYSCALL_BASE + 156) #define __NR_sched_getscheduler (__NR_SYSCALL_BASE + 157) #define __NR_sched_yield (__NR_SYSCALL_BASE + 158) #define __NR_sched_setparam (__NR_SYSCALL_BASE + 154) #define __NR_sched_getparam (__NR_SYSCALL_BASE + 155) #define __NR_sched_get_priority_max (__NR_SYSCALL_BASE + 159) #define __NR_sched_get_priority_min (__NR_SYSCALL_BASE + 160) #define __NR_sched_rr_get_interval (__NR_SYSCALL_BASE + 161) #define __NR_sched_setaffinity (__NR_SYSCALL_BASE + 241) #define __NR_sched_getaffinity (__NR_SYSCALL_BASE + 242) #define __NR_uname (__NR_SYSCALL_BASE + 122) #define __NR_wait4 (__NR_SYSCALL_BASE + 114) #define __NR_umask (__NR_SYSCALL_BASE + 60) #define __NR_reboot (__NR_SYSCALL_BASE + 88) #define __NR_syslog (__NR_SYSCALL_BASE + 103) #define __NR_init_module (__NR_SYSCALL_BASE + 128) #define __NR_delete_module (__NR_SYSCALL_BASE + 129) #define __NR_syslog (__NR_SYSCALL_BASE + 103) #define __NR_sysinfo (__NR_SYSCALL_BASE + 116) #define __NR_personality (__NR_SYSCALL_BASE + 136) #define __NR_futex (__NR_SYSCALL_BASE + 240) #define __NR_poll (__NR_SYSCALL_BASE + 168) #ifdef __arm__ #define __NR_exit_group (__NR_SYSCALL_BASE + 248) #define __NR_waitid (__NR_SYSCALL_BASE + 280) #define __NR_vfork (__NR_SYSCALL_BASE + 190) #define __NR_openat (__NR_SYSCALL_BASE + 322) #define __NR_madvise (__NR_SYSCALL_BASE + 220) #define __NR_mincore (__NR_SYSCALL_BASE + 219) #define __NR_pipe2 (__NR_SYSCALL_BASE + 359) #define __NR_getdents64 (__NR_SYSCALL_BASE + 217) #define __NR_fstatfs64 (__NR_SYSCALL_BASE + 267) #define __NR_fstatat64 (__NR_SYSCALL_BASE + 327) #define __NR_mkdirat (__NR_SYSCALL_BASE + 323) #define __NR_fchownat (__NR_SYSCALL_BASE + 325) #define __NR_fchmodat (__NR_SYSCALL_BASE + 333) #define __NR_renameat (__NR_SYSCALL_BASE + 329) #define __NR_unlinkat (__NR_SYSCALL_BASE + 328) #define __NR_statfs64 (__NR_SYSCALL_BASE + 266) #define __NR_clock_gettime (__NR_SYSCALL_BASE + 263) #define __NR_clock_settime (__NR_SYSCALL_BASE + 262) #define __NR_clock_getres (__NR_SYSCALL_BASE + 264) #define __NR_clock_nanosleep (__NR_SYSCALL_BASE + 265) #define __NR_timer_create (__NR_SYSCALL_BASE + 257) #define __NR_timer_settime (__NR_SYSCALL_BASE + 258) #define __NR_timer_gettime (__NR_SYSCALL_BASE + 259) #define __NR_timer_getoverrun (__NR_SYSCALL_BASE + 260) #define __NR_timer_delete (__NR_SYSCALL_BASE + 261) #define __NR_utimes (__NR_SYSCALL_BASE + 269) #define __NR_utimensat (__NR_SYSCALL_BASE + 348) #define __NR_socket (__NR_SYSCALL_BASE + 281) #define __NR_socketpair (__NR_SYSCALL_BASE + 288) #define __NR_bind (__NR_SYSCALL_BASE + 282) #define __NR_connect (__NR_SYSCALL_BASE + 283) #define __NR_listen (__NR_SYSCALL_BASE + 284) #define __NR_accept (__NR_SYSCALL_BASE + 285) #define __NR_getsockname (__NR_SYSCALL_BASE + 286) #define __NR_getpeername (__NR_SYSCALL_BASE + 287) #define __NR_sendto (__NR_SYSCALL_BASE + 290) #define __NR_recvfrom (__NR_SYSCALL_BASE + 292) #define __NR_shutdown (__NR_SYSCALL_BASE + 293) #define __NR_setsockopt (__NR_SYSCALL_BASE + 294) #define __NR_getsockopt (__NR_SYSCALL_BASE + 295) #define __NR_sendmsg (__NR_SYSCALL_BASE + 296) #define __NR_recvmsg (__NR_SYSCALL_BASE + 297) #define __NR_getcpu (__NR_SYSCALL_BASE + 345) #define __NR_ioprio_set (__NR_SYSCALL_BASE + 314) #define __NR_ioprio_get (__NR_SYSCALL_BASE + 315) #define __NR_epoll_create (__NR_SYSCALL_BASE + 250) #define __NR_epoll_ctl (__NR_SYSCALL_BASE + 251) #define __NR_epoll_wait (__NR_SYSCALL_BASE + 252) #define __NR_inotify_init (__NR_SYSCALL_BASE + 316) #define __NR_inotify_add_watch (__NR_SYSCALL_BASE + 317) #define __NR_inotify_rm_watch (__NR_SYSCALL_BASE + 318) #define __NR_eventfd2 (__NR_SYSCALL_BASE + 356) #define __NR_ARM_set_tls (__NR_SYSCALL_BASE + 983045) #define __NR_ARM_cacheflush (__NR_SYSCALL_BASE + 983042) #endif #ifdef __i386__ #define __NR_exit_group (__NR_SYSCALL_BASE + 252) #define __NR_waitpid (__NR_SYSCALL_BASE + 7) #define __NR_waitid (__NR_SYSCALL_BASE + 284) #define __NR_kill (__NR_SYSCALL_BASE + 37) #define __NR_tkill (__NR_SYSCALL_BASE + 238) #define __NR_set_thread_area (__NR_SYSCALL_BASE + 243) #define __NR_openat (__NR_SYSCALL_BASE + 295) #define __NR_madvise (__NR_SYSCALL_BASE + 219) #define __NR_mincore (__NR_SYSCALL_BASE + 218) #define __NR_pipe2 (__NR_SYSCALL_BASE + 331) #define __NR_getdents64 (__NR_SYSCALL_BASE + 220) #define __NR_fstatfs64 (__NR_SYSCALL_BASE + 269) #define __NR_fstatat64 (__NR_SYSCALL_BASE + 300) #define __NR_mkdirat (__NR_SYSCALL_BASE + 296) #define __NR_fchownat (__NR_SYSCALL_BASE + 298) #define __NR_fchmodat (__NR_SYSCALL_BASE + 306) #define __NR_renameat (__NR_SYSCALL_BASE + 302) #define __NR_unlinkat (__NR_SYSCALL_BASE + 301) #define __NR_statfs64 (__NR_SYSCALL_BASE + 268) #define __NR_clock_gettime (__NR_SYSCALL_BASE + 265) #define __NR_clock_settime (__NR_SYSCALL_BASE + 264) #define __NR_clock_getres (__NR_SYSCALL_BASE + 266) #define __NR_clock_nanosleep (__NR_SYSCALL_BASE + 267) #define __NR_timer_create (__NR_SYSCALL_BASE + 259) #define __NR_timer_settime (__NR_SYSCALL_BASE + 260) #define __NR_timer_gettime (__NR_SYSCALL_BASE + 261) #define __NR_timer_getoverrun (__NR_SYSCALL_BASE + 262) #define __NR_timer_delete (__NR_SYSCALL_BASE + 263) #define __NR_utimes (__NR_SYSCALL_BASE + 271) #define __NR_utimensat (__NR_SYSCALL_BASE + 320) #define __NR_socketcall (__NR_SYSCALL_BASE + 102) #define __NR_getcpu (__NR_SYSCALL_BASE + 318) #define __NR_ioprio_set (__NR_SYSCALL_BASE + 289) #define __NR_ioprio_get (__NR_SYSCALL_BASE + 290) #define __NR_epoll_create (__NR_SYSCALL_BASE + 254) #define __NR_epoll_ctl (__NR_SYSCALL_BASE + 255) #define __NR_epoll_wait (__NR_SYSCALL_BASE + 256) #define __NR_inotify_init (__NR_SYSCALL_BASE + 291) #define __NR_inotify_add_watch (__NR_SYSCALL_BASE + 292) #define __NR_inotify_rm_watch (__NR_SYSCALL_BASE + 293) #define __NR_eventfd2 (__NR_SYSCALL_BASE + 328) #endif #if defined(__SH3__) || defined(__SH4__) #define __NR_exit_group (__NR_SYSCALL_BASE + 252) #define __NR_waitpid (__NR_SYSCALL_BASE + 7) #define __NR_waitid (__NR_SYSCALL_BASE + 284) #define __NR_kill (__NR_SYSCALL_BASE + 37) #define __NR_tkill (__NR_SYSCALL_BASE + 238) #define __NR_set_thread_area (__NR_SYSCALL_BASE + 243) #define __NR_vfork (__NR_SYSCALL_BASE + 190) #define __NR_openat (__NR_SYSCALL_BASE + 295) #define __NR_madvise (__NR_SYSCALL_BASE + 219) #define __NR_mincore (__NR_SYSCALL_BASE + 218) #define __NR_pipe2 (__NR_SYSCALL_BASE + 331) #define __NR_getdents64 (__NR_SYSCALL_BASE + 220) #define __NR_fstatfs64 (__NR_SYSCALL_BASE + 269) #define __NR_fstatat64 (__NR_SYSCALL_BASE + 300) #define __NR_mkdirat (__NR_SYSCALL_BASE + 296) #define __NR_fchownat (__NR_SYSCALL_BASE + 298) #define __NR_fchmodat (__NR_SYSCALL_BASE + 306) #define __NR_renameat (__NR_SYSCALL_BASE + 302) #define __NR_unlinkat (__NR_SYSCALL_BASE + 301) #define __NR_statfs64 (__NR_SYSCALL_BASE + 268) #define __NR_clock_gettime (__NR_SYSCALL_BASE + 265) #define __NR_clock_settime (__NR_SYSCALL_BASE + 264) #define __NR_clock_getres (__NR_SYSCALL_BASE + 266) #define __NR_clock_nanosleep (__NR_SYSCALL_BASE + 267) #define __NR_timer_create (__NR_SYSCALL_BASE + 259) #define __NR_timer_settime (__NR_SYSCALL_BASE + 260) #define __NR_timer_gettime (__NR_SYSCALL_BASE + 261) #define __NR_timer_getoverrun (__NR_SYSCALL_BASE + 262) #define __NR_timer_delete (__NR_SYSCALL_BASE + 263) #define __NR_utimes (__NR_SYSCALL_BASE + 271) #define __NR_utimensat (__NR_SYSCALL_BASE + 320) #define __NR_socketcall (__NR_SYSCALL_BASE + 102) #define __NR_socketcall (__NR_SYSCALL_BASE + 102) #define __NR_socketcall (__NR_SYSCALL_BASE + 102) #define __NR_socketcall (__NR_SYSCALL_BASE + 102) #define __NR_socketcall (__NR_SYSCALL_BASE + 102) #define __NR_socketcall (__NR_SYSCALL_BASE + 102) #define __NR_socketcall (__NR_SYSCALL_BASE + 102) #define __NR_socketcall (__NR_SYSCALL_BASE + 102) #define __NR_socketcall (__NR_SYSCALL_BASE + 102) #define __NR_socketcall (__NR_SYSCALL_BASE + 102) #define __NR_socketcall (__NR_SYSCALL_BASE + 102) #define __NR_socketcall (__NR_SYSCALL_BASE + 102) #define __NR_socketcall (__NR_SYSCALL_BASE + 102) #define __NR_socketcall (__NR_SYSCALL_BASE + 102) #define __NR_socketcall (__NR_SYSCALL_BASE + 102) #define __NR_socketcall (__NR_SYSCALL_BASE + 102) #define __NR_getcpu (__NR_SYSCALL_BASE + 318) #define __NR_ioprio_set (__NR_SYSCALL_BASE + 288) #define __NR_ioprio_get (__NR_SYSCALL_BASE + 289) #define __NR_epoll_create (__NR_SYSCALL_BASE + 254) #define __NR_epoll_ctl (__NR_SYSCALL_BASE + 255) #define __NR_epoll_wait (__NR_SYSCALL_BASE + 256) #define __NR_inotify_init (__NR_SYSCALL_BASE + 290) #define __NR_inotify_add_watch (__NR_SYSCALL_BASE + 291) #define __NR_inotify_rm_watch (__NR_SYSCALL_BASE + 292) #define __NR_eventfd2 (__NR_SYSCALL_BASE + 328) #endif #endif #endif /* _BIONIC_LINUX_SYSCALLS_H_ */ android-audiosystem-1.8+13.10.20130807/include/linux/if_pppolac.h0000644000015700001700000000275112200324306024746 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** *** To edit the content of this header, modify the corresponding *** source file (e.g. under external/kernel-headers/original/) then *** run bionic/libc/kernel/tools/update_all.py *** *** Any manual change here will be lost the next time this script will *** be run. You've been warned! *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_IF_PPPOLAC_H #define __LINUX_IF_PPPOLAC_H #include #include /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct sockaddr_pppolac { sa_family_t sa_family; unsigned int sa_protocol; int udp_socket; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct __attribute__((packed)) { __u16 tunnel, session; } local, remote; } __attribute__((packed)); /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #endif android-audiosystem-1.8+13.10.20130807/include/linux/if_pppox.h0000644000015700001700000001103012200324306024444 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** *** To edit the content of this header, modify the corresponding *** source file (e.g. under external/kernel-headers/original/) then *** run bionic/libc/kernel/tools/update_all.py *** *** Any manual change here will be lost the next time this script will *** be run. You've been warned! *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_IF_PPPOX_H #define __LINUX_IF_PPPOX_H #include #include /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #include #include #include #ifndef AF_PPPOX /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define AF_PPPOX 24 #define PF_PPPOX AF_PPPOX #endif typedef __be16 sid_t; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct pppoe_addr { sid_t sid; unsigned char remote[ETH_ALEN]; char dev[IFNAMSIZ]; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ }; struct pptp_addr { __be16 call_id; struct in_addr sin_addr; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ }; #define PX_PROTO_OE 0 #define PX_PROTO_OL2TP 1 #define PX_PROTO_PPTP 2 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define PX_PROTO_OLAC 3 #define PX_PROTO_OPNS 4 #define PX_MAX_PROTO 5 struct sockaddr_pppox { /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ sa_family_t sa_family; unsigned int sa_protocol; union { struct pppoe_addr pppoe; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct pptp_addr pptp; } sa_addr; } __attribute__((packed)); struct sockaddr_pppol2tp { /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ sa_family_t sa_family; unsigned int sa_protocol; struct pppol2tp_addr pppol2tp; } __attribute__((packed)); /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct sockaddr_pppol2tpv3 { sa_family_t sa_family; unsigned int sa_protocol; struct pppol2tpv3_addr pppol2tp; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ } __attribute__((packed)); #define PPPOEIOCSFWD _IOW(0xB1 ,0, size_t) #define PPPOEIOCDFWD _IO(0xB1 ,1) #define PADI_CODE 0x09 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define PADO_CODE 0x07 #define PADR_CODE 0x19 #define PADS_CODE 0x65 #define PADT_CODE 0xa7 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct pppoe_tag { __be16 tag_type; __be16 tag_len; char tag_data[0]; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ } __attribute__ ((packed)); #define PTT_EOL __cpu_to_be16(0x0000) #define PTT_SRV_NAME __cpu_to_be16(0x0101) #define PTT_AC_NAME __cpu_to_be16(0x0102) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define PTT_HOST_UNIQ __cpu_to_be16(0x0103) #define PTT_AC_COOKIE __cpu_to_be16(0x0104) #define PTT_VENDOR __cpu_to_be16(0x0105) #define PTT_RELAY_SID __cpu_to_be16(0x0110) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define PTT_SRV_ERR __cpu_to_be16(0x0201) #define PTT_SYS_ERR __cpu_to_be16(0x0202) #define PTT_GEN_ERR __cpu_to_be16(0x0203) struct pppoe_hdr { /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #ifdef __LITTLE_ENDIAN_BITFIELD __u8 ver : 4; __u8 type : 4; #elif defined(__BIG_ENDIAN_BITFIELD) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ __u8 type : 4; __u8 ver : 4; #else #error "Please fix " /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #endif __u8 code; __be16 sid; __be16 length; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct pppoe_tag tag[0]; } __attribute__((packed)); #define PPPOE_SES_HLEN 8 #endif /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ android-audiosystem-1.8+13.10.20130807/include/linux/random.h0000644000015700001700000000210612200324306024104 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_RANDOM_H #define _LINUX_RANDOM_H #include #define RNDGETENTCNT _IOR( 'R', 0x00, int ) #define RNDADDTOENTCNT _IOW( 'R', 0x01, int ) #define RNDGETPOOL _IOR( 'R', 0x02, int [2] ) #define RNDADDENTROPY _IOW( 'R', 0x03, int [2] ) #define RNDZAPENTCNT _IO( 'R', 0x04 ) #define RNDCLEARPOOL _IO( 'R', 0x06 ) struct rand_pool_info { int entropy_count; int buf_size; __u32 buf[0]; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/lis331dlh.h0000644000015700001700000000230412200324306024332 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LIS331DLH_H__ #define __LIS331DLH_H__ #include #define LIS331DLH_IOCTL_BASE 77 #define LIS331DLH_IOCTL_SET_DELAY _IOW(LIS331DLH_IOCTL_BASE, 0, int) #define LIS331DLH_IOCTL_GET_DELAY _IOR(LIS331DLH_IOCTL_BASE, 1, int) #define LIS331DLH_IOCTL_SET_ENABLE _IOW(LIS331DLH_IOCTL_BASE, 2, int) #define LIS331DLH_IOCTL_GET_ENABLE _IOR(LIS331DLH_IOCTL_BASE, 3, int) #define LIS331DLH_IOCTL_SET_G_RANGE _IOW(LIS331DLH_IOCTL_BASE, 4, int) #define LIS331DLH_G_2G 0x00 #define LIS331DLH_G_4G 0x10 #define LIS331DLH_G_8G 0x30 #endif android-audiosystem-1.8+13.10.20130807/include/linux/elf-em.h0000644000015700001700000000253212200324306023774 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ELF_EM_H #define _LINUX_ELF_EM_H #define EM_NONE 0 #define EM_M32 1 #define EM_SPARC 2 #define EM_386 3 #define EM_68K 4 #define EM_88K 5 #define EM_486 6 #define EM_860 7 #define EM_MIPS 8 #define EM_MIPS_RS3_LE 10 #define EM_MIPS_RS4_BE 10 #define EM_PARISC 15 #define EM_SPARC32PLUS 18 #define EM_PPC 20 #define EM_PPC64 21 #define EM_SH 42 #define EM_SPARCV9 43 #define EM_IA_64 50 #define EM_X86_64 62 #define EM_S390 22 #define EM_CRIS 76 #define EM_V850 87 #define EM_M32R 88 #define EM_H8_300 46 #define EM_FRV 0x5441 #define EM_ALPHA 0x9026 #define EM_CYGNUS_V850 0x9080 #define EM_CYGNUS_M32R 0x9041 #define EM_S390_OLD 0xA390 #endif android-audiosystem-1.8+13.10.20130807/include/linux/time.h0000644000015700001700000000331112200324306023561 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_TIME_H #define _LINUX_TIME_H #include #ifndef _STRUCT_TIMESPEC #define _STRUCT_TIMESPEC struct timespec { time_t tv_sec; long tv_nsec; }; #endif struct timeval { time_t tv_sec; suseconds_t tv_usec; }; struct timezone { int tz_minuteswest; int tz_dsttime; }; #define NFDBITS __NFDBITS #define FD_SETSIZE __FD_SETSIZE #define FD_SET(fd,fdsetp) __FD_SET(fd,fdsetp) #define FD_CLR(fd,fdsetp) __FD_CLR(fd,fdsetp) #define FD_ISSET(fd,fdsetp) __FD_ISSET(fd,fdsetp) #define FD_ZERO(fdsetp) __FD_ZERO(fdsetp) #define ITIMER_REAL 0 #define ITIMER_VIRTUAL 1 #define ITIMER_PROF 2 struct itimerspec { struct timespec it_interval; struct timespec it_value; }; struct itimerval { struct timeval it_interval; struct timeval it_value; }; #define CLOCK_REALTIME 0 #define CLOCK_MONOTONIC 1 #define CLOCK_PROCESS_CPUTIME_ID 2 #define CLOCK_THREAD_CPUTIME_ID 3 #define CLOCK_SGI_CYCLE 10 #define MAX_CLOCKS 16 #define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC) #define CLOCKS_MONO CLOCK_MONOTONIC #define TIMER_ABSTIME 0x01 #endif android-audiosystem-1.8+13.10.20130807/include/linux/serial_reg.h0000644000015700001700000001473012200324306024746 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SERIAL_REG_H #define _LINUX_SERIAL_REG_H #define UART_RX 0 #define UART_TX 0 #define UART_IER 1 #define UART_IER_MSI 0x08 #define UART_IER_RLSI 0x04 #define UART_IER_THRI 0x02 #define UART_IER_RDI 0x01 #define UART_IERX_SLEEP 0x10 #define UART_IIR 2 #define UART_IIR_NO_INT 0x01 #define UART_IIR_ID 0x06 #define UART_IIR_MSI 0x00 #define UART_IIR_THRI 0x02 #define UART_IIR_RDI 0x04 #define UART_IIR_RLSI 0x06 #define UART_FCR 2 #define UART_FCR_ENABLE_FIFO 0x01 #define UART_FCR_CLEAR_RCVR 0x02 #define UART_FCR_CLEAR_XMIT 0x04 #define UART_FCR_DMA_SELECT 0x08 #define UART_FCR_R_TRIG_00 0x00 #define UART_FCR_R_TRIG_01 0x40 #define UART_FCR_R_TRIG_10 0x80 #define UART_FCR_R_TRIG_11 0xc0 #define UART_FCR_T_TRIG_00 0x00 #define UART_FCR_T_TRIG_01 0x10 #define UART_FCR_T_TRIG_10 0x20 #define UART_FCR_T_TRIG_11 0x30 #define UART_FCR_TRIGGER_MASK 0xC0 #define UART_FCR_TRIGGER_1 0x00 #define UART_FCR_TRIGGER_4 0x40 #define UART_FCR_TRIGGER_8 0x80 #define UART_FCR_TRIGGER_14 0xC0 #define UART_FCR6_R_TRIGGER_8 0x00 #define UART_FCR6_R_TRIGGER_16 0x40 #define UART_FCR6_R_TRIGGER_24 0x80 #define UART_FCR6_R_TRIGGER_28 0xC0 #define UART_FCR6_T_TRIGGER_16 0x00 #define UART_FCR6_T_TRIGGER_8 0x10 #define UART_FCR6_T_TRIGGER_24 0x20 #define UART_FCR6_T_TRIGGER_30 0x30 #define UART_FCR7_64BYTE 0x20 #define UART_LCR 3 #define UART_LCR_DLAB 0x80 #define UART_LCR_SBC 0x40 #define UART_LCR_SPAR 0x20 #define UART_LCR_EPAR 0x10 #define UART_LCR_PARITY 0x08 #define UART_LCR_STOP 0x04 #define UART_LCR_WLEN5 0x00 #define UART_LCR_WLEN6 0x01 #define UART_LCR_WLEN7 0x02 #define UART_LCR_WLEN8 0x03 #define UART_MCR 4 #define UART_MCR_CLKSEL 0x80 #define UART_MCR_TCRTLR 0x40 #define UART_MCR_XONANY 0x20 #define UART_MCR_AFE 0x20 #define UART_MCR_LOOP 0x10 #define UART_MCR_OUT2 0x08 #define UART_MCR_OUT1 0x04 #define UART_MCR_RTS 0x02 #define UART_MCR_DTR 0x01 #define UART_LSR 5 #define UART_LSR_TEMT 0x40 #define UART_LSR_THRE 0x20 #define UART_LSR_BI 0x10 #define UART_LSR_FE 0x08 #define UART_LSR_PE 0x04 #define UART_LSR_OE 0x02 #define UART_LSR_DR 0x01 #define UART_MSR 6 #define UART_MSR_DCD 0x80 #define UART_MSR_RI 0x40 #define UART_MSR_DSR 0x20 #define UART_MSR_CTS 0x10 #define UART_MSR_DDCD 0x08 #define UART_MSR_TERI 0x04 #define UART_MSR_DDSR 0x02 #define UART_MSR_DCTS 0x01 #define UART_MSR_ANY_DELTA 0x0F #define UART_SCR 7 #define UART_DLL 0 #define UART_DLM 1 #define UART_EFR 2 #define UART_EFR_CTS 0x80 #define UART_EFR_RTS 0x40 #define UART_EFR_SCD 0x20 #define UART_EFR_ECB 0x10 #define UART_XON1 4 #define UART_XON2 5 #define UART_XOFF1 6 #define UART_XOFF2 7 #define UART_TI752_TCR 6 #define UART_TI752_TLR 7 #define UART_TRG 0 #define UART_TRG_1 0x01 #define UART_TRG_4 0x04 #define UART_TRG_8 0x08 #define UART_TRG_16 0x10 #define UART_TRG_32 0x20 #define UART_TRG_64 0x40 #define UART_TRG_96 0x60 #define UART_TRG_120 0x78 #define UART_TRG_128 0x80 #define UART_FCTR 1 #define UART_FCTR_RTS_NODELAY 0x00 #define UART_FCTR_RTS_4DELAY 0x01 #define UART_FCTR_RTS_6DELAY 0x02 #define UART_FCTR_RTS_8DELAY 0x03 #define UART_FCTR_IRDA 0x04 #define UART_FCTR_TX_INT 0x08 #define UART_FCTR_TRGA 0x00 #define UART_FCTR_TRGB 0x10 #define UART_FCTR_TRGC 0x20 #define UART_FCTR_TRGD 0x30 #define UART_FCTR_SCR_SWAP 0x40 #define UART_FCTR_RX 0x00 #define UART_FCTR_TX 0x80 #define UART_EMSR 7 #define UART_EMSR_FIFO_COUNT 0x01 #define UART_EMSR_ALT_COUNT 0x02 #define UART_IER_DMAE 0x80 #define UART_IER_UUE 0x40 #define UART_IER_NRZE 0x20 #define UART_IER_RTOIE 0x10 #define UART_IIR_TOD 0x08 #define UART_FCR_PXAR1 0x00 #define UART_FCR_PXAR8 0x40 #define UART_FCR_PXAR16 0x80 #define UART_FCR_PXAR32 0xc0 #define UART_ASR 0x01 #define UART_RFL 0x03 #define UART_TFL 0x04 #define UART_ICR 0x05 #define UART_ACR 0x00 #define UART_CPR 0x01 #define UART_TCR 0x02 #define UART_CKS 0x03 #define UART_TTL 0x04 #define UART_RTL 0x05 #define UART_FCL 0x06 #define UART_FCH 0x07 #define UART_ID1 0x08 #define UART_ID2 0x09 #define UART_ID3 0x0A #define UART_REV 0x0B #define UART_CSR 0x0C #define UART_NMR 0x0D #define UART_CTR 0xFF #define UART_ACR_RXDIS 0x01 #define UART_ACR_TXDIS 0x02 #define UART_ACR_DSRFC 0x04 #define UART_ACR_TLENB 0x20 #define UART_ACR_ICRRD 0x40 #define UART_ACR_ASREN 0x80 #define UART_RSA_BASE (-8) #define UART_RSA_MSR ((UART_RSA_BASE) + 0) #define UART_RSA_MSR_SWAP (1 << 0) #define UART_RSA_MSR_FIFO (1 << 2) #define UART_RSA_MSR_FLOW (1 << 3) #define UART_RSA_MSR_ITYP (1 << 4) #define UART_RSA_IER ((UART_RSA_BASE) + 1) #define UART_RSA_IER_Rx_FIFO_H (1 << 0) #define UART_RSA_IER_Tx_FIFO_H (1 << 1) #define UART_RSA_IER_Tx_FIFO_E (1 << 2) #define UART_RSA_IER_Rx_TOUT (1 << 3) #define UART_RSA_IER_TIMER (1 << 4) #define UART_RSA_SRR ((UART_RSA_BASE) + 2) #define UART_RSA_SRR_Tx_FIFO_NEMP (1 << 0) #define UART_RSA_SRR_Tx_FIFO_NHFL (1 << 1) #define UART_RSA_SRR_Tx_FIFO_NFUL (1 << 2) #define UART_RSA_SRR_Rx_FIFO_NEMP (1 << 3) #define UART_RSA_SRR_Rx_FIFO_NHFL (1 << 4) #define UART_RSA_SRR_Rx_FIFO_NFUL (1 << 5) #define UART_RSA_SRR_Rx_TOUT (1 << 6) #define UART_RSA_SRR_TIMER (1 << 7) #define UART_RSA_FRR ((UART_RSA_BASE) + 2) #define UART_RSA_TIVSR ((UART_RSA_BASE) + 3) #define UART_RSA_TCR ((UART_RSA_BASE) + 4) #define UART_RSA_TCR_SWITCH (1 << 0) #define SERIAL_RSA_BAUD_BASE (921600) #define SERIAL_RSA_BAUD_BASE_LO (SERIAL_RSA_BAUD_BASE / 8) #define UART_OMAP_MDR1 0x08 #define UART_OMAP_MDR2 0x09 #define UART_OMAP_SCR 0x10 #define UART_OMAP_SSR 0x11 #define UART_OMAP_EBLR 0x12 #define UART_OMAP_OSC_12M_SEL 0x13 #define UART_OMAP_MVER 0x14 #define UART_OMAP_SYSC 0x15 #define UART_OMAP_SYSS 0x16 #endif android-audiosystem-1.8+13.10.20130807/include/linux/stacktrace.h0000644000015700001700000000152212200324306024751 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_STACKTRACE_H #define __LINUX_STACKTRACE_H #define save_stack_trace(trace, task, all, skip) do { } while (0) #define print_stack_trace(trace) do { } while (0) #endif android-audiosystem-1.8+13.10.20130807/include/linux/swap.h0000644000015700001700000000224512200324306023602 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SWAP_H #define _LINUX_SWAP_H #include #include #include #include #include #include #include #define SWAP_FLAG_PREFER 0x8000 #define SWAP_FLAG_PRIO_MASK 0x7fff #define SWAP_FLAG_PRIO_SHIFT 0 #define MAX_SWAPFILES_SHIFT 5 #define MAX_SWAPFILES (1 << MAX_SWAPFILES_SHIFT) typedef struct { unsigned long val; } swp_entry_t; struct reclaim_state { unsigned long reclaimed_slab; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/android_pmem.h0000644000015700001700000000272412200324306025270 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _ANDROID_PMEM_H_ #define _ANDROID_PMEM_H_ #define PMEM_IOCTL_MAGIC 'p' #define PMEM_GET_PHYS _IOW(PMEM_IOCTL_MAGIC, 1, unsigned int) #define PMEM_MAP _IOW(PMEM_IOCTL_MAGIC, 2, unsigned int) #define PMEM_GET_SIZE _IOW(PMEM_IOCTL_MAGIC, 3, unsigned int) #define PMEM_UNMAP _IOW(PMEM_IOCTL_MAGIC, 4, unsigned int) #define PMEM_ALLOCATE _IOW(PMEM_IOCTL_MAGIC, 5, unsigned int) #define PMEM_CONNECT _IOW(PMEM_IOCTL_MAGIC, 6, unsigned int) #define PMEM_GET_TOTAL_SIZE _IOW(PMEM_IOCTL_MAGIC, 7, unsigned int) #define PMEM_CACHE_FLUSH _IOW(PMEM_IOCTL_MAGIC, 8, unsigned int) struct android_pmem_platform_data { const char* name; unsigned long start; unsigned long size; unsigned no_allocator; unsigned cached; unsigned buffered; }; struct pmem_region { unsigned long offset; unsigned long len; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/kmod.h0000644000015700001700000000162012200324306023556 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_KMOD_H__ #define __LINUX_KMOD_H__ #include #include #include #define KMOD_PATH_LEN 256 #define try_then_request_module(x, mod...) ((x) ?: (request_module(mod), (x))) #endif android-audiosystem-1.8+13.10.20130807/include/linux/timer.h0000644000015700001700000000263112200324306023747 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_TIMER_H #define _LINUX_TIMER_H #include #include #include struct tvec_t_base_s; struct timer_list { struct list_head entry; unsigned long expires; void (*function)(unsigned long); unsigned long data; struct tvec_t_base_s *base; }; #define TIMER_INITIALIZER(_function, _expires, _data) { .function = (_function), .expires = (_expires), .data = (_data), .base = &boot_tvec_bases, } #define DEFINE_TIMER(_name, _function, _expires, _data) struct timer_list _name = TIMER_INITIALIZER(_function, _expires, _data) #define try_to_del_timer_sync(t) del_timer(t) #define del_timer_sync(t) del_timer(t) #define del_singleshot_timer_sync(t) del_timer_sync(t) struct hrtimer; #endif android-audiosystem-1.8+13.10.20130807/include/linux/kernel.h0000644000015700001700000000241412200324306024106 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_KERNEL_H #define _LINUX_KERNEL_H #define SI_LOAD_SHIFT 16 struct sysinfo { long uptime; unsigned long loads[3]; unsigned long totalram; unsigned long freeram; unsigned long sharedram; unsigned long bufferram; unsigned long totalswap; unsigned long freeswap; unsigned short procs; unsigned short pad; unsigned long totalhigh; unsigned long freehigh; unsigned int mem_unit; char _f[20-2*sizeof(long)-sizeof(int)]; }; #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) #define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1) #define __FUNCTION__ (__func__) #endif android-audiosystem-1.8+13.10.20130807/include/linux/if_tun.h0000644000015700001700000000442612200324306024117 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __IF_TUN_H #define __IF_TUN_H #include #include #include #define TUN_READQ_SIZE 500 #define TUN_TUN_DEV 0x0001 #define TUN_TAP_DEV 0x0002 #define TUN_TYPE_MASK 0x000f #define TUN_FASYNC 0x0010 #define TUN_NOCHECKSUM 0x0020 #define TUN_NO_PI 0x0040 #define TUN_ONE_QUEUE 0x0080 #define TUN_PERSIST 0x0100 #define TUN_VNET_HDR 0x0200 #define TUNSETNOCSUM _IOW('T', 200, int) #define TUNSETDEBUG _IOW('T', 201, int) #define TUNSETIFF _IOW('T', 202, int) #define TUNSETPERSIST _IOW('T', 203, int) #define TUNSETOWNER _IOW('T', 204, int) #define TUNSETLINK _IOW('T', 205, int) #define TUNSETGROUP _IOW('T', 206, int) #define TUNGETFEATURES _IOR('T', 207, unsigned int) #define TUNSETOFFLOAD _IOW('T', 208, unsigned int) #define TUNSETTXFILTER _IOW('T', 209, unsigned int) #define TUNGETIFF _IOR('T', 210, unsigned int) #define TUNGETSNDBUF _IOR('T', 211, int) #define TUNSETSNDBUF _IOW('T', 212, int) #define TUNATTACHFILTER _IOW('T', 213, struct sock_fprog) #define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog) #define TUNGETVNETHDRSZ _IOR('T', 215, int) #define TUNSETVNETHDRSZ _IOW('T', 216, int) #define IFF_TUN 0x0001 #define IFF_TAP 0x0002 #define IFF_NO_PI 0x1000 #define IFF_ONE_QUEUE 0x2000 #define IFF_VNET_HDR 0x4000 #define IFF_TUN_EXCL 0x8000 #define TUN_F_CSUM 0x01 #define TUN_F_TSO4 0x02 #define TUN_F_TSO6 0x04 #define TUN_F_TSO_ECN 0x08 #define TUN_F_UFO 0x10 #define TUN_PKT_STRIP 0x0001 struct tun_pi { __u16 flags; __be16 proto; }; #define TUN_FLT_ALLMULTI 0x0001 struct tun_filter { __u16 flags; __u16 count; __u8 addr[0][ETH_ALEN]; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_arp.h0000644000015700001700000000156012200324306025465 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_ARP_NETFILTER_H #define __LINUX_ARP_NETFILTER_H #include #define NF_ARP 0 #define NF_ARP_IN 0 #define NF_ARP_OUT 1 #define NF_ARP_FORWARD 2 #define NF_ARP_NUMHOOKS 3 #endif android-audiosystem-1.8+13.10.20130807/include/linux/ncp.h0000644000015700001700000001160112200324306023404 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_NCP_H #define _LINUX_NCP_H #include #define NCP_PTYPE (0x11) #define NCP_PORT (0x0451) #define NCP_ALLOC_SLOT_REQUEST (0x1111) #define NCP_REQUEST (0x2222) #define NCP_DEALLOC_SLOT_REQUEST (0x5555) struct ncp_request_header { __u16 type; __u8 sequence; __u8 conn_low; __u8 task; __u8 conn_high; __u8 function; __u8 data[0]; } __attribute__((packed)); #define NCP_REPLY (0x3333) #define NCP_WATCHDOG (0x3E3E) #define NCP_POSITIVE_ACK (0x9999) struct ncp_reply_header { __u16 type; __u8 sequence; __u8 conn_low; __u8 task; __u8 conn_high; __u8 completion_code; __u8 connection_state; __u8 data[0]; } __attribute__((packed)); #define NCP_VOLNAME_LEN (16) #define NCP_NUMBER_OF_VOLUMES (256) struct ncp_volume_info { __u32 total_blocks; __u32 free_blocks; __u32 purgeable_blocks; __u32 not_yet_purgeable_blocks; __u32 total_dir_entries; __u32 available_dir_entries; __u8 sectors_per_block; char volume_name[NCP_VOLNAME_LEN + 1]; }; #define AR_READ (cpu_to_le16(1)) #define AR_WRITE (cpu_to_le16(2)) #define AR_EXCLUSIVE (cpu_to_le16(0x20)) #define NCP_FILE_ID_LEN 6 #define NW_NS_DOS 0 #define NW_NS_MAC 1 #define NW_NS_NFS 2 #define NW_NS_FTAM 3 #define NW_NS_OS2 4 #define RIM_NAME (cpu_to_le32(1)) #define RIM_SPACE_ALLOCATED (cpu_to_le32(2)) #define RIM_ATTRIBUTES (cpu_to_le32(4)) #define RIM_DATA_SIZE (cpu_to_le32(8)) #define RIM_TOTAL_SIZE (cpu_to_le32(0x10)) #define RIM_EXT_ATTR_INFO (cpu_to_le32(0x20)) #define RIM_ARCHIVE (cpu_to_le32(0x40)) #define RIM_MODIFY (cpu_to_le32(0x80)) #define RIM_CREATION (cpu_to_le32(0x100)) #define RIM_OWNING_NAMESPACE (cpu_to_le32(0x200)) #define RIM_DIRECTORY (cpu_to_le32(0x400)) #define RIM_RIGHTS (cpu_to_le32(0x800)) #define RIM_ALL (cpu_to_le32(0xFFF)) #define RIM_COMPRESSED_INFO (cpu_to_le32(0x80000000)) #define NSIBM_NFS_NAME 0x0001 #define NSIBM_NFS_MODE 0x0002 #define NSIBM_NFS_GID 0x0004 #define NSIBM_NFS_NLINKS 0x0008 #define NSIBM_NFS_RDEV 0x0010 #define NSIBM_NFS_LINK 0x0020 #define NSIBM_NFS_CREATED 0x0040 #define NSIBM_NFS_UID 0x0080 #define NSIBM_NFS_ACSFLAG 0x0100 #define NSIBM_NFS_MYFLAG 0x0200 #define OC_MODE_OPEN 0x01 #define OC_MODE_TRUNCATE 0x02 #define OC_MODE_REPLACE 0x02 #define OC_MODE_CREATE 0x08 #define OC_ACTION_NONE 0x00 #define OC_ACTION_OPEN 0x01 #define OC_ACTION_CREATE 0x02 #define OC_ACTION_TRUNCATE 0x04 #define OC_ACTION_REPLACE 0x04 #ifndef AR_READ_ONLY #define AR_READ_ONLY 0x0001 #define AR_WRITE_ONLY 0x0002 #define AR_DENY_READ 0x0004 #define AR_DENY_WRITE 0x0008 #define AR_COMPATIBILITY 0x0010 #define AR_WRITE_THROUGH 0x0040 #define AR_OPEN_COMPRESSED 0x0100 #endif struct nw_nfs_info { __u32 mode; __u32 rdev; }; struct nw_info_struct { __u32 spaceAlloc; __le32 attributes; __u16 flags; __le32 dataStreamSize; __le32 totalStreamSize; __u16 numberOfStreams; __le16 creationTime; __le16 creationDate; __u32 creatorID; __le16 modifyTime; __le16 modifyDate; __u32 modifierID; __le16 lastAccessDate; __u16 archiveTime; __u16 archiveDate; __u32 archiverID; __u16 inheritedRightsMask; __le32 dirEntNum; __le32 DosDirNum; __u32 volNumber; __u32 EADataSize; __u32 EAKeyCount; __u32 EAKeySize; __u32 NSCreator; __u8 nameLen; __u8 entryName[256]; } __attribute__((packed)); #define DM_ATTRIBUTES (cpu_to_le32(0x02)) #define DM_CREATE_DATE (cpu_to_le32(0x04)) #define DM_CREATE_TIME (cpu_to_le32(0x08)) #define DM_CREATOR_ID (cpu_to_le32(0x10)) #define DM_ARCHIVE_DATE (cpu_to_le32(0x20)) #define DM_ARCHIVE_TIME (cpu_to_le32(0x40)) #define DM_ARCHIVER_ID (cpu_to_le32(0x80)) #define DM_MODIFY_DATE (cpu_to_le32(0x0100)) #define DM_MODIFY_TIME (cpu_to_le32(0x0200)) #define DM_MODIFIER_ID (cpu_to_le32(0x0400)) #define DM_LAST_ACCESS_DATE (cpu_to_le32(0x0800)) #define DM_INHERITED_RIGHTS_MASK (cpu_to_le32(0x1000)) #define DM_MAXIMUM_SPACE (cpu_to_le32(0x2000)) struct nw_modify_dos_info { __le32 attributes; __le16 creationDate; __le16 creationTime; __u32 creatorID; __le16 modifyDate; __le16 modifyTime; __u32 modifierID; __u16 archiveDate; __u16 archiveTime; __u32 archiverID; __le16 lastAccessDate; __u16 inheritanceGrantMask; __u16 inheritanceRevokeMask; __u32 maximumSpace; } __attribute__((packed)); struct nw_search_sequence { __u8 volNumber; __u32 dirBase; __u32 sequence; } __attribute__((packed)); #endif android-audiosystem-1.8+13.10.20130807/include/linux/binder.h0000644000015700001700000001067612200324306024102 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_BINDER_H #define _LINUX_BINDER_H #include #define B_PACK_CHARS(c1, c2, c3, c4) ((((c1)<<24)) | (((c2)<<16)) | (((c3)<<8)) | (c4)) #define B_TYPE_LARGE 0x85 enum { BINDER_TYPE_BINDER = B_PACK_CHARS('s', 'b', '*', B_TYPE_LARGE), BINDER_TYPE_WEAK_BINDER = B_PACK_CHARS('w', 'b', '*', B_TYPE_LARGE), BINDER_TYPE_HANDLE = B_PACK_CHARS('s', 'h', '*', B_TYPE_LARGE), BINDER_TYPE_WEAK_HANDLE = B_PACK_CHARS('w', 'h', '*', B_TYPE_LARGE), BINDER_TYPE_FD = B_PACK_CHARS('f', 'd', '*', B_TYPE_LARGE), }; enum { FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff, FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100, }; struct flat_binder_object { unsigned long type; unsigned long flags; union { void *binder; signed long handle; }; void *cookie; }; struct binder_write_read { signed long write_size; signed long write_consumed; unsigned long write_buffer; signed long read_size; signed long read_consumed; unsigned long read_buffer; }; struct binder_version { signed long protocol_version; }; #define BINDER_CURRENT_PROTOCOL_VERSION 7 #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, int64_t) #define BINDER_SET_MAX_THREADS _IOW('b', 5, size_t) #define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, int) #define BINDER_SET_CONTEXT_MGR _IOW('b', 7, int) #define BINDER_THREAD_EXIT _IOW('b', 8, int) #define BINDER_VERSION _IOWR('b', 9, struct binder_version) enum transaction_flags { TF_ONE_WAY = 0x01, TF_ROOT_OBJECT = 0x04, TF_STATUS_CODE = 0x08, TF_ACCEPT_FDS = 0x10, }; struct binder_transaction_data { union { size_t handle; void *ptr; } target; void *cookie; unsigned int code; unsigned int flags; pid_t sender_pid; uid_t sender_euid; size_t data_size; size_t offsets_size; union { struct { const void *buffer; const void *offsets; } ptr; uint8_t buf[8]; } data; }; struct binder_ptr_cookie { void *ptr; void *cookie; }; struct binder_pri_desc { int priority; int desc; }; struct binder_pri_ptr_cookie { int priority; void *ptr; void *cookie; }; enum BinderDriverReturnProtocol { BR_ERROR = _IOR_BAD('r', 0, int), BR_OK = _IO('r', 1), BR_TRANSACTION = _IOR_BAD('r', 2, struct binder_transaction_data), BR_REPLY = _IOR_BAD('r', 3, struct binder_transaction_data), BR_ACQUIRE_RESULT = _IOR_BAD('r', 4, int), BR_DEAD_REPLY = _IO('r', 5), BR_TRANSACTION_COMPLETE = _IO('r', 6), BR_INCREFS = _IOR_BAD('r', 7, struct binder_ptr_cookie), BR_ACQUIRE = _IOR_BAD('r', 8, struct binder_ptr_cookie), BR_RELEASE = _IOR_BAD('r', 9, struct binder_ptr_cookie), BR_DECREFS = _IOR_BAD('r', 10, struct binder_ptr_cookie), BR_ATTEMPT_ACQUIRE = _IOR_BAD('r', 11, struct binder_pri_ptr_cookie), BR_NOOP = _IO('r', 12), BR_SPAWN_LOOPER = _IO('r', 13), BR_FINISHED = _IO('r', 14), BR_DEAD_BINDER = _IOR_BAD('r', 15, void *), BR_CLEAR_DEATH_NOTIFICATION_DONE = _IOR_BAD('r', 16, void *), BR_FAILED_REPLY = _IO('r', 17), }; enum BinderDriverCommandProtocol { BC_TRANSACTION = _IOW_BAD('c', 0, struct binder_transaction_data), BC_REPLY = _IOW_BAD('c', 1, struct binder_transaction_data), BC_ACQUIRE_RESULT = _IOW_BAD('c', 2, int), BC_FREE_BUFFER = _IOW_BAD('c', 3, int), BC_INCREFS = _IOW_BAD('c', 4, int), BC_ACQUIRE = _IOW_BAD('c', 5, int), BC_RELEASE = _IOW_BAD('c', 6, int), BC_DECREFS = _IOW_BAD('c', 7, int), BC_INCREFS_DONE = _IOW_BAD('c', 8, struct binder_ptr_cookie), BC_ACQUIRE_DONE = _IOW_BAD('c', 9, struct binder_ptr_cookie), BC_ATTEMPT_ACQUIRE = _IOW_BAD('c', 10, struct binder_pri_desc), BC_REGISTER_LOOPER = _IO('c', 11), BC_ENTER_LOOPER = _IO('c', 12), BC_EXIT_LOOPER = _IO('c', 13), BC_REQUEST_DEATH_NOTIFICATION = _IOW_BAD('c', 14, struct binder_ptr_cookie), BC_CLEAR_DEATH_NOTIFICATION = _IOW_BAD('c', 15, struct binder_ptr_cookie), BC_DEAD_BINDER_DONE = _IOW_BAD('c', 16, void *), }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/cache.h0000644000015700001700000000306512200324306023674 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_CACHE_H #define __LINUX_CACHE_H #include #include #ifndef L1_CACHE_ALIGN #define L1_CACHE_ALIGN(x) ALIGN(x, L1_CACHE_BYTES) #endif #ifndef SMP_CACHE_BYTES #define SMP_CACHE_BYTES L1_CACHE_BYTES #endif #ifndef __read_mostly #define __read_mostly #endif #ifndef ____cacheline_aligned #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES))) #endif #ifndef ____cacheline_aligned_in_smp #define ____cacheline_aligned_in_smp #endif #ifndef __cacheline_aligned #define __cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES), __section__(".data.cacheline_aligned"))) #endif #ifndef __cacheline_aligned_in_smp #define __cacheline_aligned_in_smp #endif #ifndef INTERNODE_CACHE_SHIFT #define INTERNODE_CACHE_SHIFT L1_CACHE_SHIFT #endif #ifndef ____cacheline_internodealigned_in_smp #define ____cacheline_internodealigned_in_smp #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/omap_csmi.h0000644000015700001700000000173312200324306024600 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _OMAP_CSMI_H_ #define _OMAP_CSMI_H_ #include #define OMAP_CSMI_TTY_ENABLE_ACK _IO('c', 0) #define OMAP_CSMI_TTY_DISABLE_ACK _IO('c', 1) #define OMAP_CSMI_TTY_READ_UNACKED _IOR('c', 2, int) #define OMAP_CSMI_TTY_ACK _IOW('c', 3, int) #define OMAP_CSMI_TTY_WAKEUP_AND_ACK _IOW('c', 4, int) #endif android-audiosystem-1.8+13.10.20130807/include/linux/videodev.h0000644000015700001700000001555312200324306024443 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_VIDEODEV_H #define __LINUX_VIDEODEV_H #include #include #include #define VID_TYPE_CAPTURE 1 #define VID_TYPE_TUNER 2 #define VID_TYPE_TELETEXT 4 #define VID_TYPE_OVERLAY 8 #define VID_TYPE_CHROMAKEY 16 #define VID_TYPE_CLIPPING 32 #define VID_TYPE_FRAMERAM 64 #define VID_TYPE_SCALES 128 #define VID_TYPE_MONOCHROME 256 #define VID_TYPE_SUBCAPTURE 512 #define VID_TYPE_MPEG_DECODER 1024 #define VID_TYPE_MPEG_ENCODER 2048 #define VID_TYPE_MJPEG_DECODER 4096 #define VID_TYPE_MJPEG_ENCODER 8192 struct video_capability { char name[32]; int type; int channels; int audios; int maxwidth; int maxheight; int minwidth; int minheight; }; struct video_channel { int channel; char name[32]; int tuners; __u32 flags; #define VIDEO_VC_TUNER 1 #define VIDEO_VC_AUDIO 2 __u16 type; #define VIDEO_TYPE_TV 1 #define VIDEO_TYPE_CAMERA 2 __u16 norm; }; struct video_tuner { int tuner; char name[32]; unsigned long rangelow, rangehigh; __u32 flags; #define VIDEO_TUNER_PAL 1 #define VIDEO_TUNER_NTSC 2 #define VIDEO_TUNER_SECAM 4 #define VIDEO_TUNER_LOW 8 #define VIDEO_TUNER_NORM 16 #define VIDEO_TUNER_STEREO_ON 128 #define VIDEO_TUNER_RDS_ON 256 #define VIDEO_TUNER_MBS_ON 512 __u16 mode; #define VIDEO_MODE_PAL 0 #define VIDEO_MODE_NTSC 1 #define VIDEO_MODE_SECAM 2 #define VIDEO_MODE_AUTO 3 __u16 signal; }; struct video_picture { __u16 brightness; __u16 hue; __u16 colour; __u16 contrast; __u16 whiteness; __u16 depth; __u16 palette; #define VIDEO_PALETTE_GREY 1 #define VIDEO_PALETTE_HI240 2 #define VIDEO_PALETTE_RGB565 3 #define VIDEO_PALETTE_RGB24 4 #define VIDEO_PALETTE_RGB32 5 #define VIDEO_PALETTE_RGB555 6 #define VIDEO_PALETTE_YUV422 7 #define VIDEO_PALETTE_YUYV 8 #define VIDEO_PALETTE_UYVY 9 #define VIDEO_PALETTE_YUV420 10 #define VIDEO_PALETTE_YUV411 11 #define VIDEO_PALETTE_RAW 12 #define VIDEO_PALETTE_YUV422P 13 #define VIDEO_PALETTE_YUV411P 14 #define VIDEO_PALETTE_YUV420P 15 #define VIDEO_PALETTE_YUV410P 16 #define VIDEO_PALETTE_PLANAR 13 #define VIDEO_PALETTE_COMPONENT 7 }; struct video_audio { int audio; __u16 volume; __u16 bass, treble; __u32 flags; #define VIDEO_AUDIO_MUTE 1 #define VIDEO_AUDIO_MUTABLE 2 #define VIDEO_AUDIO_VOLUME 4 #define VIDEO_AUDIO_BASS 8 #define VIDEO_AUDIO_TREBLE 16 #define VIDEO_AUDIO_BALANCE 32 char name[16]; #define VIDEO_SOUND_MONO 1 #define VIDEO_SOUND_STEREO 2 #define VIDEO_SOUND_LANG1 4 #define VIDEO_SOUND_LANG2 8 __u16 mode; __u16 balance; __u16 step; }; struct video_clip { __s32 x,y; __s32 width, height; struct video_clip *next; }; struct video_window { __u32 x,y; __u32 width,height; __u32 chromakey; __u32 flags; struct video_clip __user *clips; int clipcount; #define VIDEO_WINDOW_INTERLACE 1 #define VIDEO_WINDOW_CHROMAKEY 16 #define VIDEO_CLIP_BITMAP -1 #define VIDEO_CLIPMAP_SIZE (128 * 625) }; struct video_capture { __u32 x,y; __u32 width, height; __u16 decimation; __u16 flags; #define VIDEO_CAPTURE_ODD 0 #define VIDEO_CAPTURE_EVEN 1 }; struct video_buffer { void *base; int height,width; int depth; int bytesperline; }; struct video_mmap { unsigned int frame; int height,width; unsigned int format; }; struct video_key { __u8 key[8]; __u32 flags; }; struct video_mbuf { int size; int frames; int offsets[VIDEO_MAX_FRAME]; }; #define VIDEO_NO_UNIT (-1) struct video_unit { int video; int vbi; int radio; int audio; int teletext; }; struct vbi_format { __u32 sampling_rate; __u32 samples_per_line; __u32 sample_format; __s32 start[2]; __u32 count[2]; __u32 flags; #define VBI_UNSYNC 1 #define VBI_INTERLACED 2 }; struct video_info { __u32 frame_count; __u32 h_size; __u32 v_size; __u32 smpte_timecode; __u32 picture_type; __u32 temporal_reference; __u8 user_data[256]; }; struct video_play_mode { int mode; int p1; int p2; }; struct video_code { char loadwhat[16]; int datasize; __u8 *data; }; #define VIDIOCGCAP _IOR('v',1,struct video_capability) #define VIDIOCGCHAN _IOWR('v',2,struct video_channel) #define VIDIOCSCHAN _IOW('v',3,struct video_channel) #define VIDIOCGTUNER _IOWR('v',4,struct video_tuner) #define VIDIOCSTUNER _IOW('v',5,struct video_tuner) #define VIDIOCGPICT _IOR('v',6,struct video_picture) #define VIDIOCSPICT _IOW('v',7,struct video_picture) #define VIDIOCCAPTURE _IOW('v',8,int) #define VIDIOCGWIN _IOR('v',9, struct video_window) #define VIDIOCSWIN _IOW('v',10, struct video_window) #define VIDIOCGFBUF _IOR('v',11, struct video_buffer) #define VIDIOCSFBUF _IOW('v',12, struct video_buffer) #define VIDIOCKEY _IOR('v',13, struct video_key) #define VIDIOCGFREQ _IOR('v',14, unsigned long) #define VIDIOCSFREQ _IOW('v',15, unsigned long) #define VIDIOCGAUDIO _IOR('v',16, struct video_audio) #define VIDIOCSAUDIO _IOW('v',17, struct video_audio) #define VIDIOCSYNC _IOW('v',18, int) #define VIDIOCMCAPTURE _IOW('v',19, struct video_mmap) #define VIDIOCGMBUF _IOR('v',20, struct video_mbuf) #define VIDIOCGUNIT _IOR('v',21, struct video_unit) #define VIDIOCGCAPTURE _IOR('v',22, struct video_capture) #define VIDIOCSCAPTURE _IOW('v',23, struct video_capture) #define VIDIOCSPLAYMODE _IOW('v',24, struct video_play_mode) #define VIDIOCSWRITEMODE _IOW('v',25, int) #define VIDIOCGPLAYINFO _IOR('v',26, struct video_info) #define VIDIOCSMICROCODE _IOW('v',27, struct video_code) #define VIDIOCGVBIFMT _IOR('v',28, struct vbi_format) #define VIDIOCSVBIFMT _IOW('v',29, struct vbi_format) #define BASE_VIDIOCPRIVATE 192 #define VID_WRITE_MPEG_AUD 0 #define VID_WRITE_MPEG_VID 1 #define VID_WRITE_OSD 2 #define VID_WRITE_TTX 3 #define VID_WRITE_CC 4 #define VID_WRITE_MJPEG 5 #define VID_PLAY_VID_OUT_MODE 0 #define VID_PLAY_GENLOCK 1 #define VID_PLAY_NORMAL 2 #define VID_PLAY_PAUSE 3 #define VID_PLAY_SINGLE_FRAME 4 #define VID_PLAY_FAST_FORWARD 5 #define VID_PLAY_SLOW_MOTION 6 #define VID_PLAY_IMMEDIATE_NORMAL 7 #define VID_PLAY_SWITCH_CHANNELS 8 #define VID_PLAY_FREEZE_FRAME 9 #define VID_PLAY_STILL_MODE 10 #define VID_PLAY_MASTER_MODE 11 #define VID_PLAY_MASTER_NONE 1 #define VID_PLAY_MASTER_VIDEO 2 #define VID_PLAY_MASTER_AUDIO 3 #define VID_PLAY_ACTIVE_SCANLINES 12 #define VID_PLAY_RESET 13 #define VID_PLAY_END_MARK 14 #endif android-audiosystem-1.8+13.10.20130807/include/linux/efs_dir.h0000644000015700001700000000261512200324306024244 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __EFS_DIR_H__ #define __EFS_DIR_H__ #define EFS_DIRBSIZE_BITS EFS_BLOCKSIZE_BITS #define EFS_DIRBSIZE (1 << EFS_DIRBSIZE_BITS) struct efs_dentry { __be32 inode; unsigned char namelen; char name[3]; }; #define EFS_DENTSIZE (sizeof(struct efs_dentry) - 3 + 1) #define EFS_MAXNAMELEN ((1 << (sizeof(char) * 8)) - 1) #define EFS_DIRBLK_HEADERSIZE 4 #define EFS_DIRBLK_MAGIC 0xbeef struct efs_dir { __be16 magic; unsigned char firstused; unsigned char slots; unsigned char space[EFS_DIRBSIZE - EFS_DIRBLK_HEADERSIZE]; }; #define EFS_MAXENTS ((EFS_DIRBSIZE - EFS_DIRBLK_HEADERSIZE) / (EFS_DENTSIZE + sizeof(char))) #define EFS_SLOTAT(dir, slot) EFS_REALOFF((dir)->space[slot]) #define EFS_REALOFF(offset) ((offset << 1)) #endif android-audiosystem-1.8+13.10.20130807/include/linux/if_fc.h0000644000015700001700000000200412200324306023667 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IF_FC_H #define _LINUX_IF_FC_H #define FC_ALEN 6 #define FC_HLEN (sizeof(struct fch_hdr)+sizeof(struct fcllc)) #define FC_ID_LEN 3 #define EXTENDED_SAP 0xAA #define UI_CMD 0x03 struct fch_hdr { __u8 daddr[FC_ALEN]; __u8 saddr[FC_ALEN]; }; struct fcllc { __u8 dsap; __u8 ssap; __u8 llc; __u8 protid[3]; __be16 ethertype; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/kexec.h0000644000015700001700000000136312200324306023727 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef LINUX_KEXEC_H #define LINUX_KEXEC_H struct pt_regs; struct task_struct; #endif android-audiosystem-1.8+13.10.20130807/include/linux/nfsacl.h0000644000015700001700000000203312200324306024071 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_NFSACL_H #define __LINUX_NFSACL_H #define NFS_ACL_PROGRAM 100227 #define ACLPROC2_GETACL 1 #define ACLPROC2_SETACL 2 #define ACLPROC2_GETATTR 3 #define ACLPROC2_ACCESS 4 #define ACLPROC3_GETACL 1 #define ACLPROC3_SETACL 2 #define NFS_ACL 0x0001 #define NFS_ACLCNT 0x0002 #define NFS_DFACL 0x0004 #define NFS_DFACLCNT 0x0008 #define NFS_ACL_DEFAULT 0x1000 #endif android-audiosystem-1.8+13.10.20130807/include/linux/socket.h0000644000015700001700000001325212200324306024120 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SOCKET_H #define _LINUX_SOCKET_H #define _K_SS_MAXSIZE 128 #define _K_SS_ALIGNSIZE (__alignof__ (struct sockaddr *)) struct __kernel_sockaddr_storage { unsigned short ss_family; char __data[_K_SS_MAXSIZE - sizeof(unsigned short)]; } __attribute__ ((aligned(_K_SS_ALIGNSIZE))); #if !defined(__GLIBC__) || __GLIBC__ < 2 #include #include #include #include #include typedef unsigned short sa_family_t; struct sockaddr { sa_family_t sa_family; char sa_data[14]; }; struct linger { int l_onoff; int l_linger; }; #define sockaddr_storage __kernel_sockaddr_storage struct msghdr { void * msg_name; int msg_namelen; struct iovec * msg_iov; __kernel_size_t msg_iovlen; void * msg_control; __kernel_size_t msg_controllen; unsigned msg_flags; }; struct cmsghdr { __kernel_size_t cmsg_len; int cmsg_level; int cmsg_type; }; #define __CMSG_NXTHDR(ctl, len, cmsg) __cmsg_nxthdr((ctl),(len),(cmsg)) #define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr((mhdr), (cmsg)) #define CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) ) #define CMSG_DATA(cmsg) ((void *)((char *)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr)))) #define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len)) #define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) #define __CMSG_FIRSTHDR(ctl,len) ((len) >= sizeof(struct cmsghdr) ? (struct cmsghdr *)(ctl) : (struct cmsghdr *)NULL) #define CMSG_FIRSTHDR(msg) __CMSG_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen) #define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) && (cmsg)->cmsg_len <= (unsigned long) ((mhdr)->msg_controllen - ((char *)(cmsg) - (char *)(mhdr)->msg_control))) #ifdef __GNUC__ #define __KINLINE static __inline__ #elif defined(__cplusplus) #define __KINLINE static inline #else #define __KINLINE static #endif __KINLINE struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size, struct cmsghdr *__cmsg) { struct cmsghdr * __ptr; __ptr = (struct cmsghdr*)(((unsigned char *) __cmsg) + CMSG_ALIGN(__cmsg->cmsg_len)); if ((unsigned long)((char*)(__ptr+1) - (char *) __ctl) > __size) return (struct cmsghdr *)0; return __ptr; } __KINLINE struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__cmsg) { return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg); } #define SCM_RIGHTS 0x01 #define SCM_CREDENTIALS 0x02 #define SCM_SECURITY 0x03 struct ucred { __u32 pid; __u32 uid; __u32 gid; }; #define AF_UNSPEC 0 #define AF_UNIX 1 #define AF_LOCAL 1 #define AF_INET 2 #define AF_AX25 3 #define AF_IPX 4 #define AF_APPLETALK 5 #define AF_NETROM 6 #define AF_BRIDGE 7 #define AF_ATMPVC 8 #define AF_X25 9 #define AF_INET6 10 #define AF_ROSE 11 #define AF_DECnet 12 #define AF_NETBEUI 13 #define AF_SECURITY 14 #define AF_KEY 15 #define AF_NETLINK 16 #define AF_ROUTE AF_NETLINK #define AF_PACKET 17 #define AF_ASH 18 #define AF_ECONET 19 #define AF_ATMSVC 20 #define AF_SNA 22 #define AF_IRDA 23 #define AF_PPPOX 24 #define AF_WANPIPE 25 #define AF_LLC 26 #define AF_TIPC 30 #define AF_BLUETOOTH 31 #define AF_CAIF 38 #define AF_MAX 39 #define PF_UNSPEC AF_UNSPEC #define PF_UNIX AF_UNIX #define PF_LOCAL AF_LOCAL #define PF_INET AF_INET #define PF_AX25 AF_AX25 #define PF_IPX AF_IPX #define PF_APPLETALK AF_APPLETALK #define PF_NETROM AF_NETROM #define PF_BRIDGE AF_BRIDGE #define PF_ATMPVC AF_ATMPVC #define PF_X25 AF_X25 #define PF_INET6 AF_INET6 #define PF_ROSE AF_ROSE #define PF_DECnet AF_DECnet #define PF_NETBEUI AF_NETBEUI #define PF_SECURITY AF_SECURITY #define PF_KEY AF_KEY #define PF_NETLINK AF_NETLINK #define PF_ROUTE AF_ROUTE #define PF_PACKET AF_PACKET #define PF_ASH AF_ASH #define PF_ECONET AF_ECONET #define PF_ATMSVC AF_ATMSVC #define PF_SNA AF_SNA #define PF_IRDA AF_IRDA #define PF_PPPOX AF_PPPOX #define PF_WANPIPE AF_WANPIPE #define PF_LLC AF_LLC #define PF_TIPC AF_TIPC #define PF_BLUETOOTH AF_BLUETOOTH #define PF_CAIF AF_CAIF #define PF_MAX AF_MAX #define SOMAXCONN 128 #define MSG_OOB 1 #define MSG_PEEK 2 #define MSG_DONTROUTE 4 #define MSG_TRYHARD 4 #define MSG_CTRUNC 8 #define MSG_PROBE 0x10 #define MSG_TRUNC 0x20 #define MSG_DONTWAIT 0x40 #define MSG_EOR 0x80 #define MSG_WAITALL 0x100 #define MSG_FIN 0x200 #define MSG_SYN 0x400 #define MSG_CONFIRM 0x800 #define MSG_RST 0x1000 #define MSG_ERRQUEUE 0x2000 #define MSG_NOSIGNAL 0x4000 #define MSG_MORE 0x8000 #define MSG_EOF MSG_FIN #define MSG_CMSG_COMPAT 0 #define SOL_IP 0 #define SOL_TCP 6 #define SOL_UDP 17 #define SOL_IPV6 41 #define SOL_ICMPV6 58 #define SOL_SCTP 132 #define SOL_RAW 255 #define SOL_IPX 256 #define SOL_AX25 257 #define SOL_ATALK 258 #define SOL_NETROM 259 #define SOL_ROSE 260 #define SOL_DECNET 261 #define SOL_X25 262 #define SOL_PACKET 263 #define SOL_ATM 264 #define SOL_AAL 265 #define SOL_IRDA 266 #define SOL_NETBEUI 267 #define SOL_LLC 268 #define SOL_DCCP 269 #define SOL_NETLINK 270 #define SOL_TIPC 271 #define IPX_TYPE 1 #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/netfilter_ipv4.h0000644000015700001700000000351312200324306025565 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_IP_NETFILTER_H #define __LINUX_IP_NETFILTER_H #include #define NFC_IP_SRC 0x0001 #define NFC_IP_DST 0x0002 #define NFC_IP_IF_IN 0x0004 #define NFC_IP_IF_OUT 0x0008 #define NFC_IP_TOS 0x0010 #define NFC_IP_PROTO 0x0020 #define NFC_IP_OPTIONS 0x0040 #define NFC_IP_FRAG 0x0080 #define NFC_IP_TCPFLAGS 0x0100 #define NFC_IP_SRC_PT 0x0200 #define NFC_IP_DST_PT 0x0400 #define NFC_IP_PROTO_UNKNOWN 0x2000 #define NF_IP_PRE_ROUTING 0 #define NF_IP_LOCAL_IN 1 #define NF_IP_FORWARD 2 #define NF_IP_LOCAL_OUT 3 #define NF_IP_POST_ROUTING 4 #define NF_IP_NUMHOOKS 5 enum nf_ip_hook_priorities { NF_IP_PRI_FIRST = INT_MIN, NF_IP_PRI_CONNTRACK_DEFRAG = -400, NF_IP_PRI_RAW = -300, NF_IP_PRI_SELINUX_FIRST = -225, NF_IP_PRI_CONNTRACK = -200, NF_IP_PRI_BRIDGE_SABOTAGE_FORWARD = -175, NF_IP_PRI_MANGLE = -150, NF_IP_PRI_NAT_DST = -100, NF_IP_PRI_BRIDGE_SABOTAGE_LOCAL_OUT = -50, NF_IP_PRI_FILTER = 0, NF_IP_PRI_NAT_SRC = 100, NF_IP_PRI_SELINUX_LAST = 225, NF_IP_PRI_CONNTRACK_HELPER = INT_MAX - 2, NF_IP_PRI_NAT_SEQ_ADJUST = INT_MAX - 1, NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX, NF_IP_PRI_LAST = INT_MAX, }; #define SO_ORIGINAL_DST 80 #endif android-audiosystem-1.8+13.10.20130807/include/linux/if_tr.h0000644000015700001700000000372212200324306023734 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IF_TR_H #define _LINUX_IF_TR_H #include #define TR_ALEN 6 #define TR_HLEN (sizeof(struct trh_hdr)+sizeof(struct trllc)) #define AC 0x10 #define LLC_FRAME 0x40 #define EXTENDED_SAP 0xAA #define UI_CMD 0x03 struct trh_hdr { __u8 ac; __u8 fc; __u8 daddr[TR_ALEN]; __u8 saddr[TR_ALEN]; __be16 rcf; __be16 rseg[8]; }; struct trllc { __u8 dsap; __u8 ssap; __u8 llc; __u8 protid[3]; __be16 ethertype; }; struct tr_statistics { unsigned long rx_packets; unsigned long tx_packets; unsigned long rx_bytes; unsigned long tx_bytes; unsigned long rx_errors; unsigned long tx_errors; unsigned long rx_dropped; unsigned long tx_dropped; unsigned long multicast; unsigned long transmit_collision; unsigned long line_errors; unsigned long internal_errors; unsigned long burst_errors; unsigned long A_C_errors; unsigned long abort_delimiters; unsigned long lost_frames; unsigned long recv_congest_count; unsigned long frame_copied_errors; unsigned long frequency_errors; unsigned long token_errors; unsigned long dummy1; }; #define TR_RII 0x80 #define TR_RCF_DIR_BIT 0x80 #define TR_RCF_LEN_MASK 0x1f00 #define TR_RCF_BROADCAST 0x8000 #define TR_RCF_LIMITED_BROADCAST 0xC000 #define TR_RCF_FRAME2K 0x20 #define TR_RCF_BROADCAST_MASK 0xC000 #define TR_MAXRIFLEN 18 #endif android-audiosystem-1.8+13.10.20130807/include/linux/lockd/0000755000015700001700000000000012200324404023547 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/linux/lockd/xdr.h0000644000015700001700000000337712200324306024530 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef LOCKD_XDR_H #define LOCKD_XDR_H #include #include #include #define NLM_MAXCOOKIELEN 32 #define NLM_MAXSTRLEN 1024 #define nlm_granted __constant_htonl(NLM_LCK_GRANTED) #define nlm_lck_denied __constant_htonl(NLM_LCK_DENIED) #define nlm_lck_denied_nolocks __constant_htonl(NLM_LCK_DENIED_NOLOCKS) #define nlm_lck_blocked __constant_htonl(NLM_LCK_BLOCKED) #define nlm_lck_denied_grace_period __constant_htonl(NLM_LCK_DENIED_GRACE_PERIOD) struct nlm_lock { char * caller; int len; struct nfs_fh fh; struct xdr_netobj oh; u32 svid; struct file_lock fl; }; struct nlm_cookie { unsigned char data[NLM_MAXCOOKIELEN]; unsigned int len; }; struct nlm_args { struct nlm_cookie cookie; struct nlm_lock lock; u32 block; u32 reclaim; u32 state; u32 monitor; u32 fsm_access; u32 fsm_mode; }; typedef struct nlm_args nlm_args; struct nlm_res { struct nlm_cookie cookie; u32 status; struct nlm_lock lock; }; struct nlm_reboot { char * mon; int len; u32 state; u32 addr; u32 vers; u32 proto; }; #define NLMSVC_XDRSIZE sizeof(struct nlm_args) #endif android-audiosystem-1.8+13.10.20130807/include/linux/lockd/nlm.h0000644000015700001700000000303112200324306024504 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef LINUX_LOCKD_NLM_H #define LINUX_LOCKD_NLM_H #define NLM_OFFSET_MAX ((s32) 0x7fffffff) #define NLM4_OFFSET_MAX ((s64) ((~(u64)0) >> 1)) enum { NLM_LCK_GRANTED = 0, NLM_LCK_DENIED = 1, NLM_LCK_DENIED_NOLOCKS = 2, NLM_LCK_BLOCKED = 3, NLM_LCK_DENIED_GRACE_PERIOD = 4, }; #define NLM_PROGRAM 100021 #define NLMPROC_NULL 0 #define NLMPROC_TEST 1 #define NLMPROC_LOCK 2 #define NLMPROC_CANCEL 3 #define NLMPROC_UNLOCK 4 #define NLMPROC_GRANTED 5 #define NLMPROC_TEST_MSG 6 #define NLMPROC_LOCK_MSG 7 #define NLMPROC_CANCEL_MSG 8 #define NLMPROC_UNLOCK_MSG 9 #define NLMPROC_GRANTED_MSG 10 #define NLMPROC_TEST_RES 11 #define NLMPROC_LOCK_RES 12 #define NLMPROC_CANCEL_RES 13 #define NLMPROC_UNLOCK_RES 14 #define NLMPROC_GRANTED_RES 15 #define NLMPROC_NSM_NOTIFY 16 #define NLMPROC_SHARE 20 #define NLMPROC_UNSHARE 21 #define NLMPROC_NM_LOCK 22 #define NLMPROC_FREE_ALL 23 #endif android-audiosystem-1.8+13.10.20130807/include/linux/hdsmart.h0000644000015700001700000000757112200324306024301 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_HDSMART_H #define _LINUX_HDSMART_H #define OFFLINE_FULL_SCAN 0 #define SHORT_SELF_TEST 1 #define EXTEND_SELF_TEST 2 #define SHORT_CAPTIVE_SELF_TEST 129 #define EXTEND_CAPTIVE_SELF_TEST 130 typedef struct ata_smart_attribute_s { unsigned char id; unsigned short status_flag; unsigned char normalized; unsigned char worse_normal; unsigned char raw[6]; unsigned char reserv; } __attribute__ ((packed)) ata_smart_attribute_t; typedef struct ata_smart_values_s { unsigned short revnumber; ata_smart_attribute_t vendor_attributes [30]; unsigned char offline_data_collection_status; unsigned char self_test_exec_status; unsigned short total_time_to_complete_off_line; unsigned char vendor_specific_366; unsigned char offline_data_collection_capability; unsigned short smart_capability; unsigned char errorlog_capability; unsigned char vendor_specific_371; unsigned char short_test_completion_time; unsigned char extend_test_completion_time; unsigned char reserved_374_385 [12]; unsigned char vendor_specific_386_509 [125]; unsigned char chksum; } __attribute__ ((packed)) ata_smart_values_t; typedef struct ata_smart_threshold_entry_s { unsigned char id; unsigned char normalized_threshold; unsigned char reserved[10]; } __attribute__ ((packed)) ata_smart_threshold_entry_t; typedef struct ata_smart_thresholds_s { unsigned short revnumber; ata_smart_threshold_entry_t thres_entries[30]; unsigned char reserved[149]; unsigned char chksum; } __attribute__ ((packed)) ata_smart_thresholds_t; typedef struct ata_smart_errorlog_command_struct_s { unsigned char devicecontrolreg; unsigned char featuresreg; unsigned char sector_count; unsigned char sector_number; unsigned char cylinder_low; unsigned char cylinder_high; unsigned char drive_head; unsigned char commandreg; unsigned int timestamp; } __attribute__ ((packed)) ata_smart_errorlog_command_struct_t; typedef struct ata_smart_errorlog_error_struct_s { unsigned char error_condition; unsigned char extended_error[14]; unsigned char state; unsigned short timestamp; } __attribute__ ((packed)) ata_smart_errorlog_error_struct_t; typedef struct ata_smart_errorlog_struct_s { ata_smart_errorlog_command_struct_t commands[6]; ata_smart_errorlog_error_struct_t error_struct; } __attribute__ ((packed)) ata_smart_errorlog_struct_t; typedef struct ata_smart_errorlog_s { unsigned char revnumber; unsigned char error_log_pointer; ata_smart_errorlog_struct_t errorlog_struct[5]; unsigned short ata_error_count; unsigned short non_fatal_count; unsigned short drive_timeout_count; unsigned char reserved[53]; unsigned char chksum; } __attribute__ ((packed)) ata_smart_errorlog_t; typedef struct ata_smart_selftestlog_struct_s { unsigned char selftestnumber; unsigned char selfteststatus; unsigned short timestamp; unsigned char selftestfailurecheckpoint; unsigned int lbafirstfailure; unsigned char vendorspecific[15]; } __attribute__ ((packed)) ata_smart_selftestlog_struct_t; typedef struct ata_smart_selftestlog_s { unsigned short revnumber; ata_smart_selftestlog_struct_t selftest_struct[21]; unsigned char vendorspecific[2]; unsigned char mostrecenttest; unsigned char resevered[2]; unsigned char chksum; } __attribute__ ((packed)) ata_smart_selftestlog_t; #endif android-audiosystem-1.8+13.10.20130807/include/linux/hid.h0000644000015700001700000000232112200324306023367 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __HID_H #define __HID_H #define USB_INTERFACE_CLASS_HID 3 #define USB_INTERFACE_SUBCLASS_BOOT 1 #define USB_INTERFACE_PROTOCOL_KEYBOARD 1 #define USB_INTERFACE_PROTOCOL_MOUSE 2 #define HID_REQ_GET_REPORT 0x01 #define HID_REQ_GET_IDLE 0x02 #define HID_REQ_GET_PROTOCOL 0x03 #define HID_REQ_SET_REPORT 0x09 #define HID_REQ_SET_IDLE 0x0A #define HID_REQ_SET_PROTOCOL 0x0B #define HID_DT_HID (USB_TYPE_CLASS | 0x01) #define HID_DT_REPORT (USB_TYPE_CLASS | 0x02) #define HID_DT_PHYSICAL (USB_TYPE_CLASS | 0x03) #define HID_MAX_DESCRIPTOR_SIZE 4096 #endif android-audiosystem-1.8+13.10.20130807/include/linux/numa.h0000644000015700001700000000141712200324306023570 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_NUMA_H #define _LINUX_NUMA_H #define NODES_SHIFT 0 #define MAX_NUMNODES (1 << NODES_SHIFT) #endif android-audiosystem-1.8+13.10.20130807/include/linux/efs_fs_sb.h0000644000015700001700000000277212200324306024566 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __EFS_FS_SB_H__ #define __EFS_FS_SB_H__ #define EFS_SUPER_MAGIC 0x414A53 #define EFS_MAGIC 0x072959 #define EFS_NEWMAGIC 0x07295a #define IS_EFS_MAGIC(x) ((x == EFS_MAGIC) || (x == EFS_NEWMAGIC)) #define EFS_SUPER 1 #define EFS_ROOTINODE 2 struct efs_super { __be32 fs_size; __be32 fs_firstcg; __be32 fs_cgfsize; __be16 fs_cgisize; __be16 fs_sectors; __be16 fs_heads; __be16 fs_ncg; __be16 fs_dirty; __be32 fs_time; __be32 fs_magic; char fs_fname[6]; char fs_fpack[6]; __be32 fs_bmsize; __be32 fs_tfree; __be32 fs_tinode; __be32 fs_bmblock; __be32 fs_replsb; __be32 fs_lastialloc; char fs_spare[20]; __be32 fs_checksum; }; struct efs_sb_info { __u32 fs_magic; __u32 fs_start; __u32 first_block; __u32 total_blocks; __u32 group_size; __u32 data_free; __u32 inode_free; __u16 inode_blocks; __u16 total_groups; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/videodev2.h0000644000015700001700000011212212200324306024513 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_VIDEODEV2_H #define __LINUX_VIDEODEV2_H #include #include #include #include #define VIDEO_MAX_FRAME 32 #define VID_TYPE_CAPTURE 1 #define VID_TYPE_TUNER 2 #define VID_TYPE_TELETEXT 4 #define VID_TYPE_OVERLAY 8 #define VID_TYPE_CHROMAKEY 16 #define VID_TYPE_CLIPPING 32 #define VID_TYPE_FRAMERAM 64 #define VID_TYPE_SCALES 128 #define VID_TYPE_MONOCHROME 256 #define VID_TYPE_SUBCAPTURE 512 #define VID_TYPE_MPEG_DECODER 1024 #define VID_TYPE_MPEG_ENCODER 2048 #define VID_TYPE_MJPEG_DECODER 4096 #define VID_TYPE_MJPEG_ENCODER 8192 #define v4l2_fourcc(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24)) enum v4l2_field { V4L2_FIELD_ANY = 0, V4L2_FIELD_NONE = 1, V4L2_FIELD_TOP = 2, V4L2_FIELD_BOTTOM = 3, V4L2_FIELD_INTERLACED = 4, V4L2_FIELD_SEQ_TB = 5, V4L2_FIELD_SEQ_BT = 6, V4L2_FIELD_ALTERNATE = 7, V4L2_FIELD_INTERLACED_TB = 8, V4L2_FIELD_INTERLACED_BT = 9, }; #define V4L2_FIELD_HAS_TOP(field) ((field) == V4L2_FIELD_TOP || (field) == V4L2_FIELD_INTERLACED || (field) == V4L2_FIELD_INTERLACED_TB || (field) == V4L2_FIELD_INTERLACED_BT || (field) == V4L2_FIELD_SEQ_TB || (field) == V4L2_FIELD_SEQ_BT) #define V4L2_FIELD_HAS_BOTTOM(field) ((field) == V4L2_FIELD_BOTTOM || (field) == V4L2_FIELD_INTERLACED || (field) == V4L2_FIELD_INTERLACED_TB || (field) == V4L2_FIELD_INTERLACED_BT || (field) == V4L2_FIELD_SEQ_TB || (field) == V4L2_FIELD_SEQ_BT) #define V4L2_FIELD_HAS_BOTH(field) ((field) == V4L2_FIELD_INTERLACED || (field) == V4L2_FIELD_INTERLACED_TB || (field) == V4L2_FIELD_INTERLACED_BT || (field) == V4L2_FIELD_SEQ_TB || (field) == V4L2_FIELD_SEQ_BT) enum v4l2_buf_type { V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, V4L2_BUF_TYPE_VIDEO_OUTPUT = 2, V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, V4L2_BUF_TYPE_VBI_CAPTURE = 4, V4L2_BUF_TYPE_VBI_OUTPUT = 5, V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8, V4L2_BUF_TYPE_PRIVATE = 0x80, }; enum v4l2_ctrl_type { V4L2_CTRL_TYPE_INTEGER = 1, V4L2_CTRL_TYPE_BOOLEAN = 2, V4L2_CTRL_TYPE_MENU = 3, V4L2_CTRL_TYPE_BUTTON = 4, V4L2_CTRL_TYPE_INTEGER64 = 5, V4L2_CTRL_TYPE_CTRL_CLASS = 6, }; enum v4l2_tuner_type { V4L2_TUNER_RADIO = 1, V4L2_TUNER_ANALOG_TV = 2, V4L2_TUNER_DIGITAL_TV = 3, }; enum v4l2_memory { V4L2_MEMORY_MMAP = 1, V4L2_MEMORY_USERPTR = 2, V4L2_MEMORY_OVERLAY = 3, }; enum v4l2_colorspace { V4L2_COLORSPACE_SMPTE170M = 1, V4L2_COLORSPACE_SMPTE240M = 2, V4L2_COLORSPACE_REC709 = 3, V4L2_COLORSPACE_BT878 = 4, V4L2_COLORSPACE_470_SYSTEM_M = 5, V4L2_COLORSPACE_470_SYSTEM_BG = 6, V4L2_COLORSPACE_JPEG = 7, V4L2_COLORSPACE_SRGB = 8, }; enum v4l2_priority { V4L2_PRIORITY_UNSET = 0, V4L2_PRIORITY_BACKGROUND = 1, V4L2_PRIORITY_INTERACTIVE = 2, V4L2_PRIORITY_RECORD = 3, V4L2_PRIORITY_DEFAULT = V4L2_PRIORITY_INTERACTIVE, }; struct v4l2_rect { __s32 left; __s32 top; __s32 width; __s32 height; }; struct v4l2_fract { __u32 numerator; __u32 denominator; }; struct v4l2_capability { __u8 driver[16]; __u8 card[32]; __u8 bus_info[32]; __u32 version; __u32 capabilities; __u32 reserved[4]; }; #define V4L2_CAP_VIDEO_CAPTURE 0x00000001 #define V4L2_CAP_VIDEO_OUTPUT 0x00000002 #define V4L2_CAP_VIDEO_OVERLAY 0x00000004 #define V4L2_CAP_VBI_CAPTURE 0x00000010 #define V4L2_CAP_VBI_OUTPUT 0x00000020 #define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 #define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 #define V4L2_CAP_RDS_CAPTURE 0x00000100 #define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 #define V4L2_CAP_HW_FREQ_SEEK 0x00000400 #define V4L2_CAP_TUNER 0x00010000 #define V4L2_CAP_AUDIO 0x00020000 #define V4L2_CAP_RADIO 0x00040000 #define V4L2_CAP_READWRITE 0x01000000 #define V4L2_CAP_ASYNCIO 0x02000000 #define V4L2_CAP_STREAMING 0x04000000 struct v4l2_pix_format { __u32 width; __u32 height; __u32 pixelformat; enum v4l2_field field; __u32 bytesperline; __u32 sizeimage; enum v4l2_colorspace colorspace; __u32 priv; }; #define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') #define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') #define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') #define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') #define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') #define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') #define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') #define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') #define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') #define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') #define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') #define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') #define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') #define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') #define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') #define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') #define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') #define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y', '4', '4', '4') #define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') #define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') #define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') #define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') #define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') #define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') #define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') #define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') #define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') #define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') #define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') #define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') #define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') #define V4L2_PIX_FMT_W1S_PATT v4l2_fourcc('P', 'A', 'T', '1') #define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') #define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') #define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') #define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') #define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') #define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P', 'W', 'C', '1') #define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P', 'W', 'C', '2') #define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5') #define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1') #define V4L2_PIX_FMT_SPCA505 v4l2_fourcc('S', '5', '0', '5') #define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') #define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') #define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') #define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') #define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') struct v4l2_fmtdesc { __u32 index; enum v4l2_buf_type type; __u32 flags; __u8 description[32]; __u32 pixelformat; __u32 reserved[4]; }; #define V4L2_FMT_FLAG_COMPRESSED 0x0001 enum v4l2_frmsizetypes { V4L2_FRMSIZE_TYPE_DISCRETE = 1, V4L2_FRMSIZE_TYPE_CONTINUOUS = 2, V4L2_FRMSIZE_TYPE_STEPWISE = 3, }; struct v4l2_frmsize_discrete { __u32 width; __u32 height; }; struct v4l2_frmsize_stepwise { __u32 min_width; __u32 max_width; __u32 step_width; __u32 min_height; __u32 max_height; __u32 step_height; }; struct v4l2_frmsizeenum { __u32 index; __u32 pixel_format; __u32 type; union { struct v4l2_frmsize_discrete discrete; struct v4l2_frmsize_stepwise stepwise; }; __u32 reserved[2]; }; enum v4l2_frmivaltypes { V4L2_FRMIVAL_TYPE_DISCRETE = 1, V4L2_FRMIVAL_TYPE_CONTINUOUS = 2, V4L2_FRMIVAL_TYPE_STEPWISE = 3, }; struct v4l2_frmival_stepwise { struct v4l2_fract min; struct v4l2_fract max; struct v4l2_fract step; }; struct v4l2_frmivalenum { __u32 index; __u32 pixel_format; __u32 width; __u32 height; __u32 type; union { struct v4l2_fract discrete; struct v4l2_frmival_stepwise stepwise; }; __u32 reserved[2]; }; struct v4l2_timecode { __u32 type; __u32 flags; __u8 frames; __u8 seconds; __u8 minutes; __u8 hours; __u8 userbits[4]; }; #define V4L2_TC_TYPE_24FPS 1 #define V4L2_TC_TYPE_25FPS 2 #define V4L2_TC_TYPE_30FPS 3 #define V4L2_TC_TYPE_50FPS 4 #define V4L2_TC_TYPE_60FPS 5 #define V4L2_TC_FLAG_DROPFRAME 0x0001 #define V4L2_TC_FLAG_COLORFRAME 0x0002 #define V4L2_TC_USERBITS_field 0x000C #define V4L2_TC_USERBITS_USERDEFINED 0x0000 #define V4L2_TC_USERBITS_8BITCHARS 0x0008 struct v4l2_jpegcompression { int quality; int APPn; int APP_len; char APP_data[60]; int COM_len; char COM_data[60]; __u32 jpeg_markers; #define V4L2_JPEG_MARKER_DHT (1<<3) #define V4L2_JPEG_MARKER_DQT (1<<4) #define V4L2_JPEG_MARKER_DRI (1<<5) #define V4L2_JPEG_MARKER_COM (1<<6) #define V4L2_JPEG_MARKER_APP (1<<7) }; struct v4l2_requestbuffers { __u32 count; enum v4l2_buf_type type; enum v4l2_memory memory; __u32 reserved[2]; }; struct v4l2_buffer { __u32 index; enum v4l2_buf_type type; __u32 bytesused; __u32 flags; enum v4l2_field field; struct timeval timestamp; struct v4l2_timecode timecode; __u32 sequence; enum v4l2_memory memory; union { __u32 offset; unsigned long userptr; } m; __u32 length; __u32 input; __u32 reserved; }; #define V4L2_BUF_FLAG_MAPPED 0x0001 #define V4L2_BUF_FLAG_QUEUED 0x0002 #define V4L2_BUF_FLAG_DONE 0x0004 #define V4L2_BUF_FLAG_KEYFRAME 0x0008 #define V4L2_BUF_FLAG_PFRAME 0x0010 #define V4L2_BUF_FLAG_BFRAME 0x0020 #define V4L2_BUF_FLAG_TIMECODE 0x0100 #define V4L2_BUF_FLAG_INPUT 0x0200 struct v4l2_framebuffer { __u32 capability; __u32 flags; void *base; struct v4l2_pix_format fmt; }; #define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001 #define V4L2_FBUF_CAP_CHROMAKEY 0x0002 #define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004 #define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 #define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 #define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 #define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040 #define V4L2_FBUF_CAP_SRC_CHROMAKEY 0x0080 #define V4L2_FBUF_FLAG_PRIMARY 0x0001 #define V4L2_FBUF_FLAG_OVERLAY 0x0002 #define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 #define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 #define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 #define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 #define V4L2_FBUF_FLAG_SRC_CHROMAKEY 0x0040 struct v4l2_clip { struct v4l2_rect c; struct v4l2_clip __user *next; }; struct v4l2_window { struct v4l2_rect w; enum v4l2_field field; __u32 chromakey; struct v4l2_clip __user *clips; __u32 clipcount; void __user *bitmap; __u8 global_alpha; }; struct v4l2_captureparm { __u32 capability; __u32 capturemode; struct v4l2_fract timeperframe; __u32 extendedmode; __u32 readbuffers; __u32 reserved[4]; }; #define V4L2_MODE_HIGHQUALITY 0x0001 #define V4L2_CAP_TIMEPERFRAME 0x1000 struct v4l2_outputparm { __u32 capability; __u32 outputmode; struct v4l2_fract timeperframe; __u32 extendedmode; __u32 writebuffers; __u32 reserved[4]; }; struct v4l2_cropcap { enum v4l2_buf_type type; struct v4l2_rect bounds; struct v4l2_rect defrect; struct v4l2_fract pixelaspect; }; struct v4l2_crop { enum v4l2_buf_type type; struct v4l2_rect c; }; typedef __u64 v4l2_std_id; #define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001) #define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002) #define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004) #define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008) #define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010) #define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020) #define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040) #define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080) #define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100) #define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200) #define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400) #define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800) #define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) #define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) #define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) #define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) #define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) #define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) #define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000) #define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000) #define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000) #define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000) #define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000) #define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000) #define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) #define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) #define V4L2_STD_MN (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC) #define V4L2_STD_B (V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B) #define V4L2_STD_GH (V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H) #define V4L2_STD_DK (V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK) #define V4L2_STD_PAL_BG (V4L2_STD_PAL_B | V4L2_STD_PAL_B1 | V4L2_STD_PAL_G) #define V4L2_STD_PAL_DK (V4L2_STD_PAL_D | V4L2_STD_PAL_D1 | V4L2_STD_PAL_K) #define V4L2_STD_PAL (V4L2_STD_PAL_BG | V4L2_STD_PAL_DK | V4L2_STD_PAL_H | V4L2_STD_PAL_I) #define V4L2_STD_NTSC (V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_JP | V4L2_STD_NTSC_M_KR) #define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D | V4L2_STD_SECAM_K | V4L2_STD_SECAM_K1) #define V4L2_STD_SECAM (V4L2_STD_SECAM_B | V4L2_STD_SECAM_G | V4L2_STD_SECAM_H | V4L2_STD_SECAM_DK | V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC) #define V4L2_STD_525_60 (V4L2_STD_PAL_M | V4L2_STD_PAL_60 | V4L2_STD_NTSC | V4L2_STD_NTSC_443) #define V4L2_STD_625_50 (V4L2_STD_PAL | V4L2_STD_PAL_N | V4L2_STD_PAL_Nc | V4L2_STD_SECAM) #define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB | V4L2_STD_ATSC_16_VSB) #define V4L2_STD_UNKNOWN 0 #define V4L2_STD_ALL (V4L2_STD_525_60 | V4L2_STD_625_50) struct v4l2_standard { __u32 index; v4l2_std_id id; __u8 name[24]; struct v4l2_fract frameperiod; __u32 framelines; __u32 reserved[4]; }; struct v4l2_input { __u32 index; __u8 name[32]; __u32 type; __u32 audioset; __u32 tuner; v4l2_std_id std; __u32 status; __u32 reserved[4]; }; #define V4L2_INPUT_TYPE_TUNER 1 #define V4L2_INPUT_TYPE_CAMERA 2 #define V4L2_IN_ST_NO_POWER 0x00000001 #define V4L2_IN_ST_NO_SIGNAL 0x00000002 #define V4L2_IN_ST_NO_COLOR 0x00000004 #define V4L2_IN_ST_NO_H_LOCK 0x00000100 #define V4L2_IN_ST_COLOR_KILL 0x00000200 #define V4L2_IN_ST_NO_SYNC 0x00010000 #define V4L2_IN_ST_NO_EQU 0x00020000 #define V4L2_IN_ST_NO_CARRIER 0x00040000 #define V4L2_IN_ST_MACROVISION 0x01000000 #define V4L2_IN_ST_NO_ACCESS 0x02000000 #define V4L2_IN_ST_VTR 0x04000000 struct v4l2_output { __u32 index; __u8 name[32]; __u32 type; __u32 audioset; __u32 modulator; v4l2_std_id std; __u32 reserved[4]; }; #define V4L2_OUTPUT_TYPE_MODULATOR 1 #define V4L2_OUTPUT_TYPE_ANALOG 2 #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 struct v4l2_control { __u32 id; __s32 value; }; struct v4l2_ext_control { __u32 id; __u32 reserved2[2]; union { __s32 value; __s64 value64; void *reserved; }; } __attribute__ ((packed)); struct v4l2_ext_controls { __u32 ctrl_class; __u32 count; __u32 error_idx; __u32 reserved[2]; struct v4l2_ext_control *controls; }; #define V4L2_CTRL_CLASS_USER 0x00980000 #define V4L2_CTRL_CLASS_MPEG 0x00990000 #define V4L2_CTRL_CLASS_CAMERA 0x009a0000 #define V4L2_CTRL_ID_MASK (0x0fffffff) #define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) #define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) struct v4l2_queryctrl { __u32 id; enum v4l2_ctrl_type type; __u8 name[32]; __s32 minimum; __s32 maximum; __s32 step; __s32 default_value; __u32 flags; __u32 reserved[2]; }; struct v4l2_querymenu { __u32 id; __u32 index; __u8 name[32]; __u32 reserved; }; #define V4L2_CTRL_FLAG_DISABLED 0x0001 #define V4L2_CTRL_FLAG_GRABBED 0x0002 #define V4L2_CTRL_FLAG_READ_ONLY 0x0004 #define V4L2_CTRL_FLAG_UPDATE 0x0008 #define V4L2_CTRL_FLAG_INACTIVE 0x0010 #define V4L2_CTRL_FLAG_SLIDER 0x0020 #define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 #define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900) #define V4L2_CID_USER_BASE V4L2_CID_BASE #define V4L2_CID_PRIVATE_BASE 0x08000000 #define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1) #define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0) #define V4L2_CID_CONTRAST (V4L2_CID_BASE+1) #define V4L2_CID_SATURATION (V4L2_CID_BASE+2) #define V4L2_CID_HUE (V4L2_CID_BASE+3) #define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5) #define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6) #define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7) #define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8) #define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9) #define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10) #define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) #define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12) #define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13) #define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14) #define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15) #define V4L2_CID_GAMMA (V4L2_CID_BASE+16) #define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) #define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17) #define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18) #define V4L2_CID_GAIN (V4L2_CID_BASE+19) #define V4L2_CID_HFLIP (V4L2_CID_BASE+20) #define V4L2_CID_VFLIP (V4L2_CID_BASE+21) #define V4L2_CID_HCENTER (V4L2_CID_BASE+22) #define V4L2_CID_VCENTER (V4L2_CID_BASE+23) #define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24) enum v4l2_power_line_frequency { V4L2_CID_POWER_LINE_FREQUENCY_DISABLED = 0, V4L2_CID_POWER_LINE_FREQUENCY_50HZ = 1, V4L2_CID_POWER_LINE_FREQUENCY_60HZ = 2, }; #define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25) #define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26) #define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27) #define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28) #define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29) #define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30) #define V4L2_CID_COLORFX (V4L2_CID_BASE+31) #define V4L2_CID_ROTATE (V4L2_CID_BASE+32) #define V4L2_CID_BG_COLOR (V4L2_CID_BASE+33) #define V4L2_CID_LASTP1 (V4L2_CID_BASE+34) enum v4l2_colorfx { V4L2_COLORFX_NONE = 0, V4L2_COLORFX_BW = 1, V4L2_COLORFX_SEPIA = 2, }; #define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) #define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1) #define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0) enum v4l2_mpeg_stream_type { V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, }; #define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1) #define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2) #define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3) #define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4) #define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5) #define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6) #define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7) enum v4l2_mpeg_stream_vbi_fmt { V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, }; #define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100) enum v4l2_mpeg_audio_sampling_freq { V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0, V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1, V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2, }; #define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101) enum v4l2_mpeg_audio_encoding { V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0, V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1, V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2, V4L2_MPEG_AUDIO_ENCODING_AAC = 3, V4L2_MPEG_AUDIO_ENCODING_AC3 = 4, }; #define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102) enum v4l2_mpeg_audio_l1_bitrate { V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0, V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1, V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2, V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3, V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4, V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5, V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6, V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7, V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8, V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9, V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10, V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11, V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12, V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13, }; #define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103) enum v4l2_mpeg_audio_l2_bitrate { V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0, V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1, V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2, V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3, V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4, V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5, V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6, V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7, V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8, V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9, V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10, V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11, V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12, V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13, }; #define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104) enum v4l2_mpeg_audio_l3_bitrate { V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0, V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1, V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2, V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3, V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4, V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5, V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6, V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7, V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8, V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9, V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10, V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11, V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12, V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13, }; #define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105) enum v4l2_mpeg_audio_mode { V4L2_MPEG_AUDIO_MODE_STEREO = 0, V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1, V4L2_MPEG_AUDIO_MODE_DUAL = 2, V4L2_MPEG_AUDIO_MODE_MONO = 3, }; #define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106) enum v4l2_mpeg_audio_mode_extension { V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0, V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1, V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2, V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3, }; #define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107) enum v4l2_mpeg_audio_emphasis { V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0, V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1, V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2, }; #define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108) enum v4l2_mpeg_audio_crc { V4L2_MPEG_AUDIO_CRC_NONE = 0, V4L2_MPEG_AUDIO_CRC_CRC16 = 1, }; #define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) #define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110) #define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111) enum v4l2_mpeg_audio_ac3_bitrate { V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0, V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1, V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2, V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3, V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4, V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5, V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6, V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7, V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8, V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9, V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10, V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11, V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12, V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13, V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14, V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15, V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16, V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17, V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, }; #define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) enum v4l2_mpeg_video_encoding { V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0, V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1, V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2, }; #define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201) enum v4l2_mpeg_video_aspect { V4L2_MPEG_VIDEO_ASPECT_1x1 = 0, V4L2_MPEG_VIDEO_ASPECT_4x3 = 1, V4L2_MPEG_VIDEO_ASPECT_16x9 = 2, V4L2_MPEG_VIDEO_ASPECT_221x100 = 3, }; #define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202) #define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203) #define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204) #define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205) #define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206) enum v4l2_mpeg_video_bitrate_mode { V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0, V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1, }; #define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207) #define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208) #define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209) #define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210) #define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211) #define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) #define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0) enum v4l2_mpeg_cx2341x_video_spatial_filter_mode { V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0, V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1) #define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2) enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type { V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3) enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type { V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0, V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4) enum v4l2_mpeg_cx2341x_video_temporal_filter_mode { V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0, V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5) #define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6) enum v4l2_mpeg_cx2341x_video_median_filter_type { V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4, }; #define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7) #define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8) #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9) #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10) #define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11) #define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900) #define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1) #define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1) enum v4l2_exposure_auto_type { V4L2_EXPOSURE_AUTO = 0, V4L2_EXPOSURE_MANUAL = 1, V4L2_EXPOSURE_SHUTTER_PRIORITY = 2, V4L2_EXPOSURE_APERTURE_PRIORITY = 3 }; #define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2) #define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3) #define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4) #define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5) #define V4L2_CID_PAN_RESET (V4L2_CID_CAMERA_CLASS_BASE+6) #define V4L2_CID_TILT_RESET (V4L2_CID_CAMERA_CLASS_BASE+7) #define V4L2_CID_PAN_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+8) #define V4L2_CID_TILT_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+9) #define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10) #define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11) #define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12) #define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13) #define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14) #define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE+15) #define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16) struct v4l2_tuner { __u32 index; __u8 name[32]; enum v4l2_tuner_type type; __u32 capability; __u32 rangelow; __u32 rangehigh; __u32 rxsubchans; __u32 audmode; __s32 signal; __s32 afc; __u32 reserved[4]; }; struct v4l2_modulator { __u32 index; __u8 name[32]; __u32 capability; __u32 rangelow; __u32 rangehigh; __u32 txsubchans; __u32 reserved[4]; }; #define V4L2_TUNER_CAP_LOW 0x0001 #define V4L2_TUNER_CAP_NORM 0x0002 #define V4L2_TUNER_CAP_STEREO 0x0010 #define V4L2_TUNER_CAP_LANG2 0x0020 #define V4L2_TUNER_CAP_SAP 0x0020 #define V4L2_TUNER_CAP_LANG1 0x0040 #define V4L2_TUNER_SUB_MONO 0x0001 #define V4L2_TUNER_SUB_STEREO 0x0002 #define V4L2_TUNER_SUB_LANG2 0x0004 #define V4L2_TUNER_SUB_SAP 0x0004 #define V4L2_TUNER_SUB_LANG1 0x0008 #define V4L2_TUNER_MODE_MONO 0x0000 #define V4L2_TUNER_MODE_STEREO 0x0001 #define V4L2_TUNER_MODE_LANG2 0x0002 #define V4L2_TUNER_MODE_SAP 0x0002 #define V4L2_TUNER_MODE_LANG1 0x0003 #define V4L2_TUNER_MODE_LANG1_LANG2 0x0004 struct v4l2_frequency { __u32 tuner; enum v4l2_tuner_type type; __u32 frequency; __u32 reserved[8]; }; struct v4l2_hw_freq_seek { __u32 tuner; enum v4l2_tuner_type type; __u32 seek_upward; __u32 wrap_around; __u32 reserved[8]; }; struct v4l2_audio { __u32 index; __u8 name[32]; __u32 capability; __u32 mode; __u32 reserved[2]; }; #define V4L2_AUDCAP_STEREO 0x00001 #define V4L2_AUDCAP_AVL 0x00002 #define V4L2_AUDMODE_AVL 0x00001 struct v4l2_audioout { __u32 index; __u8 name[32]; __u32 capability; __u32 mode; __u32 reserved[2]; }; #define V4L2_ENC_IDX_FRAME_I (0) #define V4L2_ENC_IDX_FRAME_P (1) #define V4L2_ENC_IDX_FRAME_B (2) #define V4L2_ENC_IDX_FRAME_MASK (0xf) struct v4l2_enc_idx_entry { __u64 offset; __u64 pts; __u32 length; __u32 flags; __u32 reserved[2]; }; #define V4L2_ENC_IDX_ENTRIES (64) struct v4l2_enc_idx { __u32 entries; __u32 entries_cap; __u32 reserved[4]; struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES]; }; #define V4L2_ENC_CMD_START (0) #define V4L2_ENC_CMD_STOP (1) #define V4L2_ENC_CMD_PAUSE (2) #define V4L2_ENC_CMD_RESUME (3) #define V4L2_ENC_CMD_STOP_AT_GOP_END (1 << 0) struct v4l2_encoder_cmd { __u32 cmd; __u32 flags; union { struct { __u32 data[8]; } raw; }; }; struct v4l2_vbi_format { __u32 sampling_rate; __u32 offset; __u32 samples_per_line; __u32 sample_format; __s32 start[2]; __u32 count[2]; __u32 flags; __u32 reserved[2]; }; #define V4L2_VBI_UNSYNC (1 << 0) #define V4L2_VBI_INTERLACED (1 << 1) struct v4l2_sliced_vbi_format { __u16 service_set; __u16 service_lines[2][24]; __u32 io_size; __u32 reserved[2]; }; #define V4L2_SLICED_TELETEXT_B (0x0001) #define V4L2_SLICED_VPS (0x0400) #define V4L2_SLICED_CAPTION_525 (0x1000) #define V4L2_SLICED_WSS_625 (0x4000) #define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) #define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) struct v4l2_sliced_vbi_cap { __u16 service_set; __u16 service_lines[2][24]; enum v4l2_buf_type type; __u32 reserved[3]; }; struct v4l2_sliced_vbi_data { __u32 id; __u32 field; __u32 line; __u32 reserved; __u8 data[48]; }; struct v4l2_format { enum v4l2_buf_type type; union { struct v4l2_pix_format pix; struct v4l2_window win; struct v4l2_vbi_format vbi; struct v4l2_sliced_vbi_format sliced; __u8 raw_data[200]; } fmt; }; struct v4l2_streamparm { enum v4l2_buf_type type; union { struct v4l2_captureparm capture; struct v4l2_outputparm output; __u8 raw_data[200]; } parm; }; #define V4L2_CHIP_MATCH_HOST 0 #define V4L2_CHIP_MATCH_I2C_DRIVER 1 #define V4L2_CHIP_MATCH_I2C_ADDR 2 #define V4L2_CHIP_MATCH_AC97 3 struct v4l2_dbg_match { __u32 type; union { __u32 addr; char name[32]; }; } __attribute__ ((packed)); struct v4l2_dbg_register { struct v4l2_dbg_match match; __u32 size; __u64 reg; __u64 val; } __attribute__ ((packed)); struct v4l2_dbg_chip_ident { struct v4l2_dbg_match match; __u32 ident; __u32 revision; } __attribute__ ((packed)); struct v4l2_chip_ident_old { __u32 match_type; __u32 match_chip; __u32 ident; __u32 revision; }; #define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability) #define VIDIOC_RESERVED _IO('V', 1) #define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc) #define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format) #define VIDIOC_S_FMT _IOWR('V', 5, struct v4l2_format) #define VIDIOC_REQBUFS _IOWR('V', 8, struct v4l2_requestbuffers) #define VIDIOC_QUERYBUF _IOWR('V', 9, struct v4l2_buffer) #define VIDIOC_G_FBUF _IOR('V', 10, struct v4l2_framebuffer) #define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer) #define VIDIOC_OVERLAY _IOW('V', 14, int) #define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer) #define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer) #define VIDIOC_STREAMON _IOW('V', 18, int) #define VIDIOC_STREAMOFF _IOW('V', 19, int) #define VIDIOC_G_PARM _IOWR('V', 21, struct v4l2_streamparm) #define VIDIOC_S_PARM _IOWR('V', 22, struct v4l2_streamparm) #define VIDIOC_G_STD _IOR('V', 23, v4l2_std_id) #define VIDIOC_S_STD _IOW('V', 24, v4l2_std_id) #define VIDIOC_ENUMSTD _IOWR('V', 25, struct v4l2_standard) #define VIDIOC_ENUMINPUT _IOWR('V', 26, struct v4l2_input) #define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control) #define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control) #define VIDIOC_G_TUNER _IOWR('V', 29, struct v4l2_tuner) #define VIDIOC_S_TUNER _IOW('V', 30, struct v4l2_tuner) #define VIDIOC_G_AUDIO _IOR('V', 33, struct v4l2_audio) #define VIDIOC_S_AUDIO _IOW('V', 34, struct v4l2_audio) #define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl) #define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu) #define VIDIOC_G_INPUT _IOR('V', 38, int) #define VIDIOC_S_INPUT _IOWR('V', 39, int) #define VIDIOC_G_OUTPUT _IOR('V', 46, int) #define VIDIOC_S_OUTPUT _IOWR('V', 47, int) #define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output) #define VIDIOC_G_AUDOUT _IOR('V', 49, struct v4l2_audioout) #define VIDIOC_S_AUDOUT _IOW('V', 50, struct v4l2_audioout) #define VIDIOC_G_MODULATOR _IOWR('V', 54, struct v4l2_modulator) #define VIDIOC_S_MODULATOR _IOW('V', 55, struct v4l2_modulator) #define VIDIOC_G_FREQUENCY _IOWR('V', 56, struct v4l2_frequency) #define VIDIOC_S_FREQUENCY _IOW('V', 57, struct v4l2_frequency) #define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap) #define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop) #define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop) #define VIDIOC_G_JPEGCOMP _IOR('V', 61, struct v4l2_jpegcompression) #define VIDIOC_S_JPEGCOMP _IOW('V', 62, struct v4l2_jpegcompression) #define VIDIOC_QUERYSTD _IOR('V', 63, v4l2_std_id) #define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format) #define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio) #define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout) #define VIDIOC_G_PRIORITY _IOR('V', 67, enum v4l2_priority) #define VIDIOC_S_PRIORITY _IOW('V', 68, enum v4l2_priority) #define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap) #define VIDIOC_LOG_STATUS _IO('V', 70) #define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls) #define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls) #define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls) #define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum) #define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum) #define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx) #define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd) #define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd) #define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register) #define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register) #define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident) #define VIDIOC_G_CHIP_IDENT_OLD _IOWR('V', 81, struct v4l2_chip_ident_old) #define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) #ifdef __OLD_VIDIOC_ #define VIDIOC_OVERLAY_OLD _IOWR('V', 14, int) #define VIDIOC_S_PARM_OLD _IOW('V', 22, struct v4l2_streamparm) #define VIDIOC_S_CTRL_OLD _IOW('V', 28, struct v4l2_control) #define VIDIOC_G_AUDIO_OLD _IOWR('V', 33, struct v4l2_audio) #define VIDIOC_G_AUDOUT_OLD _IOWR('V', 49, struct v4l2_audioout) #define VIDIOC_CROPCAP_OLD _IOR('V', 58, struct v4l2_cropcap) #endif #define BASE_VIDIOC_PRIVATE 192 #endif android-audiosystem-1.8+13.10.20130807/include/linux/seqlock.h0000644000015700001700000000403212200324306024265 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_SEQLOCK_H #define __LINUX_SEQLOCK_H #include #include typedef struct { unsigned sequence; spinlock_t lock; } seqlock_t; #define __SEQLOCK_UNLOCKED(lockname) { 0, __SPIN_LOCK_UNLOCKED(lockname) } #define SEQLOCK_UNLOCKED __SEQLOCK_UNLOCKED(old_style_seqlock_init) #define seqlock_init(x) do { *(x) = (seqlock_t) __SEQLOCK_UNLOCKED(x); } while (0) #define DEFINE_SEQLOCK(x) seqlock_t x = __SEQLOCK_UNLOCKED(x) #define SEQCNT_ZERO { 0 } #define seqcount_init(x) do { *(x) = (seqcount_t) SEQCNT_ZERO; } while (0) #define write_seqlock_irqsave(lock, flags) do { local_irq_save(flags); write_seqlock(lock); } while (0) #define write_seqlock_irq(lock) do { local_irq_disable(); write_seqlock(lock); } while (0) #define write_seqlock_bh(lock) do { local_bh_disable(); write_seqlock(lock); } while (0) #define write_sequnlock_irqrestore(lock, flags) do { write_sequnlock(lock); local_irq_restore(flags); } while(0) #define write_sequnlock_irq(lock) do { write_sequnlock(lock); local_irq_enable(); } while(0) #define write_sequnlock_bh(lock) do { write_sequnlock(lock); local_bh_enable(); } while(0) #define read_seqbegin_irqsave(lock, flags) ({ local_irq_save(flags); read_seqbegin(lock); }) #define read_seqretry_irqrestore(lock, iv, flags) ({ int ret = read_seqretry(lock, iv); local_irq_restore(flags); ret; }) #endif android-audiosystem-1.8+13.10.20130807/include/linux/seq_file.h0000644000015700001700000000132612200324306024416 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SEQ_FILE_H #define _LINUX_SEQ_FILE_H #endif android-audiosystem-1.8+13.10.20130807/include/linux/a.out.h0000644000015700001700000001065712200324306023664 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __A_OUT_GNU_H__ #define __A_OUT_GNU_H__ #define __GNU_EXEC_MACROS__ #ifndef __STRUCT_EXEC_OVERRIDE__ #include #endif enum machine_type { #ifdef M_OLDSUN2 M__OLDSUN2 = M_OLDSUN2, #else M_OLDSUN2 = 0, #endif #ifdef M_68010 M__68010 = M_68010, #else M_68010 = 1, #endif #ifdef M_68020 M__68020 = M_68020, #else M_68020 = 2, #endif #ifdef M_SPARC M__SPARC = M_SPARC, #else M_SPARC = 3, #endif M_386 = 100, M_MIPS1 = 151, M_MIPS2 = 152 }; #ifndef N_MAGIC #define N_MAGIC(exec) ((exec).a_info & 0xffff) #endif #define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff)) #define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff) #define N_SET_INFO(exec, magic, type, flags) ((exec).a_info = ((magic) & 0xffff) | (((int)(type) & 0xff) << 16) | (((flags) & 0xff) << 24)) #define N_SET_MAGIC(exec, magic) ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff))) #define N_SET_MACHTYPE(exec, machtype) ((exec).a_info = ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16)) #define N_SET_FLAGS(exec, flags) ((exec).a_info = ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24)) #define OMAGIC 0407 #define NMAGIC 0410 #define ZMAGIC 0413 #define QMAGIC 0314 #define CMAGIC 0421 #ifndef N_BADMAG #define N_BADMAG(x) (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC && N_MAGIC(x) != ZMAGIC && N_MAGIC(x) != QMAGIC) #endif #define _N_HDROFF(x) (1024 - sizeof (struct exec)) #ifndef N_TXTOFF #define N_TXTOFF(x) (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec))) #endif #ifndef N_DATOFF #define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text) #endif #ifndef N_TRELOFF #define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data) #endif #ifndef N_DRELOFF #define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x)) #endif #ifndef N_SYMOFF #define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x)) #endif #ifndef N_STROFF #define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x)) #endif #ifndef N_TXTADDR #define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0) #endif #if defined(vax) || defined(hp300) || defined(pyr) #define SEGMENT_SIZE page_size #endif #ifdef sony #define SEGMENT_SIZE 0x2000 #endif #ifdef is68k #define SEGMENT_SIZE 0x20000 #endif #if defined(m68k) && defined(PORTAR) #define PAGE_SIZE 0x400 #define SEGMENT_SIZE PAGE_SIZE #endif #ifdef linux #include #if defined(__i386__) || defined(__mc68000__) #define SEGMENT_SIZE 1024 #else #ifndef SEGMENT_SIZE #define SEGMENT_SIZE PAGE_SIZE #endif #endif #endif #define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE) #define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text) #ifndef N_DATADDR #define N_DATADDR(x) (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x)))) #endif #ifndef N_BSSADDR #define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data) #endif #ifndef N_NLIST_DECLARED struct nlist { union { char *n_name; struct nlist *n_next; long n_strx; } n_un; unsigned char n_type; char n_other; short n_desc; unsigned long n_value; }; #endif #ifndef N_UNDF #define N_UNDF 0 #endif #ifndef N_ABS #define N_ABS 2 #endif #ifndef N_TEXT #define N_TEXT 4 #endif #ifndef N_DATA #define N_DATA 6 #endif #ifndef N_BSS #define N_BSS 8 #endif #ifndef N_FN #define N_FN 15 #endif #ifndef N_EXT #define N_EXT 1 #endif #ifndef N_TYPE #define N_TYPE 036 #endif #ifndef N_STAB #define N_STAB 0340 #endif #define N_INDR 0xa #define N_SETA 0x14 #define N_SETT 0x16 #define N_SETD 0x18 #define N_SETB 0x1A #define N_SETV 0x1C #ifndef N_RELOCATION_INFO_DECLARED struct relocation_info { int r_address; unsigned int r_symbolnum:24; unsigned int r_pcrel:1; unsigned int r_length:2; unsigned int r_extern:1; #ifdef NS32K unsigned r_bsr:1; unsigned r_disp:1; unsigned r_pad:2; #else unsigned int r_pad:4; #endif }; #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/wanrouter.h0000644000015700001700000001632012200324306024655 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _ROUTER_H #define _ROUTER_H #define ROUTER_NAME "wanrouter" #define ROUTER_VERSION 1 #define ROUTER_RELEASE 1 #define ROUTER_IOCTL 'W' #define ROUTER_MAGIC 0x524D4157L enum router_ioctls { ROUTER_SETUP = ROUTER_IOCTL<<8, ROUTER_DOWN, ROUTER_STAT, ROUTER_IFNEW, ROUTER_IFDEL, ROUTER_IFSTAT, ROUTER_USER = (ROUTER_IOCTL<<8)+16, ROUTER_USER_MAX = (ROUTER_IOCTL<<8)+31 }; #define PROC_DATA_PORT_0 0x8000 #define PROC_DATA_PORT_1 0x8001 #define NLPID_IP 0xCC #define NLPID_SNAP 0x80 #define NLPID_CLNP 0x81 #define NLPID_ESIS 0x82 #define NLPID_ISIS 0x83 #define NLPID_Q933 0x08 #define WAN_IFNAME_SZ 15 #define WAN_DRVNAME_SZ 15 #define WAN_ADDRESS_SZ 31 #define USED_BY_FIELD 8 #define UDP_PTPIPE_TYPE 0x01 #define UDP_FPIPE_TYPE 0x02 #define UDP_CPIPE_TYPE 0x03 #define UDP_DRVSTATS_TYPE 0x04 #define UDP_INVALID_TYPE 0x05 #define CMD_OK 0 #define CMD_TIMEOUT 0xFF #define UDP_PKT_FRM_STACK 0x00 #define UDP_PKT_FRM_NETWORK 0x01 #define MAX_INTR_TEST_COUNTER 100 #define CRITICAL_IN_ISR 0xA1 #define CRITICAL_INTR_HANDLED 0xB1 typedef struct wan_x25_conf { unsigned lo_pvc; unsigned hi_pvc; unsigned lo_svc; unsigned hi_svc; unsigned hdlc_window; unsigned pkt_window; unsigned t1; unsigned t2; unsigned t4; unsigned n2; unsigned t10_t20; unsigned t11_t21; unsigned t12_t22; unsigned t13_t23; unsigned t16_t26; unsigned t28; unsigned r10_r20; unsigned r12_r22; unsigned r13_r23; unsigned ccitt_compat; unsigned x25_conf_opt; unsigned char LAPB_hdlc_only; unsigned char logging; unsigned char oob_on_modem; } wan_x25_conf_t; typedef struct wan_fr_conf { unsigned signalling; unsigned t391; unsigned t392; unsigned n391; unsigned n392; unsigned n393; unsigned dlci_num; unsigned dlci[100]; } wan_fr_conf_t; typedef struct wan_ppp_conf { unsigned restart_tmr; unsigned auth_rsrt_tmr; unsigned auth_wait_tmr; unsigned mdm_fail_tmr; unsigned dtr_drop_tmr; unsigned connect_tmout; unsigned conf_retry; unsigned term_retry; unsigned fail_retry; unsigned auth_retry; unsigned auth_options; unsigned ip_options; char authenticator; char ip_mode; } wan_ppp_conf_t; typedef struct wan_chdlc_conf { unsigned char ignore_dcd; unsigned char ignore_cts; unsigned char ignore_keepalive; unsigned char hdlc_streaming; unsigned char receive_only; unsigned keepalive_tx_tmr; unsigned keepalive_rx_tmr; unsigned keepalive_err_margin; unsigned slarp_timer; } wan_chdlc_conf_t; typedef struct wandev_conf { unsigned magic; unsigned config_id; unsigned ioport; unsigned long maddr; unsigned msize; int irq; int dma; char S514_CPU_no[1]; unsigned PCI_slot_no; char auto_pci_cfg; char comm_port; unsigned bps; unsigned mtu; unsigned udp_port; unsigned char ttl; unsigned char ft1; char interface; char clocking; char line_coding; char station; char connection; char read_mode; char receive_only; char tty; unsigned tty_major; unsigned tty_minor; unsigned tty_mode; char backup; unsigned hw_opt[4]; unsigned reserved[4]; unsigned data_size; void* data; union { wan_x25_conf_t x25; wan_ppp_conf_t ppp; wan_fr_conf_t fr; wan_chdlc_conf_t chdlc; } u; } wandev_conf_t; #define WANCONFIG_X25 101 #define WANCONFIG_FR 102 #define WANCONFIG_PPP 103 #define WANCONFIG_CHDLC 104 #define WANCONFIG_BSC 105 #define WANCONFIG_HDLC 106 #define WANCONFIG_MPPP 107 #define WANOPT_OFF 0 #define WANOPT_ON 1 #define WANOPT_NO 0 #define WANOPT_YES 1 #define WANOPT_RS232 0 #define WANOPT_V35 1 #define WANOPT_NRZ 0 #define WANOPT_NRZI 1 #define WANOPT_FM0 2 #define WANOPT_FM1 3 #define WANOPT_POINTTOPOINT 0 #define WANOPT_MULTIDROP 1 #define WANOPT_EXTERNAL 0 #define WANOPT_INTERNAL 1 #define WANOPT_DTE 0 #define WANOPT_DCE 1 #define WANOPT_CPE 0 #define WANOPT_NODE 1 #define WANOPT_SECONDARY 0 #define WANOPT_PRIMARY 1 #define WANOPT_PERMANENT 0 #define WANOPT_SWITCHED 1 #define WANOPT_ONDEMAND 2 #define WANOPT_FR_ANSI 1 #define WANOPT_FR_Q933 2 #define WANOPT_FR_LMI 3 #define WANOPT_PPP_STATIC 0 #define WANOPT_PPP_HOST 1 #define WANOPT_PPP_PEER 2 #define WANOPT_ONE 1 #define WANOPT_TWO 2 #define WANOPT_ONE_AND_HALF 3 #define WANOPT_NONE 0 #define WANOPT_ODD 1 #define WANOPT_EVEN 2 #define WANOPT_PRI 0 #define WANOPT_SEC 1 #define WANOPT_INTR 0 #define WANOPT_POLL 1 #define WANOPT_TTY_SYNC 0 #define WANOPT_TTY_ASYNC 1 typedef struct wandev_stat { unsigned state; unsigned ndev; unsigned connection; unsigned media_type; unsigned mtu; unsigned modem_status; unsigned rx_frames; unsigned rx_overruns; unsigned rx_crc_err; unsigned rx_aborts; unsigned rx_bad_length; unsigned rx_dropped; unsigned tx_frames; unsigned tx_underruns; unsigned tx_timeouts; unsigned tx_rejects; unsigned rx_bad_format; unsigned rx_bad_addr; unsigned tx_retries; unsigned reserved[16]; } wandev_stat_t; enum wan_states { WAN_UNCONFIGURED, WAN_DISCONNECTED, WAN_CONNECTING, WAN_CONNECTED, WAN_LIMIT, WAN_DUALPORT, WAN_DISCONNECTING, WAN_FT1_READY }; enum { WAN_LOCAL_IP, WAN_POINTOPOINT_IP, WAN_NETMASK_IP, WAN_BROADCAST_IP }; #define WAN_MODEM_CTS 0x0001 #define WAN_MODEM_DCD 0x0002 #define WAN_MODEM_DTR 0x0010 #define WAN_MODEM_RTS 0x0020 typedef struct wanif_conf { unsigned magic; unsigned config_id; char name[WAN_IFNAME_SZ+1]; char addr[WAN_ADDRESS_SZ+1]; char usedby[USED_BY_FIELD]; unsigned idle_timeout; unsigned hold_timeout; unsigned cir; unsigned bc; unsigned be; unsigned char enable_IPX; unsigned char inarp; unsigned inarp_interval; unsigned long network_number; char mc; char local_addr[WAN_ADDRESS_SZ+1]; unsigned char port; unsigned char protocol; char pap; char chap; unsigned char userid[511]; unsigned char passwd[511]; unsigned char sysname[31]; unsigned char ignore_dcd; unsigned char ignore_cts; unsigned char ignore_keepalive; unsigned char hdlc_streaming; unsigned keepalive_tx_tmr; unsigned keepalive_rx_tmr; unsigned keepalive_err_margin; unsigned slarp_timer; unsigned char ttl; char interface; char clocking; unsigned bps; unsigned mtu; unsigned char if_down; unsigned char gateway; unsigned char true_if_encoding; unsigned char asy_data_trans; unsigned char rts_hs_for_receive; unsigned char xon_xoff_hs_for_receive; unsigned char xon_xoff_hs_for_transmit; unsigned char dcd_hs_for_transmit; unsigned char cts_hs_for_transmit; unsigned char async_mode; unsigned tx_bits_per_char; unsigned rx_bits_per_char; unsigned stop_bits; unsigned char parity; unsigned break_timer; unsigned inter_char_timer; unsigned rx_complete_length; unsigned xon_char; unsigned xoff_char; unsigned char receive_only; } wanif_conf_t; #endif android-audiosystem-1.8+13.10.20130807/include/linux/ioctl.h0000644000015700001700000000135212200324306023740 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IOCTL_H #define _LINUX_IOCTL_H #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/config.h0000644000015700001700000000136012200324306024072 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_CONFIG_H #define _LINUX_CONFIG_H #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/telephony.h0000644000015700001700000001070112200324306024633 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef TELEPHONY_H #define TELEPHONY_H #define TELEPHONY_VERSION 3013 #define PHONE_VENDOR_IXJ 1 #define PHONE_VENDOR_QUICKNET PHONE_VENDOR_IXJ #define PHONE_VENDOR_VOICETRONIX 2 #define PHONE_VENDOR_ACULAB 3 #define PHONE_VENDOR_DIGI 4 #define PHONE_VENDOR_FRANKLIN 5 #define QTI_PHONEJACK 100 #define QTI_LINEJACK 300 #define QTI_PHONEJACK_LITE 400 #define QTI_PHONEJACK_PCI 500 #define QTI_PHONECARD 600 typedef enum { vendor = 0, device, port, codec, dsp } phone_cap; struct phone_capability { char desc[80]; phone_cap captype; int cap; int handle; }; typedef enum { pots = 0, pstn, handset, speaker } phone_ports; #define PHONE_CAPABILITIES _IO ('q', 0x80) #define PHONE_CAPABILITIES_LIST _IOR ('q', 0x81, struct phone_capability *) #define PHONE_CAPABILITIES_CHECK _IOW ('q', 0x82, struct phone_capability *) typedef struct { char month[3]; char day[3]; char hour[3]; char min[3]; int numlen; char number[11]; int namelen; char name[80]; } PHONE_CID; #define PHONE_RING _IO ('q', 0x83) #define PHONE_HOOKSTATE _IO ('q', 0x84) #define PHONE_MAXRINGS _IOW ('q', 0x85, char) #define PHONE_RING_CADENCE _IOW ('q', 0x86, short) #define OLD_PHONE_RING_START _IO ('q', 0x87) #define PHONE_RING_START _IOW ('q', 0x87, PHONE_CID *) #define PHONE_RING_STOP _IO ('q', 0x88) #define USA_RING_CADENCE 0xC0C0 #define PHONE_REC_CODEC _IOW ('q', 0x89, int) #define PHONE_REC_START _IO ('q', 0x8A) #define PHONE_REC_STOP _IO ('q', 0x8B) #define PHONE_REC_DEPTH _IOW ('q', 0x8C, int) #define PHONE_FRAME _IOW ('q', 0x8D, int) #define PHONE_REC_VOLUME _IOW ('q', 0x8E, int) #define PHONE_REC_VOLUME_LINEAR _IOW ('q', 0xDB, int) #define PHONE_REC_LEVEL _IO ('q', 0x8F) #define PHONE_PLAY_CODEC _IOW ('q', 0x90, int) #define PHONE_PLAY_START _IO ('q', 0x91) #define PHONE_PLAY_STOP _IO ('q', 0x92) #define PHONE_PLAY_DEPTH _IOW ('q', 0x93, int) #define PHONE_PLAY_VOLUME _IOW ('q', 0x94, int) #define PHONE_PLAY_VOLUME_LINEAR _IOW ('q', 0xDC, int) #define PHONE_PLAY_LEVEL _IO ('q', 0x95) #define PHONE_DTMF_READY _IOR ('q', 0x96, int) #define PHONE_GET_DTMF _IOR ('q', 0x97, int) #define PHONE_GET_DTMF_ASCII _IOR ('q', 0x98, int) #define PHONE_DTMF_OOB _IOW ('q', 0x99, int) #define PHONE_EXCEPTION _IOR ('q', 0x9A, int) #define PHONE_PLAY_TONE _IOW ('q', 0x9B, char) #define PHONE_SET_TONE_ON_TIME _IOW ('q', 0x9C, int) #define PHONE_SET_TONE_OFF_TIME _IOW ('q', 0x9D, int) #define PHONE_GET_TONE_ON_TIME _IO ('q', 0x9E) #define PHONE_GET_TONE_OFF_TIME _IO ('q', 0x9F) #define PHONE_GET_TONE_STATE _IO ('q', 0xA0) #define PHONE_BUSY _IO ('q', 0xA1) #define PHONE_RINGBACK _IO ('q', 0xA2) #define PHONE_DIALTONE _IO ('q', 0xA3) #define PHONE_CPT_STOP _IO ('q', 0xA4) #define PHONE_PSTN_SET_STATE _IOW ('q', 0xA4, int) #define PHONE_PSTN_GET_STATE _IO ('q', 0xA5) #define PSTN_ON_HOOK 0 #define PSTN_RINGING 1 #define PSTN_OFF_HOOK 2 #define PSTN_PULSE_DIAL 3 #define PHONE_WINK_DURATION _IOW ('q', 0xA6, int) #define PHONE_WINK _IOW ('q', 0xAA, int) typedef enum { G723_63 = 1, G723_53 = 2, TS85 = 3, TS48 = 4, TS41 = 5, G728 = 6, G729 = 7, ULAW = 8, ALAW = 9, LINEAR16 = 10, LINEAR8 = 11, WSS = 12, G729B = 13 } phone_codec; struct phone_codec_data { phone_codec type; unsigned short buf_min, buf_opt, buf_max; }; #define PHONE_QUERY_CODEC _IOWR ('q', 0xA7, struct phone_codec_data *) #define PHONE_PSTN_LINETEST _IO ('q', 0xA8) #define PHONE_VAD _IOW ('q', 0xA9, int) struct phone_except { unsigned int dtmf_ready:1; unsigned int hookstate:1; unsigned int pstn_ring:1; unsigned int caller_id:1; unsigned int pstn_wink:1; unsigned int f0:1; unsigned int f1:1; unsigned int f2:1; unsigned int f3:1; unsigned int flash:1; unsigned int fc0:1; unsigned int fc1:1; unsigned int fc2:1; unsigned int fc3:1; unsigned int reserved:18; }; union telephony_exception { struct phone_except bits; unsigned int bytes; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/irqflags.h0000644000015700001700000000273712200324306024446 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_TRACE_IRQFLAGS_H #define _LINUX_TRACE_IRQFLAGS_H #define trace_hardirqs_on() do { } while (0) #define trace_hardirqs_off() do { } while (0) #define trace_softirqs_on(ip) do { } while (0) #define trace_softirqs_off(ip) do { } while (0) #define trace_hardirq_context(p) 0 #define trace_softirq_context(p) 0 #define trace_hardirqs_enabled(p) 0 #define trace_softirqs_enabled(p) 0 #define trace_hardirq_enter() do { } while (0) #define trace_hardirq_exit() do { } while (0) #define trace_softirq_enter() do { } while (0) #define trace_softirq_exit() do { } while (0) #define INIT_TRACE_IRQFLAGS #define raw_local_irq_disable() local_irq_disable() #define raw_local_irq_enable() local_irq_enable() #define raw_local_irq_save(flags) local_irq_save(flags) #define raw_local_irq_restore(flags) local_irq_restore(flags) #endif android-audiosystem-1.8+13.10.20130807/include/linux/coda_fs_i.h0000644000015700001700000000132512200324306024534 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_CODA_FS_I #define _LINUX_CODA_FS_I #endif android-audiosystem-1.8+13.10.20130807/include/linux/pci_regs.h0000644000015700001700000003305112200324306024422 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef LINUX_PCI_REGS_H #define LINUX_PCI_REGS_H #define PCI_VENDOR_ID 0x00 #define PCI_DEVICE_ID 0x02 #define PCI_COMMAND 0x04 #define PCI_COMMAND_IO 0x1 #define PCI_COMMAND_MEMORY 0x2 #define PCI_COMMAND_MASTER 0x4 #define PCI_COMMAND_SPECIAL 0x8 #define PCI_COMMAND_INVALIDATE 0x10 #define PCI_COMMAND_VGA_PALETTE 0x20 #define PCI_COMMAND_PARITY 0x40 #define PCI_COMMAND_WAIT 0x80 #define PCI_COMMAND_SERR 0x100 #define PCI_COMMAND_FAST_BACK 0x200 #define PCI_COMMAND_INTX_DISABLE 0x400 #define PCI_STATUS 0x06 #define PCI_STATUS_CAP_LIST 0x10 #define PCI_STATUS_66MHZ 0x20 #define PCI_STATUS_UDF 0x40 #define PCI_STATUS_FAST_BACK 0x80 #define PCI_STATUS_PARITY 0x100 #define PCI_STATUS_DEVSEL_MASK 0x600 #define PCI_STATUS_DEVSEL_FAST 0x000 #define PCI_STATUS_DEVSEL_MEDIUM 0x200 #define PCI_STATUS_DEVSEL_SLOW 0x400 #define PCI_STATUS_SIG_TARGET_ABORT 0x800 #define PCI_STATUS_REC_TARGET_ABORT 0x1000 #define PCI_STATUS_REC_MASTER_ABORT 0x2000 #define PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 #define PCI_STATUS_DETECTED_PARITY 0x8000 #define PCI_CLASS_REVISION 0x08 #define PCI_REVISION_ID 0x08 #define PCI_CLASS_PROG 0x09 #define PCI_CLASS_DEVICE 0x0a #define PCI_CACHE_LINE_SIZE 0x0c #define PCI_LATENCY_TIMER 0x0d #define PCI_HEADER_TYPE 0x0e #define PCI_HEADER_TYPE_NORMAL 0 #define PCI_HEADER_TYPE_BRIDGE 1 #define PCI_HEADER_TYPE_CARDBUS 2 #define PCI_BIST 0x0f #define PCI_BIST_CODE_MASK 0x0f #define PCI_BIST_START 0x40 #define PCI_BIST_CAPABLE 0x80 #define PCI_BASE_ADDRESS_0 0x10 #define PCI_BASE_ADDRESS_1 0x14 #define PCI_BASE_ADDRESS_2 0x18 #define PCI_BASE_ADDRESS_3 0x1c #define PCI_BASE_ADDRESS_4 0x20 #define PCI_BASE_ADDRESS_5 0x24 #define PCI_BASE_ADDRESS_SPACE 0x01 #define PCI_BASE_ADDRESS_SPACE_IO 0x01 #define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00 #define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06 #define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 #define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 #define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 #define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 #define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL) #define PCI_BASE_ADDRESS_IO_MASK (~0x03UL) #define PCI_CARDBUS_CIS 0x28 #define PCI_SUBSYSTEM_VENDOR_ID 0x2c #define PCI_SUBSYSTEM_ID 0x2e #define PCI_ROM_ADDRESS 0x30 #define PCI_ROM_ADDRESS_ENABLE 0x01 #define PCI_ROM_ADDRESS_MASK (~0x7ffUL) #define PCI_CAPABILITY_LIST 0x34 #define PCI_INTERRUPT_LINE 0x3c #define PCI_INTERRUPT_PIN 0x3d #define PCI_MIN_GNT 0x3e #define PCI_MAX_LAT 0x3f #define PCI_PRIMARY_BUS 0x18 #define PCI_SECONDARY_BUS 0x19 #define PCI_SUBORDINATE_BUS 0x1a #define PCI_SEC_LATENCY_TIMER 0x1b #define PCI_IO_BASE 0x1c #define PCI_IO_LIMIT 0x1d #define PCI_IO_RANGE_TYPE_MASK 0x0fUL #define PCI_IO_RANGE_TYPE_16 0x00 #define PCI_IO_RANGE_TYPE_32 0x01 #define PCI_IO_RANGE_MASK (~0x0fUL) #define PCI_SEC_STATUS 0x1e #define PCI_MEMORY_BASE 0x20 #define PCI_MEMORY_LIMIT 0x22 #define PCI_MEMORY_RANGE_TYPE_MASK 0x0fUL #define PCI_MEMORY_RANGE_MASK (~0x0fUL) #define PCI_PREF_MEMORY_BASE 0x24 #define PCI_PREF_MEMORY_LIMIT 0x26 #define PCI_PREF_RANGE_TYPE_MASK 0x0fUL #define PCI_PREF_RANGE_TYPE_32 0x00 #define PCI_PREF_RANGE_TYPE_64 0x01 #define PCI_PREF_RANGE_MASK (~0x0fUL) #define PCI_PREF_BASE_UPPER32 0x28 #define PCI_PREF_LIMIT_UPPER32 0x2c #define PCI_IO_BASE_UPPER16 0x30 #define PCI_IO_LIMIT_UPPER16 0x32 #define PCI_ROM_ADDRESS1 0x38 #define PCI_BRIDGE_CONTROL 0x3e #define PCI_BRIDGE_CTL_PARITY 0x01 #define PCI_BRIDGE_CTL_SERR 0x02 #define PCI_BRIDGE_CTL_NO_ISA 0x04 #define PCI_BRIDGE_CTL_VGA 0x08 #define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 #define PCI_BRIDGE_CTL_BUS_RESET 0x40 #define PCI_BRIDGE_CTL_FAST_BACK 0x80 #define PCI_CB_CAPABILITY_LIST 0x14 #define PCI_CB_SEC_STATUS 0x16 #define PCI_CB_PRIMARY_BUS 0x18 #define PCI_CB_CARD_BUS 0x19 #define PCI_CB_SUBORDINATE_BUS 0x1a #define PCI_CB_LATENCY_TIMER 0x1b #define PCI_CB_MEMORY_BASE_0 0x1c #define PCI_CB_MEMORY_LIMIT_0 0x20 #define PCI_CB_MEMORY_BASE_1 0x24 #define PCI_CB_MEMORY_LIMIT_1 0x28 #define PCI_CB_IO_BASE_0 0x2c #define PCI_CB_IO_BASE_0_HI 0x2e #define PCI_CB_IO_LIMIT_0 0x30 #define PCI_CB_IO_LIMIT_0_HI 0x32 #define PCI_CB_IO_BASE_1 0x34 #define PCI_CB_IO_BASE_1_HI 0x36 #define PCI_CB_IO_LIMIT_1 0x38 #define PCI_CB_IO_LIMIT_1_HI 0x3a #define PCI_CB_IO_RANGE_MASK (~0x03UL) #define PCI_CB_BRIDGE_CONTROL 0x3e #define PCI_CB_BRIDGE_CTL_PARITY 0x01 #define PCI_CB_BRIDGE_CTL_SERR 0x02 #define PCI_CB_BRIDGE_CTL_ISA 0x04 #define PCI_CB_BRIDGE_CTL_VGA 0x08 #define PCI_CB_BRIDGE_CTL_MASTER_ABORT 0x20 #define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 #define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 #define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100 #define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200 #define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400 #define PCI_CB_SUBSYSTEM_VENDOR_ID 0x40 #define PCI_CB_SUBSYSTEM_ID 0x42 #define PCI_CB_LEGACY_MODE_BASE 0x44 #define PCI_CAP_LIST_ID 0 #define PCI_CAP_ID_PM 0x01 #define PCI_CAP_ID_AGP 0x02 #define PCI_CAP_ID_VPD 0x03 #define PCI_CAP_ID_SLOTID 0x04 #define PCI_CAP_ID_MSI 0x05 #define PCI_CAP_ID_CHSWP 0x06 #define PCI_CAP_ID_PCIX 0x07 #define PCI_CAP_ID_HT_IRQCONF 0x08 #define PCI_CAP_ID_VNDR 0x09 #define PCI_CAP_ID_SHPC 0x0C #define PCI_CAP_ID_EXP 0x10 #define PCI_CAP_ID_MSIX 0x11 #define PCI_CAP_LIST_NEXT 1 #define PCI_CAP_FLAGS 2 #define PCI_CAP_SIZEOF 4 #define PCI_PM_PMC 2 #define PCI_PM_CAP_VER_MASK 0x0007 #define PCI_PM_CAP_PME_CLOCK 0x0008 #define PCI_PM_CAP_RESERVED 0x0010 #define PCI_PM_CAP_DSI 0x0020 #define PCI_PM_CAP_AUX_POWER 0x01C0 #define PCI_PM_CAP_D1 0x0200 #define PCI_PM_CAP_D2 0x0400 #define PCI_PM_CAP_PME 0x0800 #define PCI_PM_CAP_PME_MASK 0xF800 #define PCI_PM_CAP_PME_D0 0x0800 #define PCI_PM_CAP_PME_D1 0x1000 #define PCI_PM_CAP_PME_D2 0x2000 #define PCI_PM_CAP_PME_D3 0x4000 #define PCI_PM_CAP_PME_D3cold 0x8000 #define PCI_PM_CTRL 4 #define PCI_PM_CTRL_STATE_MASK 0x0003 #define PCI_PM_CTRL_NO_SOFT_RESET 0x0004 #define PCI_PM_CTRL_PME_ENABLE 0x0100 #define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 #define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 #define PCI_PM_CTRL_PME_STATUS 0x8000 #define PCI_PM_PPB_EXTENSIONS 6 #define PCI_PM_PPB_B2_B3 0x40 #define PCI_PM_BPCC_ENABLE 0x80 #define PCI_PM_DATA_REGISTER 7 #define PCI_PM_SIZEOF 8 #define PCI_AGP_VERSION 2 #define PCI_AGP_RFU 3 #define PCI_AGP_STATUS 4 #define PCI_AGP_STATUS_RQ_MASK 0xff000000 #define PCI_AGP_STATUS_SBA 0x0200 #define PCI_AGP_STATUS_64BIT 0x0020 #define PCI_AGP_STATUS_FW 0x0010 #define PCI_AGP_STATUS_RATE4 0x0004 #define PCI_AGP_STATUS_RATE2 0x0002 #define PCI_AGP_STATUS_RATE1 0x0001 #define PCI_AGP_COMMAND 8 #define PCI_AGP_COMMAND_RQ_MASK 0xff000000 #define PCI_AGP_COMMAND_SBA 0x0200 #define PCI_AGP_COMMAND_AGP 0x0100 #define PCI_AGP_COMMAND_64BIT 0x0020 #define PCI_AGP_COMMAND_FW 0x0010 #define PCI_AGP_COMMAND_RATE4 0x0004 #define PCI_AGP_COMMAND_RATE2 0x0002 #define PCI_AGP_COMMAND_RATE1 0x0001 #define PCI_AGP_SIZEOF 12 #define PCI_VPD_ADDR 2 #define PCI_VPD_ADDR_MASK 0x7fff #define PCI_VPD_ADDR_F 0x8000 #define PCI_VPD_DATA 4 #define PCI_SID_ESR 2 #define PCI_SID_ESR_NSLOTS 0x1f #define PCI_SID_ESR_FIC 0x20 #define PCI_SID_CHASSIS_NR 3 #define PCI_MSI_FLAGS 2 #define PCI_MSI_FLAGS_64BIT 0x80 #define PCI_MSI_FLAGS_QSIZE 0x70 #define PCI_MSI_FLAGS_QMASK 0x0e #define PCI_MSI_FLAGS_ENABLE 0x01 #define PCI_MSI_FLAGS_MASKBIT 0x100 #define PCI_MSI_RFU 3 #define PCI_MSI_ADDRESS_LO 4 #define PCI_MSI_ADDRESS_HI 8 #define PCI_MSI_DATA_32 8 #define PCI_MSI_DATA_64 12 #define PCI_MSI_MASK_BIT 16 #define PCI_CHSWP_CSR 2 #define PCI_CHSWP_DHA 0x01 #define PCI_CHSWP_EIM 0x02 #define PCI_CHSWP_PIE 0x04 #define PCI_CHSWP_LOO 0x08 #define PCI_CHSWP_PI 0x30 #define PCI_CHSWP_EXT 0x40 #define PCI_CHSWP_INS 0x80 #define PCI_X_CMD 2 #define PCI_X_CMD_DPERR_E 0x0001 #define PCI_X_CMD_ERO 0x0002 #define PCI_X_CMD_MAX_READ 0x000c #define PCI_X_CMD_MAX_SPLIT 0x0070 #define PCI_X_CMD_VERSION(x) (((x) >> 12) & 3) #define PCI_X_STATUS 4 #define PCI_X_STATUS_DEVFN 0x000000ff #define PCI_X_STATUS_BUS 0x0000ff00 #define PCI_X_STATUS_64BIT 0x00010000 #define PCI_X_STATUS_133MHZ 0x00020000 #define PCI_X_STATUS_SPL_DISC 0x00040000 #define PCI_X_STATUS_UNX_SPL 0x00080000 #define PCI_X_STATUS_COMPLEX 0x00100000 #define PCI_X_STATUS_MAX_READ 0x00600000 #define PCI_X_STATUS_MAX_SPLIT 0x03800000 #define PCI_X_STATUS_MAX_CUM 0x1c000000 #define PCI_X_STATUS_SPL_ERR 0x20000000 #define PCI_X_STATUS_266MHZ 0x40000000 #define PCI_X_STATUS_533MHZ 0x80000000 #define PCI_EXP_FLAGS 2 #define PCI_EXP_FLAGS_VERS 0x000f #define PCI_EXP_FLAGS_TYPE 0x00f0 #define PCI_EXP_TYPE_ENDPOINT 0x0 #define PCI_EXP_TYPE_LEG_END 0x1 #define PCI_EXP_TYPE_ROOT_PORT 0x4 #define PCI_EXP_TYPE_UPSTREAM 0x5 #define PCI_EXP_TYPE_DOWNSTREAM 0x6 #define PCI_EXP_TYPE_PCI_BRIDGE 0x7 #define PCI_EXP_FLAGS_SLOT 0x0100 #define PCI_EXP_FLAGS_IRQ 0x3e00 #define PCI_EXP_DEVCAP 4 #define PCI_EXP_DEVCAP_PAYLOAD 0x07 #define PCI_EXP_DEVCAP_PHANTOM 0x18 #define PCI_EXP_DEVCAP_EXT_TAG 0x20 #define PCI_EXP_DEVCAP_L0S 0x1c0 #define PCI_EXP_DEVCAP_L1 0xe00 #define PCI_EXP_DEVCAP_ATN_BUT 0x1000 #define PCI_EXP_DEVCAP_ATN_IND 0x2000 #define PCI_EXP_DEVCAP_PWR_IND 0x4000 #define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 #define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 #define PCI_EXP_DEVCTL 8 #define PCI_EXP_DEVCTL_CERE 0x0001 #define PCI_EXP_DEVCTL_NFERE 0x0002 #define PCI_EXP_DEVCTL_FERE 0x0004 #define PCI_EXP_DEVCTL_URRE 0x0008 #define PCI_EXP_DEVCTL_RELAX_EN 0x0010 #define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 #define PCI_EXP_DEVCTL_EXT_TAG 0x0100 #define PCI_EXP_DEVCTL_PHANTOM 0x0200 #define PCI_EXP_DEVCTL_AUX_PME 0x0400 #define PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800 #define PCI_EXP_DEVCTL_READRQ 0x7000 #define PCI_EXP_DEVSTA 10 #define PCI_EXP_DEVSTA_CED 0x01 #define PCI_EXP_DEVSTA_NFED 0x02 #define PCI_EXP_DEVSTA_FED 0x04 #define PCI_EXP_DEVSTA_URD 0x08 #define PCI_EXP_DEVSTA_AUXPD 0x10 #define PCI_EXP_DEVSTA_TRPND 0x20 #define PCI_EXP_LNKCAP 12 #define PCI_EXP_LNKCTL 16 #define PCI_EXP_LNKSTA 18 #define PCI_EXP_SLTCAP 20 #define PCI_EXP_SLTCTL 24 #define PCI_EXP_SLTSTA 26 #define PCI_EXP_RTCTL 28 #define PCI_EXP_RTCTL_SECEE 0x01 #define PCI_EXP_RTCTL_SENFEE 0x02 #define PCI_EXP_RTCTL_SEFEE 0x04 #define PCI_EXP_RTCTL_PMEIE 0x08 #define PCI_EXP_RTCTL_CRSSVE 0x10 #define PCI_EXP_RTCAP 30 #define PCI_EXP_RTSTA 32 #define PCI_EXT_CAP_ID(header) (header & 0x0000ffff) #define PCI_EXT_CAP_VER(header) ((header >> 16) & 0xf) #define PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc) #define PCI_EXT_CAP_ID_ERR 1 #define PCI_EXT_CAP_ID_VC 2 #define PCI_EXT_CAP_ID_DSN 3 #define PCI_EXT_CAP_ID_PWR 4 #define PCI_ERR_UNCOR_STATUS 4 #define PCI_ERR_UNC_TRAIN 0x00000001 #define PCI_ERR_UNC_DLP 0x00000010 #define PCI_ERR_UNC_POISON_TLP 0x00001000 #define PCI_ERR_UNC_FCP 0x00002000 #define PCI_ERR_UNC_COMP_TIME 0x00004000 #define PCI_ERR_UNC_COMP_ABORT 0x00008000 #define PCI_ERR_UNC_UNX_COMP 0x00010000 #define PCI_ERR_UNC_RX_OVER 0x00020000 #define PCI_ERR_UNC_MALF_TLP 0x00040000 #define PCI_ERR_UNC_ECRC 0x00080000 #define PCI_ERR_UNC_UNSUP 0x00100000 #define PCI_ERR_UNCOR_MASK 8 #define PCI_ERR_UNCOR_SEVER 12 #define PCI_ERR_COR_STATUS 16 #define PCI_ERR_COR_RCVR 0x00000001 #define PCI_ERR_COR_BAD_TLP 0x00000040 #define PCI_ERR_COR_BAD_DLLP 0x00000080 #define PCI_ERR_COR_REP_ROLL 0x00000100 #define PCI_ERR_COR_REP_TIMER 0x00001000 #define PCI_ERR_COR_MASK 20 #define PCI_ERR_CAP 24 #define PCI_ERR_CAP_FEP(x) ((x) & 31) #define PCI_ERR_CAP_ECRC_GENC 0x00000020 #define PCI_ERR_CAP_ECRC_GENE 0x00000040 #define PCI_ERR_CAP_ECRC_CHKC 0x00000080 #define PCI_ERR_CAP_ECRC_CHKE 0x00000100 #define PCI_ERR_HEADER_LOG 28 #define PCI_ERR_ROOT_COMMAND 44 #define PCI_ERR_ROOT_CMD_COR_EN 0x00000001 #define PCI_ERR_ROOT_CMD_NONFATAL_EN 0x00000002 #define PCI_ERR_ROOT_CMD_FATAL_EN 0x00000004 #define PCI_ERR_ROOT_STATUS 48 #define PCI_ERR_ROOT_COR_RCV 0x00000001 #define PCI_ERR_ROOT_MULTI_COR_RCV 0x00000002 #define PCI_ERR_ROOT_UNCOR_RCV 0x00000004 #define PCI_ERR_ROOT_MULTI_UNCOR_RCV 0x00000008 #define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 #define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 #define PCI_ERR_ROOT_FATAL_RCV 0x00000040 #define PCI_ERR_ROOT_COR_SRC 52 #define PCI_ERR_ROOT_SRC 54 #define PCI_VC_PORT_REG1 4 #define PCI_VC_PORT_REG2 8 #define PCI_VC_PORT_CTRL 12 #define PCI_VC_PORT_STATUS 14 #define PCI_VC_RES_CAP 16 #define PCI_VC_RES_CTRL 20 #define PCI_VC_RES_STATUS 26 #define PCI_PWR_DSR 4 #define PCI_PWR_DATA 8 #define PCI_PWR_DATA_BASE(x) ((x) & 0xff) #define PCI_PWR_DATA_SCALE(x) (((x) >> 8) & 3) #define PCI_PWR_DATA_PM_SUB(x) (((x) >> 10) & 7) #define PCI_PWR_DATA_PM_STATE(x) (((x) >> 13) & 3) #define PCI_PWR_DATA_TYPE(x) (((x) >> 15) & 7) #define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) #define PCI_PWR_CAP 12 #define PCI_PWR_CAP_BUDGET(x) ((x) & 1) #endif android-audiosystem-1.8+13.10.20130807/include/linux/ipv6_route.h0000644000015700001700000000310412200324306024725 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IPV6_ROUTE_H #define _LINUX_IPV6_ROUTE_H #include #define RTF_DEFAULT 0x00010000 #define RTF_ALLONLINK 0x00020000 #define RTF_ADDRCONF 0x00040000 #define RTF_PREFIX_RT 0x00080000 #define RTF_ANYCAST 0x00100000 #define RTF_NONEXTHOP 0x00200000 #define RTF_EXPIRES 0x00400000 #define RTF_ROUTEINFO 0x00800000 #define RTF_CACHE 0x01000000 #define RTF_FLOW 0x02000000 #define RTF_POLICY 0x04000000 #define RTF_PREF(pref) ((pref) << 27) #define RTF_PREF_MASK 0x18000000 #define RTF_LOCAL 0x80000000 struct in6_rtmsg { struct in6_addr rtmsg_dst; struct in6_addr rtmsg_src; struct in6_addr rtmsg_gateway; __u32 rtmsg_type; __u16 rtmsg_dst_len; __u16 rtmsg_src_len; __u32 rtmsg_metric; unsigned long rtmsg_info; __u32 rtmsg_flags; int rtmsg_ifindex; }; #define RTMSG_NEWDEVICE 0x11 #define RTMSG_DELDEVICE 0x12 #define RTMSG_NEWROUTE 0x21 #define RTMSG_DELROUTE 0x22 #endif android-audiosystem-1.8+13.10.20130807/include/linux/reboot.h0000644000015700001700000000236612200324306024126 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_REBOOT_H #define _LINUX_REBOOT_H #define LINUX_REBOOT_MAGIC1 0xfee1dead #define LINUX_REBOOT_MAGIC2 672274793 #define LINUX_REBOOT_MAGIC2A 85072278 #define LINUX_REBOOT_MAGIC2B 369367448 #define LINUX_REBOOT_MAGIC2C 537993216 #define LINUX_REBOOT_CMD_RESTART 0x01234567 #define LINUX_REBOOT_CMD_HALT 0xCDEF0123 #define LINUX_REBOOT_CMD_CAD_ON 0x89ABCDEF #define LINUX_REBOOT_CMD_CAD_OFF 0x00000000 #define LINUX_REBOOT_CMD_POWER_OFF 0x4321FEDC #define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4 #define LINUX_REBOOT_CMD_SW_SUSPEND 0xD000FCE2 #define LINUX_REBOOT_CMD_KEXEC 0x45584543 #endif android-audiosystem-1.8+13.10.20130807/include/linux/user.h0000644000015700001700000000126112200324306023603 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #include android-audiosystem-1.8+13.10.20130807/include/linux/spinlock_types_up.h0000644000015700001700000000172612200324306026405 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_SPINLOCK_TYPES_UP_H #define __LINUX_SPINLOCK_TYPES_UP_H #ifndef __LINUX_SPINLOCK_TYPES_H #error "please don't include this file directly" #endif typedef struct { } raw_spinlock_t; #define __RAW_SPIN_LOCK_UNLOCKED { } typedef struct { } raw_rwlock_t; #define __RAW_RW_LOCK_UNLOCKED { } #endif android-audiosystem-1.8+13.10.20130807/include/linux/quota.h0000644000015700001700000000453212200324306023762 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_QUOTA_ #define _LINUX_QUOTA_ #include #include #define __DQUOT_VERSION__ "dquot_6.5.1" #define __DQUOT_NUM_VERSION__ 6*10000+5*100+1 typedef __kernel_uid32_t qid_t; typedef __u64 qsize_t; #define QUOTABLOCK_BITS 10 #define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS) #define qb2kb(x) ((x) << (QUOTABLOCK_BITS-10)) #define kb2qb(x) ((x) >> (QUOTABLOCK_BITS-10)) #define toqb(x) (((x) + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS) #define MAXQUOTAS 2 #define USRQUOTA 0 #define GRPQUOTA 1 #define INITQFNAMES { "user", "group", "undefined", }; #define SUBCMDMASK 0x00ff #define SUBCMDSHIFT 8 #define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK)) #define Q_SYNC 0x800001 #define Q_QUOTAON 0x800002 #define Q_QUOTAOFF 0x800003 #define Q_GETFMT 0x800004 #define Q_GETINFO 0x800005 #define Q_SETINFO 0x800006 #define Q_GETQUOTA 0x800007 #define Q_SETQUOTA 0x800008 #define QIF_BLIMITS 1 #define QIF_SPACE 2 #define QIF_ILIMITS 4 #define QIF_INODES 8 #define QIF_BTIME 16 #define QIF_ITIME 32 #define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) #define QIF_USAGE (QIF_SPACE | QIF_INODES) #define QIF_TIMES (QIF_BTIME | QIF_ITIME) #define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES) struct if_dqblk { __u64 dqb_bhardlimit; __u64 dqb_bsoftlimit; __u64 dqb_curspace; __u64 dqb_ihardlimit; __u64 dqb_isoftlimit; __u64 dqb_curinodes; __u64 dqb_btime; __u64 dqb_itime; __u32 dqb_valid; }; #define IIF_BGRACE 1 #define IIF_IGRACE 2 #define IIF_FLAGS 4 #define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS) struct if_dqinfo { __u64 dqi_bgrace; __u64 dqi_igrace; __u32 dqi_flags; __u32 dqi_valid; }; #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/dccp.h0000644000015700001700000000571112200324306023542 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_DCCP_H #define _LINUX_DCCP_H #include #include struct dccp_hdr { __be16 dccph_sport, dccph_dport; __u8 dccph_doff; #ifdef __LITTLE_ENDIAN_BITFIELD __u8 dccph_cscov:4, dccph_ccval:4; #elif defined(__BIG_ENDIAN_BITFIELD) __u8 dccph_ccval:4, dccph_cscov:4; #else #error "Adjust your defines" #endif __u16 dccph_checksum; #ifdef __LITTLE_ENDIAN_BITFIELD __u8 dccph_x:1, dccph_type:4, dccph_reserved:3; #elif defined(__BIG_ENDIAN_BITFIELD) __u8 dccph_reserved:3, dccph_type:4, dccph_x:1; #else #error "Adjust your defines" #endif __u8 dccph_seq2; __be16 dccph_seq; }; struct dccp_hdr_ext { __be32 dccph_seq_low; }; struct dccp_hdr_request { __be32 dccph_req_service; }; struct dccp_hdr_ack_bits { __be16 dccph_reserved1; __be16 dccph_ack_nr_high; __be32 dccph_ack_nr_low; }; struct dccp_hdr_response { struct dccp_hdr_ack_bits dccph_resp_ack; __be32 dccph_resp_service; }; struct dccp_hdr_reset { struct dccp_hdr_ack_bits dccph_reset_ack; __u8 dccph_reset_code, dccph_reset_data[3]; }; enum dccp_pkt_type { DCCP_PKT_REQUEST = 0, DCCP_PKT_RESPONSE, DCCP_PKT_DATA, DCCP_PKT_ACK, DCCP_PKT_DATAACK, DCCP_PKT_CLOSEREQ, DCCP_PKT_CLOSE, DCCP_PKT_RESET, DCCP_PKT_SYNC, DCCP_PKT_SYNCACK, DCCP_PKT_INVALID, }; #define DCCP_NR_PKT_TYPES DCCP_PKT_INVALID enum { DCCPO_PADDING = 0, DCCPO_MANDATORY = 1, DCCPO_MIN_RESERVED = 3, DCCPO_MAX_RESERVED = 31, DCCPO_CHANGE_L = 32, DCCPO_CONFIRM_L = 33, DCCPO_CHANGE_R = 34, DCCPO_CONFIRM_R = 35, DCCPO_NDP_COUNT = 37, DCCPO_ACK_VECTOR_0 = 38, DCCPO_ACK_VECTOR_1 = 39, DCCPO_TIMESTAMP = 41, DCCPO_TIMESTAMP_ECHO = 42, DCCPO_ELAPSED_TIME = 43, DCCPO_MAX = 45, DCCPO_MIN_CCID_SPECIFIC = 128, DCCPO_MAX_CCID_SPECIFIC = 255, }; enum { DCCPF_RESERVED = 0, DCCPF_CCID = 1, DCCPF_SEQUENCE_WINDOW = 3, DCCPF_ACK_RATIO = 5, DCCPF_SEND_ACK_VECTOR = 6, DCCPF_SEND_NDP_COUNT = 7, DCCPF_MIN_CCID_SPECIFIC = 128, DCCPF_MAX_CCID_SPECIFIC = 255, }; struct dccp_so_feat { __u8 dccpsf_feat; __u8 *dccpsf_val; __u8 dccpsf_len; }; #define DCCP_SOCKOPT_PACKET_SIZE 1 #define DCCP_SOCKOPT_SERVICE 2 #define DCCP_SOCKOPT_CHANGE_L 3 #define DCCP_SOCKOPT_CHANGE_R 4 #define DCCP_SOCKOPT_CCID_RX_INFO 128 #define DCCP_SOCKOPT_CCID_TX_INFO 192 #define DCCP_SERVICE_LIST_MAX_LEN 32 #endif android-audiosystem-1.8+13.10.20130807/include/linux/cpumask.h0000644000015700001700000001100512200324306024265 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_CPUMASK_H #define __LINUX_CPUMASK_H #include #include #include typedef struct { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; #define cpu_set(cpu, dst) __cpu_set((cpu), &(dst)) #define cpu_clear(cpu, dst) __cpu_clear((cpu), &(dst)) #define cpus_setall(dst) __cpus_setall(&(dst), NR_CPUS) #define cpus_clear(dst) __cpus_clear(&(dst), NR_CPUS) #define cpu_isset(cpu, cpumask) test_bit((cpu), (cpumask).bits) #define cpu_test_and_set(cpu, cpumask) __cpu_test_and_set((cpu), &(cpumask)) #define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS) #define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS) #define cpus_xor(dst, src1, src2) __cpus_xor(&(dst), &(src1), &(src2), NR_CPUS) #define cpus_andnot(dst, src1, src2) __cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS) #define cpus_complement(dst, src) __cpus_complement(&(dst), &(src), NR_CPUS) #define cpus_equal(src1, src2) __cpus_equal(&(src1), &(src2), NR_CPUS) #define cpus_intersects(src1, src2) __cpus_intersects(&(src1), &(src2), NR_CPUS) #define cpus_subset(src1, src2) __cpus_subset(&(src1), &(src2), NR_CPUS) #define cpus_empty(src) __cpus_empty(&(src), NR_CPUS) #define cpus_full(cpumask) __cpus_full(&(cpumask), NR_CPUS) #define cpus_weight(cpumask) __cpus_weight(&(cpumask), NR_CPUS) #define cpus_shift_right(dst, src, n) __cpus_shift_right(&(dst), &(src), (n), NR_CPUS) #define cpus_shift_left(dst, src, n) __cpus_shift_left(&(dst), &(src), (n), NR_CPUS) #define first_cpu(src) 0 #define next_cpu(n, src) 1 #define cpumask_of_cpu(cpu) ({ typeof(_unused_cpumask_arg_) m; if (sizeof(m) == sizeof(unsigned long)) { m.bits[0] = 1UL<<(cpu); } else { cpus_clear(m); cpu_set((cpu), m); } m; }) #define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS) #if NR_CPUS <= BITS_PER_LONG #define CPU_MASK_ALL (cpumask_t) { { [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD } } #else #define CPU_MASK_ALL (cpumask_t) { { [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD } } #endif #define CPU_MASK_NONE (cpumask_t) { { [0 ... BITS_TO_LONGS(NR_CPUS)-1] = 0UL } } #define CPU_MASK_CPU0 (cpumask_t) { { [0] = 1UL } } #define cpus_addr(src) ((src).bits) #define cpumask_scnprintf(buf, len, src) __cpumask_scnprintf((buf), (len), &(src), NR_CPUS) #define cpumask_parse(ubuf, ulen, dst) __cpumask_parse((ubuf), (ulen), &(dst), NR_CPUS) #define cpulist_scnprintf(buf, len, src) __cpulist_scnprintf((buf), (len), &(src), NR_CPUS) #define cpulist_parse(buf, dst) __cpulist_parse((buf), &(dst), NR_CPUS) #define cpu_remap(oldbit, old, new) __cpu_remap((oldbit), &(old), &(new), NR_CPUS) #define cpus_remap(dst, src, old, new) __cpus_remap(&(dst), &(src), &(old), &(new), NR_CPUS) #if NR_CPUS > 1 #define for_each_cpu_mask(cpu, mask) for ((cpu) = first_cpu(mask); (cpu) < NR_CPUS; (cpu) = next_cpu((cpu), (mask))) #else #define for_each_cpu_mask(cpu, mask) for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) #endif #if NR_CPUS > 1 #define num_online_cpus() cpus_weight(cpu_online_map) #define num_possible_cpus() cpus_weight(cpu_possible_map) #define num_present_cpus() cpus_weight(cpu_present_map) #define cpu_online(cpu) cpu_isset((cpu), cpu_online_map) #define cpu_possible(cpu) cpu_isset((cpu), cpu_possible_map) #define cpu_present(cpu) cpu_isset((cpu), cpu_present_map) #else #define num_online_cpus() 1 #define num_possible_cpus() 1 #define num_present_cpus() 1 #define cpu_online(cpu) ((cpu) == 0) #define cpu_possible(cpu) ((cpu) == 0) #define cpu_present(cpu) ((cpu) == 0) #endif #define highest_possible_processor_id() 0 #define any_online_cpu(mask) 0 #define for_each_possible_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map) #define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map) #define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map) #endif android-audiosystem-1.8+13.10.20130807/include/linux/bio.h0000644000015700001700000001330412200324306023377 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_BIO_H #define __LINUX_BIO_H #include #include #include #include #if defined(BIO_VMERGE_MAX_SIZE) && defined(BIO_VMERGE_BOUNDARY) #define BIOVEC_VIRT_START_SIZE(x) (bvec_to_phys(x) & (BIO_VMERGE_BOUNDARY - 1)) #define BIOVEC_VIRT_OVERSIZE(x) ((x) > BIO_VMERGE_MAX_SIZE) #else #define BIOVEC_VIRT_START_SIZE(x) 0 #define BIOVEC_VIRT_OVERSIZE(x) 0 #endif #ifndef BIO_VMERGE_BOUNDARY #define BIO_VMERGE_BOUNDARY 0 #endif #define BIO_DEBUG #ifdef BIO_DEBUG #define BIO_BUG_ON BUG_ON #else #define BIO_BUG_ON #endif #define BIO_MAX_PAGES 256 #define BIO_MAX_SIZE (BIO_MAX_PAGES << PAGE_CACHE_SHIFT) #define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9) struct bio_vec { struct page *bv_page; unsigned int bv_len; unsigned int bv_offset; }; struct bio_set; struct bio; typedef int (bio_end_io_t) (struct bio *, unsigned int, int); typedef void (bio_destructor_t) (struct bio *); struct bio { sector_t bi_sector; struct bio *bi_next; struct block_device *bi_bdev; unsigned long bi_flags; unsigned long bi_rw; unsigned short bi_vcnt; unsigned short bi_idx; unsigned short bi_phys_segments; unsigned short bi_hw_segments; unsigned int bi_size; unsigned int bi_hw_front_size; unsigned int bi_hw_back_size; unsigned int bi_max_vecs; struct bio_vec *bi_io_vec; bio_end_io_t *bi_end_io; atomic_t bi_cnt; void *bi_private; bio_destructor_t *bi_destructor; }; #define BIO_UPTODATE 0 #define BIO_RW_BLOCK 1 #define BIO_EOF 2 #define BIO_SEG_VALID 3 #define BIO_CLONED 4 #define BIO_BOUNCED 5 #define BIO_USER_MAPPED 6 #define BIO_EOPNOTSUPP 7 #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) #define BIO_POOL_BITS (4) #define BIO_POOL_OFFSET (BITS_PER_LONG - BIO_POOL_BITS) #define BIO_POOL_MASK (1UL << BIO_POOL_OFFSET) #define BIO_POOL_IDX(bio) ((bio)->bi_flags >> BIO_POOL_OFFSET) #define BIO_RW 0 #define BIO_RW_AHEAD 1 #define BIO_RW_BARRIER 2 #define BIO_RW_FAILFAST 3 #define BIO_RW_SYNC 4 #define BIO_PRIO_SHIFT (8 * sizeof(unsigned long) - IOPRIO_BITS) #define bio_prio(bio) ((bio)->bi_rw >> BIO_PRIO_SHIFT) #define bio_prio_valid(bio) ioprio_valid(bio_prio(bio)) #define bio_set_prio(bio, prio) do { WARN_ON(prio >= (1 << IOPRIO_BITS)); (bio)->bi_rw &= ((1UL << BIO_PRIO_SHIFT) - 1); (bio)->bi_rw |= ((unsigned long) (prio) << BIO_PRIO_SHIFT); } while (0) #define bio_iovec_idx(bio, idx) (&((bio)->bi_io_vec[(idx)])) #define bio_iovec(bio) bio_iovec_idx((bio), (bio)->bi_idx) #define bio_page(bio) bio_iovec((bio))->bv_page #define bio_offset(bio) bio_iovec((bio))->bv_offset #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) #define bio_sectors(bio) ((bio)->bi_size >> 9) #define bio_cur_sectors(bio) (bio_iovec(bio)->bv_len >> 9) #define bio_data(bio) (page_address(bio_page((bio))) + bio_offset((bio))) #define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER)) #define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC)) #define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST)) #define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD)) #define bio_to_phys(bio) (page_to_phys(bio_page((bio))) + (unsigned long) bio_offset((bio))) #define bvec_to_phys(bv) (page_to_phys((bv)->bv_page) + (unsigned long) (bv)->bv_offset) #define __bio_kmap_atomic(bio, idx, kmtype) (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page, kmtype) + bio_iovec_idx((bio), (idx))->bv_offset) #define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr, kmtype) #define __BVEC_END(bio) bio_iovec_idx((bio), (bio)->bi_vcnt - 1) #define __BVEC_START(bio) bio_iovec_idx((bio), (bio)->bi_idx) #ifndef BIOVEC_PHYS_MERGEABLE #define BIOVEC_PHYS_MERGEABLE(vec1, vec2) ((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2))) #endif #define BIOVEC_VIRT_MERGEABLE(vec1, vec2) ((((bvec_to_phys((vec1)) + (vec1)->bv_len) | bvec_to_phys((vec2))) & (BIO_VMERGE_BOUNDARY - 1)) == 0) #define __BIO_SEG_BOUNDARY(addr1, addr2, mask) (((addr1) | (mask)) == (((addr2) - 1) | (mask))) #define BIOVEC_SEG_BOUNDARY(q, b1, b2) __BIO_SEG_BOUNDARY(bvec_to_phys((b1)), bvec_to_phys((b2)) + (b2)->bv_len, (q)->seg_boundary_mask) #define BIO_SEG_BOUNDARY(q, b1, b2) BIOVEC_SEG_BOUNDARY((q), __BVEC_END((b1)), __BVEC_START((b2))) #define bio_io_error(bio, bytes) bio_endio((bio), (bytes), -EIO) #define __bio_for_each_segment(bvl, bio, i, start_idx) for (bvl = bio_iovec_idx((bio), (start_idx)), i = (start_idx); i < (bio)->bi_vcnt; bvl++, i++) #define bio_for_each_segment(bvl, bio, i) __bio_for_each_segment(bvl, bio, i, (bio)->bi_idx) #define bio_get(bio) atomic_inc(&(bio)->bi_cnt) struct bio_pair { struct bio bio1, bio2; struct bio_vec bv1, bv2; atomic_t cnt; int error; }; struct request_queue; struct sg_iovec; #define bvec_kmap_irq(bvec, flags) (page_address((bvec)->bv_page) + (bvec)->bv_offset) #define bvec_kunmap_irq(buf, flags) do { *(flags) = 0; } while (0) #define __bio_kunmap_irq(buf, flags) bvec_kunmap_irq(buf, flags) #define bio_kmap_irq(bio, flags) __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) #define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) #endif android-audiosystem-1.8+13.10.20130807/include/linux/msm_hw3d.h0000644000015700001700000000256512200324306024356 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _MSM_HW3D_H_ #define _MSM_HW3D_H_ #include #include struct hw3d_region; #define HW3D_IOCTL_MAGIC 'h' #define HW3D_WAIT_FOR_REVOKE _IO(HW3D_IOCTL_MAGIC, 0x80) #define HW3D_WAIT_FOR_INTERRUPT _IO(HW3D_IOCTL_MAGIC, 0x81) #define HW3D_GET_REGIONS _IOR(HW3D_IOCTL_MAGIC, 0x82, struct hw3d_region *) #define HW3D_REGION_OFFSET(id) ((((uint32_t)(id)) & 0xf) << 28) #define HW3D_REGION_ID(addr) (((uint32_t)(addr) >> 28) & 0xf) #define HW3D_OFFSET_IN_REGION(addr) ((uint32_t)(addr) & ~(0xfUL << 28)) enum { HW3D_EBI = 0, HW3D_SMI = 1, HW3D_REGS = 2, HW3D_NUM_REGIONS = HW3D_REGS + 1, }; struct hw3d_region { unsigned long phys; unsigned long map_offset; unsigned long len; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/rwsem.h0000644000015700001700000000135512200324306023766 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_RWSEM_H #define _LINUX_RWSEM_H #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/raid/0000755000015700001700000000000012200324404023372 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/linux/raid/md_p.h0000644000015700001700000000700212200324306024462 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _MD_P_H #define _MD_P_H #define MD_RESERVED_BYTES (64 * 1024) #define MD_RESERVED_SECTORS (MD_RESERVED_BYTES / 512) #define MD_RESERVED_BLOCKS (MD_RESERVED_BYTES / BLOCK_SIZE) #define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS) #define MD_NEW_SIZE_BLOCKS(x) ((x & ~(MD_RESERVED_BLOCKS - 1)) - MD_RESERVED_BLOCKS) #define MD_SB_BYTES 4096 #define MD_SB_WORDS (MD_SB_BYTES / 4) #define MD_SB_BLOCKS (MD_SB_BYTES / BLOCK_SIZE) #define MD_SB_SECTORS (MD_SB_BYTES / 512) #define MD_SB_GENERIC_OFFSET 0 #define MD_SB_PERSONALITY_OFFSET 64 #define MD_SB_DISKS_OFFSET 128 #define MD_SB_DESCRIPTOR_OFFSET 992 #define MD_SB_GENERIC_CONSTANT_WORDS 32 #define MD_SB_GENERIC_STATE_WORDS 32 #define MD_SB_GENERIC_WORDS (MD_SB_GENERIC_CONSTANT_WORDS + MD_SB_GENERIC_STATE_WORDS) #define MD_SB_PERSONALITY_WORDS 64 #define MD_SB_DESCRIPTOR_WORDS 32 #define MD_SB_DISKS 27 #define MD_SB_DISKS_WORDS (MD_SB_DISKS*MD_SB_DESCRIPTOR_WORDS) #define MD_SB_RESERVED_WORDS (1024 - MD_SB_GENERIC_WORDS - MD_SB_PERSONALITY_WORDS - MD_SB_DISKS_WORDS - MD_SB_DESCRIPTOR_WORDS) #define MD_SB_EQUAL_WORDS (MD_SB_GENERIC_WORDS + MD_SB_PERSONALITY_WORDS + MD_SB_DISKS_WORDS) #define MD_DISK_FAULTY 0 #define MD_DISK_ACTIVE 1 #define MD_DISK_SYNC 2 #define MD_DISK_REMOVED 3 #define MD_DISK_WRITEMOSTLY 9 typedef struct mdp_device_descriptor_s { __u32 number; __u32 major; __u32 minor; __u32 raid_disk; __u32 state; __u32 reserved[MD_SB_DESCRIPTOR_WORDS - 5]; } mdp_disk_t; #define MD_SB_MAGIC 0xa92b4efc #define MD_SB_CLEAN 0 #define MD_SB_ERRORS 1 #define MD_SB_BITMAP_PRESENT 8 typedef struct mdp_superblock_s { __u32 md_magic; __u32 major_version; __u32 minor_version; __u32 patch_version; __u32 gvalid_words; __u32 set_uuid0; __u32 ctime; __u32 level; __u32 size; __u32 nr_disks; __u32 raid_disks; __u32 md_minor; __u32 not_persistent; __u32 set_uuid1; __u32 set_uuid2; __u32 set_uuid3; __u32 gstate_creserved[MD_SB_GENERIC_CONSTANT_WORDS - 16]; __u32 utime; __u32 state; __u32 active_disks; __u32 working_disks; __u32 failed_disks; __u32 spare_disks; __u32 sb_csum; #ifdef __BIG_ENDIAN __u32 events_hi; __u32 events_lo; __u32 cp_events_hi; __u32 cp_events_lo; #else __u32 events_lo; __u32 events_hi; __u32 cp_events_lo; __u32 cp_events_hi; #endif __u32 recovery_cp; __u64 reshape_position; __u32 new_level; __u32 delta_disks; __u32 new_layout; __u32 new_chunk; __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 18]; __u32 layout; __u32 chunk_size; __u32 root_pv; __u32 root_block; __u32 pstate_reserved[MD_SB_PERSONALITY_WORDS - 4]; mdp_disk_t disks[MD_SB_DISKS]; __u32 reserved[MD_SB_RESERVED_WORDS]; mdp_disk_t this_disk; } mdp_super_t; #define WriteMostly1 1 #define MD_FEATURE_BITMAP_OFFSET 1 #define MD_FEATURE_RECOVERY_OFFSET 2 #define MD_FEATURE_RESHAPE_ACTIVE 4 #define MD_FEATURE_ALL (1|2|4) #endif android-audiosystem-1.8+13.10.20130807/include/linux/raid/md_k.h0000644000015700001700000001064512200324306024464 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _MD_K_H #define _MD_K_H #include "../../../drivers/md/dm-bio-list.h" #define LEVEL_MULTIPATH (-4) #define LEVEL_LINEAR (-1) #define LEVEL_FAULTY (-5) #define LEVEL_NONE (-1000000) #define MaxSector (~(sector_t)0) #define MD_THREAD_NAME_MAX 14 typedef struct mddev_s mddev_t; typedef struct mdk_rdev_s mdk_rdev_t; #define MAX_MD_DEVS 256 #define MAX_CHUNK_SIZE (1<<30) struct mdk_rdev_s { struct list_head same_set; sector_t size; mddev_t *mddev; unsigned long last_events; struct block_device *bdev; struct page *sb_page; int sb_loaded; __u64 sb_events; sector_t data_offset; sector_t sb_offset; int sb_size; int preferred_minor; struct kobject kobj; unsigned long flags; #define Faulty 1 #define In_sync 2 #define WriteMostly 4 #define BarriersNotsupp 5 int desc_nr; int raid_disk; int saved_raid_disk; sector_t recovery_offset; atomic_t nr_pending; atomic_t read_errors; atomic_t corrected_errors; }; struct mddev_s { void *private; struct mdk_personality *pers; dev_t unit; int md_minor; struct list_head disks; int sb_dirty; int ro; struct gendisk *gendisk; struct kobject kobj; int major_version, minor_version, patch_version; int persistent; int chunk_size; time_t ctime, utime; int level, layout; char clevel[16]; int raid_disks; int max_disks; sector_t size; sector_t array_size; __u64 events; char uuid[16]; sector_t reshape_position; int delta_disks, new_level, new_layout, new_chunk; struct mdk_thread_s *thread; struct mdk_thread_s *sync_thread; sector_t curr_resync; unsigned long resync_mark; sector_t resync_mark_cnt; sector_t curr_mark_cnt; sector_t resync_max_sectors; sector_t resync_mismatches; sector_t suspend_lo; sector_t suspend_hi; int sync_speed_min; int sync_speed_max; int ok_start_degraded; #define MD_RECOVERY_RUNNING 0 #define MD_RECOVERY_SYNC 1 #define MD_RECOVERY_ERR 2 #define MD_RECOVERY_INTR 3 #define MD_RECOVERY_DONE 4 #define MD_RECOVERY_NEEDED 5 #define MD_RECOVERY_REQUESTED 6 #define MD_RECOVERY_CHECK 7 #define MD_RECOVERY_RESHAPE 8 #define MD_RECOVERY_FROZEN 9 unsigned long recovery; int in_sync; struct mutex reconfig_mutex; atomic_t active; int changed; int degraded; int barriers_work; struct bio *biolist; atomic_t recovery_active; wait_queue_head_t recovery_wait; sector_t recovery_cp; spinlock_t write_lock; wait_queue_head_t sb_wait; atomic_t pending_writes; unsigned int safemode; unsigned int safemode_delay; struct timer_list safemode_timer; atomic_t writes_pending; request_queue_t *queue; atomic_t write_behind; unsigned int max_write_behind; struct bitmap *bitmap; struct file *bitmap_file; long bitmap_offset; long default_bitmap_offset; struct list_head all_mddevs; }; struct md_sysfs_entry { struct attribute attr; ssize_t (*show)(mddev_t *, char *); ssize_t (*store)(mddev_t *, const char *, size_t); }; #define ITERATE_RDEV_GENERIC(head,rdev,tmp) for ((tmp) = (head).next; (rdev) = (list_entry((tmp), mdk_rdev_t, same_set)), (tmp) = (tmp)->next, (tmp)->prev != &(head) ; ) #define ITERATE_RDEV(mddev,rdev,tmp) ITERATE_RDEV_GENERIC((mddev)->disks,rdev,tmp) #define ITERATE_RDEV_PENDING(rdev,tmp) ITERATE_RDEV_GENERIC(pending_raid_disks,rdev,tmp) #define THREAD_WAKEUP 0 #define __wait_event_lock_irq(wq, condition, lock, cmd) do { wait_queue_t __wait; init_waitqueue_entry(&__wait, current); add_wait_queue(&wq, &__wait); for (;;) { set_current_state(TASK_UNINTERRUPTIBLE); if (condition) break; spin_unlock_irq(&lock); cmd; schedule(); spin_lock_irq(&lock); } current->state = TASK_RUNNING; remove_wait_queue(&wq, &__wait); } while (0) #define wait_event_lock_irq(wq, condition, lock, cmd) do { if (condition) break; __wait_event_lock_irq(wq, condition, lock, cmd); } while (0) #endif android-audiosystem-1.8+13.10.20130807/include/linux/raid/xor.h0000644000015700001700000000230112200324306024350 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _XOR_H #define _XOR_H #include #define MAX_XOR_BLOCKS 5 struct xor_block_template { struct xor_block_template *next; const char *name; int speed; void (*do_2)(unsigned long, unsigned long *, unsigned long *); void (*do_3)(unsigned long, unsigned long *, unsigned long *, unsigned long *); void (*do_4)(unsigned long, unsigned long *, unsigned long *, unsigned long *, unsigned long *); void (*do_5)(unsigned long, unsigned long *, unsigned long *, unsigned long *, unsigned long *, unsigned long *); }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/raid/md.h0000644000015700001700000000271012200324306024144 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _MD_H #define _MD_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define MD_MAJOR_VERSION 0 #define MD_MINOR_VERSION 90 #define MD_PATCHLEVEL_VERSION 3 #endif android-audiosystem-1.8+13.10.20130807/include/linux/raid/md_u.h0000644000015700001700000000517612200324306024501 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _MD_U_H #define _MD_U_H #define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t) #define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t) #define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t) #define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13) #define RAID_AUTORUN _IO (MD_MAJOR, 0x14) #define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t) #define CLEAR_ARRAY _IO (MD_MAJOR, 0x20) #define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t) #define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22) #define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t) #define SET_DISK_INFO _IO (MD_MAJOR, 0x24) #define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25) #define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26) #define PROTECT_ARRAY _IO (MD_MAJOR, 0x27) #define HOT_ADD_DISK _IO (MD_MAJOR, 0x28) #define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29) #define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a) #define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int) #define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t) #define START_ARRAY _IO (MD_MAJOR, 0x31) #define STOP_ARRAY _IO (MD_MAJOR, 0x32) #define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33) #define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34) typedef struct mdu_version_s { int major; int minor; int patchlevel; } mdu_version_t; typedef struct mdu_array_info_s { int major_version; int minor_version; int patch_version; int ctime; int level; int size; int nr_disks; int raid_disks; int md_minor; int not_persistent; int utime; int state; int active_disks; int working_disks; int failed_disks; int spare_disks; int layout; int chunk_size; } mdu_array_info_t; typedef struct mdu_disk_info_s { int number; int major; int minor; int raid_disk; int state; } mdu_disk_info_t; typedef struct mdu_start_info_s { int major; int minor; int raid_disk; int state; } mdu_start_info_t; typedef struct mdu_bitmap_file_s { char pathname[4096]; } mdu_bitmap_file_t; typedef struct mdu_param_s { int personality; int chunk_size; int max_fault; } mdu_param_t; #endif android-audiosystem-1.8+13.10.20130807/include/linux/errqueue.h0000644000015700001700000000202212200324306024456 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ERRQUEUE_H #define _LINUX_ERRQUEUE_H 1 struct sock_extended_err { __u32 ee_errno; __u8 ee_origin; __u8 ee_type; __u8 ee_code; __u8 ee_pad; __u32 ee_info; __u32 ee_data; }; #define SO_EE_ORIGIN_NONE 0 #define SO_EE_ORIGIN_LOCAL 1 #define SO_EE_ORIGIN_ICMP 2 #define SO_EE_ORIGIN_ICMP6 3 #define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1)) #endif android-audiosystem-1.8+13.10.20130807/include/linux/pn544.h0000644000015700001700000000153112200324306023477 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #define PN544_MAGIC 0xE9 #define PN544_SET_PWR _IOW(0xE9, 0x01, unsigned int) struct pn544_i2c_platform_data { unsigned int irq_gpio; unsigned int ven_gpio; unsigned int firm_gpio; }; android-audiosystem-1.8+13.10.20130807/include/linux/module.h0000644000015700001700000000627312200324306024122 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_MODULE_H #define _LINUX_MODULE_H #include #include #include #include #include #include #include #include #include #include #include #include #include #define MODULE_SUPPORTED_DEVICE(name) #ifndef MODULE_SYMBOL_PREFIX #define MODULE_SYMBOL_PREFIX "" #endif #define MODULE_NAME_LEN (64 - sizeof(unsigned long)) struct kernel_symbol { unsigned long value; const char *name; }; struct modversion_info { unsigned long crc; char name[MODULE_NAME_LEN]; }; struct module; struct module_attribute { struct attribute attr; ssize_t (*show)(struct module_attribute *, struct module *, char *); ssize_t (*store)(struct module_attribute *, struct module *, const char *, size_t count); void (*setup)(struct module *, const char *); int (*test)(struct module *); void (*free)(struct module *); }; struct module_kobject { struct kobject kobj; struct module *mod; }; struct exception_table_entry; #ifdef MODULE #define MODULE_GENERIC_TABLE(gtype,name) extern const struct gtype##_id __mod_##gtype##_table __attribute__ ((unused, alias(__stringify(name)))) #define THIS_MODULE (&__this_module) #else #define MODULE_GENERIC_TABLE(gtype,name) #define THIS_MODULE ((struct module *)0) #endif #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info) #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias) #define MODULE_LICENSE(_license) MODULE_INFO(license, _license) #define MODULE_AUTHOR(_author) MODULE_INFO(author, _author) #define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description) #define MODULE_PARM_DESC(_parm, desc) __MODULE_INFO(parm, _parm, #_parm ":" desc) #define MODULE_DEVICE_TABLE(type,name) MODULE_GENERIC_TABLE(type##_device,name) #define MODULE_VERSION(_version) MODULE_INFO(version, _version) struct notifier_block; #define EXPORT_SYMBOL(sym) #define EXPORT_SYMBOL_GPL(sym) #define EXPORT_SYMBOL_GPL_FUTURE(sym) #define EXPORT_UNUSED_SYMBOL(sym) #define EXPORT_UNUSED_SYMBOL_GPL(sym) #define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); }) #define symbol_put(x) do { } while(0) #define symbol_put_addr(x) do { } while(0) #define module_name(mod) "kernel" #define __unsafe(mod) #define module_put_and_exit(code) do_exit(code) struct module; #define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x) #define __MODULE_STRING(x) __stringify(x) #endif android-audiosystem-1.8+13.10.20130807/include/linux/if_addr.h0000644000015700001700000000306712200324306024223 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_IF_ADDR_H #define __LINUX_IF_ADDR_H #include #include struct ifaddrmsg { __u8 ifa_family; __u8 ifa_prefixlen; __u8 ifa_flags; __u8 ifa_scope; __u32 ifa_index; }; enum { IFA_UNSPEC, IFA_ADDRESS, IFA_LOCAL, IFA_LABEL, IFA_BROADCAST, IFA_ANYCAST, IFA_CACHEINFO, IFA_MULTICAST, __IFA_MAX, }; #define IFA_MAX (__IFA_MAX - 1) #define IFA_F_SECONDARY 0x01 #define IFA_F_TEMPORARY IFA_F_SECONDARY #define IFA_F_NODAD 0x02 #define IFA_F_OPTIMISTIC 0x04 #define IFA_F_DADFAILED 0x08 #define IFA_F_HOMEADDRESS 0x10 #define IFA_F_DEPRECATED 0x20 #define IFA_F_TENTATIVE 0x40 #define IFA_F_PERMANENT 0x80 struct ifa_cacheinfo { __u32 ifa_prefered; __u32 ifa_valid; __u32 cstamp; __u32 tstamp; }; #define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg)))) #define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg)) #endif android-audiosystem-1.8+13.10.20130807/include/linux/console_struct.h0000644000015700001700000000630212200324306025674 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #include #include struct vt_struct; #define NPAR 16 struct vc_data { unsigned short vc_num; unsigned int vc_cols; unsigned int vc_rows; unsigned int vc_size_row; unsigned int vc_scan_lines; unsigned long vc_origin; unsigned long vc_scr_end; unsigned long vc_visible_origin; unsigned int vc_top, vc_bottom; const struct consw *vc_sw; unsigned short *vc_screenbuf; unsigned int vc_screenbuf_size; unsigned char vc_mode; unsigned char vc_attr; unsigned char vc_def_color; unsigned char vc_color; unsigned char vc_s_color; unsigned char vc_ulcolor; unsigned char vc_halfcolor; unsigned int vc_cursor_type; unsigned short vc_complement_mask; unsigned short vc_s_complement_mask; unsigned int vc_x, vc_y; unsigned int vc_saved_x, vc_saved_y; unsigned long vc_pos; unsigned short vc_hi_font_mask; struct console_font vc_font; unsigned short vc_video_erase_char; unsigned int vc_state; unsigned int vc_npar,vc_par[NPAR]; struct tty_struct *vc_tty; struct vt_mode vt_mode; int vt_pid; int vt_newvt; wait_queue_head_t paste_wait; unsigned int vc_charset : 1; unsigned int vc_s_charset : 1; unsigned int vc_disp_ctrl : 1; unsigned int vc_toggle_meta : 1; unsigned int vc_decscnm : 1; unsigned int vc_decom : 1; unsigned int vc_decawm : 1; unsigned int vc_deccm : 1; unsigned int vc_decim : 1; unsigned int vc_deccolm : 1; unsigned int vc_intensity : 2; unsigned int vc_underline : 1; unsigned int vc_blink : 1; unsigned int vc_reverse : 1; unsigned int vc_s_intensity : 2; unsigned int vc_s_underline : 1; unsigned int vc_s_blink : 1; unsigned int vc_s_reverse : 1; unsigned int vc_ques : 1; unsigned int vc_need_wrap : 1; unsigned int vc_can_do_color : 1; unsigned int vc_report_mouse : 2; unsigned int vc_kmalloced : 1; unsigned char vc_utf : 1; unsigned char vc_utf_count; int vc_utf_char; unsigned int vc_tab_stop[8]; unsigned char vc_palette[16*3]; unsigned short * vc_translate; unsigned char vc_G0_charset; unsigned char vc_G1_charset; unsigned char vc_saved_G0; unsigned char vc_saved_G1; unsigned int vc_bell_pitch; unsigned int vc_bell_duration; struct vc_data **vc_display_fg; unsigned long vc_uni_pagedir; unsigned long *vc_uni_pagedir_loc; }; struct vc { struct vc_data *d; }; #define CUR_DEF 0 #define CUR_NONE 1 #define CUR_UNDERLINE 2 #define CUR_LOWER_THIRD 3 #define CUR_LOWER_HALF 4 #define CUR_TWO_THIRDS 5 #define CUR_BLOCK 6 #define CUR_HWMASK 0x0f #define CUR_SWMASK 0xfff0 #define CUR_DEFAULT CUR_UNDERLINE #define CON_IS_VISIBLE(conp) (*conp->vc_display_fg == conp) android-audiosystem-1.8+13.10.20130807/include/linux/list.h0000644000015700001700000000140412200324306023577 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_LIST_H #define _LINUX_LIST_H #warning "don't include kernel headers in userspace" #endif android-audiosystem-1.8+13.10.20130807/include/linux/types.h0000644000015700001700000000222612200324306023773 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_TYPES_H #define _LINUX_TYPES_H #include #include #define __bitwise__ #define __bitwise typedef __u16 __bitwise __le16; typedef __u16 __bitwise __be16; typedef __u32 __bitwise __le32; typedef __u32 __bitwise __be32; #if defined(__GNUC__) && !defined(__STRICT_ANSI__) typedef __u64 __bitwise __le64; typedef __u64 __bitwise __be64; #endif struct ustat { __kernel_daddr_t f_tfree; __kernel_ino_t f_tinode; char f_fname[6]; char f_fpack[6]; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/ethtool.h0000644000015700001700000001634512200324306024314 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ETHTOOL_H #define _LINUX_ETHTOOL_H #include struct ethtool_cmd { __u32 cmd; __u32 supported; __u32 advertising; __u16 speed; __u8 duplex; __u8 port; __u8 phy_address; __u8 transceiver; __u8 autoneg; __u32 maxtxpkt; __u32 maxrxpkt; __u16 speed_hi; __u16 reserved2; __u32 reserved[3]; }; #define ETHTOOL_BUSINFO_LEN 32 struct ethtool_drvinfo { __u32 cmd; char driver[32]; char version[32]; char fw_version[32]; char bus_info[ETHTOOL_BUSINFO_LEN]; char reserved1[32]; char reserved2[12]; __u32 n_priv_flags; __u32 n_stats; __u32 testinfo_len; __u32 eedump_len; __u32 regdump_len; }; #define SOPASS_MAX 6 struct ethtool_wolinfo { __u32 cmd; __u32 supported; __u32 wolopts; __u8 sopass[SOPASS_MAX]; }; struct ethtool_value { __u32 cmd; __u32 data; }; struct ethtool_regs { __u32 cmd; __u32 version; __u32 len; __u8 data[0]; }; struct ethtool_eeprom { __u32 cmd; __u32 magic; __u32 offset; __u32 len; __u8 data[0]; }; struct ethtool_coalesce { __u32 cmd; __u32 rx_coalesce_usecs; __u32 rx_max_coalesced_frames; __u32 rx_coalesce_usecs_irq; __u32 rx_max_coalesced_frames_irq; __u32 tx_coalesce_usecs; __u32 tx_max_coalesced_frames; __u32 tx_coalesce_usecs_irq; __u32 tx_max_coalesced_frames_irq; __u32 stats_block_coalesce_usecs; __u32 use_adaptive_rx_coalesce; __u32 use_adaptive_tx_coalesce; __u32 pkt_rate_low; __u32 rx_coalesce_usecs_low; __u32 rx_max_coalesced_frames_low; __u32 tx_coalesce_usecs_low; __u32 tx_max_coalesced_frames_low; __u32 pkt_rate_high; __u32 rx_coalesce_usecs_high; __u32 rx_max_coalesced_frames_high; __u32 tx_coalesce_usecs_high; __u32 tx_max_coalesced_frames_high; __u32 rate_sample_interval; }; struct ethtool_ringparam { __u32 cmd; __u32 rx_max_pending; __u32 rx_mini_max_pending; __u32 rx_jumbo_max_pending; __u32 tx_max_pending; __u32 rx_pending; __u32 rx_mini_pending; __u32 rx_jumbo_pending; __u32 tx_pending; }; struct ethtool_pauseparam { __u32 cmd; __u32 autoneg; __u32 rx_pause; __u32 tx_pause; }; #define ETH_GSTRING_LEN 32 enum ethtool_stringset { ETH_SS_TEST = 0, ETH_SS_STATS, ETH_SS_PRIV_FLAGS, }; struct ethtool_gstrings { __u32 cmd; __u32 string_set; __u32 len; __u8 data[0]; }; enum ethtool_test_flags { ETH_TEST_FL_OFFLINE = (1 << 0), ETH_TEST_FL_FAILED = (1 << 1), }; struct ethtool_test { __u32 cmd; __u32 flags; __u32 reserved; __u32 len; __u64 data[0]; }; struct ethtool_stats { __u32 cmd; __u32 n_stats; __u64 data[0]; }; struct ethtool_perm_addr { __u32 cmd; __u32 size; __u8 data[0]; }; enum ethtool_flags { ETH_FLAG_LRO = (1 << 15), }; struct ethtool_rxnfc { __u32 cmd; __u32 flow_type; __u64 data; }; #define ETHTOOL_GSET 0x00000001 #define ETHTOOL_SSET 0x00000002 #define ETHTOOL_GDRVINFO 0x00000003 #define ETHTOOL_GREGS 0x00000004 #define ETHTOOL_GWOL 0x00000005 #define ETHTOOL_SWOL 0x00000006 #define ETHTOOL_GMSGLVL 0x00000007 #define ETHTOOL_SMSGLVL 0x00000008 #define ETHTOOL_NWAY_RST 0x00000009 #define ETHTOOL_GLINK 0x0000000a #define ETHTOOL_GEEPROM 0x0000000b #define ETHTOOL_SEEPROM 0x0000000c #define ETHTOOL_GCOALESCE 0x0000000e #define ETHTOOL_SCOALESCE 0x0000000f #define ETHTOOL_GRINGPARAM 0x00000010 #define ETHTOOL_SRINGPARAM 0x00000011 #define ETHTOOL_GPAUSEPARAM 0x00000012 #define ETHTOOL_SPAUSEPARAM 0x00000013 #define ETHTOOL_GRXCSUM 0x00000014 #define ETHTOOL_SRXCSUM 0x00000015 #define ETHTOOL_GTXCSUM 0x00000016 #define ETHTOOL_STXCSUM 0x00000017 #define ETHTOOL_GSG 0x00000018 #define ETHTOOL_SSG 0x00000019 #define ETHTOOL_TEST 0x0000001a #define ETHTOOL_GSTRINGS 0x0000001b #define ETHTOOL_PHYS_ID 0x0000001c #define ETHTOOL_GSTATS 0x0000001d #define ETHTOOL_GTSO 0x0000001e #define ETHTOOL_STSO 0x0000001f #define ETHTOOL_GPERMADDR 0x00000020 #define ETHTOOL_GUFO 0x00000021 #define ETHTOOL_SUFO 0x00000022 #define ETHTOOL_GGSO 0x00000023 #define ETHTOOL_SGSO 0x00000024 #define ETHTOOL_GFLAGS 0x00000025 #define ETHTOOL_SFLAGS 0x00000026 #define ETHTOOL_GPFLAGS 0x00000027 #define ETHTOOL_SPFLAGS 0x00000028 #define ETHTOOL_GRXFH 0x00000029 #define ETHTOOL_SRXFH 0x0000002a #define ETHTOOL_GGRO 0x0000002b #define ETHTOOL_SGRO 0x0000002c #define SPARC_ETH_GSET ETHTOOL_GSET #define SPARC_ETH_SSET ETHTOOL_SSET #define SUPPORTED_10baseT_Half (1 << 0) #define SUPPORTED_10baseT_Full (1 << 1) #define SUPPORTED_100baseT_Half (1 << 2) #define SUPPORTED_100baseT_Full (1 << 3) #define SUPPORTED_1000baseT_Half (1 << 4) #define SUPPORTED_1000baseT_Full (1 << 5) #define SUPPORTED_Autoneg (1 << 6) #define SUPPORTED_TP (1 << 7) #define SUPPORTED_AUI (1 << 8) #define SUPPORTED_MII (1 << 9) #define SUPPORTED_FIBRE (1 << 10) #define SUPPORTED_BNC (1 << 11) #define SUPPORTED_10000baseT_Full (1 << 12) #define SUPPORTED_Pause (1 << 13) #define SUPPORTED_Asym_Pause (1 << 14) #define SUPPORTED_2500baseX_Full (1 << 15) #define ADVERTISED_10baseT_Half (1 << 0) #define ADVERTISED_10baseT_Full (1 << 1) #define ADVERTISED_100baseT_Half (1 << 2) #define ADVERTISED_100baseT_Full (1 << 3) #define ADVERTISED_1000baseT_Half (1 << 4) #define ADVERTISED_1000baseT_Full (1 << 5) #define ADVERTISED_Autoneg (1 << 6) #define ADVERTISED_TP (1 << 7) #define ADVERTISED_AUI (1 << 8) #define ADVERTISED_MII (1 << 9) #define ADVERTISED_FIBRE (1 << 10) #define ADVERTISED_BNC (1 << 11) #define ADVERTISED_10000baseT_Full (1 << 12) #define ADVERTISED_Pause (1 << 13) #define ADVERTISED_Asym_Pause (1 << 14) #define ADVERTISED_2500baseX_Full (1 << 15) #define SPEED_10 10 #define SPEED_100 100 #define SPEED_1000 1000 #define SPEED_2500 2500 #define SPEED_10000 10000 #define DUPLEX_HALF 0x00 #define DUPLEX_FULL 0x01 #define PORT_TP 0x00 #define PORT_AUI 0x01 #define PORT_MII 0x02 #define PORT_FIBRE 0x03 #define PORT_BNC 0x04 #define XCVR_INTERNAL 0x00 #define XCVR_EXTERNAL 0x01 #define XCVR_DUMMY1 0x02 #define XCVR_DUMMY2 0x03 #define XCVR_DUMMY3 0x04 #define AUTONEG_DISABLE 0x00 #define AUTONEG_ENABLE 0x01 #define WAKE_PHY (1 << 0) #define WAKE_UCAST (1 << 1) #define WAKE_MCAST (1 << 2) #define WAKE_BCAST (1 << 3) #define WAKE_ARP (1 << 4) #define WAKE_MAGIC (1 << 5) #define WAKE_MAGICSECURE (1 << 6) #define TCP_V4_FLOW 0x01 #define UDP_V4_FLOW 0x02 #define SCTP_V4_FLOW 0x03 #define AH_ESP_V4_FLOW 0x04 #define TCP_V6_FLOW 0x05 #define UDP_V6_FLOW 0x06 #define SCTP_V6_FLOW 0x07 #define AH_ESP_V6_FLOW 0x08 #define RXH_DEV_PORT (1 << 0) #define RXH_L2DA (1 << 1) #define RXH_VLAN (1 << 2) #define RXH_L3_PROTO (1 << 3) #define RXH_IP_SRC (1 << 4) #define RXH_IP_DST (1 << 5) #define RXH_L4_B_0_1 (1 << 6) #define RXH_L4_B_2_3 (1 << 7) #define RXH_DISCARD (1 << 31) #endif android-audiosystem-1.8+13.10.20130807/include/linux/notifier.h0000644000015700001700000000377412200324306024457 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_NOTIFIER_H #define _LINUX_NOTIFIER_H #include #include #include struct notifier_block { int (*notifier_call)(struct notifier_block *, unsigned long, void *); struct notifier_block *next; int priority; }; struct atomic_notifier_head { spinlock_t lock; struct notifier_block *head; }; struct blocking_notifier_head { struct rw_semaphore rwsem; struct notifier_block *head; }; struct raw_notifier_head { struct notifier_block *head; }; #define ATOMIC_INIT_NOTIFIER_HEAD(name) do { spin_lock_init(&(name)->lock); (name)->head = NULL; } while (0) #define BLOCKING_INIT_NOTIFIER_HEAD(name) do { init_rwsem(&(name)->rwsem); (name)->head = NULL; } while (0) #define RAW_INIT_NOTIFIER_HEAD(name) do { (name)->head = NULL; } while (0) #define ATOMIC_NOTIFIER_INIT(name) { .lock = __SPIN_LOCK_UNLOCKED(name.lock), .head = NULL } #define BLOCKING_NOTIFIER_INIT(name) { .rwsem = __RWSEM_INITIALIZER((name).rwsem), .head = NULL } #define RAW_NOTIFIER_INIT(name) { .head = NULL } #define ATOMIC_NOTIFIER_HEAD(name) struct atomic_notifier_head name = ATOMIC_NOTIFIER_INIT(name) #define BLOCKING_NOTIFIER_HEAD(name) struct blocking_notifier_head name = BLOCKING_NOTIFIER_INIT(name) #define RAW_NOTIFIER_HEAD(name) struct raw_notifier_head name = RAW_NOTIFIER_INIT(name) #endif android-audiosystem-1.8+13.10.20130807/include/linux/nfs_xdr.h0000644000015700001700000002641012200324306024273 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_NFS_XDR_H #define _LINUX_NFS_XDR_H #include #include #define NFS_MAX_FILE_IO_SIZE (1048576U) #define NFS_DEF_FILE_IO_SIZE (4096U) #define NFS_MIN_FILE_IO_SIZE (1024U) struct nfs_fsid { uint64_t major; uint64_t minor; }; #define NFS_ATTR_WCC 0x0001 #define NFS_ATTR_FATTR 0x0002 #define NFS_ATTR_FATTR_V3 0x0004 #define NFS_ATTR_FATTR_V4 0x0008 #define NFS_ATTR_FATTR_V4_REFERRAL 0x0010 struct nfs_fsinfo { struct nfs_fattr *fattr; __u32 rtmax; __u32 rtpref; __u32 rtmult; __u32 wtmax; __u32 wtpref; __u32 wtmult; __u32 dtpref; __u64 maxfilesize; __u32 lease_time; }; struct nfs_fsstat { struct nfs_fattr *fattr; __u64 tbytes; __u64 fbytes; __u64 abytes; __u64 tfiles; __u64 ffiles; __u64 afiles; }; struct nfs2_fsstat { __u32 tsize; __u32 bsize; __u32 blocks; __u32 bfree; __u32 bavail; }; struct nfs_pathconf { struct nfs_fattr *fattr; __u32 max_link; __u32 max_namelen; }; struct nfs4_change_info { u32 atomic; u64 before; u64 after; }; struct nfs_seqid; struct nfs_openargs { const struct nfs_fh * fh; struct nfs_seqid * seqid; int open_flags; __u64 clientid; __u32 id; union { struct iattr * attrs; nfs4_verifier verifier; nfs4_stateid delegation; int delegation_type; } u; const struct qstr * name; const struct nfs_server *server; const u32 * bitmask; __u32 claim; }; struct nfs_openres { nfs4_stateid stateid; struct nfs_fh fh; struct nfs4_change_info cinfo; __u32 rflags; struct nfs_fattr * f_attr; struct nfs_fattr * dir_attr; const struct nfs_server *server; int delegation_type; nfs4_stateid delegation; __u32 do_recall; __u64 maxsize; }; struct nfs_open_confirmargs { const struct nfs_fh * fh; nfs4_stateid * stateid; struct nfs_seqid * seqid; }; struct nfs_open_confirmres { nfs4_stateid stateid; }; struct nfs_closeargs { struct nfs_fh * fh; nfs4_stateid * stateid; struct nfs_seqid * seqid; int open_flags; const u32 * bitmask; }; struct nfs_closeres { nfs4_stateid stateid; struct nfs_fattr * fattr; const struct nfs_server *server; }; struct nfs_lowner { __u64 clientid; u32 id; }; struct nfs_lock_args { struct nfs_fh * fh; struct file_lock * fl; struct nfs_seqid * lock_seqid; nfs4_stateid * lock_stateid; struct nfs_seqid * open_seqid; nfs4_stateid * open_stateid; struct nfs_lowner lock_owner; unsigned char block : 1; unsigned char reclaim : 1; unsigned char new_lock_owner : 1; }; struct nfs_lock_res { nfs4_stateid stateid; }; struct nfs_locku_args { struct nfs_fh * fh; struct file_lock * fl; struct nfs_seqid * seqid; nfs4_stateid * stateid; }; struct nfs_locku_res { nfs4_stateid stateid; }; struct nfs_lockt_args { struct nfs_fh * fh; struct file_lock * fl; struct nfs_lowner lock_owner; }; struct nfs_lockt_res { struct file_lock * denied; }; struct nfs4_delegreturnargs { const struct nfs_fh *fhandle; const nfs4_stateid *stateid; const u32 * bitmask; }; struct nfs4_delegreturnres { struct nfs_fattr * fattr; const struct nfs_server *server; }; struct nfs_readargs { struct nfs_fh * fh; struct nfs_open_context *context; __u64 offset; __u32 count; unsigned int pgbase; struct page ** pages; }; struct nfs_readres { struct nfs_fattr * fattr; __u32 count; int eof; }; struct nfs_writeargs { struct nfs_fh * fh; struct nfs_open_context *context; __u64 offset; __u32 count; enum nfs3_stable_how stable; unsigned int pgbase; struct page ** pages; const u32 * bitmask; }; struct nfs_writeverf { enum nfs3_stable_how committed; __u32 verifier[2]; }; struct nfs_writeres { struct nfs_fattr * fattr; struct nfs_writeverf * verf; __u32 count; const struct nfs_server *server; }; struct nfs_entry { __u64 ino; __u64 cookie, prev_cookie; const char * name; unsigned int len; int eof; struct nfs_fh * fh; struct nfs_fattr * fattr; }; struct nfs_sattrargs { struct nfs_fh * fh; struct iattr * sattr; }; struct nfs_diropargs { struct nfs_fh * fh; const char * name; unsigned int len; }; struct nfs_createargs { struct nfs_fh * fh; const char * name; unsigned int len; struct iattr * sattr; }; struct nfs_renameargs { struct nfs_fh * fromfh; const char * fromname; unsigned int fromlen; struct nfs_fh * tofh; const char * toname; unsigned int tolen; }; struct nfs_setattrargs { struct nfs_fh * fh; nfs4_stateid stateid; struct iattr * iap; const struct nfs_server * server; const u32 * bitmask; }; struct nfs_setaclargs { struct nfs_fh * fh; size_t acl_len; unsigned int acl_pgbase; struct page ** acl_pages; }; struct nfs_getaclargs { struct nfs_fh * fh; size_t acl_len; unsigned int acl_pgbase; struct page ** acl_pages; }; struct nfs_setattrres { struct nfs_fattr * fattr; const struct nfs_server * server; }; struct nfs_linkargs { struct nfs_fh * fromfh; struct nfs_fh * tofh; const char * toname; unsigned int tolen; }; struct nfs_symlinkargs { struct nfs_fh * fromfh; const char * fromname; unsigned int fromlen; const char * topath; unsigned int tolen; struct iattr * sattr; }; struct nfs_readdirargs { struct nfs_fh * fh; __u32 cookie; unsigned int count; struct page ** pages; }; struct nfs3_getaclargs { struct nfs_fh * fh; int mask; struct page ** pages; }; struct nfs3_setaclargs { struct inode * inode; int mask; struct posix_acl * acl_access; struct posix_acl * acl_default; struct page ** pages; }; struct nfs_diropok { struct nfs_fh * fh; struct nfs_fattr * fattr; }; struct nfs_readlinkargs { struct nfs_fh * fh; unsigned int pgbase; unsigned int pglen; struct page ** pages; }; struct nfs3_sattrargs { struct nfs_fh * fh; struct iattr * sattr; unsigned int guard; struct timespec guardtime; }; struct nfs3_diropargs { struct nfs_fh * fh; const char * name; unsigned int len; }; struct nfs3_accessargs { struct nfs_fh * fh; __u32 access; }; struct nfs3_createargs { struct nfs_fh * fh; const char * name; unsigned int len; struct iattr * sattr; enum nfs3_createmode createmode; __u32 verifier[2]; }; struct nfs3_mkdirargs { struct nfs_fh * fh; const char * name; unsigned int len; struct iattr * sattr; }; struct nfs3_symlinkargs { struct nfs_fh * fromfh; const char * fromname; unsigned int fromlen; const char * topath; unsigned int tolen; struct iattr * sattr; }; struct nfs3_mknodargs { struct nfs_fh * fh; const char * name; unsigned int len; enum nfs3_ftype type; struct iattr * sattr; dev_t rdev; }; struct nfs3_renameargs { struct nfs_fh * fromfh; const char * fromname; unsigned int fromlen; struct nfs_fh * tofh; const char * toname; unsigned int tolen; }; struct nfs3_linkargs { struct nfs_fh * fromfh; struct nfs_fh * tofh; const char * toname; unsigned int tolen; }; struct nfs3_readdirargs { struct nfs_fh * fh; __u64 cookie; __u32 verf[2]; int plus; unsigned int count; struct page ** pages; }; struct nfs3_diropres { struct nfs_fattr * dir_attr; struct nfs_fh * fh; struct nfs_fattr * fattr; }; struct nfs3_accessres { struct nfs_fattr * fattr; __u32 access; }; struct nfs3_readlinkargs { struct nfs_fh * fh; unsigned int pgbase; unsigned int pglen; struct page ** pages; }; struct nfs3_renameres { struct nfs_fattr * fromattr; struct nfs_fattr * toattr; }; struct nfs3_linkres { struct nfs_fattr * dir_attr; struct nfs_fattr * fattr; }; struct nfs3_readdirres { struct nfs_fattr * dir_attr; __u32 * verf; int plus; }; struct nfs3_getaclres { struct nfs_fattr * fattr; int mask; unsigned int acl_access_count; unsigned int acl_default_count; struct posix_acl * acl_access; struct posix_acl * acl_default; }; struct nfs_page; #define NFS_PAGEVEC_SIZE (8U) struct nfs_read_data { int flags; struct rpc_task task; struct inode *inode; struct rpc_cred *cred; struct nfs_fattr fattr; struct list_head pages; struct nfs_page *req; struct page **pagevec; unsigned int npages; struct nfs_readargs args; struct nfs_readres res; struct page *page_array[NFS_PAGEVEC_SIZE]; }; struct nfs_write_data { int flags; struct rpc_task task; struct inode *inode; struct rpc_cred *cred; struct nfs_fattr fattr; struct nfs_writeverf verf; struct list_head pages; struct nfs_page *req; struct page **pagevec; unsigned int npages; struct nfs_writeargs args; struct nfs_writeres res; struct page *page_array[NFS_PAGEVEC_SIZE]; }; struct nfs_access_entry; struct nfs_rpc_ops { int version; struct dentry_operations *dentry_ops; struct inode_operations *dir_inode_ops; struct inode_operations *file_inode_ops; int (*getroot) (struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *); int (*getattr) (struct nfs_server *, struct nfs_fh *, struct nfs_fattr *); int (*setattr) (struct dentry *, struct nfs_fattr *, struct iattr *); int (*lookup) (struct inode *, struct qstr *, struct nfs_fh *, struct nfs_fattr *); int (*access) (struct inode *, struct nfs_access_entry *); int (*readlink)(struct inode *, struct page *, unsigned int, unsigned int); int (*read) (struct nfs_read_data *); int (*write) (struct nfs_write_data *); int (*commit) (struct nfs_write_data *); int (*create) (struct inode *, struct dentry *, struct iattr *, int, struct nameidata *); int (*remove) (struct inode *, struct qstr *); int (*unlink_setup) (struct rpc_message *, struct dentry *, struct qstr *); int (*unlink_done) (struct dentry *, struct rpc_task *); int (*rename) (struct inode *, struct qstr *, struct inode *, struct qstr *); int (*link) (struct inode *, struct inode *, struct qstr *); int (*symlink) (struct inode *, struct qstr *, struct qstr *, struct iattr *, struct nfs_fh *, struct nfs_fattr *); int (*mkdir) (struct inode *, struct dentry *, struct iattr *); int (*rmdir) (struct inode *, struct qstr *); int (*readdir) (struct dentry *, struct rpc_cred *, u64, struct page *, unsigned int, int); int (*mknod) (struct inode *, struct dentry *, struct iattr *, dev_t); int (*statfs) (struct nfs_server *, struct nfs_fh *, struct nfs_fsstat *); int (*fsinfo) (struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *); int (*pathconf) (struct nfs_server *, struct nfs_fh *, struct nfs_pathconf *); u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus); void (*read_setup) (struct nfs_read_data *); int (*read_done) (struct rpc_task *, struct nfs_read_data *); void (*write_setup) (struct nfs_write_data *, int how); int (*write_done) (struct rpc_task *, struct nfs_write_data *); void (*commit_setup) (struct nfs_write_data *, int how); int (*commit_done) (struct rpc_task *, struct nfs_write_data *); int (*file_open) (struct inode *, struct file *); int (*file_release) (struct inode *, struct file *); int (*lock)(struct file *, int, struct file_lock *); void (*clear_acl_cache)(struct inode *); }; #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args #endif android-audiosystem-1.8+13.10.20130807/include/linux/android_alarm.h0000644000015700001700000000400112200324306025414 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ANDROID_ALARM_H #define _LINUX_ANDROID_ALARM_H #include #include typedef enum { ANDROID_ALARM_RTC_WAKEUP, ANDROID_ALARM_RTC, ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP, ANDROID_ALARM_ELAPSED_REALTIME, ANDROID_ALARM_SYSTEMTIME, ANDROID_ALARM_TYPE_COUNT, } android_alarm_type_t; typedef enum { ANDROID_ALARM_RTC_WAKEUP_MASK = 1U << ANDROID_ALARM_RTC_WAKEUP, ANDROID_ALARM_RTC_MASK = 1U << ANDROID_ALARM_RTC, ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP_MASK = 1U << ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP, ANDROID_ALARM_ELAPSED_REALTIME_MASK = 1U << ANDROID_ALARM_ELAPSED_REALTIME, ANDROID_ALARM_SYSTEMTIME_MASK = 1U << ANDROID_ALARM_SYSTEMTIME, ANDROID_ALARM_TIME_CHANGE_MASK = 1U << 16 } android_alarm_return_flags_t; #define ANDROID_ALARM_CLEAR(type) _IO('a', 0 | ((type) << 4)) #define ANDROID_ALARM_WAIT _IO('a', 1) #define ANDROID_ALARM_SET(type) _IOW('a', 2 | ((type) << 4), struct timespec) #define ANDROID_ALARM_SET_AND_WAIT(type) _IOW('a', 3 | ((type) << 4), struct timespec) #define ANDROID_ALARM_GET_TIME(type) _IOW('a', 4 | ((type) << 4), struct timespec) #define ANDROID_ALARM_SET_RTC _IOW('a', 5, struct timespec) #define ANDROID_ALARM_SET_TIMEZONE _IOW('a', 6, struct timezone) #define ANDROID_ALARM_BASE_CMD(cmd) (cmd & ~(_IOC(0, 0, 0xf0, 0))) #define ANDROID_ALARM_IOCTL_TO_TYPE(cmd) (_IOC_NR(cmd) >> 4) #endif android-audiosystem-1.8+13.10.20130807/include/linux/mm.h0000644000015700001700000000143412200324306023240 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_MM_H #define _LINUX_MM_H #include #include #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/dm-ioctl.h0000644000015700001700000000716012200324306024341 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_DM_IOCTL_V4_H #define _LINUX_DM_IOCTL_V4_H #include #define DM_DIR "mapper" #define DM_MAX_TYPE_NAME 16 #define DM_NAME_LEN 128 #define DM_UUID_LEN 129 struct dm_ioctl { uint32_t version[3]; uint32_t data_size; uint32_t data_start; uint32_t target_count; int32_t open_count; uint32_t flags; uint32_t event_nr; uint32_t padding; uint64_t dev; char name[DM_NAME_LEN]; char uuid[DM_UUID_LEN]; char data[7]; }; struct dm_target_spec { uint64_t sector_start; uint64_t length; int32_t status; uint32_t next; char target_type[DM_MAX_TYPE_NAME]; }; struct dm_target_deps { uint32_t count; uint32_t padding; uint64_t dev[0]; }; struct dm_name_list { uint64_t dev; uint32_t next; char name[0]; }; struct dm_target_versions { uint32_t next; uint32_t version[3]; char name[0]; }; struct dm_target_msg { uint64_t sector; char message[0]; }; enum { DM_VERSION_CMD = 0, DM_REMOVE_ALL_CMD, DM_LIST_DEVICES_CMD, DM_DEV_CREATE_CMD, DM_DEV_REMOVE_CMD, DM_DEV_RENAME_CMD, DM_DEV_SUSPEND_CMD, DM_DEV_STATUS_CMD, DM_DEV_WAIT_CMD, DM_TABLE_LOAD_CMD, DM_TABLE_CLEAR_CMD, DM_TABLE_DEPS_CMD, DM_TABLE_STATUS_CMD, DM_LIST_VERSIONS_CMD, DM_TARGET_MSG_CMD, DM_DEV_SET_GEOMETRY_CMD }; #define DM_IOCTL 0xfd #define DM_VERSION _IOWR(DM_IOCTL, DM_VERSION_CMD, struct dm_ioctl) #define DM_REMOVE_ALL _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD, struct dm_ioctl) #define DM_LIST_DEVICES _IOWR(DM_IOCTL, DM_LIST_DEVICES_CMD, struct dm_ioctl) #define DM_DEV_CREATE _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD, struct dm_ioctl) #define DM_DEV_REMOVE _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD, struct dm_ioctl) #define DM_DEV_RENAME _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD, struct dm_ioctl) #define DM_DEV_SUSPEND _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD, struct dm_ioctl) #define DM_DEV_STATUS _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD, struct dm_ioctl) #define DM_DEV_WAIT _IOWR(DM_IOCTL, DM_DEV_WAIT_CMD, struct dm_ioctl) #define DM_TABLE_LOAD _IOWR(DM_IOCTL, DM_TABLE_LOAD_CMD, struct dm_ioctl) #define DM_TABLE_CLEAR _IOWR(DM_IOCTL, DM_TABLE_CLEAR_CMD, struct dm_ioctl) #define DM_TABLE_DEPS _IOWR(DM_IOCTL, DM_TABLE_DEPS_CMD, struct dm_ioctl) #define DM_TABLE_STATUS _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, struct dm_ioctl) #define DM_LIST_VERSIONS _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, struct dm_ioctl) #define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl) #define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) #define DM_VERSION_MAJOR 4 #define DM_VERSION_MINOR 14 #define DM_VERSION_PATCHLEVEL 0 #define DM_VERSION_EXTRA "-ioctl (2008-04-23)" #define DM_READONLY_FLAG (1 << 0) #define DM_SUSPEND_FLAG (1 << 1) #define DM_PERSISTENT_DEV_FLAG (1 << 3) #define DM_STATUS_TABLE_FLAG (1 << 4) #define DM_ACTIVE_PRESENT_FLAG (1 << 5) #define DM_INACTIVE_PRESENT_FLAG (1 << 6) #define DM_BUFFER_FULL_FLAG (1 << 8) #define DM_SKIP_BDGET_FLAG (1 << 9) #define DM_SKIP_LOCKFS_FLAG (1 << 10) #define DM_NOFLUSH_FLAG (1 << 11) #endif android-audiosystem-1.8+13.10.20130807/include/linux/spinlock_api_smp.h0000644000015700001700000000156712200324306026170 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_SPINLOCK_API_SMP_H #define __LINUX_SPINLOCK_API_SMP_H #ifndef __LINUX_SPINLOCK_H #error "please don't include this file directly" #endif #define assert_spin_locked(x) BUG_ON(!spin_is_locked(x)) #endif android-audiosystem-1.8+13.10.20130807/include/linux/rpmsg_omx.h0000644000015700001700000000352112200324306024641 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** *** To edit the content of this header, modify the corresponding *** source file (e.g. under external/kernel-headers/original/) then *** run bionic/libc/kernel/tools/update_all.py *** *** Any manual change here will be lost the next time this script will *** be run. You've been warned! *** **************************************************************************** ****************************************************************************/ #ifndef RPMSG_OMX_H #define RPMSG_OMX_H #include #define OMX_IOC_MAGIC 'X' /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #define OMX_IOCCONNECT _IOW(OMX_IOC_MAGIC, 1, char *) #define OMX_IOCIONREGISTER _IOWR(OMX_IOC_MAGIC, 2, struct ion_fd_data) #define OMX_IOCIONUNREGISTER _IOWR(OMX_IOC_MAGIC, 3, struct ion_fd_data) #define OMX_IOC_MAXNR (3) /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ struct omx_conn_req { char name[48]; } __packed; struct omx_packet { /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ uint16_t desc; uint16_t msg_id; uint32_t flags; uint32_t fxn_idx; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ int32_t result; uint32_t data_size; uint32_t data[0]; }; /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ #endif android-audiosystem-1.8+13.10.20130807/include/linux/preempt.h0000644000015700001700000000240612200324306024303 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_PREEMPT_H #define __LINUX_PREEMPT_H #include #include #define add_preempt_count(val) do { preempt_count() += (val); } while (0) #define sub_preempt_count(val) do { preempt_count() -= (val); } while (0) #define inc_preempt_count() add_preempt_count(1) #define dec_preempt_count() sub_preempt_count(1) #define preempt_count() (current_thread_info()->preempt_count) #define preempt_disable() do { } while (0) #define preempt_enable_no_resched() do { } while (0) #define preempt_enable() do { } while (0) #define preempt_check_resched() do { } while (0) #endif android-audiosystem-1.8+13.10.20130807/include/linux/kxtf9.h0000644000015700001700000000412612200324306023675 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __KXTF9_H__ #define __KXTF9_H__ #include #define KXTF9_IOCTL_BASE 77 #define KXTF9_IOCTL_SET_DELAY _IOW(KXTF9_IOCTL_BASE, 0, int) #define KXTF9_IOCTL_GET_DELAY _IOR(KXTF9_IOCTL_BASE, 1, int) #define KXTF9_IOCTL_SET_ENABLE _IOW(KXTF9_IOCTL_BASE, 2, int) #define KXTF9_IOCTL_GET_ENABLE _IOR(KXTF9_IOCTL_BASE, 3, int) #define KXTF9_IOCTL_SET_G_RANGE _IOW(KXTF9_IOCTL_BASE, 4, int) #define KXTF9_IOCTL_SET_TILT_ENABLE _IOW(KXTF9_IOCTL_BASE, 5, int) #define KXTF9_IOCTL_SET_TAP_ENABLE _IOW(KXTF9_IOCTL_BASE, 6, int) #define KXTF9_IOCTL_SET_WAKE_ENABLE _IOW(KXTF9_IOCTL_BASE, 7, int) #define KXTF9_IOCTL_SET_PM_MODE _IOW(KXTF9_IOCTL_BASE, 8, int) #define KXTF9_IOCTL_SELF_TEST _IOW(KXTF9_IOCTL_BASE, 9, int) #define KXTF9_IOCTL_SET_SENSITIVITY _IOW(KXTF9_IOCTL_BASE, 10, int) #define RES_12BIT 0x40 #define KXTF9_G_2G 0x00 #define KXTF9_G_4G 0x08 #define KXTF9_G_8G 0x10 #define TPE 0x01 #define WUFE 0x02 #define TDTE 0x04 #define OTP1_6 0x00 #define OTP6_3 0x20 #define OTP12_5 0x40 #define OTP50 0x60 #define OWUF25 0x00 #define OWUF50 0x01 #define OWUF100 0x02 #define OWUF200 0x03 #define OTDT50 0x00 #define OTDT100 0x04 #define OTDT200 0x08 #define OTDT400 0x0C #define IEN 0x20 #define IEA 0x10 #define IEL 0x08 #define IEU 0x04 #define ODR800 0x06 #define ODR400 0x05 #define ODR200 0x04 #define ODR100 0x03 #define ODR50 0x02 #define ODR25 0x01 #define ODR12_5 0x00 #define SENSITIVITY_REGS 0x07 #endif android-audiosystem-1.8+13.10.20130807/include/linux/kd.h0000644000015700001700000000737712200324306023241 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_KD_H #define _LINUX_KD_H #include #include #define GIO_FONT 0x4B60 #define PIO_FONT 0x4B61 #define GIO_FONTX 0x4B6B #define PIO_FONTX 0x4B6C struct consolefontdesc { unsigned short charcount; unsigned short charheight; char __user *chardata; }; #define PIO_FONTRESET 0x4B6D #define GIO_CMAP 0x4B70 #define PIO_CMAP 0x4B71 #define KIOCSOUND 0x4B2F #define KDMKTONE 0x4B30 #define KDGETLED 0x4B31 #define KDSETLED 0x4B32 #define LED_SCR 0x01 #define LED_NUM 0x02 #define LED_CAP 0x04 #define KDGKBTYPE 0x4B33 #define KB_84 0x01 #define KB_101 0x02 #define KB_OTHER 0x03 #define KDADDIO 0x4B34 #define KDDELIO 0x4B35 #define KDENABIO 0x4B36 #define KDDISABIO 0x4B37 #define KDSETMODE 0x4B3A #define KD_TEXT 0x00 #define KD_GRAPHICS 0x01 #define KD_TEXT0 0x02 #define KD_TEXT1 0x03 #define KDGETMODE 0x4B3B #define KDMAPDISP 0x4B3C #define KDUNMAPDISP 0x4B3D typedef char scrnmap_t; #define E_TABSZ 256 #define GIO_SCRNMAP 0x4B40 #define PIO_SCRNMAP 0x4B41 #define GIO_UNISCRNMAP 0x4B69 #define PIO_UNISCRNMAP 0x4B6A #define GIO_UNIMAP 0x4B66 struct unipair { unsigned short unicode; unsigned short fontpos; }; struct unimapdesc { unsigned short entry_ct; struct unipair __user *entries; }; #define PIO_UNIMAP 0x4B67 #define PIO_UNIMAPCLR 0x4B68 struct unimapinit { unsigned short advised_hashsize; unsigned short advised_hashstep; unsigned short advised_hashlevel; }; #define UNI_DIRECT_BASE 0xF000 #define UNI_DIRECT_MASK 0x01FF #define K_RAW 0x00 #define K_XLATE 0x01 #define K_MEDIUMRAW 0x02 #define K_UNICODE 0x03 #define KDGKBMODE 0x4B44 #define KDSKBMODE 0x4B45 #define K_METABIT 0x03 #define K_ESCPREFIX 0x04 #define KDGKBMETA 0x4B62 #define KDSKBMETA 0x4B63 #define K_SCROLLLOCK 0x01 #define K_NUMLOCK 0x02 #define K_CAPSLOCK 0x04 #define KDGKBLED 0x4B64 #define KDSKBLED 0x4B65 struct kbentry { unsigned char kb_table; unsigned char kb_index; unsigned short kb_value; }; #define K_NORMTAB 0x00 #define K_SHIFTTAB 0x01 #define K_ALTTAB 0x02 #define K_ALTSHIFTTAB 0x03 #define KDGKBENT 0x4B46 #define KDSKBENT 0x4B47 struct kbsentry { unsigned char kb_func; unsigned char kb_string[512]; }; #define KDGKBSENT 0x4B48 #define KDSKBSENT 0x4B49 struct kbdiacr { unsigned char diacr, base, result; }; struct kbdiacrs { unsigned int kb_cnt; struct kbdiacr kbdiacr[256]; }; #define KDGKBDIACR 0x4B4A #define KDSKBDIACR 0x4B4B struct kbkeycode { unsigned int scancode, keycode; }; #define KDGETKEYCODE 0x4B4C #define KDSETKEYCODE 0x4B4D #define KDSIGACCEPT 0x4B4E struct kbd_repeat { int delay; int period; }; #define KDKBDREP 0x4B52 #define KDFONTOP 0x4B72 struct console_font_op { unsigned int op; unsigned int flags; unsigned int width, height; unsigned int charcount; unsigned char __user *data; }; struct console_font { unsigned int width, height; unsigned int charcount; unsigned char *data; }; #define KD_FONT_OP_SET 0 #define KD_FONT_OP_GET 1 #define KD_FONT_OP_SET_DEFAULT 2 #define KD_FONT_OP_COPY 3 #define KD_FONT_FLAG_DONT_RECALC 1 #endif android-audiosystem-1.8+13.10.20130807/include/linux/net.h0000644000015700001700000000256712200324306023425 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_NET_H #define _LINUX_NET_H #include #include struct poll_table_struct; struct inode; #define NPROTO 32 #define SYS_SOCKET 1 #define SYS_BIND 2 #define SYS_CONNECT 3 #define SYS_LISTEN 4 #define SYS_ACCEPT 5 #define SYS_GETSOCKNAME 6 #define SYS_GETPEERNAME 7 #define SYS_SOCKETPAIR 8 #define SYS_SEND 9 #define SYS_RECV 10 #define SYS_SENDTO 11 #define SYS_RECVFROM 12 #define SYS_SHUTDOWN 13 #define SYS_SETSOCKOPT 14 #define SYS_GETSOCKOPT 15 #define SYS_SENDMSG 16 #define SYS_RECVMSG 17 typedef enum { SS_FREE = 0, SS_UNCONNECTED, SS_CONNECTING, SS_CONNECTED, SS_DISCONNECTING } socket_state; #define __SO_ACCEPTCON (1 << 16) #endif android-audiosystem-1.8+13.10.20130807/include/linux/limits.h0000644000015700001700000000211512200324306024125 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_LIMITS_H #define _LINUX_LIMITS_H #define NR_OPEN 1024 #define NGROUPS_MAX 65536 #define ARG_MAX 131072 #define CHILD_MAX 999 #define OPEN_MAX 256 #define LINK_MAX 127 #define MAX_CANON 255 #define MAX_INPUT 255 #define NAME_MAX 255 #define PATH_MAX 4096 #define PIPE_BUF 4096 #define XATTR_NAME_MAX 255 #define XATTR_SIZE_MAX 65536 #define XATTR_LIST_MAX 65536 #define RTSIG_MAX 32 #endif android-audiosystem-1.8+13.10.20130807/include/linux/linkage.h0000644000015700001700000000310712200324306024240 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_LINKAGE_H #define _LINUX_LINKAGE_H #include #ifdef __cplusplus #define CPP_ASMLINKAGE extern "C" #else #define CPP_ASMLINKAGE #endif #ifndef asmlinkage #define asmlinkage CPP_ASMLINKAGE #endif #ifndef prevent_tail_call #define prevent_tail_call(ret) do { } while (0) #endif #ifndef __ALIGN #define __ALIGN .align 4,0x90 #define __ALIGN_STR ".align 4,0x90" #endif #ifdef __ASSEMBLY__ #define ALIGN __ALIGN #define ALIGN_STR __ALIGN_STR #ifndef ENTRY #define ENTRY(name) .globl name; ALIGN; name: #endif #define KPROBE_ENTRY(name) .section .kprobes.text, "ax"; ENTRY(name) #ifndef END #define END(name) .size name, .-name #endif #ifndef ENDPROC #define ENDPROC(name) .type name, @function; END(name) #endif #endif #define NORET_TYPE #define ATTRIB_NORET __attribute__((noreturn)) #define NORET_AND noreturn, #ifndef FASTCALL #define FASTCALL(x) x #define fastcall #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/unistd.h0000644000015700001700000000135612200324306024140 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_UNISTD_H_ #define _LINUX_UNISTD_H_ #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/spinlock.h0000644000015700001700000001077712200324306024463 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_SPINLOCK_H #define __LINUX_SPINLOCK_H #include #include #include #include #include #include #include #define LOCK_SECTION_NAME ".text.lock."KBUILD_BASENAME #define LOCK_SECTION_START(extra) ".subsection 1\n\t" extra ".ifndef " LOCK_SECTION_NAME "\n\t" LOCK_SECTION_NAME ":\n\t" ".endif\n" #define LOCK_SECTION_END ".previous\n\t" #define __lockfunc fastcall __attribute__((section(".spinlock.text"))) #include #include #define spin_lock_init(lock) do { *(lock) = SPIN_LOCK_UNLOCKED; } while (0) #define rwlock_init(lock) do { *(lock) = RW_LOCK_UNLOCKED; } while (0) #define spin_is_locked(lock) __raw_spin_is_locked(&(lock)->raw_lock) #define spin_unlock_wait(lock) __raw_spin_unlock_wait(&(lock)->raw_lock) #include #define _raw_spin_lock(lock) __raw_spin_lock(&(lock)->raw_lock) #define _raw_spin_lock_flags(lock, flags) __raw_spin_lock_flags(&(lock)->raw_lock, *(flags)) #define _raw_spin_trylock(lock) __raw_spin_trylock(&(lock)->raw_lock) #define _raw_spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock) #define _raw_read_lock(rwlock) __raw_read_lock(&(rwlock)->raw_lock) #define _raw_read_trylock(rwlock) __raw_read_trylock(&(rwlock)->raw_lock) #define _raw_read_unlock(rwlock) __raw_read_unlock(&(rwlock)->raw_lock) #define _raw_write_lock(rwlock) __raw_write_lock(&(rwlock)->raw_lock) #define _raw_write_trylock(rwlock) __raw_write_trylock(&(rwlock)->raw_lock) #define _raw_write_unlock(rwlock) __raw_write_unlock(&(rwlock)->raw_lock) #define read_can_lock(rwlock) __raw_read_can_lock(&(rwlock)->raw_lock) #define write_can_lock(rwlock) __raw_write_can_lock(&(rwlock)->raw_lock) #define spin_trylock(lock) __cond_lock(_spin_trylock(lock)) #define read_trylock(lock) __cond_lock(_read_trylock(lock)) #define write_trylock(lock) __cond_lock(_write_trylock(lock)) #define spin_lock(lock) _spin_lock(lock) #define spin_lock_nested(lock, subclass) _spin_lock(lock) #define write_lock(lock) _write_lock(lock) #define read_lock(lock) _read_lock(lock) #define spin_lock_irqsave(lock, flags) _spin_lock_irqsave(lock, flags) #define read_lock_irqsave(lock, flags) _read_lock_irqsave(lock, flags) #define write_lock_irqsave(lock, flags) _write_lock_irqsave(lock, flags) #define spin_lock_irq(lock) _spin_lock_irq(lock) #define spin_lock_bh(lock) _spin_lock_bh(lock) #define read_lock_irq(lock) _read_lock_irq(lock) #define read_lock_bh(lock) _read_lock_bh(lock) #define write_lock_irq(lock) _write_lock_irq(lock) #define write_lock_bh(lock) _write_lock_bh(lock) #define spin_unlock(lock) _spin_unlock(lock) #define read_unlock(lock) _read_unlock(lock) #define write_unlock(lock) _write_unlock(lock) #define spin_unlock_irq(lock) _spin_unlock_irq(lock) #define read_unlock_irq(lock) _read_unlock_irq(lock) #define write_unlock_irq(lock) _write_unlock_irq(lock) #define spin_unlock_irqrestore(lock, flags) _spin_unlock_irqrestore(lock, flags) #define spin_unlock_bh(lock) _spin_unlock_bh(lock) #define read_unlock_irqrestore(lock, flags) _read_unlock_irqrestore(lock, flags) #define read_unlock_bh(lock) _read_unlock_bh(lock) #define write_unlock_irqrestore(lock, flags) _write_unlock_irqrestore(lock, flags) #define write_unlock_bh(lock) _write_unlock_bh(lock) #define spin_trylock_bh(lock) __cond_lock(_spin_trylock_bh(lock)) #define spin_trylock_irq(lock) ({ local_irq_disable(); _spin_trylock(lock) ? 1 : ({ local_irq_enable(); 0; }); }) #define spin_trylock_irqsave(lock, flags) ({ local_irq_save(flags); _spin_trylock(lock) ? 1 : ({ local_irq_restore(flags); 0; }); }) #include #define atomic_dec_and_lock(atomic, lock) __cond_lock(_atomic_dec_and_lock(atomic, lock)) #define spin_can_lock(lock) (!spin_is_locked(lock)) #endif android-audiosystem-1.8+13.10.20130807/include/linux/spinlock_api_up.h0000644000015700001700000000616512200324306026014 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_SPINLOCK_API_UP_H #define __LINUX_SPINLOCK_API_UP_H #ifndef __LINUX_SPINLOCK_H #error "please don't include this file directly" #endif #define in_lock_functions(ADDR) 0 #define assert_spin_locked(lock) do { (void)(lock); } while (0) #define __LOCK(lock) do { preempt_disable(); __acquire(lock); (void)(lock); } while (0) #define __LOCK_BH(lock) do { local_bh_disable(); __LOCK(lock); } while (0) #define __LOCK_IRQ(lock) do { local_irq_disable(); __LOCK(lock); } while (0) #define __LOCK_IRQSAVE(lock, flags) do { local_irq_save(flags); __LOCK(lock); } while (0) #define __UNLOCK(lock) do { preempt_enable(); __release(lock); (void)(lock); } while (0) #define __UNLOCK_BH(lock) do { preempt_enable_no_resched(); local_bh_enable(); __release(lock); (void)(lock); } while (0) #define __UNLOCK_IRQ(lock) do { local_irq_enable(); __UNLOCK(lock); } while (0) #define __UNLOCK_IRQRESTORE(lock, flags) do { local_irq_restore(flags); __UNLOCK(lock); } while (0) #define _spin_lock(lock) __LOCK(lock) #define _spin_lock_nested(lock, subclass) __LOCK(lock) #define _read_lock(lock) __LOCK(lock) #define _write_lock(lock) __LOCK(lock) #define _spin_lock_bh(lock) __LOCK_BH(lock) #define _read_lock_bh(lock) __LOCK_BH(lock) #define _write_lock_bh(lock) __LOCK_BH(lock) #define _spin_lock_irq(lock) __LOCK_IRQ(lock) #define _read_lock_irq(lock) __LOCK_IRQ(lock) #define _write_lock_irq(lock) __LOCK_IRQ(lock) #define _spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) #define _read_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) #define _write_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags) #define _spin_trylock(lock) ({ __LOCK(lock); 1; }) #define _read_trylock(lock) ({ __LOCK(lock); 1; }) #define _write_trylock(lock) ({ __LOCK(lock); 1; }) #define _spin_trylock_bh(lock) ({ __LOCK_BH(lock); 1; }) #define _spin_unlock(lock) __UNLOCK(lock) #define _read_unlock(lock) __UNLOCK(lock) #define _write_unlock(lock) __UNLOCK(lock) #define _spin_unlock_bh(lock) __UNLOCK_BH(lock) #define _write_unlock_bh(lock) __UNLOCK_BH(lock) #define _read_unlock_bh(lock) __UNLOCK_BH(lock) #define _spin_unlock_irq(lock) __UNLOCK_IRQ(lock) #define _read_unlock_irq(lock) __UNLOCK_IRQ(lock) #define _write_unlock_irq(lock) __UNLOCK_IRQ(lock) #define _spin_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) #define _read_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) #define _write_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags) #endif android-audiosystem-1.8+13.10.20130807/include/linux/msm_q6vdec.h0000644000015700001700000001030212200324306024665 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _MSM_VDEC_H_ #define _MSM_VDEC_H_ #include #define VDEC_IOCTL_MAGIC 'v' #define VDEC_IOCTL_INITIALIZE _IOWR(VDEC_IOCTL_MAGIC, 1, struct vdec_init) #define VDEC_IOCTL_SETBUFFERS _IOW(VDEC_IOCTL_MAGIC, 2, struct vdec_buffer) #define VDEC_IOCTL_QUEUE _IOWR(VDEC_IOCTL_MAGIC, 3, struct vdec_input_buf) #define VDEC_IOCTL_REUSEFRAMEBUFFER _IOW(VDEC_IOCTL_MAGIC, 4, unsigned int) #define VDEC_IOCTL_FLUSH _IOW(VDEC_IOCTL_MAGIC, 5, unsigned int) #define VDEC_IOCTL_EOS _IO(VDEC_IOCTL_MAGIC, 6) #define VDEC_IOCTL_GETMSG _IOR(VDEC_IOCTL_MAGIC, 7, struct vdec_msg) #define VDEC_IOCTL_CLOSE _IO(VDEC_IOCTL_MAGIC, 8) #define VDEC_IOCTL_FREEBUFFERS _IOW(VDEC_IOCTL_MAGIC, 9, struct vdec_buf_info) #define VDEC_IOCTL_GETDECATTRIBUTES _IOR(VDEC_IOCTL_MAGIC, 10, struct vdec_dec_attributes) enum { VDEC_FRAME_DECODE_OK, VDEC_FRAME_DECODE_ERR, VDEC_FATAL_ERR, VDEC_FLUSH_FINISH, VDEC_EOS, VDEC_FRAME_FLUSH, VDEC_STREAM_SWITCH, VDEC_SUSPEND_FINISH, VDEC_BUFFER_CONSUMED }; enum { VDEC_FLUSH_INPUT, VDEC_FLUSH_OUTPUT, VDEC_FLUSH_ALL }; enum { VDEC_BUFFER_TYPE_INPUT, VDEC_BUFFER_TYPE_OUTPUT, VDEC_BUFFER_TYPE_INTERNAL1, VDEC_BUFFER_TYPE_INTERNAL2, }; enum { VDEC_QUEUE_SUCCESS, VDEC_QUEUE_FAILED, VDEC_QUEUE_BADSTATE, }; struct vdec_input_buf_info { u32 offset; u32 data; u32 size; int timestamp_lo; int timestamp_hi; int avsync_state; u32 flags; }; struct vdec_buf_desc { u32 bufsize; u32 num_min_buffers; u32 num_max_buffers; }; struct vdec_buf_req { u32 max_input_queue_size; struct vdec_buf_desc input; struct vdec_buf_desc output; struct vdec_buf_desc dec_req1; struct vdec_buf_desc dec_req2; }; struct vdec_region_info { u32 src_id; u32 offset; u32 size; }; struct vdec_config { u32 fourcc; u32 width; u32 height; u32 order; u32 notify_enable; u32 vc1_rowbase; u32 h264_startcode_detect; u32 h264_nal_len_size; u32 postproc_flag; u32 fruc_enable; u32 reserved; }; struct vdec_vc1_panscan_regions { int num; int width[4]; int height[4]; int xoffset[4]; int yoffset[4]; }; struct vdec_cropping_window { u32 x1; u32 y1; u32 x2; u32 y2; }; struct vdec_frame_info { u32 status; u32 offset; u32 data1; u32 data2; int timestamp_lo; int timestamp_hi; int cal_timestamp_lo; int cal_timestamp_hi; u32 dec_width; u32 dec_height; struct vdec_cropping_window cwin; u32 picture_type[2]; u32 picture_format; u32 vc1_rangeY; u32 vc1_rangeUV; u32 picture_resolution; u32 frame_disp_repeat; u32 repeat_first_field; u32 top_field_first; u32 interframe_interp; struct vdec_vc1_panscan_regions panscan; u32 concealed_macblk_num; u32 flags; u32 performance_stats; u32 data3; }; struct vdec_buf_info { u32 buf_type; struct vdec_region_info region; u32 num_buf; u32 islast; }; struct vdec_buffer { u32 pmem_id; struct vdec_buf_info buf; }; struct vdec_sequence { u8 *header; u32 len; }; struct vdec_config_sps { struct vdec_config cfg; struct vdec_sequence seq; }; #define VDEC_MSG_REUSEINPUTBUFFER 1 #define VDEC_MSG_FRAMEDONE 2 struct vdec_msg { u32 id; union { u32 buf_id; struct vdec_frame_info vfr_info; }; }; struct vdec_init { struct vdec_config_sps sps_cfg; struct vdec_buf_req *buf_req; }; struct vdec_input_buf { u32 pmem_id; struct vdec_input_buf_info buffer; struct vdec_queue_status *queue_status; }; struct vdec_queue_status { u32 status; }; struct vdec_dec_attributes { u32 fourcc; u32 profile; u32 level; u32 dec_pic_width; u32 dec_pic_height; struct vdec_buf_desc input; struct vdec_buf_desc output; struct vdec_buf_desc dec_req1; struct vdec_buf_desc dec_req2; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/apm_bios.h0000644000015700001700000000564712200324306024432 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_APM_H #define _LINUX_APM_H typedef unsigned short apm_event_t; typedef unsigned short apm_eventinfo_t; #define APM_STATE_READY 0x0000 #define APM_STATE_STANDBY 0x0001 #define APM_STATE_SUSPEND 0x0002 #define APM_STATE_OFF 0x0003 #define APM_STATE_BUSY 0x0004 #define APM_STATE_REJECT 0x0005 #define APM_STATE_OEM_SYS 0x0020 #define APM_STATE_OEM_DEV 0x0040 #define APM_STATE_DISABLE 0x0000 #define APM_STATE_ENABLE 0x0001 #define APM_STATE_DISENGAGE 0x0000 #define APM_STATE_ENGAGE 0x0001 #define APM_SYS_STANDBY 0x0001 #define APM_SYS_SUSPEND 0x0002 #define APM_NORMAL_RESUME 0x0003 #define APM_CRITICAL_RESUME 0x0004 #define APM_LOW_BATTERY 0x0005 #define APM_POWER_STATUS_CHANGE 0x0006 #define APM_UPDATE_TIME 0x0007 #define APM_CRITICAL_SUSPEND 0x0008 #define APM_USER_STANDBY 0x0009 #define APM_USER_SUSPEND 0x000a #define APM_STANDBY_RESUME 0x000b #define APM_CAPABILITY_CHANGE 0x000c #define APM_SUCCESS 0x00 #define APM_DISABLED 0x01 #define APM_CONNECTED 0x02 #define APM_NOT_CONNECTED 0x03 #define APM_16_CONNECTED 0x05 #define APM_16_UNSUPPORTED 0x06 #define APM_32_CONNECTED 0x07 #define APM_32_UNSUPPORTED 0x08 #define APM_BAD_DEVICE 0x09 #define APM_BAD_PARAM 0x0a #define APM_NOT_ENGAGED 0x0b #define APM_BAD_FUNCTION 0x0c #define APM_RESUME_DISABLED 0x0d #define APM_NO_ERROR 0x53 #define APM_BAD_STATE 0x60 #define APM_NO_EVENTS 0x80 #define APM_NOT_PRESENT 0x86 #define APM_DEVICE_BIOS 0x0000 #define APM_DEVICE_ALL 0x0001 #define APM_DEVICE_DISPLAY 0x0100 #define APM_DEVICE_STORAGE 0x0200 #define APM_DEVICE_PARALLEL 0x0300 #define APM_DEVICE_SERIAL 0x0400 #define APM_DEVICE_NETWORK 0x0500 #define APM_DEVICE_PCMCIA 0x0600 #define APM_DEVICE_BATTERY 0x8000 #define APM_DEVICE_OEM 0xe000 #define APM_DEVICE_OLD_ALL 0xffff #define APM_DEVICE_CLASS 0x00ff #define APM_DEVICE_MASK 0xff00 #define APM_MAX_BATTERIES 2 #define APM_CAP_GLOBAL_STANDBY 0x0001 #define APM_CAP_GLOBAL_SUSPEND 0x0002 #define APM_CAP_RESUME_STANDBY_TIMER 0x0004 #define APM_CAP_RESUME_SUSPEND_TIMER 0x0008 #define APM_CAP_RESUME_STANDBY_RING 0x0010 #define APM_CAP_RESUME_SUSPEND_RING 0x0020 #define APM_CAP_RESUME_STANDBY_PCMCIA 0x0040 #define APM_CAP_RESUME_SUSPEND_PCMCIA 0x0080 #include #define APM_IOC_STANDBY _IO('A', 1) #define APM_IOC_SUSPEND _IO('A', 2) #endif android-audiosystem-1.8+13.10.20130807/include/linux/ashmem.h0000644000015700001700000000313512200324306024101 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ASHMEM_H #define _LINUX_ASHMEM_H #include #include #include #define ASHMEM_NAME_LEN 256 #define ASHMEM_NAME_DEF "dev/ashmem" #define ASHMEM_NOT_PURGED 0 #define ASHMEM_WAS_PURGED 1 #define ASHMEM_IS_UNPINNED 0 #define ASHMEM_IS_PINNED 1 struct ashmem_pin { __u32 offset; __u32 len; }; #define __ASHMEMIOC 0x77 #define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN]) #define ASHMEM_GET_NAME _IOR(__ASHMEMIOC, 2, char[ASHMEM_NAME_LEN]) #define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t) #define ASHMEM_GET_SIZE _IO(__ASHMEMIOC, 4) #define ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned long) #define ASHMEM_GET_PROT_MASK _IO(__ASHMEMIOC, 6) #define ASHMEM_PIN _IOW(__ASHMEMIOC, 7, struct ashmem_pin) #define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin) #define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9) #define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10) #endif android-audiosystem-1.8+13.10.20130807/include/linux/msm_audio.h0000644000015700001700000000514112200324306024603 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_MSM_AUDIO_H #define __LINUX_MSM_AUDIO_H #include #include #include #define AUDIO_IOCTL_MAGIC 'a' #define AUDIO_START _IOW(AUDIO_IOCTL_MAGIC, 0, unsigned) #define AUDIO_STOP _IOW(AUDIO_IOCTL_MAGIC, 1, unsigned) #define AUDIO_FLUSH _IOW(AUDIO_IOCTL_MAGIC, 2, unsigned) #define AUDIO_GET_CONFIG _IOR(AUDIO_IOCTL_MAGIC, 3, unsigned) #define AUDIO_SET_CONFIG _IOW(AUDIO_IOCTL_MAGIC, 4, unsigned) #define AUDIO_GET_STATS _IOR(AUDIO_IOCTL_MAGIC, 5, unsigned) #define AUDIO_ENABLE_AUDPP _IOW(AUDIO_IOCTL_MAGIC, 6, unsigned) #define AUDIO_SET_ADRC _IOW(AUDIO_IOCTL_MAGIC, 7, unsigned) #define AUDIO_SET_EQ _IOW(AUDIO_IOCTL_MAGIC, 8, unsigned) #define AUDIO_SET_RX_IIR _IOW(AUDIO_IOCTL_MAGIC, 9, unsigned) #define AUDIO_SET_VOLUME _IOW(AUDIO_IOCTL_MAGIC, 10, unsigned) #define AUDIO_ENABLE_AUDPRE _IOW(AUDIO_IOCTL_MAGIC, 11, unsigned) #define AUDIO_SET_AGC _IOW(AUDIO_IOCTL_MAGIC, 12, unsigned) #define AUDIO_SET_NS _IOW(AUDIO_IOCTL_MAGIC, 13, unsigned) #define AUDIO_SET_TX_IIR _IOW(AUDIO_IOCTL_MAGIC, 14, unsigned) struct msm_audio_config { uint32_t buffer_size; uint32_t buffer_count; uint32_t channel_count; uint32_t sample_rate; uint32_t type; uint32_t unused[3]; }; struct msm_audio_stats { uint32_t byte_count; uint32_t sample_count; uint32_t unused[2]; }; #define SND_IOCTL_MAGIC 's' #define SND_MUTE_UNMUTED 0 #define SND_MUTE_MUTED 1 struct msm_snd_device_config { uint32_t device; uint32_t ear_mute; uint32_t mic_mute; }; #define SND_SET_DEVICE _IOW(SND_IOCTL_MAGIC, 2, struct msm_device_config *) #define SND_METHOD_VOICE 0 struct msm_snd_volume_config { uint32_t device; uint32_t method; uint32_t volume; }; #define SND_SET_VOLUME _IOW(SND_IOCTL_MAGIC, 3, struct msm_snd_volume_config *) #define SND_GET_NUM_ENDPOINTS _IOR(SND_IOCTL_MAGIC, 4, unsigned *) struct msm_snd_endpoint { int id; char name[64]; }; #define SND_GET_ENDPOINT _IOWR(SND_IOCTL_MAGIC, 5, struct msm_snd_endpoint *) #endif android-audiosystem-1.8+13.10.20130807/include/linux/smp_lock.h0000644000015700001700000000163012200324306024434 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_SMPLOCK_H #define __LINUX_SMPLOCK_H #define lock_kernel() do { } while(0) #define unlock_kernel() do { } while(0) #define release_kernel_lock(task) do { } while(0) #define reacquire_kernel_lock(task) 0 #define kernel_locked() 1 #endif android-audiosystem-1.8+13.10.20130807/include/linux/msdos_fs.h0000644000015700001700000001103212200324306024437 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_MSDOS_FS_H #define _LINUX_MSDOS_FS_H #include #include #define SECTOR_SIZE 512 #define SECTOR_BITS 9 #define MSDOS_DPB (MSDOS_DPS) #define MSDOS_DPB_BITS 4 #define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry)) #define MSDOS_DPS_BITS 4 #define CF_LE_W(v) le16_to_cpu(v) #define CF_LE_L(v) le32_to_cpu(v) #define CT_LE_W(v) cpu_to_le16(v) #define CT_LE_L(v) cpu_to_le32(v) #define MSDOS_ROOT_INO 1 #define MSDOS_DIR_BITS 5 #define FAT_MAX_DIR_ENTRIES (65536) #define FAT_MAX_DIR_SIZE (FAT_MAX_DIR_ENTRIES << MSDOS_DIR_BITS) #define ATTR_NONE 0 #define ATTR_RO 1 #define ATTR_HIDDEN 2 #define ATTR_SYS 4 #define ATTR_VOLUME 8 #define ATTR_DIR 16 #define ATTR_ARCH 32 #define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN) #define ATTR_EXT (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME) #define CASE_LOWER_BASE 8 #define CASE_LOWER_EXT 16 #define DELETED_FLAG 0xe5 #define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG) #define MSDOS_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO) #define MSDOS_MKMODE(a, m) (m & (a & ATTR_RO ? S_IRUGO|S_IXUGO : S_IRWXUGO)) #define MSDOS_NAME 11 #define MSDOS_LONGNAME 256 #define MSDOS_SLOTS 21 #define MSDOS_DOT ". " #define MSDOS_DOTDOT ".. " #define FAT_VALID_MEDIA(x) ((0xF8 <= (x) && (x) <= 0xFF) || (x) == 0xF0) #define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x)) #define FAT_START_ENT 2 #define MAX_FAT12 0xFF4 #define MAX_FAT16 0xFFF4 #define MAX_FAT32 0x0FFFFFF6 #define MAX_FAT(s) (MSDOS_SB(s)->fat_bits == 32 ? MAX_FAT32 : MSDOS_SB(s)->fat_bits == 16 ? MAX_FAT16 : MAX_FAT12) #define BAD_FAT12 0xFF7 #define BAD_FAT16 0xFFF7 #define BAD_FAT32 0x0FFFFFF7 #define EOF_FAT12 0xFFF #define EOF_FAT16 0xFFFF #define EOF_FAT32 0x0FFFFFFF #define FAT_ENT_FREE (0) #define FAT_ENT_BAD (BAD_FAT32) #define FAT_ENT_EOF (EOF_FAT32) #define FAT_FSINFO_SIG1 0x41615252 #define FAT_FSINFO_SIG2 0x61417272 #define IS_FSINFO(x) (le32_to_cpu((x)->signature1) == FAT_FSINFO_SIG1 && le32_to_cpu((x)->signature2) == FAT_FSINFO_SIG2) #define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct dirent [2]) #define VFAT_IOCTL_READDIR_SHORT _IOR('r', 2, struct dirent [2]) #define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32) #define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32) #define VFAT_IOCTL_GET_VOLUME_ID _IOR('r', 0x12, __u32) #define VFAT_SFN_DISPLAY_LOWER 0x0001 #define VFAT_SFN_DISPLAY_WIN95 0x0002 #define VFAT_SFN_DISPLAY_WINNT 0x0004 #define VFAT_SFN_CREATE_WIN95 0x0100 #define VFAT_SFN_CREATE_WINNT 0x0200 struct fat_boot_sector { __u8 ignored[3]; __u8 system_id[8]; __u8 sector_size[2]; __u8 sec_per_clus; __le16 reserved; __u8 fats; __u8 dir_entries[2]; __u8 sectors[2]; __u8 media; __le16 fat_length; __le16 secs_track; __le16 heads; __le32 hidden; __le32 total_sect; __le32 fat32_length; __le16 flags; __u8 version[2]; __le32 root_cluster; __le16 info_sector; __le16 backup_boot; __le16 reserved2[6]; }; struct fat_boot_fsinfo { __le32 signature1; __le32 reserved1[120]; __le32 signature2; __le32 free_clusters; __le32 next_cluster; __le32 reserved2[4]; }; struct fat_boot_bsx { __u8 drive; __u8 reserved1; __u8 signature; __u8 vol_id[4]; __u8 vol_label[11]; __u8 type[8]; }; #define FAT16_BSX_OFFSET 36 #define FAT32_BSX_OFFSET 64 struct msdos_dir_entry { __u8 name[MSDOS_NAME]; __u8 attr; __u8 lcase; __u8 ctime_cs; __le16 ctime; __le16 cdate; __le16 adate; __le16 starthi; __le16 time,date,start; __le32 size; }; struct msdos_dir_slot { __u8 id; __u8 name0_4[10]; __u8 attr; __u8 reserved; __u8 alias_checksum; __u8 name5_10[12]; __le16 start; __u8 name11_12[4]; }; struct fat_slot_info { loff_t i_pos; loff_t slot_off; int nr_slots; struct msdos_dir_entry *de; struct buffer_head *bh; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/bitmap.h0000644000015700001700000000166612200324306024112 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_BITMAP_H #define __LINUX_BITMAP_H #ifndef __ASSEMBLY__ #include #include #include #define BITMAP_LAST_WORD_MASK(nbits) ( ((nbits) % BITS_PER_LONG) ? (1UL<<((nbits) % BITS_PER_LONG))-1 : ~0UL ) #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/uio.h0000644000015700001700000000157112200324306023425 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_UIO_H #define __LINUX_UIO_H #include #include struct iovec { void __user *iov_base; __kernel_size_t iov_len; }; #define UIO_FASTIOV 8 #define UIO_MAXIOV 1024 #endif android-audiosystem-1.8+13.10.20130807/include/linux/blkdev.h0000644000015700001700000002661412200324306024105 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_BLKDEV_H #define _LINUX_BLKDEV_H #include #include #include #include #include #include #include #include #include #include #include #include #include struct scsi_ioctl_command; struct request_queue; typedef struct request_queue request_queue_t; struct elevator_queue; typedef struct elevator_queue elevator_t; struct request_pm_state; struct blk_trace; #define BLKDEV_MIN_RQ 4 #define BLKDEV_MAX_RQ 128 struct as_io_context { spinlock_t lock; void (*dtor)(struct as_io_context *aic); void (*exit)(struct as_io_context *aic); unsigned long state; atomic_t nr_queued; atomic_t nr_dispatched; unsigned long last_end_request; unsigned long ttime_total; unsigned long ttime_samples; unsigned long ttime_mean; unsigned int seek_samples; sector_t last_request_pos; u64 seek_total; sector_t seek_mean; }; struct cfq_queue; struct cfq_io_context { struct rb_node rb_node; void *key; struct cfq_queue *cfqq[2]; struct io_context *ioc; unsigned long last_end_request; sector_t last_request_pos; unsigned long last_queue; unsigned long ttime_total; unsigned long ttime_samples; unsigned long ttime_mean; unsigned int seek_samples; u64 seek_total; sector_t seek_mean; struct list_head queue_list; void (*dtor)(struct io_context *); void (*exit)(struct io_context *); }; struct io_context { atomic_t refcount; struct task_struct *task; int (*set_ioprio)(struct io_context *, unsigned int); unsigned long last_waited; int nr_batch_requests; struct as_io_context *aic; struct rb_root cic_root; }; struct io_context *current_io_context(gfp_t gfp_flags); struct io_context *get_io_context(gfp_t gfp_flags); struct request; typedef void (rq_end_io_fn)(struct request *, int); struct request_list { int count[2]; int starved[2]; int elvpriv; mempool_t *rq_pool; wait_queue_head_t wait[2]; }; #define BLK_MAX_CDB 16 struct request { struct list_head queuelist; struct list_head donelist; unsigned long flags; sector_t sector; unsigned long nr_sectors; unsigned int current_nr_sectors; sector_t hard_sector; unsigned long hard_nr_sectors; unsigned int hard_cur_sectors; struct bio *bio; struct bio *biotail; void *elevator_private; void *completion_data; int rq_status; int errors; struct gendisk *rq_disk; unsigned long start_time; unsigned short nr_phys_segments; unsigned short nr_hw_segments; unsigned short ioprio; int tag; int ref_count; request_queue_t *q; struct request_list *rl; struct completion *waiting; void *special; char *buffer; unsigned int cmd_len; unsigned char cmd[BLK_MAX_CDB]; unsigned int data_len; unsigned int sense_len; void *data; void *sense; unsigned int timeout; int retries; rq_end_io_fn *end_io; void *end_io_data; }; enum rq_flag_bits { __REQ_RW, __REQ_FAILFAST, __REQ_SORTED, __REQ_SOFTBARRIER, __REQ_HARDBARRIER, __REQ_FUA, __REQ_CMD, __REQ_NOMERGE, __REQ_STARTED, __REQ_DONTPREP, __REQ_QUEUED, __REQ_ELVPRIV, __REQ_PC, __REQ_BLOCK_PC, __REQ_SENSE, __REQ_FAILED, __REQ_QUIET, __REQ_SPECIAL, __REQ_DRIVE_CMD, __REQ_DRIVE_TASK, __REQ_DRIVE_TASKFILE, __REQ_PREEMPT, __REQ_PM_SUSPEND, __REQ_PM_RESUME, __REQ_PM_SHUTDOWN, __REQ_ORDERED_COLOR, __REQ_RW_SYNC, __REQ_NR_BITS, }; #define REQ_RW (1 << __REQ_RW) #define REQ_FAILFAST (1 << __REQ_FAILFAST) #define REQ_SORTED (1 << __REQ_SORTED) #define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER) #define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER) #define REQ_FUA (1 << __REQ_FUA) #define REQ_CMD (1 << __REQ_CMD) #define REQ_NOMERGE (1 << __REQ_NOMERGE) #define REQ_STARTED (1 << __REQ_STARTED) #define REQ_DONTPREP (1 << __REQ_DONTPREP) #define REQ_QUEUED (1 << __REQ_QUEUED) #define REQ_ELVPRIV (1 << __REQ_ELVPRIV) #define REQ_PC (1 << __REQ_PC) #define REQ_BLOCK_PC (1 << __REQ_BLOCK_PC) #define REQ_SENSE (1 << __REQ_SENSE) #define REQ_FAILED (1 << __REQ_FAILED) #define REQ_QUIET (1 << __REQ_QUIET) #define REQ_SPECIAL (1 << __REQ_SPECIAL) #define REQ_DRIVE_CMD (1 << __REQ_DRIVE_CMD) #define REQ_DRIVE_TASK (1 << __REQ_DRIVE_TASK) #define REQ_DRIVE_TASKFILE (1 << __REQ_DRIVE_TASKFILE) #define REQ_PREEMPT (1 << __REQ_PREEMPT) #define REQ_PM_SUSPEND (1 << __REQ_PM_SUSPEND) #define REQ_PM_RESUME (1 << __REQ_PM_RESUME) #define REQ_PM_SHUTDOWN (1 << __REQ_PM_SHUTDOWN) #define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR) #define REQ_RW_SYNC (1 << __REQ_RW_SYNC) struct request_pm_state { int pm_step; u32 pm_state; void* data; }; #include typedef int (merge_request_fn) (request_queue_t *, struct request *, struct bio *); typedef int (merge_requests_fn) (request_queue_t *, struct request *, struct request *); typedef void (request_fn_proc) (request_queue_t *q); typedef int (make_request_fn) (request_queue_t *q, struct bio *bio); typedef int (prep_rq_fn) (request_queue_t *, struct request *); typedef void (unplug_fn) (request_queue_t *); struct bio_vec; typedef int (merge_bvec_fn) (request_queue_t *, struct bio *, struct bio_vec *); typedef void (activity_fn) (void *data, int rw); typedef int (issue_flush_fn) (request_queue_t *, struct gendisk *, sector_t *); typedef void (prepare_flush_fn) (request_queue_t *, struct request *); typedef void (softirq_done_fn)(struct request *); enum blk_queue_state { Queue_down, Queue_up, }; struct blk_queue_tag { struct request **tag_index; unsigned long *tag_map; struct list_head busy_list; int busy; int max_depth; int real_max_depth; atomic_t refcnt; }; struct request_queue { struct list_head queue_head; struct request *last_merge; elevator_t *elevator; struct request_list rq; request_fn_proc *request_fn; merge_request_fn *back_merge_fn; merge_request_fn *front_merge_fn; merge_requests_fn *merge_requests_fn; make_request_fn *make_request_fn; prep_rq_fn *prep_rq_fn; unplug_fn *unplug_fn; merge_bvec_fn *merge_bvec_fn; activity_fn *activity_fn; issue_flush_fn *issue_flush_fn; prepare_flush_fn *prepare_flush_fn; softirq_done_fn *softirq_done_fn; sector_t end_sector; struct request *boundary_rq; struct timer_list unplug_timer; int unplug_thresh; unsigned long unplug_delay; struct work_struct unplug_work; struct backing_dev_info backing_dev_info; void *queuedata; void *activity_data; unsigned long bounce_pfn; gfp_t bounce_gfp; unsigned long queue_flags; spinlock_t __queue_lock; spinlock_t *queue_lock; struct kobject kobj; unsigned long nr_requests; unsigned int nr_congestion_on; unsigned int nr_congestion_off; unsigned int nr_batching; unsigned int max_sectors; unsigned int max_hw_sectors; unsigned short max_phys_segments; unsigned short max_hw_segments; unsigned short hardsect_size; unsigned int max_segment_size; unsigned long seg_boundary_mask; unsigned int dma_alignment; struct blk_queue_tag *queue_tags; unsigned int nr_sorted; unsigned int in_flight; unsigned int sg_timeout; unsigned int sg_reserved_size; int node; struct blk_trace *blk_trace; unsigned int ordered, next_ordered, ordseq; int orderr, ordcolor; struct request pre_flush_rq, bar_rq, post_flush_rq; struct request *orig_bar_rq; unsigned int bi_size; struct mutex sysfs_lock; }; #define RQ_INACTIVE (-1) #define RQ_ACTIVE 1 #define QUEUE_FLAG_CLUSTER 0 #define QUEUE_FLAG_QUEUED 1 #define QUEUE_FLAG_STOPPED 2 #define QUEUE_FLAG_READFULL 3 #define QUEUE_FLAG_WRITEFULL 4 #define QUEUE_FLAG_DEAD 5 #define QUEUE_FLAG_REENTER 6 #define QUEUE_FLAG_PLUGGED 7 #define QUEUE_FLAG_ELVSWITCH 8 enum { QUEUE_ORDERED_NONE = 0x00, QUEUE_ORDERED_DRAIN = 0x01, QUEUE_ORDERED_TAG = 0x02, QUEUE_ORDERED_PREFLUSH = 0x10, QUEUE_ORDERED_POSTFLUSH = 0x20, QUEUE_ORDERED_FUA = 0x40, QUEUE_ORDERED_DRAIN_FLUSH = QUEUE_ORDERED_DRAIN | QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_POSTFLUSH, QUEUE_ORDERED_DRAIN_FUA = QUEUE_ORDERED_DRAIN | QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_FUA, QUEUE_ORDERED_TAG_FLUSH = QUEUE_ORDERED_TAG | QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_POSTFLUSH, QUEUE_ORDERED_TAG_FUA = QUEUE_ORDERED_TAG | QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_FUA, QUEUE_ORDSEQ_STARTED = 0x01, QUEUE_ORDSEQ_DRAIN = 0x02, QUEUE_ORDSEQ_PREFLUSH = 0x04, QUEUE_ORDSEQ_BAR = 0x08, QUEUE_ORDSEQ_POSTFLUSH = 0x10, QUEUE_ORDSEQ_DONE = 0x20, }; #define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags) #define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) #define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) #define blk_queue_flushing(q) ((q)->ordseq) #define blk_fs_request(rq) ((rq)->flags & REQ_CMD) #define blk_pc_request(rq) ((rq)->flags & REQ_BLOCK_PC) #define blk_noretry_request(rq) ((rq)->flags & REQ_FAILFAST) #define blk_rq_started(rq) ((rq)->flags & REQ_STARTED) #define blk_account_rq(rq) (blk_rq_started(rq) && blk_fs_request(rq)) #define blk_pm_suspend_request(rq) ((rq)->flags & REQ_PM_SUSPEND) #define blk_pm_resume_request(rq) ((rq)->flags & REQ_PM_RESUME) #define blk_pm_request(rq) ((rq)->flags & (REQ_PM_SUSPEND | REQ_PM_RESUME)) #define blk_sorted_rq(rq) ((rq)->flags & REQ_SORTED) #define blk_barrier_rq(rq) ((rq)->flags & REQ_HARDBARRIER) #define blk_fua_rq(rq) ((rq)->flags & REQ_FUA) #define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) #define rq_data_dir(rq) ((rq)->flags & 1) #define RQ_NOMERGE_FLAGS (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER) #define rq_mergeable(rq) (!((rq)->flags & RQ_NOMERGE_FLAGS) && blk_fs_request((rq))) #define blk_queue_headactive(q, head_active) #define BLKPREP_OK 0 #define BLKPREP_KILL 1 #define BLKPREP_DEFER 2 #define BLK_BOUNCE_HIGH ((u64)blk_max_low_pfn << PAGE_SHIFT) #define BLK_BOUNCE_ANY ((u64)blk_max_pfn << PAGE_SHIFT) #define BLK_BOUNCE_ISA (ISA_DMA_THRESHOLD) #define rq_for_each_bio(_bio, rq) if ((rq->bio)) for (_bio = (rq)->bio; _bio; _bio = _bio->bi_next) #define end_io_error(uptodate) (unlikely((uptodate) <= 0)) #define blk_queue_tag_depth(q) ((q)->queue_tags->busy) #define blk_queue_tag_queue(q) ((q)->queue_tags->busy < (q)->queue_tags->max_depth) #define blk_rq_tagged(rq) ((rq)->flags & REQ_QUEUED) #define MAX_PHYS_SEGMENTS 128 #define MAX_HW_SEGMENTS 128 #define SAFE_MAX_SECTORS 255 #define BLK_DEF_MAX_SECTORS 1024 #define MAX_SEGMENT_SIZE 65536 #define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist) #define blk_finished_io(nsects) do { } while (0) #define blk_started_io(nsects) do { } while (0) #define sector_div(n, b)( { int _res; _res = (n) % (b); (n) /= (b); _res; } ) #define MODULE_ALIAS_BLOCKDEV(major,minor) MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor)) #define MODULE_ALIAS_BLOCKDEV_MAJOR(major) MODULE_ALIAS("block-major-" __stringify(major) "-*") #endif android-audiosystem-1.8+13.10.20130807/include/linux/pnp.h0000644000015700001700000000131512200324306023422 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_PNP_H #define _LINUX_PNP_H #endif android-audiosystem-1.8+13.10.20130807/include/linux/nvram.h0000644000015700001700000000160312200324306023750 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_NVRAM_H #define _LINUX_NVRAM_H #include #define NVRAM_INIT _IO('p', 0x40) #define NVRAM_SETCKS _IO('p', 0x41) #define NVRAM_FIRST_BYTE 14 #define NVRAM_OFFSET(x) ((x)-NVRAM_FIRST_BYTE) #endif android-audiosystem-1.8+13.10.20130807/include/linux/nfs3.h0000644000015700001700000000537612200324306023511 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_NFS3_H #define _LINUX_NFS3_H #define NFS3_PORT 2049 #define NFS3_MAXDATA 32768 #define NFS3_MAXPATHLEN PATH_MAX #define NFS3_MAXNAMLEN NAME_MAX #define NFS3_MAXGROUPS 16 #define NFS3_FHSIZE 64 #define NFS3_COOKIESIZE 4 #define NFS3_FIFO_DEV (-1) #define NFS3MODE_FMT 0170000 #define NFS3MODE_DIR 0040000 #define NFS3MODE_CHR 0020000 #define NFS3MODE_BLK 0060000 #define NFS3MODE_REG 0100000 #define NFS3MODE_LNK 0120000 #define NFS3MODE_SOCK 0140000 #define NFS3MODE_FIFO 0010000 #define NFS3_ACCESS_READ 0x0001 #define NFS3_ACCESS_LOOKUP 0x0002 #define NFS3_ACCESS_MODIFY 0x0004 #define NFS3_ACCESS_EXTEND 0x0008 #define NFS3_ACCESS_DELETE 0x0010 #define NFS3_ACCESS_EXECUTE 0x0020 #define NFS3_ACCESS_FULL 0x003f enum nfs3_createmode { NFS3_CREATE_UNCHECKED = 0, NFS3_CREATE_GUARDED = 1, NFS3_CREATE_EXCLUSIVE = 2 }; #define NFS3_FSF_LINK 0x0001 #define NFS3_FSF_SYMLINK 0x0002 #define NFS3_FSF_HOMOGENEOUS 0x0008 #define NFS3_FSF_CANSETTIME 0x0010 #define NFS3_FSF_DEFAULT 0x001B #define NFS3_FSF_BILLYBOY 0x0018 #define NFS3_FSF_READONLY 0x0008 enum nfs3_ftype { NF3NON = 0, NF3REG = 1, NF3DIR = 2, NF3BLK = 3, NF3CHR = 4, NF3LNK = 5, NF3SOCK = 6, NF3FIFO = 7, NF3BAD = 8 }; struct nfs3_fh { unsigned short size; unsigned char data[NFS3_FHSIZE]; }; #define NFS3_VERSION 3 #define NFS3PROC_NULL 0 #define NFS3PROC_GETATTR 1 #define NFS3PROC_SETATTR 2 #define NFS3PROC_LOOKUP 3 #define NFS3PROC_ACCESS 4 #define NFS3PROC_READLINK 5 #define NFS3PROC_READ 6 #define NFS3PROC_WRITE 7 #define NFS3PROC_CREATE 8 #define NFS3PROC_MKDIR 9 #define NFS3PROC_SYMLINK 10 #define NFS3PROC_MKNOD 11 #define NFS3PROC_REMOVE 12 #define NFS3PROC_RMDIR 13 #define NFS3PROC_RENAME 14 #define NFS3PROC_LINK 15 #define NFS3PROC_READDIR 16 #define NFS3PROC_READDIRPLUS 17 #define NFS3PROC_FSSTAT 18 #define NFS3PROC_FSINFO 19 #define NFS3PROC_PATHCONF 20 #define NFS3PROC_COMMIT 21 #define NFS_MNT3_PROGRAM 100005 #define NFS_MNT3_VERSION 3 #define MOUNTPROC3_NULL 0 #define MOUNTPROC3_MNT 1 #define MOUNTPROC3_UMNT 3 #define MOUNTPROC3_UMNTALL 4 #ifdef NFS_NEED_KERNEL_TYPES #define NFS3_POST_OP_ATTR_WORDS 22 #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/cpcap_audio.h0000644000015700001700000000453612200324306025104 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _CPCAP_AUDIO_H #define _CPCAP_AUDIO_H #include #define CPCAP_AUDIO_MAGIC 'c' #define CPCAP_AUDIO_OUT_SPEAKER 0 #define CPCAP_AUDIO_OUT_HEADSET 1 #define CPCAP_AUDIO_OUT_HEADSET_AND_SPEAKER 2 #define CPCAP_AUDIO_OUT_STANDBY 3 #define CPCAP_AUDIO_OUT_ANLG_DOCK_HEADSET 4 #define CPCAP_AUDIO_OUT_MAX 4 struct cpcap_audio_stream { unsigned id; int on; }; #define CPCAP_AUDIO_OUT_SET_OUTPUT _IOW(CPCAP_AUDIO_MAGIC, 0, const struct cpcap_audio_stream *) #define CPCAP_AUDIO_OUT_VOL_MIN 0 #define CPCAP_AUDIO_OUT_VOL_MAX 15 #define CPCAP_AUDIO_OUT_SET_VOLUME _IOW(CPCAP_AUDIO_MAGIC, 1, unsigned int) #define CPCAP_AUDIO_OUT_GET_OUTPUT _IOR(CPCAP_AUDIO_MAGIC, 2, struct cpcap_audio_stream *) #define CPCAP_AUDIO_OUT_GET_VOLUME _IOR(CPCAP_AUDIO_MAGIC, 3, unsigned int *) #define CPCAP_AUDIO_IN_MIC1 0 #define CPCAP_AUDIO_IN_MIC2 1 #define CPCAP_AUDIO_IN_STANDBY 2 #define CPCAP_AUDIO_IN_MAX 2 #define CPCAP_AUDIO_IN_SET_INPUT _IOW(CPCAP_AUDIO_MAGIC, 4, const struct cpcap_audio_stream *) #define CPCAP_AUDIO_IN_GET_INPUT _IOR(CPCAP_AUDIO_MAGIC, 5, struct cpcap_audio_stream *) #define CPCAP_AUDIO_IN_VOL_MIN 0 #define CPCAP_AUDIO_IN_VOL_MAX 31 #define CPCAP_AUDIO_IN_SET_VOLUME _IOW(CPCAP_AUDIO_MAGIC, 6, unsigned int) #define CPCAP_AUDIO_IN_GET_VOLUME _IOR(CPCAP_AUDIO_MAGIC, 7, unsigned int *) #define CPCAP_AUDIO_OUT_GET_RATE _IOR(CPCAP_AUDIO_MAGIC, 8, unsigned int *) #define CPCAP_AUDIO_OUT_SET_RATE _IOW(CPCAP_AUDIO_MAGIC, 9, unsigned int) #define CPCAP_AUDIO_IN_GET_RATE _IOR(CPCAP_AUDIO_MAGIC, 10, unsigned int *) #define CPCAP_AUDIO_IN_SET_RATE _IOW(CPCAP_AUDIO_MAGIC, 11, unsigned int) #define CPCAP_AUDIO_SET_BLUETOOTH_BYPASS _IOW(CPCAP_AUDIO_MAGIC, 12, unsigned int) #endif android-audiosystem-1.8+13.10.20130807/include/linux/usb.h0000644000015700001700000000150212200324306023414 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_USB_H #define __LINUX_USB_H #include #include #define USB_MAJOR 180 #define USB_DEVICE_MAJOR 189 #endif android-audiosystem-1.8+13.10.20130807/include/linux/usbdevice_fs.h0000644000015700001700000000705412200324306025274 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_USBDEVICE_FS_H #define _LINUX_USBDEVICE_FS_H #include #define USBDEVICE_SUPER_MAGIC 0x9fa2 struct usbdevfs_ctrltransfer { __u8 bRequestType; __u8 bRequest; __u16 wValue; __u16 wIndex; __u16 wLength; __u32 timeout; void __user *data; }; struct usbdevfs_bulktransfer { unsigned int ep; unsigned int len; unsigned int timeout; void __user *data; }; struct usbdevfs_setinterface { unsigned int interface; unsigned int altsetting; }; struct usbdevfs_disconnectsignal { unsigned int signr; void __user *context; }; #define USBDEVFS_MAXDRIVERNAME 255 struct usbdevfs_getdriver { unsigned int interface; char driver[USBDEVFS_MAXDRIVERNAME + 1]; }; struct usbdevfs_connectinfo { unsigned int devnum; unsigned char slow; }; #define USBDEVFS_URB_SHORT_NOT_OK 1 #define USBDEVFS_URB_ISO_ASAP 2 #define USBDEVFS_URB_TYPE_ISO 0 #define USBDEVFS_URB_TYPE_INTERRUPT 1 #define USBDEVFS_URB_TYPE_CONTROL 2 #define USBDEVFS_URB_TYPE_BULK 3 struct usbdevfs_iso_packet_desc { unsigned int length; unsigned int actual_length; unsigned int status; }; struct usbdevfs_urb { unsigned char type; unsigned char endpoint; int status; unsigned int flags; void __user *buffer; int buffer_length; int actual_length; int start_frame; int number_of_packets; int error_count; unsigned int signr; void *usercontext; struct usbdevfs_iso_packet_desc iso_frame_desc[0]; }; struct usbdevfs_ioctl { int ifno; int ioctl_code; void __user *data; }; struct usbdevfs_hub_portinfo { char nports; char port [127]; }; #define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer) #define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer) #define USBDEVFS_RESETEP _IOR('U', 3, unsigned int) #define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface) #define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int) #define USBDEVFS_GETDRIVER _IOW('U', 8, struct usbdevfs_getdriver) #define USBDEVFS_SUBMITURB _IOR('U', 10, struct usbdevfs_urb) #define USBDEVFS_SUBMITURB32 _IOR('U', 10, struct usbdevfs_urb32) #define USBDEVFS_DISCARDURB _IO('U', 11) #define USBDEVFS_REAPURB _IOW('U', 12, void *) #define USBDEVFS_REAPURB32 _IOW('U', 12, u32) #define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *) #define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, u32) #define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal) #define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int) #define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int) #define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo) #define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl) #define USBDEVFS_IOCTL32 _IOWR('U', 18, struct usbdevfs_ioctl32) #define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo) #define USBDEVFS_RESET _IO('U', 20) #define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int) #define USBDEVFS_DISCONNECT _IO('U', 22) #define USBDEVFS_CONNECT _IO('U', 23) #endif android-audiosystem-1.8+13.10.20130807/include/linux/atmapi.h0000644000015700001700000000163612200324306024106 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ATMAPI_H #define _LINUX_ATMAPI_H #if defined(__sparc__) || defined(__ia64__) #define __ATM_API_ALIGN __attribute__((aligned(8))) #else #define __ATM_API_ALIGN #endif typedef struct { unsigned char _[8]; } __ATM_API_ALIGN atm_kptr_t; #endif android-audiosystem-1.8+13.10.20130807/include/linux/mutex-debug.h0000644000015700001700000000173112200324306025055 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_MUTEX_DEBUG_H #define __LINUX_MUTEX_DEBUG_H #include #include #define __DEBUG_MUTEX_INITIALIZER(lockname) , .magic = &lockname #define mutex_init(mutex) do { static struct lock_class_key __key; __mutex_init((mutex), #mutex, &__key); } while (0) #endif android-audiosystem-1.8+13.10.20130807/include/linux/fs.h0000644000015700001700000001056612200324306023245 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_FS_H #define _LINUX_FS_H #include #include #undef NR_OPEN #define NR_OPEN (1024*1024) #define INR_OPEN 1024 #define BLOCK_SIZE_BITS 10 #define BLOCK_SIZE (1<i_sb->s_flags & (flg)) #define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY) #define IS_SYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS) || ((inode)->i_flags & S_SYNC)) #define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || ((inode)->i_flags & (S_SYNC|S_DIRSYNC))) #define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK) #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) #define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL) #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) #define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) #define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE) #define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE) #define BLKROSET _IO(0x12,93) #define BLKROGET _IO(0x12,94) #define BLKRRPART _IO(0x12,95) #define BLKGETSIZE _IO(0x12,96) #define BLKFLSBUF _IO(0x12,97) #define BLKRASET _IO(0x12,98) #define BLKRAGET _IO(0x12,99) #define BLKFRASET _IO(0x12,100) #define BLKFRAGET _IO(0x12,101) #define BLKSECTSET _IO(0x12,102) #define BLKSECTGET _IO(0x12,103) #define BLKSSZGET _IO(0x12,104) #define BLKBSZGET _IOR(0x12,112,size_t) #define BLKBSZSET _IOW(0x12,113,size_t) #define BLKGETSIZE64 _IOR(0x12,114,size_t) #define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup) #define BLKTRACESTART _IO(0x12,116) #define BLKTRACESTOP _IO(0x12,117) #define BLKTRACETEARDOWN _IO(0x12,118) #define BMAP_IOCTL 1 #define FIBMAP _IO(0x00,1) #define FIGETBSZ _IO(0x00,2) #define SYNC_FILE_RANGE_WAIT_BEFORE 1 #define SYNC_FILE_RANGE_WRITE 2 #define SYNC_FILE_RANGE_WAIT_AFTER 4 #endif android-audiosystem-1.8+13.10.20130807/include/linux/cdrom.h0000644000015700001700000003510512200324306023735 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_CDROM_H #define _LINUX_CDROM_H #include #define EDRIVE_CANT_DO_THIS EOPNOTSUPP #define CDROMPAUSE 0x5301 #define CDROMRESUME 0x5302 #define CDROMPLAYMSF 0x5303 #define CDROMPLAYTRKIND 0x5304 #define CDROMREADTOCHDR 0x5305 #define CDROMREADTOCENTRY 0x5306 #define CDROMSTOP 0x5307 #define CDROMSTART 0x5308 #define CDROMEJECT 0x5309 #define CDROMVOLCTRL 0x530a #define CDROMSUBCHNL 0x530b #define CDROMREADMODE2 0x530c #define CDROMREADMODE1 0x530d #define CDROMREADAUDIO 0x530e #define CDROMEJECT_SW 0x530f #define CDROMMULTISESSION 0x5310 #define CDROM_GET_MCN 0x5311 #define CDROM_GET_UPC CDROM_GET_MCN #define CDROMRESET 0x5312 #define CDROMVOLREAD 0x5313 #define CDROMREADRAW 0x5314 #define CDROMREADCOOKED 0x5315 #define CDROMSEEK 0x5316 #define CDROMPLAYBLK 0x5317 #define CDROMREADALL 0x5318 #define CDROMGETSPINDOWN 0x531d #define CDROMSETSPINDOWN 0x531e #define CDROMCLOSETRAY 0x5319 #define CDROM_SET_OPTIONS 0x5320 #define CDROM_CLEAR_OPTIONS 0x5321 #define CDROM_SELECT_SPEED 0x5322 #define CDROM_SELECT_DISC 0x5323 #define CDROM_MEDIA_CHANGED 0x5325 #define CDROM_DRIVE_STATUS 0x5326 #define CDROM_DISC_STATUS 0x5327 #define CDROM_CHANGER_NSLOTS 0x5328 #define CDROM_LOCKDOOR 0x5329 #define CDROM_DEBUG 0x5330 #define CDROM_GET_CAPABILITY 0x5331 #define CDROMAUDIOBUFSIZ 0x5382 #define DVD_READ_STRUCT 0x5390 #define DVD_WRITE_STRUCT 0x5391 #define DVD_AUTH 0x5392 #define CDROM_SEND_PACKET 0x5393 #define CDROM_NEXT_WRITABLE 0x5394 #define CDROM_LAST_WRITTEN 0x5395 struct cdrom_msf0 { __u8 minute; __u8 second; __u8 frame; }; union cdrom_addr { struct cdrom_msf0 msf; int lba; }; struct cdrom_msf { __u8 cdmsf_min0; __u8 cdmsf_sec0; __u8 cdmsf_frame0; __u8 cdmsf_min1; __u8 cdmsf_sec1; __u8 cdmsf_frame1; }; struct cdrom_ti { __u8 cdti_trk0; __u8 cdti_ind0; __u8 cdti_trk1; __u8 cdti_ind1; }; struct cdrom_tochdr { __u8 cdth_trk0; __u8 cdth_trk1; }; struct cdrom_volctrl { __u8 channel0; __u8 channel1; __u8 channel2; __u8 channel3; }; struct cdrom_subchnl { __u8 cdsc_format; __u8 cdsc_audiostatus; __u8 cdsc_adr: 4; __u8 cdsc_ctrl: 4; __u8 cdsc_trk; __u8 cdsc_ind; union cdrom_addr cdsc_absaddr; union cdrom_addr cdsc_reladdr; }; struct cdrom_tocentry { __u8 cdte_track; __u8 cdte_adr :4; __u8 cdte_ctrl :4; __u8 cdte_format; union cdrom_addr cdte_addr; __u8 cdte_datamode; }; struct cdrom_read { int cdread_lba; char *cdread_bufaddr; int cdread_buflen; }; struct cdrom_read_audio { union cdrom_addr addr; __u8 addr_format; int nframes; __u8 __user *buf; }; struct cdrom_multisession { union cdrom_addr addr; __u8 xa_flag; __u8 addr_format; }; struct cdrom_mcn { __u8 medium_catalog_number[14]; }; struct cdrom_blk { unsigned from; unsigned short len; }; #define CDROM_PACKET_SIZE 12 #define CGC_DATA_UNKNOWN 0 #define CGC_DATA_WRITE 1 #define CGC_DATA_READ 2 #define CGC_DATA_NONE 3 struct cdrom_generic_command { unsigned char cmd[CDROM_PACKET_SIZE]; unsigned char __user *buffer; unsigned int buflen; int stat; struct request_sense __user *sense; unsigned char data_direction; int quiet; int timeout; void __user *reserved[1]; }; #define CD_MINS 74 #define CD_SECS 60 #define CD_FRAMES 75 #define CD_SYNC_SIZE 12 #define CD_MSF_OFFSET 150 #define CD_CHUNK_SIZE 24 #define CD_NUM_OF_CHUNKS 98 #define CD_FRAMESIZE_SUB 96 #define CD_HEAD_SIZE 4 #define CD_SUBHEAD_SIZE 8 #define CD_EDC_SIZE 4 #define CD_ZERO_SIZE 8 #define CD_ECC_SIZE 276 #define CD_FRAMESIZE 2048 #define CD_FRAMESIZE_RAW 2352 #define CD_FRAMESIZE_RAWER 2646 #define CD_FRAMESIZE_RAW1 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE) #define CD_FRAMESIZE_RAW0 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE-CD_HEAD_SIZE) #define CD_XA_HEAD (CD_HEAD_SIZE+CD_SUBHEAD_SIZE) #define CD_XA_TAIL (CD_EDC_SIZE+CD_ECC_SIZE) #define CD_XA_SYNC_HEAD (CD_SYNC_SIZE+CD_XA_HEAD) #define CDROM_LBA 0x01 #define CDROM_MSF 0x02 #define CDROM_DATA_TRACK 0x04 #define CDROM_LEADOUT 0xAA #define CDROM_AUDIO_INVALID 0x00 #define CDROM_AUDIO_PLAY 0x11 #define CDROM_AUDIO_PAUSED 0x12 #define CDROM_AUDIO_COMPLETED 0x13 #define CDROM_AUDIO_ERROR 0x14 #define CDROM_AUDIO_NO_STATUS 0x15 #define CDC_CLOSE_TRAY 0x1 #define CDC_OPEN_TRAY 0x2 #define CDC_LOCK 0x4 #define CDC_SELECT_SPEED 0x8 #define CDC_SELECT_DISC 0x10 #define CDC_MULTI_SESSION 0x20 #define CDC_MCN 0x40 #define CDC_MEDIA_CHANGED 0x80 #define CDC_PLAY_AUDIO 0x100 #define CDC_RESET 0x200 #define CDC_DRIVE_STATUS 0x800 #define CDC_GENERIC_PACKET 0x1000 #define CDC_CD_R 0x2000 #define CDC_CD_RW 0x4000 #define CDC_DVD 0x8000 #define CDC_DVD_R 0x10000 #define CDC_DVD_RAM 0x20000 #define CDC_MO_DRIVE 0x40000 #define CDC_MRW 0x80000 #define CDC_MRW_W 0x100000 #define CDC_RAM 0x200000 #define CDS_NO_INFO 0 #define CDS_NO_DISC 1 #define CDS_TRAY_OPEN 2 #define CDS_DRIVE_NOT_READY 3 #define CDS_DISC_OK 4 #define CDS_AUDIO 100 #define CDS_DATA_1 101 #define CDS_DATA_2 102 #define CDS_XA_2_1 103 #define CDS_XA_2_2 104 #define CDS_MIXED 105 #define CDO_AUTO_CLOSE 0x1 #define CDO_AUTO_EJECT 0x2 #define CDO_USE_FFLAGS 0x4 #define CDO_LOCK 0x8 #define CDO_CHECK_TYPE 0x10 #define CDSL_NONE ((int) (~0U>>1)-1) #define CDSL_CURRENT ((int) (~0U>>1)) #define CD_PART_MAX 64 #define CD_PART_MASK (CD_PART_MAX - 1) #define GPCMD_BLANK 0xa1 #define GPCMD_CLOSE_TRACK 0x5b #define GPCMD_FLUSH_CACHE 0x35 #define GPCMD_FORMAT_UNIT 0x04 #define GPCMD_GET_CONFIGURATION 0x46 #define GPCMD_GET_EVENT_STATUS_NOTIFICATION 0x4a #define GPCMD_GET_PERFORMANCE 0xac #define GPCMD_INQUIRY 0x12 #define GPCMD_LOAD_UNLOAD 0xa6 #define GPCMD_MECHANISM_STATUS 0xbd #define GPCMD_MODE_SELECT_10 0x55 #define GPCMD_MODE_SENSE_10 0x5a #define GPCMD_PAUSE_RESUME 0x4b #define GPCMD_PLAY_AUDIO_10 0x45 #define GPCMD_PLAY_AUDIO_MSF 0x47 #define GPCMD_PLAY_AUDIO_TI 0x48 #define GPCMD_PLAY_CD 0xbc #define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e #define GPCMD_READ_10 0x28 #define GPCMD_READ_12 0xa8 #define GPCMD_READ_BUFFER_CAPACITY 0x5c #define GPCMD_READ_CDVD_CAPACITY 0x25 #define GPCMD_READ_CD 0xbe #define GPCMD_READ_CD_MSF 0xb9 #define GPCMD_READ_DISC_INFO 0x51 #define GPCMD_READ_DVD_STRUCTURE 0xad #define GPCMD_READ_FORMAT_CAPACITIES 0x23 #define GPCMD_READ_HEADER 0x44 #define GPCMD_READ_TRACK_RZONE_INFO 0x52 #define GPCMD_READ_SUBCHANNEL 0x42 #define GPCMD_READ_TOC_PMA_ATIP 0x43 #define GPCMD_REPAIR_RZONE_TRACK 0x58 #define GPCMD_REPORT_KEY 0xa4 #define GPCMD_REQUEST_SENSE 0x03 #define GPCMD_RESERVE_RZONE_TRACK 0x53 #define GPCMD_SEND_CUE_SHEET 0x5d #define GPCMD_SCAN 0xba #define GPCMD_SEEK 0x2b #define GPCMD_SEND_DVD_STRUCTURE 0xbf #define GPCMD_SEND_EVENT 0xa2 #define GPCMD_SEND_KEY 0xa3 #define GPCMD_SEND_OPC 0x54 #define GPCMD_SET_READ_AHEAD 0xa7 #define GPCMD_SET_STREAMING 0xb6 #define GPCMD_START_STOP_UNIT 0x1b #define GPCMD_STOP_PLAY_SCAN 0x4e #define GPCMD_TEST_UNIT_READY 0x00 #define GPCMD_VERIFY_10 0x2f #define GPCMD_WRITE_10 0x2a #define GPCMD_WRITE_AND_VERIFY_10 0x2e #define GPCMD_SET_SPEED 0xbb #define GPCMD_PLAYAUDIO_TI 0x48 #define GPCMD_GET_MEDIA_STATUS 0xda #define GPMODE_VENDOR_PAGE 0x00 #define GPMODE_R_W_ERROR_PAGE 0x01 #define GPMODE_WRITE_PARMS_PAGE 0x05 #define GPMODE_WCACHING_PAGE 0x08 #define GPMODE_AUDIO_CTL_PAGE 0x0e #define GPMODE_POWER_PAGE 0x1a #define GPMODE_FAULT_FAIL_PAGE 0x1c #define GPMODE_TO_PROTECT_PAGE 0x1d #define GPMODE_CAPABILITIES_PAGE 0x2a #define GPMODE_ALL_PAGES 0x3f #define GPMODE_CDROM_PAGE 0x0d #define DVD_STRUCT_PHYSICAL 0x00 #define DVD_STRUCT_COPYRIGHT 0x01 #define DVD_STRUCT_DISCKEY 0x02 #define DVD_STRUCT_BCA 0x03 #define DVD_STRUCT_MANUFACT 0x04 struct dvd_layer { __u8 book_version : 4; __u8 book_type : 4; __u8 min_rate : 4; __u8 disc_size : 4; __u8 layer_type : 4; __u8 track_path : 1; __u8 nlayers : 2; __u8 track_density : 4; __u8 linear_density : 4; __u8 bca : 1; __u32 start_sector; __u32 end_sector; __u32 end_sector_l0; }; #define DVD_LAYERS 4 struct dvd_physical { __u8 type; __u8 layer_num; struct dvd_layer layer[DVD_LAYERS]; }; struct dvd_copyright { __u8 type; __u8 layer_num; __u8 cpst; __u8 rmi; }; struct dvd_disckey { __u8 type; unsigned agid : 2; __u8 value[2048]; }; struct dvd_bca { __u8 type; int len; __u8 value[188]; }; struct dvd_manufact { __u8 type; __u8 layer_num; int len; __u8 value[2048]; }; typedef union { __u8 type; struct dvd_physical physical; struct dvd_copyright copyright; struct dvd_disckey disckey; struct dvd_bca bca; struct dvd_manufact manufact; } dvd_struct; #define DVD_LU_SEND_AGID 0 #define DVD_HOST_SEND_CHALLENGE 1 #define DVD_LU_SEND_KEY1 2 #define DVD_LU_SEND_CHALLENGE 3 #define DVD_HOST_SEND_KEY2 4 #define DVD_AUTH_ESTABLISHED 5 #define DVD_AUTH_FAILURE 6 #define DVD_LU_SEND_TITLE_KEY 7 #define DVD_LU_SEND_ASF 8 #define DVD_INVALIDATE_AGID 9 #define DVD_LU_SEND_RPC_STATE 10 #define DVD_HOST_SEND_RPC_STATE 11 typedef __u8 dvd_key[5]; typedef __u8 dvd_challenge[10]; struct dvd_lu_send_agid { __u8 type; unsigned agid : 2; }; struct dvd_host_send_challenge { __u8 type; unsigned agid : 2; dvd_challenge chal; }; struct dvd_send_key { __u8 type; unsigned agid : 2; dvd_key key; }; struct dvd_lu_send_challenge { __u8 type; unsigned agid : 2; dvd_challenge chal; }; #define DVD_CPM_NO_COPYRIGHT 0 #define DVD_CPM_COPYRIGHTED 1 #define DVD_CP_SEC_NONE 0 #define DVD_CP_SEC_EXIST 1 #define DVD_CGMS_UNRESTRICTED 0 #define DVD_CGMS_SINGLE 2 #define DVD_CGMS_RESTRICTED 3 struct dvd_lu_send_title_key { __u8 type; unsigned agid : 2; dvd_key title_key; int lba; unsigned cpm : 1; unsigned cp_sec : 1; unsigned cgms : 2; }; struct dvd_lu_send_asf { __u8 type; unsigned agid : 2; unsigned asf : 1; }; struct dvd_host_send_rpcstate { __u8 type; __u8 pdrc; }; struct dvd_lu_send_rpcstate { __u8 type : 2; __u8 vra : 3; __u8 ucca : 3; __u8 region_mask; __u8 rpc_scheme; }; typedef union { __u8 type; struct dvd_lu_send_agid lsa; struct dvd_host_send_challenge hsc; struct dvd_send_key lsk; struct dvd_lu_send_challenge lsc; struct dvd_send_key hsk; struct dvd_lu_send_title_key lstk; struct dvd_lu_send_asf lsasf; struct dvd_host_send_rpcstate hrpcs; struct dvd_lu_send_rpcstate lrpcs; } dvd_authinfo; struct request_sense { #ifdef __BIG_ENDIAN_BITFIELD __u8 valid : 1; __u8 error_code : 7; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 error_code : 7; __u8 valid : 1; #endif __u8 segment_number; #ifdef __BIG_ENDIAN_BITFIELD __u8 reserved1 : 2; __u8 ili : 1; __u8 reserved2 : 1; __u8 sense_key : 4; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 sense_key : 4; __u8 reserved2 : 1; __u8 ili : 1; __u8 reserved1 : 2; #endif __u8 information[4]; __u8 add_sense_len; __u8 command_info[4]; __u8 asc; __u8 ascq; __u8 fruc; __u8 sks[3]; __u8 asb[46]; }; #define CDF_RWRT 0x0020 #define CDF_HWDM 0x0024 #define CDF_MRW 0x0028 #define CDM_MRW_NOTMRW 0 #define CDM_MRW_BGFORMAT_INACTIVE 1 #define CDM_MRW_BGFORMAT_ACTIVE 2 #define CDM_MRW_BGFORMAT_COMPLETE 3 #define MRW_LBA_DMA 0 #define MRW_LBA_GAA 1 #define MRW_MODE_PC_PRE1 0x2c #define MRW_MODE_PC 0x03 struct mrw_feature_desc { __u16 feature_code; #ifdef __BIG_ENDIAN_BITFIELD __u8 reserved1 : 2; __u8 feature_version : 4; __u8 persistent : 1; __u8 curr : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 curr : 1; __u8 persistent : 1; __u8 feature_version : 4; __u8 reserved1 : 2; #endif __u8 add_len; #ifdef __BIG_ENDIAN_BITFIELD __u8 reserved2 : 7; __u8 write : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 write : 1; __u8 reserved2 : 7; #endif __u8 reserved3; __u8 reserved4; __u8 reserved5; }; struct rwrt_feature_desc { __u16 feature_code; #ifdef __BIG_ENDIAN_BITFIELD __u8 reserved1 : 2; __u8 feature_version : 4; __u8 persistent : 1; __u8 curr : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 curr : 1; __u8 persistent : 1; __u8 feature_version : 4; __u8 reserved1 : 2; #endif __u8 add_len; __u32 last_lba; __u32 block_size; __u16 blocking; #ifdef __BIG_ENDIAN_BITFIELD __u8 reserved2 : 7; __u8 page_present : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 page_present : 1; __u8 reserved2 : 7; #endif __u8 reserved3; }; typedef struct { __u16 disc_information_length; #ifdef __BIG_ENDIAN_BITFIELD __u8 reserved1 : 3; __u8 erasable : 1; __u8 border_status : 2; __u8 disc_status : 2; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 disc_status : 2; __u8 border_status : 2; __u8 erasable : 1; __u8 reserved1 : 3; #else #error "Please fix " #endif __u8 n_first_track; __u8 n_sessions_lsb; __u8 first_track_lsb; __u8 last_track_lsb; #ifdef __BIG_ENDIAN_BITFIELD __u8 did_v : 1; __u8 dbc_v : 1; __u8 uru : 1; __u8 reserved2 : 2; __u8 dbit : 1; __u8 mrw_status : 2; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 mrw_status : 2; __u8 dbit : 1; __u8 reserved2 : 2; __u8 uru : 1; __u8 dbc_v : 1; __u8 did_v : 1; #endif __u8 disc_type; __u8 n_sessions_msb; __u8 first_track_msb; __u8 last_track_msb; __u32 disc_id; __u32 lead_in; __u32 lead_out; __u8 disc_bar_code[8]; __u8 reserved3; __u8 n_opc; } disc_information; typedef struct { __u16 track_information_length; __u8 track_lsb; __u8 session_lsb; __u8 reserved1; #ifdef __BIG_ENDIAN_BITFIELD __u8 reserved2 : 2; __u8 damage : 1; __u8 copy : 1; __u8 track_mode : 4; __u8 rt : 1; __u8 blank : 1; __u8 packet : 1; __u8 fp : 1; __u8 data_mode : 4; __u8 reserved3 : 6; __u8 lra_v : 1; __u8 nwa_v : 1; #elif defined(__LITTLE_ENDIAN_BITFIELD) __u8 track_mode : 4; __u8 copy : 1; __u8 damage : 1; __u8 reserved2 : 2; __u8 data_mode : 4; __u8 fp : 1; __u8 packet : 1; __u8 blank : 1; __u8 rt : 1; __u8 nwa_v : 1; __u8 lra_v : 1; __u8 reserved3 : 6; #endif __u32 track_start; __u32 next_writable; __u32 free_blocks; __u32 fixed_packet_size; __u32 track_size; __u32 last_rec_address; } track_information; struct feature_header { __u32 data_len; __u8 reserved1; __u8 reserved2; __u16 curr_profile; }; struct mode_page_header { __u16 mode_data_length; __u8 medium_type; __u8 reserved1; __u8 reserved2; __u8 reserved3; __u16 desc_length; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/proc_fs.h0000644000015700001700000000406412200324306024264 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_PROC_FS_H #define _LINUX_PROC_FS_H #include #include #include #include #define FIRST_PROCESS_ENTRY 256 enum { PROC_ROOT_INO = 1, }; #define PROC_SUPER_MAGIC 0x9fa0 typedef int (read_proc_t)(char *page, char **start, off_t off, int count, int *eof, void *data); typedef int (write_proc_t)(struct file *file, const char __user *buffer, unsigned long count, void *data); typedef int (get_info_t)(char *, char **, off_t, int); struct proc_dir_entry { unsigned int low_ino; unsigned short namelen; const char *name; mode_t mode; nlink_t nlink; uid_t uid; gid_t gid; loff_t size; struct inode_operations * proc_iops; const struct file_operations * proc_fops; get_info_t *get_info; struct module *owner; struct proc_dir_entry *next, *parent, *subdir; void *data; read_proc_t *read_proc; write_proc_t *write_proc; atomic_t count; int deleted; void *set; }; struct kcore_list { struct kcore_list *next; unsigned long addr; size_t size; }; struct vmcore { struct list_head list; unsigned long long paddr; unsigned long long size; loff_t offset; }; #define proc_root_driver NULL #define proc_net NULL #define proc_bus NULL #define proc_net_fops_create(name, mode, fops) ({ (void)(mode), NULL; }) #define proc_net_create(name, mode, info) ({ (void)(mode), NULL; }) #define remove_proc_entry(name, parent) do {} while (0) #endif android-audiosystem-1.8+13.10.20130807/include/linux/node.h0000644000015700001700000000157612200324306023563 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_NODE_H_ #define _LINUX_NODE_H_ #include #include struct node { struct sys_device sysdev; }; #define to_node(sys_device) container_of(sys_device, struct node, sysdev) #endif android-audiosystem-1.8+13.10.20130807/include/linux/ipmi_smi.h0000644000015700001700000000413412200324306024435 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_IPMI_SMI_H #define __LINUX_IPMI_SMI_H #include #include #include #include #include #include typedef struct ipmi_smi *ipmi_smi_t; struct ipmi_smi_msg { struct list_head link; long msgid; void *user_data; int data_size; unsigned char data[IPMI_MAX_MSG_LENGTH]; int rsp_size; unsigned char rsp[IPMI_MAX_MSG_LENGTH]; void (*done)(struct ipmi_smi_msg *msg); }; struct ipmi_smi_handlers { struct module *owner; int (*start_processing)(void *send_info, ipmi_smi_t new_intf); void (*sender)(void *send_info, struct ipmi_smi_msg *msg, int priority); void (*request_events)(void *send_info); void (*set_run_to_completion)(void *send_info, int run_to_completion); void (*poll)(void *send_info); int (*inc_usecount)(void *send_info); void (*dec_usecount)(void *send_info); }; struct ipmi_device_id { unsigned char device_id; unsigned char device_revision; unsigned char firmware_revision_1; unsigned char firmware_revision_2; unsigned char ipmi_version; unsigned char additional_device_support; unsigned int manufacturer_id; unsigned int product_id; unsigned char aux_firmware_revision[4]; unsigned int aux_firmware_revision_set : 1; }; #define ipmi_version_major(v) ((v)->ipmi_version & 0xf) #define ipmi_version_minor(v) ((v)->ipmi_version >> 4) struct ipmi_smi_msg *ipmi_alloc_smi_msg(void); #endif android-audiosystem-1.8+13.10.20130807/include/linux/cdev.h0000644000015700001700000000131612200324306023547 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_CDEV_H #define _LINUX_CDEV_H #endif android-audiosystem-1.8+13.10.20130807/include/linux/bmp085.h0000644000015700001700000000214412200324306023641 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __BMP085_H__ #define __BMP085_H__ #include #define BMP085_NAME "bmp085" #define BMP085_IOCTL_BASE 78 #define BMP085_IOCTL_SET_DELAY _IOW(BMP085_IOCTL_BASE, 0, int) #define BMP085_IOCTL_GET_DELAY _IOR(BMP085_IOCTL_BASE, 1, int) #define BMP085_IOCTL_SET_ENABLE _IOW(BMP085_IOCTL_BASE, 2, int) #define BMP085_IOCTL_GET_ENABLE _IOR(BMP085_IOCTL_BASE, 3, int) #define BMP085_IOCTL_ACCURACY _IOW(BMP085_IOCTL_BASE, 4, int) #endif android-audiosystem-1.8+13.10.20130807/include/linux/pkt_sched.h0000644000015700001700000001532112200324306024573 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_PKT_SCHED_H #define __LINUX_PKT_SCHED_H #include #define TC_PRIO_BESTEFFORT 0 #define TC_PRIO_FILLER 1 #define TC_PRIO_BULK 2 #define TC_PRIO_INTERACTIVE_BULK 4 #define TC_PRIO_INTERACTIVE 6 #define TC_PRIO_CONTROL 7 #define TC_PRIO_MAX 15 struct tc_stats { __u64 bytes; __u32 packets; __u32 drops; __u32 overlimits; __u32 bps; __u32 pps; __u32 qlen; __u32 backlog; }; struct tc_estimator { signed char interval; unsigned char ewma_log; }; #define TC_H_MAJ_MASK (0xFFFF0000U) #define TC_H_MIN_MASK (0x0000FFFFU) #define TC_H_MAJ(h) ((h)&TC_H_MAJ_MASK) #define TC_H_MIN(h) ((h)&TC_H_MIN_MASK) #define TC_H_MAKE(maj,min) (((maj)&TC_H_MAJ_MASK)|((min)&TC_H_MIN_MASK)) #define TC_H_UNSPEC (0U) #define TC_H_ROOT (0xFFFFFFFFU) #define TC_H_INGRESS (0xFFFFFFF1U) struct tc_ratespec { unsigned char cell_log; unsigned char __reserved; unsigned short overhead; short cell_align; unsigned short mpu; __u32 rate; }; #define TC_RTAB_SIZE 1024 struct tc_sizespec { unsigned char cell_log; unsigned char size_log; short cell_align; int overhead; unsigned int linklayer; unsigned int mpu; unsigned int mtu; unsigned int tsize; }; enum { TCA_STAB_UNSPEC, TCA_STAB_BASE, TCA_STAB_DATA, __TCA_STAB_MAX }; #define TCA_STAB_MAX (__TCA_STAB_MAX - 1) struct tc_fifo_qopt { __u32 limit; }; #define TCQ_PRIO_BANDS 16 #define TCQ_MIN_PRIO_BANDS 2 struct tc_prio_qopt { int bands; __u8 priomap[TC_PRIO_MAX+1]; }; struct tc_multiq_qopt { __u16 bands; __u16 max_bands; }; struct tc_tbf_qopt { struct tc_ratespec rate; struct tc_ratespec peakrate; __u32 limit; __u32 buffer; __u32 mtu; }; enum { TCA_TBF_UNSPEC, TCA_TBF_PARMS, TCA_TBF_RTAB, TCA_TBF_PTAB, __TCA_TBF_MAX, }; #define TCA_TBF_MAX (__TCA_TBF_MAX - 1) struct tc_sfq_qopt { unsigned quantum; int perturb_period; __u32 limit; unsigned divisor; unsigned flows; }; struct tc_sfq_xstats { __s32 allot; }; enum { TCA_RED_UNSPEC, TCA_RED_PARMS, TCA_RED_STAB, __TCA_RED_MAX, }; #define TCA_RED_MAX (__TCA_RED_MAX - 1) struct tc_red_qopt { __u32 limit; __u32 qth_min; __u32 qth_max; unsigned char Wlog; unsigned char Plog; unsigned char Scell_log; unsigned char flags; #define TC_RED_ECN 1 #define TC_RED_HARDDROP 2 }; struct tc_red_xstats { __u32 early; __u32 pdrop; __u32 other; __u32 marked; }; #define MAX_DPs 16 enum { TCA_GRED_UNSPEC, TCA_GRED_PARMS, TCA_GRED_STAB, TCA_GRED_DPS, __TCA_GRED_MAX, }; #define TCA_GRED_MAX (__TCA_GRED_MAX - 1) struct tc_gred_qopt { __u32 limit; __u32 qth_min; __u32 qth_max; __u32 DP; __u32 backlog; __u32 qave; __u32 forced; __u32 early; __u32 other; __u32 pdrop; __u8 Wlog; __u8 Plog; __u8 Scell_log; __u8 prio; __u32 packets; __u32 bytesin; }; struct tc_gred_sopt { __u32 DPs; __u32 def_DP; __u8 grio; __u8 flags; __u16 pad1; }; #define TC_HTB_NUMPRIO 8 #define TC_HTB_MAXDEPTH 8 #define TC_HTB_PROTOVER 3 struct tc_htb_opt { struct tc_ratespec rate; struct tc_ratespec ceil; __u32 buffer; __u32 cbuffer; __u32 quantum; __u32 level; __u32 prio; }; struct tc_htb_glob { __u32 version; __u32 rate2quantum; __u32 defcls; __u32 debug; __u32 direct_pkts; }; enum { TCA_HTB_UNSPEC, TCA_HTB_PARMS, TCA_HTB_INIT, TCA_HTB_CTAB, TCA_HTB_RTAB, __TCA_HTB_MAX, }; #define TCA_HTB_MAX (__TCA_HTB_MAX - 1) struct tc_htb_xstats { __u32 lends; __u32 borrows; __u32 giants; __u32 tokens; __u32 ctokens; }; struct tc_hfsc_qopt { __u16 defcls; }; struct tc_service_curve { __u32 m1; __u32 d; __u32 m2; }; struct tc_hfsc_stats { __u64 work; __u64 rtwork; __u32 period; __u32 level; }; enum { TCA_HFSC_UNSPEC, TCA_HFSC_RSC, TCA_HFSC_FSC, TCA_HFSC_USC, __TCA_HFSC_MAX, }; #define TCA_HFSC_MAX (__TCA_HFSC_MAX - 1) #define TC_CBQ_MAXPRIO 8 #define TC_CBQ_MAXLEVEL 8 #define TC_CBQ_DEF_EWMA 5 struct tc_cbq_lssopt { unsigned char change; unsigned char flags; #define TCF_CBQ_LSS_BOUNDED 1 #define TCF_CBQ_LSS_ISOLATED 2 unsigned char ewma_log; unsigned char level; #define TCF_CBQ_LSS_FLAGS 1 #define TCF_CBQ_LSS_EWMA 2 #define TCF_CBQ_LSS_MAXIDLE 4 #define TCF_CBQ_LSS_MINIDLE 8 #define TCF_CBQ_LSS_OFFTIME 0x10 #define TCF_CBQ_LSS_AVPKT 0x20 __u32 maxidle; __u32 minidle; __u32 offtime; __u32 avpkt; }; struct tc_cbq_wrropt { unsigned char flags; unsigned char priority; unsigned char cpriority; unsigned char __reserved; __u32 allot; __u32 weight; }; struct tc_cbq_ovl { unsigned char strategy; #define TC_CBQ_OVL_CLASSIC 0 #define TC_CBQ_OVL_DELAY 1 #define TC_CBQ_OVL_LOWPRIO 2 #define TC_CBQ_OVL_DROP 3 #define TC_CBQ_OVL_RCLASSIC 4 unsigned char priority2; __u16 pad; __u32 penalty; }; struct tc_cbq_police { unsigned char police; unsigned char __res1; unsigned short __res2; }; struct tc_cbq_fopt { __u32 split; __u32 defmap; __u32 defchange; }; struct tc_cbq_xstats { __u32 borrows; __u32 overactions; __s32 avgidle; __s32 undertime; }; enum { TCA_CBQ_UNSPEC, TCA_CBQ_LSSOPT, TCA_CBQ_WRROPT, TCA_CBQ_FOPT, TCA_CBQ_OVL_STRATEGY, TCA_CBQ_RATE, TCA_CBQ_RTAB, TCA_CBQ_POLICE, __TCA_CBQ_MAX, }; #define TCA_CBQ_MAX (__TCA_CBQ_MAX - 1) enum { TCA_DSMARK_UNSPEC, TCA_DSMARK_INDICES, TCA_DSMARK_DEFAULT_INDEX, TCA_DSMARK_SET_TC_INDEX, TCA_DSMARK_MASK, TCA_DSMARK_VALUE, __TCA_DSMARK_MAX, }; #define TCA_DSMARK_MAX (__TCA_DSMARK_MAX - 1) enum { TCA_ATM_UNSPEC, TCA_ATM_FD, TCA_ATM_PTR, TCA_ATM_HDR, TCA_ATM_EXCESS, TCA_ATM_ADDR, TCA_ATM_STATE, __TCA_ATM_MAX, }; #define TCA_ATM_MAX (__TCA_ATM_MAX - 1) enum { TCA_NETEM_UNSPEC, TCA_NETEM_CORR, TCA_NETEM_DELAY_DIST, TCA_NETEM_REORDER, TCA_NETEM_CORRUPT, __TCA_NETEM_MAX, }; #define TCA_NETEM_MAX (__TCA_NETEM_MAX - 1) struct tc_netem_qopt { __u32 latency; __u32 limit; __u32 loss; __u32 gap; __u32 duplicate; __u32 jitter; }; struct tc_netem_corr { __u32 delay_corr; __u32 loss_corr; __u32 dup_corr; }; struct tc_netem_reorder { __u32 probability; __u32 correlation; }; struct tc_netem_corrupt { __u32 probability; __u32 correlation; }; #define NETEM_DIST_SCALE 8192 enum { TCA_DRR_UNSPEC, TCA_DRR_QUANTUM, __TCA_DRR_MAX }; #define TCA_DRR_MAX (__TCA_DRR_MAX - 1) struct tc_drr_stats { __u32 deficit; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/fcntl.h0000644000015700001700000000231112200324306023730 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_FCNTL_H #define _LINUX_FCNTL_H #include #define F_SETLEASE (F_LINUX_SPECIFIC_BASE+0) #define F_GETLEASE (F_LINUX_SPECIFIC_BASE+1) #define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2) #define DN_ACCESS 0x00000001 #define DN_MODIFY 0x00000002 #define DN_CREATE 0x00000004 #define DN_DELETE 0x00000008 #define DN_RENAME 0x00000010 #define DN_ATTRIB 0x00000020 #define DN_MULTISHOT 0x80000000 #define AT_FDCWD -100 #define AT_SYMLINK_NOFOLLOW 0x100 #define AT_REMOVEDIR 0x200 #define AT_SYMLINK_FOLLOW 0x400 #endif android-audiosystem-1.8+13.10.20130807/include/linux/ioport.h0000644000015700001700000000633112200324306024144 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IOPORT_H #define _LINUX_IOPORT_H #include #include struct resource { resource_size_t start; resource_size_t end; const char *name; unsigned long flags; struct resource *parent, *sibling, *child; }; struct resource_list { struct resource_list *next; struct resource *res; struct pci_dev *dev; }; #define IORESOURCE_BITS 0x000000ff #define IORESOURCE_IO 0x00000100 #define IORESOURCE_MEM 0x00000200 #define IORESOURCE_IRQ 0x00000400 #define IORESOURCE_DMA 0x00000800 #define IORESOURCE_PREFETCH 0x00001000 #define IORESOURCE_READONLY 0x00002000 #define IORESOURCE_CACHEABLE 0x00004000 #define IORESOURCE_RANGELENGTH 0x00008000 #define IORESOURCE_SHADOWABLE 0x00010000 #define IORESOURCE_BUS_HAS_VGA 0x00080000 #define IORESOURCE_DISABLED 0x10000000 #define IORESOURCE_UNSET 0x20000000 #define IORESOURCE_AUTO 0x40000000 #define IORESOURCE_BUSY 0x80000000 #define IORESOURCE_IRQ_HIGHEDGE (1<<0) #define IORESOURCE_IRQ_LOWEDGE (1<<1) #define IORESOURCE_IRQ_HIGHLEVEL (1<<2) #define IORESOURCE_IRQ_LOWLEVEL (1<<3) #define IORESOURCE_IRQ_SHAREABLE (1<<4) #define IORESOURCE_DMA_TYPE_MASK (3<<0) #define IORESOURCE_DMA_8BIT (0<<0) #define IORESOURCE_DMA_8AND16BIT (1<<0) #define IORESOURCE_DMA_16BIT (2<<0) #define IORESOURCE_DMA_MASTER (1<<2) #define IORESOURCE_DMA_BYTE (1<<3) #define IORESOURCE_DMA_WORD (1<<4) #define IORESOURCE_DMA_SPEED_MASK (3<<6) #define IORESOURCE_DMA_COMPATIBLE (0<<6) #define IORESOURCE_DMA_TYPEA (1<<6) #define IORESOURCE_DMA_TYPEB (2<<6) #define IORESOURCE_DMA_TYPEF (3<<6) #define IORESOURCE_MEM_WRITEABLE (1<<0) #define IORESOURCE_MEM_CACHEABLE (1<<1) #define IORESOURCE_MEM_RANGELENGTH (1<<2) #define IORESOURCE_MEM_TYPE_MASK (3<<3) #define IORESOURCE_MEM_8BIT (0<<3) #define IORESOURCE_MEM_16BIT (1<<3) #define IORESOURCE_MEM_8AND16BIT (2<<3) #define IORESOURCE_MEM_32BIT (3<<3) #define IORESOURCE_MEM_SHADOWABLE (1<<5) #define IORESOURCE_MEM_EXPANSIONROM (1<<6) #define IORESOURCE_ROM_ENABLE (1<<0) #define IORESOURCE_ROM_SHADOW (1<<1) #define IORESOURCE_ROM_COPY (1<<2) #define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) #define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name)) #define rename_region(region, newname) do { (region)->name = (newname); } while (0) #define release_region(start,n) __release_region(&ioport_resource, (start), (n)) #define check_mem_region(start,n) __check_region(&iomem_resource, (start), (n)) #define release_mem_region(start,n) __release_region(&iomem_resource, (start), (n)) #endif android-audiosystem-1.8+13.10.20130807/include/linux/miscdevice.h0000644000015700001700000000325312200324306024743 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_MISCDEVICE_H #define _LINUX_MISCDEVICE_H #include #include #define PSMOUSE_MINOR 1 #define MS_BUSMOUSE_MINOR 2 #define ATIXL_BUSMOUSE_MINOR 3 #define ATARIMOUSE_MINOR 5 #define SUN_MOUSE_MINOR 6 #define APOLLO_MOUSE_MINOR 7 #define PC110PAD_MINOR 9 #define WATCHDOG_MINOR 130 #define TEMP_MINOR 131 #define RTC_MINOR 135 #define EFI_RTC_MINOR 136 #define SUN_OPENPROM_MINOR 139 #define DMAPI_MINOR 140 #define NVRAM_MINOR 144 #define SGI_MMTIMER 153 #define STORE_QUEUE_MINOR 155 #define I2O_MINOR 166 #define MICROCODE_MINOR 184 #define MWAVE_MINOR 219 #define MPT_MINOR 220 #define MISC_DYNAMIC_MINOR 255 #define TUN_MINOR 200 #define HPET_MINOR 228 struct device; struct class_device; struct miscdevice { int minor; const char *name; const struct file_operations *fops; struct list_head list; struct device *dev; struct class_device *class; }; #define MODULE_ALIAS_MISCDEV(minor) MODULE_ALIAS("char-major-" __stringify(MISC_MAJOR) "-" __stringify(minor)) #endif android-audiosystem-1.8+13.10.20130807/include/linux/bitops.h0000644000015700001700000000140312200324306024123 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_BITOPS_H #define _LINUX_BITOPS_H #include #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/dmaengine.h0000644000015700001700000000131312200324306024552 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef DMAENGINE_H #define DMAENGINE_H #endif android-audiosystem-1.8+13.10.20130807/include/linux/kernelcapi.h0000644000015700001700000000231712200324306024745 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __KERNELCAPI_H__ #define __KERNELCAPI_H__ #define CAPI_MAXAPPL 240 #define CAPI_MAXCONTR 32 #define CAPI_MAXDATAWINDOW 8 typedef struct kcapi_flagdef { int contr; int flag; } kcapi_flagdef; typedef struct kcapi_carddef { char driver[32]; unsigned int port; unsigned irq; unsigned int membase; int cardnr; } kcapi_carddef; #define KCAPI_CMD_TRACE 10 #define KCAPI_CMD_ADDCARD 11 #define KCAPI_TRACE_OFF 0 #define KCAPI_TRACE_SHORT_NO_DATA 1 #define KCAPI_TRACE_FULL_NO_DATA 2 #define KCAPI_TRACE_SHORT 3 #define KCAPI_TRACE_FULL 4 #endif android-audiosystem-1.8+13.10.20130807/include/linux/taskstats.h0000644000015700001700000000331712200324306024652 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_TASKSTATS_H #define _LINUX_TASKSTATS_H #define TASKSTATS_VERSION 1 struct taskstats { __u16 version; __u16 padding[3]; __u64 cpu_count; __u64 cpu_delay_total; __u64 blkio_count; __u64 blkio_delay_total; __u64 swapin_count; __u64 swapin_delay_total; __u64 cpu_run_real_total; __u64 cpu_run_virtual_total; }; enum { TASKSTATS_CMD_UNSPEC = 0, TASKSTATS_CMD_GET, TASKSTATS_CMD_NEW, __TASKSTATS_CMD_MAX, }; #define TASKSTATS_CMD_MAX (__TASKSTATS_CMD_MAX - 1) enum { TASKSTATS_TYPE_UNSPEC = 0, TASKSTATS_TYPE_PID, TASKSTATS_TYPE_TGID, TASKSTATS_TYPE_STATS, TASKSTATS_TYPE_AGGR_PID, TASKSTATS_TYPE_AGGR_TGID, __TASKSTATS_TYPE_MAX, }; #define TASKSTATS_TYPE_MAX (__TASKSTATS_TYPE_MAX - 1) enum { TASKSTATS_CMD_ATTR_UNSPEC = 0, TASKSTATS_CMD_ATTR_PID, TASKSTATS_CMD_ATTR_TGID, TASKSTATS_CMD_ATTR_REGISTER_CPUMASK, TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK, __TASKSTATS_CMD_ATTR_MAX, }; #define TASKSTATS_CMD_ATTR_MAX (__TASKSTATS_CMD_ATTR_MAX - 1) #define TASKSTATS_GENL_NAME "TASKSTATS" #define TASKSTATS_GENL_VERSION 0x1 #endif android-audiosystem-1.8+13.10.20130807/include/linux/rtnetlink.h0000644000015700001700000002632512200324306024647 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_RTNETLINK_H #define __LINUX_RTNETLINK_H #include #include #include #include #include #define RTNL_FAMILY_IPMR 128 #define RTNL_FAMILY_IP6MR 129 #define RTNL_FAMILY_MAX 129 enum { RTM_BASE = 16, #define RTM_BASE RTM_BASE RTM_NEWLINK = 16, #define RTM_NEWLINK RTM_NEWLINK RTM_DELLINK, #define RTM_DELLINK RTM_DELLINK RTM_GETLINK, #define RTM_GETLINK RTM_GETLINK RTM_SETLINK, #define RTM_SETLINK RTM_SETLINK RTM_NEWADDR = 20, #define RTM_NEWADDR RTM_NEWADDR RTM_DELADDR, #define RTM_DELADDR RTM_DELADDR RTM_GETADDR, #define RTM_GETADDR RTM_GETADDR RTM_NEWROUTE = 24, #define RTM_NEWROUTE RTM_NEWROUTE RTM_DELROUTE, #define RTM_DELROUTE RTM_DELROUTE RTM_GETROUTE, #define RTM_GETROUTE RTM_GETROUTE RTM_NEWNEIGH = 28, #define RTM_NEWNEIGH RTM_NEWNEIGH RTM_DELNEIGH, #define RTM_DELNEIGH RTM_DELNEIGH RTM_GETNEIGH, #define RTM_GETNEIGH RTM_GETNEIGH RTM_NEWRULE = 32, #define RTM_NEWRULE RTM_NEWRULE RTM_DELRULE, #define RTM_DELRULE RTM_DELRULE RTM_GETRULE, #define RTM_GETRULE RTM_GETRULE RTM_NEWQDISC = 36, #define RTM_NEWQDISC RTM_NEWQDISC RTM_DELQDISC, #define RTM_DELQDISC RTM_DELQDISC RTM_GETQDISC, #define RTM_GETQDISC RTM_GETQDISC RTM_NEWTCLASS = 40, #define RTM_NEWTCLASS RTM_NEWTCLASS RTM_DELTCLASS, #define RTM_DELTCLASS RTM_DELTCLASS RTM_GETTCLASS, #define RTM_GETTCLASS RTM_GETTCLASS RTM_NEWTFILTER = 44, #define RTM_NEWTFILTER RTM_NEWTFILTER RTM_DELTFILTER, #define RTM_DELTFILTER RTM_DELTFILTER RTM_GETTFILTER, #define RTM_GETTFILTER RTM_GETTFILTER RTM_NEWACTION = 48, #define RTM_NEWACTION RTM_NEWACTION RTM_DELACTION, #define RTM_DELACTION RTM_DELACTION RTM_GETACTION, #define RTM_GETACTION RTM_GETACTION RTM_NEWPREFIX = 52, #define RTM_NEWPREFIX RTM_NEWPREFIX RTM_GETMULTICAST = 58, #define RTM_GETMULTICAST RTM_GETMULTICAST RTM_GETANYCAST = 62, #define RTM_GETANYCAST RTM_GETANYCAST RTM_NEWNEIGHTBL = 64, #define RTM_NEWNEIGHTBL RTM_NEWNEIGHTBL RTM_GETNEIGHTBL = 66, #define RTM_GETNEIGHTBL RTM_GETNEIGHTBL RTM_SETNEIGHTBL, #define RTM_SETNEIGHTBL RTM_SETNEIGHTBL RTM_NEWNDUSEROPT = 68, #define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT RTM_NEWADDRLABEL = 72, #define RTM_NEWADDRLABEL RTM_NEWADDRLABEL RTM_DELADDRLABEL, #define RTM_DELADDRLABEL RTM_DELADDRLABEL RTM_GETADDRLABEL, #define RTM_GETADDRLABEL RTM_GETADDRLABEL RTM_GETDCB = 78, #define RTM_GETDCB RTM_GETDCB RTM_SETDCB, #define RTM_SETDCB RTM_SETDCB __RTM_MAX, #define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) }; #define RTM_NR_MSGTYPES (RTM_MAX + 1 - RTM_BASE) #define RTM_NR_FAMILIES (RTM_NR_MSGTYPES >> 2) #define RTM_FAM(cmd) (((cmd) - RTM_BASE) >> 2) struct rtattr { unsigned short rta_len; unsigned short rta_type; }; #define RTA_ALIGNTO 4 #define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) ) #define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && (rta)->rta_len >= sizeof(struct rtattr) && (rta)->rta_len <= (len)) #define RTA_NEXT(rta,attrlen) ((attrlen) -= RTA_ALIGN((rta)->rta_len), (struct rtattr*)(((char*)(rta)) + RTA_ALIGN((rta)->rta_len))) #define RTA_LENGTH(len) (RTA_ALIGN(sizeof(struct rtattr)) + (len)) #define RTA_SPACE(len) RTA_ALIGN(RTA_LENGTH(len)) #define RTA_DATA(rta) ((void*)(((char*)(rta)) + RTA_LENGTH(0))) #define RTA_PAYLOAD(rta) ((int)((rta)->rta_len) - RTA_LENGTH(0)) struct rtmsg { unsigned char rtm_family; unsigned char rtm_dst_len; unsigned char rtm_src_len; unsigned char rtm_tos; unsigned char rtm_table; unsigned char rtm_protocol; unsigned char rtm_scope; unsigned char rtm_type; unsigned rtm_flags; }; enum { RTN_UNSPEC, RTN_UNICAST, RTN_LOCAL, RTN_BROADCAST, RTN_ANYCAST, RTN_MULTICAST, RTN_BLACKHOLE, RTN_UNREACHABLE, RTN_PROHIBIT, RTN_THROW, RTN_NAT, RTN_XRESOLVE, __RTN_MAX }; #define RTN_MAX (__RTN_MAX - 1) #define RTPROT_UNSPEC 0 #define RTPROT_REDIRECT 1 #define RTPROT_KERNEL 2 #define RTPROT_BOOT 3 #define RTPROT_STATIC 4 #define RTPROT_GATED 8 #define RTPROT_RA 9 #define RTPROT_MRT 10 #define RTPROT_ZEBRA 11 #define RTPROT_BIRD 12 #define RTPROT_DNROUTED 13 #define RTPROT_XORP 14 #define RTPROT_NTK 15 #define RTPROT_DHCP 16 enum rt_scope_t { RT_SCOPE_UNIVERSE=0, RT_SCOPE_SITE=200, RT_SCOPE_LINK=253, RT_SCOPE_HOST=254, RT_SCOPE_NOWHERE=255 }; #define RTM_F_NOTIFY 0x100 #define RTM_F_CLONED 0x200 #define RTM_F_EQUALIZE 0x400 #define RTM_F_PREFIX 0x800 enum rt_class_t { RT_TABLE_UNSPEC=0, RT_TABLE_COMPAT=252, RT_TABLE_DEFAULT=253, RT_TABLE_MAIN=254, RT_TABLE_LOCAL=255, RT_TABLE_MAX=0xFFFFFFFF }; enum rtattr_type_t { RTA_UNSPEC, RTA_DST, RTA_SRC, RTA_IIF, RTA_OIF, RTA_GATEWAY, RTA_PRIORITY, RTA_PREFSRC, RTA_METRICS, RTA_MULTIPATH, RTA_PROTOINFO, RTA_FLOW, RTA_CACHEINFO, RTA_SESSION, RTA_MP_ALGO, RTA_TABLE, RTA_MARK, __RTA_MAX }; #define RTA_MAX (__RTA_MAX - 1) #define RTM_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg)))) #define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg)) struct rtnexthop { unsigned short rtnh_len; unsigned char rtnh_flags; unsigned char rtnh_hops; int rtnh_ifindex; }; #define RTNH_F_DEAD 1 #define RTNH_F_PERVASIVE 2 #define RTNH_F_ONLINK 4 #define RTNH_ALIGNTO 4 #define RTNH_ALIGN(len) ( ((len)+RTNH_ALIGNTO-1) & ~(RTNH_ALIGNTO-1) ) #define RTNH_OK(rtnh,len) ((rtnh)->rtnh_len >= sizeof(struct rtnexthop) && ((int)(rtnh)->rtnh_len) <= (len)) #define RTNH_NEXT(rtnh) ((struct rtnexthop*)(((char*)(rtnh)) + RTNH_ALIGN((rtnh)->rtnh_len))) #define RTNH_LENGTH(len) (RTNH_ALIGN(sizeof(struct rtnexthop)) + (len)) #define RTNH_SPACE(len) RTNH_ALIGN(RTNH_LENGTH(len)) #define RTNH_DATA(rtnh) ((struct rtattr*)(((char*)(rtnh)) + RTNH_LENGTH(0))) struct rta_cacheinfo { __u32 rta_clntref; __u32 rta_lastuse; __s32 rta_expires; __u32 rta_error; __u32 rta_used; #define RTNETLINK_HAVE_PEERINFO 1 __u32 rta_id; __u32 rta_ts; __u32 rta_tsage; }; enum { RTAX_UNSPEC, #define RTAX_UNSPEC RTAX_UNSPEC RTAX_LOCK, #define RTAX_LOCK RTAX_LOCK RTAX_MTU, #define RTAX_MTU RTAX_MTU RTAX_WINDOW, #define RTAX_WINDOW RTAX_WINDOW RTAX_RTT, #define RTAX_RTT RTAX_RTT RTAX_RTTVAR, #define RTAX_RTTVAR RTAX_RTTVAR RTAX_SSTHRESH, #define RTAX_SSTHRESH RTAX_SSTHRESH RTAX_CWND, #define RTAX_CWND RTAX_CWND RTAX_ADVMSS, #define RTAX_ADVMSS RTAX_ADVMSS RTAX_REORDERING, #define RTAX_REORDERING RTAX_REORDERING RTAX_HOPLIMIT, #define RTAX_HOPLIMIT RTAX_HOPLIMIT RTAX_INITCWND, #define RTAX_INITCWND RTAX_INITCWND RTAX_FEATURES, #define RTAX_FEATURES RTAX_FEATURES RTAX_RTO_MIN, #define RTAX_RTO_MIN RTAX_RTO_MIN RTAX_INITRWND, #define RTAX_INITRWND RTAX_INITRWND __RTAX_MAX }; #define RTAX_MAX (__RTAX_MAX - 1) #define RTAX_FEATURE_ECN 0x00000001 #define RTAX_FEATURE_SACK 0x00000002 #define RTAX_FEATURE_TIMESTAMP 0x00000004 #define RTAX_FEATURE_ALLFRAG 0x00000008 struct rta_session { __u8 proto; __u8 pad1; __u16 pad2; union { struct { __u16 sport; __u16 dport; } ports; struct { __u8 type; __u8 code; __u16 ident; } icmpt; __u32 spi; } u; }; struct rtgenmsg { unsigned char rtgen_family; }; struct ifinfomsg { unsigned char ifi_family; unsigned char __ifi_pad; unsigned short ifi_type; int ifi_index; unsigned ifi_flags; unsigned ifi_change; }; struct prefixmsg { unsigned char prefix_family; unsigned char prefix_pad1; unsigned short prefix_pad2; int prefix_ifindex; unsigned char prefix_type; unsigned char prefix_len; unsigned char prefix_flags; unsigned char prefix_pad3; }; enum { PREFIX_UNSPEC, PREFIX_ADDRESS, PREFIX_CACHEINFO, __PREFIX_MAX }; #define PREFIX_MAX (__PREFIX_MAX - 1) struct prefix_cacheinfo { __u32 preferred_time; __u32 valid_time; }; struct tcmsg { unsigned char tcm_family; unsigned char tcm__pad1; unsigned short tcm__pad2; int tcm_ifindex; __u32 tcm_handle; __u32 tcm_parent; __u32 tcm_info; }; enum { TCA_UNSPEC, TCA_KIND, TCA_OPTIONS, TCA_STATS, TCA_XSTATS, TCA_RATE, TCA_FCNT, TCA_STATS2, TCA_STAB, __TCA_MAX }; #define TCA_MAX (__TCA_MAX - 1) #define TCA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg)))) #define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg)) struct nduseroptmsg { unsigned char nduseropt_family; unsigned char nduseropt_pad1; unsigned short nduseropt_opts_len; int nduseropt_ifindex; __u8 nduseropt_icmp_type; __u8 nduseropt_icmp_code; unsigned short nduseropt_pad2; unsigned int nduseropt_pad3; }; enum { NDUSEROPT_UNSPEC, NDUSEROPT_SRCADDR, __NDUSEROPT_MAX }; #define NDUSEROPT_MAX (__NDUSEROPT_MAX - 1) #define RTMGRP_LINK 1 #define RTMGRP_NOTIFY 2 #define RTMGRP_NEIGH 4 #define RTMGRP_TC 8 #define RTMGRP_IPV4_IFADDR 0x10 #define RTMGRP_IPV4_MROUTE 0x20 #define RTMGRP_IPV4_ROUTE 0x40 #define RTMGRP_IPV4_RULE 0x80 #define RTMGRP_IPV6_IFADDR 0x100 #define RTMGRP_IPV6_MROUTE 0x200 #define RTMGRP_IPV6_ROUTE 0x400 #define RTMGRP_IPV6_IFINFO 0x800 #define RTMGRP_DECnet_IFADDR 0x1000 #define RTMGRP_DECnet_ROUTE 0x4000 #define RTMGRP_IPV6_PREFIX 0x20000 enum rtnetlink_groups { RTNLGRP_NONE, #define RTNLGRP_NONE RTNLGRP_NONE RTNLGRP_LINK, #define RTNLGRP_LINK RTNLGRP_LINK RTNLGRP_NOTIFY, #define RTNLGRP_NOTIFY RTNLGRP_NOTIFY RTNLGRP_NEIGH, #define RTNLGRP_NEIGH RTNLGRP_NEIGH RTNLGRP_TC, #define RTNLGRP_TC RTNLGRP_TC RTNLGRP_IPV4_IFADDR, #define RTNLGRP_IPV4_IFADDR RTNLGRP_IPV4_IFADDR RTNLGRP_IPV4_MROUTE, #define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_ROUTE, #define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_RULE, #define RTNLGRP_IPV4_RULE RTNLGRP_IPV4_RULE RTNLGRP_IPV6_IFADDR, #define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_MROUTE, #define RTNLGRP_IPV6_MROUTE RTNLGRP_IPV6_MROUTE RTNLGRP_IPV6_ROUTE, #define RTNLGRP_IPV6_ROUTE RTNLGRP_IPV6_ROUTE RTNLGRP_IPV6_IFINFO, #define RTNLGRP_IPV6_IFINFO RTNLGRP_IPV6_IFINFO RTNLGRP_DECnet_IFADDR, #define RTNLGRP_DECnet_IFADDR RTNLGRP_DECnet_IFADDR RTNLGRP_NOP2, RTNLGRP_DECnet_ROUTE, #define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_RULE, #define RTNLGRP_DECnet_RULE RTNLGRP_DECnet_RULE RTNLGRP_NOP4, RTNLGRP_IPV6_PREFIX, #define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_RULE, #define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE RTNLGRP_ND_USEROPT, #define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT RTNLGRP_PHONET_IFADDR, #define RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_ROUTE, #define RTNLGRP_PHONET_ROUTE RTNLGRP_PHONET_ROUTE __RTNLGRP_MAX }; #define RTNLGRP_MAX (__RTNLGRP_MAX - 1) struct tcamsg { unsigned char tca_family; unsigned char tca__pad1; unsigned short tca__pad2; }; #define TA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcamsg)))) #define TA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcamsg)) #define TCA_ACT_TAB 1 #define TCAA_MAX 1 #endif android-audiosystem-1.8+13.10.20130807/include/linux/hdlc/0000755000015700001700000000000012200324404023365 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/linux/hdlc/ioctl.h0000644000015700001700000000265712200324306024663 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __HDLC_IOCTL_H__ #define __HDLC_IOCTL_H__ typedef struct { unsigned int clock_rate; unsigned int clock_type; unsigned short loopback; } sync_serial_settings; typedef struct { unsigned int clock_rate; unsigned int clock_type; unsigned short loopback; unsigned int slot_map; } te1_settings; typedef struct { unsigned short encoding; unsigned short parity; } raw_hdlc_proto; typedef struct { unsigned int t391; unsigned int t392; unsigned int n391; unsigned int n392; unsigned int n393; unsigned short lmi; unsigned short dce; } fr_proto; typedef struct { unsigned int dlci; } fr_proto_pvc; typedef struct { unsigned int dlci; char master[IFNAMSIZ]; }fr_proto_pvc_info; typedef struct { unsigned int interval; unsigned int timeout; } cisco_proto; #endif android-audiosystem-1.8+13.10.20130807/include/linux/init.h0000644000015700001700000001077512200324306023602 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_INIT_H #define _LINUX_INIT_H #include #define __init __attribute__ ((__section__ (".init.text"))) #define __initdata __attribute__ ((__section__ (".init.data"))) #define __exitdata __attribute__ ((__section__(".exit.data"))) #define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit"))) #ifdef MODULE #define __exit __attribute__ ((__section__(".exit.text"))) #else #define __exit __attribute_used__ __attribute__ ((__section__(".exit.text"))) #endif #define __INIT .section ".init.text","ax" #define __FINIT .previous #define __INITDATA .section ".init.data","aw" #ifndef __ASSEMBLY__ typedef int (*initcall_t)(void); typedef void (*exitcall_t)(void); #endif #ifndef MODULE #ifndef __ASSEMBLY__ #define __define_initcall(level,fn) static initcall_t __initcall_##fn __attribute_used__ __attribute__((__section__(".initcall" level ".init"))) = fn #define core_initcall(fn) __define_initcall("1",fn) #define postcore_initcall(fn) __define_initcall("2",fn) #define arch_initcall(fn) __define_initcall("3",fn) #define subsys_initcall(fn) __define_initcall("4",fn) #define fs_initcall(fn) __define_initcall("5",fn) #define device_initcall(fn) __define_initcall("6",fn) #define late_initcall(fn) __define_initcall("7",fn) #define __initcall(fn) device_initcall(fn) #define __exitcall(fn) static exitcall_t __exitcall_##fn __exit_call = fn #define console_initcall(fn) static initcall_t __initcall_##fn __attribute_used__ __attribute__((__section__(".con_initcall.init")))=fn #define security_initcall(fn) static initcall_t __initcall_##fn __attribute_used__ __attribute__((__section__(".security_initcall.init"))) = fn struct obs_kernel_param { const char *str; int (*setup_func)(char *); int early; }; #define __setup_param(str, unique_id, fn, early) static char __setup_str_##unique_id[] __initdata = str; static struct obs_kernel_param __setup_##unique_id __attribute_used__ __attribute__((__section__(".init.setup"))) __attribute__((aligned((sizeof(long))))) = { __setup_str_##unique_id, fn, early } #define __setup_null_param(str, unique_id) __setup_param(str, unique_id, NULL, 0) #define __setup(str, fn) __setup_param(str, fn, fn, 0) #define __obsolete_setup(str) __setup_null_param(str, __LINE__) #define early_param(str, fn) __setup_param(str, fn, fn, 1) #endif #define module_init(x) __initcall(x); #define module_exit(x) __exitcall(x); #else #define core_initcall(fn) module_init(fn) #define postcore_initcall(fn) module_init(fn) #define arch_initcall(fn) module_init(fn) #define subsys_initcall(fn) module_init(fn) #define fs_initcall(fn) module_init(fn) #define device_initcall(fn) module_init(fn) #define late_initcall(fn) module_init(fn) #define security_initcall(fn) module_init(fn) #define module_init(initfn) static inline initcall_t __inittest(void) { return initfn; } int init_module(void) __attribute__((alias(#initfn))); #define module_exit(exitfn) static inline exitcall_t __exittest(void) { return exitfn; } void cleanup_module(void) __attribute__((alias(#exitfn))); #define __setup_param(str, unique_id, fn) #define __setup_null_param(str, unique_id) #define __setup(str, func) #define __obsolete_setup(str) #endif #define __nosavedata __attribute__ ((__section__ (".data.nosave"))) #define __init_or_module __init #define __initdata_or_module __initdata #define __devinit __init #define __devinitdata __initdata #define __devexit __exit #define __devexitdata __exitdata #define __cpuinit __init #define __cpuinitdata __initdata #define __cpuexit __exit #define __cpuexitdata __exitdata #define __meminit __init #define __meminitdata __initdata #define __memexit __exit #define __memexitdata __exitdata #ifdef MODULE #define __devexit_p(x) x #else #define __devexit_p(x) NULL #endif #ifdef MODULE #define __exit_p(x) x #else #define __exit_p(x) NULL #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/slab.h0000644000015700001700000000131712200324306023550 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SLAB_H #define _LINUX_SLAB_H #endif android-audiosystem-1.8+13.10.20130807/include/linux/hidraw.h0000644000015700001700000000244312200324306024106 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _HIDRAW_H #define _HIDRAW_H #include #include struct hidraw_report_descriptor { __u32 size; __u8 value[HID_MAX_DESCRIPTOR_SIZE]; }; struct hidraw_devinfo { __u32 bustype; __s16 vendor; __s16 product; }; #define HIDIOCGRDESCSIZE _IOR('H', 0x01, int) #define HIDIOCGRDESC _IOR('H', 0x02, struct hidraw_report_descriptor) #define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo) #define HIDIOCGRAWNAME(len) _IOC(_IOC_READ, 'H', 0x04, len) #define HIDIOCGRAWPHYS(len) _IOC(_IOC_READ, 'H', 0x05, len) #define HIDRAW_FIRST_MINOR 0 #define HIDRAW_MAX_DEVICES 64 #define HIDRAW_BUFFER_SIZE 64 #endif android-audiosystem-1.8+13.10.20130807/include/linux/msg.h0000644000015700001700000000325712200324306023422 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_MSG_H #define _LINUX_MSG_H #include #define MSG_STAT 11 #define MSG_INFO 12 #define MSG_NOERROR 010000 #define MSG_EXCEPT 020000 struct msqid_ds { struct ipc_perm msg_perm; struct msg *msg_first; struct msg *msg_last; __kernel_time_t msg_stime; __kernel_time_t msg_rtime; __kernel_time_t msg_ctime; unsigned long msg_lcbytes; unsigned long msg_lqbytes; unsigned short msg_cbytes; unsigned short msg_qnum; unsigned short msg_qbytes; __kernel_ipc_pid_t msg_lspid; __kernel_ipc_pid_t msg_lrpid; }; #include struct msgbuf { long mtype; char mtext[1]; }; struct msginfo { int msgpool; int msgmap; int msgmax; int msgmnb; int msgmni; int msgssz; int msgtql; unsigned short msgseg; }; #define MSGMNI 16 #define MSGMAX 8192 #define MSGMNB 16384 #define MSGPOOL (MSGMNI*MSGMNB/1024) #define MSGTQL MSGMNB #define MSGMAP MSGMNB #define MSGSSZ 16 #define __MSGSEG ((MSGPOOL*1024)/ MSGSSZ) #define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff) #endif android-audiosystem-1.8+13.10.20130807/include/linux/thread_info.h0000644000015700001700000000157412200324306025116 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_THREAD_INFO_H #define _LINUX_THREAD_INFO_H struct restart_block { long (*fn)(struct restart_block *); unsigned long arg0, arg1, arg2, arg3; }; #include #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/keychord.h0000644000015700001700000000155512200324306024443 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_KEYCHORD_H_ #define __LINUX_KEYCHORD_H_ #include #define KEYCHORD_VERSION 1 struct input_keychord { __u16 version; __u16 id; __u16 count; __u16 keycodes[]; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/if_link.h0000644000015700001700000001277712200324306024256 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IF_LINK_H #define _LINUX_IF_LINK_H #include #include struct rtnl_link_stats { __u32 rx_packets; __u32 tx_packets; __u32 rx_bytes; __u32 tx_bytes; __u32 rx_errors; __u32 tx_errors; __u32 rx_dropped; __u32 tx_dropped; __u32 multicast; __u32 collisions; __u32 rx_length_errors; __u32 rx_over_errors; __u32 rx_crc_errors; __u32 rx_frame_errors; __u32 rx_fifo_errors; __u32 rx_missed_errors; __u32 tx_aborted_errors; __u32 tx_carrier_errors; __u32 tx_fifo_errors; __u32 tx_heartbeat_errors; __u32 tx_window_errors; __u32 rx_compressed; __u32 tx_compressed; }; struct rtnl_link_stats64 { __u64 rx_packets; __u64 tx_packets; __u64 rx_bytes; __u64 tx_bytes; __u64 rx_errors; __u64 tx_errors; __u64 rx_dropped; __u64 tx_dropped; __u64 multicast; __u64 collisions; __u64 rx_length_errors; __u64 rx_over_errors; __u64 rx_crc_errors; __u64 rx_frame_errors; __u64 rx_fifo_errors; __u64 rx_missed_errors; __u64 tx_aborted_errors; __u64 tx_carrier_errors; __u64 tx_fifo_errors; __u64 tx_heartbeat_errors; __u64 tx_window_errors; __u64 rx_compressed; __u64 tx_compressed; }; struct rtnl_link_ifmap { __u64 mem_start; __u64 mem_end; __u64 base_addr; __u16 irq; __u8 dma; __u8 port; }; enum { IFLA_UNSPEC, IFLA_ADDRESS, IFLA_BROADCAST, IFLA_IFNAME, IFLA_MTU, IFLA_LINK, IFLA_QDISC, IFLA_STATS, IFLA_COST, #define IFLA_COST IFLA_COST IFLA_PRIORITY, #define IFLA_PRIORITY IFLA_PRIORITY IFLA_MASTER, #define IFLA_MASTER IFLA_MASTER IFLA_WIRELESS, #define IFLA_WIRELESS IFLA_WIRELESS IFLA_PROTINFO, #define IFLA_PROTINFO IFLA_PROTINFO IFLA_TXQLEN, #define IFLA_TXQLEN IFLA_TXQLEN IFLA_MAP, #define IFLA_MAP IFLA_MAP IFLA_WEIGHT, #define IFLA_WEIGHT IFLA_WEIGHT IFLA_OPERSTATE, IFLA_LINKMODE, IFLA_LINKINFO, #define IFLA_LINKINFO IFLA_LINKINFO IFLA_NET_NS_PID, IFLA_IFALIAS, IFLA_NUM_VF, IFLA_VFINFO_LIST, IFLA_STATS64, IFLA_VF_PORTS, IFLA_PORT_SELF, __IFLA_MAX }; #define IFLA_MAX (__IFLA_MAX - 1) #define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg)))) #define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg)) enum { IFLA_INET6_UNSPEC, IFLA_INET6_FLAGS, IFLA_INET6_CONF, IFLA_INET6_STATS, IFLA_INET6_MCAST, IFLA_INET6_CACHEINFO, IFLA_INET6_ICMP6STATS, __IFLA_INET6_MAX }; #define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1) struct ifla_cacheinfo { __u32 max_reasm_len; __u32 tstamp; __u32 reachable_time; __u32 retrans_time; }; enum { IFLA_INFO_UNSPEC, IFLA_INFO_KIND, IFLA_INFO_DATA, IFLA_INFO_XSTATS, __IFLA_INFO_MAX, }; #define IFLA_INFO_MAX (__IFLA_INFO_MAX - 1) enum { IFLA_VLAN_UNSPEC, IFLA_VLAN_ID, IFLA_VLAN_FLAGS, IFLA_VLAN_EGRESS_QOS, IFLA_VLAN_INGRESS_QOS, __IFLA_VLAN_MAX, }; #define IFLA_VLAN_MAX (__IFLA_VLAN_MAX - 1) struct ifla_vlan_flags { __u32 flags; __u32 mask; }; enum { IFLA_VLAN_QOS_UNSPEC, IFLA_VLAN_QOS_MAPPING, __IFLA_VLAN_QOS_MAX }; #define IFLA_VLAN_QOS_MAX (__IFLA_VLAN_QOS_MAX - 1) struct ifla_vlan_qos_mapping { __u32 from; __u32 to; }; enum { IFLA_MACVLAN_UNSPEC, IFLA_MACVLAN_MODE, __IFLA_MACVLAN_MAX, }; #define IFLA_MACVLAN_MAX (__IFLA_MACVLAN_MAX - 1) enum macvlan_mode { MACVLAN_MODE_PRIVATE = 1, MACVLAN_MODE_VEPA = 2, MACVLAN_MODE_BRIDGE = 4, }; enum { IFLA_VF_INFO_UNSPEC, IFLA_VF_INFO, __IFLA_VF_INFO_MAX, }; #define IFLA_VF_INFO_MAX (__IFLA_VF_INFO_MAX - 1) enum { IFLA_VF_UNSPEC, IFLA_VF_MAC, IFLA_VF_VLAN, IFLA_VF_TX_RATE, __IFLA_VF_MAX, }; #define IFLA_VF_MAX (__IFLA_VF_MAX - 1) struct ifla_vf_mac { __u32 vf; __u8 mac[32]; }; struct ifla_vf_vlan { __u32 vf; __u32 vlan; __u32 qos; }; struct ifla_vf_tx_rate { __u32 vf; __u32 rate; }; struct ifla_vf_info { __u32 vf; __u8 mac[32]; __u32 vlan; __u32 qos; __u32 tx_rate; }; enum { IFLA_VF_PORT_UNSPEC, IFLA_VF_PORT, __IFLA_VF_PORT_MAX, }; #define IFLA_VF_PORT_MAX (__IFLA_VF_PORT_MAX - 1) enum { IFLA_PORT_UNSPEC, IFLA_PORT_VF, IFLA_PORT_PROFILE, IFLA_PORT_VSI_TYPE, IFLA_PORT_INSTANCE_UUID, IFLA_PORT_HOST_UUID, IFLA_PORT_REQUEST, IFLA_PORT_RESPONSE, __IFLA_PORT_MAX, }; #define IFLA_PORT_MAX (__IFLA_PORT_MAX - 1) #define PORT_PROFILE_MAX 40 #define PORT_UUID_MAX 16 #define PORT_SELF_VF -1 enum { PORT_REQUEST_PREASSOCIATE = 0, PORT_REQUEST_PREASSOCIATE_RR, PORT_REQUEST_ASSOCIATE, PORT_REQUEST_DISASSOCIATE, }; enum { PORT_VDP_RESPONSE_SUCCESS = 0, PORT_VDP_RESPONSE_INVALID_FORMAT, PORT_VDP_RESPONSE_INSUFFICIENT_RESOURCES, PORT_VDP_RESPONSE_UNUSED_VTID, PORT_VDP_RESPONSE_VTID_VIOLATION, PORT_VDP_RESPONSE_VTID_VERSION_VIOALTION, PORT_VDP_RESPONSE_OUT_OF_SYNC, PORT_PROFILE_RESPONSE_SUCCESS = 0x100, PORT_PROFILE_RESPONSE_INPROGRESS, PORT_PROFILE_RESPONSE_INVALID, PORT_PROFILE_RESPONSE_BADSTATE, PORT_PROFILE_RESPONSE_INSUFFICIENT_RESOURCES, PORT_PROFILE_RESPONSE_ERROR, }; struct ifla_port_vsi { __u8 vsi_mgr_id; __u8 vsi_type_id[3]; __u8 vsi_type_version; __u8 pad[3]; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/sched.h0000644000015700001700000000266512200324306023724 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SCHED_H #define _LINUX_SCHED_H #include #define CSIGNAL 0x000000ff #define CLONE_VM 0x00000100 #define CLONE_FS 0x00000200 #define CLONE_FILES 0x00000400 #define CLONE_SIGHAND 0x00000800 #define CLONE_PTRACE 0x00002000 #define CLONE_VFORK 0x00004000 #define CLONE_PARENT 0x00008000 #define CLONE_THREAD 0x00010000 #define CLONE_NEWNS 0x00020000 #define CLONE_SYSVSEM 0x00040000 #define CLONE_SETTLS 0x00080000 #define CLONE_PARENT_SETTID 0x00100000 #define CLONE_CHILD_CLEARTID 0x00200000 #define CLONE_DETACHED 0x00400000 #define CLONE_UNTRACED 0x00800000 #define CLONE_CHILD_SETTID 0x01000000 #define CLONE_STOPPED 0x02000000 #define SCHED_NORMAL 0 #define SCHED_FIFO 1 #define SCHED_RR 2 #define SCHED_BATCH 3 #endif android-audiosystem-1.8+13.10.20130807/include/linux/elf.h0000644000015700001700000001640412200324306023400 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ELF_H #define _LINUX_ELF_H #include #include #include #include #ifndef elf_read_implies_exec #define elf_read_implies_exec(ex, have_pt_gnu_stack) 0 #endif typedef __u32 Elf32_Addr; typedef __u16 Elf32_Half; typedef __u32 Elf32_Off; typedef __s32 Elf32_Sword; typedef __u32 Elf32_Word; typedef __u64 Elf64_Addr; typedef __u16 Elf64_Half; typedef __s16 Elf64_SHalf; typedef __u64 Elf64_Off; typedef __s32 Elf64_Sword; typedef __u32 Elf64_Word; typedef __u64 Elf64_Xword; typedef __s64 Elf64_Sxword; #define PT_NULL 0 #define PT_LOAD 1 #define PT_DYNAMIC 2 #define PT_INTERP 3 #define PT_NOTE 4 #define PT_SHLIB 5 #define PT_PHDR 6 #define PT_TLS 7 #define PT_LOOS 0x60000000 #define PT_HIOS 0x6fffffff #define PT_LOPROC 0x70000000 #define PT_HIPROC 0x7fffffff #define PT_GNU_EH_FRAME 0x6474e550 #define PT_GNU_STACK (PT_LOOS + 0x474e551) #define ET_NONE 0 #define ET_REL 1 #define ET_EXEC 2 #define ET_DYN 3 #define ET_CORE 4 #define ET_LOPROC 0xff00 #define ET_HIPROC 0xffff #define DT_NULL 0 #define DT_NEEDED 1 #define DT_PLTRELSZ 2 #define DT_PLTGOT 3 #define DT_HASH 4 #define DT_STRTAB 5 #define DT_SYMTAB 6 #define DT_RELA 7 #define DT_RELASZ 8 #define DT_RELAENT 9 #define DT_STRSZ 10 #define DT_SYMENT 11 #define DT_INIT 12 #define DT_FINI 13 #define DT_SONAME 14 #define DT_RPATH 15 #define DT_SYMBOLIC 16 #define DT_REL 17 #define DT_RELSZ 18 #define DT_RELENT 19 #define DT_PLTREL 20 #define DT_DEBUG 21 #define DT_TEXTREL 22 #define DT_JMPREL 23 #define DT_LOPROC 0x70000000 #define DT_HIPROC 0x7fffffff #define STB_LOCAL 0 #define STB_GLOBAL 1 #define STB_WEAK 2 #define STT_NOTYPE 0 #define STT_OBJECT 1 #define STT_FUNC 2 #define STT_SECTION 3 #define STT_FILE 4 #define STT_COMMON 5 #define STT_TLS 6 #define ELF_ST_BIND(x) ((x) >> 4) #define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf) #define ELF32_ST_BIND(x) ELF_ST_BIND(x) #define ELF32_ST_TYPE(x) ELF_ST_TYPE(x) #define ELF64_ST_BIND(x) ELF_ST_BIND(x) #define ELF64_ST_TYPE(x) ELF_ST_TYPE(x) typedef struct dynamic{ Elf32_Sword d_tag; union{ Elf32_Sword d_val; Elf32_Addr d_ptr; } d_un; } Elf32_Dyn; typedef struct { Elf64_Sxword d_tag; union { Elf64_Xword d_val; Elf64_Addr d_ptr; } d_un; } Elf64_Dyn; #define ELF32_R_SYM(x) ((x) >> 8) #define ELF32_R_TYPE(x) ((x) & 0xff) #define ELF64_R_SYM(i) ((i) >> 32) #define ELF64_R_TYPE(i) ((i) & 0xffffffff) typedef struct elf32_rel { Elf32_Addr r_offset; Elf32_Word r_info; } Elf32_Rel; typedef struct elf64_rel { Elf64_Addr r_offset; Elf64_Xword r_info; } Elf64_Rel; typedef struct elf32_rela{ Elf32_Addr r_offset; Elf32_Word r_info; Elf32_Sword r_addend; } Elf32_Rela; typedef struct elf64_rela { Elf64_Addr r_offset; Elf64_Xword r_info; Elf64_Sxword r_addend; } Elf64_Rela; typedef struct elf32_sym{ Elf32_Word st_name; Elf32_Addr st_value; Elf32_Word st_size; unsigned char st_info; unsigned char st_other; Elf32_Half st_shndx; } Elf32_Sym; typedef struct elf64_sym { Elf64_Word st_name; unsigned char st_info; unsigned char st_other; Elf64_Half st_shndx; Elf64_Addr st_value; Elf64_Xword st_size; } Elf64_Sym; #define EI_NIDENT 16 typedef struct elf32_hdr{ unsigned char e_ident[EI_NIDENT]; Elf32_Half e_type; Elf32_Half e_machine; Elf32_Word e_version; Elf32_Addr e_entry; Elf32_Off e_phoff; Elf32_Off e_shoff; Elf32_Word e_flags; Elf32_Half e_ehsize; Elf32_Half e_phentsize; Elf32_Half e_phnum; Elf32_Half e_shentsize; Elf32_Half e_shnum; Elf32_Half e_shstrndx; } Elf32_Ehdr; typedef struct elf64_hdr { unsigned char e_ident[16]; Elf64_Half e_type; Elf64_Half e_machine; Elf64_Word e_version; Elf64_Addr e_entry; Elf64_Off e_phoff; Elf64_Off e_shoff; Elf64_Word e_flags; Elf64_Half e_ehsize; Elf64_Half e_phentsize; Elf64_Half e_phnum; Elf64_Half e_shentsize; Elf64_Half e_shnum; Elf64_Half e_shstrndx; } Elf64_Ehdr; #define PF_R 0x4 #define PF_W 0x2 #define PF_X 0x1 typedef struct elf32_phdr{ Elf32_Word p_type; Elf32_Off p_offset; Elf32_Addr p_vaddr; Elf32_Addr p_paddr; Elf32_Word p_filesz; Elf32_Word p_memsz; Elf32_Word p_flags; Elf32_Word p_align; } Elf32_Phdr; typedef struct elf64_phdr { Elf64_Word p_type; Elf64_Word p_flags; Elf64_Off p_offset; Elf64_Addr p_vaddr; Elf64_Addr p_paddr; Elf64_Xword p_filesz; Elf64_Xword p_memsz; Elf64_Xword p_align; } Elf64_Phdr; #define SHT_NULL 0 #define SHT_PROGBITS 1 #define SHT_SYMTAB 2 #define SHT_STRTAB 3 #define SHT_RELA 4 #define SHT_HASH 5 #define SHT_DYNAMIC 6 #define SHT_NOTE 7 #define SHT_NOBITS 8 #define SHT_REL 9 #define SHT_SHLIB 10 #define SHT_DYNSYM 11 #define SHT_NUM 12 #define SHT_LOPROC 0x70000000 #define SHT_HIPROC 0x7fffffff #define SHT_LOUSER 0x80000000 #define SHT_HIUSER 0xffffffff #define SHF_WRITE 0x1 #define SHF_ALLOC 0x2 #define SHF_EXECINSTR 0x4 #define SHF_MASKPROC 0xf0000000 #define SHN_UNDEF 0 #define SHN_LORESERVE 0xff00 #define SHN_LOPROC 0xff00 #define SHN_HIPROC 0xff1f #define SHN_ABS 0xfff1 #define SHN_COMMON 0xfff2 #define SHN_HIRESERVE 0xffff typedef struct { Elf32_Word sh_name; Elf32_Word sh_type; Elf32_Word sh_flags; Elf32_Addr sh_addr; Elf32_Off sh_offset; Elf32_Word sh_size; Elf32_Word sh_link; Elf32_Word sh_info; Elf32_Word sh_addralign; Elf32_Word sh_entsize; } Elf32_Shdr; typedef struct elf64_shdr { Elf64_Word sh_name; Elf64_Word sh_type; Elf64_Xword sh_flags; Elf64_Addr sh_addr; Elf64_Off sh_offset; Elf64_Xword sh_size; Elf64_Word sh_link; Elf64_Word sh_info; Elf64_Xword sh_addralign; Elf64_Xword sh_entsize; } Elf64_Shdr; #define EI_MAG0 0 #define EI_MAG1 1 #define EI_MAG2 2 #define EI_MAG3 3 #define EI_CLASS 4 #define EI_DATA 5 #define EI_VERSION 6 #define EI_OSABI 7 #define EI_PAD 8 #define ELFMAG0 0x7f #define ELFMAG1 'E' #define ELFMAG2 'L' #define ELFMAG3 'F' #define ELFMAG "\177ELF" #define SELFMAG 4 #define ELFCLASSNONE 0 #define ELFCLASS32 1 #define ELFCLASS64 2 #define ELFCLASSNUM 3 #define ELFDATANONE 0 #define ELFDATA2LSB 1 #define ELFDATA2MSB 2 #define EV_NONE 0 #define EV_CURRENT 1 #define EV_NUM 2 #define ELFOSABI_NONE 0 #define ELFOSABI_LINUX 3 #ifndef ELF_OSABI #define ELF_OSABI ELFOSABI_NONE #endif #define NT_PRSTATUS 1 #define NT_PRFPREG 2 #define NT_PRPSINFO 3 #define NT_TASKSTRUCT 4 #define NT_AUXV 6 #define NT_PRXFPREG 0x46e62b7f typedef struct elf32_note { Elf32_Word n_namesz; Elf32_Word n_descsz; Elf32_Word n_type; } Elf32_Nhdr; typedef struct elf64_note { Elf64_Word n_namesz; Elf64_Word n_descsz; Elf64_Word n_type; } Elf64_Nhdr; #if ELF_CLASS == ELFCLASS32 #define elfhdr elf32_hdr #define elf_phdr elf32_phdr #define elf_note elf32_note #else #define elfhdr elf64_hdr #define elf_phdr elf64_phdr #define elf_note elf64_note #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/akm8973.h0000644000015700001700000000367112200324306023737 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef AKM8973_H #define AKM8973_H #include #define AKMIO 0xA1 #define ECS_IOCTL_WRITE _IOW(AKMIO, 0x01, char[5]) #define ECS_IOCTL_READ _IOWR(AKMIO, 0x02, char[5]) #define ECS_IOCTL_RESET _IO(AKMIO, 0x03) #define ECS_IOCTL_SET_MODE _IOW(AKMIO, 0x04, short) #define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x05, char[RBUFF_SIZE+1]) #define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x06, short[12]) #define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x07, int) #define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x08, int) #define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x30, short) #define ECS_IOCTL_APP_SET_MODE _IOW(AKMIO, 0x10, short) #define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short) #define ECS_IOCTL_APP_GET_MFLAG _IOW(AKMIO, 0x12, short) #define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short) #define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short) #define ECS_IOCTL_APP_SET_TFLAG _IOR(AKMIO, 0x15, short) #define ECS_IOCTL_APP_GET_TFLAG _IOR(AKMIO, 0x16, short) #define ECS_IOCTL_APP_RESET_PEDOMETER _IO(AKMIO, 0x17) #define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, short) #define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY #define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short) #define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short) #define ECS_IOCTL_SET_STEP_CNT _IOW(AKMIO, 0x20, short) #endif android-audiosystem-1.8+13.10.20130807/include/linux/wireless.h0000644000015700001700000002742712200324306024476 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_WIRELESS_H #define _LINUX_WIRELESS_H #include #include #include #define WIRELESS_EXT 20 #define SIOCSIWCOMMIT 0x8B00 #define SIOCGIWNAME 0x8B01 #define SIOCSIWNWID 0x8B02 #define SIOCGIWNWID 0x8B03 #define SIOCSIWFREQ 0x8B04 #define SIOCGIWFREQ 0x8B05 #define SIOCSIWMODE 0x8B06 #define SIOCGIWMODE 0x8B07 #define SIOCSIWSENS 0x8B08 #define SIOCGIWSENS 0x8B09 #define SIOCSIWRANGE 0x8B0A #define SIOCGIWRANGE 0x8B0B #define SIOCSIWPRIV 0x8B0C #define SIOCGIWPRIV 0x8B0D #define SIOCSIWSTATS 0x8B0E #define SIOCGIWSTATS 0x8B0F #define SIOCSIWSPY 0x8B10 #define SIOCGIWSPY 0x8B11 #define SIOCSIWTHRSPY 0x8B12 #define SIOCGIWTHRSPY 0x8B13 #define SIOCSIWAP 0x8B14 #define SIOCGIWAP 0x8B15 #define SIOCGIWAPLIST 0x8B17 #define SIOCSIWSCAN 0x8B18 #define SIOCGIWSCAN 0x8B19 #define SIOCSIWESSID 0x8B1A #define SIOCGIWESSID 0x8B1B #define SIOCSIWNICKN 0x8B1C #define SIOCGIWNICKN 0x8B1D #define SIOCSIWRATE 0x8B20 #define SIOCGIWRATE 0x8B21 #define SIOCSIWRTS 0x8B22 #define SIOCGIWRTS 0x8B23 #define SIOCSIWFRAG 0x8B24 #define SIOCGIWFRAG 0x8B25 #define SIOCSIWTXPOW 0x8B26 #define SIOCGIWTXPOW 0x8B27 #define SIOCSIWRETRY 0x8B28 #define SIOCGIWRETRY 0x8B29 #define SIOCSIWENCODE 0x8B2A #define SIOCGIWENCODE 0x8B2B #define SIOCSIWPOWER 0x8B2C #define SIOCGIWPOWER 0x8B2D #define SIOCSIWGENIE 0x8B30 #define SIOCGIWGENIE 0x8B31 #define SIOCSIWMLME 0x8B16 #define SIOCSIWAUTH 0x8B32 #define SIOCGIWAUTH 0x8B33 #define SIOCSIWENCODEEXT 0x8B34 #define SIOCGIWENCODEEXT 0x8B35 #define SIOCSIWPMKSA 0x8B36 #define SIOCIWFIRSTPRIV 0x8BE0 #define SIOCIWLASTPRIV 0x8BFF #define SIOCIWFIRST 0x8B00 #define SIOCIWLAST SIOCIWLASTPRIV #define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST) #define IW_IS_SET(cmd) (!((cmd) & 0x1)) #define IW_IS_GET(cmd) ((cmd) & 0x1) #define IWEVTXDROP 0x8C00 #define IWEVQUAL 0x8C01 #define IWEVCUSTOM 0x8C02 #define IWEVREGISTERED 0x8C03 #define IWEVEXPIRED 0x8C04 #define IWEVGENIE 0x8C05 #define IWEVMICHAELMICFAILURE 0x8C06 #define IWEVASSOCREQIE 0x8C07 #define IWEVASSOCRESPIE 0x8C08 #define IWEVPMKIDCAND 0x8C09 #define IWEVFIRST 0x8C00 #define IW_EVENT_IDX(cmd) ((cmd) - IWEVFIRST) #define IW_PRIV_TYPE_MASK 0x7000 #define IW_PRIV_TYPE_NONE 0x0000 #define IW_PRIV_TYPE_BYTE 0x1000 #define IW_PRIV_TYPE_CHAR 0x2000 #define IW_PRIV_TYPE_INT 0x4000 #define IW_PRIV_TYPE_FLOAT 0x5000 #define IW_PRIV_TYPE_ADDR 0x6000 #define IW_PRIV_SIZE_FIXED 0x0800 #define IW_PRIV_SIZE_MASK 0x07FF #define IW_MAX_FREQUENCIES 32 #define IW_MAX_BITRATES 32 #define IW_MAX_TXPOWER 8 #define IW_MAX_SPY 8 #define IW_MAX_AP 64 #define IW_ESSID_MAX_SIZE 32 #define IW_MODE_AUTO 0 #define IW_MODE_ADHOC 1 #define IW_MODE_INFRA 2 #define IW_MODE_MASTER 3 #define IW_MODE_REPEAT 4 #define IW_MODE_SECOND 5 #define IW_MODE_MONITOR 6 #define IW_QUAL_QUAL_UPDATED 0x01 #define IW_QUAL_LEVEL_UPDATED 0x02 #define IW_QUAL_NOISE_UPDATED 0x04 #define IW_QUAL_ALL_UPDATED 0x07 #define IW_QUAL_DBM 0x08 #define IW_QUAL_QUAL_INVALID 0x10 #define IW_QUAL_LEVEL_INVALID 0x20 #define IW_QUAL_NOISE_INVALID 0x40 #define IW_QUAL_ALL_INVALID 0x70 #define IW_FREQ_AUTO 0x00 #define IW_FREQ_FIXED 0x01 #define IW_MAX_ENCODING_SIZES 8 #define IW_ENCODING_TOKEN_MAX 64 #define IW_ENCODE_INDEX 0x00FF #define IW_ENCODE_FLAGS 0xFF00 #define IW_ENCODE_MODE 0xF000 #define IW_ENCODE_DISABLED 0x8000 #define IW_ENCODE_ENABLED 0x0000 #define IW_ENCODE_RESTRICTED 0x4000 #define IW_ENCODE_OPEN 0x2000 #define IW_ENCODE_NOKEY 0x0800 #define IW_ENCODE_TEMP 0x0400 #define IW_POWER_ON 0x0000 #define IW_POWER_TYPE 0xF000 #define IW_POWER_PERIOD 0x1000 #define IW_POWER_TIMEOUT 0x2000 #define IW_POWER_MODE 0x0F00 #define IW_POWER_UNICAST_R 0x0100 #define IW_POWER_MULTICAST_R 0x0200 #define IW_POWER_ALL_R 0x0300 #define IW_POWER_FORCE_S 0x0400 #define IW_POWER_REPEATER 0x0800 #define IW_POWER_MODIFIER 0x000F #define IW_POWER_MIN 0x0001 #define IW_POWER_MAX 0x0002 #define IW_POWER_RELATIVE 0x0004 #define IW_TXPOW_TYPE 0x00FF #define IW_TXPOW_DBM 0x0000 #define IW_TXPOW_MWATT 0x0001 #define IW_TXPOW_RELATIVE 0x0002 #define IW_TXPOW_RANGE 0x1000 #define IW_RETRY_ON 0x0000 #define IW_RETRY_TYPE 0xF000 #define IW_RETRY_LIMIT 0x1000 #define IW_RETRY_LIFETIME 0x2000 #define IW_RETRY_MODIFIER 0x000F #define IW_RETRY_MIN 0x0001 #define IW_RETRY_MAX 0x0002 #define IW_RETRY_RELATIVE 0x0004 #define IW_SCAN_DEFAULT 0x0000 #define IW_SCAN_ALL_ESSID 0x0001 #define IW_SCAN_THIS_ESSID 0x0002 #define IW_SCAN_ALL_FREQ 0x0004 #define IW_SCAN_THIS_FREQ 0x0008 #define IW_SCAN_ALL_MODE 0x0010 #define IW_SCAN_THIS_MODE 0x0020 #define IW_SCAN_ALL_RATE 0x0040 #define IW_SCAN_THIS_RATE 0x0080 #define IW_SCAN_TYPE_ACTIVE 0 #define IW_SCAN_TYPE_PASSIVE 1 #define IW_SCAN_MAX_DATA 4096 #define IW_CUSTOM_MAX 256 #define IW_GENERIC_IE_MAX 1024 #define IW_MLME_DEAUTH 0 #define IW_MLME_DISASSOC 1 #define IW_AUTH_INDEX 0x0FFF #define IW_AUTH_FLAGS 0xF000 #define IW_AUTH_WPA_VERSION 0 #define IW_AUTH_CIPHER_PAIRWISE 1 #define IW_AUTH_CIPHER_GROUP 2 #define IW_AUTH_KEY_MGMT 3 #define IW_AUTH_TKIP_COUNTERMEASURES 4 #define IW_AUTH_DROP_UNENCRYPTED 5 #define IW_AUTH_80211_AUTH_ALG 6 #define IW_AUTH_WPA_ENABLED 7 #define IW_AUTH_RX_UNENCRYPTED_EAPOL 8 #define IW_AUTH_ROAMING_CONTROL 9 #define IW_AUTH_PRIVACY_INVOKED 10 #define IW_AUTH_WPA_VERSION_DISABLED 0x00000001 #define IW_AUTH_WPA_VERSION_WPA 0x00000002 #define IW_AUTH_WPA_VERSION_WPA2 0x00000004 #define IW_AUTH_CIPHER_NONE 0x00000001 #define IW_AUTH_CIPHER_WEP40 0x00000002 #define IW_AUTH_CIPHER_TKIP 0x00000004 #define IW_AUTH_CIPHER_CCMP 0x00000008 #define IW_AUTH_CIPHER_WEP104 0x00000010 #define IW_AUTH_KEY_MGMT_802_1X 1 #define IW_AUTH_KEY_MGMT_PSK 2 #define IW_AUTH_ALG_OPEN_SYSTEM 0x00000001 #define IW_AUTH_ALG_SHARED_KEY 0x00000002 #define IW_AUTH_ALG_LEAP 0x00000004 #define IW_AUTH_ROAMING_ENABLE 0 #define IW_AUTH_ROAMING_DISABLE 1 #define IW_ENCODE_SEQ_MAX_SIZE 8 #define IW_ENCODE_ALG_NONE 0 #define IW_ENCODE_ALG_WEP 1 #define IW_ENCODE_ALG_TKIP 2 #define IW_ENCODE_ALG_CCMP 3 #define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001 #define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002 #define IW_ENCODE_EXT_GROUP_KEY 0x00000004 #define IW_ENCODE_EXT_SET_TX_KEY 0x00000008 #define IW_MICFAILURE_KEY_ID 0x00000003 #define IW_MICFAILURE_GROUP 0x00000004 #define IW_MICFAILURE_PAIRWISE 0x00000008 #define IW_MICFAILURE_STAKEY 0x00000010 #define IW_MICFAILURE_COUNT 0x00000060 #define IW_ENC_CAPA_WPA 0x00000001 #define IW_ENC_CAPA_WPA2 0x00000002 #define IW_ENC_CAPA_CIPHER_TKIP 0x00000004 #define IW_ENC_CAPA_CIPHER_CCMP 0x00000008 #define IW_EVENT_CAPA_BASE(cmd) ((cmd >= SIOCIWFIRSTPRIV) ? (cmd - SIOCIWFIRSTPRIV + 0x60) : (cmd - SIOCSIWCOMMIT)) #define IW_EVENT_CAPA_INDEX(cmd) (IW_EVENT_CAPA_BASE(cmd) >> 5) #define IW_EVENT_CAPA_MASK(cmd) (1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F)) #define IW_EVENT_CAPA_K_0 (IW_EVENT_CAPA_MASK(0x8B04) | IW_EVENT_CAPA_MASK(0x8B06) | IW_EVENT_CAPA_MASK(0x8B1A)) #define IW_EVENT_CAPA_K_1 (IW_EVENT_CAPA_MASK(0x8B2A)) #define IW_EVENT_CAPA_SET(event_capa, cmd) (event_capa[IW_EVENT_CAPA_INDEX(cmd)] |= IW_EVENT_CAPA_MASK(cmd)) #define IW_EVENT_CAPA_SET_KERNEL(event_capa) {event_capa[0] |= IW_EVENT_CAPA_K_0; event_capa[1] |= IW_EVENT_CAPA_K_1; } struct iw_param { __s32 value; __u8 fixed; __u8 disabled; __u16 flags; }; struct iw_point { void __user *pointer; __u16 length; __u16 flags; }; struct iw_freq { __s32 m; __s16 e; __u8 i; __u8 flags; }; struct iw_quality { __u8 qual; __u8 level; __u8 noise; __u8 updated; }; struct iw_discarded { __u32 nwid; __u32 code; __u32 fragment; __u32 retries; __u32 misc; }; struct iw_missed { __u32 beacon; }; struct iw_thrspy { struct sockaddr addr; struct iw_quality qual; struct iw_quality low; struct iw_quality high; }; struct iw_scan_req { __u8 scan_type; __u8 essid_len; __u8 num_channels; __u8 flags; struct sockaddr bssid; __u8 essid[IW_ESSID_MAX_SIZE]; __u32 min_channel_time; __u32 max_channel_time; struct iw_freq channel_list[IW_MAX_FREQUENCIES]; }; struct iw_encode_ext { __u32 ext_flags; __u8 tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; __u8 rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; struct sockaddr addr; __u16 alg; __u16 key_len; __u8 key[0]; }; struct iw_mlme { __u16 cmd; __u16 reason_code; struct sockaddr addr; }; #define IW_PMKSA_ADD 1 #define IW_PMKSA_REMOVE 2 #define IW_PMKSA_FLUSH 3 #define IW_PMKID_LEN 16 struct iw_pmksa { __u32 cmd; struct sockaddr bssid; __u8 pmkid[IW_PMKID_LEN]; }; struct iw_michaelmicfailure { __u32 flags; struct sockaddr src_addr; __u8 tsc[IW_ENCODE_SEQ_MAX_SIZE]; }; #define IW_PMKID_CAND_PREAUTH 0x00000001 struct iw_pmkid_cand { __u32 flags; __u32 index; struct sockaddr bssid; }; struct iw_statistics { __u16 status; struct iw_quality qual; struct iw_discarded discard; struct iw_missed miss; }; union iwreq_data { char name[IFNAMSIZ]; struct iw_point essid; struct iw_param nwid; struct iw_freq freq; struct iw_param sens; struct iw_param bitrate; struct iw_param txpower; struct iw_param rts; struct iw_param frag; __u32 mode; struct iw_param retry; struct iw_point encoding; struct iw_param power; struct iw_quality qual; struct sockaddr ap_addr; struct sockaddr addr; struct iw_param param; struct iw_point data; }; struct iwreq { union { char ifrn_name[IFNAMSIZ]; } ifr_ifrn; union iwreq_data u; }; struct iw_range { __u32 throughput; __u32 min_nwid; __u32 max_nwid; __u16 old_num_channels; __u8 old_num_frequency; __u32 event_capa[6]; __s32 sensitivity; struct iw_quality max_qual; struct iw_quality avg_qual; __u8 num_bitrates; __s32 bitrate[IW_MAX_BITRATES]; __s32 min_rts; __s32 max_rts; __s32 min_frag; __s32 max_frag; __s32 min_pmp; __s32 max_pmp; __s32 min_pmt; __s32 max_pmt; __u16 pmp_flags; __u16 pmt_flags; __u16 pm_capa; __u16 encoding_size[IW_MAX_ENCODING_SIZES]; __u8 num_encoding_sizes; __u8 max_encoding_tokens; __u8 encoding_login_index; __u16 txpower_capa; __u8 num_txpower; __s32 txpower[IW_MAX_TXPOWER]; __u8 we_version_compiled; __u8 we_version_source; __u16 retry_capa; __u16 retry_flags; __u16 r_time_flags; __s32 min_retry; __s32 max_retry; __s32 min_r_time; __s32 max_r_time; __u16 num_channels; __u8 num_frequency; struct iw_freq freq[IW_MAX_FREQUENCIES]; __u32 enc_capa; }; struct iw_priv_args { __u32 cmd; __u16 set_args; __u16 get_args; char name[IFNAMSIZ]; }; struct iw_event { __u16 len; __u16 cmd; union iwreq_data u; }; #define IW_EV_LCP_LEN (sizeof(struct iw_event) - sizeof(union iwreq_data)) #define IW_EV_CHAR_LEN (IW_EV_LCP_LEN + IFNAMSIZ) #define IW_EV_UINT_LEN (IW_EV_LCP_LEN + sizeof(__u32)) #define IW_EV_FREQ_LEN (IW_EV_LCP_LEN + sizeof(struct iw_freq)) #define IW_EV_PARAM_LEN (IW_EV_LCP_LEN + sizeof(struct iw_param)) #define IW_EV_ADDR_LEN (IW_EV_LCP_LEN + sizeof(struct sockaddr)) #define IW_EV_QUAL_LEN (IW_EV_LCP_LEN + sizeof(struct iw_quality)) #define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - (char *) NULL) #define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - IW_EV_POINT_OFF) #endif android-audiosystem-1.8+13.10.20130807/include/linux/completion.h0000644000015700001700000000226112200324306024777 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_COMPLETION_H #define __LINUX_COMPLETION_H #include struct completion { unsigned int done; wait_queue_head_t wait; }; #define COMPLETION_INITIALIZER(work) { 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) } #define COMPLETION_INITIALIZER_ONSTACK(work) ({ init_completion(&work); work; }) #define DECLARE_COMPLETION(work) struct completion work = COMPLETION_INITIALIZER(work) #define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work) #define INIT_COMPLETION(x) ((x).done = 0) #endif android-audiosystem-1.8+13.10.20130807/include/linux/posix_acl.h0000644000015700001700000000254712200324306024616 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_POSIX_ACL_H #define __LINUX_POSIX_ACL_H #include #define ACL_UNDEFINED_ID (-1) #define ACL_TYPE_ACCESS (0x8000) #define ACL_TYPE_DEFAULT (0x4000) #define ACL_USER_OBJ (0x01) #define ACL_USER (0x02) #define ACL_GROUP_OBJ (0x04) #define ACL_GROUP (0x08) #define ACL_MASK (0x10) #define ACL_OTHER (0x20) #define ACL_READ (0x04) #define ACL_WRITE (0x02) #define ACL_EXECUTE (0x01) struct posix_acl_entry { short e_tag; unsigned short e_perm; unsigned int e_id; }; struct posix_acl { atomic_t a_refcount; unsigned int a_count; struct posix_acl_entry a_entries[0]; }; #define FOREACH_ACL_ENTRY(pa, acl, pe) for(pa=(acl)->a_entries, pe=pa+(acl)->a_count; pa #undef EXT2FS_DEBUG #define EXT2_PREALLOCATE #define EXT2_DEFAULT_PREALLOC_BLOCKS 8 #define EXT2FS_DATE "95/08/09" #define EXT2FS_VERSION "0.5b" #ifdef EXT2FS_DEBUG #define ext2_debug(f, a...) { printk ("EXT2-fs DEBUG (%s, %d): %s:", __FILE__, __LINE__, __FUNCTION__); printk (f, ## a); } #else #define ext2_debug(f, a...) #endif #define EXT2_BAD_INO 1 #define EXT2_ROOT_INO 2 #define EXT2_BOOT_LOADER_INO 5 #define EXT2_UNDEL_DIR_INO 6 #define EXT2_GOOD_OLD_FIRST_INO 11 #define EXT2_SUPER_MAGIC 0xEF53 #define EXT2_SB(sb) (sb) #define EXT2_LINK_MAX 32000 #define EXT2_MIN_BLOCK_SIZE 1024 #define EXT2_MAX_BLOCK_SIZE 4096 #define EXT2_MIN_BLOCK_LOG_SIZE 10 #define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size) #define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32)) #define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) #define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? EXT2_GOOD_OLD_INODE_SIZE : (s)->s_inode_size) #define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? EXT2_GOOD_OLD_FIRST_INO : (s)->s_first_ino) #define EXT2_MIN_FRAG_SIZE 1024 #define EXT2_MAX_FRAG_SIZE 4096 #define EXT2_MIN_FRAG_LOG_SIZE 10 #define EXT2_FRAG_SIZE(s) (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size) #define EXT2_FRAGS_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s)) struct ext2_group_desc { __le32 bg_block_bitmap; __le32 bg_inode_bitmap; __le32 bg_inode_table; __le16 bg_free_blocks_count; __le16 bg_free_inodes_count; __le16 bg_used_dirs_count; __le16 bg_pad; __le32 bg_reserved[3]; }; #define EXT2_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group) #define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc)) #define EXT2_INODES_PER_GROUP(s) ((s)->s_inodes_per_group) #define EXT2_NDIR_BLOCKS 12 #define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS #define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1) #define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1) #define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1) #define EXT2_SECRM_FL 0x00000001 #define EXT2_UNRM_FL 0x00000002 #define EXT2_COMPR_FL 0x00000004 #define EXT2_SYNC_FL 0x00000008 #define EXT2_IMMUTABLE_FL 0x00000010 #define EXT2_APPEND_FL 0x00000020 #define EXT2_NODUMP_FL 0x00000040 #define EXT2_NOATIME_FL 0x00000080 #define EXT2_DIRTY_FL 0x00000100 #define EXT2_COMPRBLK_FL 0x00000200 #define EXT2_NOCOMP_FL 0x00000400 #define EXT2_ECOMPR_FL 0x00000800 #define EXT2_BTREE_FL 0x00001000 #define EXT2_INDEX_FL 0x00001000 #define EXT2_IMAGIC_FL 0x00002000 #define EXT2_JOURNAL_DATA_FL 0x00004000 #define EXT2_NOTAIL_FL 0x00008000 #define EXT2_DIRSYNC_FL 0x00010000 #define EXT2_TOPDIR_FL 0x00020000 #define EXT2_RESERVED_FL 0x80000000 #define EXT2_FL_USER_VISIBLE 0x0003DFFF #define EXT2_FL_USER_MODIFIABLE 0x000380FF #define EXT2_IOC_GETFLAGS _IOR('f', 1, long) #define EXT2_IOC_SETFLAGS _IOW('f', 2, long) #define EXT2_IOC_GETVERSION _IOR('v', 1, long) #define EXT2_IOC_SETVERSION _IOW('v', 2, long) struct ext2_inode { __le16 i_mode; __le16 i_uid; __le32 i_size; __le32 i_atime; __le32 i_ctime; __le32 i_mtime; __le32 i_dtime; __le16 i_gid; __le16 i_links_count; __le32 i_blocks; __le32 i_flags; union { struct { __le32 l_i_reserved1; } linux1; struct { __le32 h_i_translator; } hurd1; struct { __le32 m_i_reserved1; } masix1; } osd1; __le32 i_block[EXT2_N_BLOCKS]; __le32 i_generation; __le32 i_file_acl; __le32 i_dir_acl; __le32 i_faddr; union { struct { __u8 l_i_frag; __u8 l_i_fsize; __u16 i_pad1; __le16 l_i_uid_high; __le16 l_i_gid_high; __u32 l_i_reserved2; } linux2; struct { __u8 h_i_frag; __u8 h_i_fsize; __le16 h_i_mode_high; __le16 h_i_uid_high; __le16 h_i_gid_high; __le32 h_i_author; } hurd2; struct { __u8 m_i_frag; __u8 m_i_fsize; __u16 m_pad1; __u32 m_i_reserved2[2]; } masix2; } osd2; }; #define i_size_high i_dir_acl #ifdef __linux__ #define i_reserved1 osd1.linux1.l_i_reserved1 #define i_frag osd2.linux2.l_i_frag #define i_fsize osd2.linux2.l_i_fsize #define i_uid_low i_uid #define i_gid_low i_gid #define i_uid_high osd2.linux2.l_i_uid_high #define i_gid_high osd2.linux2.l_i_gid_high #define i_reserved2 osd2.linux2.l_i_reserved2 #endif #ifdef __hurd__ #define i_translator osd1.hurd1.h_i_translator #define i_frag osd2.hurd2.h_i_frag; #define i_fsize osd2.hurd2.h_i_fsize; #define i_uid_high osd2.hurd2.h_i_uid_high #define i_gid_high osd2.hurd2.h_i_gid_high #define i_author osd2.hurd2.h_i_author #endif #ifdef __masix__ #define i_reserved1 osd1.masix1.m_i_reserved1 #define i_frag osd2.masix2.m_i_frag #define i_fsize osd2.masix2.m_i_fsize #define i_reserved2 osd2.masix2.m_i_reserved2 #endif #define EXT2_VALID_FS 0x0001 #define EXT2_ERROR_FS 0x0002 #define EXT2_MOUNT_CHECK 0x000001 #define EXT2_MOUNT_OLDALLOC 0x000002 #define EXT2_MOUNT_GRPID 0x000004 #define EXT2_MOUNT_DEBUG 0x000008 #define EXT2_MOUNT_ERRORS_CONT 0x000010 #define EXT2_MOUNT_ERRORS_RO 0x000020 #define EXT2_MOUNT_ERRORS_PANIC 0x000040 #define EXT2_MOUNT_MINIX_DF 0x000080 #define EXT2_MOUNT_NOBH 0x000100 #define EXT2_MOUNT_NO_UID32 0x000200 #define EXT2_MOUNT_XATTR_USER 0x004000 #define EXT2_MOUNT_POSIX_ACL 0x008000 #define EXT2_MOUNT_XIP 0x010000 #define EXT2_MOUNT_USRQUOTA 0x020000 #define EXT2_MOUNT_GRPQUOTA 0x040000 #define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt #define set_opt(o, opt) o |= EXT2_MOUNT_##opt #define test_opt(sb, opt) (EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_##opt) #define EXT2_DFL_MAX_MNT_COUNT 20 #define EXT2_DFL_CHECKINTERVAL 0 #define EXT2_ERRORS_CONTINUE 1 #define EXT2_ERRORS_RO 2 #define EXT2_ERRORS_PANIC 3 #define EXT2_ERRORS_DEFAULT EXT2_ERRORS_CONTINUE struct ext2_super_block { __le32 s_inodes_count; __le32 s_blocks_count; __le32 s_r_blocks_count; __le32 s_free_blocks_count; __le32 s_free_inodes_count; __le32 s_first_data_block; __le32 s_log_block_size; __le32 s_log_frag_size; __le32 s_blocks_per_group; __le32 s_frags_per_group; __le32 s_inodes_per_group; __le32 s_mtime; __le32 s_wtime; __le16 s_mnt_count; __le16 s_max_mnt_count; __le16 s_magic; __le16 s_state; __le16 s_errors; __le16 s_minor_rev_level; __le32 s_lastcheck; __le32 s_checkinterval; __le32 s_creator_os; __le32 s_rev_level; __le16 s_def_resuid; __le16 s_def_resgid; __le32 s_first_ino; __le16 s_inode_size; __le16 s_block_group_nr; __le32 s_feature_compat; __le32 s_feature_incompat; __le32 s_feature_ro_compat; __u8 s_uuid[16]; char s_volume_name[16]; char s_last_mounted[64]; __le32 s_algorithm_usage_bitmap; __u8 s_prealloc_blocks; __u8 s_prealloc_dir_blocks; __u16 s_padding1; __u8 s_journal_uuid[16]; __u32 s_journal_inum; __u32 s_journal_dev; __u32 s_last_orphan; __u32 s_hash_seed[4]; __u8 s_def_hash_version; __u8 s_reserved_char_pad; __u16 s_reserved_word_pad; __le32 s_default_mount_opts; __le32 s_first_meta_bg; __u32 s_reserved[190]; }; #define EXT2_OS_LINUX 0 #define EXT2_OS_HURD 1 #define EXT2_OS_MASIX 2 #define EXT2_OS_FREEBSD 3 #define EXT2_OS_LITES 4 #define EXT2_GOOD_OLD_REV 0 #define EXT2_DYNAMIC_REV 1 #define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV #define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV #define EXT2_GOOD_OLD_INODE_SIZE 128 #define EXT2_HAS_COMPAT_FEATURE(sb,mask) ( EXT2_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) ) #define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) ( EXT2_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) ) #define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) ( EXT2_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) ) #define EXT2_SET_COMPAT_FEATURE(sb,mask) EXT2_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask) #define EXT2_SET_RO_COMPAT_FEATURE(sb,mask) EXT2_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask) #define EXT2_SET_INCOMPAT_FEATURE(sb,mask) EXT2_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask) #define EXT2_CLEAR_COMPAT_FEATURE(sb,mask) EXT2_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask) #define EXT2_CLEAR_RO_COMPAT_FEATURE(sb,mask) EXT2_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask) #define EXT2_CLEAR_INCOMPAT_FEATURE(sb,mask) EXT2_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask) #define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001 #define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002 #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 #define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008 #define EXT2_FEATURE_COMPAT_RESIZE_INO 0x0010 #define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020 #define EXT2_FEATURE_COMPAT_ANY 0xffffffff #define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 #define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 #define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 #define EXT2_FEATURE_RO_COMPAT_ANY 0xffffffff #define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001 #define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002 #define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 #define EXT2_FEATURE_INCOMPAT_META_BG 0x0010 #define EXT2_FEATURE_INCOMPAT_ANY 0xffffffff #define EXT2_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR #define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| EXT2_FEATURE_INCOMPAT_META_BG) #define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| EXT2_FEATURE_RO_COMPAT_LARGE_FILE| EXT2_FEATURE_RO_COMPAT_BTREE_DIR) #define EXT2_FEATURE_RO_COMPAT_UNSUPPORTED ~EXT2_FEATURE_RO_COMPAT_SUPP #define EXT2_FEATURE_INCOMPAT_UNSUPPORTED ~EXT2_FEATURE_INCOMPAT_SUPP #define EXT2_DEF_RESUID 0 #define EXT2_DEF_RESGID 0 #define EXT2_DEFM_DEBUG 0x0001 #define EXT2_DEFM_BSDGROUPS 0x0002 #define EXT2_DEFM_XATTR_USER 0x0004 #define EXT2_DEFM_ACL 0x0008 #define EXT2_DEFM_UID16 0x0010 #define EXT3_DEFM_JMODE 0x0060 #define EXT3_DEFM_JMODE_DATA 0x0020 #define EXT3_DEFM_JMODE_ORDERED 0x0040 #define EXT3_DEFM_JMODE_WBACK 0x0060 #define EXT2_NAME_LEN 255 struct ext2_dir_entry { __le32 inode; __le16 rec_len; __le16 name_len; char name[EXT2_NAME_LEN]; }; struct ext2_dir_entry_2 { __le32 inode; __le16 rec_len; __u8 name_len; __u8 file_type; char name[EXT2_NAME_LEN]; }; enum { EXT2_FT_UNKNOWN, EXT2_FT_REG_FILE, EXT2_FT_DIR, EXT2_FT_CHRDEV, EXT2_FT_BLKDEV, EXT2_FT_FIFO, EXT2_FT_SOCK, EXT2_FT_SYMLINK, EXT2_FT_MAX }; #define EXT2_DIR_PAD 4 #define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1) #define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & ~EXT2_DIR_ROUND) #endif android-audiosystem-1.8+13.10.20130807/include/linux/utime.h0000644000015700001700000000140712200324306023752 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_UTIME_H #define _LINUX_UTIME_H struct utimbuf { time_t actime; time_t modtime; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/capella_cm3602.h0000644000015700001700000000175012200324306025223 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_CAPELLA_CM3602_H #define __LINUX_CAPELLA_CM3602_H #include #include #define CAPELLA_CM3602_IOCTL_MAGIC 'c' #define CAPELLA_CM3602_IOCTL_GET_ENABLED _IOR(CAPELLA_CM3602_IOCTL_MAGIC, 1, int *) #define CAPELLA_CM3602_IOCTL_ENABLE _IOW(CAPELLA_CM3602_IOCTL_MAGIC, 2, int *) #endif android-audiosystem-1.8+13.10.20130807/include/linux/ioprio.h0000644000015700001700000000247612200324306024137 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef IOPRIO_H #define IOPRIO_H #include #define IOPRIO_BITS (16) #define IOPRIO_CLASS_SHIFT (13) #define IOPRIO_PRIO_MASK ((1UL << IOPRIO_CLASS_SHIFT) - 1) #define IOPRIO_PRIO_CLASS(mask) ((mask) >> IOPRIO_CLASS_SHIFT) #define IOPRIO_PRIO_DATA(mask) ((mask) & IOPRIO_PRIO_MASK) #define IOPRIO_PRIO_VALUE(class, data) (((class) << IOPRIO_CLASS_SHIFT) | data) #define ioprio_valid(mask) (IOPRIO_PRIO_CLASS((mask)) != IOPRIO_CLASS_NONE) enum { IOPRIO_CLASS_NONE, IOPRIO_CLASS_RT, IOPRIO_CLASS_BE, IOPRIO_CLASS_IDLE, }; #define IOPRIO_BE_NR (8) enum { IOPRIO_WHO_PROCESS = 1, IOPRIO_WHO_PGRP, IOPRIO_WHO_USER, }; #define IOPRIO_NORM (4) #endif android-audiosystem-1.8+13.10.20130807/include/linux/pagemap.h0000644000015700001700000000234612200324306024244 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_PAGEMAP_H #define _LINUX_PAGEMAP_H #include #include #include #include #include #include #include #define AS_EIO (__GFP_BITS_SHIFT + 0) #define AS_ENOSPC (__GFP_BITS_SHIFT + 1) #define PAGE_CACHE_SHIFT PAGE_SHIFT #define PAGE_CACHE_SIZE PAGE_SIZE #define PAGE_CACHE_MASK PAGE_MASK #define PAGE_CACHE_ALIGN(addr) (((addr)+PAGE_CACHE_SIZE-1)&PAGE_CACHE_MASK) #define page_cache_get(page) get_page(page) #define page_cache_release(page) put_page(page) #endif android-audiosystem-1.8+13.10.20130807/include/linux/etherdevice.h0000644000015700001700000000146112200324306025116 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ETHERDEVICE_H #define _LINUX_ETHERDEVICE_H #include #include #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/workqueue.h0000644000015700001700000000327012200324306024656 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_WORKQUEUE_H #define _LINUX_WORKQUEUE_H #include #include #include struct workqueue_struct; struct work_struct { unsigned long pending; struct list_head entry; void (*func)(void *); void *data; void *wq_data; struct timer_list timer; }; struct execute_work { struct work_struct work; }; #define __WORK_INITIALIZER(n, f, d) { .entry = { &(n).entry, &(n).entry }, .func = (f), .data = (d), .timer = TIMER_INITIALIZER(NULL, 0, 0), } #define DECLARE_WORK(n, f, d) struct work_struct n = __WORK_INITIALIZER(n, f, d) #define PREPARE_WORK(_work, _func, _data) do { (_work)->func = _func; (_work)->data = _data; } while (0) #define INIT_WORK(_work, _func, _data) do { INIT_LIST_HEAD(&(_work)->entry); (_work)->pending = 0; PREPARE_WORK((_work), (_func), (_data)); init_timer(&(_work)->timer); } while (0) #define create_workqueue(name) __create_workqueue((name), 0) #define create_singlethread_workqueue(name) __create_workqueue((name), 1) #endif android-audiosystem-1.8+13.10.20130807/include/linux/string.h0000644000015700001700000000132512200324306024134 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_STRING_H_ #define _LINUX_STRING_H_ #endif android-audiosystem-1.8+13.10.20130807/include/linux/sunrpc/0000755000015700001700000000000012200324404023765 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/linux/sunrpc/auth_gss.h0000644000015700001700000000134612200324306025760 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SUNRPC_AUTH_GSS_H #define _LINUX_SUNRPC_AUTH_GSS_H #endif android-audiosystem-1.8+13.10.20130807/include/linux/sunrpc/xdr.h0000644000015700001700000000132112200324306024731 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _SUNRPC_XDR_H_ #define _SUNRPC_XDR_H_ #endif android-audiosystem-1.8+13.10.20130807/include/linux/sunrpc/xprt.h0000644000015700001700000001002312200324306025130 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SUNRPC_XPRT_H #define _LINUX_SUNRPC_XPRT_H #include #include #include #include #include #define RPC_MIN_SLOT_TABLE (2U) #define RPC_DEF_SLOT_TABLE (16U) #define RPC_MAX_SLOT_TABLE (128U) #define RPC_CALLHDRSIZE 6 #define RPC_REPHDRSIZE 4 #define RPC_MIN_RESVPORT (1U) #define RPC_MAX_RESVPORT (65535U) #define RPC_DEF_MIN_RESVPORT (665U) #define RPC_DEF_MAX_RESVPORT (1023U) struct rpc_timeout { unsigned long to_initval, to_maxval, to_increment; unsigned int to_retries; unsigned char to_exponential; }; struct rpc_task; struct rpc_xprt; struct seq_file; struct rpc_rqst { struct rpc_xprt * rq_xprt; struct xdr_buf rq_snd_buf; struct xdr_buf rq_rcv_buf; struct rpc_task * rq_task; __u32 rq_xid; int rq_cong; int rq_received; u32 rq_seqno; int rq_enc_pages_num; struct page **rq_enc_pages; void (*rq_release_snd_buf)(struct rpc_rqst *); struct list_head rq_list; __u32 * rq_buffer; size_t rq_bufsize; struct xdr_buf rq_private_buf; unsigned long rq_majortimeo; unsigned long rq_timeout; unsigned int rq_retries; u32 rq_bytes_sent; unsigned long rq_xtime; int rq_ntrans; }; #define rq_svec rq_snd_buf.head #define rq_slen rq_snd_buf.len struct rpc_xprt_ops { void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize); int (*reserve_xprt)(struct rpc_task *task); void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task); void (*set_port)(struct rpc_xprt *xprt, unsigned short port); void (*connect)(struct rpc_task *task); void * (*buf_alloc)(struct rpc_task *task, size_t size); void (*buf_free)(struct rpc_task *task); int (*send_request)(struct rpc_task *task); void (*set_retrans_timeout)(struct rpc_task *task); void (*timer)(struct rpc_task *task); void (*release_request)(struct rpc_task *task); void (*close)(struct rpc_xprt *xprt); void (*destroy)(struct rpc_xprt *xprt); void (*print_stats)(struct rpc_xprt *xprt, struct seq_file *seq); }; struct rpc_xprt { struct rpc_xprt_ops * ops; struct socket * sock; struct sock * inet; struct rpc_timeout timeout; struct sockaddr_in addr; int prot; unsigned long cong; unsigned long cwnd; size_t rcvsize, sndsize; size_t max_payload; unsigned int tsh_size; struct rpc_wait_queue sending; struct rpc_wait_queue resend; struct rpc_wait_queue pending; struct rpc_wait_queue backlog; struct list_head free; struct rpc_rqst * slot; unsigned int max_reqs; unsigned long state; unsigned char shutdown : 1, resvport : 1; __u32 xid; u32 tcp_recm, tcp_xid, tcp_reclen, tcp_offset; unsigned long tcp_copied, tcp_flags; unsigned long connect_timeout, bind_timeout, reestablish_timeout; struct work_struct connect_worker; unsigned short port; struct work_struct task_cleanup; struct timer_list timer; unsigned long last_used, idle_timeout; spinlock_t transport_lock; spinlock_t reserve_lock; struct rpc_task * snd_task; struct list_head recv; struct { unsigned long bind_count, connect_count, connect_start, connect_time, sends, recvs, bad_xids; unsigned long long req_u, bklog_u; } stat; void (*old_data_ready)(struct sock *, int); void (*old_state_change)(struct sock *); void (*old_write_space)(struct sock *); }; #define XPRT_LAST_FRAG (1 << 0) #define XPRT_COPY_RECM (1 << 1) #define XPRT_COPY_XID (1 << 2) #define XPRT_COPY_DATA (1 << 3) #endif android-audiosystem-1.8+13.10.20130807/include/linux/sunrpc/svc.h0000644000015700001700000000424712200324306024741 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef SUNRPC_SVC_H #define SUNRPC_SVC_H #include #include #include #include #include #include struct svc_serv { struct list_head sv_threads; struct list_head sv_sockets; struct svc_program * sv_program; struct svc_stat * sv_stats; spinlock_t sv_lock; unsigned int sv_nrthreads; unsigned int sv_bufsz; unsigned int sv_xdrsize; struct list_head sv_permsocks; struct list_head sv_tempsocks; int sv_tmpcnt; char * sv_name; }; #define RPCSVC_MAXPAYLOAD (64*1024u) #define RPCSVC_MAXPAGES ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 2) struct svc_program { struct svc_program * pg_next; u32 pg_prog; unsigned int pg_lovers; unsigned int pg_hivers; unsigned int pg_nvers; struct svc_version ** pg_vers; char * pg_name; char * pg_class; struct svc_stat * pg_stats; int (*pg_authenticate)(struct svc_rqst *); }; struct svc_version { u32 vs_vers; u32 vs_nproc; struct svc_procedure * vs_proc; u32 vs_xdrsize; int (*vs_dispatch)(struct svc_rqst *, u32 *); }; typedef int (*svc_procfunc)(struct svc_rqst *, void *argp, void *resp); struct svc_procedure { svc_procfunc pc_func; kxdrproc_t pc_decode; kxdrproc_t pc_encode; kxdrproc_t pc_release; unsigned int pc_argsize; unsigned int pc_ressize; unsigned int pc_count; unsigned int pc_cachetype; unsigned int pc_xdrressize; }; typedef void (*svc_thread_fn)(struct svc_rqst *); struct svc_serv * svc_create(struct svc_program *, unsigned int); #endif android-audiosystem-1.8+13.10.20130807/include/linux/sunrpc/debug.h0000644000015700001700000000237512200324306025234 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SUNRPC_DEBUG_H_ #define _LINUX_SUNRPC_DEBUG_H_ #define RPCDBG_XPRT 0x0001 #define RPCDBG_CALL 0x0002 #define RPCDBG_DEBUG 0x0004 #define RPCDBG_NFS 0x0008 #define RPCDBG_AUTH 0x0010 #define RPCDBG_PMAP 0x0020 #define RPCDBG_SCHED 0x0040 #define RPCDBG_TRANS 0x0080 #define RPCDBG_SVCSOCK 0x0100 #define RPCDBG_SVCDSP 0x0200 #define RPCDBG_MISC 0x0400 #define RPCDBG_CACHE 0x0800 #define RPCDBG_ALL 0x7fff #define CTL_SUNRPC 7249 enum { CTL_RPCDEBUG = 1, CTL_NFSDEBUG, CTL_NFSDDEBUG, CTL_NLMDEBUG, CTL_SLOTTABLE_UDP, CTL_SLOTTABLE_TCP, CTL_MIN_RESVPORT, CTL_MAX_RESVPORT, }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/sunrpc/clnt.h0000644000015700001700000000503212200324306025077 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SUNRPC_CLNT_H #define _LINUX_SUNRPC_CLNT_H #include #include #include #include #include #include #include #include struct rpc_portmap { __u32 pm_prog; __u32 pm_vers; __u32 pm_prot; __u16 pm_port; unsigned char pm_binding : 1; struct rpc_wait_queue pm_bindwait; }; struct rpc_inode; struct rpc_clnt { atomic_t cl_count; atomic_t cl_users; struct rpc_xprt * cl_xprt; struct rpc_procinfo * cl_procinfo; u32 cl_maxproc; char * cl_server; char * cl_protname; struct rpc_auth * cl_auth; struct rpc_stat * cl_stats; struct rpc_iostats * cl_metrics; unsigned int cl_softrtry : 1, cl_intr : 1, cl_autobind : 1, cl_oneshot : 1, cl_dead : 1; struct rpc_rtt * cl_rtt; struct rpc_portmap * cl_pmap; int cl_nodelen; char cl_nodename[UNX_MAXNODENAME]; char cl_pathname[30]; struct vfsmount * cl_vfsmnt; struct dentry * cl_dentry; struct rpc_clnt * cl_parent; struct rpc_rtt cl_rtt_default; struct rpc_portmap cl_pmap_default; char cl_inline_name[32]; }; #define cl_timeout cl_xprt->timeout #define cl_prog cl_pmap->pm_prog #define cl_vers cl_pmap->pm_vers #define cl_port cl_pmap->pm_port #define cl_prot cl_pmap->pm_prot #define RPC_MAXVERSION 4 struct rpc_program { char * name; u32 number; unsigned int nrvers; struct rpc_version ** version; struct rpc_stat * stats; char * pipe_dir_name; }; struct rpc_version { u32 number; unsigned int nrprocs; struct rpc_procinfo * procs; }; struct rpc_procinfo { u32 p_proc; kxdrproc_t p_encode; kxdrproc_t p_decode; unsigned int p_bufsiz; unsigned int p_count; unsigned int p_timer; u32 p_statidx; char * p_name; }; #define RPC_CONGESTED(clnt) (RPCXPRT_CONGESTED((clnt)->cl_xprt)) #define RPC_PEERADDR(clnt) (&(clnt)->cl_xprt->addr) #endif android-audiosystem-1.8+13.10.20130807/include/linux/sunrpc/auth.h0000644000015700001700000000133512200324306025102 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SUNRPC_AUTH_H #define _LINUX_SUNRPC_AUTH_H #endif android-audiosystem-1.8+13.10.20130807/include/linux/sunrpc/timer.h0000644000015700001700000000154712200324306025266 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SUNRPC_TIMER_H #define _LINUX_SUNRPC_TIMER_H #include struct rpc_rtt { unsigned long timeo; unsigned long srtt[5]; unsigned long sdrtt[5]; int ntimeouts[5]; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/sunrpc/types.h0000644000015700001700000000157712200324306025315 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SUNRPC_TYPES_H_ #define _LINUX_SUNRPC_TYPES_H_ #include #include #include #include #define signalled() (signal_pending(current)) #endif android-audiosystem-1.8+13.10.20130807/include/linux/sunrpc/gss_api.h0000644000015700001700000000134412200324306025566 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SUNRPC_GSS_API_H #define _LINUX_SUNRPC_GSS_API_H #endif android-audiosystem-1.8+13.10.20130807/include/linux/sunrpc/gss_asn1.h0000644000015700001700000000270112200324306025655 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #include #define SIZEOF_INT 4 #define G_BAD_SERVICE_NAME (-2045022976L) #define G_BAD_STRING_UID (-2045022975L) #define G_NOUSER (-2045022974L) #define G_VALIDATE_FAILED (-2045022973L) #define G_BUFFER_ALLOC (-2045022972L) #define G_BAD_MSG_CTX (-2045022971L) #define G_WRONG_SIZE (-2045022970L) #define G_BAD_USAGE (-2045022969L) #define G_UNKNOWN_QOP (-2045022968L) #define G_NO_HOSTNAME (-2045022967L) #define G_BAD_HOSTNAME (-2045022966L) #define G_WRONG_MECH (-2045022965L) #define G_BAD_TOK_HEADER (-2045022964L) #define G_BAD_DIRECTION (-2045022963L) #define G_TOK_TRUNC (-2045022962L) #define G_REFLECT (-2045022961L) #define G_WRONG_TOKID (-2045022960L) #define g_OID_equal(o1,o2) (((o1)->len == (o2)->len) && (memcmp((o1)->data,(o2)->data,(int) (o1)->len) == 0)) android-audiosystem-1.8+13.10.20130807/include/linux/sunrpc/svcauth.h0000644000015700001700000000134512200324306025617 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SUNRPC_SVCAUTH_H_ #define _LINUX_SUNRPC_SVCAUTH_H_ #endif android-audiosystem-1.8+13.10.20130807/include/linux/sunrpc/gss_err.h0000644000015700001700000000134312200324306025604 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SUNRPC_GSS_ERR_H #define _LINUX_SUNRPC_GSS_ERR_H #endif android-audiosystem-1.8+13.10.20130807/include/linux/sunrpc/sched.h0000644000015700001700000001430612200324306025231 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SUNRPC_SCHED_H_ #define _LINUX_SUNRPC_SCHED_H_ #include #include #include #include #include #include struct rpc_procinfo; struct rpc_message { struct rpc_procinfo * rpc_proc; void * rpc_argp; void * rpc_resp; struct rpc_cred * rpc_cred; }; struct rpc_call_ops; struct rpc_wait_queue; struct rpc_wait { struct list_head list; struct list_head links; struct rpc_wait_queue * rpc_waitq; }; struct rpc_task { #ifdef RPC_DEBUG unsigned long tk_magic; #endif atomic_t tk_count; struct list_head tk_task; struct rpc_clnt * tk_client; struct rpc_rqst * tk_rqstp; int tk_status; struct rpc_message tk_msg; __u8 tk_garb_retry; __u8 tk_cred_retry; unsigned long tk_cookie; void (*tk_timeout_fn)(struct rpc_task *); void (*tk_callback)(struct rpc_task *); void (*tk_action)(struct rpc_task *); const struct rpc_call_ops *tk_ops; void * tk_calldata; struct timer_list tk_timer; unsigned long tk_timeout; unsigned short tk_flags; unsigned char tk_priority : 2; unsigned long tk_runstate; struct workqueue_struct *tk_workqueue; union { struct work_struct tk_work; struct rpc_wait tk_wait; } u; unsigned short tk_timeouts; size_t tk_bytes_sent; unsigned long tk_start; long tk_rtt; #ifdef RPC_DEBUG unsigned short tk_pid; #endif }; #define tk_auth tk_client->cl_auth #define tk_xprt tk_client->cl_xprt #define task_for_each(task, pos, head) list_for_each(pos, head) if ((task=list_entry(pos, struct rpc_task, u.tk_wait.list)),1) #define task_for_first(task, head) if (!list_empty(head) && ((task=list_entry((head)->next, struct rpc_task, u.tk_wait.list)),1)) #define alltask_for_each(task, pos, head) list_for_each(pos, head) if ((task=list_entry(pos, struct rpc_task, tk_task)),1) typedef void (*rpc_action)(struct rpc_task *); struct rpc_call_ops { void (*rpc_call_prepare)(struct rpc_task *, void *); void (*rpc_call_done)(struct rpc_task *, void *); void (*rpc_release)(void *); }; #define RPC_TASK_ASYNC 0x0001 #define RPC_TASK_SWAPPER 0x0002 #define RPC_TASK_CHILD 0x0008 #define RPC_CALL_MAJORSEEN 0x0020 #define RPC_TASK_ROOTCREDS 0x0040 #define RPC_TASK_DYNAMIC 0x0080 #define RPC_TASK_KILLED 0x0100 #define RPC_TASK_SOFT 0x0200 #define RPC_TASK_NOINTR 0x0400 #define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) #define RPC_IS_CHILD(t) ((t)->tk_flags & RPC_TASK_CHILD) #define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) #define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS) #define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) #define RPC_DO_CALLBACK(t) ((t)->tk_callback != NULL) #define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT) #define RPC_TASK_UNINTERRUPTIBLE(t) ((t)->tk_flags & RPC_TASK_NOINTR) #define RPC_TASK_RUNNING 0 #define RPC_TASK_QUEUED 1 #define RPC_TASK_WAKEUP 2 #define RPC_TASK_HAS_TIMER 3 #define RPC_TASK_ACTIVE 4 #define RPC_IS_RUNNING(t) (test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)) #define rpc_set_running(t) (set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)) #define rpc_test_and_set_running(t) (test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)) #define rpc_clear_running(t) do { smp_mb__before_clear_bit(); clear_bit(RPC_TASK_RUNNING, &(t)->tk_runstate); smp_mb__after_clear_bit(); } while (0) #define RPC_IS_QUEUED(t) (test_bit(RPC_TASK_QUEUED, &(t)->tk_runstate)) #define rpc_set_queued(t) (set_bit(RPC_TASK_QUEUED, &(t)->tk_runstate)) #define rpc_clear_queued(t) do { smp_mb__before_clear_bit(); clear_bit(RPC_TASK_QUEUED, &(t)->tk_runstate); smp_mb__after_clear_bit(); } while (0) #define rpc_start_wakeup(t) (test_and_set_bit(RPC_TASK_WAKEUP, &(t)->tk_runstate) == 0) #define rpc_finish_wakeup(t) do { smp_mb__before_clear_bit(); clear_bit(RPC_TASK_WAKEUP, &(t)->tk_runstate); smp_mb__after_clear_bit(); } while (0) #define RPC_IS_ACTIVATED(t) (test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate)) #define rpc_set_active(t) (set_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate)) #define rpc_clear_active(t) do { smp_mb__before_clear_bit(); clear_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate); smp_mb__after_clear_bit(); } while(0) #define RPC_PRIORITY_LOW 0 #define RPC_PRIORITY_NORMAL 1 #define RPC_PRIORITY_HIGH 2 #define RPC_NR_PRIORITY (RPC_PRIORITY_HIGH+1) struct rpc_wait_queue { spinlock_t lock; struct list_head tasks[RPC_NR_PRIORITY]; unsigned long cookie; unsigned char maxpriority; unsigned char priority; unsigned char count; unsigned char nr; unsigned short qlen; #ifdef RPC_DEBUG const char * name; #endif }; #define RPC_BATCH_COUNT 16 #ifndef RPC_DEBUG #define RPC_WAITQ_INIT(var,qname) { .lock = SPIN_LOCK_UNLOCKED, .tasks = { [0] = LIST_HEAD_INIT(var.tasks[0]), [1] = LIST_HEAD_INIT(var.tasks[1]), [2] = LIST_HEAD_INIT(var.tasks[2]), }, } #else #define RPC_WAITQ_INIT(var,qname) { .lock = SPIN_LOCK_UNLOCKED, .tasks = { [0] = LIST_HEAD_INIT(var.tasks[0]), [1] = LIST_HEAD_INIT(var.tasks[1]), [2] = LIST_HEAD_INIT(var.tasks[2]), }, .name = qname, } #endif #define RPC_WAITQ(var,qname) struct rpc_wait_queue var = RPC_WAITQ_INIT(var,qname) #define RPC_IS_PRIORITY(q) ((q)->maxpriority > 0) struct rpc_task *rpc_new_task(struct rpc_clnt *, int flags, const struct rpc_call_ops *ops, void *data); struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags, const struct rpc_call_ops *ops, void *data); struct rpc_task *rpc_new_child(struct rpc_clnt *, struct rpc_task *parent); struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *); #ifdef RPC_DEBUG #endif #ifdef RPC_DEBUG #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/sunrpc/stats.h0000644000015700001700000000222712200324306025300 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SUNRPC_STATS_H #define _LINUX_SUNRPC_STATS_H #include struct rpc_stat { struct rpc_program * program; unsigned int netcnt, netudpcnt, nettcpcnt, nettcpconn, netreconn; unsigned int rpccnt, rpcretrans, rpcauthrefresh, rpcgarbage; }; struct svc_stat { struct svc_program * program; unsigned int netcnt, netudpcnt, nettcpcnt, nettcpconn; unsigned int rpccnt, rpcbadfmt, rpcbadauth, rpcbadclnt; }; #ifdef MODULE #endif #define proc_net_rpc NULL #endif android-audiosystem-1.8+13.10.20130807/include/linux/sunrpc/msg_prot.h0000644000015700001700000000134512200324306025774 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SUNRPC_MSGPROT_H_ #define _LINUX_SUNRPC_MSGPROT_H_ #endif android-audiosystem-1.8+13.10.20130807/include/linux/loop.h0000644000015700001700000000375712200324306023612 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_LOOP_H #define _LINUX_LOOP_H #define LO_NAME_SIZE 64 #define LO_KEY_SIZE 32 enum { LO_FLAGS_READ_ONLY = 1, LO_FLAGS_USE_AOPS = 2, }; #include #include struct loop_info { int lo_number; __kernel_old_dev_t lo_device; unsigned long lo_inode; __kernel_old_dev_t lo_rdevice; int lo_offset; int lo_encrypt_type; int lo_encrypt_key_size; int lo_flags; char lo_name[LO_NAME_SIZE]; unsigned char lo_encrypt_key[LO_KEY_SIZE]; unsigned long lo_init[2]; char reserved[4]; }; struct loop_info64 { __u64 lo_device; __u64 lo_inode; __u64 lo_rdevice; __u64 lo_offset; __u64 lo_sizelimit; __u32 lo_number; __u32 lo_encrypt_type; __u32 lo_encrypt_key_size; __u32 lo_flags; __u8 lo_file_name[LO_NAME_SIZE]; __u8 lo_crypt_name[LO_NAME_SIZE]; __u8 lo_encrypt_key[LO_KEY_SIZE]; __u64 lo_init[2]; }; #define LO_CRYPT_NONE 0 #define LO_CRYPT_XOR 1 #define LO_CRYPT_DES 2 #define LO_CRYPT_FISH2 3 #define LO_CRYPT_BLOW 4 #define LO_CRYPT_CAST128 5 #define LO_CRYPT_IDEA 6 #define LO_CRYPT_DUMMY 9 #define LO_CRYPT_SKIPJACK 10 #define LO_CRYPT_CRYPTOAPI 18 #define MAX_LO_CRYPT 20 #define LOOP_SET_FD 0x4C00 #define LOOP_CLR_FD 0x4C01 #define LOOP_SET_STATUS 0x4C02 #define LOOP_GET_STATUS 0x4C03 #define LOOP_SET_STATUS64 0x4C04 #define LOOP_GET_STATUS64 0x4C05 #define LOOP_CHANGE_FD 0x4C06 #endif android-audiosystem-1.8+13.10.20130807/include/linux/timex.h0000644000015700001700000000526012200324306023756 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_TIMEX_H #define _LINUX_TIMEX_H #include #include #include #define SHIFT_KG 6 #define SHIFT_KF 16 #define SHIFT_KH 2 #define MAXTC 6 #define SHIFT_SCALE 22 #define SHIFT_UPDATE (SHIFT_KG + MAXTC) #define SHIFT_USEC 16 #define FINENSEC (1L << (SHIFT_SCALE - 10)) #define MAXPHASE 512000L #define MAXFREQ (512L << SHIFT_USEC) #define MINSEC 16L #define MAXSEC 1200L #define NTP_PHASE_LIMIT (MAXPHASE << 5) struct timex { unsigned int modes; long offset; long freq; long maxerror; long esterror; int status; long constant; long precision; long tolerance; struct timeval time; long tick; long ppsfreq; long jitter; int shift; long stabil; long jitcnt; long calcnt; long errcnt; long stbcnt; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; }; #define ADJ_OFFSET 0x0001 #define ADJ_FREQUENCY 0x0002 #define ADJ_MAXERROR 0x0004 #define ADJ_ESTERROR 0x0008 #define ADJ_STATUS 0x0010 #define ADJ_TIMECONST 0x0020 #define ADJ_TICK 0x4000 #define ADJ_OFFSET_SINGLESHOT 0x8001 #define MOD_OFFSET ADJ_OFFSET #define MOD_FREQUENCY ADJ_FREQUENCY #define MOD_MAXERROR ADJ_MAXERROR #define MOD_ESTERROR ADJ_ESTERROR #define MOD_STATUS ADJ_STATUS #define MOD_TIMECONST ADJ_TIMECONST #define MOD_CLKB ADJ_TICK #define MOD_CLKA ADJ_OFFSET_SINGLESHOT #define STA_PLL 0x0001 #define STA_PPSFREQ 0x0002 #define STA_PPSTIME 0x0004 #define STA_FLL 0x0008 #define STA_INS 0x0010 #define STA_DEL 0x0020 #define STA_UNSYNC 0x0040 #define STA_FREQHOLD 0x0080 #define STA_PPSSIGNAL 0x0100 #define STA_PPSJITTER 0x0200 #define STA_PPSWANDER 0x0400 #define STA_PPSERROR 0x0800 #define STA_CLOCKERR 0x1000 #define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | STA_PPSERROR | STA_CLOCKERR) #define TIME_OK 0 #define TIME_INS 1 #define TIME_DEL 2 #define TIME_OOP 3 #define TIME_WAIT 4 #define TIME_ERROR 5 #define TIME_BAD TIME_ERROR #endif android-audiosystem-1.8+13.10.20130807/include/linux/msm_vidc_dec.h0000644000015700001700000003102512200324306025242 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _MSM_VIDC_DEC_H_ #define _MSM_VIDC_DEC_H_ #include #include #define VDEC_S_BASE 0x40000000 #define VDEC_S_SUCCESS (VDEC_S_BASE) #define VDEC_S_EFAIL (VDEC_S_BASE + 1) #define VDEC_S_EFATAL (VDEC_S_BASE + 2) #define VDEC_S_EBADPARAM (VDEC_S_BASE + 3) #define VDEC_S_EINVALSTATE (VDEC_S_BASE + 4) #define VDEC_S_ENOSWRES (VDEC_S_BASE + 5) #define VDEC_S_ENOHWRES (VDEC_S_BASE + 6) #define VDEC_S_EINVALCMD (VDEC_S_BASE + 7) #define VDEC_S_ETIMEOUT (VDEC_S_BASE + 8) #define VDEC_S_ENOPREREQ (VDEC_S_BASE + 9) #define VDEC_S_ECMDQFULL (VDEC_S_BASE + 10) #define VDEC_S_ENOTSUPP (VDEC_S_BASE + 11) #define VDEC_S_ENOTIMPL (VDEC_S_BASE + 12) #define VDEC_S_BUSY (VDEC_S_BASE + 13) #define VDEC_INTF_VER 1 #define VDEC_MSG_BASE 0x0000000 #define VDEC_MSG_INVALID (VDEC_MSG_BASE + 0) #define VDEC_MSG_RESP_INPUT_BUFFER_DONE (VDEC_MSG_BASE + 1) #define VDEC_MSG_RESP_OUTPUT_BUFFER_DONE (VDEC_MSG_BASE + 2) #define VDEC_MSG_RESP_INPUT_FLUSHED (VDEC_MSG_BASE + 3) #define VDEC_MSG_RESP_OUTPUT_FLUSHED (VDEC_MSG_BASE + 4) #define VDEC_MSG_RESP_FLUSH_INPUT_DONE (VDEC_MSG_BASE + 5) #define VDEC_MSG_RESP_FLUSH_OUTPUT_DONE (VDEC_MSG_BASE + 6) #define VDEC_MSG_RESP_START_DONE (VDEC_MSG_BASE + 7) #define VDEC_MSG_RESP_STOP_DONE (VDEC_MSG_BASE + 8) #define VDEC_MSG_RESP_PAUSE_DONE (VDEC_MSG_BASE + 9) #define VDEC_MSG_RESP_RESUME_DONE (VDEC_MSG_BASE + 10) #define VDEC_MSG_RESP_RESOURCE_LOADED (VDEC_MSG_BASE + 11) #define VDEC_EVT_RESOURCES_LOST (VDEC_MSG_BASE + 12) #define VDEC_MSG_EVT_CONFIG_CHANGED (VDEC_MSG_BASE + 13) #define VDEC_MSG_EVT_HW_ERROR (VDEC_MSG_BASE + 14) #define VDEC_BUFFERFLAG_EOS 0x00000001 #define VDEC_BUFFERFLAG_DECODEONLY 0x00000004 #define VDEC_BUFFERFLAG_DATACORRUPT 0x00000008 #define VDEC_BUFFERFLAG_ENDOFFRAME 0x00000010 #define VDEC_BUFFERFLAG_SYNCFRAME 0x00000020 #define VDEC_BUFFERFLAG_EXTRADATA 0x00000040 #define VDEC_BUFFERFLAG_CODECCONFIG 0x00000080 #define VDEC_EXTRADATA_QP 0x00000001 #define VDEC_EXTRADATA_SEI 0x00000002 #define VDEC_EXTRADATA_VUI 0x00000004 #define VDEC_EXTRADATA_MB_ERROR_MAP 0x00000008 #define VDEC_CMDBASE 0x800 #define VDEC_CMD_SET_INTF_VERSION (VDEC_CMDBASE) #define VDEC_IOCTL_MAGIC 'v' struct vdec_ioctl_msg { void *inputparam; void *outputparam; }; #define VDEC_IOCTL_GET_PROFILE_LEVEL_SUPPORTED _IOWR(VDEC_IOCTL_MAGIC, 0, struct vdec_ioctl_msg) #define VDEC_IOCTL_GET_INTERLACE_FORMAT _IOR(VDEC_IOCTL_MAGIC, 1, struct vdec_ioctl_msg) #define VDEC_IOCTL_GET_CURRENT_PROFILE_LEVEL _IOWR(VDEC_IOCTL_MAGIC, 2, struct vdec_ioctl_msg) #define VDEC_IOCTL_SET_OUTPUT_FORMAT _IOWR(VDEC_IOCTL_MAGIC, 3, struct vdec_ioctl_msg) #define VDEC_IOCTL_GET_OUTPUT_FORMAT _IOWR(VDEC_IOCTL_MAGIC, 4, struct vdec_ioctl_msg) #define VDEC_IOCTL_SET_CODEC _IOW(VDEC_IOCTL_MAGIC, 5, struct vdec_ioctl_msg) #define VDEC_IOCTL_GET_CODEC _IOR(VDEC_IOCTL_MAGIC, 6, struct vdec_ioctl_msg) #define VDEC_IOCTL_SET_PICRES _IOW(VDEC_IOCTL_MAGIC, 7, struct vdec_ioctl_msg) #define VDEC_IOCTL_GET_PICRES _IOR(VDEC_IOCTL_MAGIC, 8, struct vdec_ioctl_msg) #define VDEC_IOCTL_SET_EXTRADATA _IOW(VDEC_IOCTL_MAGIC, 9, struct vdec_ioctl_msg) #define VDEC_IOCTL_GET_EXTRADATA _IOR(VDEC_IOCTL_MAGIC, 10, struct vdec_ioctl_msg) #define VDEC_IOCTL_SET_SEQUENCE_HEADER _IOW(VDEC_IOCTL_MAGIC, 11, struct vdec_ioctl_msg) #define VDEC_IOCTL_SET_BUFFER_REQ _IOW(VDEC_IOCTL_MAGIC, 12, struct vdec_ioctl_msg) #define VDEC_IOCTL_GET_BUFFER_REQ _IOR(VDEC_IOCTL_MAGIC, 13, struct vdec_ioctl_msg) #define VDEC_IOCTL_ALLOCATE_BUFFER _IOWR(VDEC_IOCTL_MAGIC, 14, struct vdec_ioctl_msg) #define VDEC_IOCTL_FREE_BUFFER _IOW(VDEC_IOCTL_MAGIC, 15, struct vdec_ioctl_msg) #define VDEC_IOCTL_SET_BUFFER _IOW(VDEC_IOCTL_MAGIC, 16, struct vdec_ioctl_msg) #define VDEC_IOCTL_FILL_OUTPUT_BUFFER _IOW(VDEC_IOCTL_MAGIC, 17, struct vdec_ioctl_msg) #define VDEC_IOCTL_DECODE_FRAME _IOW(VDEC_IOCTL_MAGIC, 18, struct vdec_ioctl_msg) #define VDEC_IOCTL_LOAD_RESOURCES _IO(VDEC_IOCTL_MAGIC, 19) #define VDEC_IOCTL_CMD_START _IO(VDEC_IOCTL_MAGIC, 20) #define VDEC_IOCTL_CMD_STOP _IO(VDEC_IOCTL_MAGIC, 21) #define VDEC_IOCTL_CMD_PAUSE _IO(VDEC_IOCTL_MAGIC, 22) #define VDEC_IOCTL_CMD_RESUME _IO(VDEC_IOCTL_MAGIC, 23) #define VDEC_IOCTL_CMD_FLUSH _IOW(VDEC_IOCTL_MAGIC, 24, struct vdec_ioctl_msg) #define VDEC_IOCTL_GET_NEXT_MSG _IOR(VDEC_IOCTL_MAGIC, 25, struct vdec_ioctl_msg) #define VDEC_IOCTL_STOP_NEXT_MSG _IO(VDEC_IOCTL_MAGIC, 26) #define VDEC_IOCTL_GET_NUMBER_INSTANCES _IOR(VDEC_IOCTL_MAGIC, 27, struct vdec_ioctl_msg) enum vdec_picture { PICTURE_TYPE_I, PICTURE_TYPE_P, PICTURE_TYPE_B, PICTURE_TYPE_BI, PICTURE_TYPE_SKIP, PICTURE_TYPE_UNKNOWN }; enum vdec_buffer { VDEC_BUFFER_TYPE_INPUT, VDEC_BUFFER_TYPE_OUTPUT }; struct vdec_allocatorproperty { enum vdec_buffer buffer_type; uint32_t mincount; uint32_t maxcount; uint32_t actualcount; uint32_t buffer_size; uint32_t alignment; uint32_t buf_poolid; }; struct vdec_bufferpayload { uint8_t *bufferaddr; uint32_t buffer_len; int pmem_fd; uint32_t offset; uint32_t mmaped_size; }; struct vdec_setbuffer_cmd { enum vdec_buffer buffer_type; struct vdec_bufferpayload buffer; }; struct vdec_fillbuffer_cmd { struct vdec_bufferpayload buffer; void *client_data; }; enum vdec_bufferflush { VDEC_FLUSH_TYPE_INPUT, VDEC_FLUSH_TYPE_OUTPUT, VDEC_FLUSH_TYPE_ALL }; enum vdec_codec { VDEC_CODECTYPE_H264 = 0x1, VDEC_CODECTYPE_H263 = 0x2, VDEC_CODECTYPE_MPEG4 = 0x3, VDEC_CODECTYPE_DIVX_3 = 0x4, VDEC_CODECTYPE_DIVX_4 = 0x5, VDEC_CODECTYPE_DIVX_5 = 0x6, VDEC_CODECTYPE_DIVX_6 = 0x7, VDEC_CODECTYPE_XVID = 0x8, VDEC_CODECTYPE_MPEG1 = 0x9, VDEC_CODECTYPE_MPEG2 = 0xa, VDEC_CODECTYPE_VC1 = 0xb, VDEC_CODECTYPE_VC1_RCV = 0xc }; enum vdec_mpeg2_profile { VDEC_MPEG2ProfileSimple = 0x1, VDEC_MPEG2ProfileMain = 0x2, VDEC_MPEG2Profile422 = 0x4, VDEC_MPEG2ProfileSNR = 0x8, VDEC_MPEG2ProfileSpatial = 0x10, VDEC_MPEG2ProfileHigh = 0x20, VDEC_MPEG2ProfileKhronosExtensions = 0x6F000000, VDEC_MPEG2ProfileVendorStartUnused = 0x7F000000, VDEC_MPEG2ProfileMax = 0x7FFFFFFF }; enum vdec_mpeg2_level { VDEC_MPEG2LevelLL = 0x1, VDEC_MPEG2LevelML = 0x2, VDEC_MPEG2LevelH14 = 0x4, VDEC_MPEG2LevelHL = 0x8, VDEC_MPEG2LevelKhronosExtensions = 0x6F000000, VDEC_MPEG2LevelVendorStartUnused = 0x7F000000, VDEC_MPEG2LevelMax = 0x7FFFFFFF }; enum vdec_mpeg4_profile { VDEC_MPEG4ProfileSimple = 0x01, VDEC_MPEG4ProfileSimpleScalable = 0x02, VDEC_MPEG4ProfileCore = 0x04, VDEC_MPEG4ProfileMain = 0x08, VDEC_MPEG4ProfileNbit = 0x10, VDEC_MPEG4ProfileScalableTexture = 0x20, VDEC_MPEG4ProfileSimpleFace = 0x40, VDEC_MPEG4ProfileSimpleFBA = 0x80, VDEC_MPEG4ProfileBasicAnimated = 0x100, VDEC_MPEG4ProfileHybrid = 0x200, VDEC_MPEG4ProfileAdvancedRealTime = 0x400, VDEC_MPEG4ProfileCoreScalable = 0x800, VDEC_MPEG4ProfileAdvancedCoding = 0x1000, VDEC_MPEG4ProfileAdvancedCore = 0x2000, VDEC_MPEG4ProfileAdvancedScalable = 0x4000, VDEC_MPEG4ProfileAdvancedSimple = 0x8000, VDEC_MPEG4ProfileKhronosExtensions = 0x6F000000, VDEC_MPEG4ProfileVendorStartUnused = 0x7F000000, VDEC_MPEG4ProfileMax = 0x7FFFFFFF }; enum vdec_mpeg4_level { VDEC_MPEG4Level0 = 0x01, VDEC_MPEG4Level0b = 0x02, VDEC_MPEG4Level1 = 0x04, VDEC_MPEG4Level2 = 0x08, VDEC_MPEG4Level3 = 0x10, VDEC_MPEG4Level4 = 0x20, VDEC_MPEG4Level4a = 0x40, VDEC_MPEG4Level5 = 0x80, VDEC_MPEG4LevelKhronosExtensions = 0x6F000000, VDEC_MPEG4LevelVendorStartUnused = 0x7F000000, VDEC_MPEG4LevelMax = 0x7FFFFFFF }; enum vdec_avc_profile { VDEC_AVCProfileBaseline = 0x01, VDEC_AVCProfileMain = 0x02, VDEC_AVCProfileExtended = 0x04, VDEC_AVCProfileHigh = 0x08, VDEC_AVCProfileHigh10 = 0x10, VDEC_AVCProfileHigh422 = 0x20, VDEC_AVCProfileHigh444 = 0x40, VDEC_AVCProfileKhronosExtensions = 0x6F000000, VDEC_AVCProfileVendorStartUnused = 0x7F000000, VDEC_AVCProfileMax = 0x7FFFFFFF }; enum vdec_avc_level { VDEC_AVCLevel1 = 0x01, VDEC_AVCLevel1b = 0x02, VDEC_AVCLevel11 = 0x04, VDEC_AVCLevel12 = 0x08, VDEC_AVCLevel13 = 0x10, VDEC_AVCLevel2 = 0x20, VDEC_AVCLevel21 = 0x40, VDEC_AVCLevel22 = 0x80, VDEC_AVCLevel3 = 0x100, VDEC_AVCLevel31 = 0x200, VDEC_AVCLevel32 = 0x400, VDEC_AVCLevel4 = 0x800, VDEC_AVCLevel41 = 0x1000, VDEC_AVCLevel42 = 0x2000, VDEC_AVCLevel5 = 0x4000, VDEC_AVCLevel51 = 0x8000, VDEC_AVCLevelKhronosExtensions = 0x6F000000, VDEC_AVCLevelVendorStartUnused = 0x7F000000, VDEC_AVCLevelMax = 0x7FFFFFFF }; enum vdec_divx_profile { VDEC_DIVXProfile_qMobile = 0x01, VDEC_DIVXProfile_Mobile = 0x02, VDEC_DIVXProfile_HD = 0x04, VDEC_DIVXProfile_Handheld = 0x08, VDEC_DIVXProfile_Portable = 0x10, VDEC_DIVXProfile_HomeTheater = 0x20 }; enum vdec_xvid_profile { VDEC_XVIDProfile_Simple = 0x1, VDEC_XVIDProfile_Advanced_Realtime_Simple = 0x2, VDEC_XVIDProfile_Advanced_Simple = 0x4 }; enum vdec_xvid_level { VDEC_XVID_LEVEL_S_L0 = 0x1, VDEC_XVID_LEVEL_S_L1 = 0x2, VDEC_XVID_LEVEL_S_L2 = 0x4, VDEC_XVID_LEVEL_S_L3 = 0x8, VDEC_XVID_LEVEL_ARTS_L1 = 0x10, VDEC_XVID_LEVEL_ARTS_L2 = 0x20, VDEC_XVID_LEVEL_ARTS_L3 = 0x40, VDEC_XVID_LEVEL_ARTS_L4 = 0x80, VDEC_XVID_LEVEL_AS_L0 = 0x100, VDEC_XVID_LEVEL_AS_L1 = 0x200, VDEC_XVID_LEVEL_AS_L2 = 0x400, VDEC_XVID_LEVEL_AS_L3 = 0x800, VDEC_XVID_LEVEL_AS_L4 = 0x1000 }; enum vdec_h263profile { VDEC_H263ProfileBaseline = 0x01, VDEC_H263ProfileH320Coding = 0x02, VDEC_H263ProfileBackwardCompatible = 0x04, VDEC_H263ProfileISWV2 = 0x08, VDEC_H263ProfileISWV3 = 0x10, VDEC_H263ProfileHighCompression = 0x20, VDEC_H263ProfileInternet = 0x40, VDEC_H263ProfileInterlace = 0x80, VDEC_H263ProfileHighLatency = 0x100, VDEC_H263ProfileKhronosExtensions = 0x6F000000, VDEC_H263ProfileVendorStartUnused = 0x7F000000, VDEC_H263ProfileMax = 0x7FFFFFFF }; enum vdec_h263level { VDEC_H263Level10 = 0x01, VDEC_H263Level20 = 0x02, VDEC_H263Level30 = 0x04, VDEC_H263Level40 = 0x08, VDEC_H263Level45 = 0x10, VDEC_H263Level50 = 0x20, VDEC_H263Level60 = 0x40, VDEC_H263Level70 = 0x80, VDEC_H263LevelKhronosExtensions = 0x6F000000, VDEC_H263LevelVendorStartUnused = 0x7F000000, VDEC_H263LevelMax = 0x7FFFFFFF }; enum vdec_wmv_format { VDEC_WMVFormatUnused = 0x01, VDEC_WMVFormat7 = 0x02, VDEC_WMVFormat8 = 0x04, VDEC_WMVFormat9 = 0x08, VDEC_WMFFormatKhronosExtensions = 0x6F000000, VDEC_WMFFormatVendorStartUnused = 0x7F000000, VDEC_WMVFormatMax = 0x7FFFFFFF }; enum vdec_vc1_profile { VDEC_VC1ProfileSimple = 0x1, VDEC_VC1ProfileMain = 0x2, VDEC_VC1ProfileAdvanced = 0x4 }; enum vdec_vc1_level { VDEC_VC1_LEVEL_S_Low = 0x1, VDEC_VC1_LEVEL_S_Medium = 0x2, VDEC_VC1_LEVEL_M_Low = 0x4, VDEC_VC1_LEVEL_M_Medium = 0x8, VDEC_VC1_LEVEL_M_High = 0x10, VDEC_VC1_LEVEL_A_L0 = 0x20, VDEC_VC1_LEVEL_A_L1 = 0x40, VDEC_VC1_LEVEL_A_L2 = 0x80, VDEC_VC1_LEVEL_A_L3 = 0x100, VDEC_VC1_LEVEL_A_L4 = 0x200 }; struct vdec_profile_level { uint32_t profiles; uint32_t levels; }; enum vdec_interlaced_format { VDEC_InterlaceFrameProgressive = 0x1, VDEC_InterlaceInterleaveFrameTopFieldFirst = 0x2, VDEC_InterlaceInterleaveFrameBottomFieldFirst = 0x4 }; enum vdec_output_fromat { VDEC_YUV_FORMAT_NV12 = 0x1, VDEC_YUV_FORMAT_TILE_4x2 = 0x2 }; struct vdec_picsize { uint32_t frame_width; uint32_t frame_height; uint32_t stride; uint32_t scan_lines; }; struct vdec_seqheader { uint8_t *ptr_seqheader; uint32_t seq_header_len; int pmem_fd; uint32_t pmem_offset; }; struct vdec_mberror { uint8_t *ptr_errormap; uint32_t err_mapsize; }; struct vdec_input_frameinfo { uint8_t *bufferaddr; uint32_t offset; uint32_t datalen; uint32_t flags; int64_t timestamp; void *client_data; int pmem_fd; uint32_t pmem_offset; }; struct vdec_framesize { uint32_t left; uint32_t top; uint32_t right; uint32_t bottom; }; struct vdec_output_frameinfo { uint8_t *phy_addr; uint8_t *bufferaddr; uint32_t offset; uint32_t len; uint32_t flags; int64_t time_stamp; void *client_data; void *input_frame_clientdata; struct vdec_framesize framesize; }; union vdec_msgdata { struct vdec_output_frameinfo output_frame; void *input_frame_clientdata; }; struct vdec_msginfo { uint32_t status_code; uint32_t msgcode; union vdec_msgdata msgdata; uint32_t msgdatasize; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/hardirq.h0000644000015700001700000000472712200324306024271 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef LINUX_HARDIRQ_H #define LINUX_HARDIRQ_H #include #include #include #include #include #define PREEMPT_BITS 8 #define SOFTIRQ_BITS 8 #ifndef HARDIRQ_BITS #define HARDIRQ_BITS 12 #if 1 << HARDIRQ_BITS < NR_IRQS #error HARDIRQ_BITS is too low! #endif #endif #define PREEMPT_SHIFT 0 #define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) #define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) #define __IRQ_MASK(x) ((1UL << (x))-1) #define PREEMPT_MASK (__IRQ_MASK(PREEMPT_BITS) << PREEMPT_SHIFT) #define SOFTIRQ_MASK (__IRQ_MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT) #define HARDIRQ_MASK (__IRQ_MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT) #define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT) #define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT) #define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) #if PREEMPT_ACTIVE < 1 << HARDIRQ_SHIFT + HARDIRQ_BITS #error PREEMPT_ACTIVE is too low! #endif #define hardirq_count() (preempt_count() & HARDIRQ_MASK) #define softirq_count() (preempt_count() & SOFTIRQ_MASK) #define irq_count() (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK)) #define in_irq() (hardirq_count()) #define in_softirq() (softirq_count()) #define in_interrupt() (irq_count()) #define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0) #define preemptible() 0 #define IRQ_EXIT_OFFSET HARDIRQ_OFFSET #define synchronize_irq(irq) barrier() struct task_struct; #define irq_enter() do { account_system_vtime(current); add_preempt_count(HARDIRQ_OFFSET); trace_hardirq_enter(); } while (0) #define __irq_exit() do { trace_hardirq_exit(); account_system_vtime(current); sub_preempt_count(HARDIRQ_OFFSET); } while (0) #define nmi_enter() do { lockdep_off(); irq_enter(); } while (0) #define nmi_exit() do { __irq_exit(); lockdep_on(); } while (0) #endif android-audiosystem-1.8+13.10.20130807/include/linux/qic117.h0000644000015700001700000001757212200324306023646 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _QIC117_H #define _QIC117_H typedef enum { QIC_NO_COMMAND = 0, QIC_RESET = 1, QIC_REPORT_NEXT_BIT = 2, QIC_PAUSE = 3, QIC_MICRO_STEP_PAUSE = 4, QIC_ALTERNATE_TIMEOUT = 5, QIC_REPORT_DRIVE_STATUS = 6, QIC_REPORT_ERROR_CODE = 7, QIC_REPORT_DRIVE_CONFIGURATION = 8, QIC_REPORT_ROM_VERSION = 9, QIC_LOGICAL_FORWARD = 10, QIC_PHYSICAL_REVERSE = 11, QIC_PHYSICAL_FORWARD = 12, QIC_SEEK_HEAD_TO_TRACK = 13, QIC_SEEK_LOAD_POINT = 14, QIC_ENTER_FORMAT_MODE = 15, QIC_WRITE_REFERENCE_BURST = 16, QIC_ENTER_VERIFY_MODE = 17, QIC_STOP_TAPE = 18, QIC_MICRO_STEP_HEAD_UP = 21, QIC_MICRO_STEP_HEAD_DOWN = 22, QIC_SOFT_SELECT = 23, QIC_SOFT_DESELECT = 24, QIC_SKIP_REVERSE = 25, QIC_SKIP_FORWARD = 26, QIC_SELECT_RATE = 27, QIC_ENTER_DIAGNOSTIC_1 = 28, QIC_ENTER_DIAGNOSTIC_2 = 29, QIC_ENTER_PRIMARY_MODE = 30, QIC_REPORT_VENDOR_ID = 32, QIC_REPORT_TAPE_STATUS = 33, QIC_SKIP_EXTENDED_REVERSE = 34, QIC_SKIP_EXTENDED_FORWARD = 35, QIC_CALIBRATE_TAPE_LENGTH = 36, QIC_REPORT_FORMAT_SEGMENTS = 37, QIC_SET_FORMAT_SEGMENTS = 38, QIC_PHANTOM_SELECT = 46, QIC_PHANTOM_DESELECT = 47 } qic117_cmd_t; typedef enum { discretional = 0, required, ccs1, ccs2 } qic_compatibility; typedef enum { unused, mode, motion, report } command_types; struct qic117_command_table { char *name; __u8 mask; __u8 state; __u8 cmd_type; __u8 non_intr; __u8 level; }; #define QIC117_COMMANDS { {NULL, 0x00, 0x00, mode, 0, discretional}, {"soft reset", 0x00, 0x00, motion, 1, required}, {"report next bit", 0x00, 0x00, report, 0, required}, {"pause", 0x36, 0x24, motion, 1, required}, {"micro step pause", 0x36, 0x24, motion, 1, required}, {"alternate command timeout", 0x00, 0x00, mode, 0, required}, {"report drive status", 0x00, 0x00, report, 0, required}, {"report error code", 0x01, 0x01, report, 0, required}, {"report drive configuration",0x00, 0x00, report, 0, required}, {"report rom version", 0x00, 0x00, report, 0, required}, {"logical forward", 0x37, 0x25, motion, 0, required}, {"physical reverse", 0x17, 0x05, motion, 0, required}, {"physical forward", 0x17, 0x05, motion, 0, required}, {"seek head to track", 0x37, 0x25, motion, 0, required}, {"seek load point", 0x17, 0x05, motion, 1, required}, {"enter format mode", 0x1f, 0x05, mode, 0, required}, {"write reference burst", 0x1f, 0x05, motion, 1, required}, {"enter verify mode", 0x37, 0x25, mode, 0, required}, {"stop tape", 0x00, 0x00, motion, 1, required}, {"reserved (19)", 0x00, 0x00, unused, 0, discretional}, {"reserved (20)", 0x00, 0x00, unused, 0, discretional}, {"micro step head up", 0x02, 0x00, motion, 0, required}, {"micro step head down", 0x02, 0x00, motion, 0, required}, {"soft select", 0x00, 0x00, mode, 0, discretional}, {"soft deselect", 0x00, 0x00, mode, 0, discretional}, {"skip segments reverse", 0x36, 0x24, motion, 1, required}, {"skip segments forward", 0x36, 0x24, motion, 1, required}, {"select rate or format", 0x03, 0x01, mode, 0, required }, {"enter diag mode 1", 0x00, 0x00, mode, 0, discretional}, {"enter diag mode 2", 0x00, 0x00, mode, 0, discretional}, {"enter primary mode", 0x00, 0x00, mode, 0, required}, {"vendor unique (31)", 0x00, 0x00, unused, 0, discretional}, {"report vendor id", 0x00, 0x00, report, 0, required}, {"report tape status", 0x04, 0x04, report, 0, ccs1}, {"skip extended reverse", 0x36, 0x24, motion, 1, ccs1}, {"skip extended forward", 0x36, 0x24, motion, 1, ccs1}, {"calibrate tape length", 0x17, 0x05, motion, 1, ccs2}, {"report format segments", 0x17, 0x05, report, 0, ccs2}, {"set format segments", 0x17, 0x05, mode, 0, ccs2}, {"reserved (39)", 0x00, 0x00, unused, 0, discretional}, {"vendor unique (40)", 0x00, 0x00, unused, 0, discretional}, {"vendor unique (41)", 0x00, 0x00, unused, 0, discretional}, {"vendor unique (42)", 0x00, 0x00, unused, 0, discretional}, {"vendor unique (43)", 0x00, 0x00, unused, 0, discretional}, {"vendor unique (44)", 0x00, 0x00, unused, 0, discretional}, {"vendor unique (45)", 0x00, 0x00, unused, 0, discretional}, {"phantom select", 0x00, 0x00, mode, 0, discretional}, {"phantom deselect", 0x00, 0x00, mode, 0, discretional}, } #define QIC_STATUS_READY 0x01 #define QIC_STATUS_ERROR 0x02 #define QIC_STATUS_CARTRIDGE_PRESENT 0x04 #define QIC_STATUS_WRITE_PROTECT 0x08 #define QIC_STATUS_NEW_CARTRIDGE 0x10 #define QIC_STATUS_REFERENCED 0x20 #define QIC_STATUS_AT_BOT 0x40 #define QIC_STATUS_AT_EOT 0x80 #define QIC_CONFIG_RATE_MASK 0x18 #define QIC_CONFIG_RATE_SHIFT 3 #define QIC_CONFIG_RATE_250 0 #define QIC_CONFIG_RATE_500 2 #define QIC_CONFIG_RATE_1000 3 #define QIC_CONFIG_RATE_2000 1 #define QIC_CONFIG_RATE_4000 0 #define QIC_CONFIG_LONG 0x40 #define QIC_CONFIG_80 0x80 #define QIC_TAPE_STD_MASK 0x0f #define QIC_TAPE_QIC40 0x01 #define QIC_TAPE_QIC80 0x02 #define QIC_TAPE_QIC3020 0x03 #define QIC_TAPE_QIC3010 0x04 #define QIC_TAPE_LEN_MASK 0x70 #define QIC_TAPE_205FT 0x10 #define QIC_TAPE_307FT 0x20 #define QIC_TAPE_VARIABLE 0x30 #define QIC_TAPE_1100FT 0x40 #define QIC_TAPE_FLEX 0x60 #define QIC_TAPE_WIDE 0x80 #define QIC_TOP_TAPE_LEN 1500 typedef struct { char *message; unsigned int fatal:1; } ftape_error; #define QIC117_ERRORS { { "No error", 0, }, { "Command Received while Drive Not Ready", 0, }, { "Cartridge Not Present or Removed", 1, }, { "Motor Speed Error (not within 1%)", 1, }, { "Motor Speed Fault (jammed, or gross speed error", 1, }, { "Cartridge Write Protected", 1, }, { "Undefined or Reserved Command Code", 1, }, { "Illegal Track Address Specified for Seek", 1, }, { "Illegal Command in Report Subcontext", 0, }, { "Illegal Entry into a Diagnostic Mode", 1, }, { "Broken Tape Detected (based on hole sensor)", 1, }, { "Warning--Read Gain Setting Error", 1, }, { "Command Received While Error Status Pending (obs)", 1, }, { "Command Received While New Cartridge Pending", 1, }, { "Command Illegal or Undefined in Primary Mode", 1, }, { "Command Illegal or Undefined in Format Mode", 1, }, { "Command Illegal or Undefined in Verify Mode", 1, }, { "Logical Forward Not at Logical BOT or no Format Segments in Format Mode", 1, }, { "Logical EOT Before All Segments generated", 1, }, { "Command Illegal When Cartridge Not Referenced", 1, }, { "Self-Diagnostic Failed (cannot be cleared)", 1, }, { "Warning EEPROM Not Initialized, Defaults Set", 1, }, { "EEPROM Corrupted or Hardware Failure", 1, }, { "Motion Time-out Error", 1, }, { "Data Segment Too Long -- Logical Forward or Pause", 1, }, { "Transmit Overrun (obs)", 1, }, { "Power On Reset Occurred", 0, }, { "Software Reset Occurred", 0, }, { "Diagnostic Mode 1 Error", 1, }, { "Diagnostic Mode 2 Error", 1, }, { "Command Received During Non-Interruptible Process", 1, }, { "Rate or Format Selection Error", 1, }, { "Illegal Command While in High Speed Mode", 1, }, { "Illegal Seek Segment Value", 1, }, { "Invalid Media", 1, }, { "Head Positioning Failure", 1, }, { "Write Reference Burst Failure", 1, }, { "Prom Code Missing", 1, }, { "Invalid Format", 1, }, { "EOT/BOT System Failure", 1, }, { "Prom A Checksum Error", 1, }, { "Drive Wakeup Reset Occurred", 1, }, { "Prom B Checksum Error", 1, }, { "Illegal Entry into Format Mode", 1, }, } #endif android-audiosystem-1.8+13.10.20130807/include/linux/utsname.h0000644000015700001700000000220712200324306024302 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_UTSNAME_H #define _LINUX_UTSNAME_H #define __OLD_UTS_LEN 8 struct oldold_utsname { char sysname[9]; char nodename[9]; char release[9]; char version[9]; char machine[9]; }; #define __NEW_UTS_LEN 64 struct old_utsname { char sysname[65]; char nodename[65]; char release[65]; char version[65]; char machine[65]; }; struct new_utsname { char sysname[65]; char nodename[65]; char release[65]; char version[65]; char machine[65]; char domainname[65]; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/pm.h0000644000015700001700000000131312200324306023237 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_PM_H #define _LINUX_PM_H #endif android-audiosystem-1.8+13.10.20130807/include/linux/if.h0000644000015700001700000001115412200324306023225 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IF_H #define _LINUX_IF_H #include #include #include #define IFNAMSIZ 16 #define IFALIASZ 256 #include #define IFF_UP 0x1 #define IFF_BROADCAST 0x2 #define IFF_DEBUG 0x4 #define IFF_LOOPBACK 0x8 #define IFF_POINTOPOINT 0x10 #define IFF_NOTRAILERS 0x20 #define IFF_RUNNING 0x40 #define IFF_NOARP 0x80 #define IFF_PROMISC 0x100 #define IFF_ALLMULTI 0x200 #define IFF_MASTER 0x400 #define IFF_SLAVE 0x800 #define IFF_MULTICAST 0x1000 #define IFF_PORTSEL 0x2000 #define IFF_AUTOMEDIA 0x4000 #define IFF_DYNAMIC 0x8000 #define IFF_LOWER_UP 0x10000 #define IFF_DORMANT 0x20000 #define IFF_ECHO 0x40000 #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO| IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) #define IFF_802_1Q_VLAN 0x1 #define IFF_EBRIDGE 0x2 #define IFF_SLAVE_INACTIVE 0x4 #define IFF_MASTER_8023AD 0x8 #define IFF_MASTER_ALB 0x10 #define IFF_BONDING 0x20 #define IFF_SLAVE_NEEDARP 0x40 #define IFF_ISATAP 0x80 #define IFF_MASTER_ARPMON 0x100 #define IFF_WAN_HDLC 0x200 #define IFF_XMIT_DST_RELEASE 0x400 #define IFF_DONT_BRIDGE 0x800 #define IFF_IN_NETPOLL 0x1000 #define IFF_DISABLE_NETPOLL 0x2000 #define IF_GET_IFACE 0x0001 #define IF_GET_PROTO 0x0002 #define IF_IFACE_V35 0x1000 #define IF_IFACE_V24 0x1001 #define IF_IFACE_X21 0x1002 #define IF_IFACE_T1 0x1003 #define IF_IFACE_E1 0x1004 #define IF_IFACE_SYNC_SERIAL 0x1005 #define IF_IFACE_X21D 0x1006 #define IF_PROTO_HDLC 0x2000 #define IF_PROTO_PPP 0x2001 #define IF_PROTO_CISCO 0x2002 #define IF_PROTO_FR 0x2003 #define IF_PROTO_FR_ADD_PVC 0x2004 #define IF_PROTO_FR_DEL_PVC 0x2005 #define IF_PROTO_X25 0x2006 #define IF_PROTO_HDLC_ETH 0x2007 #define IF_PROTO_FR_ADD_ETH_PVC 0x2008 #define IF_PROTO_FR_DEL_ETH_PVC 0x2009 #define IF_PROTO_FR_PVC 0x200A #define IF_PROTO_FR_ETH_PVC 0x200B #define IF_PROTO_RAW 0x200C enum { IF_OPER_UNKNOWN, IF_OPER_NOTPRESENT, IF_OPER_DOWN, IF_OPER_LOWERLAYERDOWN, IF_OPER_TESTING, IF_OPER_DORMANT, IF_OPER_UP, }; enum { IF_LINK_MODE_DEFAULT, IF_LINK_MODE_DORMANT, }; struct ifmap { unsigned long mem_start; unsigned long mem_end; unsigned short base_addr; unsigned char irq; unsigned char dma; unsigned char port; }; struct if_settings { unsigned int type; unsigned int size; union { raw_hdlc_proto __user *raw_hdlc; cisco_proto __user *cisco; fr_proto __user *fr; fr_proto_pvc __user *fr_pvc; fr_proto_pvc_info __user *fr_pvc_info; sync_serial_settings __user *sync; te1_settings __user *te1; } ifs_ifsu; }; struct ifreq { #define IFHWADDRLEN 6 union { char ifrn_name[IFNAMSIZ]; } ifr_ifrn; union { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; short ifru_flags; int ifru_ivalue; int ifru_mtu; struct ifmap ifru_map; char ifru_slave[IFNAMSIZ]; char ifru_newname[IFNAMSIZ]; void __user * ifru_data; struct if_settings ifru_settings; } ifr_ifru; }; #define ifr_name ifr_ifrn.ifrn_name #define ifr_hwaddr ifr_ifru.ifru_hwaddr #define ifr_addr ifr_ifru.ifru_addr #define ifr_dstaddr ifr_ifru.ifru_dstaddr #define ifr_broadaddr ifr_ifru.ifru_broadaddr #define ifr_netmask ifr_ifru.ifru_netmask #define ifr_flags ifr_ifru.ifru_flags #define ifr_metric ifr_ifru.ifru_ivalue #define ifr_mtu ifr_ifru.ifru_mtu #define ifr_map ifr_ifru.ifru_map #define ifr_slave ifr_ifru.ifru_slave #define ifr_data ifr_ifru.ifru_data #define ifr_ifindex ifr_ifru.ifru_ivalue #define ifr_bandwidth ifr_ifru.ifru_ivalue #define ifr_qlen ifr_ifru.ifru_ivalue #define ifr_newname ifr_ifru.ifru_newname #define ifr_settings ifr_ifru.ifru_settings struct ifconf { int ifc_len; union { char __user *ifcu_buf; struct ifreq __user *ifcu_req; } ifc_ifcu; }; #define ifc_buf ifc_ifcu.ifcu_buf #define ifc_req ifc_ifcu.ifcu_req #endif android-audiosystem-1.8+13.10.20130807/include/linux/spinlock_types.h0000644000015700001700000000310712200324306025674 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_SPINLOCK_TYPES_H #define __LINUX_SPINLOCK_TYPES_H #include #include typedef struct { raw_spinlock_t raw_lock; } spinlock_t; #define SPINLOCK_MAGIC 0xdead4ead typedef struct { raw_rwlock_t raw_lock; } rwlock_t; #define RWLOCK_MAGIC 0xdeaf1eed #define SPINLOCK_OWNER_INIT ((void *)-1L) #define SPIN_DEP_MAP_INIT(lockname) #define RW_DEP_MAP_INIT(lockname) #define __SPIN_LOCK_UNLOCKED(lockname) (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, SPIN_DEP_MAP_INIT(lockname) } #define __RW_LOCK_UNLOCKED(lockname) (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, RW_DEP_MAP_INIT(lockname) } #define SPIN_LOCK_UNLOCKED __SPIN_LOCK_UNLOCKED(old_style_spin_init) #define RW_LOCK_UNLOCKED __RW_LOCK_UNLOCKED(old_style_rw_init) #define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x) #define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x) #endif android-audiosystem-1.8+13.10.20130807/include/linux/ftape.h0000644000015700001700000000271712200324306023733 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _FTAPE_H #define _FTAPE_H #define FTAPE_VERSION "ftape v3.04d 25/11/97" #include #include #define FT_SECTOR(x) (x+1) #define FT_SECTOR_SIZE 1024 #define FT_SECTORS_PER_SEGMENT 32 #define FT_ECC_SECTORS 3 #define FT_SEGMENT_SIZE ((FT_SECTORS_PER_SEGMENT - FT_ECC_SECTORS) * FT_SECTOR_SIZE) #define FT_BUFF_SIZE (FT_SECTORS_PER_SEGMENT * FT_SECTOR_SIZE) #define FTAPE_SEL_A 0 #define FTAPE_SEL_B 1 #define FTAPE_SEL_C 2 #define FTAPE_SEL_D 3 #define FTAPE_SEL_MASK 3 #define FTAPE_SEL(unit) ((unit) & FTAPE_SEL_MASK) #define FTAPE_NO_REWIND 4 typedef union { struct { __u8 error; __u8 command; } error; long space; } ft_drive_error; typedef union { struct { __u8 drive_status; __u8 drive_config; __u8 tape_status; } status; long space; } ft_drive_status; #endif android-audiosystem-1.8+13.10.20130807/include/linux/version.h0000644000015700001700000000137412200324306024317 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #define LINUX_VERSION_CODE 132626 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) android-audiosystem-1.8+13.10.20130807/include/linux/sysdev.h0000644000015700001700000000400012200324306024134 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _SYSDEV_H_ #define _SYSDEV_H_ #include #include struct sys_device; struct sysdev_class { struct list_head drivers; int (*shutdown)(struct sys_device *); int (*suspend)(struct sys_device *, pm_message_t state); int (*resume)(struct sys_device *); struct kset kset; }; struct sysdev_class_attribute { struct attribute attr; ssize_t (*show)(struct sysdev_class *, char *); ssize_t (*store)(struct sysdev_class *, const char *, size_t); }; #define SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) struct sysdev_class_attribute attr_##_name = { .attr = {.name = __stringify(_name), .mode = _mode }, .show = _show, .store = _store, }; struct sysdev_driver { struct list_head entry; int (*add)(struct sys_device *); int (*remove)(struct sys_device *); int (*shutdown)(struct sys_device *); int (*suspend)(struct sys_device *, pm_message_t state); int (*resume)(struct sys_device *); }; struct sys_device { u32 id; struct sysdev_class * cls; struct kobject kobj; }; struct sysdev_attribute { struct attribute attr; ssize_t (*show)(struct sys_device *, char *); ssize_t (*store)(struct sys_device *, const char *, size_t); }; #define SYSDEV_ATTR(_name,_mode,_show,_store) struct sysdev_attribute attr_##_name = { .attr = {.name = __stringify(_name), .mode = _mode }, .show = _show, .store = _store, }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/ata.h0000644000015700001700000001471412200324306023401 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_ATA_H__ #define __LINUX_ATA_H__ #include #define ATA_DMA_BOUNDARY 0xffffUL #define ATA_DMA_MASK 0xffffffffULL enum { ATA_MAX_DEVICES = 2, ATA_MAX_PRD = 256, ATA_SECT_SIZE = 512, ATA_ID_WORDS = 256, ATA_ID_SERNO_OFS = 10, ATA_ID_FW_REV_OFS = 23, ATA_ID_PROD_OFS = 27, ATA_ID_OLD_PIO_MODES = 51, ATA_ID_FIELD_VALID = 53, ATA_ID_MWDMA_MODES = 63, ATA_ID_PIO_MODES = 64, ATA_ID_EIDE_DMA_MIN = 65, ATA_ID_EIDE_PIO = 67, ATA_ID_EIDE_PIO_IORDY = 68, ATA_ID_UDMA_MODES = 88, ATA_ID_MAJOR_VER = 80, ATA_ID_PIO4 = (1 << 1), ATA_PCI_CTL_OFS = 2, ATA_SERNO_LEN = 20, ATA_UDMA0 = (1 << 0), ATA_UDMA1 = ATA_UDMA0 | (1 << 1), ATA_UDMA2 = ATA_UDMA1 | (1 << 2), ATA_UDMA3 = ATA_UDMA2 | (1 << 3), ATA_UDMA4 = ATA_UDMA3 | (1 << 4), ATA_UDMA5 = ATA_UDMA4 | (1 << 5), ATA_UDMA6 = ATA_UDMA5 | (1 << 6), ATA_UDMA7 = ATA_UDMA6 | (1 << 7), ATA_UDMA_MASK_40C = ATA_UDMA2, ATA_PRD_SZ = 8, ATA_PRD_TBL_SZ = (ATA_MAX_PRD * ATA_PRD_SZ), ATA_PRD_EOT = (1 << 31), ATA_DMA_TABLE_OFS = 4, ATA_DMA_STATUS = 2, ATA_DMA_CMD = 0, ATA_DMA_WR = (1 << 3), ATA_DMA_START = (1 << 0), ATA_DMA_INTR = (1 << 2), ATA_DMA_ERR = (1 << 1), ATA_DMA_ACTIVE = (1 << 0), ATA_HOB = (1 << 7), ATA_NIEN = (1 << 1), ATA_LBA = (1 << 6), ATA_DEV1 = (1 << 4), ATA_DEVICE_OBS = (1 << 7) | (1 << 5), ATA_DEVCTL_OBS = (1 << 3), ATA_BUSY = (1 << 7), ATA_DRDY = (1 << 6), ATA_DF = (1 << 5), ATA_DRQ = (1 << 3), ATA_ERR = (1 << 0), ATA_SRST = (1 << 2), ATA_ICRC = (1 << 7), ATA_UNC = (1 << 6), ATA_IDNF = (1 << 4), ATA_ABORTED = (1 << 2), ATA_REG_DATA = 0x00, ATA_REG_ERR = 0x01, ATA_REG_NSECT = 0x02, ATA_REG_LBAL = 0x03, ATA_REG_LBAM = 0x04, ATA_REG_LBAH = 0x05, ATA_REG_DEVICE = 0x06, ATA_REG_STATUS = 0x07, ATA_REG_FEATURE = ATA_REG_ERR, ATA_REG_CMD = ATA_REG_STATUS, ATA_REG_BYTEL = ATA_REG_LBAM, ATA_REG_BYTEH = ATA_REG_LBAH, ATA_REG_DEVSEL = ATA_REG_DEVICE, ATA_REG_IRQ = ATA_REG_NSECT, ATA_CMD_CHK_POWER = 0xE5, ATA_CMD_STANDBY = 0xE2, ATA_CMD_IDLE = 0xE3, ATA_CMD_EDD = 0x90, ATA_CMD_FLUSH = 0xE7, ATA_CMD_FLUSH_EXT = 0xEA, ATA_CMD_ID_ATA = 0xEC, ATA_CMD_ID_ATAPI = 0xA1, ATA_CMD_READ = 0xC8, ATA_CMD_READ_EXT = 0x25, ATA_CMD_WRITE = 0xCA, ATA_CMD_WRITE_EXT = 0x35, ATA_CMD_WRITE_FUA_EXT = 0x3D, ATA_CMD_FPDMA_READ = 0x60, ATA_CMD_FPDMA_WRITE = 0x61, ATA_CMD_PIO_READ = 0x20, ATA_CMD_PIO_READ_EXT = 0x24, ATA_CMD_PIO_WRITE = 0x30, ATA_CMD_PIO_WRITE_EXT = 0x34, ATA_CMD_READ_MULTI = 0xC4, ATA_CMD_READ_MULTI_EXT = 0x29, ATA_CMD_WRITE_MULTI = 0xC5, ATA_CMD_WRITE_MULTI_EXT = 0x39, ATA_CMD_WRITE_MULTI_FUA_EXT = 0xCE, ATA_CMD_SET_FEATURES = 0xEF, ATA_CMD_PACKET = 0xA0, ATA_CMD_VERIFY = 0x40, ATA_CMD_VERIFY_EXT = 0x42, ATA_CMD_STANDBYNOW1 = 0xE0, ATA_CMD_IDLEIMMEDIATE = 0xE1, ATA_CMD_INIT_DEV_PARAMS = 0x91, ATA_CMD_READ_NATIVE_MAX = 0xF8, ATA_CMD_READ_NATIVE_MAX_EXT = 0x27, ATA_CMD_READ_LOG_EXT = 0x2f, ATA_LOG_SATA_NCQ = 0x10, SETFEATURES_XFER = 0x03, XFER_UDMA_7 = 0x47, XFER_UDMA_6 = 0x46, XFER_UDMA_5 = 0x45, XFER_UDMA_4 = 0x44, XFER_UDMA_3 = 0x43, XFER_UDMA_2 = 0x42, XFER_UDMA_1 = 0x41, XFER_UDMA_0 = 0x40, XFER_MW_DMA_2 = 0x22, XFER_MW_DMA_1 = 0x21, XFER_MW_DMA_0 = 0x20, XFER_SW_DMA_2 = 0x12, XFER_SW_DMA_1 = 0x11, XFER_SW_DMA_0 = 0x10, XFER_PIO_4 = 0x0C, XFER_PIO_3 = 0x0B, XFER_PIO_2 = 0x0A, XFER_PIO_1 = 0x09, XFER_PIO_0 = 0x08, XFER_PIO_SLOW = 0x00, SETFEATURES_WC_ON = 0x02, SETFEATURES_WC_OFF = 0x82, ATAPI_PKT_DMA = (1 << 0), ATAPI_DMADIR = (1 << 2), ATAPI_CDB_LEN = 16, ATA_CBL_NONE = 0, ATA_CBL_PATA40 = 1, ATA_CBL_PATA80 = 2, ATA_CBL_PATA_UNK = 3, ATA_CBL_SATA = 4, SCR_STATUS = 0, SCR_ERROR = 1, SCR_CONTROL = 2, SCR_ACTIVE = 3, SCR_NOTIFICATION = 4, SERR_DATA_RECOVERED = (1 << 0), SERR_COMM_RECOVERED = (1 << 1), SERR_DATA = (1 << 8), SERR_PERSISTENT = (1 << 9), SERR_PROTOCOL = (1 << 10), SERR_INTERNAL = (1 << 11), SERR_PHYRDY_CHG = (1 << 16), SERR_DEV_XCHG = (1 << 26), ATA_TFLAG_LBA48 = (1 << 0), ATA_TFLAG_ISADDR = (1 << 1), ATA_TFLAG_DEVICE = (1 << 2), ATA_TFLAG_WRITE = (1 << 3), ATA_TFLAG_LBA = (1 << 4), ATA_TFLAG_FUA = (1 << 5), ATA_TFLAG_POLLING = (1 << 6), }; enum ata_tf_protocols { ATA_PROT_UNKNOWN, ATA_PROT_NODATA, ATA_PROT_PIO, ATA_PROT_DMA, ATA_PROT_NCQ, ATA_PROT_ATAPI, ATA_PROT_ATAPI_NODATA, ATA_PROT_ATAPI_DMA, }; enum ata_ioctls { ATA_IOC_GET_IO32 = 0x309, ATA_IOC_SET_IO32 = 0x324, }; struct ata_prd { u32 addr; u32 flags_len; }; struct ata_taskfile { unsigned long flags; u8 protocol; u8 ctl; u8 hob_feature; u8 hob_nsect; u8 hob_lbal; u8 hob_lbam; u8 hob_lbah; u8 feature; u8 nsect; u8 lbal; u8 lbam; u8 lbah; u8 device; u8 command; }; #define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) #define ata_id_is_cfa(id) ((id)[0] == 0x848A) #define ata_id_is_sata(id) ((id)[93] == 0) #define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) #define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) #define ata_id_hpa_enabled(id) ((id)[85] & (1 << 10)) #define ata_id_has_fua(id) ((id)[84] & (1 << 6)) #define ata_id_has_flush(id) ((id)[83] & (1 << 12)) #define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13)) #define ata_id_has_lba48(id) ((id)[83] & (1 << 10)) #define ata_id_has_hpa(id) ((id)[82] & (1 << 10)) #define ata_id_has_wcache(id) ((id)[82] & (1 << 5)) #define ata_id_has_pm(id) ((id)[82] & (1 << 3)) #define ata_id_has_lba(id) ((id)[49] & (1 << 9)) #define ata_id_has_dma(id) ((id)[49] & (1 << 8)) #define ata_id_has_ncq(id) ((id)[76] & (1 << 8)) #define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1) #define ata_id_removeable(id) ((id)[0] & (1 << 7)) #define ata_id_has_dword_io(id) ((id)[50] & (1 << 0)) #define ata_id_u32(id,n) (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)])) #define ata_id_u64(id,n) ( ((u64) (id)[(n) + 3] << 48) | ((u64) (id)[(n) + 2] << 32) | ((u64) (id)[(n) + 1] << 16) | ((u64) (id)[(n) + 0]) ) #define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20) #endif android-audiosystem-1.8+13.10.20130807/include/linux/icmpv6.h0000644000015700001700000000747712200324306024050 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ICMPV6_H #define _LINUX_ICMPV6_H #include #include struct icmp6hdr { __u8 icmp6_type; __u8 icmp6_code; __sum16 icmp6_cksum; union { __be32 un_data32[1]; __be16 un_data16[2]; __u8 un_data8[4]; struct icmpv6_echo { __be16 identifier; __be16 sequence; } u_echo; struct icmpv6_nd_advt { #ifdef __LITTLE_ENDIAN_BITFIELD __u32 reserved:5, override:1, solicited:1, router:1, reserved2:24; #elif defined(__BIG_ENDIAN_BITFIELD) __u32 router:1, solicited:1, override:1, reserved:29; #else #error "Please fix " #endif } u_nd_advt; struct icmpv6_nd_ra { __u8 hop_limit; #ifdef __LITTLE_ENDIAN_BITFIELD __u8 reserved:3, router_pref:2, home_agent:1, other:1, managed:1; #elif defined(__BIG_ENDIAN_BITFIELD) __u8 managed:1, other:1, home_agent:1, router_pref:2, reserved:3; #else #error "Please fix " #endif __be16 rt_lifetime; } u_nd_ra; } icmp6_dataun; #define icmp6_identifier icmp6_dataun.u_echo.identifier #define icmp6_sequence icmp6_dataun.u_echo.sequence #define icmp6_pointer icmp6_dataun.un_data32[0] #define icmp6_mtu icmp6_dataun.un_data32[0] #define icmp6_unused icmp6_dataun.un_data32[0] #define icmp6_maxdelay icmp6_dataun.un_data16[0] #define icmp6_router icmp6_dataun.u_nd_advt.router #define icmp6_solicited icmp6_dataun.u_nd_advt.solicited #define icmp6_override icmp6_dataun.u_nd_advt.override #define icmp6_ndiscreserved icmp6_dataun.u_nd_advt.reserved #define icmp6_hop_limit icmp6_dataun.u_nd_ra.hop_limit #define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed #define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other #define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime #define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref }; #define ICMPV6_ROUTER_PREF_LOW 0x3 #define ICMPV6_ROUTER_PREF_MEDIUM 0x0 #define ICMPV6_ROUTER_PREF_HIGH 0x1 #define ICMPV6_ROUTER_PREF_INVALID 0x2 #define ICMPV6_DEST_UNREACH 1 #define ICMPV6_PKT_TOOBIG 2 #define ICMPV6_TIME_EXCEED 3 #define ICMPV6_PARAMPROB 4 #define ICMPV6_INFOMSG_MASK 0x80 #define ICMPV6_ECHO_REQUEST 128 #define ICMPV6_ECHO_REPLY 129 #define ICMPV6_MGM_QUERY 130 #define ICMPV6_MGM_REPORT 131 #define ICMPV6_MGM_REDUCTION 132 #define ICMPV6_NI_QUERY 139 #define ICMPV6_NI_REPLY 140 #define ICMPV6_MLD2_REPORT 143 #define ICMPV6_DHAAD_REQUEST 144 #define ICMPV6_DHAAD_REPLY 145 #define ICMPV6_MOBILE_PREFIX_SOL 146 #define ICMPV6_MOBILE_PREFIX_ADV 147 #define ICMPV6_NOROUTE 0 #define ICMPV6_ADM_PROHIBITED 1 #define ICMPV6_NOT_NEIGHBOUR 2 #define ICMPV6_ADDR_UNREACH 3 #define ICMPV6_PORT_UNREACH 4 #define ICMPV6_EXC_HOPLIMIT 0 #define ICMPV6_EXC_FRAGTIME 1 #define ICMPV6_HDR_FIELD 0 #define ICMPV6_UNK_NEXTHDR 1 #define ICMPV6_UNK_OPTION 2 #define ICMPV6_FILTER 1 #define ICMPV6_FILTER_BLOCK 1 #define ICMPV6_FILTER_PASS 2 #define ICMPV6_FILTER_BLOCKOTHERS 3 #define ICMPV6_FILTER_PASSONLY 4 struct icmp6_filter { __u32 data[8]; }; #define MLD2_MODE_IS_INCLUDE 1 #define MLD2_MODE_IS_EXCLUDE 2 #define MLD2_CHANGE_TO_INCLUDE 3 #define MLD2_CHANGE_TO_EXCLUDE 4 #define MLD2_ALLOW_NEW_SOURCES 5 #define MLD2_BLOCK_OLD_SOURCES 6 #define MLD2_ALL_MCR_INIT { { { 0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,0x16 } } } #endif android-audiosystem-1.8+13.10.20130807/include/linux/mutex.h0000644000015700001700000000321512200324306023770 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_MUTEX_H #define __LINUX_MUTEX_H #include #include #include #include #include struct mutex { atomic_t count; spinlock_t wait_lock; struct list_head wait_list; }; struct mutex_waiter { struct list_head list; struct task_struct *task; }; #define __DEBUG_MUTEX_INITIALIZER(lockname) #define mutex_init(mutex) do { static struct lock_class_key __key; __mutex_init((mutex), #mutex, &__key); } while (0) #define mutex_destroy(mutex) do { } while (0) #define __DEP_MAP_MUTEX_INITIALIZER(lockname) #define __MUTEX_INITIALIZER(lockname) { .count = ATOMIC_INIT(1) , .wait_lock = SPIN_LOCK_UNLOCKED , .wait_list = LIST_HEAD_INIT(lockname.wait_list) __DEBUG_MUTEX_INITIALIZER(lockname) __DEP_MAP_MUTEX_INITIALIZER(lockname) } #define DEFINE_MUTEX(mutexname) struct mutex mutexname = __MUTEX_INITIALIZER(mutexname) #define mutex_lock_nested(lock, subclass) mutex_lock(lock) #endif android-audiosystem-1.8+13.10.20130807/include/linux/netdevice.h0000644000015700001700000000345212200324306024577 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_NETDEVICE_H #define _LINUX_NETDEVICE_H #include #include #include #define MAX_ADDR_LEN 32 #define NETDEV_TX_OK 0 #define NETDEV_TX_BUSY 1 #define NETDEV_TX_LOCKED -1 #define LL_MAX_HEADER 32 #define MAX_HEADER LL_MAX_HEADER struct net_device_stats { unsigned long rx_packets; unsigned long tx_packets; unsigned long rx_bytes; unsigned long tx_bytes; unsigned long rx_errors; unsigned long tx_errors; unsigned long rx_dropped; unsigned long tx_dropped; unsigned long multicast; unsigned long collisions; unsigned long rx_length_errors; unsigned long rx_over_errors; unsigned long rx_crc_errors; unsigned long rx_frame_errors; unsigned long rx_fifo_errors; unsigned long rx_missed_errors; unsigned long tx_aborted_errors; unsigned long tx_carrier_errors; unsigned long tx_fifo_errors; unsigned long tx_heartbeat_errors; unsigned long tx_window_errors; unsigned long rx_compressed; unsigned long tx_compressed; }; enum { IF_PORT_UNKNOWN = 0, IF_PORT_10BASE2, IF_PORT_10BASET, IF_PORT_AUI, IF_PORT_100BASET, IF_PORT_100BASETX, IF_PORT_100BASEFX }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/perf_event.h0000644000015700001700000001177212200324306024772 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_PERF_EVENT_H #define _LINUX_PERF_EVENT_H #include #include #include enum perf_type_id { PERF_TYPE_HARDWARE = 0, PERF_TYPE_SOFTWARE = 1, PERF_TYPE_TRACEPOINT = 2, PERF_TYPE_HW_CACHE = 3, PERF_TYPE_RAW = 4, PERF_TYPE_BREAKPOINT = 5, PERF_TYPE_MAX, }; enum perf_hw_id { PERF_COUNT_HW_CPU_CYCLES = 0, PERF_COUNT_HW_INSTRUCTIONS = 1, PERF_COUNT_HW_CACHE_REFERENCES = 2, PERF_COUNT_HW_CACHE_MISSES = 3, PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4, PERF_COUNT_HW_BRANCH_MISSES = 5, PERF_COUNT_HW_BUS_CYCLES = 6, PERF_COUNT_HW_MAX, }; enum perf_hw_cache_id { PERF_COUNT_HW_CACHE_L1D = 0, PERF_COUNT_HW_CACHE_L1I = 1, PERF_COUNT_HW_CACHE_LL = 2, PERF_COUNT_HW_CACHE_DTLB = 3, PERF_COUNT_HW_CACHE_ITLB = 4, PERF_COUNT_HW_CACHE_BPU = 5, PERF_COUNT_HW_CACHE_MAX, }; enum perf_hw_cache_op_id { PERF_COUNT_HW_CACHE_OP_READ = 0, PERF_COUNT_HW_CACHE_OP_WRITE = 1, PERF_COUNT_HW_CACHE_OP_PREFETCH = 2, PERF_COUNT_HW_CACHE_OP_MAX, }; enum perf_hw_cache_op_result_id { PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0, PERF_COUNT_HW_CACHE_RESULT_MISS = 1, PERF_COUNT_HW_CACHE_RESULT_MAX, }; enum perf_sw_ids { PERF_COUNT_SW_CPU_CLOCK = 0, PERF_COUNT_SW_TASK_CLOCK = 1, PERF_COUNT_SW_PAGE_FAULTS = 2, PERF_COUNT_SW_CONTEXT_SWITCHES = 3, PERF_COUNT_SW_CPU_MIGRATIONS = 4, PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, PERF_COUNT_SW_ALIGNMENT_FAULTS = 7, PERF_COUNT_SW_EMULATION_FAULTS = 8, PERF_COUNT_SW_MAX, }; enum perf_event_sample_format { PERF_SAMPLE_IP = 1U << 0, PERF_SAMPLE_TID = 1U << 1, PERF_SAMPLE_TIME = 1U << 2, PERF_SAMPLE_ADDR = 1U << 3, PERF_SAMPLE_READ = 1U << 4, PERF_SAMPLE_CALLCHAIN = 1U << 5, PERF_SAMPLE_ID = 1U << 6, PERF_SAMPLE_CPU = 1U << 7, PERF_SAMPLE_PERIOD = 1U << 8, PERF_SAMPLE_STREAM_ID = 1U << 9, PERF_SAMPLE_RAW = 1U << 10, PERF_SAMPLE_MAX = 1U << 11, }; enum perf_event_read_format { PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0, PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1, PERF_FORMAT_ID = 1U << 2, PERF_FORMAT_GROUP = 1U << 3, PERF_FORMAT_MAX = 1U << 4, }; #define PERF_ATTR_SIZE_VER0 64 struct perf_event_attr { __u32 type; __u32 size; __u64 config; union { __u64 sample_period; __u64 sample_freq; }; __u64 sample_type; __u64 read_format; __u64 disabled : 1, inherit : 1, pinned : 1, exclusive : 1, exclude_user : 1, exclude_kernel : 1, exclude_hv : 1, exclude_idle : 1, mmap : 1, comm : 1, freq : 1, inherit_stat : 1, enable_on_exec : 1, task : 1, watermark : 1, precise_ip : 2, __reserved_1 : 47; union { __u32 wakeup_events; __u32 wakeup_watermark; }; __u32 bp_type; __u64 bp_addr; __u64 bp_len; }; #define PERF_EVENT_IOC_ENABLE _IO ('$', 0) #define PERF_EVENT_IOC_DISABLE _IO ('$', 1) #define PERF_EVENT_IOC_REFRESH _IO ('$', 2) #define PERF_EVENT_IOC_RESET _IO ('$', 3) #define PERF_EVENT_IOC_PERIOD _IOW('$', 4, __u64) #define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) #define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *) enum perf_event_ioc_flags { PERF_IOC_FLAG_GROUP = 1U << 0, }; struct perf_event_mmap_page { __u32 version; __u32 compat_version; __u32 lock; __u32 index; __s64 offset; __u64 time_enabled; __u64 time_running; __u64 __reserved[123]; __u64 data_head; __u64 data_tail; }; #define PERF_RECORD_MISC_CPUMODE_MASK (7 << 0) #define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0) #define PERF_RECORD_MISC_KERNEL (1 << 0) #define PERF_RECORD_MISC_USER (2 << 0) #define PERF_RECORD_MISC_HYPERVISOR (3 << 0) #define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0) #define PERF_RECORD_MISC_GUEST_USER (5 << 0) #define PERF_RECORD_MISC_EXACT_IP (1 << 14) #define PERF_RECORD_MISC_EXT_RESERVED (1 << 15) struct perf_event_header { __u32 type; __u16 misc; __u16 size; }; enum perf_event_type { PERF_RECORD_MMAP = 1, PERF_RECORD_LOST = 2, PERF_RECORD_COMM = 3, PERF_RECORD_EXIT = 4, PERF_RECORD_THROTTLE = 5, PERF_RECORD_UNTHROTTLE = 6, PERF_RECORD_FORK = 7, PERF_RECORD_READ = 8, PERF_RECORD_SAMPLE = 9, PERF_RECORD_MAX, }; enum perf_callchain_context { PERF_CONTEXT_HV = (__u64)-32, PERF_CONTEXT_KERNEL = (__u64)-128, PERF_CONTEXT_USER = (__u64)-512, PERF_CONTEXT_GUEST = (__u64)-2048, PERF_CONTEXT_GUEST_KERNEL = (__u64)-2176, PERF_CONTEXT_GUEST_USER = (__u64)-2560, PERF_CONTEXT_MAX = (__u64)-4095, }; #define PERF_FLAG_FD_NO_GROUP (1U << 0) #define PERF_FLAG_FD_OUTPUT (1U << 1) #endif android-audiosystem-1.8+13.10.20130807/include/linux/param.h0000644000015700001700000000135112200324306023725 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_PARAM_H #define _LINUX_PARAM_H #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/smb.h0000644000015700001700000000251412200324306023410 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_SMB_H #define _LINUX_SMB_H #include enum smb_protocol { SMB_PROTOCOL_NONE, SMB_PROTOCOL_CORE, SMB_PROTOCOL_COREPLUS, SMB_PROTOCOL_LANMAN1, SMB_PROTOCOL_LANMAN2, SMB_PROTOCOL_NT1 }; enum smb_case_hndl { SMB_CASE_DEFAULT, SMB_CASE_LOWER, SMB_CASE_UPPER }; struct smb_dskattr { __u16 total; __u16 allocblocks; __u16 blocksize; __u16 free; }; struct smb_conn_opt { unsigned int fd; enum smb_protocol protocol; enum smb_case_hndl case_handling; __u32 max_xmit; __u16 server_uid; __u16 tid; __u16 secmode; __u16 maxmux; __u16 maxvcs; __u16 rawmode; __u32 sesskey; __u32 maxraw; __u32 capabilities; __s16 serverzone; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/l3g4200d.h0000644000015700001700000000207712200324306023772 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __L3G4200D_H__ #define __L3G4200D_H__ #include #define L3G4200D_NAME "l3g4200d" #define L3G4200D_IOCTL_BASE 77 #define L3G4200D_IOCTL_SET_DELAY _IOW(L3G4200D_IOCTL_BASE, 0, int) #define L3G4200D_IOCTL_GET_DELAY _IOR(L3G4200D_IOCTL_BASE, 1, int) #define L3G4200D_IOCTL_SET_ENABLE _IOW(L3G4200D_IOCTL_BASE, 2, int) #define L3G4200D_IOCTL_GET_ENABLE _IOR(L3G4200D_IOCTL_BASE, 3, int) #endif android-audiosystem-1.8+13.10.20130807/include/linux/mt9t013.h0000644000015700001700000000667712200324306023766 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef CAMERA_MT9T013_H #define CAMERA_MT9T013_H #include #include #include #include #define MT9T013_I2C_IOCTL_MAGIC 'm' #define MT9T013_I2C_IOCTL_W _IOW(MT9T013_I2C_IOCTL_MAGIC, 0, unsigned) #define MT9T013_I2C_IOCTL_R _IOR(MT9T013_I2C_IOCTL_MAGIC, 1, unsigned) #define MT9T013_I2C_IOCTL_AF_W _IOW(MT9T013_I2C_IOCTL_MAGIC, 2, unsigned) #define MT9T013_I2C_IOCTL_CAMIF_PAD_REG_RESET _IO(MT9T013_I2C_IOCTL_MAGIC, 3) #define MT9T013_I2C_IOCTL_CAMIF_PAD_REG_RESET_2 _IO(MT9T013_I2C_IOCTL_MAGIC, 4) #define CAMERA_CONFIGURE_GPIOS _IO(MT9T013_I2C_IOCTL_MAGIC, 7) #define CAMERA_UNCONFIGURE_GPIOS _IO(MT9T013_I2C_IOCTL_MAGIC, 8) #define CAMERA_LENS_POWER_ON _IO(MT9T013_I2C_IOCTL_MAGIC, 9) #define CAMERA_LENS_POWER_OFF _IO(MT9T013_I2C_IOCTL_MAGIC, 10) #define MT9T013_I2C_IOCTL_CAMIF_APPS_RESET _IO(MT9T013_I2C_IOCTL_MAGIC, 11) #define CAMIO_VFE_MDC_CLK 1 #define CAMIO_MDC_CLK 2 #define CAMIO_VFE_CLK 3 #define MT9T013_I2C_IOCTL_CLK_ENABLE _IOW(MT9T013_I2C_IOCTL_MAGIC, 12, unsigned) #define MT9T013_I2C_IOCTL_CLK_DISABLE _IOW(MT9T013_I2C_IOCTL_MAGIC, 13, unsigned) #define MT9T013_I2C_IOCTL_CLK_SELECT _IOW(MT9T013_I2C_IOCTL_MAGIC, 14, unsigned) #define MT9T013_I2C_IOCTL_CLK_FREQ_PROG _IOW(MT9T013_I2C_IOCTL_MAGIC, 15, unsigned) #define CAMSENSOR_REG_INIT 0<<0 #define CAMSENSOR_REG_UPDATE_PERIODIC 1<<0 #define CAMSENSOR_TYPE_PREVIEW 0<<1 #define CAMSENSOR_TYPE_SNAPSHOT 1<<1 #define MT9T013_I2C_IOCTL_SENSOR_SETTING _IOW(MT9T013_I2C_IOCTL_MAGIC, 16, uint32_t) struct mt9t013_reg_struct { uint16_t vt_pix_clk_div; uint16_t vt_sys_clk_div; uint16_t pre_pll_clk_div; uint16_t pll_multiplier; uint16_t op_pix_clk_div; uint16_t op_sys_clk_div; uint16_t scale_m; uint16_t row_speed; uint16_t x_addr_start; uint16_t x_addr_end; uint16_t y_addr_start; uint16_t y_addr_end; uint16_t read_mode; uint16_t x_output_size ; uint16_t y_output_size; uint16_t line_length_pck; uint16_t frame_length_lines; uint16_t coarse_integration_time; uint16_t fine_integration_time; }; struct mt9t013_reg_pat { struct mt9t013_reg_struct reg[2]; }; #define MT9T013_I2C_IOCTL_GET_REGISTERS _IOR(MT9T013_I2C_IOCTL_MAGIC, 17, struct mt9t013_reg_pat *) struct mt9t013_exposure_gain { uint16_t gain; uint16_t line; uint32_t mode; }; #define MT9T013_I2C_IOCTL_EXPOSURE_GAIN _IOW(MT9T013_I2C_IOCTL_MAGIC, 18, struct exposure_gain *) #define MT9T013_I2C_IOCTL_MOVE_FOCUS _IOW(MT9T013_I2C_IOCTL_MAGIC, 19, uint32_t) #define MT9T013_I2C_IOCTL_SET_DEFAULT_FOCUS _IOW(MT9T013_I2C_IOCTL_MAGIC, 20, uint32_t) #define MT9T013_I2C_IOCTL_POWER_DOWN _IO(MT9T013_I2C_IOCTL_MAGIC, 21) struct mt9t013_init { int preview; uint16_t chipid; }; #define MT9T013_I2C_IOCTL_INIT _IOWR(MT9T013_I2C_IOCTL_MAGIC, 22, struct mt9t013_init *) #endif android-audiosystem-1.8+13.10.20130807/include/linux/atmsap.h0000644000015700001700000000507112200324306024115 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_ATMSAP_H #define _LINUX_ATMSAP_H #include #define ATM_L2_NONE 0 #define ATM_L2_ISO1745 0x01 #define ATM_L2_Q291 0x02 #define ATM_L2_X25_LL 0x06 #define ATM_L2_X25_ML 0x07 #define ATM_L2_LAPB 0x08 #define ATM_L2_HDLC_ARM 0x09 #define ATM_L2_HDLC_NRM 0x0a #define ATM_L2_HDLC_ABM 0x0b #define ATM_L2_ISO8802 0x0c #define ATM_L2_X75 0x0d #define ATM_L2_Q922 0x0e #define ATM_L2_USER 0x10 #define ATM_L2_ISO7776 0x11 #define ATM_L3_NONE 0 #define ATM_L3_X25 0x06 #define ATM_L3_ISO8208 0x07 #define ATM_L3_X223 0x08 #define ATM_L3_ISO8473 0x09 #define ATM_L3_T70 0x0a #define ATM_L3_TR9577 0x0b #define ATM_L3_H310 0x0c #define ATM_L3_H321 0x0d #define ATM_L3_USER 0x10 #define ATM_HL_NONE 0 #define ATM_HL_ISO 0x01 #define ATM_HL_USER 0x02 #define ATM_HL_HLP 0x03 #define ATM_HL_VENDOR 0x04 #define ATM_IMD_NONE 0 #define ATM_IMD_NORMAL 1 #define ATM_IMD_EXTENDED 2 #define ATM_TT_NONE 0 #define ATM_TT_RX 1 #define ATM_TT_TX 2 #define ATM_TT_RXTX 3 #define ATM_MC_NONE 0 #define ATM_MC_TS 1 #define ATM_MC_TS_FEC 2 #define ATM_MC_PS 3 #define ATM_MC_PS_FEC 4 #define ATM_MC_H221 5 #define ATM_MAX_HLI 8 struct atm_blli { unsigned char l2_proto; union { struct { unsigned char mode; unsigned char window; } itu; unsigned char user; } l2; unsigned char l3_proto; union { struct { unsigned char mode; unsigned char def_size; unsigned char window; } itu; unsigned char user; struct { unsigned char term_type; unsigned char fw_mpx_cap; unsigned char bw_mpx_cap; } h310; struct { unsigned char ipi; unsigned char snap[5]; } tr9577; } l3; } __ATM_API_ALIGN; struct atm_bhli { unsigned char hl_type; unsigned char hl_length; unsigned char hl_info[ATM_MAX_HLI]; }; #define ATM_MAX_BLLI 3 struct atm_sap { struct atm_bhli bhli; struct atm_blli blli[ATM_MAX_BLLI] __ATM_API_ALIGN; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/key.h0000644000015700001700000000151512200324306023417 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_KEY_H #define _LINUX_KEY_H #include #include #include #include #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/termios.h0000644000015700001700000000141012200324306024303 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_TERMIOS_H #define _LINUX_TERMIOS_H #include #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/moduleparam.h0000644000015700001700000000774512200324306025150 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_MODULE_PARAMS_H #define _LINUX_MODULE_PARAMS_H #include #include #include #ifdef MODULE #define MODULE_PARAM_PREFIX #else #define MODULE_PARAM_PREFIX KBUILD_MODNAME "." #endif #ifdef MODULE #define ___module_cat(a,b) __mod_ ## a ## b #define __module_cat(a,b) ___module_cat(a,b) #define __MODULE_INFO(tag, name, info) static const char __module_cat(name,__LINE__)[] __attribute_used__ __attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info #else #define __MODULE_INFO(tag, name, info) #endif #define __MODULE_PARM_TYPE(name, _type) __MODULE_INFO(parmtype, name##type, #name ":" _type) struct kernel_param; typedef int (*param_set_fn)(const char *val, struct kernel_param *kp); typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp); struct kernel_param { const char *name; unsigned int perm; param_set_fn set; param_get_fn get; void *arg; }; struct kparam_string { unsigned int maxlen; char *string; }; struct kparam_array { unsigned int max; unsigned int *num; param_set_fn set; param_get_fn get; unsigned int elemsize; void *elem; }; #define __module_param_call(prefix, name, set, get, arg, perm) static char __param_str_##name[] = prefix #name; static struct kernel_param const __param_##name __attribute_used__ __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) = { __param_str_##name, perm, set, get, arg } #define module_param_call(name, set, get, arg, perm) __module_param_call(MODULE_PARAM_PREFIX, name, set, get, arg, perm) #define module_param_named(name, value, type, perm) param_check_##type(name, &(value)); module_param_call(name, param_set_##type, param_get_##type, &value, perm); __MODULE_PARM_TYPE(name, #type) #define module_param(name, type, perm) module_param_named(name, name, type, perm) #define module_param_string(name, string, len, perm) static struct kparam_string __param_string_##name = { len, string }; module_param_call(name, param_set_copystring, param_get_string, &__param_string_##name, perm); __MODULE_PARM_TYPE(name, "string") #define __param_check(name, p, type) static inline type *__check_##name(void) { return(p); } #define param_check_byte(name, p) __param_check(name, p, unsigned char) #define param_check_short(name, p) __param_check(name, p, short) #define param_check_ushort(name, p) __param_check(name, p, unsigned short) #define param_check_int(name, p) __param_check(name, p, int) #define param_check_uint(name, p) __param_check(name, p, unsigned int) #define param_check_long(name, p) __param_check(name, p, long) #define param_check_ulong(name, p) __param_check(name, p, unsigned long) #define param_check_charp(name, p) __param_check(name, p, char *) #define param_check_bool(name, p) __param_check(name, p, int) #define param_check_invbool(name, p) __param_check(name, p, int) #define module_param_array_named(name, array, type, nump, perm) static struct kparam_array __param_arr_##name = { ARRAY_SIZE(array), nump, param_set_##type, param_get_##type, sizeof(array[0]), array }; module_param_call(name, param_array_set, param_array_get, &__param_arr_##name, perm); __MODULE_PARM_TYPE(name, "array of " #type) #define module_param_array(name, type, nump, perm) module_param_array_named(name, name, type, nump, perm) struct module; #endif android-audiosystem-1.8+13.10.20130807/include/linux/wait.h0000644000015700001700000000200712200324306023570 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_WAIT_H #define _LINUX_WAIT_H #define WNOHANG 0x00000001 #define WUNTRACED 0x00000002 #define WSTOPPED WUNTRACED #define WEXITED 0x00000004 #define WCONTINUED 0x00000008 #define WNOWAIT 0x01000000 #define __WNOTHREAD 0x20000000 #define __WALL 0x40000000 #define __WCLONE 0x80000000 #define P_ALL 0 #define P_PID 1 #define P_PGID 2 #endif android-audiosystem-1.8+13.10.20130807/include/linux/neighbour.h0000644000015700001700000000503412200324306024611 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef __LINUX_NEIGHBOUR_H #define __LINUX_NEIGHBOUR_H #include #include struct ndmsg { __u8 ndm_family; __u8 ndm_pad1; __u16 ndm_pad2; __s32 ndm_ifindex; __u16 ndm_state; __u8 ndm_flags; __u8 ndm_type; }; enum { NDA_UNSPEC, NDA_DST, NDA_LLADDR, NDA_CACHEINFO, NDA_PROBES, __NDA_MAX }; #define NDA_MAX (__NDA_MAX - 1) #define NTF_USE 0x01 #define NTF_PROXY 0x08 #define NTF_ROUTER 0x80 #define NUD_INCOMPLETE 0x01 #define NUD_REACHABLE 0x02 #define NUD_STALE 0x04 #define NUD_DELAY 0x08 #define NUD_PROBE 0x10 #define NUD_FAILED 0x20 #define NUD_NOARP 0x40 #define NUD_PERMANENT 0x80 #define NUD_NONE 0x00 struct nda_cacheinfo { __u32 ndm_confirmed; __u32 ndm_used; __u32 ndm_updated; __u32 ndm_refcnt; }; struct ndt_stats { __u64 ndts_allocs; __u64 ndts_destroys; __u64 ndts_hash_grows; __u64 ndts_res_failed; __u64 ndts_lookups; __u64 ndts_hits; __u64 ndts_rcv_probes_mcast; __u64 ndts_rcv_probes_ucast; __u64 ndts_periodic_gc_runs; __u64 ndts_forced_gc_runs; }; enum { NDTPA_UNSPEC, NDTPA_IFINDEX, NDTPA_REFCNT, NDTPA_REACHABLE_TIME, NDTPA_BASE_REACHABLE_TIME, NDTPA_RETRANS_TIME, NDTPA_GC_STALETIME, NDTPA_DELAY_PROBE_TIME, NDTPA_QUEUE_LEN, NDTPA_APP_PROBES, NDTPA_UCAST_PROBES, NDTPA_MCAST_PROBES, NDTPA_ANYCAST_DELAY, NDTPA_PROXY_DELAY, NDTPA_PROXY_QLEN, NDTPA_LOCKTIME, __NDTPA_MAX }; #define NDTPA_MAX (__NDTPA_MAX - 1) struct ndtmsg { __u8 ndtm_family; __u8 ndtm_pad1; __u16 ndtm_pad2; }; struct ndt_config { __u16 ndtc_key_len; __u16 ndtc_entry_size; __u32 ndtc_entries; __u32 ndtc_last_flush; __u32 ndtc_last_rand; __u32 ndtc_hash_rnd; __u32 ndtc_hash_mask; __u32 ndtc_hash_chain_gc; __u32 ndtc_proxy_qlen; }; enum { NDTA_UNSPEC, NDTA_NAME, NDTA_THRESH1, NDTA_THRESH2, NDTA_THRESH3, NDTA_CONFIG, NDTA_PARMS, NDTA_STATS, NDTA_GC_INTERVAL, __NDTA_MAX }; #define NDTA_MAX (__NDTA_MAX - 1) #endif android-audiosystem-1.8+13.10.20130807/include/linux/sysfs.h0000644000015700001700000000437512200324306024005 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _SYSFS_H_ #define _SYSFS_H_ #include struct kobject; struct module; struct attribute { const char * name; struct module * owner; mode_t mode; }; struct attribute_group { const char * name; struct attribute ** attrs; }; #define __ATTR(_name,_mode,_show,_store) { .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, .show = _show, .store = _store, } #define __ATTR_RO(_name) { .attr = { .name = __stringify(_name), .mode = 0444, .owner = THIS_MODULE }, .show = _name##_show, } #define __ATTR_NULL { .attr = { .name = NULL } } #define attr_name(_attr) (_attr).attr.name struct vm_area_struct; struct bin_attribute { struct attribute attr; size_t size; void *private; ssize_t (*read)(struct kobject *, char *, loff_t, size_t); ssize_t (*write)(struct kobject *, char *, loff_t, size_t); int (*mmap)(struct kobject *, struct bin_attribute *attr, struct vm_area_struct *vma); }; struct sysfs_ops { ssize_t (*show)(struct kobject *, struct attribute *,char *); ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); }; struct sysfs_dirent { atomic_t s_count; struct list_head s_sibling; struct list_head s_children; void * s_element; int s_type; umode_t s_mode; struct dentry * s_dentry; struct iattr * s_iattr; atomic_t s_event; }; #define SYSFS_ROOT 0x0001 #define SYSFS_DIR 0x0002 #define SYSFS_KOBJ_ATTR 0x0004 #define SYSFS_KOBJ_BIN_ATTR 0x0008 #define SYSFS_KOBJ_DEVICE 0x0010 #define SYSFS_KOBJ_LINK 0x0020 #define SYSFS_NOT_PINNED (SYSFS_KOBJ_ATTR | SYSFS_KOBJ_BIN_ATTR | SYSFS_KOBJ_DEVICE | SYSFS_KOBJ_LINK) #endif android-audiosystem-1.8+13.10.20130807/include/linux/jiffies.h0000644000015700001700000000750312200324306024251 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_JIFFIES_H #define _LINUX_JIFFIES_H #include #include #include #include #include #include #if HZ >= (12 && HZ < 24) #define SHIFT_HZ 4 #elif HZ >= 24 && HZ < 48 #define SHIFT_HZ 5 #elif HZ >= 48 && HZ < 96 #define SHIFT_HZ 6 #elif HZ >= 96 && HZ < 192 #define SHIFT_HZ 7 #elif HZ >= 192 && HZ < 384 #define SHIFT_HZ 8 #elif HZ >= 384 && HZ < 768 #define SHIFT_HZ 9 #elif HZ >= 768 && HZ < 1536 #define SHIFT_HZ 10 #else #error You lose. #endif #define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) #define LATCH_HPET ((HPET_TICK_RATE + HZ/2) / HZ) #define SH_DIV(NOM,DEN,LSH) ( (((NOM) / (DEN)) << (LSH)) + ((((NOM) % (DEN)) << (LSH)) + (DEN) / 2) / (DEN)) #define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8)) #define ACTHZ_HPET (SH_DIV (HPET_TICK_RATE, LATCH_HPET, 8)) #define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8)) #define TICK_NSEC_HPET (SH_DIV(1000000UL * 1000, ACTHZ_HPET, 8)) #define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ) #define TICK_USEC_TO_NSEC(TUSEC) (SH_DIV (TUSEC * USER_HZ * 1000, ACTHZ, 8)) #define __jiffy_data __attribute__((section(".data"))) #if BITS_PER_LONG < 64 #else #endif #define time_after(a,b) (typecheck(unsigned long, a) && typecheck(unsigned long, b) && ((long)(b) - (long)(a) < 0)) #define time_before(a,b) time_after(b,a) #define time_after_eq(a,b) (typecheck(unsigned long, a) && typecheck(unsigned long, b) && ((long)(a) - (long)(b) >= 0)) #define time_before_eq(a,b) time_after_eq(b,a) #define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ)) #define MAX_JIFFY_OFFSET ((~0UL >> 1)-1) #define SEC_JIFFIE_SC (31 - SHIFT_HZ) #if !((NSEC_PER_SEC << 2) / TICK_NSEC << SEC_JIFFIE_SC - 2 & 0x80000000) #undef SEC_JIFFIE_SC #define SEC_JIFFIE_SC (32 - SHIFT_HZ) #endif #define NSEC_JIFFIE_SC (SEC_JIFFIE_SC + 29) #define USEC_JIFFIE_SC (SEC_JIFFIE_SC + 19) #define SEC_CONVERSION ((unsigned long)((((u64)NSEC_PER_SEC << SEC_JIFFIE_SC) + TICK_NSEC -1) / (u64)TICK_NSEC)) #define NSEC_CONVERSION ((unsigned long)((((u64)1 << NSEC_JIFFIE_SC) + TICK_NSEC -1) / (u64)TICK_NSEC)) #define USEC_CONVERSION ((unsigned long)((((u64)NSEC_PER_USEC << USEC_JIFFIE_SC) + TICK_NSEC -1) / (u64)TICK_NSEC)) #define USEC_ROUND (u64)(((u64)1 << USEC_JIFFIE_SC) - 1) #if BITS_PER_LONG < 64 #define MAX_SEC_IN_JIFFIES (long)((u64)((u64)MAX_JIFFY_OFFSET * TICK_NSEC) / NSEC_PER_SEC) #else #define MAX_SEC_IN_JIFFIES (SH_DIV((MAX_JIFFY_OFFSET >> SEC_JIFFIE_SC) * TICK_NSEC, NSEC_PER_SEC, 1) - 1) #endif #if HZ <= (MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)) #elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) #else #endif #if HZ <= (USEC_PER_SEC && !(USEC_PER_SEC % HZ)) #elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC) #else #endif #if HZ <= (MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)) #elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC) #else #endif #if HZ <= (USEC_PER_SEC && !(USEC_PER_SEC % HZ)) #elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC) #else #endif #if TICK_NSEC % NSEC_PER_SEC / USER_HZ == 0 #else #endif #if HZ % USER_HZ == 0 #else #endif #if TICK_NSEC % NSEC_PER_SEC / USER_HZ == 0 #else #endif #if NSEC_PER_SEC % USER_HZ == 0 #elif (USER_HZ % 512) == 0 #else #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/msm_mdp.h0000644000015700001700000000361612200324306024267 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _MSM_MDP_H_ #define _MSM_MDP_H_ #include #define MSMFB_IOCTL_MAGIC 'm' #define MSMFB_GRP_DISP _IOW(MSMFB_IOCTL_MAGIC, 1, unsigned int) #define MSMFB_BLIT _IOW(MSMFB_IOCTL_MAGIC, 2, unsigned int) enum { MDP_RGB_565, MDP_XRGB_8888, MDP_Y_CBCR_H2V2, MDP_ARGB_8888, MDP_RGB_888, MDP_Y_CRCB_H2V2, MDP_YCRYCB_H2V1, MDP_Y_CRCB_H2V1, MDP_Y_CBCR_H2V1, MDP_RGBA_8888, MDP_BGRA_8888, MDP_RGBX_8888, MDP_IMGTYPE_LIMIT }; enum { PMEM_IMG, FB_IMG, }; #define MDP_ROT_NOP 0 #define MDP_FLIP_LR 0x1 #define MDP_FLIP_UD 0x2 #define MDP_ROT_90 0x4 #define MDP_ROT_180 (MDP_FLIP_UD|MDP_FLIP_LR) #define MDP_ROT_270 (MDP_ROT_90|MDP_FLIP_UD|MDP_FLIP_LR) #define MDP_DITHER 0x8 #define MDP_BLUR 0x10 #define MDP_BLEND_FG_PREMULT 0x20000 #define MDP_TRANSP_NOP 0xffffffff #define MDP_ALPHA_NOP 0xff struct mdp_rect { uint32_t x; uint32_t y; uint32_t w; uint32_t h; }; struct mdp_img { uint32_t width; uint32_t height; uint32_t format; uint32_t offset; int memory_id; }; struct mdp_blit_req { struct mdp_img src; struct mdp_img dst; struct mdp_rect src_rect; struct mdp_rect dst_rect; uint32_t alpha; uint32_t transp_mask; uint32_t flags; }; struct mdp_blit_req_list { uint32_t count; struct mdp_blit_req req[]; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/xattr.h0000644000015700001700000000312612200324306023771 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_XATTR_H #define _LINUX_XATTR_H #define XATTR_CREATE 0x1 #define XATTR_REPLACE 0x2 #define XATTR_OS2_PREFIX "os2." #define XATTR_OS2_PREFIX_LEN (sizeof (XATTR_OS2_PREFIX) - 1) #define XATTR_SECURITY_PREFIX "security." #define XATTR_SECURITY_PREFIX_LEN (sizeof (XATTR_SECURITY_PREFIX) - 1) #define XATTR_SYSTEM_PREFIX "system." #define XATTR_SYSTEM_PREFIX_LEN (sizeof (XATTR_SYSTEM_PREFIX) - 1) #define XATTR_TRUSTED_PREFIX "trusted." #define XATTR_TRUSTED_PREFIX_LEN (sizeof (XATTR_TRUSTED_PREFIX) - 1) #define XATTR_USER_PREFIX "user." #define XATTR_USER_PREFIX_LEN (sizeof (XATTR_USER_PREFIX) - 1) struct xattr_handler { char *prefix; size_t (*list)(struct inode *inode, char *list, size_t list_size, const char *name, size_t name_len); int (*get)(struct inode *inode, const char *name, void *buffer, size_t size); int (*set)(struct inode *inode, const char *name, const void *buffer, size_t size, int flags); }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/tty.h0000644000015700001700000000134212200324306023445 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_TTY_H #define _LINUX_TTY_H #define N_CAIF 20 #endif android-audiosystem-1.8+13.10.20130807/include/linux/if_fddi.h0000644000015700001700000000425112200324306024213 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_IF_FDDI_H #define _LINUX_IF_FDDI_H #define FDDI_K_ALEN 6 #define FDDI_K_8022_HLEN 16 #define FDDI_K_SNAP_HLEN 21 #define FDDI_K_8022_ZLEN 16 #define FDDI_K_SNAP_ZLEN 21 #define FDDI_K_8022_DLEN 4475 #define FDDI_K_SNAP_DLEN 4470 #define FDDI_K_LLC_ZLEN 13 #define FDDI_K_LLC_LEN 4491 #define FDDI_FC_K_VOID 0x00 #define FDDI_FC_K_NON_RESTRICTED_TOKEN 0x80 #define FDDI_FC_K_RESTRICTED_TOKEN 0xC0 #define FDDI_FC_K_SMT_MIN 0x41 #define FDDI_FC_K_SMT_MAX 0x4F #define FDDI_FC_K_MAC_MIN 0xC1 #define FDDI_FC_K_MAC_MAX 0xCF #define FDDI_FC_K_ASYNC_LLC_MIN 0x50 #define FDDI_FC_K_ASYNC_LLC_DEF 0x54 #define FDDI_FC_K_ASYNC_LLC_MAX 0x5F #define FDDI_FC_K_SYNC_LLC_MIN 0xD0 #define FDDI_FC_K_SYNC_LLC_MAX 0xD7 #define FDDI_FC_K_IMPLEMENTOR_MIN 0x60 #define FDDI_FC_K_IMPLEMENTOR_MAX 0x6F #define FDDI_FC_K_RESERVED_MIN 0x70 #define FDDI_FC_K_RESERVED_MAX 0x7F #define FDDI_EXTENDED_SAP 0xAA #define FDDI_UI_CMD 0x03 struct fddi_8022_1_hdr { __u8 dsap; __u8 ssap; __u8 ctrl; } __attribute__ ((packed)); struct fddi_8022_2_hdr { __u8 dsap; __u8 ssap; __u8 ctrl_1; __u8 ctrl_2; } __attribute__ ((packed)); #define FDDI_K_OUI_LEN 3 struct fddi_snap_hdr { __u8 dsap; __u8 ssap; __u8 ctrl; __u8 oui[FDDI_K_OUI_LEN]; __be16 ethertype; } __attribute__ ((packed)); struct fddihdr { __u8 fc; __u8 daddr[FDDI_K_ALEN]; __u8 saddr[FDDI_K_ALEN]; union { struct fddi_8022_1_hdr llc_8022_1; struct fddi_8022_2_hdr llc_8022_2; struct fddi_snap_hdr llc_snap; } hdr; } __attribute__ ((packed)); #endif android-audiosystem-1.8+13.10.20130807/include/linux/mmzone.h0000644000015700001700000000132312200324306024131 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_MMZONE_H #define _LINUX_MMZONE_H #endif android-audiosystem-1.8+13.10.20130807/include/linux/device.h0000644000015700001700000001517312200324306024073 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _DEVICE_H_ #define _DEVICE_H_ #include #include #include #include #include #include #include #include #include #define DEVICE_NAME_SIZE 50 #define DEVICE_NAME_HALF __stringify(20) #define DEVICE_ID_SIZE 32 #define BUS_ID_SIZE KOBJ_NAME_LEN struct device; struct device_driver; struct class; struct class_device; struct bus_type { const char * name; struct subsystem subsys; struct kset drivers; struct kset devices; struct klist klist_devices; struct klist klist_drivers; struct bus_attribute * bus_attrs; struct device_attribute * dev_attrs; struct driver_attribute * drv_attrs; int (*match)(struct device * dev, struct device_driver * drv); int (*uevent)(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size); int (*probe)(struct device * dev); int (*remove)(struct device * dev); void (*shutdown)(struct device * dev); int (*suspend)(struct device * dev, pm_message_t state); int (*resume)(struct device * dev); }; struct device * bus_find_device(struct bus_type *bus, struct device *start, void *data, int (*match)(struct device *, void *)); struct bus_attribute { struct attribute attr; ssize_t (*show)(struct bus_type *, char * buf); ssize_t (*store)(struct bus_type *, const char * buf, size_t count); }; #define BUS_ATTR(_name,_mode,_show,_store) struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store) struct device_driver { const char * name; struct bus_type * bus; struct completion unloaded; struct kobject kobj; struct klist klist_devices; struct klist_node knode_bus; struct module * owner; int (*probe) (struct device * dev); int (*remove) (struct device * dev); void (*shutdown) (struct device * dev); int (*suspend) (struct device * dev, pm_message_t state); int (*resume) (struct device * dev); }; struct driver_attribute { struct attribute attr; ssize_t (*show)(struct device_driver *, char * buf); ssize_t (*store)(struct device_driver *, const char * buf, size_t count); }; #define DRIVER_ATTR(_name,_mode,_show,_store) struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store) struct device * driver_find_device(struct device_driver *drv, struct device *start, void *data, int (*match)(struct device *, void *)); struct class { const char * name; struct module * owner; struct subsystem subsys; struct list_head children; struct list_head devices; struct list_head interfaces; struct semaphore sem; struct class_attribute * class_attrs; struct class_device_attribute * class_dev_attrs; int (*uevent)(struct class_device *dev, char **envp, int num_envp, char *buffer, int buffer_size); void (*release)(struct class_device *dev); void (*class_release)(struct class *class); }; struct class_attribute { struct attribute attr; ssize_t (*show)(struct class *, char * buf); ssize_t (*store)(struct class *, const char * buf, size_t count); }; #define CLASS_ATTR(_name,_mode,_show,_store) struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store) struct class_device_attribute { struct attribute attr; ssize_t (*show)(struct class_device *, char * buf); ssize_t (*store)(struct class_device *, const char * buf, size_t count); }; #define CLASS_DEVICE_ATTR(_name,_mode,_show,_store) struct class_device_attribute class_device_attr_##_name = __ATTR(_name,_mode,_show,_store) struct class_device { struct list_head node; struct kobject kobj; struct class * class; dev_t devt; struct class_device_attribute *devt_attr; struct class_device_attribute uevent_attr; struct device * dev; void * class_data; struct class_device *parent; struct attribute_group ** groups; void (*release)(struct class_device *dev); int (*uevent)(struct class_device *dev, char **envp, int num_envp, char *buffer, int buffer_size); char class_id[BUS_ID_SIZE]; }; struct class_interface { struct list_head node; struct class *class; int (*add) (struct class_device *, struct class_interface *); void (*remove) (struct class_device *, struct class_interface *); }; struct device_attribute { struct attribute attr; ssize_t (*show)(struct device *dev, struct device_attribute *attr, char *buf); ssize_t (*store)(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); }; #define DEVICE_ATTR(_name,_mode,_show,_store) struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store) struct device { struct klist klist_children; struct klist_node knode_parent; struct klist_node knode_driver; struct klist_node knode_bus; struct device * parent; struct kobject kobj; char bus_id[BUS_ID_SIZE]; struct device_attribute uevent_attr; struct device_attribute *devt_attr; struct semaphore sem; struct bus_type * bus; struct device_driver *driver; void *driver_data; void *platform_data; void *firmware_data; struct dev_pm_info power; u64 *dma_mask; u64 coherent_dma_mask; struct list_head dma_pools; struct dma_coherent_mem *dma_mem; struct list_head node; struct class *class; dev_t devt; void (*release)(struct device * dev); }; #define dev_printk(level, dev, format, arg...) printk(level "%s %s: " format , dev_driver_string(dev) , (dev)->bus_id , ## arg) #ifdef DEBUG #define dev_dbg(dev, format, arg...) dev_printk(KERN_DEBUG , dev , format , ## arg) #else #define dev_dbg(dev, format, arg...) do { (void)(dev); } while (0) #endif #define dev_err(dev, format, arg...) dev_printk(KERN_ERR , dev , format , ## arg) #define dev_info(dev, format, arg...) dev_printk(KERN_INFO , dev , format , ## arg) #define dev_warn(dev, format, arg...) dev_printk(KERN_WARNING , dev , format , ## arg) #define dev_notice(dev, format, arg...) dev_printk(KERN_NOTICE , dev , format , ## arg) #define MODULE_ALIAS_CHARDEV(major,minor) MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) #define MODULE_ALIAS_CHARDEV_MAJOR(major) MODULE_ALIAS("char-major-" __stringify(major) "-*") #endif android-audiosystem-1.8+13.10.20130807/include/linux/soundcard.h0000644000015700001700000006775512200324306024633 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef SOUNDCARD_H #define SOUNDCARD_H #define SOUND_VERSION 0x030802 #define OPEN_SOUND_SYSTEM #include #include #define SNDCARD_ADLIB 1 #define SNDCARD_SB 2 #define SNDCARD_PAS 3 #define SNDCARD_GUS 4 #define SNDCARD_MPU401 5 #define SNDCARD_SB16 6 #define SNDCARD_SB16MIDI 7 #define SNDCARD_UART6850 8 #define SNDCARD_GUS16 9 #define SNDCARD_MSS 10 #define SNDCARD_PSS 11 #define SNDCARD_SSCAPE 12 #define SNDCARD_PSS_MPU 13 #define SNDCARD_PSS_MSS 14 #define SNDCARD_SSCAPE_MSS 15 #define SNDCARD_TRXPRO 16 #define SNDCARD_TRXPRO_SB 17 #define SNDCARD_TRXPRO_MPU 18 #define SNDCARD_MAD16 19 #define SNDCARD_MAD16_MPU 20 #define SNDCARD_CS4232 21 #define SNDCARD_CS4232_MPU 22 #define SNDCARD_MAUI 23 #define SNDCARD_PSEUDO_MSS 24 #define SNDCARD_GUSPNP 25 #define SNDCARD_UART401 26 #ifndef _SIOWR #if defined(_IOWR) && (defined(_AIX) || !defined(sun) && !defined(sparc) && !defined(__sparc__) && !defined(__INCioctlh) && !defined(__Lynx__)) #define SIOCPARM_MASK IOCPARM_MASK #define SIOC_VOID IOC_VOID #define SIOC_OUT IOC_OUT #define SIOC_IN IOC_IN #define SIOC_INOUT IOC_INOUT #define _SIOC_SIZE _IOC_SIZE #define _SIOC_DIR _IOC_DIR #define _SIOC_NONE _IOC_NONE #define _SIOC_READ _IOC_READ #define _SIOC_WRITE _IOC_WRITE #define _SIO _IO #define _SIOR _IOR #define _SIOW _IOW #define _SIOWR _IOWR #else #define SIOCPARM_MASK 0x1fff #define SIOC_VOID 0x00000000 #define SIOC_OUT 0x20000000 #define SIOC_IN 0x40000000 #define SIOC_INOUT (SIOC_IN|SIOC_OUT) #define _SIO(x,y) ((int)(SIOC_VOID|(x<<8)|y)) #define _SIOR(x,y,t) ((int)(SIOC_OUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) #define _SIOW(x,y,t) ((int)(SIOC_IN|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) #define _SIOWR(x,y,t) ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y)) #define _SIOC_SIZE(x) ((x>>16)&SIOCPARM_MASK) #define _SIOC_DIR(x) (x & 0xf0000000) #define _SIOC_NONE SIOC_VOID #define _SIOC_READ SIOC_OUT #define _SIOC_WRITE SIOC_IN #endif #endif #define SNDCTL_SEQ_RESET _SIO ('Q', 0) #define SNDCTL_SEQ_SYNC _SIO ('Q', 1) #define SNDCTL_SYNTH_INFO _SIOWR('Q', 2, struct synth_info) #define SNDCTL_SEQ_CTRLRATE _SIOWR('Q', 3, int) #define SNDCTL_SEQ_GETOUTCOUNT _SIOR ('Q', 4, int) #define SNDCTL_SEQ_GETINCOUNT _SIOR ('Q', 5, int) #define SNDCTL_SEQ_PERCMODE _SIOW ('Q', 6, int) #define SNDCTL_FM_LOAD_INSTR _SIOW ('Q', 7, struct sbi_instrument) #define SNDCTL_SEQ_TESTMIDI _SIOW ('Q', 8, int) #define SNDCTL_SEQ_RESETSAMPLES _SIOW ('Q', 9, int) #define SNDCTL_SEQ_NRSYNTHS _SIOR ('Q',10, int) #define SNDCTL_SEQ_NRMIDIS _SIOR ('Q',11, int) #define SNDCTL_MIDI_INFO _SIOWR('Q',12, struct midi_info) #define SNDCTL_SEQ_THRESHOLD _SIOW ('Q',13, int) #define SNDCTL_SYNTH_MEMAVL _SIOWR('Q',14, int) #define SNDCTL_FM_4OP_ENABLE _SIOW ('Q',15, int) #define SNDCTL_SEQ_PANIC _SIO ('Q',17) #define SNDCTL_SEQ_OUTOFBAND _SIOW ('Q',18, struct seq_event_rec) #define SNDCTL_SEQ_GETTIME _SIOR ('Q',19, int) #define SNDCTL_SYNTH_ID _SIOWR('Q',20, struct synth_info) #define SNDCTL_SYNTH_CONTROL _SIOWR('Q',21, struct synth_control) #define SNDCTL_SYNTH_REMOVESAMPLE _SIOWR('Q',22, struct remove_sample) typedef struct synth_control { int devno; char data[4000]; }synth_control; typedef struct remove_sample { int devno; int bankno; int instrno; } remove_sample; typedef struct seq_event_rec { unsigned char arr[8]; } seq_event_rec; #define SNDCTL_TMR_TIMEBASE _SIOWR('T', 1, int) #define SNDCTL_TMR_START _SIO ('T', 2) #define SNDCTL_TMR_STOP _SIO ('T', 3) #define SNDCTL_TMR_CONTINUE _SIO ('T', 4) #define SNDCTL_TMR_TEMPO _SIOWR('T', 5, int) #define SNDCTL_TMR_SOURCE _SIOWR('T', 6, int) #define TMR_INTERNAL 0x00000001 #define TMR_EXTERNAL 0x00000002 #define TMR_MODE_MIDI 0x00000010 #define TMR_MODE_FSK 0x00000020 #define TMR_MODE_CLS 0x00000040 #define TMR_MODE_SMPTE 0x00000080 #define SNDCTL_TMR_METRONOME _SIOW ('T', 7, int) #define SNDCTL_TMR_SELECT _SIOW ('T', 8, int) #define _LINUX_PATCHKEY_H_INDIRECT #include #undef _LINUX_PATCHKEY_H_INDIRECT #ifdef __BYTE_ORDER #if __BYTE_ORDER == __BIG_ENDIAN #define AFMT_S16_NE AFMT_S16_BE #elif __BYTE_ORDER == __LITTLE_ENDIAN #define AFMT_S16_NE AFMT_S16_LE #else #error "could not determine byte order" #endif #endif struct patch_info { unsigned short key; #define WAVE_PATCH _PATCHKEY(0x04) #define GUS_PATCH WAVE_PATCH #define WAVEFRONT_PATCH _PATCHKEY(0x06) short device_no; short instr_no; unsigned int mode; #define WAVE_16_BITS 0x01 #define WAVE_UNSIGNED 0x02 #define WAVE_LOOPING 0x04 #define WAVE_BIDIR_LOOP 0x08 #define WAVE_LOOP_BACK 0x10 #define WAVE_SUSTAIN_ON 0x20 #define WAVE_ENVELOPES 0x40 #define WAVE_FAST_RELEASE 0x80 #define WAVE_VIBRATO 0x00010000 #define WAVE_TREMOLO 0x00020000 #define WAVE_SCALE 0x00040000 #define WAVE_FRACTIONS 0x00080000 #define WAVE_ROM 0x40000000 #define WAVE_MULAW 0x20000000 int len; int loop_start, loop_end; unsigned int base_freq; unsigned int base_note; unsigned int high_note; unsigned int low_note; int panning; int detuning; unsigned char env_rate[ 6 ]; unsigned char env_offset[ 6 ]; unsigned char tremolo_sweep; unsigned char tremolo_rate; unsigned char tremolo_depth; unsigned char vibrato_sweep; unsigned char vibrato_rate; unsigned char vibrato_depth; int scale_frequency; unsigned int scale_factor; int volume; int fractions; int reserved1; int spare[2]; char data[1]; }; struct sysex_info { short key; #define SYSEX_PATCH _PATCHKEY(0x05) #define MAUI_PATCH _PATCHKEY(0x06) short device_no; int len; unsigned char data[1]; }; #define SEQ_NOTEOFF 0 #define SEQ_FMNOTEOFF SEQ_NOTEOFF #define SEQ_NOTEON 1 #define SEQ_FMNOTEON SEQ_NOTEON #define SEQ_WAIT TMR_WAIT_ABS #define SEQ_PGMCHANGE 3 #define SEQ_FMPGMCHANGE SEQ_PGMCHANGE #define SEQ_SYNCTIMER TMR_START #define SEQ_MIDIPUTC 5 #define SEQ_DRUMON 6 #define SEQ_DRUMOFF 7 #define SEQ_ECHO TMR_ECHO #define SEQ_AFTERTOUCH 9 #define SEQ_CONTROLLER 10 #define CTL_BANK_SELECT 0x00 #define CTL_MODWHEEL 0x01 #define CTL_BREATH 0x02 #define CTL_FOOT 0x04 #define CTL_PORTAMENTO_TIME 0x05 #define CTL_DATA_ENTRY 0x06 #define CTL_MAIN_VOLUME 0x07 #define CTL_BALANCE 0x08 #define CTL_PAN 0x0a #define CTL_EXPRESSION 0x0b #define CTL_GENERAL_PURPOSE1 0x10 #define CTL_GENERAL_PURPOSE2 0x11 #define CTL_GENERAL_PURPOSE3 0x12 #define CTL_GENERAL_PURPOSE4 0x13 #define CTL_DAMPER_PEDAL 0x40 #define CTL_SUSTAIN 0x40 #define CTL_HOLD 0x40 #define CTL_PORTAMENTO 0x41 #define CTL_SOSTENUTO 0x42 #define CTL_SOFT_PEDAL 0x43 #define CTL_HOLD2 0x45 #define CTL_GENERAL_PURPOSE5 0x50 #define CTL_GENERAL_PURPOSE6 0x51 #define CTL_GENERAL_PURPOSE7 0x52 #define CTL_GENERAL_PURPOSE8 0x53 #define CTL_EXT_EFF_DEPTH 0x5b #define CTL_TREMOLO_DEPTH 0x5c #define CTL_CHORUS_DEPTH 0x5d #define CTL_DETUNE_DEPTH 0x5e #define CTL_CELESTE_DEPTH 0x5e #define CTL_PHASER_DEPTH 0x5f #define CTL_DATA_INCREMENT 0x60 #define CTL_DATA_DECREMENT 0x61 #define CTL_NONREG_PARM_NUM_LSB 0x62 #define CTL_NONREG_PARM_NUM_MSB 0x63 #define CTL_REGIST_PARM_NUM_LSB 0x64 #define CTL_REGIST_PARM_NUM_MSB 0x65 #define CTRL_PITCH_BENDER 255 #define CTRL_PITCH_BENDER_RANGE 254 #define CTRL_EXPRESSION 253 #define CTRL_MAIN_VOLUME 252 #define SEQ_BALANCE 11 #define SEQ_VOLMODE 12 #define VOL_METHOD_ADAGIO 1 #define VOL_METHOD_LINEAR 2 #define SEQ_FULLSIZE 0xfd #define SEQ_PRIVATE 0xfe #define SEQ_EXTENDED 0xff typedef unsigned char sbi_instr_data[32]; struct sbi_instrument { unsigned short key; #define FM_PATCH _PATCHKEY(0x01) #define OPL3_PATCH _PATCHKEY(0x03) short device; int channel; sbi_instr_data operators; }; struct synth_info { char name[30]; int device; int synth_type; #define SYNTH_TYPE_FM 0 #define SYNTH_TYPE_SAMPLE 1 #define SYNTH_TYPE_MIDI 2 int synth_subtype; #define FM_TYPE_ADLIB 0x00 #define FM_TYPE_OPL3 0x01 #define MIDI_TYPE_MPU401 0x401 #define SAMPLE_TYPE_BASIC 0x10 #define SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC #define SAMPLE_TYPE_WAVEFRONT 0x11 int perc_mode; int nr_voices; int nr_drums; int instr_bank_size; unsigned int capabilities; #define SYNTH_CAP_PERCMODE 0x00000001 #define SYNTH_CAP_OPL3 0x00000002 #define SYNTH_CAP_INPUT 0x00000004 int dummies[19]; }; struct sound_timer_info { char name[32]; int caps; }; #define MIDI_CAP_MPU401 1 struct midi_info { char name[30]; int device; unsigned int capabilities; int dev_type; int dummies[18]; }; typedef struct { unsigned char cmd; char nr_args, nr_returns; unsigned char data[30]; } mpu_command_rec; #define SNDCTL_MIDI_PRETIME _SIOWR('m', 0, int) #define SNDCTL_MIDI_MPUMODE _SIOWR('m', 1, int) #define SNDCTL_MIDI_MPUCMD _SIOWR('m', 2, mpu_command_rec) #define SNDCTL_DSP_RESET _SIO ('P', 0) #define SNDCTL_DSP_SYNC _SIO ('P', 1) #define SNDCTL_DSP_SPEED _SIOWR('P', 2, int) #define SNDCTL_DSP_STEREO _SIOWR('P', 3, int) #define SNDCTL_DSP_GETBLKSIZE _SIOWR('P', 4, int) #define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT #define SNDCTL_DSP_CHANNELS _SIOWR('P', 6, int) #define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS #define SOUND_PCM_WRITE_FILTER _SIOWR('P', 7, int) #define SNDCTL_DSP_POST _SIO ('P', 8) #define SNDCTL_DSP_SUBDIVIDE _SIOWR('P', 9, int) #define SNDCTL_DSP_SETFRAGMENT _SIOWR('P',10, int) #define SNDCTL_DSP_GETFMTS _SIOR ('P',11, int) #define SNDCTL_DSP_SETFMT _SIOWR('P',5, int) #define AFMT_QUERY 0x00000000 #define AFMT_MU_LAW 0x00000001 #define AFMT_A_LAW 0x00000002 #define AFMT_IMA_ADPCM 0x00000004 #define AFMT_U8 0x00000008 #define AFMT_S16_LE 0x00000010 #define AFMT_S16_BE 0x00000020 #define AFMT_S8 0x00000040 #define AFMT_U16_LE 0x00000080 #define AFMT_U16_BE 0x00000100 #define AFMT_MPEG 0x00000200 #define AFMT_AC3 0x00000400 typedef struct audio_buf_info { int fragments; int fragstotal; int fragsize; int bytes; } audio_buf_info; #define SNDCTL_DSP_GETOSPACE _SIOR ('P',12, audio_buf_info) #define SNDCTL_DSP_GETISPACE _SIOR ('P',13, audio_buf_info) #define SNDCTL_DSP_NONBLOCK _SIO ('P',14) #define SNDCTL_DSP_GETCAPS _SIOR ('P',15, int) #define DSP_CAP_REVISION 0x000000ff #define DSP_CAP_DUPLEX 0x00000100 #define DSP_CAP_REALTIME 0x00000200 #define DSP_CAP_BATCH 0x00000400 #define DSP_CAP_COPROC 0x00000800 #define DSP_CAP_TRIGGER 0x00001000 #define DSP_CAP_MMAP 0x00002000 #define DSP_CAP_MULTI 0x00004000 #define DSP_CAP_BIND 0x00008000 #define SNDCTL_DSP_GETTRIGGER _SIOR ('P',16, int) #define SNDCTL_DSP_SETTRIGGER _SIOW ('P',16, int) #define PCM_ENABLE_INPUT 0x00000001 #define PCM_ENABLE_OUTPUT 0x00000002 typedef struct count_info { int bytes; int blocks; int ptr; } count_info; #define SNDCTL_DSP_GETIPTR _SIOR ('P',17, count_info) #define SNDCTL_DSP_GETOPTR _SIOR ('P',18, count_info) typedef struct buffmem_desc { unsigned *buffer; int size; } buffmem_desc; #define SNDCTL_DSP_MAPINBUF _SIOR ('P', 19, buffmem_desc) #define SNDCTL_DSP_MAPOUTBUF _SIOR ('P', 20, buffmem_desc) #define SNDCTL_DSP_SETSYNCRO _SIO ('P', 21) #define SNDCTL_DSP_SETDUPLEX _SIO ('P', 22) #define SNDCTL_DSP_GETODELAY _SIOR ('P', 23, int) #define SNDCTL_DSP_GETCHANNELMASK _SIOWR('P', 64, int) #define SNDCTL_DSP_BIND_CHANNEL _SIOWR('P', 65, int) #define DSP_BIND_QUERY 0x00000000 #define DSP_BIND_FRONT 0x00000001 #define DSP_BIND_SURR 0x00000002 #define DSP_BIND_CENTER_LFE 0x00000004 #define DSP_BIND_HANDSET 0x00000008 #define DSP_BIND_MIC 0x00000010 #define DSP_BIND_MODEM1 0x00000020 #define DSP_BIND_MODEM2 0x00000040 #define DSP_BIND_I2S 0x00000080 #define DSP_BIND_SPDIF 0x00000100 #define SNDCTL_DSP_SETSPDIF _SIOW ('P', 66, int) #define SNDCTL_DSP_GETSPDIF _SIOR ('P', 67, int) #define SPDIF_PRO 0x0001 #define SPDIF_N_AUD 0x0002 #define SPDIF_COPY 0x0004 #define SPDIF_PRE 0x0008 #define SPDIF_CC 0x07f0 #define SPDIF_L 0x0800 #define SPDIF_DRS 0x4000 #define SPDIF_V 0x8000 #define SNDCTL_DSP_PROFILE _SIOW ('P', 23, int) #define APF_NORMAL 0 #define APF_NETWORK 1 #define APF_CPUINTENS 2 #define SOUND_PCM_READ_RATE _SIOR ('P', 2, int) #define SOUND_PCM_READ_CHANNELS _SIOR ('P', 6, int) #define SOUND_PCM_READ_BITS _SIOR ('P', 5, int) #define SOUND_PCM_READ_FILTER _SIOR ('P', 7, int) #define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT #define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED #define SOUND_PCM_POST SNDCTL_DSP_POST #define SOUND_PCM_RESET SNDCTL_DSP_RESET #define SOUND_PCM_SYNC SNDCTL_DSP_SYNC #define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE #define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT #define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS #define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT #define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE #define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE #define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK #define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS #define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER #define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER #define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO #define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR #define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR #define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF #define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF typedef struct copr_buffer { int command; int flags; #define CPF_NONE 0x0000 #define CPF_FIRST 0x0001 #define CPF_LAST 0x0002 int len; int offs; unsigned char data[4000]; } copr_buffer; typedef struct copr_debug_buf { int command; int parm1; int parm2; int flags; int len; } copr_debug_buf; typedef struct copr_msg { int len; unsigned char data[4000]; } copr_msg; #define SNDCTL_COPR_RESET _SIO ('C', 0) #define SNDCTL_COPR_LOAD _SIOWR('C', 1, copr_buffer) #define SNDCTL_COPR_RDATA _SIOWR('C', 2, copr_debug_buf) #define SNDCTL_COPR_RCODE _SIOWR('C', 3, copr_debug_buf) #define SNDCTL_COPR_WDATA _SIOW ('C', 4, copr_debug_buf) #define SNDCTL_COPR_WCODE _SIOW ('C', 5, copr_debug_buf) #define SNDCTL_COPR_RUN _SIOWR('C', 6, copr_debug_buf) #define SNDCTL_COPR_HALT _SIOWR('C', 7, copr_debug_buf) #define SNDCTL_COPR_SENDMSG _SIOWR('C', 8, copr_msg) #define SNDCTL_COPR_RCVMSG _SIOR ('C', 9, copr_msg) #define SOUND_MIXER_NRDEVICES 25 #define SOUND_MIXER_VOLUME 0 #define SOUND_MIXER_BASS 1 #define SOUND_MIXER_TREBLE 2 #define SOUND_MIXER_SYNTH 3 #define SOUND_MIXER_PCM 4 #define SOUND_MIXER_SPEAKER 5 #define SOUND_MIXER_LINE 6 #define SOUND_MIXER_MIC 7 #define SOUND_MIXER_CD 8 #define SOUND_MIXER_IMIX 9 #define SOUND_MIXER_ALTPCM 10 #define SOUND_MIXER_RECLEV 11 #define SOUND_MIXER_IGAIN 12 #define SOUND_MIXER_OGAIN 13 #define SOUND_MIXER_LINE1 14 #define SOUND_MIXER_LINE2 15 #define SOUND_MIXER_LINE3 16 #define SOUND_MIXER_DIGITAL1 17 #define SOUND_MIXER_DIGITAL2 18 #define SOUND_MIXER_DIGITAL3 19 #define SOUND_MIXER_PHONEIN 20 #define SOUND_MIXER_PHONEOUT 21 #define SOUND_MIXER_VIDEO 22 #define SOUND_MIXER_RADIO 23 #define SOUND_MIXER_MONITOR 24 #define SOUND_ONOFF_MIN 28 #define SOUND_ONOFF_MAX 30 #define SOUND_MIXER_NONE 31 #define SOUND_MIXER_ENHANCE SOUND_MIXER_NONE #define SOUND_MIXER_MUTE SOUND_MIXER_NONE #define SOUND_MIXER_LOUD SOUND_MIXER_NONE #define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor"} #define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", "line1", "line2", "line3", "dig1", "dig2", "dig3", "phin", "phout", "video", "radio", "monitor"} #define SOUND_MIXER_RECSRC 0xff #define SOUND_MIXER_DEVMASK 0xfe #define SOUND_MIXER_RECMASK 0xfd #define SOUND_MIXER_CAPS 0xfc #define SOUND_CAP_EXCL_INPUT 0x00000001 #define SOUND_MIXER_STEREODEVS 0xfb #define SOUND_MIXER_OUTSRC 0xfa #define SOUND_MIXER_OUTMASK 0xf9 #define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME) #define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS) #define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE) #define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH) #define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM) #define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER) #define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE) #define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC) #define SOUND_MASK_CD (1 << SOUND_MIXER_CD) #define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX) #define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM) #define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV) #define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN) #define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN) #define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1) #define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2) #define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3) #define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1) #define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2) #define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3) #define SOUND_MASK_PHONEIN (1 << SOUND_MIXER_PHONEIN) #define SOUND_MASK_PHONEOUT (1 << SOUND_MIXER_PHONEOUT) #define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO) #define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO) #define SOUND_MASK_MONITOR (1 << SOUND_MIXER_MONITOR) #define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE) #define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE) #define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD) #define MIXER_READ(dev) _SIOR('M', dev, int) #define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME) #define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS) #define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE) #define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH) #define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM) #define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER) #define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE) #define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC) #define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD) #define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX) #define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM) #define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV) #define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN) #define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN) #define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1) #define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2) #define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3) #define SOUND_MIXER_READ_MUTE MIXER_READ(SOUND_MIXER_MUTE) #define SOUND_MIXER_READ_ENHANCE MIXER_READ(SOUND_MIXER_ENHANCE) #define SOUND_MIXER_READ_LOUD MIXER_READ(SOUND_MIXER_LOUD) #define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC) #define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK) #define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK) #define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS) #define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS) #define MIXER_WRITE(dev) _SIOWR('M', dev, int) #define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME) #define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS) #define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE) #define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH) #define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM) #define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER) #define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE) #define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC) #define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD) #define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX) #define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM) #define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV) #define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN) #define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN) #define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1) #define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2) #define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3) #define SOUND_MIXER_WRITE_MUTE MIXER_WRITE(SOUND_MIXER_MUTE) #define SOUND_MIXER_WRITE_ENHANCE MIXER_WRITE(SOUND_MIXER_ENHANCE) #define SOUND_MIXER_WRITE_LOUD MIXER_WRITE(SOUND_MIXER_LOUD) #define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC) typedef struct mixer_info { char id[16]; char name[32]; int modify_counter; int fillers[10]; } mixer_info; typedef struct _old_mixer_info { char id[16]; char name[32]; } _old_mixer_info; #define SOUND_MIXER_INFO _SIOR ('M', 101, mixer_info) #define SOUND_OLD_MIXER_INFO _SIOR ('M', 101, _old_mixer_info) typedef unsigned char mixer_record[128]; #define SOUND_MIXER_ACCESS _SIOWR('M', 102, mixer_record) #define SOUND_MIXER_AGC _SIOWR('M', 103, int) #define SOUND_MIXER_3DSE _SIOWR('M', 104, int) #define SOUND_MIXER_PRIVATE1 _SIOWR('M', 111, int) #define SOUND_MIXER_PRIVATE2 _SIOWR('M', 112, int) #define SOUND_MIXER_PRIVATE3 _SIOWR('M', 113, int) #define SOUND_MIXER_PRIVATE4 _SIOWR('M', 114, int) #define SOUND_MIXER_PRIVATE5 _SIOWR('M', 115, int) typedef struct mixer_vol_table { int num; char name[32]; int levels[32]; } mixer_vol_table; #define SOUND_MIXER_GETLEVELS _SIOWR('M', 116, mixer_vol_table) #define SOUND_MIXER_SETLEVELS _SIOWR('M', 117, mixer_vol_table) #define OSS_GETVERSION _SIOR ('M', 118, int) #define EV_SEQ_LOCAL 0x80 #define EV_TIMING 0x81 #define EV_CHN_COMMON 0x92 #define EV_CHN_VOICE 0x93 #define EV_SYSEX 0x94 #define MIDI_NOTEOFF 0x80 #define MIDI_NOTEON 0x90 #define MIDI_KEY_PRESSURE 0xA0 #define MIDI_CTL_CHANGE 0xB0 #define MIDI_PGM_CHANGE 0xC0 #define MIDI_CHN_PRESSURE 0xD0 #define MIDI_PITCH_BEND 0xE0 #define MIDI_SYSTEM_PREFIX 0xF0 #define TMR_WAIT_REL 1 #define TMR_WAIT_ABS 2 #define TMR_STOP 3 #define TMR_START 4 #define TMR_CONTINUE 5 #define TMR_TEMPO 6 #define TMR_ECHO 8 #define TMR_CLOCK 9 #define TMR_SPP 10 #define TMR_TIMESIG 11 #define LOCL_STARTAUDIO 1 #if !defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL) || defined(USE_SEQ_MACROS) #define SEQ_DECLAREBUF() SEQ_USE_EXTBUF() #define SEQ_PM_DEFINES int __foo_bar___ #ifdef OSSLIB #define SEQ_USE_EXTBUF() extern unsigned char *_seqbuf; extern int _seqbuflen;extern int _seqbufptr #define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len #define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen) #define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen) #define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen) #define SEQ_LOAD_GMINSTR(dev, instr) OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen) #define SEQ_LOAD_GMDRUM(dev, drum) OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen) #else #define SEQ_LOAD_GMINSTR(dev, instr) #define SEQ_LOAD_GMDRUM(dev, drum) #define SEQ_USE_EXTBUF() extern unsigned char _seqbuf[]; extern int _seqbuflen;extern int _seqbufptr #ifndef USE_SIMPLE_MACROS #define SEQ_DEFINEBUF(len) unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0 #define _SEQ_NEEDBUF(len) if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump() #define _SEQ_ADVBUF(len) _seqbufptr += len #define SEQ_DUMPBUF seqbuf_dump #else #define _SEQ_NEEDBUF(len) #endif #endif #define SEQ_VOLUME_MODE(dev, mode) {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = SEQ_EXTENDED; _seqbuf[_seqbufptr+1] = SEQ_VOLMODE; _seqbuf[_seqbufptr+2] = (dev); _seqbuf[_seqbufptr+3] = (mode); _seqbuf[_seqbufptr+4] = 0; _seqbuf[_seqbufptr+5] = 0; _seqbuf[_seqbufptr+6] = 0; _seqbuf[_seqbufptr+7] = 0; _SEQ_ADVBUF(8);} #define _CHN_VOICE(dev, event, chn, note, parm) {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = EV_CHN_VOICE; _seqbuf[_seqbufptr+1] = (dev); _seqbuf[_seqbufptr+2] = (event); _seqbuf[_seqbufptr+3] = (chn); _seqbuf[_seqbufptr+4] = (note); _seqbuf[_seqbufptr+5] = (parm); _seqbuf[_seqbufptr+6] = (0); _seqbuf[_seqbufptr+7] = 0; _SEQ_ADVBUF(8);} #define SEQ_START_NOTE(dev, chn, note, vol) _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol) #define SEQ_STOP_NOTE(dev, chn, note, vol) _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol) #define SEQ_KEY_PRESSURE(dev, chn, note, pressure) _CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure) #define _CHN_COMMON(dev, event, chn, p1, p2, w14) {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = EV_CHN_COMMON; _seqbuf[_seqbufptr+1] = (dev); _seqbuf[_seqbufptr+2] = (event); _seqbuf[_seqbufptr+3] = (chn); _seqbuf[_seqbufptr+4] = (p1); _seqbuf[_seqbufptr+5] = (p2); *(short *)&_seqbuf[_seqbufptr+6] = (w14); _SEQ_ADVBUF(8);} #define SEQ_SYSEX(dev, buf, len) {int ii, ll=(len); unsigned char *bufp=buf; if (ll>6)ll=6; _SEQ_NEEDBUF(8); _seqbuf[_seqbufptr] = EV_SYSEX; _seqbuf[_seqbufptr+1] = (dev); for(ii=0;ii>8)&0xff); _seqbuf[_seqbufptr+7] = 0; _SEQ_ADVBUF(8);} #define SEQ_PITCHBEND(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value) #define SEQ_BENDER_RANGE(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value) #define SEQ_EXPRESSION(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128) #define SEQ_MAIN_VOLUME(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100) #define SEQ_PANNING(dev, voice, pos) SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2) #define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr+0] = EV_TIMING; _seqbuf[_seqbufptr+1] = (ev); _seqbuf[_seqbufptr+2] = 0; _seqbuf[_seqbufptr+3] = 0; *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); _SEQ_ADVBUF(8);} #define SEQ_START_TIMER() _TIMER_EVENT(TMR_START, 0) #define SEQ_STOP_TIMER() _TIMER_EVENT(TMR_STOP, 0) #define SEQ_CONTINUE_TIMER() _TIMER_EVENT(TMR_CONTINUE, 0) #define SEQ_WAIT_TIME(ticks) _TIMER_EVENT(TMR_WAIT_ABS, ticks) #define SEQ_DELTA_TIME(ticks) _TIMER_EVENT(TMR_WAIT_REL, ticks) #define SEQ_ECHO_BACK(key) _TIMER_EVENT(TMR_ECHO, key) #define SEQ_SET_TEMPO(value) _TIMER_EVENT(TMR_TEMPO, value) #define SEQ_SONGPOS(pos) _TIMER_EVENT(TMR_SPP, pos) #define SEQ_TIME_SIGNATURE(sig) _TIMER_EVENT(TMR_TIMESIG, sig) #define _LOCAL_EVENT(ev, parm) {_SEQ_NEEDBUF(8); _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; _seqbuf[_seqbufptr+1] = (ev); _seqbuf[_seqbufptr+2] = 0; _seqbuf[_seqbufptr+3] = 0; *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); _SEQ_ADVBUF(8);} #define SEQ_PLAYAUDIO(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO, devmask) #define SEQ_MIDIOUT(device, byte) {_SEQ_NEEDBUF(4); _seqbuf[_seqbufptr] = SEQ_MIDIPUTC; _seqbuf[_seqbufptr+1] = (byte); _seqbuf[_seqbufptr+2] = (device); _seqbuf[_seqbufptr+3] = 0; _SEQ_ADVBUF(4);} #ifdef OSSLIB #define SEQ_WRPATCH(patchx, len) OSS_write_patch(seqfd, (char*)(patchx), len) #define SEQ_WRPATCH2(patchx, len) OSS_write_patch2(seqfd, (char*)(patchx), len) #else #define SEQ_WRPATCH(patchx, len) {if (_seqbufptr) SEQ_DUMPBUF(); if (write(seqfd, (char*)(patchx), len)==-1) perror("Write patch: /dev/sequencer");} #define SEQ_WRPATCH2(patchx, len) (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len)) #endif #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/akm8975.h0000644000015700001700000000461512200324306023740 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef AKM8975_H #define AKM8975_H #include #define AK8975_MODE_SNG_MEASURE 0x01 #define AK8975_MODE_SELF_TEST 0x08 #define AK8975_MODE_FUSE_ACCESS 0x0F #define AK8975_MODE_POWER_DOWN 0x00 #define RBUFF_SIZE 8 #define AK8975_REG_WIA 0x00 #define AK8975_REG_INFO 0x01 #define AK8975_REG_ST1 0x02 #define AK8975_REG_HXL 0x03 #define AK8975_REG_HXH 0x04 #define AK8975_REG_HYL 0x05 #define AK8975_REG_HYH 0x06 #define AK8975_REG_HZL 0x07 #define AK8975_REG_HZH 0x08 #define AK8975_REG_ST2 0x09 #define AK8975_REG_CNTL 0x0A #define AK8975_REG_RSV 0x0B #define AK8975_REG_ASTC 0x0C #define AK8975_REG_TS1 0x0D #define AK8975_REG_TS2 0x0E #define AK8975_REG_I2CDIS 0x0F #define AK8975_FUSE_ASAX 0x10 #define AK8975_FUSE_ASAY 0x11 #define AK8975_FUSE_ASAZ 0x12 #define AKMIO 0xA1 #define ECS_IOCTL_WRITE _IOW(AKMIO, 0x02, char[5]) #define ECS_IOCTL_READ _IOWR(AKMIO, 0x03, char[5]) #define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x08, char[RBUFF_SIZE]) #define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x0C, short[12]) #define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x0D, int) #define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x0E, int) #define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x30, short) #define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short) #define ECS_IOCTL_APP_GET_MFLAG _IOW(AKMIO, 0x12, short) #define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short) #define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short) #define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, short) #define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY #define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short) #define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short) #define ECS_IOCTL_APP_SET_TFLAG _IOR(AKMIO, 0x15, short) #define ECS_INTR 140 struct akm8975_platform_data { int intr; }; #endif android-audiosystem-1.8+13.10.20130807/include/linux/delay.h0000644000015700001700000000201412200324306023720 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_DELAY_H #define _LINUX_DELAY_H #include #ifndef MAX_UDELAY_MS #define MAX_UDELAY_MS 5 #endif #ifndef mdelay #define mdelay(n) ( (__builtin_constant_p(n) && (n)<=MAX_UDELAY_MS) ? udelay((n)*1000) : ({unsigned long __ms=(n); while (__ms--) udelay(1000);})) #endif #ifndef ndelay #define ndelay(x) udelay(((x)+999)/1000) #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/byteorder/0000755000015700001700000000000012200324404024452 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/linux/byteorder/generic.h0000644000015700001700000000135112200324306026240 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_BYTEORDER_GENERIC_H #define _LINUX_BYTEORDER_GENERIC_H #endif android-audiosystem-1.8+13.10.20130807/include/linux/byteorder/swab.h0000644000015700001700000000767112200324306025573 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_BYTEORDER_SWAB_H #define _LINUX_BYTEORDER_SWAB_H #include #define ___swab16(x) ({ __u16 __x = (x); ((__u16)( (((__u16)(__x) & (__u16)0x00ffU) << 8) | (((__u16)(__x) & (__u16)0xff00U) >> 8) )); }) #define ___swab32(x) ({ __u32 __x = (x); ((__u32)( (((__u32)(__x) & (__u32)0x000000ffUL) << 24) | (((__u32)(__x) & (__u32)0x0000ff00UL) << 8) | (((__u32)(__x) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(__x) & (__u32)0xff000000UL) >> 24) )); }) #define ___swab64(x) ({ __u64 __x = (x); ((__u64)( (__u64)(((__u64)(__x) & (__u64)0x00000000000000ffULL) << 56) | (__u64)(((__u64)(__x) & (__u64)0x000000000000ff00ULL) << 40) | (__u64)(((__u64)(__x) & (__u64)0x0000000000ff0000ULL) << 24) | (__u64)(((__u64)(__x) & (__u64)0x00000000ff000000ULL) << 8) | (__u64)(((__u64)(__x) & (__u64)0x000000ff00000000ULL) >> 8) | (__u64)(((__u64)(__x) & (__u64)0x0000ff0000000000ULL) >> 24) | (__u64)(((__u64)(__x) & (__u64)0x00ff000000000000ULL) >> 40) | (__u64)(((__u64)(__x) & (__u64)0xff00000000000000ULL) >> 56) )); }) #define ___constant_swab16(x) ((__u16)( (((__u16)(x) & (__u16)0x00ffU) << 8) | (((__u16)(x) & (__u16)0xff00U) >> 8) )) #define ___constant_swab32(x) ((__u32)( (((__u32)(x) & (__u32)0x000000ffUL) << 24) | (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(x) & (__u32)0xff000000UL) >> 24) )) #define ___constant_swab64(x) ((__u64)( (__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | (__u64)(((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | (__u64)(((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | (__u64)(((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | (__u64)(((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | (__u64)(((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | (__u64)(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | (__u64)(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56) )) #ifndef __arch__swab16 #define __arch__swab16(x) ({ __u16 __tmp = (x) ; ___swab16(__tmp); }) #endif #ifndef __arch__swab32 #define __arch__swab32(x) ({ __u32 __tmp = (x) ; ___swab32(__tmp); }) #endif #ifndef __arch__swab64 #define __arch__swab64(x) ({ __u64 __tmp = (x) ; ___swab64(__tmp); }) #endif #ifndef __arch__swab16p #define __arch__swab16p(x) __arch__swab16(*(x)) #endif #ifndef __arch__swab32p #define __arch__swab32p(x) __arch__swab32(*(x)) #endif #ifndef __arch__swab64p #define __arch__swab64p(x) __arch__swab64(*(x)) #endif #ifndef __arch__swab16s #define __arch__swab16s(x) do { *(x) = __arch__swab16p((x)); } while (0) #endif #ifndef __arch__swab32s #define __arch__swab32s(x) do { *(x) = __arch__swab32p((x)); } while (0) #endif #ifndef __arch__swab64s #define __arch__swab64s(x) do { *(x) = __arch__swab64p((x)); } while (0) #endif #if defined(__GNUC__) && defined(__OPTIMIZE__) #define __swab16(x) (__builtin_constant_p((__u16)(x)) ? ___swab16((x)) : __fswab16((x))) #define __swab32(x) (__builtin_constant_p((__u32)(x)) ? ___swab32((x)) : __fswab32((x))) #define __swab64(x) (__builtin_constant_p((__u64)(x)) ? ___swab64((x)) : __fswab64((x))) #else #define __swab16(x) __fswab16(x) #define __swab32(x) __fswab32(x) #define __swab64(x) __fswab64(x) #endif #ifdef __BYTEORDER_HAS_U64__ #ifdef __SWAB_64_THRU_32__ #else #endif #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/byteorder/little_endian.h0000644000015700001700000000633512200324306027446 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_BYTEORDER_LITTLE_ENDIAN_H #define _LINUX_BYTEORDER_LITTLE_ENDIAN_H #ifndef __LITTLE_ENDIAN #define __LITTLE_ENDIAN 1234 #endif #ifndef __LITTLE_ENDIAN_BITFIELD #define __LITTLE_ENDIAN_BITFIELD #endif #include #include #define __constant_htonl(x) ((__force __be32)___constant_swab32((x))) #define __constant_ntohl(x) ___constant_swab32((__force __be32)(x)) #define __constant_htons(x) ((__force __be16)___constant_swab16((x))) #define __constant_ntohs(x) ___constant_swab16((__force __be16)(x)) #define __constant_cpu_to_le64(x) ((__force __le64)(__u64)(x)) #define __constant_le64_to_cpu(x) ((__force __u64)(__le64)(x)) #define __constant_cpu_to_le32(x) ((__force __le32)(__u32)(x)) #define __constant_le32_to_cpu(x) ((__force __u32)(__le32)(x)) #define __constant_cpu_to_le16(x) ((__force __le16)(__u16)(x)) #define __constant_le16_to_cpu(x) ((__force __u16)(__le16)(x)) #define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x))) #define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x)) #define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x))) #define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32)(__be32)(x)) #define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x))) #define __constant_be16_to_cpu(x) ___constant_swab16((__force __u16)(__be16)(x)) #define __cpu_to_le64(x) ((__force __le64)(__u64)(x)) #define __le64_to_cpu(x) ((__force __u64)(__le64)(x)) #define __cpu_to_le32(x) ((__force __le32)(__u32)(x)) #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) #define __cpu_to_le16(x) ((__force __le16)(__u16)(x)) #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) #define __cpu_to_be64(x) ((__force __be64)__swab64((x))) #define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x)) #define __cpu_to_be32(x) ((__force __be32)__swab32((x))) #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x)) #define __cpu_to_be16(x) ((__force __be16)__swab16((x))) #define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x)) #define __cpu_to_le64s(x) do {} while (0) #define __le64_to_cpus(x) do {} while (0) #define __cpu_to_le32s(x) do {} while (0) #define __le32_to_cpus(x) do {} while (0) #define __cpu_to_le16s(x) do {} while (0) #define __le16_to_cpus(x) do {} while (0) #define __cpu_to_be64s(x) __swab64s((x)) #define __be64_to_cpus(x) __swab64s((x)) #define __cpu_to_be32s(x) __swab32s((x)) #define __be32_to_cpus(x) __swab32s((x)) #define __cpu_to_be16s(x) __swab16s((x)) #define __be16_to_cpus(x) __swab16s((x)) #include #endif android-audiosystem-1.8+13.10.20130807/include/linux/byteorder/swabb.h0000644000015700001700000000422712200324306025727 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_BYTEORDER_SWABB_H #define _LINUX_BYTEORDER_SWABB_H #define ___swahw32(x) ({ __u32 __x = (x); ((__u32)( (((__u32)(__x) & (__u32)0x0000ffffUL) << 16) | (((__u32)(__x) & (__u32)0xffff0000UL) >> 16) )); }) #define ___swahb32(x) ({ __u32 __x = (x); ((__u32)( (((__u32)(__x) & (__u32)0x00ff00ffUL) << 8) | (((__u32)(__x) & (__u32)0xff00ff00UL) >> 8) )); }) #define ___constant_swahw32(x) ((__u32)( (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | (((__u32)(x) & (__u32)0xffff0000UL) >> 16) )) #define ___constant_swahb32(x) ((__u32)( (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | (((__u32)(x) & (__u32)0xff00ff00UL) >> 8) )) #ifndef __arch__swahw32 #define __arch__swahw32(x) ___swahw32(x) #endif #ifndef __arch__swahb32 #define __arch__swahb32(x) ___swahb32(x) #endif #ifndef __arch__swahw32p #define __arch__swahw32p(x) __swahw32(*(x)) #endif #ifndef __arch__swahb32p #define __arch__swahb32p(x) __swahb32(*(x)) #endif #ifndef __arch__swahw32s #define __arch__swahw32s(x) do { *(x) = __swahw32p((x)); } while (0) #endif #ifndef __arch__swahb32s #define __arch__swahb32s(x) do { *(x) = __swahb32p((x)); } while (0) #endif #if defined(__GNUC__) && defined(__OPTIMIZE__) #define __swahw32(x) (__builtin_constant_p((__u32)(x)) ? ___swahw32((x)) : __fswahw32((x))) #define __swahb32(x) (__builtin_constant_p((__u32)(x)) ? ___swahb32((x)) : __fswahb32((x))) #else #define __swahw32(x) __fswahw32(x) #define __swahb32(x) __fswahb32(x) #endif #ifdef __BYTEORDER_HAS_U64__ #endif #endif android-audiosystem-1.8+13.10.20130807/include/linux/byteorder/big_endian.h0000644000015700001700000000623312200324306026707 0ustar pbuserpbgroup00000000000000/**************************************************************************** **************************************************************************** *** *** This header was automatically generated from a Linux kernel header *** of the same name, to make information necessary for userspace to *** call into the kernel available to libc. It contains only constants, *** structures, and macros generated from the original header, and thus, *** contains no copyrightable information. *** **************************************************************************** ****************************************************************************/ #ifndef _LINUX_BYTEORDER_BIG_ENDIAN_H #define _LINUX_BYTEORDER_BIG_ENDIAN_H #ifndef __BIG_ENDIAN #define __BIG_ENDIAN 4321 #endif #ifndef __BIG_ENDIAN_BITFIELD #define __BIG_ENDIAN_BITFIELD #endif #include #include #define __constant_htonl(x) ((__force __be32)(__u32)(x)) #define __constant_ntohl(x) ((__force __u32)(__be32)(x)) #define __constant_htons(x) ((__force __be16)(__u16)(x)) #define __constant_ntohs(x) ((__force __u16)(__be16)(x)) #define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x))) #define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x)) #define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x))) #define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x)) #define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x))) #define __constant_le16_to_cpu(x) ___constant_swab16((__force __u16)(__le16)(x)) #define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x)) #define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x)) #define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x)) #define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x)) #define __constant_cpu_to_be16(x) ((__force __be16)(__u16)(x)) #define __constant_be16_to_cpu(x) ((__force __u16)(__be16)(x)) #define __cpu_to_le64(x) ((__force __le64)__swab64((x))) #define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x)) #define __cpu_to_le32(x) ((__force __le32)__swab32((x))) #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x)) #define __cpu_to_le16(x) ((__force __le16)__swab16((x))) #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x)) #define __cpu_to_be64(x) ((__force __be64)(__u64)(x)) #define __be64_to_cpu(x) ((__force __u64)(__be64)(x)) #define __cpu_to_be32(x) ((__force __be32)(__u32)(x)) #define __be32_to_cpu(x) ((__force __u32)(__be32)(x)) #define __cpu_to_be16(x) ((__force __be16)(__u16)(x)) #define __be16_to_cpu(x) ((__force __u16)(__be16)(x)) #define __cpu_to_le64s(x) __swab64s((x)) #define __le64_to_cpus(x) __swab64s((x)) #define __cpu_to_le32s(x) __swab32s((x)) #define __le32_to_cpus(x) __swab32s((x)) #define __cpu_to_le16s(x) __swab16s((x)) #define __le16_to_cpus(x) __swab16s((x)) #define __cpu_to_be64s(x) do {} while (0) #define __be64_to_cpus(x) do {} while (0) #define __cpu_to_be32s(x) do {} while (0) #define __be32_to_cpus(x) do {} while (0) #define __cpu_to_be16s(x) do {} while (0) #define __be16_to_cpus(x) do {} while (0) #include #endif android-audiosystem-1.8+13.10.20130807/include/waudio/0000755000015700001700000000000012200324404022604 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/waudio/android_audio_wrapper_define.h0000644000015700001700000000306012200324306030630 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 Motorola * Copyright (C) 2011-2012 Canonical, Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_WRAPPER_DEFINE_H #define ANDROID_AUDIO_WRAPPER_DEFINE_H #define ANDROID_AUDIO_WRAPPER_ERROR_START 0x9000000 typedef unsigned long uint32; typedef int status_type; typedef void* TrackHandle; typedef void* RecordHandle; typedef int AudioIOHandle; typedef void (*callback_t)(int event, void* user, void *info); #define AUDIO_PARAMETER_ROUTING "routing" #define AUDIO_PARAMETER_FORMAT "format" #define AUDIO_PARAMETER_CHANNELS "channels" #define AUDIO_PARAMETER_FRAME_COUNT "frame_count" #define AUDIO_PARAMETER_INPUT_SOURCE "input_source" enum{ OK = 0, NO_ERROR = 0, //UNKNOWN_ERROR, //INIT_FAIL = -ENODEV, INVALID_PARAM = ANDROID_AUDIO_WRAPPER_ERROR_START }; // Audio sub formats (see AudioSystem::audio_format). enum pcm_sub_format { PCM_SUB_16_BIT = 0x1, // must be 1 for backward compatibility PCM_SUB_8_BIT = 0x2, // must be 2 for backward compatibility }; #endif android-audiosystem-1.8+13.10.20130807/include/waudio/android_audio_wrapper.h0000644000015700001700000000603612200324306027324 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 Motorola * Copyright (C) 2011-2012 Canonical, Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_WRAPPER_H #define ANDROID_AUDIO_WRAPPER_H #include #include #include "android_audio_wrapper_define.h" //#include //#ifdef _cplusplus //extern "C" //{ //#endif typedef struct _buffer_struct{ // enum { // MUTE = 0x00000001 // }; uint32_t flags; int channelCount; int format; size_t frameCount; size_t size; union { void* raw; short* i16; int8_t* i8; }; }buffer_struct; /*Audio Track related interface*/ TrackHandle CreateAudioTrack(); void DestoryAudioTrack(TrackHandle handle); void AudioTrack_start(TrackHandle handle); void AudioTrack_stop(TrackHandle handle); status_type AudioTrack_getposition(TrackHandle handle,uint32 *position); //status_type AudioTrack_setposition(TrackHandle handle,int32_t position); size_t AudioTrack_write(TrackHandle handle,const void *buffer, size_t size); status_type AudioTrack_set(TrackHandle handle,stream_type streamtype, uint32 samplerate,audio_format format, audio_channels hannel); void AudioTrack_pause(TrackHandle handle); status_type AudioTrack_set_asyn(TrackHandle handle,stream_type streamtype, uint32 samplerate,audio_format format, audio_channels hannel,callback_t cbf,void* user); uint32 AudioTrack_latency(TrackHandle handle); void AudioTrack_mute(TrackHandle handle, int muted); /*Audio Record related interface*/ RecordHandle CreateAudioRecord(); void DestoryAudioRecord(RecordHandle handle); void AudioRecord_start(RecordHandle handle); void AudioRecord_stop(RecordHandle handle); status_type AudioRecord_getposition(RecordHandle handle,int32_t *position); //status_type AudioRecord_setposition(RecordHandle handle,int32_t position); size_t AudioRecord_read(RecordHandle handle,void *buffer, size_t size); status_type AudioRecord_set(RecordHandle handle,audio_source inputsource); //void AudioRecord_pause(RecordHandle handle); uint32 AudioRecord_latency(RecordHandle handle); /*Audio System related interface*/ status_type AudioSystem_getStreamVolumeIndex(stream_type streamtype,int *index ); status_type AudioSystem_getStreamMute(stream_type streamtype, int *mute ); status_type AudioSystem_setStreamVolumeIndex(stream_type streamtype,int index ); status_type AudioSystem_setStreamMute(stream_type streamtype, int mute ); //#ifdef _cplusplus //} //#endif #endif android-audiosystem-1.8+13.10.20130807/include/audio_utils/0000755000015700001700000000000012200324404023635 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/audio_utils/fixedfft.h0000644000015700001700000000156212200324306025612 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_FIXEDFFT_H #define ANDROID_AUDIO_FIXEDFFT_H #include #include __BEGIN_DECLS /* See description in fixedfft.cpp */ extern void fixed_fft_real(int n, int32_t *v); __END_DECLS #endif // ANDROID_AUDIO_FIXEDFFT_H android-audiosystem-1.8+13.10.20130807/include/audio_utils/echo_reference.h0000644000015700001700000000506112200324306026745 0ustar pbuserpbgroup00000000000000/* ** Copyright 2011, The Android Open-Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #ifndef ANDROID_ECHO_REFERENCE_H #define ANDROID_ECHO_REFERENCE_H #include #include __BEGIN_DECLS /* Buffer descriptor used by read() and write() methods, including the time stamp and delay. */ struct echo_reference_buffer { void *raw; // pointer to audio frame size_t frame_count; // number of frames in buffer int32_t delay_ns; // delay for this buffer (see comment below) struct timespec time_stamp; // time stamp for this buffer (see comment below) // default ALSA gettimeofday() format }; /** * + as input: * - delay_ns is the delay introduced by playback buffers * - time_stamp is the time stamp corresponding to the delay calculation * + as output: * unused * when used for EchoReference::read(): * + as input: * - delay_ns is the delay introduced by capture buffers * - time_stamp is the time stamp corresponding to the delay calculation * + as output: * - delay_ns is the delay between the returned frames and the capture time derived from * delay and time stamp indicated as input. This delay is to be communicated to the AEC. * - frame_count is updated with the actual number of frames returned */ struct echo_reference_itfe { int (*read)(struct echo_reference_itfe *echo_reference, struct echo_reference_buffer *buffer); int (*write)(struct echo_reference_itfe *echo_reference, struct echo_reference_buffer *buffer); }; int create_echo_reference(audio_format_t rdFormat, uint32_t rdChannelCount, uint32_t rdSamplingRate, audio_format_t wrFormat, uint32_t wrChannelCount, uint32_t wrSamplingRate, struct echo_reference_itfe **); void release_echo_reference(struct echo_reference_itfe *echo_reference); __END_DECLS #endif // ANDROID_ECHO_REFERENCE_H android-audiosystem-1.8+13.10.20130807/include/audio_utils/primitives.h0000644000015700001700000001234112200324306026203 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_PRIMITIVES_H #define ANDROID_AUDIO_PRIMITIVES_H #include #include #include __BEGIN_DECLS /** * Dither and clamp pairs of 32-bit input samples (sums) to 16-bit output samples (out). * Each 32-bit input sample is a signed fixed-point Q19.12. * The .12 fraction is dithered, and the integer portion is then clamped to Q15. * For interleaved stereo, c is the number of sample pairs, * and out is an array of interleaved pairs of 16-bit samples per channel. * For mono, c is the number of samples / 2, and out is an array of 16-bit samples. * The name "dither" is a misnomer; the current implementation does not actually dither * but uses truncation. This may change. */ void ditherAndClamp(int32_t* out, const int32_t *sums, size_t c); /* Expand and copy samples from unsigned 8-bit offset by 0x80 to signed 16-bit. * Parameters: * dst Destination buffer * src Source buffer * count Number of samples to copy * The destination and source buffers must either be completely separate (non-overlapping), or * they must both start at the same address. Partially overlapping buffers are not supported. */ void memcpy_to_i16_from_u8(int16_t *dst, const uint8_t *src, size_t count); /* Downmix pairs of interleaved stereo input 16-bit samples to mono output 16-bit samples. * Parameters: * dst Destination buffer * src Source buffer * count Number of stereo frames to downmix * The destination and source buffers must be completely separate (non-overlapping). * The current implementation truncates the sum rather than dither, but this may change. */ void downmix_to_mono_i16_from_stereo_i16(int16_t *dst, const int16_t *src, size_t count); /* Upmix mono input 16-bit samples to pairs of interleaved stereo output 16-bit samples by * duplicating. * Parameters: * dst Destination buffer * src Source buffer * count Number of mono samples to upmix * The destination and source buffers must be completely separate (non-overlapping). */ void upmix_to_stereo_i16_from_mono_i16(int16_t *dst, const int16_t *src, size_t count); /** * Clamp (aka hard limit or clip) a signed 32-bit sample to 16-bit range. */ static inline int16_t clamp16(int32_t sample) { if ((sample>>15) ^ (sample>>31)) sample = 0x7FFF ^ (sample>>31); return sample; } /** * Multiply-accumulate 16-bit terms with 32-bit result: return a + in*v. */ static inline int32_t mulAdd(int16_t in, int16_t v, int32_t a) { #if defined(__arm__) && !defined(__thumb__) int32_t out; asm( "smlabb %[out], %[in], %[v], %[a] \n" : [out]"=r"(out) : [in]"%r"(in), [v]"r"(v), [a]"r"(a) : ); return out; #else return a + in * (int32_t)v; #endif } /** * Multiply 16-bit terms with 32-bit result: return in*v. */ static inline int32_t mul(int16_t in, int16_t v) { #if defined(__arm__) && !defined(__thumb__) int32_t out; asm( "smulbb %[out], %[in], %[v] \n" : [out]"=r"(out) : [in]"%r"(in), [v]"r"(v) : ); return out; #else return in * (int32_t)v; #endif } /** * Similar to mulAdd, but the 16-bit terms are extracted from a 32-bit interleaved stereo pair. */ static inline int32_t mulAddRL(int left, uint32_t inRL, uint32_t vRL, int32_t a) { #if defined(__arm__) && !defined(__thumb__) int32_t out; if (left) { asm( "smlabb %[out], %[inRL], %[vRL], %[a] \n" : [out]"=r"(out) : [inRL]"%r"(inRL), [vRL]"r"(vRL), [a]"r"(a) : ); } else { asm( "smlatt %[out], %[inRL], %[vRL], %[a] \n" : [out]"=r"(out) : [inRL]"%r"(inRL), [vRL]"r"(vRL), [a]"r"(a) : ); } return out; #else if (left) { return a + (int16_t)(inRL&0xFFFF) * (int16_t)(vRL&0xFFFF); } else { return a + (int16_t)(inRL>>16) * (int16_t)(vRL>>16); } #endif } /** * Similar to mul, but the 16-bit terms are extracted from a 32-bit interleaved stereo pair. */ static inline int32_t mulRL(int left, uint32_t inRL, uint32_t vRL) { #if defined(__arm__) && !defined(__thumb__) int32_t out; if (left) { asm( "smulbb %[out], %[inRL], %[vRL] \n" : [out]"=r"(out) : [inRL]"%r"(inRL), [vRL]"r"(vRL) : ); } else { asm( "smultt %[out], %[inRL], %[vRL] \n" : [out]"=r"(out) : [inRL]"%r"(inRL), [vRL]"r"(vRL) : ); } return out; #else if (left) { return (int16_t)(inRL&0xFFFF) * (int16_t)(vRL&0xFFFF); } else { return (int16_t)(inRL>>16) * (int16_t)(vRL>>16); } #endif } __END_DECLS #endif // ANDROID_AUDIO_PRIMITIVES_H android-audiosystem-1.8+13.10.20130807/include/audio_utils/resampler.h0000644000015700001700000000671112200324306026006 0ustar pbuserpbgroup00000000000000/* ** Copyright 2008, The Android Open-Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #ifndef ANDROID_RESAMPLER_H #define ANDROID_RESAMPLER_H #include #include __BEGIN_DECLS #define RESAMPLER_QUALITY_MAX 10 #define RESAMPLER_QUALITY_MIN 0 #define RESAMPLER_QUALITY_DEFAULT 4 #define RESAMPLER_QUALITY_VOIP 3 #define RESAMPLER_QUALITY_DESKTOP 5 struct resampler_buffer { union { void* raw; short* i16; int8_t* i8; }; size_t frame_count; }; /* call back interface used by the resampler to get new data */ struct resampler_buffer_provider { /** * get a new buffer of data: * as input: buffer->frame_count is the number of frames requested * as output: buffer->frame_count is the number of frames returned * buffer->raw points to data returned */ int (*get_next_buffer)(struct resampler_buffer_provider *provider, struct resampler_buffer *buffer); /** * release a consumed buffer of data: * as input: buffer->frame_count is the number of frames released * buffer->raw points to data released */ void (*release_buffer)(struct resampler_buffer_provider *provider, struct resampler_buffer *buffer); }; /* resampler interface */ struct resampler_itfe { /** * reset resampler state */ void (*reset)(struct resampler_itfe *resampler); /** * resample input from buffer provider and output at most *outFrameCount to out buffer. * *outFrameCount is updated with the actual number of frames produced. */ int (*resample_from_provider)(struct resampler_itfe *resampler, int16_t *out, size_t *outFrameCount); /** * resample at most *inFrameCount frames from in buffer and output at most * *outFrameCount to out buffer. *inFrameCount and *outFrameCount are updated respectively * with the number of frames remaining in input and written to output. */ int (*resample_from_input)(struct resampler_itfe *resampler, int16_t *in, size_t *inFrameCount, int16_t *out, size_t *outFrameCount); /** * return the latency introduced by the resampler in ns. */ int32_t (*delay_ns)(struct resampler_itfe *resampler); }; /** * create a resampler according to input parameters passed. * If resampler_buffer_provider is not NULL only resample_from_provider() can be called. * If resampler_buffer_provider is NULL only resample_from_input() can be called. */ int create_resampler(uint32_t inSampleRate, uint32_t outSampleRate, uint32_t channelCount, uint32_t quality, struct resampler_buffer_provider *provider, struct resampler_itfe **); /** * release resampler resources. */ void release_resampler(struct resampler_itfe *); __END_DECLS #endif // ANDROID_RESAMPLER_H android-audiosystem-1.8+13.10.20130807/include/system/0000755000015700001700000000000012200324404022640 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/include/system/audio.h0000644000015700001700000007145512200324306024127 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * Copyright (c) 2012, The Linux Foundation. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_CORE_H #define ANDROID_AUDIO_CORE_H #include #include #include #include #include __BEGIN_DECLS /* The enums were moved here mostly from * frameworks/base/include/media/AudioSystem.h */ typedef int audio_io_handle_t; /* Audio stream types */ typedef enum { AUDIO_STREAM_DEFAULT = -1, AUDIO_STREAM_VOICE_CALL = 0, AUDIO_STREAM_SYSTEM = 1, AUDIO_STREAM_RING = 2, AUDIO_STREAM_MUSIC = 3, AUDIO_STREAM_ALARM = 4, AUDIO_STREAM_NOTIFICATION = 5, AUDIO_STREAM_BLUETOOTH_SCO = 6, AUDIO_STREAM_ENFORCED_AUDIBLE = 7, /* Sounds that cannot be muted by user and must be routed to speaker */ AUDIO_STREAM_DTMF = 8, AUDIO_STREAM_TTS = 9, AUDIO_STREAM_CNT, AUDIO_STREAM_MAX = AUDIO_STREAM_CNT - 1, } audio_stream_type_t; /* Do not change these values without updating their counterparts * in media/java/android/media/MediaRecorder.java! */ typedef enum { AUDIO_SOURCE_DEFAULT = 0, AUDIO_SOURCE_MIC = 1, AUDIO_SOURCE_VOICE_UPLINK = 2, AUDIO_SOURCE_VOICE_DOWNLINK = 3, AUDIO_SOURCE_VOICE_CALL = 4, AUDIO_SOURCE_CAMCORDER = 5, AUDIO_SOURCE_VOICE_RECOGNITION = 6, AUDIO_SOURCE_VOICE_COMMUNICATION = 7, AUDIO_SOURCE_REMOTE_SUBMIX = 8, /* Source for the mix to be presented remotely. */ /* An example of remote presentation is Wifi Display */ /* where a dongle attached to a TV can be used to */ /* play the mix captured by this audio source. */ AUDIO_SOURCE_CNT, AUDIO_SOURCE_MAX = AUDIO_SOURCE_CNT - 1, } audio_source_t; /* special audio session values * (XXX: should this be living in the audio effects land?) */ typedef enum { /* session for effects attached to a particular output stream * (value must be less than 0) */ AUDIO_SESSION_OUTPUT_STAGE = -1, /* session for effects applied to output mix. These effects can * be moved by audio policy manager to another output stream * (value must be 0) */ AUDIO_SESSION_OUTPUT_MIX = 0, } audio_session_t; /* Audio sub formats (see enum audio_format). */ /* PCM sub formats */ typedef enum { AUDIO_FORMAT_PCM_SUB_16_BIT = 0x1, /* DO NOT CHANGE - PCM signed 16 bits */ AUDIO_FORMAT_PCM_SUB_8_BIT = 0x2, /* DO NOT CHANGE - PCM unsigned 8 bits */ AUDIO_FORMAT_PCM_SUB_32_BIT = 0x3, /* PCM signed .31 fixed point */ AUDIO_FORMAT_PCM_SUB_8_24_BIT = 0x4, /* PCM signed 7.24 fixed point */ } audio_format_pcm_sub_fmt_t; /* MP3 sub format field definition : can use 11 LSBs in the same way as MP3 * frame header to specify bit rate, stereo mode, version... */ typedef enum { AUDIO_FORMAT_MP3_SUB_NONE = 0x0, } audio_format_mp3_sub_fmt_t; /* AMR NB/WB sub format field definition: specify frame block interleaving, * bandwidth efficient or octet aligned, encoding mode for recording... */ typedef enum { AUDIO_FORMAT_AMR_SUB_NONE = 0x0, } audio_format_amr_sub_fmt_t; /* AAC sub format field definition: specify profile or bitrate for recording... */ typedef enum { AUDIO_FORMAT_AAC_SUB_NONE = 0x0, } audio_format_aac_sub_fmt_t; /* VORBIS sub format field definition: specify quality for recording... */ typedef enum { AUDIO_FORMAT_VORBIS_SUB_NONE = 0x0, } audio_format_vorbis_sub_fmt_t; /* Audio format consists in a main format field (upper 8 bits) and a sub format * field (lower 24 bits). * * The main format indicates the main codec type. The sub format field * indicates options and parameters for each format. The sub format is mainly * used for record to indicate for instance the requested bitrate or profile. * It can also be used for certain formats to give informations not present in * the encoded audio stream (e.g. octet alignement for AMR). */ typedef enum { AUDIO_FORMAT_INVALID = 0xFFFFFFFFUL, AUDIO_FORMAT_DEFAULT = 0, AUDIO_FORMAT_PCM = 0x00000000UL, /* DO NOT CHANGE */ AUDIO_FORMAT_MP3 = 0x01000000UL, AUDIO_FORMAT_AMR_NB = 0x02000000UL, AUDIO_FORMAT_AMR_WB = 0x03000000UL, AUDIO_FORMAT_AAC = 0x04000000UL, AUDIO_FORMAT_HE_AAC_V1 = 0x05000000UL, AUDIO_FORMAT_HE_AAC_V2 = 0x06000000UL, AUDIO_FORMAT_VORBIS = 0x07000000UL, #ifdef QCOM_HARDWARE AUDIO_FORMAT_EVRC = 0x08000000UL, AUDIO_FORMAT_QCELP = 0x09000000UL, AUDIO_FORMAT_AC3 = 0x0a000000UL, AUDIO_FORMAT_AC3_PLUS = 0x0b000000UL, AUDIO_FORMAT_DTS = 0x0c000000UL, AUDIO_FORMAT_WMA = 0x0d000000UL, AUDIO_FORMAT_WMA_PRO = 0x0e000000UL, AUDIO_FORMAT_AAC_ADIF = 0x0f000000UL, AUDIO_FORMAT_EVRCB = 0x10000000UL, AUDIO_FORMAT_EVRCWB = 0x11000000UL, AUDIO_FORMAT_EAC3 = 0x12000000UL, AUDIO_FORMAT_DTS_LBR = 0x13000000UL, AUDIO_FORMAT_AMR_WB_PLUS = 0x14000000UL, AUDIO_FORMAT_MP2 = 0x15000000UL, #endif AUDIO_FORMAT_MAIN_MASK = 0xFF000000UL, AUDIO_FORMAT_SUB_MASK = 0x00FFFFFFUL, /* Aliases */ AUDIO_FORMAT_PCM_16_BIT = (AUDIO_FORMAT_PCM | AUDIO_FORMAT_PCM_SUB_16_BIT), AUDIO_FORMAT_PCM_8_BIT = (AUDIO_FORMAT_PCM | AUDIO_FORMAT_PCM_SUB_8_BIT), AUDIO_FORMAT_PCM_32_BIT = (AUDIO_FORMAT_PCM | AUDIO_FORMAT_PCM_SUB_32_BIT), AUDIO_FORMAT_PCM_8_24_BIT = (AUDIO_FORMAT_PCM | AUDIO_FORMAT_PCM_SUB_8_24_BIT), } audio_format_t; enum { /* output channels */ AUDIO_CHANNEL_OUT_FRONT_LEFT = 0x1, AUDIO_CHANNEL_OUT_FRONT_RIGHT = 0x2, AUDIO_CHANNEL_OUT_FRONT_CENTER = 0x4, AUDIO_CHANNEL_OUT_LOW_FREQUENCY = 0x8, AUDIO_CHANNEL_OUT_BACK_LEFT = 0x10, AUDIO_CHANNEL_OUT_BACK_RIGHT = 0x20, AUDIO_CHANNEL_OUT_FRONT_LEFT_OF_CENTER = 0x40, AUDIO_CHANNEL_OUT_FRONT_RIGHT_OF_CENTER = 0x80, AUDIO_CHANNEL_OUT_BACK_CENTER = 0x100, AUDIO_CHANNEL_OUT_SIDE_LEFT = 0x200, AUDIO_CHANNEL_OUT_SIDE_RIGHT = 0x400, AUDIO_CHANNEL_OUT_TOP_CENTER = 0x800, AUDIO_CHANNEL_OUT_TOP_FRONT_LEFT = 0x1000, AUDIO_CHANNEL_OUT_TOP_FRONT_CENTER = 0x2000, AUDIO_CHANNEL_OUT_TOP_FRONT_RIGHT = 0x4000, AUDIO_CHANNEL_OUT_TOP_BACK_LEFT = 0x8000, AUDIO_CHANNEL_OUT_TOP_BACK_CENTER = 0x10000, AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT = 0x20000, AUDIO_CHANNEL_OUT_MONO = AUDIO_CHANNEL_OUT_FRONT_LEFT, AUDIO_CHANNEL_OUT_STEREO = (AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT), #ifdef QCOM_HARDWARE AUDIO_CHANNEL_OUT_2POINT1 = (AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_FRONT_CENTER), #endif AUDIO_CHANNEL_OUT_QUAD = (AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_BACK_LEFT | AUDIO_CHANNEL_OUT_BACK_RIGHT), AUDIO_CHANNEL_OUT_SURROUND = (AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_BACK_CENTER), #ifdef QCOM_HARDWARE AUDIO_CHANNEL_OUT_PENTA = (AUDIO_CHANNEL_OUT_QUAD | AUDIO_CHANNEL_OUT_FRONT_CENTER), #endif AUDIO_CHANNEL_OUT_5POINT1 = (AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_LOW_FREQUENCY | AUDIO_CHANNEL_OUT_BACK_LEFT | AUDIO_CHANNEL_OUT_BACK_RIGHT), #ifdef QCOM_HARDWARE AUDIO_CHANNEL_OUT_6POINT1 = (AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_LOW_FREQUENCY | AUDIO_CHANNEL_OUT_BACK_LEFT | AUDIO_CHANNEL_OUT_BACK_RIGHT | AUDIO_CHANNEL_OUT_BACK_CENTER), #endif // matches the correct AudioFormat.CHANNEL_OUT_7POINT1_SURROUND definition for 7.1 AUDIO_CHANNEL_OUT_7POINT1 = (AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_LOW_FREQUENCY | AUDIO_CHANNEL_OUT_BACK_LEFT | AUDIO_CHANNEL_OUT_BACK_RIGHT | AUDIO_CHANNEL_OUT_SIDE_LEFT | AUDIO_CHANNEL_OUT_SIDE_RIGHT), AUDIO_CHANNEL_OUT_ALL = (AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_LOW_FREQUENCY | AUDIO_CHANNEL_OUT_BACK_LEFT | AUDIO_CHANNEL_OUT_BACK_RIGHT | AUDIO_CHANNEL_OUT_FRONT_LEFT_OF_CENTER | AUDIO_CHANNEL_OUT_FRONT_RIGHT_OF_CENTER | AUDIO_CHANNEL_OUT_BACK_CENTER| AUDIO_CHANNEL_OUT_SIDE_LEFT| AUDIO_CHANNEL_OUT_SIDE_RIGHT| AUDIO_CHANNEL_OUT_TOP_CENTER| AUDIO_CHANNEL_OUT_TOP_FRONT_LEFT| AUDIO_CHANNEL_OUT_TOP_FRONT_CENTER| AUDIO_CHANNEL_OUT_TOP_FRONT_RIGHT| AUDIO_CHANNEL_OUT_TOP_BACK_LEFT| AUDIO_CHANNEL_OUT_TOP_BACK_CENTER| AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT), /* input channels */ AUDIO_CHANNEL_IN_LEFT = 0x4, AUDIO_CHANNEL_IN_RIGHT = 0x8, AUDIO_CHANNEL_IN_FRONT = 0x10, AUDIO_CHANNEL_IN_BACK = 0x20, AUDIO_CHANNEL_IN_LEFT_PROCESSED = 0x40, AUDIO_CHANNEL_IN_RIGHT_PROCESSED = 0x80, AUDIO_CHANNEL_IN_FRONT_PROCESSED = 0x100, AUDIO_CHANNEL_IN_BACK_PROCESSED = 0x200, AUDIO_CHANNEL_IN_PRESSURE = 0x400, AUDIO_CHANNEL_IN_X_AXIS = 0x800, AUDIO_CHANNEL_IN_Y_AXIS = 0x1000, AUDIO_CHANNEL_IN_Z_AXIS = 0x2000, AUDIO_CHANNEL_IN_VOICE_UPLINK = 0x4000, AUDIO_CHANNEL_IN_VOICE_DNLINK = 0x8000, #ifdef QCOM_HARDWARE AUDIO_CHANNEL_IN_FRONT_LEFT = 0x10000, AUDIO_CHANNEL_IN_FRONT_RIGHT = 0x20000, AUDIO_CHANNEL_IN_FRONT_CENTER = 0x40000, AUDIO_CHANNEL_IN_LOW_FREQUENCY = 0x80000, AUDIO_CHANNEL_IN_BACK_LEFT = 0x100000, AUDIO_CHANNEL_IN_BACK_RIGHT = 0x200000, #endif AUDIO_CHANNEL_IN_MONO = AUDIO_CHANNEL_IN_FRONT, AUDIO_CHANNEL_IN_STEREO = (AUDIO_CHANNEL_IN_LEFT | AUDIO_CHANNEL_IN_RIGHT), #ifdef QCOM_HARDWARE AUDIO_CHANNEL_IN_5POINT1 = (AUDIO_CHANNEL_IN_FRONT_LEFT | AUDIO_CHANNEL_IN_FRONT_RIGHT | AUDIO_CHANNEL_IN_FRONT_CENTER | AUDIO_CHANNEL_IN_LOW_FREQUENCY | AUDIO_CHANNEL_IN_BACK_LEFT | AUDIO_CHANNEL_IN_BACK_RIGHT), AUDIO_CHANNEL_IN_VOICE_UPLINK_MONO = (AUDIO_CHANNEL_IN_VOICE_UPLINK | AUDIO_CHANNEL_IN_MONO), AUDIO_CHANNEL_IN_VOICE_DNLINK_MONO = (AUDIO_CHANNEL_IN_VOICE_DNLINK | AUDIO_CHANNEL_IN_MONO), AUDIO_CHANNEL_IN_VOICE_CALL_MONO = (AUDIO_CHANNEL_IN_VOICE_UPLINK_MONO | AUDIO_CHANNEL_IN_VOICE_DNLINK_MONO), #endif AUDIO_CHANNEL_IN_ALL = (AUDIO_CHANNEL_IN_LEFT | AUDIO_CHANNEL_IN_RIGHT | AUDIO_CHANNEL_IN_FRONT | AUDIO_CHANNEL_IN_BACK| AUDIO_CHANNEL_IN_LEFT_PROCESSED | AUDIO_CHANNEL_IN_RIGHT_PROCESSED | AUDIO_CHANNEL_IN_FRONT_PROCESSED | AUDIO_CHANNEL_IN_BACK_PROCESSED| AUDIO_CHANNEL_IN_PRESSURE | AUDIO_CHANNEL_IN_X_AXIS | AUDIO_CHANNEL_IN_Y_AXIS | AUDIO_CHANNEL_IN_Z_AXIS | #ifdef QCOM_HARDWARE AUDIO_CHANNEL_IN_5POINT1 | #endif AUDIO_CHANNEL_IN_VOICE_UPLINK | AUDIO_CHANNEL_IN_VOICE_DNLINK) }; typedef uint32_t audio_channel_mask_t; typedef enum { AUDIO_MODE_INVALID = -2, AUDIO_MODE_CURRENT = -1, AUDIO_MODE_NORMAL = 0, AUDIO_MODE_RINGTONE = 1, AUDIO_MODE_IN_CALL = 2, AUDIO_MODE_IN_COMMUNICATION = 3, AUDIO_MODE_CNT, AUDIO_MODE_MAX = AUDIO_MODE_CNT - 1, } audio_mode_t; typedef enum { AUDIO_IN_ACOUSTICS_AGC_ENABLE = 0x0001, AUDIO_IN_ACOUSTICS_AGC_DISABLE = 0, AUDIO_IN_ACOUSTICS_NS_ENABLE = 0x0002, AUDIO_IN_ACOUSTICS_NS_DISABLE = 0, AUDIO_IN_ACOUSTICS_TX_IIR_ENABLE = 0x0004, AUDIO_IN_ACOUSTICS_TX_DISABLE = 0, } audio_in_acoustics_t; enum { AUDIO_DEVICE_NONE = 0x0, /* reserved bits */ #if defined(ICS_AUDIO_BLOB) || defined(MR0_AUDIO_BLOB) AUDIO_DEVICE_BIT_IN = 0x10000, #else AUDIO_DEVICE_BIT_IN = 0x80000000, #endif AUDIO_DEVICE_BIT_DEFAULT = 0x40000000, /* output devices */ AUDIO_DEVICE_OUT_EARPIECE = 0x1, AUDIO_DEVICE_OUT_SPEAKER = 0x2, AUDIO_DEVICE_OUT_WIRED_HEADSET = 0x4, AUDIO_DEVICE_OUT_WIRED_HEADPHONE = 0x8, AUDIO_DEVICE_OUT_BLUETOOTH_SCO = 0x10, AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET = 0x20, AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT = 0x40, AUDIO_DEVICE_OUT_BLUETOOTH_A2DP = 0x80, AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES = 0x100, AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER = 0x200, AUDIO_DEVICE_OUT_AUX_DIGITAL = 0x400, AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET = 0x800, AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET = 0x1000, AUDIO_DEVICE_OUT_USB_ACCESSORY = 0x2000, AUDIO_DEVICE_OUT_USB_DEVICE = 0x4000, AUDIO_DEVICE_OUT_REMOTE_SUBMIX = 0x8000, #ifdef QCOM_HARDWARE AUDIO_DEVICE_OUT_ANC_HEADSET = 0x10000, AUDIO_DEVICE_OUT_ANC_HEADPHONE = 0x20000, AUDIO_DEVICE_OUT_PROXY = 0x40000, AUDIO_DEVICE_OUT_FM = 0x80000, AUDIO_DEVICE_OUT_FM_TX = 0x100000, #endif AUDIO_DEVICE_OUT_DEFAULT = AUDIO_DEVICE_BIT_DEFAULT, AUDIO_DEVICE_OUT_ALL = (AUDIO_DEVICE_OUT_EARPIECE | AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE | AUDIO_DEVICE_OUT_BLUETOOTH_SCO | AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET | AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT | AUDIO_DEVICE_OUT_BLUETOOTH_A2DP | AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES | AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER | AUDIO_DEVICE_OUT_AUX_DIGITAL | AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET | AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET | AUDIO_DEVICE_OUT_USB_ACCESSORY | AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_REMOTE_SUBMIX | #ifdef QCOM_HARDWARE AUDIO_DEVICE_OUT_ANC_HEADSET | AUDIO_DEVICE_OUT_ANC_HEADPHONE | AUDIO_DEVICE_OUT_PROXY | AUDIO_DEVICE_OUT_FM | AUDIO_DEVICE_OUT_FM_TX | #endif AUDIO_DEVICE_OUT_DEFAULT), AUDIO_DEVICE_OUT_ALL_A2DP = (AUDIO_DEVICE_OUT_BLUETOOTH_A2DP | AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES | AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER), AUDIO_DEVICE_OUT_ALL_SCO = (AUDIO_DEVICE_OUT_BLUETOOTH_SCO | AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET | AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT), AUDIO_DEVICE_OUT_ALL_USB = (AUDIO_DEVICE_OUT_USB_ACCESSORY | AUDIO_DEVICE_OUT_USB_DEVICE), /* input devices */ #if defined(ICS_AUDIO_BLOB) || defined(MR0_AUDIO_BLOB) AUDIO_DEVICE_IN_COMMUNICATION = AUDIO_DEVICE_BIT_IN * 0x1, AUDIO_DEVICE_IN_AMBIENT = AUDIO_DEVICE_BIT_IN * 0x2, AUDIO_DEVICE_IN_BUILTIN_MIC = AUDIO_DEVICE_BIT_IN * 0x4, AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET = AUDIO_DEVICE_BIT_IN * 0x8, AUDIO_DEVICE_IN_WIRED_HEADSET = AUDIO_DEVICE_BIT_IN * 0x10, AUDIO_DEVICE_IN_AUX_DIGITAL = AUDIO_DEVICE_BIT_IN * 0x20, AUDIO_DEVICE_IN_VOICE_CALL = AUDIO_DEVICE_BIT_IN * 0x40, AUDIO_DEVICE_IN_BACK_MIC = AUDIO_DEVICE_BIT_IN * 0x80, AUDIO_DEVICE_IN_REMOTE_SUBMIX = AUDIO_DEVICE_BIT_IN * 0x100, AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET = AUDIO_DEVICE_BIT_IN * 0x200, AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET = AUDIO_DEVICE_BIT_IN * 0x400, AUDIO_DEVICE_IN_USB_ACCESSORY = AUDIO_DEVICE_BIT_IN * 0x800, AUDIO_DEVICE_IN_USB_DEVICE = AUDIO_DEVICE_BIT_IN * 0x1000, AUDIO_DEVICE_IN_DEFAULT = AUDIO_DEVICE_IN_BUILTIN_MIC, #else AUDIO_DEVICE_IN_COMMUNICATION = AUDIO_DEVICE_BIT_IN | 0x1, AUDIO_DEVICE_IN_AMBIENT = AUDIO_DEVICE_BIT_IN | 0x2, AUDIO_DEVICE_IN_BUILTIN_MIC = AUDIO_DEVICE_BIT_IN | 0x4, AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET = AUDIO_DEVICE_BIT_IN | 0x8, AUDIO_DEVICE_IN_WIRED_HEADSET = AUDIO_DEVICE_BIT_IN | 0x10, AUDIO_DEVICE_IN_AUX_DIGITAL = AUDIO_DEVICE_BIT_IN | 0x20, AUDIO_DEVICE_IN_VOICE_CALL = AUDIO_DEVICE_BIT_IN | 0x40, AUDIO_DEVICE_IN_BACK_MIC = AUDIO_DEVICE_BIT_IN | 0x80, AUDIO_DEVICE_IN_REMOTE_SUBMIX = AUDIO_DEVICE_BIT_IN | 0x100, AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET = AUDIO_DEVICE_BIT_IN | 0x200, AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET = AUDIO_DEVICE_BIT_IN | 0x400, AUDIO_DEVICE_IN_USB_ACCESSORY = AUDIO_DEVICE_BIT_IN | 0x800, AUDIO_DEVICE_IN_USB_DEVICE = AUDIO_DEVICE_BIT_IN | 0x1000, #ifdef QCOM_HARDWARE AUDIO_DEVICE_IN_ANC_HEADSET = AUDIO_DEVICE_BIT_IN | 0x2000, AUDIO_DEVICE_IN_PROXY = AUDIO_DEVICE_BIT_IN | 0x4000, AUDIO_DEVICE_IN_FM_RX = AUDIO_DEVICE_BIT_IN | 0x8000, AUDIO_DEVICE_IN_FM_RX_A2DP = AUDIO_DEVICE_BIT_IN | 0x10000, #endif AUDIO_DEVICE_IN_DEFAULT = AUDIO_DEVICE_BIT_IN | AUDIO_DEVICE_BIT_DEFAULT, #endif AUDIO_DEVICE_IN_ALL = (AUDIO_DEVICE_IN_COMMUNICATION | AUDIO_DEVICE_IN_AMBIENT | AUDIO_DEVICE_IN_BUILTIN_MIC | AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET | AUDIO_DEVICE_IN_WIRED_HEADSET | AUDIO_DEVICE_IN_AUX_DIGITAL | AUDIO_DEVICE_IN_VOICE_CALL | AUDIO_DEVICE_IN_BACK_MIC | AUDIO_DEVICE_IN_REMOTE_SUBMIX | AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET | AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET | AUDIO_DEVICE_IN_USB_ACCESSORY | AUDIO_DEVICE_IN_USB_DEVICE | #ifdef QCOM_HARDWARE AUDIO_DEVICE_IN_ANC_HEADSET | AUDIO_DEVICE_IN_FM_RX | AUDIO_DEVICE_IN_FM_RX_A2DP | AUDIO_DEVICE_IN_PROXY | #endif AUDIO_DEVICE_IN_DEFAULT), AUDIO_DEVICE_IN_ALL_SCO = AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET, }; typedef uint32_t audio_devices_t; /* the audio output flags serve two purposes: * - when an AudioTrack is created they indicate a "wish" to be connected to an * output stream with attributes corresponding to the specified flags * - when present in an output profile descriptor listed for a particular audio * hardware module, they indicate that an output stream can be opened that * supports the attributes indicated by the flags. * the audio policy manager will try to match the flags in the request * (when getOuput() is called) to an available output stream. */ typedef enum { AUDIO_OUTPUT_FLAG_NONE = 0x0, // no attributes AUDIO_OUTPUT_FLAG_DIRECT = 0x1, // this output directly connects a track // to one output stream: no software mixer AUDIO_OUTPUT_FLAG_PRIMARY = 0x2, // this output is the primary output of // the device. It is unique and must be // present. It is opened by default and // receives routing, audio mode and volume // controls related to voice calls. AUDIO_OUTPUT_FLAG_FAST = 0x4, // output supports "fast tracks", // defined elsewhere AUDIO_OUTPUT_FLAG_DEEP_BUFFER = 0x8,// use deep audio buffers #ifdef QCOM_HARDWARE //Qualcomm Flags AUDIO_OUTPUT_FLAG_LPA = 0x1000, // use LPA AUDIO_OUTPUT_FLAG_TUNNEL = 0x2000, // use Tunnel AUDIO_OUTPUT_FLAG_VOIP_RX = 0x4000 // use this flag in combination with DIRECT to // indicate HAL to activate EC & NS // path for VOIP calls #endif } audio_output_flags_t; static inline bool audio_is_output_device(audio_devices_t device) { if (((device & AUDIO_DEVICE_BIT_IN) == 0) && (popcount(device) == 1) && ((device & ~AUDIO_DEVICE_OUT_ALL) == 0)) return true; else return false; } static inline bool audio_is_input_device(audio_devices_t device) { if ((device & AUDIO_DEVICE_BIT_IN) != 0) { device &= ~AUDIO_DEVICE_BIT_IN; if ((popcount(device) == 1) && ((device & ~AUDIO_DEVICE_IN_ALL) == 0)) return true; } return false; } static inline bool audio_is_output_devices(audio_devices_t device) { return (device & AUDIO_DEVICE_BIT_IN) == 0; } static inline bool audio_is_a2dp_device(audio_devices_t device) { if ((popcount(device) == 1) && (device & AUDIO_DEVICE_OUT_ALL_A2DP)) return true; else return false; } static inline bool audio_is_bluetooth_sco_device(audio_devices_t device) { device &= ~AUDIO_DEVICE_BIT_IN; if ((popcount(device) == 1) && (device & (AUDIO_DEVICE_OUT_ALL_SCO | AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET))) return true; else return false; } static inline bool audio_is_usb_device(audio_devices_t device) { if ((popcount(device) == 1) && (device & AUDIO_DEVICE_OUT_ALL_USB)) return true; else return false; } static inline bool audio_is_remote_submix_device(audio_devices_t device) { if ((popcount(device) == 1) && (device & AUDIO_DEVICE_OUT_REMOTE_SUBMIX)) return true; else return false; } static inline bool audio_is_input_channel(uint32_t channel) { if ((channel & ~AUDIO_CHANNEL_IN_ALL) == 0) return true; else return false; } static inline bool audio_is_output_channel(uint32_t channel) { if ((channel & ~AUDIO_CHANNEL_OUT_ALL) == 0) return true; else return false; } /* Derive an output channel mask from a channel count. * This is to be used when the content channel mask is unknown. The 1, 2, 4, 5, 6, 7 and 8 channel * cases are mapped to the standard game/home-theater layouts, but note that 4 is mapped to quad, * and not stereo + FC + mono surround. A channel count of 3 is arbitrarily mapped to stereo + FC * for continuity with stereo. * Returns the matching channel mask, or 0 if the number of channels exceeds that of the * configurations for which a default channel mask is defined. */ static inline audio_channel_mask_t audio_channel_out_mask_from_count(uint32_t channel_count) { switch(channel_count) { case 1: return AUDIO_CHANNEL_OUT_MONO; case 2: return AUDIO_CHANNEL_OUT_STEREO; case 3: return (AUDIO_CHANNEL_OUT_STEREO | AUDIO_CHANNEL_OUT_FRONT_CENTER); case 4: // 4.0 return AUDIO_CHANNEL_OUT_QUAD; case 5: // 5.0 return (AUDIO_CHANNEL_OUT_QUAD | AUDIO_CHANNEL_OUT_FRONT_CENTER); case 6: // 5.1 return AUDIO_CHANNEL_OUT_5POINT1; case 7: // 6.1 return (AUDIO_CHANNEL_OUT_5POINT1 | AUDIO_CHANNEL_OUT_BACK_CENTER); case 8: return AUDIO_CHANNEL_OUT_7POINT1; default: return 0; } } /* Similar to above, but for input. Currently handles mono and stereo and 5.1 input. */ static inline audio_channel_mask_t audio_channel_in_mask_from_count(uint32_t channel_count) { switch (channel_count) { case 1: return AUDIO_CHANNEL_IN_MONO; case 2: return AUDIO_CHANNEL_IN_STEREO; #ifdef QCOM_HARDWARE case 6: return AUDIO_CHANNEL_IN_5POINT1; #endif default: return 0; } } static inline bool audio_is_valid_format(audio_format_t format) { switch (format & AUDIO_FORMAT_MAIN_MASK) { case AUDIO_FORMAT_PCM: if (format != AUDIO_FORMAT_PCM_16_BIT && format != AUDIO_FORMAT_PCM_8_BIT) { return false; } case AUDIO_FORMAT_MP3: case AUDIO_FORMAT_AMR_NB: case AUDIO_FORMAT_AMR_WB: case AUDIO_FORMAT_AAC: case AUDIO_FORMAT_HE_AAC_V1: case AUDIO_FORMAT_HE_AAC_V2: case AUDIO_FORMAT_VORBIS: #ifdef QCOM_HARDWARE case AUDIO_FORMAT_QCELP: case AUDIO_FORMAT_EVRC: case AUDIO_FORMAT_EVRCB: case AUDIO_FORMAT_EVRCWB: case AUDIO_FORMAT_AC3: case AUDIO_FORMAT_EAC3: case AUDIO_FORMAT_AAC_ADIF: case AUDIO_FORMAT_WMA: case AUDIO_FORMAT_WMA_PRO: case AUDIO_FORMAT_DTS: case AUDIO_FORMAT_DTS_LBR: case AUDIO_FORMAT_AMR_WB_PLUS: case AUDIO_FORMAT_MP2: #endif return true; default: return false; } } static inline bool audio_is_linear_pcm(audio_format_t format) { return ((format & AUDIO_FORMAT_MAIN_MASK) == AUDIO_FORMAT_PCM); } static inline size_t audio_bytes_per_sample(audio_format_t format) { size_t size = 0; switch (format) { case AUDIO_FORMAT_PCM_32_BIT: case AUDIO_FORMAT_PCM_8_24_BIT: size = sizeof(int32_t); break; case AUDIO_FORMAT_PCM_16_BIT: size = sizeof(int16_t); break; case AUDIO_FORMAT_PCM_8_BIT: size = sizeof(uint8_t); break; #ifdef QCOM_HARDWARE case AUDIO_FORMAT_AMR_WB: size = 61; break; #endif default: break; } return size; } __END_DECLS #endif // ANDROID_AUDIO_CORE_H android-audiosystem-1.8+13.10.20130807/include/system/window.h0000644000015700001700000007747112200324306024341 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef SYSTEM_CORE_INCLUDE_ANDROID_WINDOW_H #define SYSTEM_CORE_INCLUDE_ANDROID_WINDOW_H #include #include #include #include #include #include #include #include #include #ifdef __cplusplus #include #endif __BEGIN_DECLS /*****************************************************************************/ #define ANDROID_NATIVE_MAKE_CONSTANT(a,b,c,d) \ (((unsigned)(a)<<24)|((unsigned)(b)<<16)|((unsigned)(c)<<8)|(unsigned)(d)) #define ANDROID_NATIVE_WINDOW_MAGIC \ ANDROID_NATIVE_MAKE_CONSTANT('_','w','n','d') #define ANDROID_NATIVE_BUFFER_MAGIC \ ANDROID_NATIVE_MAKE_CONSTANT('_','b','f','r') // --------------------------------------------------------------------------- // This #define may be used to conditionally compile device-specific code to // support either the prior ANativeWindow interface, which did not pass libsync // fences around, or the new interface that does. This #define is only present // when the ANativeWindow interface does include libsync support. #define ANDROID_NATIVE_WINDOW_HAS_SYNC 1 // --------------------------------------------------------------------------- typedef const native_handle_t* buffer_handle_t; // --------------------------------------------------------------------------- typedef struct android_native_rect_t { int32_t left; int32_t top; int32_t right; int32_t bottom; } android_native_rect_t; // --------------------------------------------------------------------------- typedef struct android_native_base_t { /* a magic value defined by the actual EGL native type */ int magic; /* the sizeof() of the actual EGL native type */ int version; void* reserved[4]; /* reference-counting interface */ void (*incRef)(struct android_native_base_t* base); void (*decRef)(struct android_native_base_t* base); } android_native_base_t; typedef struct ANativeWindowBuffer { #ifdef __cplusplus ANativeWindowBuffer() { common.magic = ANDROID_NATIVE_BUFFER_MAGIC; common.version = sizeof(ANativeWindowBuffer); memset(common.reserved, 0, sizeof(common.reserved)); } // Implement the methods that sp expects so that it // can be used to automatically refcount ANativeWindowBuffer's. void incStrong(const void* id) const { common.incRef(const_cast(&common)); } void decStrong(const void* id) const { common.decRef(const_cast(&common)); } #endif struct android_native_base_t common; int width; int height; int stride; int format; int usage; void* reserved[2]; buffer_handle_t handle; void* reserved_proc[8]; } ANativeWindowBuffer_t; // Old typedef for backwards compatibility. typedef ANativeWindowBuffer_t android_native_buffer_t; // --------------------------------------------------------------------------- /* attributes queriable with query() */ enum { NATIVE_WINDOW_WIDTH = 0, NATIVE_WINDOW_HEIGHT = 1, NATIVE_WINDOW_FORMAT = 2, /* The minimum number of buffers that must remain un-dequeued after a buffer * has been queued. This value applies only if set_buffer_count was used to * override the number of buffers and if a buffer has since been queued. * Users of the set_buffer_count ANativeWindow method should query this * value before calling set_buffer_count. If it is necessary to have N * buffers simultaneously dequeued as part of the steady-state operation, * and this query returns M then N+M buffers should be requested via * native_window_set_buffer_count. * * Note that this value does NOT apply until a single buffer has been * queued. In particular this means that it is possible to: * * 1. Query M = min undequeued buffers * 2. Set the buffer count to N + M * 3. Dequeue all N + M buffers * 4. Cancel M buffers * 5. Queue, dequeue, queue, dequeue, ad infinitum */ NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS = 3, /* Check whether queueBuffer operations on the ANativeWindow send the buffer * to the window compositor. The query sets the returned 'value' argument * to 1 if the ANativeWindow DOES send queued buffers directly to the window * compositor and 0 if the buffers do not go directly to the window * compositor. * * This can be used to determine whether protected buffer content should be * sent to the ANativeWindow. Note, however, that a result of 1 does NOT * indicate that queued buffers will be protected from applications or users * capturing their contents. If that behavior is desired then some other * mechanism (e.g. the GRALLOC_USAGE_PROTECTED flag) should be used in * conjunction with this query. */ NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER = 4, /* Get the concrete type of a ANativeWindow. See below for the list of * possible return values. * * This query should not be used outside the Android framework and will * likely be removed in the near future. */ NATIVE_WINDOW_CONCRETE_TYPE = 5, /* * Default width and height of ANativeWindow buffers, these are the * dimensions of the window buffers irrespective of the * NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS call and match the native window * size unless overridden by NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS. */ NATIVE_WINDOW_DEFAULT_WIDTH = 6, NATIVE_WINDOW_DEFAULT_HEIGHT = 7, /* * transformation that will most-likely be applied to buffers. This is only * a hint, the actual transformation applied might be different. * * INTENDED USE: * * The transform hint can be used by a producer, for instance the GLES * driver, to pre-rotate the rendering such that the final transformation * in the composer is identity. This can be very useful when used in * conjunction with the h/w composer HAL, in situations where it * cannot handle arbitrary rotations. * * 1. Before dequeuing a buffer, the GL driver (or any other ANW client) * queries the ANW for NATIVE_WINDOW_TRANSFORM_HINT. * * 2. The GL driver overrides the width and height of the ANW to * account for NATIVE_WINDOW_TRANSFORM_HINT. This is done by querying * NATIVE_WINDOW_DEFAULT_{WIDTH | HEIGHT}, swapping the dimensions * according to NATIVE_WINDOW_TRANSFORM_HINT and calling * native_window_set_buffers_dimensions(). * * 3. The GL driver dequeues a buffer of the new pre-rotated size. * * 4. The GL driver renders to the buffer such that the image is * already transformed, that is applying NATIVE_WINDOW_TRANSFORM_HINT * to the rendering. * * 5. The GL driver calls native_window_set_transform to apply * inverse transformation to the buffer it just rendered. * In order to do this, the GL driver needs * to calculate the inverse of NATIVE_WINDOW_TRANSFORM_HINT, this is * done easily: * * int hintTransform, inverseTransform; * query(..., NATIVE_WINDOW_TRANSFORM_HINT, &hintTransform); * inverseTransform = hintTransform; * if (hintTransform & HAL_TRANSFORM_ROT_90) * inverseTransform ^= HAL_TRANSFORM_ROT_180; * * * 6. The GL driver queues the pre-transformed buffer. * * 7. The composer combines the buffer transform with the display * transform. If the buffer transform happens to cancel out the * display transform then no rotation is needed. * */ NATIVE_WINDOW_TRANSFORM_HINT = 8, /* * Boolean that indicates whether the consumer is running more than * one buffer behind the producer. */ NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND = 9 }; /* Valid operations for the (*perform)() hook. * * Values marked as 'deprecated' are supported, but have been superceded by * other functionality. * * Values marked as 'private' should be considered private to the framework. * HAL implementation code with access to an ANativeWindow should not use these, * as it may not interact properly with the framework's use of the * ANativeWindow. */ enum { NATIVE_WINDOW_SET_USAGE = 0, NATIVE_WINDOW_CONNECT = 1, /* deprecated */ NATIVE_WINDOW_DISCONNECT = 2, /* deprecated */ NATIVE_WINDOW_SET_CROP = 3, /* private */ NATIVE_WINDOW_SET_BUFFER_COUNT = 4, NATIVE_WINDOW_SET_BUFFERS_GEOMETRY = 5, /* deprecated */ NATIVE_WINDOW_SET_BUFFERS_TRANSFORM = 6, NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP = 7, NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS = 8, NATIVE_WINDOW_SET_BUFFERS_FORMAT = 9, NATIVE_WINDOW_SET_SCALING_MODE = 10, /* private */ NATIVE_WINDOW_LOCK = 11, /* private */ NATIVE_WINDOW_UNLOCK_AND_POST = 12, /* private */ NATIVE_WINDOW_API_CONNECT = 13, /* private */ NATIVE_WINDOW_API_DISCONNECT = 14, /* private */ NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS = 15, /* private */ NATIVE_WINDOW_SET_POST_TRANSFORM_CROP = 16, /* private */ NATIVE_WINDOW_SET_BUFFERS_SIZE = 17, /* private */ #ifdef QCOM_HARDWARE NATIVE_WINDOW_UPDATE_BUFFERS_GEOMETRY = 18, /* private */ #endif }; /* parameter for NATIVE_WINDOW_[API_][DIS]CONNECT */ enum { /* Buffers will be queued by EGL via eglSwapBuffers after being filled using * OpenGL ES. */ NATIVE_WINDOW_API_EGL = 1, /* Buffers will be queued after being filled using the CPU */ NATIVE_WINDOW_API_CPU = 2, /* Buffers will be queued by Stagefright after being filled by a video * decoder. The video decoder can either be a software or hardware decoder. */ NATIVE_WINDOW_API_MEDIA = 3, /* Buffers will be queued by the the camera HAL. */ NATIVE_WINDOW_API_CAMERA = 4, }; /* parameter for NATIVE_WINDOW_SET_BUFFERS_TRANSFORM */ enum { /* flip source image horizontally */ NATIVE_WINDOW_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H , /* flip source image vertically */ NATIVE_WINDOW_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V, /* rotate source image 90 degrees clock-wise */ NATIVE_WINDOW_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90, /* rotate source image 180 degrees */ NATIVE_WINDOW_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180, /* rotate source image 270 degrees clock-wise */ NATIVE_WINDOW_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270, }; /* parameter for NATIVE_WINDOW_SET_SCALING_MODE */ enum { /* the window content is not updated (frozen) until a buffer of * the window size is received (enqueued) */ NATIVE_WINDOW_SCALING_MODE_FREEZE = 0, /* the buffer is scaled in both dimensions to match the window size */ NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW = 1, /* the buffer is scaled uniformly such that the smaller dimension * of the buffer matches the window size (cropping in the process) */ NATIVE_WINDOW_SCALING_MODE_SCALE_CROP = 2, /* the window is clipped to the size of the buffer's crop rectangle; pixels * outside the crop rectangle are treated as if they are completely * transparent. */ NATIVE_WINDOW_SCALING_MODE_NO_SCALE_CROP = 3, }; /* values returned by the NATIVE_WINDOW_CONCRETE_TYPE query */ enum { NATIVE_WINDOW_FRAMEBUFFER = 0, /* FramebufferNativeWindow */ NATIVE_WINDOW_SURFACE = 1, /* Surface */ NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT = 2, /* SurfaceTextureClient */ }; /* parameter for NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP * * Special timestamp value to indicate that timestamps should be auto-generated * by the native window when queueBuffer is called. This is equal to INT64_MIN, * defined directly to avoid problems with C99/C++ inclusion of stdint.h. */ static const int64_t NATIVE_WINDOW_TIMESTAMP_AUTO = (-9223372036854775807LL-1); struct ANativeWindow { #ifdef __cplusplus ANativeWindow() : flags(0), minSwapInterval(0), maxSwapInterval(0), xdpi(0), ydpi(0) { common.magic = ANDROID_NATIVE_WINDOW_MAGIC; common.version = sizeof(ANativeWindow); memset(common.reserved, 0, sizeof(common.reserved)); } /* Implement the methods that sp expects so that it can be used to automatically refcount ANativeWindow's. */ void incStrong(const void* id) const { common.incRef(const_cast(&common)); } void decStrong(const void* id) const { common.decRef(const_cast(&common)); } #endif struct android_native_base_t common; /* flags describing some attributes of this surface or its updater */ const uint32_t flags; /* min swap interval supported by this updated */ const int minSwapInterval; /* max swap interval supported by this updated */ const int maxSwapInterval; /* horizontal and vertical resolution in DPI */ const float xdpi; const float ydpi; /* Some storage reserved for the OEM's driver. */ intptr_t oem[4]; /* * Set the swap interval for this surface. * * Returns 0 on success or -errno on error. */ int (*setSwapInterval)(struct ANativeWindow* window, int interval); /* * Hook called by EGL to acquire a buffer. After this call, the buffer * is not locked, so its content cannot be modified. This call may block if * no buffers are available. * * The window holds a reference to the buffer between dequeueBuffer and * either queueBuffer or cancelBuffer, so clients only need their own * reference if they might use the buffer after queueing or canceling it. * Holding a reference to a buffer after queueing or canceling it is only * allowed if a specific buffer count has been set. * * Returns 0 on success or -errno on error. * * XXX: This function is deprecated. It will continue to work for some * time for binary compatibility, but the new dequeueBuffer function that * outputs a fence file descriptor should be used in its place. */ int (*dequeueBuffer_DEPRECATED)(struct ANativeWindow* window, struct ANativeWindowBuffer** buffer); /* * hook called by EGL to lock a buffer. This MUST be called before modifying * the content of a buffer. The buffer must have been acquired with * dequeueBuffer first. * * Returns 0 on success or -errno on error. * * XXX: This function is deprecated. It will continue to work for some * time for binary compatibility, but it is essentially a no-op, and calls * to it should be removed. */ int (*lockBuffer_DEPRECATED)(struct ANativeWindow* window, struct ANativeWindowBuffer* buffer); /* * Hook called by EGL when modifications to the render buffer are done. * This unlocks and post the buffer. * * The window holds a reference to the buffer between dequeueBuffer and * either queueBuffer or cancelBuffer, so clients only need their own * reference if they might use the buffer after queueing or canceling it. * Holding a reference to a buffer after queueing or canceling it is only * allowed if a specific buffer count has been set. * * Buffers MUST be queued in the same order than they were dequeued. * * Returns 0 on success or -errno on error. * * XXX: This function is deprecated. It will continue to work for some * time for binary compatibility, but the new queueBuffer function that * takes a fence file descriptor should be used in its place (pass a value * of -1 for the fence file descriptor if there is no valid one to pass). */ int (*queueBuffer_DEPRECATED)(struct ANativeWindow* window, struct ANativeWindowBuffer* buffer); /* * hook used to retrieve information about the native window. * * Returns 0 on success or -errno on error. */ int (*query)(const struct ANativeWindow* window, int what, int* value); /* * hook used to perform various operations on the surface. * (*perform)() is a generic mechanism to add functionality to * ANativeWindow while keeping backward binary compatibility. * * DO NOT CALL THIS HOOK DIRECTLY. Instead, use the helper functions * defined below. * * (*perform)() returns -ENOENT if the 'what' parameter is not supported * by the surface's implementation. * * The valid operations are: * NATIVE_WINDOW_SET_USAGE * NATIVE_WINDOW_CONNECT (deprecated) * NATIVE_WINDOW_DISCONNECT (deprecated) * NATIVE_WINDOW_SET_CROP (private) * NATIVE_WINDOW_SET_BUFFER_COUNT * NATIVE_WINDOW_SET_BUFFERS_GEOMETRY (deprecated) * NATIVE_WINDOW_SET_BUFFERS_TRANSFORM * NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP * NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS * NATIVE_WINDOW_SET_BUFFERS_FORMAT * NATIVE_WINDOW_SET_SCALING_MODE (private) * NATIVE_WINDOW_LOCK (private) * NATIVE_WINDOW_UNLOCK_AND_POST (private) * NATIVE_WINDOW_API_CONNECT (private) * NATIVE_WINDOW_API_DISCONNECT (private) * NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS (private) * NATIVE_WINDOW_SET_POST_TRANSFORM_CROP (private) * */ int (*perform)(struct ANativeWindow* window, int operation, ... ); /* * Hook used to cancel a buffer that has been dequeued. * No synchronization is performed between dequeue() and cancel(), so * either external synchronization is needed, or these functions must be * called from the same thread. * * The window holds a reference to the buffer between dequeueBuffer and * either queueBuffer or cancelBuffer, so clients only need their own * reference if they might use the buffer after queueing or canceling it. * Holding a reference to a buffer after queueing or canceling it is only * allowed if a specific buffer count has been set. * * XXX: This function is deprecated. It will continue to work for some * time for binary compatibility, but the new cancelBuffer function that * takes a fence file descriptor should be used in its place (pass a value * of -1 for the fence file descriptor if there is no valid one to pass). */ int (*cancelBuffer_DEPRECATED)(struct ANativeWindow* window, struct ANativeWindowBuffer* buffer); /* * Hook called by EGL to acquire a buffer. This call may block if no * buffers are available. * * The window holds a reference to the buffer between dequeueBuffer and * either queueBuffer or cancelBuffer, so clients only need their own * reference if they might use the buffer after queueing or canceling it. * Holding a reference to a buffer after queueing or canceling it is only * allowed if a specific buffer count has been set. * * The libsync fence file descriptor returned in the int pointed to by the * fenceFd argument will refer to the fence that must signal before the * dequeued buffer may be written to. A value of -1 indicates that the * caller may access the buffer immediately without waiting on a fence. If * a valid file descriptor is returned (i.e. any value except -1) then the * caller is responsible for closing the file descriptor. * * Returns 0 on success or -errno on error. */ int (*dequeueBuffer)(struct ANativeWindow* window, struct ANativeWindowBuffer** buffer, int* fenceFd); /* * Hook called by EGL when modifications to the render buffer are done. * This unlocks and post the buffer. * * The window holds a reference to the buffer between dequeueBuffer and * either queueBuffer or cancelBuffer, so clients only need their own * reference if they might use the buffer after queueing or canceling it. * Holding a reference to a buffer after queueing or canceling it is only * allowed if a specific buffer count has been set. * * The fenceFd argument specifies a libsync fence file descriptor for a * fence that must signal before the buffer can be accessed. If the buffer * can be accessed immediately then a value of -1 should be used. The * caller must not use the file descriptor after it is passed to * queueBuffer, and the ANativeWindow implementation is responsible for * closing it. * * Returns 0 on success or -errno on error. */ int (*queueBuffer)(struct ANativeWindow* window, struct ANativeWindowBuffer* buffer, int fenceFd); /* * Hook used to cancel a buffer that has been dequeued. * No synchronization is performed between dequeue() and cancel(), so * either external synchronization is needed, or these functions must be * called from the same thread. * * The window holds a reference to the buffer between dequeueBuffer and * either queueBuffer or cancelBuffer, so clients only need their own * reference if they might use the buffer after queueing or canceling it. * Holding a reference to a buffer after queueing or canceling it is only * allowed if a specific buffer count has been set. * * The fenceFd argument specifies a libsync fence file decsriptor for a * fence that must signal before the buffer can be accessed. If the buffer * can be accessed immediately then a value of -1 should be used. * * Note that if the client has not waited on the fence that was returned * from dequeueBuffer, that same fence should be passed to cancelBuffer to * ensure that future uses of the buffer are preceded by a wait on that * fence. The caller must not use the file descriptor after it is passed * to cancelBuffer, and the ANativeWindow implementation is responsible for * closing it. * * Returns 0 on success or -errno on error. */ int (*cancelBuffer)(struct ANativeWindow* window, struct ANativeWindowBuffer* buffer, int fenceFd); }; /* Backwards compatibility: use ANativeWindow (struct ANativeWindow in C). * android_native_window_t is deprecated. */ typedef struct ANativeWindow ANativeWindow; typedef struct ANativeWindow android_native_window_t; /* * native_window_set_usage(..., usage) * Sets the intended usage flags for the next buffers * acquired with (*lockBuffer)() and on. * By default (if this function is never called), a usage of * GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE * is assumed. * Calling this function will usually cause following buffers to be * reallocated. */ static inline int native_window_set_usage( struct ANativeWindow* window, int usage) { return window->perform(window, NATIVE_WINDOW_SET_USAGE, usage); } /* deprecated. Always returns 0. Don't call. */ static inline int native_window_connect( struct ANativeWindow* window, int api) { return 0; } /* deprecated. Always returns 0. Don't call. */ static inline int native_window_disconnect( struct ANativeWindow* window, int api) { return 0; } /* * native_window_set_crop(..., crop) * Sets which region of the next queued buffers needs to be considered. * Depending on the scaling mode, a buffer's crop region is scaled and/or * cropped to match the surface's size. This function sets the crop in * pre-transformed buffer pixel coordinates. * * The specified crop region applies to all buffers queued after it is called. * * If 'crop' is NULL, subsequently queued buffers won't be cropped. * * An error is returned if for instance the crop region is invalid, out of the * buffer's bound or if the window is invalid. */ static inline int native_window_set_crop( struct ANativeWindow* window, android_native_rect_t const * crop) { return window->perform(window, NATIVE_WINDOW_SET_CROP, crop); } /* * native_window_set_post_transform_crop(..., crop) * Sets which region of the next queued buffers needs to be considered. * Depending on the scaling mode, a buffer's crop region is scaled and/or * cropped to match the surface's size. This function sets the crop in * post-transformed pixel coordinates. * * The specified crop region applies to all buffers queued after it is called. * * If 'crop' is NULL, subsequently queued buffers won't be cropped. * * An error is returned if for instance the crop region is invalid, out of the * buffer's bound or if the window is invalid. */ static inline int native_window_set_post_transform_crop( struct ANativeWindow* window, android_native_rect_t const * crop) { return window->perform(window, NATIVE_WINDOW_SET_POST_TRANSFORM_CROP, crop); } /* * native_window_set_active_rect(..., active_rect) * * This function is deprecated and will be removed soon. For now it simply * sets the post-transform crop for compatibility while multi-project commits * get checked. */ static inline int native_window_set_active_rect( struct ANativeWindow* window, android_native_rect_t const * active_rect) { return native_window_set_post_transform_crop(window, active_rect); } /* * native_window_set_buffer_count(..., count) * Sets the number of buffers associated with this native window. */ static inline int native_window_set_buffer_count( struct ANativeWindow* window, size_t bufferCount) { return window->perform(window, NATIVE_WINDOW_SET_BUFFER_COUNT, bufferCount); } /* * native_window_set_buffers_geometry(..., int w, int h, int format) * All buffers dequeued after this call will have the dimensions and format * specified. A successful call to this function has the same effect as calling * native_window_set_buffers_size and native_window_set_buffers_format. * * XXX: This function is deprecated. The native_window_set_buffers_dimensions * and native_window_set_buffers_format functions should be used instead. */ static inline int native_window_set_buffers_geometry( struct ANativeWindow* window, int w, int h, int format) { return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_GEOMETRY, w, h, format); } /* * native_window_set_buffers_dimensions(..., int w, int h) * All buffers dequeued after this call will have the dimensions specified. * In particular, all buffers will have a fixed-size, independent from the * native-window size. They will be scaled according to the scaling mode * (see native_window_set_scaling_mode) upon window composition. * * If w and h are 0, the normal behavior is restored. That is, dequeued buffers * following this call will be sized to match the window's size. * * Calling this function will reset the window crop to a NULL value, which * disables cropping of the buffers. */ static inline int native_window_set_buffers_dimensions( struct ANativeWindow* window, int w, int h) { return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS, w, h); } /* * native_window_set_buffers_user_dimensions(..., int w, int h) * * Sets the user buffer size for the window, which overrides the * window's size. All buffers dequeued after this call will have the * dimensions specified unless overridden by * native_window_set_buffers_dimensions. All buffers will have a * fixed-size, independent from the native-window size. They will be * scaled according to the scaling mode (see * native_window_set_scaling_mode) upon window composition. * * If w and h are 0, the normal behavior is restored. That is, the * default buffer size will match the windows's size. * * Calling this function will reset the window crop to a NULL value, which * disables cropping of the buffers. */ static inline int native_window_set_buffers_user_dimensions( struct ANativeWindow* window, int w, int h) { return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS, w, h); } /* * native_window_set_buffers_format(..., int format) * All buffers dequeued after this call will have the format specified. * * If the specified format is 0, the default buffer format will be used. */ static inline int native_window_set_buffers_format( struct ANativeWindow* window, int format) { return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_FORMAT, format); } /* * native_window_set_buffers_transform(..., int transform) * All buffers queued after this call will be displayed transformed according * to the transform parameter specified. */ static inline int native_window_set_buffers_transform( struct ANativeWindow* window, int transform) { return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_TRANSFORM, transform); } /* * native_window_set_buffers_timestamp(..., int64_t timestamp) * All buffers queued after this call will be associated with the timestamp * parameter specified. If the timestamp is set to NATIVE_WINDOW_TIMESTAMP_AUTO * (the default), timestamps will be generated automatically when queueBuffer is * called. The timestamp is measured in nanoseconds, and is normally monotonically * increasing. The timestamp should be unaffected by time-of-day adjustments, * and for a camera should be strictly monotonic but for a media player may be * reset when the position is set. */ static inline int native_window_set_buffers_timestamp( struct ANativeWindow* window, int64_t timestamp) { return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP, timestamp); } /* * native_window_set_scaling_mode(..., int mode) * All buffers queued after this call will be associated with the scaling mode * specified. */ static inline int native_window_set_scaling_mode( struct ANativeWindow* window, int mode) { return window->perform(window, NATIVE_WINDOW_SET_SCALING_MODE, mode); } /* * native_window_api_connect(..., int api) * connects an API to this window. only one API can be connected at a time. * Returns -EINVAL if for some reason the window cannot be connected, which * can happen if it's connected to some other API. */ static inline int native_window_api_connect( struct ANativeWindow* window, int api) { return window->perform(window, NATIVE_WINDOW_API_CONNECT, api); } /* * native_window_api_disconnect(..., int api) * disconnect the API from this window. * An error is returned if for instance the window wasn't connected in the * first place. */ static inline int native_window_api_disconnect( struct ANativeWindow* window, int api) { return window->perform(window, NATIVE_WINDOW_API_DISCONNECT, api); } /* * native_window_dequeue_buffer_and_wait(...) * Dequeue a buffer and wait on the fence associated with that buffer. The * buffer may safely be accessed immediately upon this function returning. An * error is returned if either of the dequeue or the wait operations fail. */ static inline int native_window_dequeue_buffer_and_wait(ANativeWindow *anw, struct ANativeWindowBuffer** anb) { return anw->dequeueBuffer_DEPRECATED(anw, anb); } __END_DECLS #endif /* SYSTEM_CORE_INCLUDE_ANDROID_WINDOW_H */ android-audiosystem-1.8+13.10.20130807/include/system/graphics.h0000644000015700001700000001346712200324306024625 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H #define SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H #ifdef __cplusplus extern "C" { #endif /* * If the HAL needs to create service threads to handle graphics related * tasks, these threads need to run at HAL_PRIORITY_URGENT_DISPLAY priority * if they can block the main rendering thread in any way. * * the priority of the current thread can be set with: * * #include * setpriority(PRIO_PROCESS, 0, HAL_PRIORITY_URGENT_DISPLAY); * */ #define HAL_PRIORITY_URGENT_DISPLAY (-8) /** * pixel format definitions */ enum { HAL_PIXEL_FORMAT_RGBA_8888 = 1, HAL_PIXEL_FORMAT_RGBX_8888 = 2, HAL_PIXEL_FORMAT_RGB_888 = 3, HAL_PIXEL_FORMAT_RGB_565 = 4, HAL_PIXEL_FORMAT_BGRA_8888 = 5, HAL_PIXEL_FORMAT_RGBA_5551 = 6, HAL_PIXEL_FORMAT_RGBA_4444 = 7, /* 0x8 - 0xFF range unavailable */ /* * 0x100 - 0x1FF * * This range is reserved for pixel formats that are specific to the HAL * implementation. Implementations can use any value in this range to * communicate video pixel formats between their HAL modules. These formats * must not have an alpha channel. Additionally, an EGLimage created from a * gralloc buffer of one of these formats must be supported for use with the * GL_OES_EGL_image_external OpenGL ES extension. */ /* * Android YUV format: * * This format is exposed outside of the HAL to software decoders and * applications. EGLImageKHR must support it in conjunction with the * OES_EGL_image_external extension. * * YV12 is a 4:2:0 YCrCb planar format comprised of a WxH Y plane followed * by (W/2) x (H/2) Cr and Cb planes. * * This format assumes * - an even width * - an even height * - a horizontal stride multiple of 16 pixels * - a vertical stride equal to the height * * y_size = stride * height * c_stride = ALIGN(stride/2, 16) * c_size = c_stride * height/2 * size = y_size + c_size * 2 * cr_offset = y_size * cb_offset = y_size + c_size * */ HAL_PIXEL_FORMAT_YV12 = 0x32315659, // YCrCb 4:2:0 Planar /* * Android RAW sensor format: * * This format is exposed outside of the HAL to applications. * * RAW_SENSOR is a single-channel 16-bit format, typically representing raw * Bayer-pattern images from an image sensor, with minimal processing. * * The exact pixel layout of the data in the buffer is sensor-dependent, and * needs to be queried from the camera device. * * Generally, not all 16 bits are used; more common values are 10 or 12 * bits. All parameters to interpret the raw data (black and white points, * color space, etc) must be queried from the camera device. * * This format assumes * - an even width * - an even height * - a horizontal stride multiple of 16 pixels (32 bytes). */ HAL_PIXEL_FORMAT_RAW_SENSOR = 0x20, /* * Android binary blob graphics buffer format: * * This format is used to carry task-specific data which does not have a * standard image structure. The details of the format are left to the two * endpoints. * * A typical use case is for transporting JPEG-compressed images from the * Camera HAL to the framework or to applications. * * Buffers of this format must have a height of 1, and width equal to their * size in bytes. */ HAL_PIXEL_FORMAT_BLOB = 0x21, /* * Android format indicating that the choice of format is entirely up to the * device-specific Gralloc implementation. * * The Gralloc implementation should examine the usage bits passed in when * allocating a buffer with this format, and it should derive the pixel * format from those usage flags. This format will never be used with any * of the GRALLOC_USAGE_SW_* usage flags. * * If a buffer of this format is to be used as an OpenGL ES texture, the * framework will assume that sampling the texture will always return an * alpha value of 1.0 (i.e. the buffer contains only opaque pixel values). * */ HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED = 0x22, /* Legacy formats (deprecated), used by ImageFormat.java */ HAL_PIXEL_FORMAT_YCbCr_422_SP = 0x10, // NV16 HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21 HAL_PIXEL_FORMAT_YCbCr_422_I = 0x14, // YUY2 }; /** * Transformation definitions * * IMPORTANT NOTE: * HAL_TRANSFORM_ROT_90 is applied CLOCKWISE and AFTER HAL_TRANSFORM_FLIP_{H|V}. * */ enum { /* flip source image horizontally (around the vertical axis) */ HAL_TRANSFORM_FLIP_H = 0x01, /* flip source image vertically (around the horizontal axis)*/ HAL_TRANSFORM_FLIP_V = 0x02, /* rotate source image 90 degrees clockwise */ HAL_TRANSFORM_ROT_90 = 0x04, /* rotate source image 180 degrees */ HAL_TRANSFORM_ROT_180 = 0x03, /* rotate source image 270 degrees clockwise */ HAL_TRANSFORM_ROT_270 = 0x07, }; #ifdef __cplusplus } #endif #endif /* SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H */ android-audiosystem-1.8+13.10.20130807/include/system/camera.h0000644000015700001700000002724212200324306024251 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef SYSTEM_CORE_INCLUDE_ANDROID_CAMERA_H #define SYSTEM_CORE_INCLUDE_ANDROID_CAMERA_H #include #include #include #include #include #include __BEGIN_DECLS /** * A set of bit masks for specifying how the received preview frames are * handled before the previewCallback() call. * * The least significant 3 bits of an "int" value are used for this purpose: * * ..... 0 0 0 * ^ ^ ^ * | | |---------> determine whether the callback is enabled or not * | |-----------> determine whether the callback is one-shot or not * |-------------> determine whether the frame is copied out or not * * WARNING: When a frame is sent directly without copying, it is the frame * receiver's responsiblity to make sure that the frame data won't get * corrupted by subsequent preview frames filled by the camera. This flag is * recommended only when copying out data brings significant performance price * and the handling/processing of the received frame data is always faster than * the preview frame rate so that data corruption won't occur. * * For instance, * 1. 0x00 disables the callback. In this case, copy out and one shot bits * are ignored. * 2. 0x01 enables a callback without copying out the received frames. A * typical use case is the Camcorder application to avoid making costly * frame copies. * 3. 0x05 is enabling a callback with frame copied out repeatedly. A typical * use case is the Camera application. * 4. 0x07 is enabling a callback with frame copied out only once. A typical * use case is the Barcode scanner application. */ enum { CAMERA_FRAME_CALLBACK_FLAG_ENABLE_MASK = 0x01, CAMERA_FRAME_CALLBACK_FLAG_ONE_SHOT_MASK = 0x02, CAMERA_FRAME_CALLBACK_FLAG_COPY_OUT_MASK = 0x04, /** Typical use cases */ CAMERA_FRAME_CALLBACK_FLAG_NOOP = 0x00, CAMERA_FRAME_CALLBACK_FLAG_CAMCORDER = 0x01, CAMERA_FRAME_CALLBACK_FLAG_CAMERA = 0x05, CAMERA_FRAME_CALLBACK_FLAG_BARCODE_SCANNER = 0x07 }; /** msgType in notifyCallback and dataCallback functions */ enum { CAMERA_MSG_ERROR = 0x0001, // notifyCallback CAMERA_MSG_SHUTTER = 0x0002, // notifyCallback CAMERA_MSG_FOCUS = 0x0004, // notifyCallback CAMERA_MSG_ZOOM = 0x0008, // notifyCallback CAMERA_MSG_PREVIEW_FRAME = 0x0010, // dataCallback CAMERA_MSG_VIDEO_FRAME = 0x0020, // data_timestamp_callback CAMERA_MSG_POSTVIEW_FRAME = 0x0040, // dataCallback CAMERA_MSG_RAW_IMAGE = 0x0080, // dataCallback CAMERA_MSG_COMPRESSED_IMAGE = 0x0100, // dataCallback CAMERA_MSG_RAW_IMAGE_NOTIFY = 0x0200, // dataCallback // Preview frame metadata. This can be combined with // CAMERA_MSG_PREVIEW_FRAME in dataCallback. For example, the apps can // request FRAME and METADATA. Or the apps can request only FRAME or only // METADATA. CAMERA_MSG_PREVIEW_METADATA = 0x0400, // dataCallback // Notify on autofocus start and stop. This is useful in continuous // autofocus - FOCUS_MODE_CONTINUOUS_VIDEO and FOCUS_MODE_CONTINUOUS_PICTURE. #if defined(QCOM_ICS_COMPAT) && defined(QCOM_HARDWARE) CAMERA_MSG_STATS_DATA = 0x800, CAMERA_MSG_FOCUS_MOVE = 0x1000, // notifyCallback #elif defined(OMAP_ICS_CAMERA) && defined(OMAP_ENHANCEMENT) CAMERA_MSG_COMPRESSED_BURST_IMAGE = 0x0800, //dataCallback CAMERA_MSG_RAW_BURST = 0x1000, // dataCallback #else CAMERA_MSG_FOCUS_MOVE = 0x0800, // notifyCallback #ifdef QCOM_HARDWARE CAMERA_MSG_STATS_DATA = 0x1000, #elif defined(OMAP_ENHANCEMENT) && defined(OMAP_ENHANCEMENT_BURST_CAPTURE) CAMERA_MSG_COMPRESSED_BURST_IMAGE = 0x1000, // dataCallback CAMERA_MSG_RAW_BURST = 0x2000, // dataCallback #endif #endif CAMERA_MSG_ALL_MSGS = 0xFFFF }; /** cmdType in sendCommand functions */ enum { CAMERA_CMD_START_SMOOTH_ZOOM = 1, CAMERA_CMD_STOP_SMOOTH_ZOOM = 2, /** * Set the clockwise rotation of preview display (setPreviewDisplay) in * degrees. This affects the preview frames and the picture displayed after * snapshot. This method is useful for portrait mode applications. Note * that preview display of front-facing cameras is flipped horizontally * before the rotation, that is, the image is reflected along the central * vertical axis of the camera sensor. So the users can see themselves as * looking into a mirror. * * This does not affect the order of byte array of * CAMERA_MSG_PREVIEW_FRAME, CAMERA_MSG_VIDEO_FRAME, * CAMERA_MSG_POSTVIEW_FRAME, CAMERA_MSG_RAW_IMAGE, or * CAMERA_MSG_COMPRESSED_IMAGE. This is allowed to be set during preview * since API level 14. */ CAMERA_CMD_SET_DISPLAY_ORIENTATION = 3, /** * cmdType to disable/enable shutter sound. In sendCommand passing arg1 = * 0 will disable, while passing arg1 = 1 will enable the shutter sound. */ CAMERA_CMD_ENABLE_SHUTTER_SOUND = 4, /* cmdType to play recording sound */ CAMERA_CMD_PLAY_RECORDING_SOUND = 5, /** * Start the face detection. This should be called after preview is started. * The camera will notify the listener of CAMERA_MSG_FACE and the detected * faces in the preview frame. The detected faces may be the same as the * previous ones. Apps should call CAMERA_CMD_STOP_FACE_DETECTION to stop * the face detection. This method is supported if CameraParameters * KEY_MAX_NUM_HW_DETECTED_FACES or KEY_MAX_NUM_SW_DETECTED_FACES is * bigger than 0. Hardware and software face detection should not be running * at the same time. If the face detection has started, apps should not send * this again. * * In hardware face detection mode, CameraParameters KEY_WHITE_BALANCE, * KEY_FOCUS_AREAS and KEY_METERING_AREAS have no effect. * * arg1 is the face detection type. It can be CAMERA_FACE_DETECTION_HW or * CAMERA_FACE_DETECTION_SW. If the type of face detection requested is not * supported, the HAL must return BAD_VALUE. */ CAMERA_CMD_START_FACE_DETECTION = 6, /** * Stop the face detection. */ CAMERA_CMD_STOP_FACE_DETECTION = 7, #if defined(QCOM_ICS_COMPAT) && defined(QCOM_HARDWARE) CAMERA_CMD_HISTOGRAM_ON = 8, CAMERA_CMD_HISTOGRAM_OFF = 9, CAMERA_CMD_HISTOGRAM_SEND_DATA = 10, /* Unused by the older blobs, but referenced */ CAMERA_CMD_ENABLE_FOCUS_MOVE_MSG = 11, CAMERA_CMD_PING = 12, CAMERA_CMD_SET_VIDEO_BUFFER_COUNT = 13, #else /** * Enable/disable focus move callback (CAMERA_MSG_FOCUS_MOVE). Passing * arg1 = 0 will disable, while passing arg1 = 1 will enable the callback. */ CAMERA_CMD_ENABLE_FOCUS_MOVE_MSG = 8, /** * Ping camera service to see if camera hardware is released. * * When any camera method returns error, the client can use ping command * to see if the camera has been taken away by other clients. If the result * is NO_ERROR, it means the camera hardware is not released. If the result * is not NO_ERROR, the camera has been released and the existing client * can silently finish itself or show a dialog. */ CAMERA_CMD_PING = 9, /** * Configure the number of video buffers used for recording. The intended * video buffer count for recording is passed as arg1, which must be * greater than 0. This command must be sent before recording is started. * This command returns INVALID_OPERATION error if it is sent after video * recording is started, or the command is not supported at all. This * command also returns a BAD_VALUE error if the intended video buffer * count is non-positive or too big to be realized. */ CAMERA_CMD_SET_VIDEO_BUFFER_COUNT = 10, #endif }; /** camera fatal errors */ enum { CAMERA_ERROR_UNKNOWN = 1, /** * Camera was released because another client has connected to the camera. * The original client should call Camera::disconnect immediately after * getting this notification. Otherwise, the camera will be released by * camera service in a short time. The client should not call any method * (except disconnect and sending CAMERA_CMD_PING) after getting this. */ CAMERA_ERROR_RELEASED = 2, CAMERA_ERROR_SERVER_DIED = 100 }; enum { /** The facing of the camera is opposite to that of the screen. */ CAMERA_FACING_BACK = 0, /** The facing of the camera is the same as that of the screen. */ CAMERA_FACING_FRONT = 1 }; #ifdef QCOM_HARDWARE enum { CAMERA_SUPPORT_MODE_2D = 0x01, /* Camera Sensor supports 2D mode. */ CAMERA_SUPPORT_MODE_3D = 0x02, /* Camera Sensor supports 3D mode. */ CAMERA_SUPPORT_MODE_NONZSL = 0x04, /* Camera Sensor in NON-ZSL mode. */ CAMERA_SUPPORT_MODE_ZSL = 0x08 /* Camera Sensor supports ZSL mode. */ }; #endif enum { /** Hardware face detection. It does not use much CPU. */ CAMERA_FACE_DETECTION_HW = 0, /** * Software face detection. It uses some CPU. Applications must use * Camera.setPreviewTexture for preview in this mode. */ CAMERA_FACE_DETECTION_SW = 1 }; /** * The information of a face from camera face detection. */ typedef struct camera_face { /** * Bounds of the face [left, top, right, bottom]. (-1000, -1000) represents * the top-left of the camera field of view, and (1000, 1000) represents the * bottom-right of the field of view. The width and height cannot be 0 or * negative. This is supported by both hardware and software face detection. * * The direction is relative to the sensor orientation, that is, what the * sensor sees. The direction is not affected by the rotation or mirroring * of CAMERA_CMD_SET_DISPLAY_ORIENTATION. */ int32_t rect[4]; /** * The confidence level of the face. The range is 1 to 100. 100 is the * highest confidence. This is supported by both hardware and software * face detection. */ int32_t score; /** * An unique id per face while the face is visible to the tracker. If * the face leaves the field-of-view and comes back, it will get a new * id. If the value is 0, id is not supported. */ int32_t id; /** * The coordinates of the center of the left eye. The range is -1000 to * 1000. -2000, -2000 if this is not supported. */ int32_t left_eye[2]; /** * The coordinates of the center of the right eye. The range is -1000 to * 1000. -2000, -2000 if this is not supported. */ int32_t right_eye[2]; /** * The coordinates of the center of the mouth. The range is -1000 to 1000. * -2000, -2000 if this is not supported. */ int32_t mouth[2]; } camera_face_t; /** * The metadata of the frame data. */ typedef struct camera_frame_metadata { /** * The number of detected faces in the frame. */ int32_t number_of_faces; /** * An array of the detected faces. The length is number_of_faces. */ camera_face_t *faces; } camera_frame_metadata_t; __END_DECLS #endif /* SYSTEM_CORE_INCLUDE_ANDROID_CAMERA_H */ android-audiosystem-1.8+13.10.20130807/include/system/audio_policy.h0000644000015700001700000000623312200324306025476 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_AUDIO_POLICY_CORE_H #define ANDROID_AUDIO_POLICY_CORE_H #include #include #include #include __BEGIN_DECLS /* The enums were moved here mostly from * frameworks/base/include/media/AudioSystem.h */ #ifdef QCOM_HARDWARE /* request to open a direct output with get_output() (by opposition to * sharing an output with other AudioTracks) */ typedef enum { AUDIO_POLICY_OUTPUT_FLAG_INDIRECT = 0x0, AUDIO_POLICY_OUTPUT_FLAG_DIRECT = 0x1 } audio_policy_output_flags_t; #endif /* device categories used for audio_policy->set_force_use() */ typedef enum { AUDIO_POLICY_FORCE_NONE, AUDIO_POLICY_FORCE_SPEAKER, AUDIO_POLICY_FORCE_HEADPHONES, AUDIO_POLICY_FORCE_BT_SCO, AUDIO_POLICY_FORCE_BT_A2DP, AUDIO_POLICY_FORCE_WIRED_ACCESSORY, AUDIO_POLICY_FORCE_BT_CAR_DOCK, AUDIO_POLICY_FORCE_BT_DESK_DOCK, AUDIO_POLICY_FORCE_ANALOG_DOCK, AUDIO_POLICY_FORCE_DIGITAL_DOCK, AUDIO_POLICY_FORCE_NO_BT_A2DP, /* A2DP sink is not preferred to speaker or wired HS */ AUDIO_POLICY_FORCE_SYSTEM_ENFORCED, AUDIO_POLICY_FORCE_CFG_CNT, AUDIO_POLICY_FORCE_CFG_MAX = AUDIO_POLICY_FORCE_CFG_CNT - 1, AUDIO_POLICY_FORCE_DEFAULT = AUDIO_POLICY_FORCE_NONE, } audio_policy_forced_cfg_t; /* usages used for audio_policy->set_force_use() */ typedef enum { AUDIO_POLICY_FORCE_FOR_COMMUNICATION, AUDIO_POLICY_FORCE_FOR_MEDIA, AUDIO_POLICY_FORCE_FOR_RECORD, AUDIO_POLICY_FORCE_FOR_DOCK, AUDIO_POLICY_FORCE_FOR_SYSTEM, AUDIO_POLICY_FORCE_USE_CNT, AUDIO_POLICY_FORCE_USE_MAX = AUDIO_POLICY_FORCE_USE_CNT - 1, } audio_policy_force_use_t; /* device connection states used for audio_policy->set_device_connection_state() */ typedef enum { AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE, AUDIO_POLICY_DEVICE_STATE_AVAILABLE, AUDIO_POLICY_DEVICE_STATE_CNT, AUDIO_POLICY_DEVICE_STATE_MAX = AUDIO_POLICY_DEVICE_STATE_CNT - 1, } audio_policy_dev_state_t; typedef enum { /* Used to generate a tone to notify the user of a * notification/alarm/ringtone while they are in a call. */ AUDIO_POLICY_TONE_IN_CALL_NOTIFICATION = 0, AUDIO_POLICY_TONE_CNT, AUDIO_POLICY_TONE_MAX = AUDIO_POLICY_TONE_CNT - 1, } audio_policy_tone_t; static inline bool audio_is_low_visibility(audio_stream_type_t stream) { switch (stream) { case AUDIO_STREAM_SYSTEM: case AUDIO_STREAM_NOTIFICATION: case AUDIO_STREAM_RING: return true; default: return false; } } __END_DECLS #endif // ANDROID_AUDIO_POLICY_CORE_H android-audiosystem-1.8+13.10.20130807/pkg_name0000644000015700001700000000002412200324306021372 0ustar pbuserpbgroup00000000000000android-audiosystem android-audiosystem-1.8+13.10.20130807/package_make0000644000015700001700000000144712200324306022213 0ustar pbuserpbgroup00000000000000 # This make include file uses pkg-c.onfig to resolve package dependencies PKG_NAME = $(shell cat $(top_srcdir)/pkg_name) PKG_VERSION = $(shell cat $(top_srcdir)/pkg_version) # individual Makefile should fill these in PKG_LIB = PKG_APP = lib_dirs = app_dirs = STATIC_LIBS = CFILES = CCFILES = CXXFILES = CPPFILES = SFILES = sFILES = # OSS dependent packages ######################## ifneq ($(oss_pkg_config_args),) OSS_PKGCFLAGS := $(shell export PKG_CONFIG_PATH=$(OSS_PKG_CONFIG_PATH):$(MOT_PKG_CONFIG_PATH) && pkg-config --cflags $(oss_pkg_config_args)) OSS_PKGLDFLAGS := $(shell export PKG_CONFIG_PATH=$(OSS_PKG_CONFIG_PATH):$(MOT_PKG_CONFIG_PATH) && pkg-config --libs $(oss_pkg_config_args)) else OSS_PKGCFLAGS := OSS_PKGLDFLAGS := endif PKGLDFLAGS = $(OSS_PKGLDFLAGS) PKGCFLAGS = $(OSS_PKGCFLAGS) android-audiosystem-1.8+13.10.20130807/README0000644000015700001700000000643412200324306020561 0ustar pbuserpbgroup00000000000000The following is a brief overview of the directory structure to make it easier to understand the organization. Below is a list of the top-level directories along with a brief note about the contents. __ |-- lib |-- Makefile.defines [config define main entry, according different ARCH, pick different config defines] |-- Config.defines.arm [arm ARCH config defines] |-- Config.defines.x86 [x86 ARCH config defines] |-- binder [correspond android folder: frameworks/native/libs/binder] |-- libcutils [correspond android folder: system/core/libcutils] |-- atomics_arm.S [modified correspond android file: bionic/libc/arch-arm/bionic/atomics_arm.S] |-- atomics_x86.S [modified correspond android file: bionic/libc/arch-x86/bionic/atomics_x86.S] |-- android_reboot.c [modified @LP] |-- mot_pthread.c [new file][copy correspond android file: bionic/libc/bionic/pthread.c] |-- dlmalloc_stubs.c [modified, removed bionic specific header] |-- iosched_policy.c [modified, cover HAVE_UBUNTU_OS defines] |-- ... [original files] |-- liblog [correspond android folder: system/core/liblog] |-- libmedia [correspond android folder: frameworks/base/media/libmedia] |-- AudioTrack.cpp [modified file] |-- ... [original files except LOG name change] |-- utils [correspond android folder: frameworks/base/libs/utils] |-- LOG/ALOG update. Not yet using version from JB 4.2.1 to avoid extra dependencies. |-- waudio [new files, C language wrapper lib for libmedia] |-- wctlplugin [new files, alsa ctl plugin] |-- wpcmplugin [new files, alsa pcm plugin] |-- include [new files, include export header files] |-- include [internal include header files] |-- android [correspond android folder: system/core/include/android @LP( + frameworks/base/native/incude/android)] |-- binder [correspond android folder: frameworks/base/include/binder] |-- cutils [correspond android folder: system/core/include/cutils] |-- atomics.h [correspond android file: bionic/libc/include/sys/atomics.h] |-- mot_pthread.h [new file] |-- ... [original files] |-- linux [correspond android folder: bionic/libc/kernel/common/linux] |-- ashmem.h [modified file] |-- linux-syscalls.h [correspond android file: bionic/libc/include/sys/linux-syscalls.h] |-- machine [correspond android folder: bionic/libc/arch-arm/include/machine] |-- media [correspond android folder: frameworks/base/include/media] |-- private [correspond android folder: frameworks/base/include/private @LP( + system/core/inlcude/private/android_filesystem_config.h)] |-- media/AudioTrackShared.h [modified file] |-- media/motthreads.h [new file] |-- ... [original files] |-- system [correspond android folder: system/core/include/system @LP] |-- hardware [correspond android folder: hardware/libhardware/include/hardware @LP] |-- unicode [correspond android folder: external/icu4c/common/unicode] |-- utils [correspond android folder: frameworks/base/include/utils] |-- LOG/ALOG update. Not yet using version from JB 4.2.1 to avoid extra dependencies. |-- waudio [new files] |-- app |-- debian android-audiosystem-1.8+13.10.20130807/pkg_version0000644000015700001700000000000412200324306022135 0ustar pbuserpbgroup000000000000001.0 android-audiosystem-1.8+13.10.20130807/target_app0000644000015700001700000000215412200324306021745 0ustar pbuserpbgroup00000000000000 # This make include file contains the details for building an application ifeq ($(FORCE_CXX_LINK),TRUE) LINKER := $(TOOLS_PREFIX)g++ else LINKER := $(TOOLS_PREFIX)gcc endif TARGET = $(PKG_APP) CLEAN += core* $(TARGET) ifeq ($(USE_GETTEXT_I18N),TRUE) #Create a target to create a POT file in the po folder GENPOT = $(PODIR)/$(GETTEXT_PACKAGE).pot #Add POT file to the clean list CLEAN += $(GENPOT) #Generate as many .mo files as the number of languages supported #They all go to ${DEBIAN}/usr/local/share/locale//LC_MESSAGES/.mo GENMO = $(foreach LOCALE,$(SUPPORTED_LOCALES), $(install_locale)/$(LOCALE)/LC_MESSAGES/$(GETTEXT_PACKAGE).mo) #Rule to generate mo file in the debian folder $(install_locale)/%/LC_MESSAGES/$(GETTEXT_PACKAGE).mo: $(PODIR)/$(GETTEXT_PACKAGE).%.po mkdir -p $(dir $@) msgfmt $< -o $@ endif all : $(TARGET) app : $(TARGET) $(TARGET) : $(DEPENDS) $(OBJECTS) $(LINKER) $(COMMON_FLAGS) $(LD_FLAGS) -o $(TARGET) $(OBJECTS) $(STATIC_LIBS) $(SHARED_LIBS) clean : $(REMOVE) $(CLEAN) install : $(TARGET) $(GENPOT) $(GENMO) $(MKDIR) $(install_app) $(COPY) $(TARGET) $(install_app) android-audiosystem-1.8+13.10.20130807/app/0000755000015700001700000000000012200324404020451 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/app/test.c0000644000015700001700000001064612200324306021604 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 Motorola * Copyright (C) 2011-2012 Canonical, Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include int main(int argc, char** argv) { if (argc == 1) { printf("No test target, please input target like './audiotest 1' \n"); printf("1: Test AudioTrack\n"); printf("2: Test AudioRecord\n"); printf("3: Test AudioSystem\n"); return 0; } if (strcmp(argv[1], "1") == 0) { TrackHandle handle; handle = CreateAudioTrack(); if (handle != NULL) { printf("Create AudioTrack successfully"); if (AudioTrack_set(handle, AUDIO_STREAM_MUSIC, 44100, AUDIO_FORMAT_PCM_16_BIT, AUDIO_CHANNEL_OUT_STEREO) == NO_ERROR) { int i = 1024; char localbuf[i]; int position; printf("Audio Track setting successfully"); AudioTrack_start(handle); printf("Audio Track start successfully"); if (AudioTrack_write(handle, localbuf, i) == i) { printf("Audio Track write first time successfully"); AudioTrack_pause(handle); printf("Audio Track pause"); AudioTrack_start(handle); printf("Audio Track get latency is %d.", (int) AudioTrack_latency(handle)); if (AudioTrack_write(handle, localbuf, i) == 1) { if (NO_ERROR == AudioTrack_getposition(handle, (long unsigned int*) &position)) { printf("Audio Track get position is %d.",position); AudioTrack_stop(handle); printf("Audio Track stop successfully"); DestoryAudioTrack(handle); } else { printf("Audio Track getposition fail"); } } else { printf("Audio Track write fail"); } } else { printf("Audio Track write fail"); } } else { printf("Audio Track setting fail"); } } else { printf("Create Audio Track fail"); } } else if (strcmp(argv[1], "2") == 0) { //Test AudioRecord RecordHandle rhandle; rhandle = CreateAudioRecord(); if (rhandle != NULL) { printf("Create AudioRecord successfully"); if (AudioRecord_set(rhandle, AUDIO_SOURCE_MIC, 44100, AUDIO_FORMAT_PCM_16_BIT, AUDIO_CHANNEL_IN_STEREO) == NO_ERROR) { int i = 1024; char localbuf[i]; int position; printf("Audio Record setting successfully"); AudioRecord_start(rhandle); printf("Audio Record start successfully"); if (AudioRecord_read(rhandle, localbuf, i) == i) { printf("Audio Record read first time successfully"); printf("Audio Record get latency is %d.", (int) AudioRecord_latency(rhandle)); if(AudioRecord_getposition(rhandle, &position) == NO_ERROR) { printf("Audio Record get position is %d.", position); AudioRecord_stop(rhandle); printf("Audio Record stop successfully"); DestoryAudioRecord(rhandle); } else { printf("Audio Record getposition fail"); } } else { printf("Audio Record read fail"); } } else { printf("Audio Record setting fail"); } } else { printf("Create Audio Record fail"); } } else if (strcmp(argv[1], "3") == 0) { int volume = 0; if (AudioSystem_getStreamVolumeIndex(AUDIO_STREAM_MUSIC, &volume, AUDIO_DEVICE_OUT_ALL) == NO_ERROR) { printf("Audio System get MUSIC volume is %d.", volume); volume = 1; if (AudioSystem_setStreamVolumeIndex(AUDIO_STREAM_MUSIC, volume, AUDIO_DEVICE_OUT_ALL) == NO_ERROR) printf("Audio System get/set MUSIC volume is OK."); } else { printf("Audio System get MUSIC volume fail"); } int mute = 0; if (AudioSystem_getStreamMute(AUDIO_STREAM_MUSIC, &mute) == NO_ERROR) { printf("Audio System get MUSIC mute is %d.", mute); mute = 1; if (AudioSystem_setStreamMute(AUDIO_STREAM_MUSIC, mute) == NO_ERROR) printf("Audio System get/set MUSIC mute is OK."); } else { printf("Audio System get MUSIC Mute fail"); } } return 0; } android-audiosystem-1.8+13.10.20130807/app/build.sh0000755000015700001700000000013012200324306022102 0ustar pbuserpbgroup00000000000000#!/bin/sh target='armel' make clean make -e ARCH=$target make -e ARCH=$target install android-audiosystem-1.8+13.10.20130807/app/Makefile0000644000015700001700000000270512200324306022116 0ustar pbuserpbgroup00000000000000make_home := .. top_srcdir := .. include $(make_home)/project_make include $(make_home)/package_make ####################### # CUSTOMIZE MACROS HERE ####################### # name your binary here PKG_APP = audiotest # at least one of following lines must be uncommented # CFILES is .c # CCFILES is .cc # CPPFILES is .cpp # CXXFILES is .cxx CFILES = test.c #CCFILES = #CPPFILES = test.cpp #CXXFILES = FORCE_CXX_LINK = FALSE # if this app depends on private static library built # by this package, uncomment next line # STATIC_LIBS = ../lib/waudio/libwaudio.a ../lib/libmedia/libmedia.a ../lib/libbinder/libbinder.a ../lib/libutils/libutils.a ../lib/libcutils/libcutils.a ../lib/liblog/liblog.a # modify compiler command-line options # CFLAGS = -fPIC # add system libraries to link line #LDSYSLIBS = # modify linker command-line options, e.g., # -L and -l to specify shared libraries built by this package LDFLAGS += \ -L ../lib/waudio \ -L ../lib/libmedia \ -L ../lib/binder \ -L ../lib/utils \ -L ../lib/libcutils \ -L ../lib/liblog SHARED_LIBS += -lwaudio -ldl -lz -lm -lmedia -lbinder -lutils -lcutils -llog # This last macro is rarely used, it is intended to allow # a system library to be replaced, e.g. with a debug version # if used it should be -L -L etc. #PKGLIBS = ############################ # END OF MACROS TO CUSTOMIZE ############################ all: $(TARGET) #-include $(DEPENDS) include $(make_home)/target_app android-audiosystem-1.8+13.10.20130807/lib/0000755000015700001700000000000012200324404020437 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/lib/include/0000755000015700001700000000000012200324404022062 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/lib/include/asound_module_pcm_android.h0000644000015700001700000000006612200324306027433 0ustar pbuserpbgroup00000000000000dummy header file for libasound_module_pcm_android.so android-audiosystem-1.8+13.10.20130807/lib/include/cutils.h0000644000015700001700000000004312200324306023534 0ustar pbuserpbgroup00000000000000dummy header file for libcutils.so android-audiosystem-1.8+13.10.20130807/lib/include/asound_module_ctl_android.h0000644000015700001700000000006612200324306027436 0ustar pbuserpbgroup00000000000000dummy header file for libasound_module_ctl_android.so android-audiosystem-1.8+13.10.20130807/lib/include/binder.h0000644000015700001700000000004312200324306023474 0ustar pbuserpbgroup00000000000000dummy header file for libbinder.so android-audiosystem-1.8+13.10.20130807/lib/include/log.h0000644000015700001700000000004012200324306023007 0ustar pbuserpbgroup00000000000000dummy header file for liblog.so android-audiosystem-1.8+13.10.20130807/lib/include/utils.h0000644000015700001700000000004212200324306023370 0ustar pbuserpbgroup00000000000000dummy header file for libutils.so android-audiosystem-1.8+13.10.20130807/lib/include/waudio.h0000644000015700001700000005406112200324306023532 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 Motorola * Copyright (C) 2011-2012 Canonical, Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef WAUDIO_H #define WAUDIO_H #ifdef __cplusplus extern "C" { #endif #include #include #define ANDROID_AUDIO_WRAPPER_ERROR_START 0x9000000 typedef unsigned long uint32; /** * audio stream parameters */ #define AUDIO_PARAMETER_STREAM_ROUTING "routing" #define AUDIO_PARAMETER_STREAM_FORMAT "format" #define AUDIO_PARAMETER_STREAM_CHANNELS "channels" #define AUDIO_PARAMETER_STREAM_FRAME_COUNT "frame_count" #define AUDIO_PARAMETER_STREAM_INPUT_SOURCE "input_source" typedef int status_type; enum{ OK = 0, NO_ERROR = 0, //UNKNOWN_ERROR, //INIT_FAIL = -ENODEV, INVALID_PARAM = ANDROID_AUDIO_WRAPPER_ERROR_START, }; /* As a convenience, if a callback is supplied, a handler thread * is automatically created with the appropriate priority. This thread * invokes the callback when a new buffer becomes availlable or an underrun condition occurs. * Parameters: * * event: type of event notified (see enum AudioTrack::event_type). * user: Pointer to context for use by the callback receiver. * info: Pointer to optional parameter according to event type: * - EVENT_MORE_DATA: pointer to AudioTrack::Buffer struct. The callback must not write * more bytes than indicated by 'size' field and update 'size' if less bytes are * written. * - EVENT_UNDERRUN: unused. * - EVENT_LOOP_END: pointer to an int indicating the number of loops remaining. * - EVENT_MARKER: pointer to an uin32_t containing the marker position in frames. * - EVENT_NEW_POS: pointer to an uin32_t containing the new position in frames. * - EVENT_BUFFER_END: unused. */ typedef void (*callback_t)(int event, void* user, void *info); typedef enum _audio_stream_type_t { AUDIO_STREAM_DEFAULT = -1, AUDIO_STREAM_VOICE_CALL = 0, AUDIO_STREAM_SYSTEM = 1, AUDIO_STREAM_RING = 2, AUDIO_STREAM_MUSIC = 3, AUDIO_STREAM_ALARM = 4, AUDIO_STREAM_NOTIFICATION = 5, AUDIO_STREAM_BLUETOOTH_SCO = 6, AUDIO_STREAM_ENFORCED_AUDIBLE = 7, /* Sounds that cannot be muted by user and must be routed to speaker */ AUDIO_STREAM_DTMF = 8, AUDIO_STREAM_TTS = 9, AUDIO_NUM_STREAM_TYPES } audio_stream_type_t; /* Audio Modes used by AudioFlinger (useful when changing states at a call) */ typedef enum { AUDIO_MODE_INVALID = -2, AUDIO_MODE_CURRENT = -1, AUDIO_MODE_NORMAL = 0, AUDIO_MODE_RINGTONE = 1, AUDIO_MODE_IN_CALL = 2, AUDIO_MODE_IN_COMMUNICATION = 3, AUDIO_MODE_CNT, AUDIO_MODE_MAX = AUDIO_MODE_CNT - 1, } audio_mode_t; typedef enum { AUDIO_OUTPUT_FLAG_NONE = 0x0, // no attributes AUDIO_OUTPUT_FLAG_DIRECT = 0x1, // this output directly connects a track // to one output stream: no software mixer AUDIO_OUTPUT_FLAG_PRIMARY = 0x2, // this output is the primary output of // the device. It is unique and must be // present. It is opened by default and // receives routing, audio mode and volume // controls related to voice calls. AUDIO_OUTPUT_FLAG_FAST = 0x4, // output supports "fast tracks", // defined elsewhere AUDIO_OUTPUT_FLAG_DEEP_BUFFER = 0x8,// use deep audio buffers } audio_output_flags_t; /* Events used by AudioTrack callback function (audio_track_cblk_t). */ enum _event_type { EVENT_MORE_DATA = 0, // Request to write more data to PCM buffer. EVENT_UNDERRUN = 1, // PCM buffer underrun occured. EVENT_LOOP_END = 2, // Sample loop end was reached; playback restarted from loop start if loop count was not 0. EVENT_MARKER = 3, // Playback head is at the specified marker position (See setMarkerPosition()). EVENT_NEW_POS = 4, // Playback head is at a new position (See setPositionUpdatePeriod()). EVENT_BUFFER_END = 5 // Playback head is at the end of the buffer. } event_type; /* Do not change these values without updating their counterparts * in media/java/android/media/MediaRecorder.java! */ typedef enum { AUDIO_SOURCE_DEFAULT = 0, AUDIO_SOURCE_MIC = 1, AUDIO_SOURCE_VOICE_UPLINK = 2, AUDIO_SOURCE_VOICE_DOWNLINK = 3, AUDIO_SOURCE_VOICE_CALL = 4, AUDIO_SOURCE_CAMCORDER = 5, AUDIO_SOURCE_VOICE_RECOGNITION = 6, AUDIO_SOURCE_VOICE_COMMUNICATION = 7, AUDIO_SOURCE_REMOTE_SUBMIX = 8, /* Source for the mix to be presented remotely. */ /* An example of remote presentation is Wifi Display */ /* where a dongle attached to a TV can be used to */ /* play the mix captured by this audio source. */ AUDIO_SOURCE_CNT, AUDIO_SOURCE_MAX = AUDIO_SOURCE_CNT - 1, } audio_source_t; typedef enum { AUDIO_FORMAT_PCM_SUB_16_BIT = 0x1, /* DO NOT CHANGE - PCM signed 16 bits */ AUDIO_FORMAT_PCM_SUB_8_BIT = 0x2, /* DO NOT CHANGE - PCM unsigned 8 bits */ AUDIO_FORMAT_PCM_SUB_32_BIT = 0x3, /* PCM signed .31 fixed point */ AUDIO_FORMAT_PCM_SUB_8_24_BIT = 0x4, /* PCM signed 7.24 fixed point */ } audio_format_pcm_sub_fmt_t; // Audio format consists in a main format field (upper 8 bits) and a sub format field (lower 24 bits). // The main format indicates the main codec type. The sub format field indicates options and parameters // for each format. The sub format is mainly used for record to indicate for instance the requested bitrate // or profile. It can also be used for certain formats to give informations not present in the encoded // audio stream (e.g. octet alignement for AMR). typedef enum _audio_format_t { AUDIO_FORMAT_INVALID = 0xFFFFFFFFUL, AUDIO_FORMAT_DEFAULT = 0, AUDIO_FORMAT_PCM = 0x00000000UL, /* DO NOT CHANGE */ AUDIO_FORMAT_MP3 = 0x01000000UL, AUDIO_FORMAT_AMR_NB = 0x02000000UL, AUDIO_FORMAT_AMR_WB = 0x03000000UL, AUDIO_FORMAT_AAC = 0x04000000UL, AUDIO_FORMAT_HE_AAC_V1 = 0x05000000UL, AUDIO_FORMAT_HE_AAC_V2 = 0x06000000UL, AUDIO_FORMAT_VORBIS = 0x07000000UL, AUDIO_FORMAT_MAIN_MASK = 0xFF000000UL, AUDIO_FORMAT_SUB_MASK = 0x00FFFFFFUL, /* Aliases */ AUDIO_FORMAT_PCM_16_BIT = (AUDIO_FORMAT_PCM | AUDIO_FORMAT_PCM_SUB_16_BIT), AUDIO_FORMAT_PCM_8_BIT = (AUDIO_FORMAT_PCM | AUDIO_FORMAT_PCM_SUB_8_BIT), AUDIO_FORMAT_PCM_32_BIT = (AUDIO_FORMAT_PCM | AUDIO_FORMAT_PCM_SUB_32_BIT), AUDIO_FORMAT_PCM_8_24_BIT = (AUDIO_FORMAT_PCM | AUDIO_FORMAT_PCM_SUB_8_24_BIT), } audio_format_t; // Channel mask definitions must be kept in sync with JAVA values in /media/java/android/media/AudioFormat.java enum { /* output channels */ AUDIO_CHANNEL_OUT_FRONT_LEFT = 0x1, AUDIO_CHANNEL_OUT_FRONT_RIGHT = 0x2, AUDIO_CHANNEL_OUT_FRONT_CENTER = 0x4, AUDIO_CHANNEL_OUT_LOW_FREQUENCY = 0x8, AUDIO_CHANNEL_OUT_BACK_LEFT = 0x10, AUDIO_CHANNEL_OUT_BACK_RIGHT = 0x20, AUDIO_CHANNEL_OUT_FRONT_LEFT_OF_CENTER = 0x40, AUDIO_CHANNEL_OUT_FRONT_RIGHT_OF_CENTER = 0x80, AUDIO_CHANNEL_OUT_BACK_CENTER = 0x100, AUDIO_CHANNEL_OUT_SIDE_LEFT = 0x200, AUDIO_CHANNEL_OUT_SIDE_RIGHT = 0x400, AUDIO_CHANNEL_OUT_TOP_CENTER = 0x800, AUDIO_CHANNEL_OUT_TOP_FRONT_LEFT = 0x1000, AUDIO_CHANNEL_OUT_TOP_FRONT_CENTER = 0x2000, AUDIO_CHANNEL_OUT_TOP_FRONT_RIGHT = 0x4000, AUDIO_CHANNEL_OUT_TOP_BACK_LEFT = 0x8000, AUDIO_CHANNEL_OUT_TOP_BACK_CENTER = 0x10000, AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT = 0x20000, AUDIO_CHANNEL_OUT_MONO = AUDIO_CHANNEL_OUT_FRONT_LEFT, AUDIO_CHANNEL_OUT_STEREO = (AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT), AUDIO_CHANNEL_OUT_QUAD = (AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_BACK_LEFT | AUDIO_CHANNEL_OUT_BACK_RIGHT), AUDIO_CHANNEL_OUT_SURROUND = (AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_BACK_CENTER), AUDIO_CHANNEL_OUT_5POINT1 = (AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_LOW_FREQUENCY | AUDIO_CHANNEL_OUT_BACK_LEFT | AUDIO_CHANNEL_OUT_BACK_RIGHT), // matches the correct AudioFormat.CHANNEL_OUT_7POINT1_SURROUND definition for 7.1 AUDIO_CHANNEL_OUT_7POINT1 = (AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_LOW_FREQUENCY | AUDIO_CHANNEL_OUT_BACK_LEFT | AUDIO_CHANNEL_OUT_BACK_RIGHT | AUDIO_CHANNEL_OUT_SIDE_LEFT | AUDIO_CHANNEL_OUT_SIDE_RIGHT), AUDIO_CHANNEL_OUT_ALL = (AUDIO_CHANNEL_OUT_FRONT_LEFT | AUDIO_CHANNEL_OUT_FRONT_RIGHT | AUDIO_CHANNEL_OUT_FRONT_CENTER | AUDIO_CHANNEL_OUT_LOW_FREQUENCY | AUDIO_CHANNEL_OUT_BACK_LEFT | AUDIO_CHANNEL_OUT_BACK_RIGHT | AUDIO_CHANNEL_OUT_FRONT_LEFT_OF_CENTER | AUDIO_CHANNEL_OUT_FRONT_RIGHT_OF_CENTER | AUDIO_CHANNEL_OUT_BACK_CENTER| AUDIO_CHANNEL_OUT_SIDE_LEFT| AUDIO_CHANNEL_OUT_SIDE_RIGHT| AUDIO_CHANNEL_OUT_TOP_CENTER| AUDIO_CHANNEL_OUT_TOP_FRONT_LEFT| AUDIO_CHANNEL_OUT_TOP_FRONT_CENTER| AUDIO_CHANNEL_OUT_TOP_FRONT_RIGHT| AUDIO_CHANNEL_OUT_TOP_BACK_LEFT| AUDIO_CHANNEL_OUT_TOP_BACK_CENTER| AUDIO_CHANNEL_OUT_TOP_BACK_RIGHT), /* input channels */ AUDIO_CHANNEL_IN_LEFT = 0x4, AUDIO_CHANNEL_IN_RIGHT = 0x8, AUDIO_CHANNEL_IN_FRONT = 0x10, AUDIO_CHANNEL_IN_BACK = 0x20, AUDIO_CHANNEL_IN_LEFT_PROCESSED = 0x40, AUDIO_CHANNEL_IN_RIGHT_PROCESSED = 0x80, AUDIO_CHANNEL_IN_FRONT_PROCESSED = 0x100, AUDIO_CHANNEL_IN_BACK_PROCESSED = 0x200, AUDIO_CHANNEL_IN_PRESSURE = 0x400, AUDIO_CHANNEL_IN_X_AXIS = 0x800, AUDIO_CHANNEL_IN_Y_AXIS = 0x1000, AUDIO_CHANNEL_IN_Z_AXIS = 0x2000, AUDIO_CHANNEL_IN_VOICE_UPLINK = 0x4000, AUDIO_CHANNEL_IN_VOICE_DNLINK = 0x8000, AUDIO_CHANNEL_IN_MONO = AUDIO_CHANNEL_IN_FRONT, AUDIO_CHANNEL_IN_STEREO = (AUDIO_CHANNEL_IN_LEFT | AUDIO_CHANNEL_IN_RIGHT), AUDIO_CHANNEL_IN_ALL = (AUDIO_CHANNEL_IN_LEFT | AUDIO_CHANNEL_IN_RIGHT | AUDIO_CHANNEL_IN_FRONT | AUDIO_CHANNEL_IN_BACK| AUDIO_CHANNEL_IN_LEFT_PROCESSED | AUDIO_CHANNEL_IN_RIGHT_PROCESSED | AUDIO_CHANNEL_IN_FRONT_PROCESSED | AUDIO_CHANNEL_IN_BACK_PROCESSED| AUDIO_CHANNEL_IN_PRESSURE | AUDIO_CHANNEL_IN_X_AXIS | AUDIO_CHANNEL_IN_Y_AXIS | AUDIO_CHANNEL_IN_Z_AXIS | AUDIO_CHANNEL_IN_VOICE_UPLINK | AUDIO_CHANNEL_IN_VOICE_DNLINK) }; typedef uint32_t audio_channel_mask_t; enum { AUDIO_DEVICE_NONE = 0x0, /* reserved bits */ AUDIO_DEVICE_BIT_IN = 0x80000000, AUDIO_DEVICE_BIT_DEFAULT = 0x40000000, /* output devices */ AUDIO_DEVICE_OUT_EARPIECE = 0x1, AUDIO_DEVICE_OUT_SPEAKER = 0x2, AUDIO_DEVICE_OUT_WIRED_HEADSET = 0x4, AUDIO_DEVICE_OUT_WIRED_HEADPHONE = 0x8, AUDIO_DEVICE_OUT_BLUETOOTH_SCO = 0x10, AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET = 0x20, AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT = 0x40, AUDIO_DEVICE_OUT_BLUETOOTH_A2DP = 0x80, AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES = 0x100, AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER = 0x200, AUDIO_DEVICE_OUT_AUX_DIGITAL = 0x400, AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET = 0x800, AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET = 0x1000, AUDIO_DEVICE_OUT_USB_ACCESSORY = 0x2000, AUDIO_DEVICE_OUT_USB_DEVICE = 0x4000, AUDIO_DEVICE_OUT_REMOTE_SUBMIX = 0x8000, AUDIO_DEVICE_OUT_DEFAULT = AUDIO_DEVICE_BIT_DEFAULT, AUDIO_DEVICE_OUT_ALL = (AUDIO_DEVICE_OUT_EARPIECE | AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE | AUDIO_DEVICE_OUT_BLUETOOTH_SCO | AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET | AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT | AUDIO_DEVICE_OUT_BLUETOOTH_A2DP | AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES | AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER | AUDIO_DEVICE_OUT_AUX_DIGITAL | AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET | AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET | AUDIO_DEVICE_OUT_USB_ACCESSORY | AUDIO_DEVICE_OUT_USB_DEVICE | AUDIO_DEVICE_OUT_REMOTE_SUBMIX | AUDIO_DEVICE_OUT_DEFAULT), AUDIO_DEVICE_OUT_ALL_A2DP = (AUDIO_DEVICE_OUT_BLUETOOTH_A2DP | AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES | AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER), AUDIO_DEVICE_OUT_ALL_SCO = (AUDIO_DEVICE_OUT_BLUETOOTH_SCO | AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET | AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT), AUDIO_DEVICE_OUT_ALL_USB = (AUDIO_DEVICE_OUT_USB_ACCESSORY | AUDIO_DEVICE_OUT_USB_DEVICE), /* input devices */ AUDIO_DEVICE_IN_COMMUNICATION = AUDIO_DEVICE_BIT_IN | 0x1, AUDIO_DEVICE_IN_AMBIENT = AUDIO_DEVICE_BIT_IN | 0x2, AUDIO_DEVICE_IN_BUILTIN_MIC = AUDIO_DEVICE_BIT_IN | 0x4, AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET = AUDIO_DEVICE_BIT_IN | 0x8, AUDIO_DEVICE_IN_WIRED_HEADSET = AUDIO_DEVICE_BIT_IN | 0x10, AUDIO_DEVICE_IN_AUX_DIGITAL = AUDIO_DEVICE_BIT_IN | 0x20, AUDIO_DEVICE_IN_VOICE_CALL = AUDIO_DEVICE_BIT_IN | 0x40, AUDIO_DEVICE_IN_BACK_MIC = AUDIO_DEVICE_BIT_IN | 0x80, AUDIO_DEVICE_IN_REMOTE_SUBMIX = AUDIO_DEVICE_BIT_IN | 0x100, AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET = AUDIO_DEVICE_BIT_IN | 0x200, AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET = AUDIO_DEVICE_BIT_IN | 0x400, AUDIO_DEVICE_IN_USB_ACCESSORY = AUDIO_DEVICE_BIT_IN | 0x800, AUDIO_DEVICE_IN_USB_DEVICE = AUDIO_DEVICE_BIT_IN | 0x1000, AUDIO_DEVICE_IN_DEFAULT = AUDIO_DEVICE_BIT_IN | AUDIO_DEVICE_BIT_DEFAULT, AUDIO_DEVICE_IN_ALL = (AUDIO_DEVICE_IN_COMMUNICATION | AUDIO_DEVICE_IN_AMBIENT | AUDIO_DEVICE_IN_BUILTIN_MIC | AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET | AUDIO_DEVICE_IN_WIRED_HEADSET | AUDIO_DEVICE_IN_AUX_DIGITAL | AUDIO_DEVICE_IN_VOICE_CALL | AUDIO_DEVICE_IN_BACK_MIC | AUDIO_DEVICE_IN_REMOTE_SUBMIX | AUDIO_DEVICE_IN_ANLG_DOCK_HEADSET | AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET | AUDIO_DEVICE_IN_USB_ACCESSORY | AUDIO_DEVICE_IN_USB_DEVICE | AUDIO_DEVICE_IN_DEFAULT), AUDIO_DEVICE_IN_ALL_SCO = AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET, }; typedef uint32_t audio_devices_t; typedef void* TrackHandle; typedef void* RecordHandle; typedef int AudioIOHandle; typedef struct _buffer_struct{ // enum { // MUTE = 0x00000001 // }; uint32_t flags; int channelCount; int format; size_t frameCount; size_t size; union { void* raw; short* i16; int8_t* i8; }; } buffer_struct; /* Audio Track related interface */ TrackHandle CreateAudioTrack(); void DestoryAudioTrack(TrackHandle handle); void AudioTrack_start(TrackHandle handle); void AudioTrack_stop(TrackHandle handle); status_type AudioTrack_getposition(TrackHandle handle, uint32 *position); //status_type AudioTrack_setposition(TrackHandle handle,int32_t position); size_t AudioTrack_write(TrackHandle handle, const void *buffer, size_t size); status_type AudioTrack_set(TrackHandle handle, audio_stream_type_t streamtype, uint32 samplerate, audio_format_t format, audio_channel_mask_t channel); void AudioTrack_pause(TrackHandle handle); status_type AudioTrack_set_asyn(TrackHandle handle, audio_stream_type_t streamtype, uint32 samplerate, audio_format_t format, audio_channel_mask_t channel, callback_t cbf, void* user); uint32 AudioTrack_latency(TrackHandle handle); void AudioTrack_mute(TrackHandle handle, int muted); /* Audio Record related interfaces */ RecordHandle CreateAudioRecord(); void DestoryAudioRecord(RecordHandle handle); void AudioRecord_start(RecordHandle handle); void AudioRecord_stop(RecordHandle handle); status_type AudioRecord_getposition(RecordHandle handle, int32_t *position); //status_type AudioRecord_setposition(RecordHandle handle,int32_t position); size_t AudioRecord_read(RecordHandle handle, void *buffer, size_t size); status_type AudioRecord_set(RecordHandle handle, audio_source_t inputsource, uint32 samplerate, audio_format_t format, audio_channel_mask_t channel); //void AudioRecord_pause(RecordHandle handle); uint32 AudioRecord_latency(RecordHandle handle); /* Audio System related interface */ AudioIOHandle AudioSystem_getOutput(audio_stream_type_t streamtype, uint32 samplerate, audio_format_t format, audio_channel_mask_t channels, audio_output_flags_t flags); status_type AudioSystem_setParameters(AudioIOHandle ioHandle, char *keyvaluepairs); const char * AudioSystem_getParameters(AudioIOHandle ioHandle, char *keys); /* Master */ status_type AudioSystem_setMasterVolume(float value); status_type AudioSystem_getMasterVolume(float *value); status_type AudioSystem_setMasterMute(int mute); status_type AudioSystem_getMasterMute(int *mute); status_type AudioSystem_muteMicrophone(int state); status_type AudioSystem_isMicrophoneMuted(int *state); status_type AudioSystem_setMode(audio_mode_t mode); status_type AudioSystem_setVoiceVolume(float volume); /* Stream */ status_type AudioSystem_initStreamVolume(audio_stream_type_t streamtype, int indexMin, int indexMax); status_type AudioSystem_setStreamMute(audio_stream_type_t streamtype, int mute ); status_type AudioSystem_getStreamMute(audio_stream_type_t streamtype, int *mute ); status_type AudioSystem_getStreamVolumeIndex(audio_stream_type_t streamtype, int *index, audio_devices_t device); status_type AudioSystem_setStreamVolumeIndex(audio_stream_type_t streamtype, int index, audio_devices_t device); status_type AudioSystem_setStreamVolume(audio_stream_type_t streamtype, float value, int output); status_type AudioSystem_getStreamVolume(audio_stream_type_t streamtype, float *value, int output); #ifdef __cplusplus } #endif #endif android-audiosystem-1.8+13.10.20130807/lib/include/media.h0000644000015700001700000000004212200324306023307 0ustar pbuserpbgroup00000000000000dummy header file for libmedia.so android-audiosystem-1.8+13.10.20130807/lib/build-tree.sh0000755000015700001700000000446012200324306023037 0ustar pbuserpbgroup00000000000000#!/bin/sh # FILE : build-tree.sh # DESC : This script replaces Makefile in app/ and/or lib/ # when multiple apps or libs are in the package set -e usage() { echo "This script requires a target to build, from this list" echo "all app|lib clean install uninstall" echo "native|cross can specify build environment, default is cross" exit 1 } # check for at least one command-line argument if [ "$#" -eq 0 ] then usage fi # parse first command-line argument target=none for i; do case "$1" in all ) target=all; shift;; app ) target=app; shift;; lib ) target=lib; shift;; clean ) target=clean; shift;; install ) target=install; shift;; uninstall ) target=uninstall; shift;; esac if [ $# -eq 0 ] then break fi done if [ "$target" = "none" ] then usage fi architecture=`dpkg-architecture -qDEB_HOST_ARCH` # iterate through the directories under this node # following the dependency order cwd=`pwd` make ARCH=$architecture -C $cwd/liblog $target ret_value=$? if [ $ret_value -ne 0 ] then exit $ret_value fi make ARCH=$architecture -C $cwd/utils $target ret_value=$? if [ $ret_value -ne 0 ] then exit $ret_value fi make ARCH=$architecture -C $cwd/libcutils $target ret_value=$? if [ $ret_value -ne 0 ] then exit $ret_value fi make ARCH=$architecture -C $cwd/binder $target ret_value=$? if [ $ret_value -ne 0 ] then exit $ret_value fi make ARCH=$architecture -C $cwd/audio_utils $target ret_value=$? if [ $ret_value -ne 0 ] then exit $ret_value fi make ARCH=$architecture -C $cwd/libmedia $target ret_value=$? if [ $ret_value -ne 0 ] then exit $ret_value fi make ARCH=$architecture -C $cwd/waudio $target ret_value=$? if [ $ret_value -ne 0 ] then exit $ret_value fi make ARCH=$architecture -C $cwd/wctlplugin $target ret_value=$? if [ $ret_value -ne 0 ] then exit $ret_value fi make ARCH=$architecture -C $cwd/wpcmplugin $target ret_value=$? if [ $ret_value -ne 0 ] then exit $ret_value fi #for d in * #do # if [ -d $d -a "$d" != "include" ] # then # echo "***********************************************" # echo "build-tree.sh make ARCH=$architecture -C $cwd/$d $target" # echo "***********************************************" # make ARCH=$architecture -C $cwd/$d $target # ret_value=$? # if [ $ret_value -ne 0 ] # then # exit $ret_value # fi # fi #done android-audiosystem-1.8+13.10.20130807/lib/utils/0000755000015700001700000000000012200324404021577 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/lib/utils/ResourceTypes.cpp0000644000015700001700000054434212200324306025134 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "ResourceType" //#define LOG_NDEBUG 0 #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef INT32_MAX #define INT32_MAX ((int32_t)(2147483647)) #endif #define POOL_NOISY(x) //x #define XML_NOISY(x) //x #define TABLE_NOISY(x) //x #define TABLE_GETENTRY(x) //x #define TABLE_SUPER_NOISY(x) //x #define LOAD_TABLE_NOISY(x) //x #define TABLE_THEME(x) //x namespace android { #ifdef HAVE_WINSOCK #undef nhtol #undef htonl #ifdef HAVE_LITTLE_ENDIAN #define ntohl(x) ( ((x) << 24) | (((x) >> 24) & 255) | (((x) << 8) & 0xff0000) | (((x) >> 8) & 0xff00) ) #define htonl(x) ntohl(x) #define ntohs(x) ( (((x) << 8) & 0xff00) | (((x) >> 8) & 255) ) #define htons(x) ntohs(x) #else #define ntohl(x) (x) #define htonl(x) (x) #define ntohs(x) (x) #define htons(x) (x) #endif #endif #define IDMAP_MAGIC 0x706d6469 // size measured in sizeof(uint32_t) #define IDMAP_HEADER_SIZE (ResTable::IDMAP_HEADER_SIZE_BYTES / sizeof(uint32_t)) static void printToLogFunc(void* cookie, const char* txt) { ALOGV("%s", txt); } // Standard C isspace() is only required to look at the low byte of its input, so // produces incorrect results for UTF-16 characters. For safety's sake, assume that // any high-byte UTF-16 code point is not whitespace. inline int isspace16(char16_t c) { return (c < 0x0080 && isspace(c)); } // range checked; guaranteed to NUL-terminate within the stated number of available slots // NOTE: if this truncates the dst string due to running out of space, no attempt is // made to avoid splitting surrogate pairs. static void strcpy16_dtoh(uint16_t* dst, const uint16_t* src, size_t avail) { uint16_t* last = dst + avail - 1; while (*src && (dst < last)) { char16_t s = dtohs(*src); *dst++ = s; src++; } *dst = 0; } static status_t validate_chunk(const ResChunk_header* chunk, size_t minSize, const uint8_t* dataEnd, const char* name) { const uint16_t headerSize = dtohs(chunk->headerSize); const uint32_t size = dtohl(chunk->size); if (headerSize >= minSize) { if (headerSize <= size) { if (((headerSize|size)&0x3) == 0) { if ((ssize_t)size <= (dataEnd-((const uint8_t*)chunk))) { return NO_ERROR; } ALOGW("%s data size %p extends beyond resource end %p.", name, (void*)size, (void*)(dataEnd-((const uint8_t*)chunk))); return BAD_TYPE; } ALOGW("%s size 0x%x or headerSize 0x%x is not on an integer boundary.", name, (int)size, (int)headerSize); return BAD_TYPE; } ALOGW("%s size %p is smaller than header size %p.", name, (void*)size, (void*)(int)headerSize); return BAD_TYPE; } ALOGW("%s header size %p is too small.", name, (void*)(int)headerSize); return BAD_TYPE; } inline void Res_value::copyFrom_dtoh(const Res_value& src) { size = dtohs(src.size); res0 = src.res0; dataType = src.dataType; data = dtohl(src.data); } void Res_png_9patch::deviceToFile() { for (int i = 0; i < numXDivs; i++) { xDivs[i] = htonl(xDivs[i]); } for (int i = 0; i < numYDivs; i++) { yDivs[i] = htonl(yDivs[i]); } paddingLeft = htonl(paddingLeft); paddingRight = htonl(paddingRight); paddingTop = htonl(paddingTop); paddingBottom = htonl(paddingBottom); for (int i=0; ixDivs, numXDivs * sizeof(int32_t)); data += numXDivs * sizeof(int32_t); memmove(data, this->yDivs, numYDivs * sizeof(int32_t)); data += numYDivs * sizeof(int32_t); memmove(data, this->colors, numColors * sizeof(uint32_t)); } static void deserializeInternal(const void* inData, Res_png_9patch* outData) { char* patch = (char*) inData; if (inData != outData) { memmove(&outData->wasDeserialized, patch, 4); // copy wasDeserialized, numXDivs, numYDivs, numColors memmove(&outData->paddingLeft, patch + 12, 4); // copy wasDeserialized, numXDivs, numYDivs, numColors } outData->wasDeserialized = true; char* data = (char*)outData; data += sizeof(Res_png_9patch); outData->xDivs = (int32_t*) data; data += outData->numXDivs * sizeof(int32_t); outData->yDivs = (int32_t*) data; data += outData->numYDivs * sizeof(int32_t); outData->colors = (uint32_t*) data; } static bool assertIdmapHeader(const uint32_t* map, size_t sizeBytes) { if (sizeBytes < ResTable::IDMAP_HEADER_SIZE_BYTES) { ALOGW("idmap assertion failed: size=%d bytes\n", sizeBytes); return false; } if (*map != htodl(IDMAP_MAGIC)) { // htodl: map data expected to be in correct endianess ALOGW("idmap assertion failed: invalid magic found (is 0x%08x, expected 0x%08x)\n", *map, htodl(IDMAP_MAGIC)); return false; } return true; } static status_t idmapLookup(const uint32_t* map, size_t sizeBytes, uint32_t key, uint32_t* outValue) { // see README for details on the format of map if (!assertIdmapHeader(map, sizeBytes)) { return UNKNOWN_ERROR; } map = map + IDMAP_HEADER_SIZE; // skip ahead to data segment // size of data block, in uint32_t const size_t size = (sizeBytes - ResTable::IDMAP_HEADER_SIZE_BYTES) / sizeof(uint32_t); const uint32_t type = Res_GETTYPE(key) + 1; // add one, idmap stores "public" type id const uint32_t entry = Res_GETENTRY(key); const uint32_t typeCount = *map; if (type > typeCount) { ALOGW("Resource ID map: type=%d exceeds number of types=%d\n", type, typeCount); return UNKNOWN_ERROR; } if (typeCount > size) { ALOGW("Resource ID map: number of types=%d exceeds size of map=%d\n", typeCount, size); return UNKNOWN_ERROR; } const uint32_t typeOffset = map[type]; if (typeOffset == 0) { *outValue = 0; return NO_ERROR; } if (typeOffset + 1 > size) { ALOGW("Resource ID map: type offset=%d exceeds reasonable value, size of map=%d\n", typeOffset, size); return UNKNOWN_ERROR; } const uint32_t entryCount = map[typeOffset]; const uint32_t entryOffset = map[typeOffset + 1]; if (entryCount == 0 || entry < entryOffset || entry - entryOffset > entryCount - 1) { *outValue = 0; return NO_ERROR; } const uint32_t index = typeOffset + 2 + entry - entryOffset; if (index > size) { ALOGW("Resource ID map: entry index=%d exceeds size of map=%d\n", index, size); *outValue = 0; return NO_ERROR; } *outValue = map[index]; return NO_ERROR; } static status_t getIdmapPackageId(const uint32_t* map, size_t mapSize, uint32_t *outId) { if (!assertIdmapHeader(map, mapSize)) { return UNKNOWN_ERROR; } const uint32_t* p = map + IDMAP_HEADER_SIZE + 1; while (*p == 0) { ++p; } *outId = (map[*p + IDMAP_HEADER_SIZE + 2] >> 24) & 0x000000ff; return NO_ERROR; } Res_png_9patch* Res_png_9patch::deserialize(const void* inData) { if (sizeof(void*) != sizeof(int32_t)) { ALOGE("Cannot deserialize on non 32-bit system\n"); return NULL; } deserializeInternal(inData, (Res_png_9patch*) inData); return (Res_png_9patch*) inData; } // -------------------------------------------------------------------- // -------------------------------------------------------------------- // -------------------------------------------------------------------- ResStringPool::ResStringPool() : mError(NO_INIT), mOwnedData(NULL), mHeader(NULL), mCache(NULL) { } ResStringPool::ResStringPool(const void* data, size_t size, bool copyData) : mError(NO_INIT), mOwnedData(NULL), mHeader(NULL), mCache(NULL) { setTo(data, size, copyData); } ResStringPool::~ResStringPool() { uninit(); } status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) { if (!data || !size) { return (mError=BAD_TYPE); } uninit(); const bool notDeviceEndian = htods(0xf0) != 0xf0; if (copyData || notDeviceEndian) { mOwnedData = malloc(size); if (mOwnedData == NULL) { return (mError=NO_MEMORY); } memcpy(mOwnedData, data, size); data = mOwnedData; } mHeader = (const ResStringPool_header*)data; if (notDeviceEndian) { ResStringPool_header* h = const_cast(mHeader); h->header.headerSize = dtohs(mHeader->header.headerSize); h->header.type = dtohs(mHeader->header.type); h->header.size = dtohl(mHeader->header.size); h->stringCount = dtohl(mHeader->stringCount); h->styleCount = dtohl(mHeader->styleCount); h->flags = dtohl(mHeader->flags); h->stringsStart = dtohl(mHeader->stringsStart); h->stylesStart = dtohl(mHeader->stylesStart); } if (mHeader->header.headerSize > mHeader->header.size || mHeader->header.size > size) { ALOGW("Bad string block: header size %d or total size %d is larger than data size %d\n", (int)mHeader->header.headerSize, (int)mHeader->header.size, (int)size); return (mError=BAD_TYPE); } mSize = mHeader->header.size; mEntries = (const uint32_t*) (((const uint8_t*)data)+mHeader->header.headerSize); if (mHeader->stringCount > 0) { if ((mHeader->stringCount*sizeof(uint32_t) < mHeader->stringCount) // uint32 overflow? || (mHeader->header.headerSize+(mHeader->stringCount*sizeof(uint32_t))) > size) { ALOGW("Bad string block: entry of %d items extends past data size %d\n", (int)(mHeader->header.headerSize+(mHeader->stringCount*sizeof(uint32_t))), (int)size); return (mError=BAD_TYPE); } size_t charSize; if (mHeader->flags&ResStringPool_header::UTF8_FLAG) { charSize = sizeof(uint8_t); mCache = (char16_t**)malloc(sizeof(char16_t**)*mHeader->stringCount); memset(mCache, 0, sizeof(char16_t**)*mHeader->stringCount); } else { charSize = sizeof(char16_t); } mStrings = (const void*) (((const uint8_t*)data)+mHeader->stringsStart); if (mHeader->stringsStart >= (mHeader->header.size-sizeof(uint16_t))) { ALOGW("Bad string block: string pool starts at %d, after total size %d\n", (int)mHeader->stringsStart, (int)mHeader->header.size); return (mError=BAD_TYPE); } if (mHeader->styleCount == 0) { mStringPoolSize = (mHeader->header.size-mHeader->stringsStart)/charSize; } else { // check invariant: styles starts before end of data if (mHeader->stylesStart >= (mHeader->header.size-sizeof(uint16_t))) { ALOGW("Bad style block: style block starts at %d past data size of %d\n", (int)mHeader->stylesStart, (int)mHeader->header.size); return (mError=BAD_TYPE); } // check invariant: styles follow the strings if (mHeader->stylesStart <= mHeader->stringsStart) { ALOGW("Bad style block: style block starts at %d, before strings at %d\n", (int)mHeader->stylesStart, (int)mHeader->stringsStart); return (mError=BAD_TYPE); } mStringPoolSize = (mHeader->stylesStart-mHeader->stringsStart)/charSize; } // check invariant: stringCount > 0 requires a string pool to exist if (mStringPoolSize == 0) { ALOGW("Bad string block: stringCount is %d but pool size is 0\n", (int)mHeader->stringCount); return (mError=BAD_TYPE); } if (notDeviceEndian) { size_t i; uint32_t* e = const_cast(mEntries); for (i=0; istringCount; i++) { e[i] = dtohl(mEntries[i]); } if (!(mHeader->flags&ResStringPool_header::UTF8_FLAG)) { const char16_t* strings = (const char16_t*)mStrings; char16_t* s = const_cast(strings); for (i=0; iflags&ResStringPool_header::UTF8_FLAG && ((uint8_t*)mStrings)[mStringPoolSize-1] != 0) || (!mHeader->flags&ResStringPool_header::UTF8_FLAG && ((char16_t*)mStrings)[mStringPoolSize-1] != 0)) { ALOGW("Bad string block: last string is not 0-terminated\n"); return (mError=BAD_TYPE); } } else { mStrings = NULL; mStringPoolSize = 0; } if (mHeader->styleCount > 0) { mEntryStyles = mEntries + mHeader->stringCount; // invariant: integer overflow in calculating mEntryStyles if (mEntryStyles < mEntries) { ALOGW("Bad string block: integer overflow finding styles\n"); return (mError=BAD_TYPE); } if (((const uint8_t*)mEntryStyles-(const uint8_t*)mHeader) > (int)size) { ALOGW("Bad string block: entry of %d styles extends past data size %d\n", (int)((const uint8_t*)mEntryStyles-(const uint8_t*)mHeader), (int)size); return (mError=BAD_TYPE); } mStyles = (const uint32_t*) (((const uint8_t*)data)+mHeader->stylesStart); if (mHeader->stylesStart >= mHeader->header.size) { ALOGW("Bad string block: style pool starts %d, after total size %d\n", (int)mHeader->stylesStart, (int)mHeader->header.size); return (mError=BAD_TYPE); } mStylePoolSize = (mHeader->header.size-mHeader->stylesStart)/sizeof(uint32_t); if (notDeviceEndian) { size_t i; uint32_t* e = const_cast(mEntryStyles); for (i=0; istyleCount; i++) { e[i] = dtohl(mEntryStyles[i]); } uint32_t* s = const_cast(mStyles); for (i=0; istringCount; x++) { if (mCache[x] != NULL) { free(mCache[x]); mCache[x] = NULL; } } free(mCache); mCache = NULL; } } /** * Strings in UTF-16 format have length indicated by a length encoded in the * stored data. It is either 1 or 2 characters of length data. This allows a * maximum length of 0x7FFFFFF (2147483647 bytes), but if you're storing that * much data in a string, you're abusing them. * * If the high bit is set, then there are two characters or 4 bytes of length * data encoded. In that case, drop the high bit of the first character and * add it together with the next character. */ static inline size_t decodeLength(const char16_t** str) { size_t len = **str; if ((len & 0x8000) != 0) { (*str)++; len = ((len & 0x7FFF) << 16) | **str; } (*str)++; return len; } /** * Strings in UTF-8 format have length indicated by a length encoded in the * stored data. It is either 1 or 2 characters of length data. This allows a * maximum length of 0x7FFF (32767 bytes), but you should consider storing * text in another way if you're using that much data in a single string. * * If the high bit is set, then there are two characters or 2 bytes of length * data encoded. In that case, drop the high bit of the first character and * add it together with the next character. */ static inline size_t decodeLength(const uint8_t** str) { size_t len = **str; if ((len & 0x80) != 0) { (*str)++; len = ((len & 0x7F) << 8) | **str; } (*str)++; return len; } const uint16_t* ResStringPool::stringAt(size_t idx, size_t* u16len) const { if (mError == NO_ERROR && idx < mHeader->stringCount) { const bool isUTF8 = (mHeader->flags&ResStringPool_header::UTF8_FLAG) != 0; const uint32_t off = mEntries[idx]/(isUTF8?sizeof(char):sizeof(char16_t)); if (off < (mStringPoolSize-1)) { if (!isUTF8) { const char16_t* strings = (char16_t*)mStrings; const char16_t* str = strings+off; *u16len = decodeLength(&str); if ((uint32_t)(str+*u16len-strings) < mStringPoolSize) { return str; } else { ALOGW("Bad string block: string #%d extends to %d, past end at %d\n", (int)idx, (int)(str+*u16len-strings), (int)mStringPoolSize); } } else { const uint8_t* strings = (uint8_t*)mStrings; const uint8_t* u8str = strings+off; *u16len = decodeLength(&u8str); size_t u8len = decodeLength(&u8str); // encLen must be less than 0x7FFF due to encoding. if ((uint32_t)(u8str+u8len-strings) < mStringPoolSize) { AutoMutex lock(mDecodeLock); if (mCache[idx] != NULL) { return mCache[idx]; } ssize_t actualLen = utf8_to_utf16_length(u8str, u8len); if (actualLen < 0 || (size_t)actualLen != *u16len) { ALOGW("Bad string block: string #%lld decoded length is not correct " "%lld vs %llu\n", (long long)idx, (long long)actualLen, (long long)*u16len); return NULL; } char16_t *u16str = (char16_t *)calloc(*u16len+1, sizeof(char16_t)); if (!u16str) { ALOGW("No memory when trying to allocate decode cache for string #%d\n", (int)idx); return NULL; } utf8_to_utf16(u8str, u8len, u16str); mCache[idx] = u16str; return u16str; } else { ALOGW("Bad string block: string #%lld extends to %lld, past end at %lld\n", (long long)idx, (long long)(u8str+u8len-strings), (long long)mStringPoolSize); } } } else { ALOGW("Bad string block: string #%d entry is at %d, past end at %d\n", (int)idx, (int)(off*sizeof(uint16_t)), (int)(mStringPoolSize*sizeof(uint16_t))); } } return NULL; } const char* ResStringPool::string8At(size_t idx, size_t* outLen) const { if (mError == NO_ERROR && idx < mHeader->stringCount) { const bool isUTF8 = (mHeader->flags&ResStringPool_header::UTF8_FLAG) != 0; const uint32_t off = mEntries[idx]/(isUTF8?sizeof(char):sizeof(char16_t)); if (off < (mStringPoolSize-1)) { if (isUTF8) { const uint8_t* strings = (uint8_t*)mStrings; const uint8_t* str = strings+off; *outLen = decodeLength(&str); size_t encLen = decodeLength(&str); if ((uint32_t)(str+encLen-strings) < mStringPoolSize) { return (const char*)str; } else { ALOGW("Bad string block: string #%d extends to %d, past end at %d\n", (int)idx, (int)(str+encLen-strings), (int)mStringPoolSize); } } } else { ALOGW("Bad string block: string #%d entry is at %d, past end at %d\n", (int)idx, (int)(off*sizeof(uint16_t)), (int)(mStringPoolSize*sizeof(uint16_t))); } } return NULL; } const ResStringPool_span* ResStringPool::styleAt(const ResStringPool_ref& ref) const { return styleAt(ref.index); } const ResStringPool_span* ResStringPool::styleAt(size_t idx) const { if (mError == NO_ERROR && idx < mHeader->styleCount) { const uint32_t off = (mEntryStyles[idx]/sizeof(uint32_t)); if (off < mStylePoolSize) { return (const ResStringPool_span*)(mStyles+off); } else { ALOGW("Bad string block: style #%d entry is at %d, past end at %d\n", (int)idx, (int)(off*sizeof(uint32_t)), (int)(mStylePoolSize*sizeof(uint32_t))); } } return NULL; } ssize_t ResStringPool::indexOfString(const char16_t* str, size_t strLen) const { if (mError != NO_ERROR) { return mError; } size_t len; // TODO optimize searching for UTF-8 strings taking into account // the cache fill to determine when to convert the searched-for // string key to UTF-8. if (mHeader->flags&ResStringPool_header::SORTED_FLAG) { // Do a binary search for the string... ssize_t l = 0; ssize_t h = mHeader->stringCount-1; ssize_t mid; while (l <= h) { mid = l + (h - l)/2; const char16_t* s = stringAt(mid, &len); int c = s ? strzcmp16(s, len, str, strLen) : -1; POOL_NOISY(printf("Looking for %s, at %s, cmp=%d, l/mid/h=%d/%d/%d\n", String8(str).string(), String8(s).string(), c, (int)l, (int)mid, (int)h)); if (c == 0) { return mid; } else if (c < 0) { l = mid + 1; } else { h = mid - 1; } } } else { // It is unusual to get the ID from an unsorted string block... // most often this happens because we want to get IDs for style // span tags; since those always appear at the end of the string // block, start searching at the back. for (int i=mHeader->stringCount-1; i>=0; i--) { const char16_t* s = stringAt(i, &len); POOL_NOISY(printf("Looking for %s, at %s, i=%d\n", String8(str, strLen).string(), String8(s).string(), i)); if (s && strzcmp16(s, len, str, strLen) == 0) { return i; } } } return NAME_NOT_FOUND; } size_t ResStringPool::size() const { return (mError == NO_ERROR) ? mHeader->stringCount : 0; } #ifndef HAVE_ANDROID_OS bool ResStringPool::isUTF8() const { return (mHeader->flags&ResStringPool_header::UTF8_FLAG)!=0; } #endif // -------------------------------------------------------------------- // -------------------------------------------------------------------- // -------------------------------------------------------------------- ResXMLParser::ResXMLParser(const ResXMLTree& tree) : mTree(tree), mEventCode(BAD_DOCUMENT) { } void ResXMLParser::restart() { mCurNode = NULL; mEventCode = mTree.mError == NO_ERROR ? START_DOCUMENT : BAD_DOCUMENT; } const ResStringPool& ResXMLParser::getStrings() const { return mTree.mStrings; } ResXMLParser::event_code_t ResXMLParser::getEventType() const { return mEventCode; } ResXMLParser::event_code_t ResXMLParser::next() { if (mEventCode == START_DOCUMENT) { mCurNode = mTree.mRootNode; mCurExt = mTree.mRootExt; return (mEventCode=mTree.mRootCode); } else if (mEventCode >= FIRST_CHUNK_CODE) { return nextNode(); } return mEventCode; } int32_t ResXMLParser::getCommentID() const { return mCurNode != NULL ? dtohl(mCurNode->comment.index) : -1; } const uint16_t* ResXMLParser::getComment(size_t* outLen) const { int32_t id = getCommentID(); return id >= 0 ? mTree.mStrings.stringAt(id, outLen) : NULL; } uint32_t ResXMLParser::getLineNumber() const { return mCurNode != NULL ? dtohl(mCurNode->lineNumber) : -1; } int32_t ResXMLParser::getTextID() const { if (mEventCode == TEXT) { return dtohl(((const ResXMLTree_cdataExt*)mCurExt)->data.index); } return -1; } const uint16_t* ResXMLParser::getText(size_t* outLen) const { int32_t id = getTextID(); return id >= 0 ? mTree.mStrings.stringAt(id, outLen) : NULL; } ssize_t ResXMLParser::getTextValue(Res_value* outValue) const { if (mEventCode == TEXT) { outValue->copyFrom_dtoh(((const ResXMLTree_cdataExt*)mCurExt)->typedData); return sizeof(Res_value); } return BAD_TYPE; } int32_t ResXMLParser::getNamespacePrefixID() const { if (mEventCode == START_NAMESPACE || mEventCode == END_NAMESPACE) { return dtohl(((const ResXMLTree_namespaceExt*)mCurExt)->prefix.index); } return -1; } const uint16_t* ResXMLParser::getNamespacePrefix(size_t* outLen) const { int32_t id = getNamespacePrefixID(); //printf("prefix=%d event=%p\n", id, mEventCode); return id >= 0 ? mTree.mStrings.stringAt(id, outLen) : NULL; } int32_t ResXMLParser::getNamespaceUriID() const { if (mEventCode == START_NAMESPACE || mEventCode == END_NAMESPACE) { return dtohl(((const ResXMLTree_namespaceExt*)mCurExt)->uri.index); } return -1; } const uint16_t* ResXMLParser::getNamespaceUri(size_t* outLen) const { int32_t id = getNamespaceUriID(); //printf("uri=%d event=%p\n", id, mEventCode); return id >= 0 ? mTree.mStrings.stringAt(id, outLen) : NULL; } int32_t ResXMLParser::getElementNamespaceID() const { if (mEventCode == START_TAG) { return dtohl(((const ResXMLTree_attrExt*)mCurExt)->ns.index); } if (mEventCode == END_TAG) { return dtohl(((const ResXMLTree_endElementExt*)mCurExt)->ns.index); } return -1; } const uint16_t* ResXMLParser::getElementNamespace(size_t* outLen) const { int32_t id = getElementNamespaceID(); return id >= 0 ? mTree.mStrings.stringAt(id, outLen) : NULL; } int32_t ResXMLParser::getElementNameID() const { if (mEventCode == START_TAG) { return dtohl(((const ResXMLTree_attrExt*)mCurExt)->name.index); } if (mEventCode == END_TAG) { return dtohl(((const ResXMLTree_endElementExt*)mCurExt)->name.index); } return -1; } const uint16_t* ResXMLParser::getElementName(size_t* outLen) const { int32_t id = getElementNameID(); return id >= 0 ? mTree.mStrings.stringAt(id, outLen) : NULL; } size_t ResXMLParser::getAttributeCount() const { if (mEventCode == START_TAG) { return dtohs(((const ResXMLTree_attrExt*)mCurExt)->attributeCount); } return 0; } int32_t ResXMLParser::getAttributeNamespaceID(size_t idx) const { if (mEventCode == START_TAG) { const ResXMLTree_attrExt* tag = (const ResXMLTree_attrExt*)mCurExt; if (idx < dtohs(tag->attributeCount)) { const ResXMLTree_attribute* attr = (const ResXMLTree_attribute*) (((const uint8_t*)tag) + dtohs(tag->attributeStart) + (dtohs(tag->attributeSize)*idx)); return dtohl(attr->ns.index); } } return -2; } const uint16_t* ResXMLParser::getAttributeNamespace(size_t idx, size_t* outLen) const { int32_t id = getAttributeNamespaceID(idx); //printf("attribute namespace=%d idx=%d event=%p\n", id, idx, mEventCode); //XML_NOISY(printf("getAttributeNamespace 0x%x=0x%x\n", idx, id)); return id >= 0 ? mTree.mStrings.stringAt(id, outLen) : NULL; } int32_t ResXMLParser::getAttributeNameID(size_t idx) const { if (mEventCode == START_TAG) { const ResXMLTree_attrExt* tag = (const ResXMLTree_attrExt*)mCurExt; if (idx < dtohs(tag->attributeCount)) { const ResXMLTree_attribute* attr = (const ResXMLTree_attribute*) (((const uint8_t*)tag) + dtohs(tag->attributeStart) + (dtohs(tag->attributeSize)*idx)); return dtohl(attr->name.index); } } return -1; } const uint16_t* ResXMLParser::getAttributeName(size_t idx, size_t* outLen) const { int32_t id = getAttributeNameID(idx); //printf("attribute name=%d idx=%d event=%p\n", id, idx, mEventCode); //XML_NOISY(printf("getAttributeName 0x%x=0x%x\n", idx, id)); return id >= 0 ? mTree.mStrings.stringAt(id, outLen) : NULL; } uint32_t ResXMLParser::getAttributeNameResID(size_t idx) const { int32_t id = getAttributeNameID(idx); if (id >= 0 && (size_t)id < mTree.mNumResIds) { return dtohl(mTree.mResIds[id]); } return 0; } int32_t ResXMLParser::getAttributeValueStringID(size_t idx) const { if (mEventCode == START_TAG) { const ResXMLTree_attrExt* tag = (const ResXMLTree_attrExt*)mCurExt; if (idx < dtohs(tag->attributeCount)) { const ResXMLTree_attribute* attr = (const ResXMLTree_attribute*) (((const uint8_t*)tag) + dtohs(tag->attributeStart) + (dtohs(tag->attributeSize)*idx)); return dtohl(attr->rawValue.index); } } return -1; } const uint16_t* ResXMLParser::getAttributeStringValue(size_t idx, size_t* outLen) const { int32_t id = getAttributeValueStringID(idx); //XML_NOISY(printf("getAttributeValue 0x%x=0x%x\n", idx, id)); return id >= 0 ? mTree.mStrings.stringAt(id, outLen) : NULL; } int32_t ResXMLParser::getAttributeDataType(size_t idx) const { if (mEventCode == START_TAG) { const ResXMLTree_attrExt* tag = (const ResXMLTree_attrExt*)mCurExt; if (idx < dtohs(tag->attributeCount)) { const ResXMLTree_attribute* attr = (const ResXMLTree_attribute*) (((const uint8_t*)tag) + dtohs(tag->attributeStart) + (dtohs(tag->attributeSize)*idx)); return attr->typedValue.dataType; } } return Res_value::TYPE_NULL; } int32_t ResXMLParser::getAttributeData(size_t idx) const { if (mEventCode == START_TAG) { const ResXMLTree_attrExt* tag = (const ResXMLTree_attrExt*)mCurExt; if (idx < dtohs(tag->attributeCount)) { const ResXMLTree_attribute* attr = (const ResXMLTree_attribute*) (((const uint8_t*)tag) + dtohs(tag->attributeStart) + (dtohs(tag->attributeSize)*idx)); return dtohl(attr->typedValue.data); } } return 0; } ssize_t ResXMLParser::getAttributeValue(size_t idx, Res_value* outValue) const { if (mEventCode == START_TAG) { const ResXMLTree_attrExt* tag = (const ResXMLTree_attrExt*)mCurExt; if (idx < dtohs(tag->attributeCount)) { const ResXMLTree_attribute* attr = (const ResXMLTree_attribute*) (((const uint8_t*)tag) + dtohs(tag->attributeStart) + (dtohs(tag->attributeSize)*idx)); outValue->copyFrom_dtoh(attr->typedValue); return sizeof(Res_value); } } return BAD_TYPE; } ssize_t ResXMLParser::indexOfAttribute(const char* ns, const char* attr) const { String16 nsStr(ns != NULL ? ns : ""); String16 attrStr(attr); return indexOfAttribute(ns ? nsStr.string() : NULL, ns ? nsStr.size() : 0, attrStr.string(), attrStr.size()); } ssize_t ResXMLParser::indexOfAttribute(const char16_t* ns, size_t nsLen, const char16_t* attr, size_t attrLen) const { if (mEventCode == START_TAG) { const size_t N = getAttributeCount(); for (size_t i=0; i attr=%s, curAttr=%s\n", // String8(attr).string(), String8(curAttr).string()); if (attr && curAttr && (strzcmp16(attr, attrLen, curAttr, curAttrLen) == 0)) { if (ns == NULL) { if (curNs == NULL) return i; } else if (curNs != NULL) { //printf(" --> ns=%s, curNs=%s\n", // String8(ns).string(), String8(curNs).string()); if (strzcmp16(ns, nsLen, curNs, curNsLen) == 0) return i; } } } } return NAME_NOT_FOUND; } ssize_t ResXMLParser::indexOfID() const { if (mEventCode == START_TAG) { const ssize_t idx = dtohs(((const ResXMLTree_attrExt*)mCurExt)->idIndex); if (idx > 0) return (idx-1); } return NAME_NOT_FOUND; } ssize_t ResXMLParser::indexOfClass() const { if (mEventCode == START_TAG) { const ssize_t idx = dtohs(((const ResXMLTree_attrExt*)mCurExt)->classIndex); if (idx > 0) return (idx-1); } return NAME_NOT_FOUND; } ssize_t ResXMLParser::indexOfStyle() const { if (mEventCode == START_TAG) { const ssize_t idx = dtohs(((const ResXMLTree_attrExt*)mCurExt)->styleIndex); if (idx > 0) return (idx-1); } return NAME_NOT_FOUND; } ResXMLParser::event_code_t ResXMLParser::nextNode() { if (mEventCode < 0) { return mEventCode; } do { const ResXMLTree_node* next = (const ResXMLTree_node*) (((const uint8_t*)mCurNode) + dtohl(mCurNode->header.size)); //ALOGW("Next node: prev=%p, next=%p\n", mCurNode, next); if (((const uint8_t*)next) >= mTree.mDataEnd) { mCurNode = NULL; return (mEventCode=END_DOCUMENT); } if (mTree.validateNode(next) != NO_ERROR) { mCurNode = NULL; return (mEventCode=BAD_DOCUMENT); } mCurNode = next; const uint16_t headerSize = dtohs(next->header.headerSize); const uint32_t totalSize = dtohl(next->header.size); mCurExt = ((const uint8_t*)next) + headerSize; size_t minExtSize = 0; event_code_t eventCode = (event_code_t)dtohs(next->header.type); switch ((mEventCode=eventCode)) { case RES_XML_START_NAMESPACE_TYPE: case RES_XML_END_NAMESPACE_TYPE: minExtSize = sizeof(ResXMLTree_namespaceExt); break; case RES_XML_START_ELEMENT_TYPE: minExtSize = sizeof(ResXMLTree_attrExt); break; case RES_XML_END_ELEMENT_TYPE: minExtSize = sizeof(ResXMLTree_endElementExt); break; case RES_XML_CDATA_TYPE: minExtSize = sizeof(ResXMLTree_cdataExt); break; default: ALOGW("Unknown XML block: header type %d in node at %d\n", (int)dtohs(next->header.type), (int)(((const uint8_t*)next)-((const uint8_t*)mTree.mHeader))); continue; } if ((totalSize-headerSize) < minExtSize) { ALOGW("Bad XML block: header type 0x%x in node at 0x%x has size %d, need %d\n", (int)dtohs(next->header.type), (int)(((const uint8_t*)next)-((const uint8_t*)mTree.mHeader)), (int)(totalSize-headerSize), (int)minExtSize); return (mEventCode=BAD_DOCUMENT); } //printf("CurNode=%p, CurExt=%p, headerSize=%d, minExtSize=%d\n", // mCurNode, mCurExt, headerSize, minExtSize); return eventCode; } while (true); } void ResXMLParser::getPosition(ResXMLParser::ResXMLPosition* pos) const { pos->eventCode = mEventCode; pos->curNode = mCurNode; pos->curExt = mCurExt; } void ResXMLParser::setPosition(const ResXMLParser::ResXMLPosition& pos) { mEventCode = pos.eventCode; mCurNode = pos.curNode; mCurExt = pos.curExt; } // -------------------------------------------------------------------- static volatile int32_t gCount = 0; ResXMLTree::ResXMLTree() : ResXMLParser(*this) , mError(NO_INIT), mOwnedData(NULL) { //ALOGI("Creating ResXMLTree %p #%d\n", this, android_atomic_inc(&gCount)+1); restart(); } ResXMLTree::ResXMLTree(const void* data, size_t size, bool copyData) : ResXMLParser(*this) , mError(NO_INIT), mOwnedData(NULL) { //ALOGI("Creating ResXMLTree %p #%d\n", this, android_atomic_inc(&gCount)+1); setTo(data, size, copyData); } ResXMLTree::~ResXMLTree() { //ALOGI("Destroying ResXMLTree in %p #%d\n", this, android_atomic_dec(&gCount)-1); uninit(); } status_t ResXMLTree::setTo(const void* data, size_t size, bool copyData) { uninit(); mEventCode = START_DOCUMENT; if (copyData) { mOwnedData = malloc(size); if (mOwnedData == NULL) { return (mError=NO_MEMORY); } memcpy(mOwnedData, data, size); data = mOwnedData; } mHeader = (const ResXMLTree_header*)data; mSize = dtohl(mHeader->header.size); if (dtohs(mHeader->header.headerSize) > mSize || mSize > size) { ALOGW("Bad XML block: header size %d or total size %d is larger than data size %d\n", (int)dtohs(mHeader->header.headerSize), (int)dtohl(mHeader->header.size), (int)size); mError = BAD_TYPE; restart(); return mError; } mDataEnd = ((const uint8_t*)mHeader) + mSize; mStrings.uninit(); mRootNode = NULL; mResIds = NULL; mNumResIds = 0; // First look for a couple interesting chunks: the string block // and first XML node. const ResChunk_header* chunk = (const ResChunk_header*)(((const uint8_t*)mHeader) + dtohs(mHeader->header.headerSize)); const ResChunk_header* lastChunk = chunk; while (((const uint8_t*)chunk) < (mDataEnd-sizeof(ResChunk_header)) && ((const uint8_t*)chunk) < (mDataEnd-dtohl(chunk->size))) { status_t err = validate_chunk(chunk, sizeof(ResChunk_header), mDataEnd, "XML"); if (err != NO_ERROR) { mError = err; goto done; } const uint16_t type = dtohs(chunk->type); const size_t size = dtohl(chunk->size); XML_NOISY(printf("Scanning @ %p: type=0x%x, size=0x%x\n", (void*)(((uint32_t)chunk)-((uint32_t)mHeader)), type, size)); if (type == RES_STRING_POOL_TYPE) { mStrings.setTo(chunk, size); } else if (type == RES_XML_RESOURCE_MAP_TYPE) { mResIds = (const uint32_t*) (((const uint8_t*)chunk)+dtohs(chunk->headerSize)); mNumResIds = (dtohl(chunk->size)-dtohs(chunk->headerSize))/sizeof(uint32_t); } else if (type >= RES_XML_FIRST_CHUNK_TYPE && type <= RES_XML_LAST_CHUNK_TYPE) { if (validateNode((const ResXMLTree_node*)chunk) != NO_ERROR) { mError = BAD_TYPE; goto done; } mCurNode = (const ResXMLTree_node*)lastChunk; if (nextNode() == BAD_DOCUMENT) { mError = BAD_TYPE; goto done; } mRootNode = mCurNode; mRootExt = mCurExt; mRootCode = mEventCode; break; } else { XML_NOISY(printf("Skipping unknown chunk!\n")); } lastChunk = chunk; chunk = (const ResChunk_header*) (((const uint8_t*)chunk) + size); } if (mRootNode == NULL) { ALOGW("Bad XML block: no root element node found\n"); mError = BAD_TYPE; goto done; } mError = mStrings.getError(); done: restart(); return mError; } status_t ResXMLTree::getError() const { return mError; } void ResXMLTree::uninit() { mError = NO_INIT; mStrings.uninit(); if (mOwnedData) { free(mOwnedData); mOwnedData = NULL; } restart(); } status_t ResXMLTree::validateNode(const ResXMLTree_node* node) const { const uint16_t eventCode = dtohs(node->header.type); status_t err = validate_chunk( &node->header, sizeof(ResXMLTree_node), mDataEnd, "ResXMLTree_node"); if (err >= NO_ERROR) { // Only perform additional validation on START nodes if (eventCode != RES_XML_START_ELEMENT_TYPE) { return NO_ERROR; } const uint16_t headerSize = dtohs(node->header.headerSize); const uint32_t size = dtohl(node->header.size); const ResXMLTree_attrExt* attrExt = (const ResXMLTree_attrExt*) (((const uint8_t*)node) + headerSize); // check for sensical values pulled out of the stream so far... if ((size >= headerSize + sizeof(ResXMLTree_attrExt)) && ((void*)attrExt > (void*)node)) { const size_t attrSize = ((size_t)dtohs(attrExt->attributeSize)) * dtohs(attrExt->attributeCount); if ((dtohs(attrExt->attributeStart)+attrSize) <= (size-headerSize)) { return NO_ERROR; } ALOGW("Bad XML block: node attributes use 0x%x bytes, only have 0x%x bytes\n", (unsigned int)(dtohs(attrExt->attributeStart)+attrSize), (unsigned int)(size-headerSize)); } else { ALOGW("Bad XML start block: node header size 0x%x, size 0x%x\n", (unsigned int)headerSize, (unsigned int)size); } return BAD_TYPE; } return err; #if 0 const bool isStart = dtohs(node->header.type) == RES_XML_START_ELEMENT_TYPE; const uint16_t headerSize = dtohs(node->header.headerSize); const uint32_t size = dtohl(node->header.size); if (headerSize >= (isStart ? sizeof(ResXMLTree_attrNode) : sizeof(ResXMLTree_node))) { if (size >= headerSize) { if (((const uint8_t*)node) <= (mDataEnd-size)) { if (!isStart) { return NO_ERROR; } if ((((size_t)dtohs(node->attributeSize))*dtohs(node->attributeCount)) <= (size-headerSize)) { return NO_ERROR; } ALOGW("Bad XML block: node attributes use 0x%x bytes, only have 0x%x bytes\n", ((int)dtohs(node->attributeSize))*dtohs(node->attributeCount), (int)(size-headerSize)); return BAD_TYPE; } ALOGW("Bad XML block: node at 0x%x extends beyond data end 0x%x\n", (int)(((const uint8_t*)node)-((const uint8_t*)mHeader)), (int)mSize); return BAD_TYPE; } ALOGW("Bad XML block: node at 0x%x header size 0x%x smaller than total size 0x%x\n", (int)(((const uint8_t*)node)-((const uint8_t*)mHeader)), (int)headerSize, (int)size); return BAD_TYPE; } ALOGW("Bad XML block: node at 0x%x header size 0x%x too small\n", (int)(((const uint8_t*)node)-((const uint8_t*)mHeader)), (int)headerSize); return BAD_TYPE; #endif } // -------------------------------------------------------------------- // -------------------------------------------------------------------- // -------------------------------------------------------------------- struct ResTable::Header { Header(ResTable* _owner) : owner(_owner), ownedData(NULL), header(NULL), resourceIDMap(NULL), resourceIDMapSize(0) { } ~Header() { free(resourceIDMap); } ResTable* const owner; void* ownedData; const ResTable_header* header; size_t size; const uint8_t* dataEnd; size_t index; void* cookie; ResStringPool values; uint32_t* resourceIDMap; size_t resourceIDMapSize; }; struct ResTable::Type { Type(const Header* _header, const Package* _package, size_t count) : header(_header), package(_package), entryCount(count), typeSpec(NULL), typeSpecFlags(NULL) { } const Header* const header; const Package* const package; const size_t entryCount; const ResTable_typeSpec* typeSpec; const uint32_t* typeSpecFlags; Vector configs; }; struct ResTable::Package { Package(ResTable* _owner, const Header* _header, const ResTable_package* _package) : owner(_owner), header(_header), package(_package) { } ~Package() { size_t i = types.size(); while (i > 0) { i--; delete types[i]; } } ResTable* const owner; const Header* const header; const ResTable_package* const package; Vector types; ResStringPool typeStrings; ResStringPool keyStrings; const Type* getType(size_t idx) const { return idx < types.size() ? types[idx] : NULL; } }; // A group of objects describing a particular resource package. // The first in 'package' is always the root object (from the resource // table that defined the package); the ones after are skins on top of it. struct ResTable::PackageGroup { PackageGroup(ResTable* _owner, const String16& _name, uint32_t _id) : owner(_owner), name(_name), id(_id), typeCount(0), bags(NULL) { } ~PackageGroup() { clearBagCache(); const size_t N = packages.size(); for (size_t i=0; iowner == owner) { delete pkg; } } } void clearBagCache() { if (bags) { TABLE_NOISY(printf("bags=%p\n", bags)); Package* pkg = packages[0]; TABLE_NOISY(printf("typeCount=%x\n", typeCount)); for (size_t i=0; igetType(i); if (type != NULL) { bag_set** typeBags = bags[i]; TABLE_NOISY(printf("typeBags=%p\n", typeBags)); if (typeBags) { TABLE_NOISY(printf("type->entryCount=%x\n", type->entryCount)); const size_t N = type->entryCount; for (size_t j=0; j packages; // This is for finding typeStrings and other common package stuff. Package* basePackage; // For quick access. size_t typeCount; // Computed attribute bags, first indexed by the type and second // by the entry in that type. bag_set*** bags; }; struct ResTable::bag_set { size_t numAttrs; // number in array size_t availAttrs; // total space in array uint32_t typeSpecFlags; // Followed by 'numAttr' bag_entry structures. }; ResTable::Theme::Theme(const ResTable& table) : mTable(table) { memset(mPackages, 0, sizeof(mPackages)); } ResTable::Theme::~Theme() { for (size_t i=0; inumTypes; j++) { theme_entry* te = pi->types[j].entries; if (te != NULL) { free(te); } } free(pi); } ResTable::Theme::package_info* ResTable::Theme::copy_package(package_info* pi) { package_info* newpi = (package_info*)malloc( sizeof(package_info) + (pi->numTypes*sizeof(type_info))); newpi->numTypes = pi->numTypes; for (size_t j=0; jnumTypes; j++) { size_t cnt = pi->types[j].numEntries; newpi->types[j].numEntries = cnt; theme_entry* te = pi->types[j].entries; if (te != NULL) { theme_entry* newte = (theme_entry*)malloc(cnt*sizeof(theme_entry)); newpi->types[j].entries = newte; memcpy(newte, te, cnt*sizeof(theme_entry)); } else { newpi->types[j].entries = NULL; } } return newpi; } status_t ResTable::Theme::applyStyle(uint32_t resID, bool force) { const bag_entry* bag; uint32_t bagTypeSpecFlags = 0; mTable.lock(); const ssize_t N = mTable.getBagLocked(resID, &bag, &bagTypeSpecFlags); TABLE_NOISY(ALOGV("Applying style 0x%08x to theme %p, count=%d", resID, this, N)); if (N < 0) { mTable.unlock(); return N; } uint32_t curPackage = 0xffffffff; ssize_t curPackageIndex = 0; package_info* curPI = NULL; uint32_t curType = 0xffffffff; size_t numEntries = 0; theme_entry* curEntries = NULL; const bag_entry* end = bag + N; while (bag < end) { const uint32_t attrRes = bag->map.name.ident; const uint32_t p = Res_GETPACKAGE(attrRes); const uint32_t t = Res_GETTYPE(attrRes); const uint32_t e = Res_GETENTRY(attrRes); if (curPackage != p) { const ssize_t pidx = mTable.getResourcePackageIndex(attrRes); if (pidx < 0) { ALOGE("Style contains key with bad package: 0x%08x\n", attrRes); bag++; continue; } curPackage = p; curPackageIndex = pidx; curPI = mPackages[pidx]; if (curPI == NULL) { PackageGroup* const grp = mTable.mPackageGroups[pidx]; int cnt = grp->typeCount; curPI = (package_info*)malloc( sizeof(package_info) + (cnt*sizeof(type_info))); curPI->numTypes = cnt; memset(curPI->types, 0, cnt*sizeof(type_info)); mPackages[pidx] = curPI; } curType = 0xffffffff; } if (curType != t) { if (t >= curPI->numTypes) { ALOGE("Style contains key with bad type: 0x%08x\n", attrRes); bag++; continue; } curType = t; curEntries = curPI->types[t].entries; if (curEntries == NULL) { PackageGroup* const grp = mTable.mPackageGroups[curPackageIndex]; const Type* type = grp->packages[0]->getType(t); int cnt = type != NULL ? type->entryCount : 0; curEntries = (theme_entry*)malloc(cnt*sizeof(theme_entry)); memset(curEntries, Res_value::TYPE_NULL, cnt*sizeof(theme_entry)); curPI->types[t].numEntries = cnt; curPI->types[t].entries = curEntries; } numEntries = curPI->types[t].numEntries; } if (e >= numEntries) { ALOGE("Style contains key with bad entry: 0x%08x\n", attrRes); bag++; continue; } theme_entry* curEntry = curEntries + e; TABLE_NOISY(ALOGV("Attr 0x%08x: type=0x%x, data=0x%08x; curType=0x%x", attrRes, bag->map.value.dataType, bag->map.value.data, curEntry->value.dataType)); if (force || curEntry->value.dataType == Res_value::TYPE_NULL) { curEntry->stringBlock = bag->stringBlock; curEntry->typeSpecFlags |= bagTypeSpecFlags; curEntry->value = bag->map.value; } bag++; } mTable.unlock(); //ALOGI("Applying style 0x%08x (force=%d) theme %p...\n", resID, force, this); //dumpToLog(); return NO_ERROR; } status_t ResTable::Theme::setTo(const Theme& other) { //ALOGI("Setting theme %p from theme %p...\n", this, &other); //dumpToLog(); //other.dumpToLog(); if (&mTable == &other.mTable) { for (size_t i=0; i= 0) { const package_info* const pi = mPackages[p]; TABLE_THEME(ALOGI("Found package: %p", pi)); if (pi != NULL) { TABLE_THEME(ALOGI("Desired type index is %ld in avail %d", t, pi->numTypes)); if (t < pi->numTypes) { const type_info& ti = pi->types[t]; TABLE_THEME(ALOGI("Desired entry index is %ld in avail %d", e, ti.numEntries)); if (e < ti.numEntries) { const theme_entry& te = ti.entries[e]; if (outTypeSpecFlags != NULL) { *outTypeSpecFlags |= te.typeSpecFlags; } TABLE_THEME(ALOGI("Theme value: type=0x%x, data=0x%08x", te.value.dataType, te.value.data)); const uint8_t type = te.value.dataType; if (type == Res_value::TYPE_ATTRIBUTE) { if (cnt > 0) { cnt--; resID = te.value.data; continue; } ALOGW("Too many attribute references, stopped at: 0x%08x\n", resID); return BAD_INDEX; } else if (type != Res_value::TYPE_NULL) { *outValue = te.value; return te.stringBlock; } return BAD_INDEX; } } } } break; } while (true); return BAD_INDEX; } ssize_t ResTable::Theme::resolveAttributeReference(Res_value* inOutValue, ssize_t blockIndex, uint32_t* outLastRef, uint32_t* inoutTypeSpecFlags, ResTable_config* inoutConfig) const { //printf("Resolving type=0x%x\n", inOutValue->dataType); if (inOutValue->dataType == Res_value::TYPE_ATTRIBUTE) { uint32_t newTypeSpecFlags; blockIndex = getAttribute(inOutValue->data, inOutValue, &newTypeSpecFlags); TABLE_THEME(ALOGI("Resolving attr reference: blockIndex=%d, type=0x%x, data=%p\n", (int)blockIndex, (int)inOutValue->dataType, (void*)inOutValue->data)); if (inoutTypeSpecFlags != NULL) *inoutTypeSpecFlags |= newTypeSpecFlags; //printf("Retrieved attribute new type=0x%x\n", inOutValue->dataType); if (blockIndex < 0) { return blockIndex; } } return mTable.resolveReference(inOutValue, blockIndex, outLastRef, inoutTypeSpecFlags, inoutConfig); } void ResTable::Theme::dumpToLog() const { ALOGI("Theme %p:\n", this); for (size_t i=0; inumTypes; j++) { type_info& ti = pi->types[j]; if (ti.numEntries == 0) continue; ALOGI(" Type #0x%02x:\n", (int)(j+1)); for (size_t k=0; k(idmap)); } status_t ResTable::add(Asset* asset, void* cookie, bool copyData, const void* idmap) { const void* data = asset->getBuffer(true); if (data == NULL) { ALOGW("Unable to get buffer of resource asset file"); return UNKNOWN_ERROR; } size_t size = (size_t)asset->getLength(); return add(data, size, cookie, asset, copyData, reinterpret_cast(idmap)); } status_t ResTable::add(ResTable* src) { mError = src->mError; for (size_t i=0; imHeaders.size(); i++) { mHeaders.add(src->mHeaders[i]); } for (size_t i=0; imPackageGroups.size(); i++) { PackageGroup* srcPg = src->mPackageGroups[i]; PackageGroup* pg = new PackageGroup(this, srcPg->name, srcPg->id); for (size_t j=0; jpackages.size(); j++) { pg->packages.add(srcPg->packages[j]); } pg->basePackage = srcPg->basePackage; pg->typeCount = srcPg->typeCount; mPackageGroups.add(pg); } memcpy(mPackageMap, src->mPackageMap, sizeof(mPackageMap)); return mError; } status_t ResTable::add(const void* data, size_t size, void* cookie, Asset* asset, bool copyData, const Asset* idmap) { if (!data) return NO_ERROR; Header* header = new Header(this); header->index = mHeaders.size(); header->cookie = cookie; if (idmap != NULL) { const size_t idmap_size = idmap->getLength(); const void* idmap_data = const_cast(idmap)->getBuffer(true); header->resourceIDMap = (uint32_t*)malloc(idmap_size); if (header->resourceIDMap == NULL) { delete header; return (mError = NO_MEMORY); } memcpy((void*)header->resourceIDMap, idmap_data, idmap_size); header->resourceIDMapSize = idmap_size; } mHeaders.add(header); const bool notDeviceEndian = htods(0xf0) != 0xf0; LOAD_TABLE_NOISY( ALOGV("Adding resources to ResTable: data=%p, size=0x%x, cookie=%p, asset=%p, copy=%d " "idmap=%p\n", data, size, cookie, asset, copyData, idmap)); if (copyData || notDeviceEndian) { header->ownedData = malloc(size); if (header->ownedData == NULL) { return (mError=NO_MEMORY); } memcpy(header->ownedData, data, size); data = header->ownedData; } header->header = (const ResTable_header*)data; header->size = dtohl(header->header->header.size); //ALOGI("Got size 0x%x, again size 0x%x, raw size 0x%x\n", header->size, // dtohl(header->header->header.size), header->header->header.size); LOAD_TABLE_NOISY(ALOGV("Loading ResTable @%p:\n", header->header)); LOAD_TABLE_NOISY(printHexData(2, header->header, header->size < 256 ? header->size : 256, 16, 16, 0, false, printToLogFunc)); if (dtohs(header->header->header.headerSize) > header->size || header->size > size) { ALOGW("Bad resource table: header size 0x%x or total size 0x%x is larger than data size 0x%x\n", (int)dtohs(header->header->header.headerSize), (int)header->size, (int)size); return (mError=BAD_TYPE); } if (((dtohs(header->header->header.headerSize)|header->size)&0x3) != 0) { ALOGW("Bad resource table: header size 0x%x or total size 0x%x is not on an integer boundary\n", (int)dtohs(header->header->header.headerSize), (int)header->size); return (mError=BAD_TYPE); } header->dataEnd = ((const uint8_t*)header->header) + header->size; // Iterate through all chunks. size_t curPackage = 0; const ResChunk_header* chunk = (const ResChunk_header*)(((const uint8_t*)header->header) + dtohs(header->header->header.headerSize)); while (((const uint8_t*)chunk) <= (header->dataEnd-sizeof(ResChunk_header)) && ((const uint8_t*)chunk) <= (header->dataEnd-dtohl(chunk->size))) { status_t err = validate_chunk(chunk, sizeof(ResChunk_header), header->dataEnd, "ResTable"); if (err != NO_ERROR) { return (mError=err); } TABLE_NOISY(ALOGV("Chunk: type=0x%x, headerSize=0x%x, size=0x%x, pos=%p\n", dtohs(chunk->type), dtohs(chunk->headerSize), dtohl(chunk->size), (void*)(((const uint8_t*)chunk) - ((const uint8_t*)header->header)))); const size_t csize = dtohl(chunk->size); const uint16_t ctype = dtohs(chunk->type); if (ctype == RES_STRING_POOL_TYPE) { if (header->values.getError() != NO_ERROR) { // Only use the first string chunk; ignore any others that // may appear. status_t err = header->values.setTo(chunk, csize); if (err != NO_ERROR) { return (mError=err); } } else { ALOGW("Multiple string chunks found in resource table."); } } else if (ctype == RES_TABLE_PACKAGE_TYPE) { if (curPackage >= dtohl(header->header->packageCount)) { ALOGW("More package chunks were found than the %d declared in the header.", dtohl(header->header->packageCount)); return (mError=BAD_TYPE); } uint32_t idmap_id = 0; if (idmap != NULL) { uint32_t tmp; if (getIdmapPackageId(header->resourceIDMap, header->resourceIDMapSize, &tmp) == NO_ERROR) { idmap_id = tmp; } } if (parsePackage((ResTable_package*)chunk, header, idmap_id) != NO_ERROR) { return mError; } curPackage++; } else { ALOGW("Unknown chunk type %p in table at %p.\n", (void*)(int)(ctype), (void*)(((const uint8_t*)chunk) - ((const uint8_t*)header->header))); } chunk = (const ResChunk_header*) (((const uint8_t*)chunk) + csize); } if (curPackage < dtohl(header->header->packageCount)) { ALOGW("Fewer package chunks (%d) were found than the %d declared in the header.", (int)curPackage, dtohl(header->header->packageCount)); return (mError=BAD_TYPE); } mError = header->values.getError(); if (mError != NO_ERROR) { ALOGW("No string values found in resource table!"); } TABLE_NOISY(ALOGV("Returning from add with mError=%d\n", mError)); return mError; } status_t ResTable::getError() const { return mError; } void ResTable::uninit() { mError = NO_INIT; size_t N = mPackageGroups.size(); for (size_t i=0; iowner == this) { if (header->ownedData) { free(header->ownedData); } delete header; } } mPackageGroups.clear(); mHeaders.clear(); } bool ResTable::getResourceName(uint32_t resID, resource_name* outName) const { if (mError != NO_ERROR) { return false; } const ssize_t p = getResourcePackageIndex(resID); const int t = Res_GETTYPE(resID); const int e = Res_GETENTRY(resID); if (p < 0) { if (Res_GETPACKAGE(resID)+1 == 0) { ALOGW("No package identifier when getting name for resource number 0x%08x", resID); } else { ALOGW("No known package when getting name for resource number 0x%08x", resID); } return false; } if (t < 0) { ALOGW("No type identifier when getting name for resource number 0x%08x", resID); return false; } const PackageGroup* const grp = mPackageGroups[p]; if (grp == NULL) { ALOGW("Bad identifier when getting name for resource number 0x%08x", resID); return false; } if (grp->packages.size() > 0) { const Package* const package = grp->packages[0]; const ResTable_type* type; const ResTable_entry* entry; ssize_t offset = getEntry(package, t, e, NULL, &type, &entry, NULL); if (offset <= 0) { return false; } outName->package = grp->name.string(); outName->packageLen = grp->name.size(); outName->type = grp->basePackage->typeStrings.stringAt(t, &outName->typeLen); outName->name = grp->basePackage->keyStrings.stringAt( dtohl(entry->key.index), &outName->nameLen); // If we have a bad index for some reason, we should abort. if (outName->type == NULL || outName->name == NULL) { return false; } return true; } return false; } ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag, uint16_t density, uint32_t* outSpecFlags, ResTable_config* outConfig) const { if (mError != NO_ERROR) { return mError; } const ssize_t p = getResourcePackageIndex(resID); const int t = Res_GETTYPE(resID); const int e = Res_GETENTRY(resID); if (p < 0) { if (Res_GETPACKAGE(resID)+1 == 0) { ALOGW("No package identifier when getting value for resource number 0x%08x", resID); } else { ALOGW("No known package when getting value for resource number 0x%08x", resID); } return BAD_INDEX; } if (t < 0) { ALOGW("No type identifier when getting value for resource number 0x%08x", resID); return BAD_INDEX; } const Res_value* bestValue = NULL; const Package* bestPackage = NULL; ResTable_config bestItem; memset(&bestItem, 0, sizeof(bestItem)); // make the compiler shut up if (outSpecFlags != NULL) *outSpecFlags = 0; // Look through all resource packages, starting with the most // recently added. const PackageGroup* const grp = mPackageGroups[p]; if (grp == NULL) { ALOGW("Bad identifier when getting value for resource number 0x%08x", resID); return BAD_INDEX; } // Allow overriding density const ResTable_config* desiredConfig = &mParams; ResTable_config* overrideConfig = NULL; if (density > 0) { overrideConfig = (ResTable_config*) malloc(sizeof(ResTable_config)); if (overrideConfig == NULL) { ALOGE("Couldn't malloc ResTable_config for overrides: %s", strerror(errno)); return BAD_INDEX; } memcpy(overrideConfig, &mParams, sizeof(ResTable_config)); overrideConfig->density = density; desiredConfig = overrideConfig; } ssize_t rc = BAD_VALUE; size_t ip = grp->packages.size(); while (ip > 0) { ip--; int T = t; int E = e; const Package* const package = grp->packages[ip]; if (package->header->resourceIDMap) { uint32_t overlayResID = 0x0; status_t retval = idmapLookup(package->header->resourceIDMap, package->header->resourceIDMapSize, resID, &overlayResID); if (retval == NO_ERROR && overlayResID != 0x0) { // for this loop iteration, this is the type and entry we really want ALOGV("resource map 0x%08x -> 0x%08x\n", resID, overlayResID); T = Res_GETTYPE(overlayResID); E = Res_GETENTRY(overlayResID); } else { // resource not present in overlay package, continue with the next package continue; } } const ResTable_type* type; const ResTable_entry* entry; const Type* typeClass; ssize_t offset = getEntry(package, T, E, desiredConfig, &type, &entry, &typeClass); if (offset <= 0) { // No {entry, appropriate config} pair found in package. If this // package is an overlay package (ip != 0), this simply means the // overlay package did not specify a default. // Non-overlay packages are still required to provide a default. if (offset < 0 && ip == 0) { ALOGW("Failure getting entry for 0x%08x (t=%d e=%d) in package %zd (error %d)\n", resID, T, E, ip, (int)offset); rc = offset; goto out; } continue; } if ((dtohs(entry->flags)&entry->FLAG_COMPLEX) != 0) { if (!mayBeBag) { ALOGW("Requesting resource %p failed because it is complex\n", (void*)resID); } continue; } TABLE_NOISY(aout << "Resource type data: " << HexDump(type, dtohl(type->header.size)) << endl); if ((size_t)offset > (dtohl(type->header.size)-sizeof(Res_value))) { ALOGW("ResTable_item at %d is beyond type chunk data %d", (int)offset, dtohl(type->header.size)); rc = BAD_TYPE; goto out; } const Res_value* item = (const Res_value*)(((const uint8_t*)type) + offset); ResTable_config thisConfig; thisConfig.copyFromDtoH(type->config); if (outSpecFlags != NULL) { if (typeClass->typeSpecFlags != NULL) { *outSpecFlags |= dtohl(typeClass->typeSpecFlags[E]); } else { *outSpecFlags = -1; } } if (bestPackage != NULL && (bestItem.isMoreSpecificThan(thisConfig) || bestItem.diff(thisConfig) == 0)) { // Discard thisConfig not only if bestItem is more specific, but also if the two configs // are identical (diff == 0), or overlay packages will not take effect. continue; } bestItem = thisConfig; bestValue = item; bestPackage = package; } TABLE_NOISY(printf("Found result: package %p\n", bestPackage)); if (bestValue) { outValue->size = dtohs(bestValue->size); outValue->res0 = bestValue->res0; outValue->dataType = bestValue->dataType; outValue->data = dtohl(bestValue->data); if (outConfig != NULL) { *outConfig = bestItem; } TABLE_NOISY(size_t len; printf("Found value: pkg=%d, type=%d, str=%s, int=%d\n", bestPackage->header->index, outValue->dataType, outValue->dataType == bestValue->TYPE_STRING ? String8(bestPackage->header->values.stringAt( outValue->data, &len)).string() : "", outValue->data)); rc = bestPackage->header->index; goto out; } out: if (overrideConfig != NULL) { free(overrideConfig); } return rc; } ssize_t ResTable::resolveReference(Res_value* value, ssize_t blockIndex, uint32_t* outLastRef, uint32_t* inoutTypeSpecFlags, ResTable_config* outConfig) const { int count=0; while (blockIndex >= 0 && value->dataType == value->TYPE_REFERENCE && value->data != 0 && count < 20) { if (outLastRef) *outLastRef = value->data; uint32_t lastRef = value->data; uint32_t newFlags = 0; const ssize_t newIndex = getResource(value->data, value, true, 0, &newFlags, outConfig); if (newIndex == BAD_INDEX) { return BAD_INDEX; } TABLE_THEME(ALOGI("Resolving reference %p: newIndex=%d, type=0x%x, data=%p\n", (void*)lastRef, (int)newIndex, (int)value->dataType, (void*)value->data)); //printf("Getting reference 0x%08x: newIndex=%d\n", value->data, newIndex); if (inoutTypeSpecFlags != NULL) *inoutTypeSpecFlags |= newFlags; if (newIndex < 0) { // This can fail if the resource being referenced is a style... // in this case, just return the reference, and expect the // caller to deal with. return blockIndex; } blockIndex = newIndex; count++; } return blockIndex; } const char16_t* ResTable::valueToString( const Res_value* value, size_t stringBlock, char16_t tmpBuffer[TMP_BUFFER_SIZE], size_t* outLen) { if (!value) { return NULL; } if (value->dataType == value->TYPE_STRING) { return getTableStringBlock(stringBlock)->stringAt(value->data, outLen); } // XXX do int to string conversions. return NULL; } ssize_t ResTable::lockBag(uint32_t resID, const bag_entry** outBag) const { mLock.lock(); ssize_t err = getBagLocked(resID, outBag); if (err < NO_ERROR) { //printf("*** get failed! unlocking\n"); mLock.unlock(); } return err; } void ResTable::unlockBag(const bag_entry* bag) const { //printf("<<< unlockBag %p\n", this); mLock.unlock(); } void ResTable::lock() const { mLock.lock(); } void ResTable::unlock() const { mLock.unlock(); } ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag, uint32_t* outTypeSpecFlags) const { if (mError != NO_ERROR) { return mError; } const ssize_t p = getResourcePackageIndex(resID); const int t = Res_GETTYPE(resID); const int e = Res_GETENTRY(resID); if (p < 0) { ALOGW("Invalid package identifier when getting bag for resource number 0x%08x", resID); return BAD_INDEX; } if (t < 0) { ALOGW("No type identifier when getting bag for resource number 0x%08x", resID); return BAD_INDEX; } //printf("Get bag: id=0x%08x, p=%d, t=%d\n", resID, p, t); PackageGroup* const grp = mPackageGroups[p]; if (grp == NULL) { ALOGW("Bad identifier when getting bag for resource number 0x%08x", resID); return false; } if (t >= (int)grp->typeCount) { ALOGW("Type identifier 0x%x is larger than type count 0x%x", t+1, (int)grp->typeCount); return BAD_INDEX; } const Package* const basePackage = grp->packages[0]; const Type* const typeConfigs = basePackage->getType(t); const size_t NENTRY = typeConfigs->entryCount; if (e >= (int)NENTRY) { ALOGW("Entry identifier 0x%x is larger than entry count 0x%x", e, (int)typeConfigs->entryCount); return BAD_INDEX; } // First see if we've already computed this bag... if (grp->bags) { bag_set** typeSet = grp->bags[t]; if (typeSet) { bag_set* set = typeSet[e]; if (set) { if (set != (bag_set*)0xFFFFFFFF) { if (outTypeSpecFlags != NULL) { *outTypeSpecFlags = set->typeSpecFlags; } *outBag = (bag_entry*)(set+1); //ALOGI("Found existing bag for: %p\n", (void*)resID); return set->numAttrs; } ALOGW("Attempt to retrieve bag 0x%08x which is invalid or in a cycle.", resID); return BAD_INDEX; } } } // Bag not found, we need to compute it! if (!grp->bags) { grp->bags = (bag_set***)malloc(sizeof(bag_set*)*grp->typeCount); if (!grp->bags) return NO_MEMORY; memset(grp->bags, 0, sizeof(bag_set*)*grp->typeCount); } bag_set** typeSet = grp->bags[t]; if (!typeSet) { typeSet = (bag_set**)malloc(sizeof(bag_set*)*NENTRY); if (!typeSet) return NO_MEMORY; memset(typeSet, 0, sizeof(bag_set*)*NENTRY); grp->bags[t] = typeSet; } // Mark that we are currently working on this one. typeSet[e] = (bag_set*)0xFFFFFFFF; // This is what we are building. bag_set* set = NULL; TABLE_NOISY(ALOGI("Building bag: %p\n", (void*)resID)); ResTable_config bestConfig; memset(&bestConfig, 0, sizeof(bestConfig)); // Now collect all bag attributes from all packages. size_t ip = grp->packages.size(); while (ip > 0) { ip--; int T = t; int E = e; const Package* const package = grp->packages[ip]; if (package->header->resourceIDMap) { uint32_t overlayResID = 0x0; status_t retval = idmapLookup(package->header->resourceIDMap, package->header->resourceIDMapSize, resID, &overlayResID); if (retval == NO_ERROR && overlayResID != 0x0) { // for this loop iteration, this is the type and entry we really want ALOGV("resource map 0x%08x -> 0x%08x\n", resID, overlayResID); T = Res_GETTYPE(overlayResID); E = Res_GETENTRY(overlayResID); } else { // resource not present in overlay package, continue with the next package continue; } } const ResTable_type* type; const ResTable_entry* entry; const Type* typeClass; ALOGV("Getting entry pkg=%p, t=%d, e=%d\n", package, T, E); ssize_t offset = getEntry(package, T, E, &mParams, &type, &entry, &typeClass); ALOGV("Resulting offset=%d\n", offset); if (offset <= 0) { // No {entry, appropriate config} pair found in package. If this // package is an overlay package (ip != 0), this simply means the // overlay package did not specify a default. // Non-overlay packages are still required to provide a default. if (offset < 0 && ip == 0) { if (set) free(set); return offset; } continue; } if ((dtohs(entry->flags)&entry->FLAG_COMPLEX) == 0) { ALOGW("Skipping entry %p in package table %d because it is not complex!\n", (void*)resID, (int)ip); continue; } if (set != NULL && !type->config.isBetterThan(bestConfig, NULL)) { continue; } bestConfig = type->config; if (set) { free(set); set = NULL; } const uint16_t entrySize = dtohs(entry->size); const uint32_t parent = entrySize >= sizeof(ResTable_map_entry) ? dtohl(((const ResTable_map_entry*)entry)->parent.ident) : 0; const uint32_t count = entrySize >= sizeof(ResTable_map_entry) ? dtohl(((const ResTable_map_entry*)entry)->count) : 0; size_t N = count; TABLE_NOISY(ALOGI("Found map: size=%p parent=%p count=%d\n", entrySize, parent, count)); // If this map inherits from another, we need to start // with its parent's values. Otherwise start out empty. TABLE_NOISY(printf("Creating new bag, entrySize=0x%08x, parent=0x%08x\n", entrySize, parent)); if (parent) { const bag_entry* parentBag; uint32_t parentTypeSpecFlags = 0; const ssize_t NP = getBagLocked(parent, &parentBag, &parentTypeSpecFlags); const size_t NT = ((NP >= 0) ? NP : 0) + N; set = (bag_set*)malloc(sizeof(bag_set)+sizeof(bag_entry)*NT); if (set == NULL) { return NO_MEMORY; } if (NP > 0) { memcpy(set+1, parentBag, NP*sizeof(bag_entry)); set->numAttrs = NP; TABLE_NOISY(ALOGI("Initialized new bag with %d inherited attributes.\n", NP)); } else { TABLE_NOISY(ALOGI("Initialized new bag with no inherited attributes.\n")); set->numAttrs = 0; } set->availAttrs = NT; set->typeSpecFlags = parentTypeSpecFlags; } else { set = (bag_set*)malloc(sizeof(bag_set)+sizeof(bag_entry)*N); if (set == NULL) { return NO_MEMORY; } set->numAttrs = 0; set->availAttrs = N; set->typeSpecFlags = 0; } if (typeClass->typeSpecFlags != NULL) { set->typeSpecFlags |= dtohl(typeClass->typeSpecFlags[E]); } else { set->typeSpecFlags = -1; } // Now merge in the new attributes... ssize_t curOff = offset; const ResTable_map* map; bag_entry* entries = (bag_entry*)(set+1); size_t curEntry = 0; uint32_t pos = 0; TABLE_NOISY(ALOGI("Starting with set %p, entries=%p, avail=%d\n", set, entries, set->availAttrs)); while (pos < count) { TABLE_NOISY(printf("Now at %p\n", (void*)curOff)); if ((size_t)curOff > (dtohl(type->header.size)-sizeof(ResTable_map))) { ALOGW("ResTable_map at %d is beyond type chunk data %d", (int)curOff, dtohl(type->header.size)); return BAD_TYPE; } map = (const ResTable_map*)(((const uint8_t*)type) + curOff); N++; const uint32_t newName = htodl(map->name.ident); bool isInside; uint32_t oldName = 0; while ((isInside=(curEntry < set->numAttrs)) && (oldName=entries[curEntry].map.name.ident) < newName) { TABLE_NOISY(printf("#%d: Keeping existing attribute: 0x%08x\n", curEntry, entries[curEntry].map.name.ident)); curEntry++; } if ((!isInside) || oldName != newName) { // This is a new attribute... figure out what to do with it. if (set->numAttrs >= set->availAttrs) { // Need to alloc more memory... const size_t newAvail = set->availAttrs+N; set = (bag_set*)realloc(set, sizeof(bag_set) + sizeof(bag_entry)*newAvail); if (set == NULL) { return NO_MEMORY; } set->availAttrs = newAvail; entries = (bag_entry*)(set+1); TABLE_NOISY(printf("Reallocated set %p, entries=%p, avail=%d\n", set, entries, set->availAttrs)); } if (isInside) { // Going in the middle, need to make space. memmove(entries+curEntry+1, entries+curEntry, sizeof(bag_entry)*(set->numAttrs-curEntry)); set->numAttrs++; } TABLE_NOISY(printf("#%d: Inserting new attribute: 0x%08x\n", curEntry, newName)); } else { TABLE_NOISY(printf("#%d: Replacing existing attribute: 0x%08x\n", curEntry, oldName)); } bag_entry* cur = entries+curEntry; cur->stringBlock = package->header->index; cur->map.name.ident = newName; cur->map.value.copyFrom_dtoh(map->value); TABLE_NOISY(printf("Setting entry #%d %p: block=%d, name=0x%08x, type=%d, data=0x%08x\n", curEntry, cur, cur->stringBlock, cur->map.name.ident, cur->map.value.dataType, cur->map.value.data)); // On to the next! curEntry++; pos++; const size_t size = dtohs(map->value.size); curOff += size + sizeof(*map)-sizeof(map->value); }; if (curEntry > set->numAttrs) { set->numAttrs = curEntry; } } // And this is it... typeSet[e] = set; if (set) { if (outTypeSpecFlags != NULL) { *outTypeSpecFlags = set->typeSpecFlags; } *outBag = (bag_entry*)(set+1); TABLE_NOISY(ALOGI("Returning %d attrs\n", set->numAttrs)); return set->numAttrs; } return BAD_INDEX; } void ResTable::setParameters(const ResTable_config* params) { mLock.lock(); TABLE_GETENTRY(ALOGI("Setting parameters: imsi:%d/%d lang:%c%c cnt:%c%c " "orien:%d touch:%d density:%d key:%d inp:%d nav:%d sz:%dx%d sw%ddp w%ddp h%ddp\n", params->mcc, params->mnc, params->language[0] ? params->language[0] : '-', params->language[1] ? params->language[1] : '-', params->country[0] ? params->country[0] : '-', params->country[1] ? params->country[1] : '-', params->orientation, params->touchscreen, params->density, params->keyboard, params->inputFlags, params->navigation, params->screenWidth, params->screenHeight, params->smallestScreenWidthDp, params->screenWidthDp, params->screenHeightDp)); mParams = *params; for (size_t i=0; iclearBagCache(); } mLock.unlock(); } void ResTable::getParameters(ResTable_config* params) const { mLock.lock(); *params = mParams; mLock.unlock(); } struct id_name_map { uint32_t id; size_t len; char16_t name[6]; }; const static id_name_map ID_NAMES[] = { { ResTable_map::ATTR_TYPE, 5, { '^', 't', 'y', 'p', 'e' } }, { ResTable_map::ATTR_L10N, 5, { '^', 'l', '1', '0', 'n' } }, { ResTable_map::ATTR_MIN, 4, { '^', 'm', 'i', 'n' } }, { ResTable_map::ATTR_MAX, 4, { '^', 'm', 'a', 'x' } }, { ResTable_map::ATTR_OTHER, 6, { '^', 'o', 't', 'h', 'e', 'r' } }, { ResTable_map::ATTR_ZERO, 5, { '^', 'z', 'e', 'r', 'o' } }, { ResTable_map::ATTR_ONE, 4, { '^', 'o', 'n', 'e' } }, { ResTable_map::ATTR_TWO, 4, { '^', 't', 'w', 'o' } }, { ResTable_map::ATTR_FEW, 4, { '^', 'f', 'e', 'w' } }, { ResTable_map::ATTR_MANY, 5, { '^', 'm', 'a', 'n', 'y' } }, }; uint32_t ResTable::identifierForName(const char16_t* name, size_t nameLen, const char16_t* type, size_t typeLen, const char16_t* package, size_t packageLen, uint32_t* outTypeSpecFlags) const { TABLE_SUPER_NOISY(printf("Identifier for name: error=%d\n", mError)); // Check for internal resource identifier as the very first thing, so // that we will always find them even when there are no resources. if (name[0] == '^') { const int N = (sizeof(ID_NAMES)/sizeof(ID_NAMES[0])); size_t len; for (int i=0; ilen; if (len != nameLen) { continue; } for (size_t j=1; jname[j] != name[j]) { goto nope; } } if (outTypeSpecFlags) { *outTypeSpecFlags = ResTable_typeSpec::SPEC_PUBLIC; } return m->id; nope: ; } if (nameLen > 7) { if (name[1] == 'i' && name[2] == 'n' && name[3] == 'd' && name[4] == 'e' && name[5] == 'x' && name[6] == '_') { int index = atoi(String8(name + 7, nameLen - 7).string()); if (Res_CHECKID(index)) { ALOGW("Array resource index: %d is too large.", index); return 0; } if (outTypeSpecFlags) { *outTypeSpecFlags = ResTable_typeSpec::SPEC_PUBLIC; } return Res_MAKEARRAY(index); } } return 0; } if (mError != NO_ERROR) { return 0; } bool fakePublic = false; // Figure out the package and type we are looking in... const char16_t* packageEnd = NULL; const char16_t* typeEnd = NULL; const char16_t* const nameEnd = name+nameLen; const char16_t* p = name; while (p < nameEnd) { if (*p == ':') packageEnd = p; else if (*p == '/') typeEnd = p; p++; } if (*name == '@') { name++; if (*name == '*') { fakePublic = true; name++; } } if (name >= nameEnd) { return 0; } if (packageEnd) { package = name; packageLen = packageEnd-name; name = packageEnd+1; } else if (!package) { return 0; } if (typeEnd) { type = name; typeLen = typeEnd-name; name = typeEnd+1; } else if (!type) { return 0; } if (name >= nameEnd) { return 0; } nameLen = nameEnd-name; TABLE_NOISY(printf("Looking for identifier: type=%s, name=%s, package=%s\n", String8(type, typeLen).string(), String8(name, nameLen).string(), String8(package, packageLen).string())); const size_t NG = mPackageGroups.size(); for (size_t ig=0; igname.string(), group->name.size())) { TABLE_NOISY(printf("Skipping package group: %s\n", String8(group->name).string())); continue; } const ssize_t ti = group->basePackage->typeStrings.indexOfString(type, typeLen); if (ti < 0) { TABLE_NOISY(printf("Type not found in package %s\n", String8(group->name).string())); continue; } const ssize_t ei = group->basePackage->keyStrings.indexOfString(name, nameLen); if (ei < 0) { TABLE_NOISY(printf("Name not found in package %s\n", String8(group->name).string())); continue; } TABLE_NOISY(printf("Search indices: type=%d, name=%d\n", ti, ei)); const Type* const typeConfigs = group->packages[0]->getType(ti); if (typeConfigs == NULL || typeConfigs->configs.size() <= 0) { TABLE_NOISY(printf("Expected type structure not found in package %s for idnex %d\n", String8(group->name).string(), ti)); } size_t NTC = typeConfigs->configs.size(); for (size_t tci=0; tciconfigs[tci]; const uint32_t typeOffset = dtohl(ty->entriesStart); const uint8_t* const end = ((const uint8_t*)ty) + dtohl(ty->header.size); const uint32_t* const eindex = (const uint32_t*) (((const uint8_t*)ty) + dtohs(ty->header.headerSize)); const size_t NE = dtohl(ty->entryCount); for (size_t i=0; i (dtohl(ty->header.size)-sizeof(ResTable_entry))) { ALOGW("ResTable_entry at %d is beyond type chunk data %d", offset, dtohl(ty->header.size)); return 0; } if ((offset&0x3) != 0) { ALOGW("ResTable_entry at %d (pkg=%d type=%d ent=%d) is not on an integer boundary when looking for %s:%s/%s", (int)offset, (int)group->id, (int)ti+1, (int)i, String8(package, packageLen).string(), String8(type, typeLen).string(), String8(name, nameLen).string()); return 0; } const ResTable_entry* const entry = (const ResTable_entry*) (((const uint8_t*)ty) + offset); if (dtohs(entry->size) < sizeof(*entry)) { ALOGW("ResTable_entry size %d is too small", dtohs(entry->size)); return BAD_TYPE; } TABLE_SUPER_NOISY(printf("Looking at entry #%d: want str %d, have %d\n", i, ei, dtohl(entry->key.index))); if (dtohl(entry->key.index) == (size_t)ei) { if (outTypeSpecFlags) { *outTypeSpecFlags = typeConfigs->typeSpecFlags[i]; if (fakePublic) { *outTypeSpecFlags |= ResTable_typeSpec::SPEC_PUBLIC; } } return Res_MAKEID(group->id-1, ti, i); } } } } return 0; } bool ResTable::expandResourceRef(const uint16_t* refStr, size_t refLen, String16* outPackage, String16* outType, String16* outName, const String16* defType, const String16* defPackage, const char** outErrorMsg, bool* outPublicOnly) { const char16_t* packageEnd = NULL; const char16_t* typeEnd = NULL; const char16_t* p = refStr; const char16_t* const end = p + refLen; while (p < end) { if (*p == ':') packageEnd = p; else if (*p == '/') { typeEnd = p; break; } p++; } p = refStr; if (*p == '@') p++; if (outPublicOnly != NULL) { *outPublicOnly = true; } if (*p == '*') { p++; if (outPublicOnly != NULL) { *outPublicOnly = false; } } if (packageEnd) { *outPackage = String16(p, packageEnd-p); p = packageEnd+1; } else { if (!defPackage) { if (outErrorMsg) { *outErrorMsg = "No resource package specified"; } return false; } *outPackage = *defPackage; } if (typeEnd) { *outType = String16(p, typeEnd-p); p = typeEnd+1; } else { if (!defType) { if (outErrorMsg) { *outErrorMsg = "No resource type specified"; } return false; } *outType = *defType; } *outName = String16(p, end-p); if(**outPackage == 0) { if(outErrorMsg) { *outErrorMsg = "Resource package cannot be an empty string"; } return false; } if(**outType == 0) { if(outErrorMsg) { *outErrorMsg = "Resource type cannot be an empty string"; } return false; } if(**outName == 0) { if(outErrorMsg) { *outErrorMsg = "Resource id cannot be an empty string"; } return false; } return true; } static uint32_t get_hex(char c, bool* outError) { if (c >= '0' && c <= '9') { return c - '0'; } else if (c >= 'a' && c <= 'f') { return c - 'a' + 0xa; } else if (c >= 'A' && c <= 'F') { return c - 'A' + 0xa; } *outError = true; return 0; } struct unit_entry { const char* name; size_t len; uint8_t type; uint32_t unit; float scale; }; static const unit_entry unitNames[] = { { "px", strlen("px"), Res_value::TYPE_DIMENSION, Res_value::COMPLEX_UNIT_PX, 1.0f }, { "dip", strlen("dip"), Res_value::TYPE_DIMENSION, Res_value::COMPLEX_UNIT_DIP, 1.0f }, { "dp", strlen("dp"), Res_value::TYPE_DIMENSION, Res_value::COMPLEX_UNIT_DIP, 1.0f }, { "sp", strlen("sp"), Res_value::TYPE_DIMENSION, Res_value::COMPLEX_UNIT_SP, 1.0f }, { "pt", strlen("pt"), Res_value::TYPE_DIMENSION, Res_value::COMPLEX_UNIT_PT, 1.0f }, { "in", strlen("in"), Res_value::TYPE_DIMENSION, Res_value::COMPLEX_UNIT_IN, 1.0f }, { "mm", strlen("mm"), Res_value::TYPE_DIMENSION, Res_value::COMPLEX_UNIT_MM, 1.0f }, { "%", strlen("%"), Res_value::TYPE_FRACTION, Res_value::COMPLEX_UNIT_FRACTION, 1.0f/100 }, { "%p", strlen("%p"), Res_value::TYPE_FRACTION, Res_value::COMPLEX_UNIT_FRACTION_PARENT, 1.0f/100 }, { NULL, 0, 0, 0, 0 } }; static bool parse_unit(const char* str, Res_value* outValue, float* outScale, const char** outEnd) { const char* end = str; while (*end != 0 && !isspace((unsigned char)*end)) { end++; } const size_t len = end-str; const char* realEnd = end; while (*realEnd != 0 && isspace((unsigned char)*realEnd)) { realEnd++; } if (*realEnd != 0) { return false; } const unit_entry* cur = unitNames; while (cur->name) { if (len == cur->len && strncmp(cur->name, str, len) == 0) { outValue->dataType = cur->type; outValue->data = cur->unit << Res_value::COMPLEX_UNIT_SHIFT; *outScale = cur->scale; *outEnd = end; //printf("Found unit %s for %s\n", cur->name, str); return true; } cur++; } return false; } bool ResTable::stringToInt(const char16_t* s, size_t len, Res_value* outValue) { while (len > 0 && isspace16(*s)) { s++; len--; } if (len <= 0) { return false; } size_t i = 0; int32_t val = 0; bool neg = false; if (*s == '-') { neg = true; i++; } if (s[i] < '0' || s[i] > '9') { return false; } // Decimal or hex? if (s[i] == '0' && s[i+1] == 'x') { if (outValue) outValue->dataType = outValue->TYPE_INT_HEX; i += 2; bool error = false; while (i < len && !error) { val = (val*16) + get_hex(s[i], &error); i++; } if (error) { return false; } } else { if (outValue) outValue->dataType = outValue->TYPE_INT_DEC; while (i < len) { if (s[i] < '0' || s[i] > '9') { return false; } val = (val*10) + s[i]-'0'; i++; } } if (neg) val = -val; while (i < len && isspace16(s[i])) { i++; } if (i == len) { if (outValue) outValue->data = val; return true; } return false; } bool ResTable::stringToFloat(const char16_t* s, size_t len, Res_value* outValue) { while (len > 0 && isspace16(*s)) { s++; len--; } if (len <= 0) { return false; } char buf[128]; int i=0; while (len > 0 && *s != 0 && i < 126) { if (*s > 255) { return false; } buf[i++] = *s++; len--; } if (len > 0) { return false; } if (buf[0] < '0' && buf[0] > '9' && buf[0] != '.') { return false; } buf[i] = 0; const char* end; float f = strtof(buf, (char**)&end); if (*end != 0 && !isspace((unsigned char)*end)) { // Might be a unit... float scale; if (parse_unit(end, outValue, &scale, &end)) { f *= scale; const bool neg = f < 0; if (neg) f = -f; uint64_t bits = (uint64_t)(f*(1<<23)+.5f); uint32_t radix; uint32_t shift; if ((bits&0x7fffff) == 0) { // Always use 23p0 if there is no fraction, just to make // things easier to read. radix = Res_value::COMPLEX_RADIX_23p0; shift = 23; } else if ((bits&0xffffffffff800000LL) == 0) { // Magnitude is zero -- can fit in 0 bits of precision. radix = Res_value::COMPLEX_RADIX_0p23; shift = 0; } else if ((bits&0xffffffff80000000LL) == 0) { // Magnitude can fit in 8 bits of precision. radix = Res_value::COMPLEX_RADIX_8p15; shift = 8; } else if ((bits&0xffffff8000000000LL) == 0) { // Magnitude can fit in 16 bits of precision. radix = Res_value::COMPLEX_RADIX_16p7; shift = 16; } else { // Magnitude needs entire range, so no fractional part. radix = Res_value::COMPLEX_RADIX_23p0; shift = 23; } int32_t mantissa = (int32_t)( (bits>>shift) & Res_value::COMPLEX_MANTISSA_MASK); if (neg) { mantissa = (-mantissa) & Res_value::COMPLEX_MANTISSA_MASK; } outValue->data |= (radix<data); return true; } return false; } while (*end != 0 && isspace((unsigned char)*end)) { end++; } if (*end == 0) { if (outValue) { outValue->dataType = outValue->TYPE_FLOAT; *(float*)(&outValue->data) = f; return true; } } return false; } bool ResTable::stringToValue(Res_value* outValue, String16* outString, const char16_t* s, size_t len, bool preserveSpaces, bool coerceType, uint32_t attrID, const String16* defType, const String16* defPackage, Accessor* accessor, void* accessorCookie, uint32_t attrType, bool enforcePrivate) const { bool localizationSetting = accessor != NULL && accessor->getLocalizationSetting(); const char* errorMsg = NULL; outValue->size = sizeof(Res_value); outValue->res0 = 0; // First strip leading/trailing whitespace. Do this before handling // escapes, so they can be used to force whitespace into the string. if (!preserveSpaces) { while (len > 0 && isspace16(*s)) { s++; len--; } while (len > 0 && isspace16(s[len-1])) { len--; } // If the string ends with '\', then we keep the space after it. if (len > 0 && s[len-1] == '\\' && s[len] != 0) { len++; } } //printf("Value for: %s\n", String8(s, len).string()); uint32_t l10nReq = ResTable_map::L10N_NOT_REQUIRED; uint32_t attrMin = 0x80000000, attrMax = 0x7fffffff; bool fromAccessor = false; if (attrID != 0 && !Res_INTERNALID(attrID)) { const ssize_t p = getResourcePackageIndex(attrID); const bag_entry* bag; ssize_t cnt = p >= 0 ? lockBag(attrID, &bag) : -1; //printf("For attr 0x%08x got bag of %d\n", attrID, cnt); if (cnt >= 0) { while (cnt > 0) { //printf("Entry 0x%08x = 0x%08x\n", bag->map.name.ident, bag->map.value.data); switch (bag->map.name.ident) { case ResTable_map::ATTR_TYPE: attrType = bag->map.value.data; break; case ResTable_map::ATTR_MIN: attrMin = bag->map.value.data; break; case ResTable_map::ATTR_MAX: attrMax = bag->map.value.data; break; case ResTable_map::ATTR_L10N: l10nReq = bag->map.value.data; break; } bag++; cnt--; } unlockBag(bag); } else if (accessor && accessor->getAttributeType(attrID, &attrType)) { fromAccessor = true; if (attrType == ResTable_map::TYPE_ENUM || attrType == ResTable_map::TYPE_FLAGS || attrType == ResTable_map::TYPE_INTEGER) { accessor->getAttributeMin(attrID, &attrMin); accessor->getAttributeMax(attrID, &attrMax); } if (localizationSetting) { l10nReq = accessor->getAttributeL10N(attrID); } } } const bool canStringCoerce = coerceType && (attrType&ResTable_map::TYPE_STRING) != 0; if (*s == '@') { outValue->dataType = outValue->TYPE_REFERENCE; // Note: we don't check attrType here because the reference can // be to any other type; we just need to count on the client making // sure the referenced type is correct. //printf("Looking up ref: %s\n", String8(s, len).string()); // It's a reference! if (len == 5 && s[1]=='n' && s[2]=='u' && s[3]=='l' && s[4]=='l') { outValue->data = 0; return true; } else { bool createIfNotFound = false; const char16_t* resourceRefName; int resourceNameLen; if (len > 2 && s[1] == '+') { createIfNotFound = true; resourceRefName = s + 2; resourceNameLen = len - 2; } else if (len > 2 && s[1] == '*') { enforcePrivate = false; resourceRefName = s + 2; resourceNameLen = len - 2; } else { createIfNotFound = false; resourceRefName = s + 1; resourceNameLen = len - 1; } String16 package, type, name; if (!expandResourceRef(resourceRefName,resourceNameLen, &package, &type, &name, defType, defPackage, &errorMsg)) { if (accessor != NULL) { accessor->reportError(accessorCookie, errorMsg); } return false; } uint32_t specFlags = 0; uint32_t rid = identifierForName(name.string(), name.size(), type.string(), type.size(), package.string(), package.size(), &specFlags); if (rid != 0) { if (enforcePrivate) { if ((specFlags&ResTable_typeSpec::SPEC_PUBLIC) == 0) { if (accessor != NULL) { accessor->reportError(accessorCookie, "Resource is not public."); } return false; } } if (!accessor) { outValue->data = rid; return true; } rid = Res_MAKEID( accessor->getRemappedPackage(Res_GETPACKAGE(rid)), Res_GETTYPE(rid), Res_GETENTRY(rid)); TABLE_NOISY(printf("Incl %s:%s/%s: 0x%08x\n", String8(package).string(), String8(type).string(), String8(name).string(), rid)); outValue->data = rid; return true; } if (accessor) { uint32_t rid = accessor->getCustomResourceWithCreation(package, type, name, createIfNotFound); if (rid != 0) { TABLE_NOISY(printf("Pckg %s:%s/%s: 0x%08x\n", String8(package).string(), String8(type).string(), String8(name).string(), rid)); outValue->data = rid; return true; } } } if (accessor != NULL) { accessor->reportError(accessorCookie, "No resource found that matches the given name"); } return false; } // if we got to here, and localization is required and it's not a reference, // complain and bail. if (l10nReq == ResTable_map::L10N_SUGGESTED) { if (localizationSetting) { if (accessor != NULL) { accessor->reportError(accessorCookie, "This attribute must be localized."); } } } if (*s == '#') { // It's a color! Convert to an integer of the form 0xaarrggbb. uint32_t color = 0; bool error = false; if (len == 4) { outValue->dataType = outValue->TYPE_INT_COLOR_RGB4; color |= 0xFF000000; color |= get_hex(s[1], &error) << 20; color |= get_hex(s[1], &error) << 16; color |= get_hex(s[2], &error) << 12; color |= get_hex(s[2], &error) << 8; color |= get_hex(s[3], &error) << 4; color |= get_hex(s[3], &error); } else if (len == 5) { outValue->dataType = outValue->TYPE_INT_COLOR_ARGB4; color |= get_hex(s[1], &error) << 28; color |= get_hex(s[1], &error) << 24; color |= get_hex(s[2], &error) << 20; color |= get_hex(s[2], &error) << 16; color |= get_hex(s[3], &error) << 12; color |= get_hex(s[3], &error) << 8; color |= get_hex(s[4], &error) << 4; color |= get_hex(s[4], &error); } else if (len == 7) { outValue->dataType = outValue->TYPE_INT_COLOR_RGB8; color |= 0xFF000000; color |= get_hex(s[1], &error) << 20; color |= get_hex(s[2], &error) << 16; color |= get_hex(s[3], &error) << 12; color |= get_hex(s[4], &error) << 8; color |= get_hex(s[5], &error) << 4; color |= get_hex(s[6], &error); } else if (len == 9) { outValue->dataType = outValue->TYPE_INT_COLOR_ARGB8; color |= get_hex(s[1], &error) << 28; color |= get_hex(s[2], &error) << 24; color |= get_hex(s[3], &error) << 20; color |= get_hex(s[4], &error) << 16; color |= get_hex(s[5], &error) << 12; color |= get_hex(s[6], &error) << 8; color |= get_hex(s[7], &error) << 4; color |= get_hex(s[8], &error); } else { error = true; } if (!error) { if ((attrType&ResTable_map::TYPE_COLOR) == 0) { if (!canStringCoerce) { if (accessor != NULL) { accessor->reportError(accessorCookie, "Color types not allowed"); } return false; } } else { outValue->data = color; //printf("Color input=%s, output=0x%x\n", String8(s, len).string(), color); return true; } } else { if ((attrType&ResTable_map::TYPE_COLOR) != 0) { if (accessor != NULL) { accessor->reportError(accessorCookie, "Color value not valid --" " must be #rgb, #argb, #rrggbb, or #aarrggbb"); } #if 0 fprintf(stderr, "%s: Color ID %s value %s is not valid\n", "Resource File", //(const char*)in->getPrintableSource(), String8(*curTag).string(), String8(s, len).string()); #endif return false; } } } if (*s == '?') { outValue->dataType = outValue->TYPE_ATTRIBUTE; // Note: we don't check attrType here because the reference can // be to any other type; we just need to count on the client making // sure the referenced type is correct. //printf("Looking up attr: %s\n", String8(s, len).string()); static const String16 attr16("attr"); String16 package, type, name; if (!expandResourceRef(s+1, len-1, &package, &type, &name, &attr16, defPackage, &errorMsg)) { if (accessor != NULL) { accessor->reportError(accessorCookie, errorMsg); } return false; } //printf("Pkg: %s, Type: %s, Name: %s\n", // String8(package).string(), String8(type).string(), // String8(name).string()); uint32_t specFlags = 0; uint32_t rid = identifierForName(name.string(), name.size(), type.string(), type.size(), package.string(), package.size(), &specFlags); if (rid != 0) { if (enforcePrivate) { if ((specFlags&ResTable_typeSpec::SPEC_PUBLIC) == 0) { if (accessor != NULL) { accessor->reportError(accessorCookie, "Attribute is not public."); } return false; } } if (!accessor) { outValue->data = rid; return true; } rid = Res_MAKEID( accessor->getRemappedPackage(Res_GETPACKAGE(rid)), Res_GETTYPE(rid), Res_GETENTRY(rid)); //printf("Incl %s:%s/%s: 0x%08x\n", // String8(package).string(), String8(type).string(), // String8(name).string(), rid); outValue->data = rid; return true; } if (accessor) { uint32_t rid = accessor->getCustomResource(package, type, name); if (rid != 0) { //printf("Mine %s:%s/%s: 0x%08x\n", // String8(package).string(), String8(type).string(), // String8(name).string(), rid); outValue->data = rid; return true; } } if (accessor != NULL) { accessor->reportError(accessorCookie, "No resource found that matches the given name"); } return false; } if (stringToInt(s, len, outValue)) { if ((attrType&ResTable_map::TYPE_INTEGER) == 0) { // If this type does not allow integers, but does allow floats, // fall through on this error case because the float type should // be able to accept any integer value. if (!canStringCoerce && (attrType&ResTable_map::TYPE_FLOAT) == 0) { if (accessor != NULL) { accessor->reportError(accessorCookie, "Integer types not allowed"); } return false; } } else { if (((int32_t)outValue->data) < ((int32_t)attrMin) || ((int32_t)outValue->data) > ((int32_t)attrMax)) { if (accessor != NULL) { accessor->reportError(accessorCookie, "Integer value out of range"); } return false; } return true; } } if (stringToFloat(s, len, outValue)) { if (outValue->dataType == Res_value::TYPE_DIMENSION) { if ((attrType&ResTable_map::TYPE_DIMENSION) != 0) { return true; } if (!canStringCoerce) { if (accessor != NULL) { accessor->reportError(accessorCookie, "Dimension types not allowed"); } return false; } } else if (outValue->dataType == Res_value::TYPE_FRACTION) { if ((attrType&ResTable_map::TYPE_FRACTION) != 0) { return true; } if (!canStringCoerce) { if (accessor != NULL) { accessor->reportError(accessorCookie, "Fraction types not allowed"); } return false; } } else if ((attrType&ResTable_map::TYPE_FLOAT) == 0) { if (!canStringCoerce) { if (accessor != NULL) { accessor->reportError(accessorCookie, "Float types not allowed"); } return false; } } else { return true; } } if (len == 4) { if ((s[0] == 't' || s[0] == 'T') && (s[1] == 'r' || s[1] == 'R') && (s[2] == 'u' || s[2] == 'U') && (s[3] == 'e' || s[3] == 'E')) { if ((attrType&ResTable_map::TYPE_BOOLEAN) == 0) { if (!canStringCoerce) { if (accessor != NULL) { accessor->reportError(accessorCookie, "Boolean types not allowed"); } return false; } } else { outValue->dataType = outValue->TYPE_INT_BOOLEAN; outValue->data = (uint32_t)-1; return true; } } } if (len == 5) { if ((s[0] == 'f' || s[0] == 'F') && (s[1] == 'a' || s[1] == 'A') && (s[2] == 'l' || s[2] == 'L') && (s[3] == 's' || s[3] == 'S') && (s[4] == 'e' || s[4] == 'E')) { if ((attrType&ResTable_map::TYPE_BOOLEAN) == 0) { if (!canStringCoerce) { if (accessor != NULL) { accessor->reportError(accessorCookie, "Boolean types not allowed"); } return false; } } else { outValue->dataType = outValue->TYPE_INT_BOOLEAN; outValue->data = 0; return true; } } } if ((attrType&ResTable_map::TYPE_ENUM) != 0) { const ssize_t p = getResourcePackageIndex(attrID); const bag_entry* bag; ssize_t cnt = p >= 0 ? lockBag(attrID, &bag) : -1; //printf("Got %d for enum\n", cnt); if (cnt >= 0) { resource_name rname; while (cnt > 0) { if (!Res_INTERNALID(bag->map.name.ident)) { //printf("Trying attr #%08x\n", bag->map.name.ident); if (getResourceName(bag->map.name.ident, &rname)) { #if 0 printf("Matching %s against %s (0x%08x)\n", String8(s, len).string(), String8(rname.name, rname.nameLen).string(), bag->map.name.ident); #endif if (strzcmp16(s, len, rname.name, rname.nameLen) == 0) { outValue->dataType = bag->map.value.dataType; outValue->data = bag->map.value.data; unlockBag(bag); return true; } } } bag++; cnt--; } unlockBag(bag); } if (fromAccessor) { if (accessor->getAttributeEnum(attrID, s, len, outValue)) { return true; } } } if ((attrType&ResTable_map::TYPE_FLAGS) != 0) { const ssize_t p = getResourcePackageIndex(attrID); const bag_entry* bag; ssize_t cnt = p >= 0 ? lockBag(attrID, &bag) : -1; //printf("Got %d for flags\n", cnt); if (cnt >= 0) { bool failed = false; resource_name rname; outValue->dataType = Res_value::TYPE_INT_HEX; outValue->data = 0; const char16_t* end = s + len; const char16_t* pos = s; while (pos < end && !failed) { const char16_t* start = pos; pos++; while (pos < end && *pos != '|') { pos++; } //printf("Looking for: %s\n", String8(start, pos-start).string()); const bag_entry* bagi = bag; ssize_t i; for (i=0; imap.name.ident)) { //printf("Trying attr #%08x\n", bagi->map.name.ident); if (getResourceName(bagi->map.name.ident, &rname)) { #if 0 printf("Matching %s against %s (0x%08x)\n", String8(start,pos-start).string(), String8(rname.name, rname.nameLen).string(), bagi->map.name.ident); #endif if (strzcmp16(start, pos-start, rname.name, rname.nameLen) == 0) { outValue->data |= bagi->map.value.data; break; } } } } if (i >= cnt) { // Didn't find this flag identifier. failed = true; } if (pos < end) { pos++; } } unlockBag(bag); if (!failed) { //printf("Final flag value: 0x%lx\n", outValue->data); return true; } } if (fromAccessor) { if (accessor->getAttributeFlags(attrID, s, len, outValue)) { //printf("Final flag value: 0x%lx\n", outValue->data); return true; } } } if ((attrType&ResTable_map::TYPE_STRING) == 0) { if (accessor != NULL) { accessor->reportError(accessorCookie, "String types not allowed"); } return false; } // Generic string handling... outValue->dataType = outValue->TYPE_STRING; if (outString) { bool failed = collectString(outString, s, len, preserveSpaces, &errorMsg); if (accessor != NULL) { accessor->reportError(accessorCookie, errorMsg); } return failed; } return true; } bool ResTable::collectString(String16* outString, const char16_t* s, size_t len, bool preserveSpaces, const char** outErrorMsg, bool append) { String16 tmp; char quoted = 0; const char16_t* p = s; while (p < (s+len)) { while (p < (s+len)) { const char16_t c = *p; if (c == '\\') { break; } if (!preserveSpaces) { if (quoted == 0 && isspace16(c) && (c != ' ' || isspace16(*(p+1)))) { break; } if (c == '"' && (quoted == 0 || quoted == '"')) { break; } if (c == '\'' && (quoted == 0 || quoted == '\'')) { /* * In practice, when people write ' instead of \' * in a string, they are doing it by accident * instead of really meaning to use ' as a quoting * character. Warn them so they don't lose it. */ if (outErrorMsg) { *outErrorMsg = "Apostrophe not preceded by \\"; } return false; } } p++; } if (p < (s+len)) { if (p > s) { tmp.append(String16(s, p-s)); } if (!preserveSpaces && (*p == '"' || *p == '\'')) { if (quoted == 0) { quoted = *p; } else { quoted = 0; } p++; } else if (!preserveSpaces && isspace16(*p)) { // Space outside of a quote -- consume all spaces and // leave a single plain space char. tmp.append(String16(" ")); p++; while (p < (s+len) && isspace16(*p)) { p++; } } else if (*p == '\\') { p++; if (p < (s+len)) { switch (*p) { case 't': tmp.append(String16("\t")); break; case 'n': tmp.append(String16("\n")); break; case '#': tmp.append(String16("#")); break; case '@': tmp.append(String16("@")); break; case '?': tmp.append(String16("?")); break; case '"': tmp.append(String16("\"")); break; case '\'': tmp.append(String16("'")); break; case '\\': tmp.append(String16("\\")); break; case 'u': { char16_t chr = 0; int i = 0; while (i < 4 && p[1] != 0) { p++; i++; int c; if (*p >= '0' && *p <= '9') { c = *p - '0'; } else if (*p >= 'a' && *p <= 'f') { c = *p - 'a' + 10; } else if (*p >= 'A' && *p <= 'F') { c = *p - 'A' + 10; } else { if (outErrorMsg) { *outErrorMsg = "Bad character in \\u unicode escape sequence"; } return false; } chr = (chr<<4) | c; } tmp.append(String16(&chr, 1)); } break; default: // ignore unknown escape chars. break; } p++; } } len -= (p-s); s = p; } } if (tmp.size() != 0) { if (len > 0) { tmp.append(String16(s, len)); } if (append) { outString->append(tmp); } else { outString->setTo(tmp); } } else { if (append) { outString->append(String16(s, len)); } else { outString->setTo(s, len); } } return true; } size_t ResTable::getBasePackageCount() const { if (mError != NO_ERROR) { return 0; } return mPackageGroups.size(); } const char16_t* ResTable::getBasePackageName(size_t idx) const { if (mError != NO_ERROR) { return 0; } LOG_FATAL_IF(idx >= mPackageGroups.size(), "Requested package index %d past package count %d", (int)idx, (int)mPackageGroups.size()); return mPackageGroups[idx]->name.string(); } uint32_t ResTable::getBasePackageId(size_t idx) const { if (mError != NO_ERROR) { return 0; } LOG_FATAL_IF(idx >= mPackageGroups.size(), "Requested package index %d past package count %d", (int)idx, (int)mPackageGroups.size()); return mPackageGroups[idx]->id; } size_t ResTable::getTableCount() const { return mHeaders.size(); } const ResStringPool* ResTable::getTableStringBlock(size_t index) const { return &mHeaders[index]->values; } void* ResTable::getTableCookie(size_t index) const { return mHeaders[index]->cookie; } void ResTable::getConfigurations(Vector* configs) const { const size_t I = mPackageGroups.size(); for (size_t i=0; ipackages.size(); for (size_t j=0; jpackages[j]; const size_t K = package->types.size(); for (size_t k=0; ktypes[k]; if (type == NULL) continue; const size_t L = type->configs.size(); for (size_t l=0; lconfigs[l]; const ResTable_config* cfg = &config->config; // only insert unique const size_t M = configs->size(); size_t m; for (m=0; madd(*cfg); } } } } } } void ResTable::getLocales(Vector* locales) const { Vector configs; ALOGV("calling getConfigurations"); getConfigurations(&configs); ALOGV("called getConfigurations size=%d", (int)configs.size()); const size_t I = configs.size(); for (size_t i=0; isize(); size_t j; for (j=0; jadd(String8(locale)); } } } ssize_t ResTable::getEntry( const Package* package, int typeIndex, int entryIndex, const ResTable_config* config, const ResTable_type** outType, const ResTable_entry** outEntry, const Type** outTypeClass) const { ALOGV("Getting entry from package %p\n", package); const ResTable_package* const pkg = package->package; const Type* allTypes = package->getType(typeIndex); ALOGV("allTypes=%p\n", allTypes); if (allTypes == NULL) { ALOGV("Skipping entry type index 0x%02x because type is NULL!\n", typeIndex); return 0; } if ((size_t)entryIndex >= allTypes->entryCount) { ALOGW("getEntry failing because entryIndex %d is beyond type entryCount %d", entryIndex, (int)allTypes->entryCount); return BAD_TYPE; } const ResTable_type* type = NULL; uint32_t offset = ResTable_type::NO_ENTRY; ResTable_config bestConfig; memset(&bestConfig, 0, sizeof(bestConfig)); // make the compiler shut up const size_t NT = allTypes->configs.size(); for (size_t i=0; iconfigs[i]; if (thisType == NULL) continue; ResTable_config thisConfig; thisConfig.copyFromDtoH(thisType->config); TABLE_GETENTRY(ALOGI("Match entry 0x%x in type 0x%x (sz 0x%x): imsi:%d/%d=%d/%d " "lang:%c%c=%c%c cnt:%c%c=%c%c orien:%d=%d touch:%d=%d " "density:%d=%d key:%d=%d inp:%d=%d nav:%d=%d w:%d=%d h:%d=%d " "swdp:%d=%d wdp:%d=%d hdp:%d=%d\n", entryIndex, typeIndex+1, dtohl(thisType->config.size), thisConfig.mcc, thisConfig.mnc, config ? config->mcc : 0, config ? config->mnc : 0, thisConfig.language[0] ? thisConfig.language[0] : '-', thisConfig.language[1] ? thisConfig.language[1] : '-', config && config->language[0] ? config->language[0] : '-', config && config->language[1] ? config->language[1] : '-', thisConfig.country[0] ? thisConfig.country[0] : '-', thisConfig.country[1] ? thisConfig.country[1] : '-', config && config->country[0] ? config->country[0] : '-', config && config->country[1] ? config->country[1] : '-', thisConfig.orientation, config ? config->orientation : 0, thisConfig.touchscreen, config ? config->touchscreen : 0, thisConfig.density, config ? config->density : 0, thisConfig.keyboard, config ? config->keyboard : 0, thisConfig.inputFlags, config ? config->inputFlags : 0, thisConfig.navigation, config ? config->navigation : 0, thisConfig.screenWidth, config ? config->screenWidth : 0, thisConfig.screenHeight, config ? config->screenHeight : 0, thisConfig.smallestScreenWidthDp, config ? config->smallestScreenWidthDp : 0, thisConfig.screenWidthDp, config ? config->screenWidthDp : 0, thisConfig.screenHeightDp, config ? config->screenHeightDp : 0)); // Check to make sure this one is valid for the current parameters. if (config && !thisConfig.match(*config)) { TABLE_GETENTRY(ALOGI("Does not match config!\n")); continue; } // Check if there is the desired entry in this type. const uint8_t* const end = ((const uint8_t*)thisType) + dtohl(thisType->header.size); const uint32_t* const eindex = (const uint32_t*) (((const uint8_t*)thisType) + dtohs(thisType->header.headerSize)); uint32_t thisOffset = dtohl(eindex[entryIndex]); if (thisOffset == ResTable_type::NO_ENTRY) { TABLE_GETENTRY(ALOGI("Skipping because it is not defined!\n")); continue; } if (type != NULL) { // Check if this one is less specific than the last found. If so, // we will skip it. We check starting with things we most care // about to those we least care about. if (!thisConfig.isBetterThan(bestConfig, config)) { TABLE_GETENTRY(ALOGI("This config is worse than last!\n")); continue; } } type = thisType; offset = thisOffset; bestConfig = thisConfig; TABLE_GETENTRY(ALOGI("Best entry so far -- using it!\n")); if (!config) break; } if (type == NULL) { TABLE_GETENTRY(ALOGI("No value found for requested entry!\n")); return BAD_INDEX; } offset += dtohl(type->entriesStart); TABLE_NOISY(aout << "Looking in resource table " << package->header->header << ", typeOff=" << (void*)(((const char*)type)-((const char*)package->header->header)) << ", offset=" << (void*)offset << endl); if (offset > (dtohl(type->header.size)-sizeof(ResTable_entry))) { ALOGW("ResTable_entry at 0x%x is beyond type chunk data 0x%x", offset, dtohl(type->header.size)); return BAD_TYPE; } if ((offset&0x3) != 0) { ALOGW("ResTable_entry at 0x%x is not on an integer boundary", offset); return BAD_TYPE; } const ResTable_entry* const entry = (const ResTable_entry*) (((const uint8_t*)type) + offset); if (dtohs(entry->size) < sizeof(*entry)) { ALOGW("ResTable_entry size 0x%x is too small", dtohs(entry->size)); return BAD_TYPE; } *outType = type; *outEntry = entry; if (outTypeClass != NULL) { *outTypeClass = allTypes; } return offset + dtohs(entry->size); } status_t ResTable::parsePackage(const ResTable_package* const pkg, const Header* const header, uint32_t idmap_id) { const uint8_t* base = (const uint8_t*)pkg; status_t err = validate_chunk(&pkg->header, sizeof(*pkg), header->dataEnd, "ResTable_package"); if (err != NO_ERROR) { return (mError=err); } const size_t pkgSize = dtohl(pkg->header.size); if (dtohl(pkg->typeStrings) >= pkgSize) { ALOGW("ResTable_package type strings at %p are past chunk size %p.", (void*)dtohl(pkg->typeStrings), (void*)pkgSize); return (mError=BAD_TYPE); } if ((dtohl(pkg->typeStrings)&0x3) != 0) { ALOGW("ResTable_package type strings at %p is not on an integer boundary.", (void*)dtohl(pkg->typeStrings)); return (mError=BAD_TYPE); } if (dtohl(pkg->keyStrings) >= pkgSize) { ALOGW("ResTable_package key strings at %p are past chunk size %p.", (void*)dtohl(pkg->keyStrings), (void*)pkgSize); return (mError=BAD_TYPE); } if ((dtohl(pkg->keyStrings)&0x3) != 0) { ALOGW("ResTable_package key strings at %p is not on an integer boundary.", (void*)dtohl(pkg->keyStrings)); return (mError=BAD_TYPE); } Package* package = NULL; PackageGroup* group = NULL; uint32_t id = idmap_id != 0 ? idmap_id : dtohl(pkg->id); // If at this point id == 0, pkg is an overlay package without a // corresponding idmap. During regular usage, overlay packages are // always loaded alongside their idmaps, but during idmap creation // the package is temporarily loaded by itself. if (id < 256) { package = new Package(this, header, pkg); if (package == NULL) { return (mError=NO_MEMORY); } size_t idx = mPackageMap[id]; if (idx == 0) { idx = mPackageGroups.size()+1; char16_t tmpName[sizeof(pkg->name)/sizeof(char16_t)]; strcpy16_dtoh(tmpName, pkg->name, sizeof(pkg->name)/sizeof(char16_t)); group = new PackageGroup(this, String16(tmpName), id); if (group == NULL) { delete package; return (mError=NO_MEMORY); } err = package->typeStrings.setTo(base+dtohl(pkg->typeStrings), header->dataEnd-(base+dtohl(pkg->typeStrings))); if (err != NO_ERROR) { delete group; delete package; return (mError=err); } err = package->keyStrings.setTo(base+dtohl(pkg->keyStrings), header->dataEnd-(base+dtohl(pkg->keyStrings))); if (err != NO_ERROR) { delete group; delete package; return (mError=err); } //printf("Adding new package id %d at index %d\n", id, idx); err = mPackageGroups.add(group); if (err < NO_ERROR) { return (mError=err); } group->basePackage = package; mPackageMap[id] = (uint8_t)idx; } else { group = mPackageGroups.itemAt(idx-1); if (group == NULL) { return (mError=UNKNOWN_ERROR); } } err = group->packages.add(package); if (err < NO_ERROR) { return (mError=err); } } else { LOG_ALWAYS_FATAL("Package id out of range"); return NO_ERROR; } // Iterate through all chunks. size_t curPackage = 0; const ResChunk_header* chunk = (const ResChunk_header*)(((const uint8_t*)pkg) + dtohs(pkg->header.headerSize)); const uint8_t* endPos = ((const uint8_t*)pkg) + dtohs(pkg->header.size); while (((const uint8_t*)chunk) <= (endPos-sizeof(ResChunk_header)) && ((const uint8_t*)chunk) <= (endPos-dtohl(chunk->size))) { TABLE_NOISY(ALOGV("PackageChunk: type=0x%x, headerSize=0x%x, size=0x%x, pos=%p\n", dtohs(chunk->type), dtohs(chunk->headerSize), dtohl(chunk->size), (void*)(((const uint8_t*)chunk) - ((const uint8_t*)header->header)))); const size_t csize = dtohl(chunk->size); const uint16_t ctype = dtohs(chunk->type); if (ctype == RES_TABLE_TYPE_SPEC_TYPE) { const ResTable_typeSpec* typeSpec = (const ResTable_typeSpec*)(chunk); err = validate_chunk(&typeSpec->header, sizeof(*typeSpec), endPos, "ResTable_typeSpec"); if (err != NO_ERROR) { return (mError=err); } const size_t typeSpecSize = dtohl(typeSpec->header.size); LOAD_TABLE_NOISY(printf("TypeSpec off %p: type=0x%x, headerSize=0x%x, size=%p\n", (void*)(base-(const uint8_t*)chunk), dtohs(typeSpec->header.type), dtohs(typeSpec->header.headerSize), (void*)typeSize)); // look for block overrun or int overflow when multiplying by 4 if ((dtohl(typeSpec->entryCount) > (INT32_MAX/sizeof(uint32_t)) || dtohs(typeSpec->header.headerSize)+(sizeof(uint32_t)*dtohl(typeSpec->entryCount)) > typeSpecSize)) { ALOGW("ResTable_typeSpec entry index to %p extends beyond chunk end %p.", (void*)(dtohs(typeSpec->header.headerSize) +(sizeof(uint32_t)*dtohl(typeSpec->entryCount))), (void*)typeSpecSize); return (mError=BAD_TYPE); } if (typeSpec->id == 0) { ALOGW("ResTable_type has an id of 0."); return (mError=BAD_TYPE); } while (package->types.size() < typeSpec->id) { package->types.add(NULL); } Type* t = package->types[typeSpec->id-1]; if (t == NULL) { t = new Type(header, package, dtohl(typeSpec->entryCount)); package->types.editItemAt(typeSpec->id-1) = t; } else if (dtohl(typeSpec->entryCount) != t->entryCount) { ALOGW("ResTable_typeSpec entry count inconsistent: given %d, previously %d", (int)dtohl(typeSpec->entryCount), (int)t->entryCount); return (mError=BAD_TYPE); } t->typeSpecFlags = (const uint32_t*)( ((const uint8_t*)typeSpec) + dtohs(typeSpec->header.headerSize)); t->typeSpec = typeSpec; } else if (ctype == RES_TABLE_TYPE_TYPE) { const ResTable_type* type = (const ResTable_type*)(chunk); err = validate_chunk(&type->header, sizeof(*type)-sizeof(ResTable_config)+4, endPos, "ResTable_type"); if (err != NO_ERROR) { return (mError=err); } const size_t typeSize = dtohl(type->header.size); LOAD_TABLE_NOISY(printf("Type off %p: type=0x%x, headerSize=0x%x, size=%p\n", (void*)(base-(const uint8_t*)chunk), dtohs(type->header.type), dtohs(type->header.headerSize), (void*)typeSize)); if (dtohs(type->header.headerSize)+(sizeof(uint32_t)*dtohl(type->entryCount)) > typeSize) { ALOGW("ResTable_type entry index to %p extends beyond chunk end %p.", (void*)(dtohs(type->header.headerSize) +(sizeof(uint32_t)*dtohl(type->entryCount))), (void*)typeSize); return (mError=BAD_TYPE); } if (dtohl(type->entryCount) != 0 && dtohl(type->entriesStart) > (typeSize-sizeof(ResTable_entry))) { ALOGW("ResTable_type entriesStart at %p extends beyond chunk end %p.", (void*)dtohl(type->entriesStart), (void*)typeSize); return (mError=BAD_TYPE); } if (type->id == 0) { ALOGW("ResTable_type has an id of 0."); return (mError=BAD_TYPE); } while (package->types.size() < type->id) { package->types.add(NULL); } Type* t = package->types[type->id-1]; if (t == NULL) { t = new Type(header, package, dtohl(type->entryCount)); package->types.editItemAt(type->id-1) = t; } else if (dtohl(type->entryCount) != t->entryCount) { ALOGW("ResTable_type entry count inconsistent: given %d, previously %d", (int)dtohl(type->entryCount), (int)t->entryCount); return (mError=BAD_TYPE); } TABLE_GETENTRY( ResTable_config thisConfig; thisConfig.copyFromDtoH(type->config); ALOGI("Adding config to type %d: imsi:%d/%d lang:%c%c cnt:%c%c " "orien:%d touch:%d density:%d key:%d inp:%d nav:%d w:%d h:%d " "swdp:%d wdp:%d hdp:%d\n", type->id, thisConfig.mcc, thisConfig.mnc, thisConfig.language[0] ? thisConfig.language[0] : '-', thisConfig.language[1] ? thisConfig.language[1] : '-', thisConfig.country[0] ? thisConfig.country[0] : '-', thisConfig.country[1] ? thisConfig.country[1] : '-', thisConfig.orientation, thisConfig.touchscreen, thisConfig.density, thisConfig.keyboard, thisConfig.inputFlags, thisConfig.navigation, thisConfig.screenWidth, thisConfig.screenHeight, thisConfig.smallestScreenWidthDp, thisConfig.screenWidthDp, thisConfig.screenHeightDp)); t->configs.add(type); } else { status_t err = validate_chunk(chunk, sizeof(ResChunk_header), endPos, "ResTable_package:unknown"); if (err != NO_ERROR) { return (mError=err); } } chunk = (const ResChunk_header*) (((const uint8_t*)chunk) + csize); } if (group->typeCount == 0) { group->typeCount = package->types.size(); } return NO_ERROR; } status_t ResTable::createIdmap(const ResTable& overlay, uint32_t originalCrc, uint32_t overlayCrc, void** outData, size_t* outSize) const { // see README for details on the format of map if (mPackageGroups.size() == 0) { return UNKNOWN_ERROR; } if (mPackageGroups[0]->packages.size() == 0) { return UNKNOWN_ERROR; } Vector > map; const PackageGroup* pg = mPackageGroups[0]; const Package* pkg = pg->packages[0]; size_t typeCount = pkg->types.size(); // starting size is header + first item (number of types in map) *outSize = (IDMAP_HEADER_SIZE + 1) * sizeof(uint32_t); const String16 overlayPackage(overlay.mPackageGroups[0]->packages[0]->package->name); const uint32_t pkg_id = pkg->package->id << 24; for (size_t typeIndex = 0; typeIndex < typeCount; ++typeIndex) { ssize_t offset = -1; const Type* typeConfigs = pkg->getType(typeIndex); ssize_t mapIndex = map.add(); if (mapIndex < 0) { return NO_MEMORY; } Vector& vector = map.editItemAt(mapIndex); for (size_t entryIndex = 0; entryIndex < typeConfigs->entryCount; ++entryIndex) { uint32_t resID = (0xff000000 & ((pkg->package->id)<<24)) | (0x00ff0000 & ((typeIndex+1)<<16)) | (0x0000ffff & (entryIndex)); resource_name resName; if (!this->getResourceName(resID, &resName)) { ALOGW("idmap: resource 0x%08x has spec but lacks values, skipping\n", resID); continue; } const String16 overlayType(resName.type, resName.typeLen); const String16 overlayName(resName.name, resName.nameLen); uint32_t overlayResID = overlay.identifierForName(overlayName.string(), overlayName.size(), overlayType.string(), overlayType.size(), overlayPackage.string(), overlayPackage.size()); if (overlayResID != 0) { // overlay package has package ID == 0, use original package's ID instead overlayResID |= pkg_id; } vector.push(overlayResID); if (overlayResID != 0 && offset == -1) { offset = Res_GETENTRY(resID); } #if 0 if (overlayResID != 0) { ALOGD("%s/%s 0x%08x -> 0x%08x\n", String8(String16(resName.type)).string(), String8(String16(resName.name)).string(), resID, overlayResID); } #endif } if (offset != -1) { // shave off leading and trailing entries which lack overlay values vector.removeItemsAt(0, offset); vector.insertAt((uint32_t)offset, 0, 1); while (vector.top() == 0) { vector.pop(); } // reserve space for number and offset of entries, and the actual entries *outSize += (2 + vector.size()) * sizeof(uint32_t); } else { // no entries of current type defined in overlay package vector.clear(); // reserve space for type offset *outSize += 1 * sizeof(uint32_t); } } if ((*outData = malloc(*outSize)) == NULL) { return NO_MEMORY; } uint32_t* data = (uint32_t*)*outData; *data++ = htodl(IDMAP_MAGIC); *data++ = htodl(originalCrc); *data++ = htodl(overlayCrc); const size_t mapSize = map.size(); *data++ = htodl(mapSize); size_t offset = mapSize; for (size_t i = 0; i < mapSize; ++i) { const Vector& vector = map.itemAt(i); const size_t N = vector.size(); if (N == 0) { *data++ = htodl(0); } else { offset++; *data++ = htodl(offset); offset += N; } } for (size_t i = 0; i < mapSize; ++i) { const Vector& vector = map.itemAt(i); const size_t N = vector.size(); if (N == 0) { continue; } *data++ = htodl(N - 1); // do not count the offset (which is vector's first element) for (size_t j = 0; j < N; ++j) { const uint32_t& overlayResID = vector.itemAt(j); *data++ = htodl(overlayResID); } } return NO_ERROR; } bool ResTable::getIdmapInfo(const void* idmap, size_t sizeBytes, uint32_t* pOriginalCrc, uint32_t* pOverlayCrc) { const uint32_t* map = (const uint32_t*)idmap; if (!assertIdmapHeader(map, sizeBytes)) { return false; } *pOriginalCrc = map[1]; *pOverlayCrc = map[2]; return true; } #ifndef HAVE_ANDROID_OS #define CHAR16_TO_CSTR(c16, len) (String8(String16(c16,len)).string()) #define CHAR16_ARRAY_EQ(constant, var, len) \ ((len == (sizeof(constant)/sizeof(constant[0]))) && (0 == memcmp((var), (constant), (len)))) void print_complex(uint32_t complex, bool isFraction) { const float MANTISSA_MULT = 1.0f / (1<>Res_value::COMPLEX_RADIX_SHIFT) & Res_value::COMPLEX_RADIX_MASK]; printf("%f", value); if (!isFraction) { switch ((complex>>Res_value::COMPLEX_UNIT_SHIFT)&Res_value::COMPLEX_UNIT_MASK) { case Res_value::COMPLEX_UNIT_PX: printf("px"); break; case Res_value::COMPLEX_UNIT_DIP: printf("dp"); break; case Res_value::COMPLEX_UNIT_SP: printf("sp"); break; case Res_value::COMPLEX_UNIT_PT: printf("pt"); break; case Res_value::COMPLEX_UNIT_IN: printf("in"); break; case Res_value::COMPLEX_UNIT_MM: printf("mm"); break; default: printf(" (unknown unit)"); break; } } else { switch ((complex>>Res_value::COMPLEX_UNIT_SHIFT)&Res_value::COMPLEX_UNIT_MASK) { case Res_value::COMPLEX_UNIT_FRACTION: printf("%%"); break; case Res_value::COMPLEX_UNIT_FRACTION_PARENT: printf("%%p"); break; default: printf(" (unknown unit)"); break; } } } // Normalize a string for output String8 ResTable::normalizeForOutput( const char *input ) { String8 ret; char buff[2]; buff[1] = '\0'; while (*input != '\0') { switch (*input) { // All interesting characters are in the ASCII zone, so we are making our own lives // easier by scanning the string one byte at a time. case '\\': ret += "\\\\"; break; case '\n': ret += "\\n"; break; case '"': ret += "\\\""; break; default: buff[0] = *input; ret += buff; break; } input++; } return ret; } void ResTable::print_value(const Package* pkg, const Res_value& value) const { if (value.dataType == Res_value::TYPE_NULL) { printf("(null)\n"); } else if (value.dataType == Res_value::TYPE_REFERENCE) { printf("(reference) 0x%08x\n", value.data); } else if (value.dataType == Res_value::TYPE_ATTRIBUTE) { printf("(attribute) 0x%08x\n", value.data); } else if (value.dataType == Res_value::TYPE_STRING) { size_t len; const char* str8 = pkg->header->values.string8At( value.data, &len); if (str8 != NULL) { printf("(string8) \"%s\"\n", normalizeForOutput(str8).string()); } else { const char16_t* str16 = pkg->header->values.stringAt( value.data, &len); if (str16 != NULL) { printf("(string16) \"%s\"\n", normalizeForOutput(String8(str16, len).string()).string()); } else { printf("(string) null\n"); } } } else if (value.dataType == Res_value::TYPE_FLOAT) { printf("(float) %g\n", *(const float*)&value.data); } else if (value.dataType == Res_value::TYPE_DIMENSION) { printf("(dimension) "); print_complex(value.data, false); printf("\n"); } else if (value.dataType == Res_value::TYPE_FRACTION) { printf("(fraction) "); print_complex(value.data, true); printf("\n"); } else if (value.dataType >= Res_value::TYPE_FIRST_COLOR_INT || value.dataType <= Res_value::TYPE_LAST_COLOR_INT) { printf("(color) #%08x\n", value.data); } else if (value.dataType == Res_value::TYPE_INT_BOOLEAN) { printf("(boolean) %s\n", value.data ? "true" : "false"); } else if (value.dataType >= Res_value::TYPE_FIRST_INT || value.dataType <= Res_value::TYPE_LAST_INT) { printf("(int) 0x%08x or %d\n", value.data, value.data); } else { printf("(unknown type) t=0x%02x d=0x%08x (s=0x%04x r=0x%02x)\n", (int)value.dataType, (int)value.data, (int)value.size, (int)value.res0); } } void ResTable::print(bool inclValues) const { if (mError != 0) { printf("mError=0x%x (%s)\n", mError, strerror(mError)); } #if 0 printf("mParams=%c%c-%c%c,\n", mParams.language[0], mParams.language[1], mParams.country[0], mParams.country[1]); #endif size_t pgCount = mPackageGroups.size(); printf("Package Groups (%d)\n", (int)pgCount); for (size_t pgIndex=0; pgIndexid, (int)pg->packages.size(), String8(pg->name).string()); size_t pkgCount = pg->packages.size(); for (size_t pkgIndex=0; pkgIndexpackages[pkgIndex]; size_t typeCount = pkg->types.size(); printf(" Package %d id=%d name=%s typeCount=%d\n", (int)pkgIndex, pkg->package->id, String8(String16(pkg->package->name)).string(), (int)typeCount); for (size_t typeIndex=0; typeIndexgetType(typeIndex); if (typeConfigs == NULL) { printf(" type %d NULL\n", (int)typeIndex); continue; } const size_t NTC = typeConfigs->configs.size(); printf(" type %d configCount=%d entryCount=%d\n", (int)typeIndex, (int)NTC, (int)typeConfigs->entryCount); if (typeConfigs->typeSpecFlags != NULL) { for (size_t entryIndex=0; entryIndexentryCount; entryIndex++) { uint32_t resID = (0xff000000 & ((pkg->package->id)<<24)) | (0x00ff0000 & ((typeIndex+1)<<16)) | (0x0000ffff & (entryIndex)); resource_name resName; if (this->getResourceName(resID, &resName)) { printf(" spec resource 0x%08x %s:%s/%s: flags=0x%08x\n", resID, CHAR16_TO_CSTR(resName.package, resName.packageLen), CHAR16_TO_CSTR(resName.type, resName.typeLen), CHAR16_TO_CSTR(resName.name, resName.nameLen), dtohl(typeConfigs->typeSpecFlags[entryIndex])); } else { printf(" INVALID TYPE CONFIG FOR RESOURCE 0x%08x\n", resID); } } } for (size_t configIndex=0; configIndexconfigs[configIndex]; if ((((uint64_t)type)&0x3) != 0) { printf(" NON-INTEGER ResTable_type ADDRESS: %p\n", type); continue; } char density[16]; uint16_t dval = dtohs(type->config.density); if (dval == ResTable_config::DENSITY_DEFAULT) { strcpy(density, "def"); } else if (dval == ResTable_config::DENSITY_NONE) { strcpy(density, "no"); } else { sprintf(density, "%d", (int)dval); } printf(" config %d", (int)configIndex); if (type->config.mcc != 0) { printf(" mcc=%d", dtohs(type->config.mcc)); } if (type->config.mnc != 0) { printf(" mnc=%d", dtohs(type->config.mnc)); } if (type->config.locale != 0) { printf(" lang=%c%c cnt=%c%c", type->config.language[0] ? type->config.language[0] : '-', type->config.language[1] ? type->config.language[1] : '-', type->config.country[0] ? type->config.country[0] : '-', type->config.country[1] ? type->config.country[1] : '-'); } if (type->config.screenLayout != 0) { printf(" sz=%d", type->config.screenLayout&ResTable_config::MASK_SCREENSIZE); switch (type->config.screenLayout&ResTable_config::MASK_SCREENSIZE) { case ResTable_config::SCREENSIZE_SMALL: printf(" (small)"); break; case ResTable_config::SCREENSIZE_NORMAL: printf(" (normal)"); break; case ResTable_config::SCREENSIZE_LARGE: printf(" (large)"); break; case ResTable_config::SCREENSIZE_XLARGE: printf(" (xlarge)"); break; } printf(" lng=%d", type->config.screenLayout&ResTable_config::MASK_SCREENLONG); switch (type->config.screenLayout&ResTable_config::MASK_SCREENLONG) { case ResTable_config::SCREENLONG_NO: printf(" (notlong)"); break; case ResTable_config::SCREENLONG_YES: printf(" (long)"); break; } } if (type->config.orientation != 0) { printf(" orient=%d", type->config.orientation); switch (type->config.orientation) { case ResTable_config::ORIENTATION_PORT: printf(" (port)"); break; case ResTable_config::ORIENTATION_LAND: printf(" (land)"); break; case ResTable_config::ORIENTATION_SQUARE: printf(" (square)"); break; } } if (type->config.uiMode != 0) { printf(" type=%d", type->config.uiMode&ResTable_config::MASK_UI_MODE_TYPE); switch (type->config.uiMode&ResTable_config::MASK_UI_MODE_TYPE) { case ResTable_config::UI_MODE_TYPE_NORMAL: printf(" (normal)"); break; case ResTable_config::UI_MODE_TYPE_CAR: printf(" (car)"); break; } printf(" night=%d", type->config.uiMode&ResTable_config::MASK_UI_MODE_NIGHT); switch (type->config.uiMode&ResTable_config::MASK_UI_MODE_NIGHT) { case ResTable_config::UI_MODE_NIGHT_NO: printf(" (no)"); break; case ResTable_config::UI_MODE_NIGHT_YES: printf(" (yes)"); break; } } if (dval != 0) { printf(" density=%s", density); } if (type->config.touchscreen != 0) { printf(" touch=%d", type->config.touchscreen); switch (type->config.touchscreen) { case ResTable_config::TOUCHSCREEN_NOTOUCH: printf(" (notouch)"); break; case ResTable_config::TOUCHSCREEN_STYLUS: printf(" (stylus)"); break; case ResTable_config::TOUCHSCREEN_FINGER: printf(" (finger)"); break; } } if (type->config.inputFlags != 0) { printf(" keyhid=%d", type->config.inputFlags&ResTable_config::MASK_KEYSHIDDEN); switch (type->config.inputFlags&ResTable_config::MASK_KEYSHIDDEN) { case ResTable_config::KEYSHIDDEN_NO: printf(" (no)"); break; case ResTable_config::KEYSHIDDEN_YES: printf(" (yes)"); break; case ResTable_config::KEYSHIDDEN_SOFT: printf(" (soft)"); break; } printf(" navhid=%d", type->config.inputFlags&ResTable_config::MASK_NAVHIDDEN); switch (type->config.inputFlags&ResTable_config::MASK_NAVHIDDEN) { case ResTable_config::NAVHIDDEN_NO: printf(" (no)"); break; case ResTable_config::NAVHIDDEN_YES: printf(" (yes)"); break; } } if (type->config.keyboard != 0) { printf(" kbd=%d", type->config.keyboard); switch (type->config.keyboard) { case ResTable_config::KEYBOARD_NOKEYS: printf(" (nokeys)"); break; case ResTable_config::KEYBOARD_QWERTY: printf(" (qwerty)"); break; case ResTable_config::KEYBOARD_12KEY: printf(" (12key)"); break; } } if (type->config.navigation != 0) { printf(" nav=%d", type->config.navigation); switch (type->config.navigation) { case ResTable_config::NAVIGATION_NONAV: printf(" (nonav)"); break; case ResTable_config::NAVIGATION_DPAD: printf(" (dpad)"); break; case ResTable_config::NAVIGATION_TRACKBALL: printf(" (trackball)"); break; case ResTable_config::NAVIGATION_WHEEL: printf(" (wheel)"); break; } } if (type->config.screenWidth != 0) { printf(" w=%d", dtohs(type->config.screenWidth)); } if (type->config.screenHeight != 0) { printf(" h=%d", dtohs(type->config.screenHeight)); } if (type->config.smallestScreenWidthDp != 0) { printf(" swdp=%d", dtohs(type->config.smallestScreenWidthDp)); } if (type->config.screenWidthDp != 0) { printf(" wdp=%d", dtohs(type->config.screenWidthDp)); } if (type->config.screenHeightDp != 0) { printf(" hdp=%d", dtohs(type->config.screenHeightDp)); } if (type->config.sdkVersion != 0) { printf(" sdk=%d", dtohs(type->config.sdkVersion)); } if (type->config.minorVersion != 0) { printf(" mver=%d", dtohs(type->config.minorVersion)); } printf("\n"); size_t entryCount = dtohl(type->entryCount); uint32_t entriesStart = dtohl(type->entriesStart); if ((entriesStart&0x3) != 0) { printf(" NON-INTEGER ResTable_type entriesStart OFFSET: %p\n", (void*)entriesStart); continue; } uint32_t typeSize = dtohl(type->header.size); if ((typeSize&0x3) != 0) { printf(" NON-INTEGER ResTable_type header.size: %p\n", (void*)typeSize); continue; } for (size_t entryIndex=0; entryIndexheader.size); const uint32_t* const eindex = (const uint32_t*) (((const uint8_t*)type) + dtohs(type->header.headerSize)); uint32_t thisOffset = dtohl(eindex[entryIndex]); if (thisOffset == ResTable_type::NO_ENTRY) { continue; } uint32_t resID = (0xff000000 & ((pkg->package->id)<<24)) | (0x00ff0000 & ((typeIndex+1)<<16)) | (0x0000ffff & (entryIndex)); resource_name resName; if (this->getResourceName(resID, &resName)) { printf(" resource 0x%08x %s:%s/%s: ", resID, CHAR16_TO_CSTR(resName.package, resName.packageLen), CHAR16_TO_CSTR(resName.type, resName.typeLen), CHAR16_TO_CSTR(resName.name, resName.nameLen)); } else { printf(" INVALID RESOURCE 0x%08x: ", resID); } if ((thisOffset&0x3) != 0) { printf("NON-INTEGER OFFSET: %p\n", (void*)thisOffset); continue; } if ((thisOffset+sizeof(ResTable_entry)) > typeSize) { printf("OFFSET OUT OF BOUNDS: %p+%p (size is %p)\n", (void*)entriesStart, (void*)thisOffset, (void*)typeSize); continue; } const ResTable_entry* ent = (const ResTable_entry*) (((const uint8_t*)type) + entriesStart + thisOffset); if (((entriesStart + thisOffset)&0x3) != 0) { printf("NON-INTEGER ResTable_entry OFFSET: %p\n", (void*)(entriesStart + thisOffset)); continue; } uint16_t esize = dtohs(ent->size); if ((esize&0x3) != 0) { printf("NON-INTEGER ResTable_entry SIZE: %p\n", (void*)esize); continue; } if ((thisOffset+esize) > typeSize) { printf("ResTable_entry OUT OF BOUNDS: %p+%p+%p (size is %p)\n", (void*)entriesStart, (void*)thisOffset, (void*)esize, (void*)typeSize); continue; } const Res_value* valuePtr = NULL; const ResTable_map_entry* bagPtr = NULL; Res_value value; if ((dtohs(ent->flags)&ResTable_entry::FLAG_COMPLEX) != 0) { printf(""); bagPtr = (const ResTable_map_entry*)ent; } else { valuePtr = (const Res_value*) (((const uint8_t*)ent) + esize); value.copyFrom_dtoh(*valuePtr); printf("t=0x%02x d=0x%08x (s=0x%04x r=0x%02x)", (int)value.dataType, (int)value.data, (int)value.size, (int)value.res0); } if ((dtohs(ent->flags)&ResTable_entry::FLAG_PUBLIC) != 0) { printf(" (PUBLIC)"); } printf("\n"); if (inclValues) { if (valuePtr != NULL) { printf(" "); print_value(pkg, value); } else if (bagPtr != NULL) { const int N = dtohl(bagPtr->count); const uint8_t* baseMapPtr = (const uint8_t*)ent; size_t mapOffset = esize; const ResTable_map* mapPtr = (ResTable_map*)(baseMapPtr+mapOffset); printf(" Parent=0x%08x, Count=%d\n", dtohl(bagPtr->parent.ident), N); for (int i=0; iname.ident)); value.copyFrom_dtoh(mapPtr->value); print_value(pkg, value); const size_t size = dtohs(mapPtr->value.size); mapOffset += size + sizeof(*mapPtr)-sizeof(mapPtr->value); mapPtr = (ResTable_map*)(baseMapPtr+mapOffset); } } } } } } } } } #endif // HAVE_ANDROID_OS } // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/Debug.cpp0000644000015700001700000002075612200324306023344 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include namespace android { // --------------------------------------------------------------------- static const char indentStr[] = " " " "; const char* stringForIndent(int32_t indentLevel) { ssize_t off = sizeof(indentStr)-1-(indentLevel*2); return indentStr + (off < 0 ? 0 : off); } // --------------------------------------------------------------------- static void defaultPrintFunc(void* cookie, const char* txt) { printf("%s", txt); } // --------------------------------------------------------------------- static inline int isident(int c) { return isalnum(c) || c == '_'; } static inline bool isasciitype(char c) { if( c >= ' ' && c < 127 && c != '\'' && c != '\\' ) return true; return false; } static inline char makehexdigit(uint32_t val) { return "0123456789abcdef"[val&0xF]; } static char* appendhexnum(uint32_t val, char* out) { for( int32_t i=28; i>=0; i-=4 ) { *out++ = makehexdigit( val>>i ); } *out = 0; return out; } static inline char makeupperhexdigit(uint32_t val) { return "0123456789ABCDEF"[val&0xF]; } static char* appendupperhexnum(uint32_t val, char* out) { for( int32_t i=28; i>=0; i-=4 ) { *out++ = makeupperhexdigit( val>>i ); } *out = 0; return out; } static char* appendcharornum(char c, char* out, bool skipzero = true) { if (skipzero && c == 0) return out; if (isasciitype(c)) { *out++ = c; return out; } *out++ = '\\'; *out++ = 'x'; *out++ = makehexdigit(c>>4); *out++ = makehexdigit(c); return out; } static char* typetostring(uint32_t type, char* out, bool fullContext = true, bool strict = false) { char* pos = out; char c[4]; c[0] = (char)((type>>24)&0xFF); c[1] = (char)((type>>16)&0xFF); c[2] = (char)((type>>8)&0xFF); c[3] = (char)(type&0xFF); bool valid; if( !strict ) { // now even less strict! // valid = isasciitype(c[3]); valid = true; int32_t i = 0; bool zero = true; while (valid && i<3) { if (c[i] == 0) { if (!zero) valid = false; } else { zero = false; //if (!isasciitype(c[i])) valid = false; } i++; } // if all zeros, not a valid type code. if (zero) valid = false; } else { valid = isident(c[3]) ? true : false; int32_t i = 0; bool zero = true; while (valid && i<3) { if (c[i] == 0) { if (!zero) valid = false; } else { zero = false; if (!isident(c[i])) valid = false; } i++; } } if( valid && (!fullContext || c[0] != '0' || c[1] != 'x') ) { if( fullContext ) *pos++ = '\''; pos = appendcharornum(c[0], pos); pos = appendcharornum(c[1], pos); pos = appendcharornum(c[2], pos); pos = appendcharornum(c[3], pos); if( fullContext ) *pos++ = '\''; *pos = 0; return pos; } if( fullContext ) { *pos++ = '0'; *pos++ = 'x'; } return appendhexnum(type, pos); } void printTypeCode(uint32_t typeCode, debugPrintFunc func, void* cookie) { char buffer[32]; char* end = typetostring(typeCode, buffer); *end = 0; func ? (*func)(cookie, buffer) : defaultPrintFunc(cookie, buffer); } void printHexData(int32_t indent, const void *buf, size_t length, size_t bytesPerLine, int32_t singleLineBytesCutoff, size_t alignment, bool cStyle, debugPrintFunc func, void* cookie) { if (alignment == 0) { if (bytesPerLine >= 16) alignment = 4; else if (bytesPerLine >= 8) alignment = 2; else alignment = 1; } if (func == NULL) func = defaultPrintFunc; size_t offset; unsigned char *pos = (unsigned char *)buf; if (pos == NULL) { if (singleLineBytesCutoff < 0) func(cookie, "\n"); func(cookie, "(NULL)"); return; } if (length == 0) { if (singleLineBytesCutoff < 0) func(cookie, "\n"); func(cookie, "(empty)"); return; } if ((int32_t)length < 0) { if (singleLineBytesCutoff < 0) func(cookie, "\n"); char buf[64]; sprintf(buf, "(bad length: %d)", length); func(cookie, buf); return; } char buffer[256]; static const size_t maxBytesPerLine = (sizeof(buffer)-1-11-4)/(3+1); if (bytesPerLine > maxBytesPerLine) bytesPerLine = maxBytesPerLine; const bool oneLine = (int32_t)length <= singleLineBytesCutoff; bool newLine = false; if (cStyle) { indent++; func(cookie, "{\n"); newLine = true; } else if (!oneLine) { func(cookie, "\n"); newLine = true; } for (offset = 0; ; offset += bytesPerLine, pos += bytesPerLine) { long remain = length; char* c = buffer; if (!oneLine && !cStyle) { sprintf(c, "0x%08x: ", (int)offset); c += 12; } size_t index; size_t word; for (word = 0; word < bytesPerLine; ) { #ifdef HAVE_LITTLE_ENDIAN const size_t startIndex = word+(alignment-(alignment?1:0)); const ssize_t dir = -1; #else const size_t startIndex = word; const ssize_t dir = 1; #endif for (index = 0; index < alignment || (alignment == 0 && index < bytesPerLine); index++) { if (!cStyle) { if (index == 0 && word > 0 && alignment > 0) { *c++ = ' '; } if (remain-- > 0) { const unsigned char val = *(pos+startIndex+(index*dir)); *c++ = makehexdigit(val>>4); *c++ = makehexdigit(val); } else if (!oneLine) { *c++ = ' '; *c++ = ' '; } } else { if (remain > 0) { if (index == 0 && word > 0) { *c++ = ','; *c++ = ' '; } if (index == 0) { *c++ = '0'; *c++ = 'x'; } const unsigned char val = *(pos+startIndex+(index*dir)); *c++ = makehexdigit(val>>4); *c++ = makehexdigit(val); remain--; } } } word += index; } if (!cStyle) { remain = length; *c++ = ' '; *c++ = '\''; for (index = 0; index < bytesPerLine; index++) { if (remain-- > 0) { const unsigned char val = pos[index]; *c++ = (val >= ' ' && val < 127) ? val : '.'; } else if (!oneLine) { *c++ = ' '; } } *c++ = '\''; if (length > bytesPerLine) *c++ = '\n'; } else { if (remain > 0) *c++ = ','; *c++ = '\n'; } if (newLine && indent) func(cookie, stringForIndent(indent)); *c = 0; func(cookie, buffer); newLine = true; if (length <= bytesPerLine) break; length -= bytesPerLine; } if (cStyle) { if (indent > 0) func(cookie, stringForIndent(indent-1)); func(cookie, "};"); } } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/String8.cpp0000644000015700001700000003344612200324306023654 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include #include #include #include #include /* * Functions outside android is below the namespace android, since they use * functions and constants in android namespace. */ // --------------------------------------------------------------------------- namespace android { // Separator used by resource paths. This is not platform dependent contrary // to OS_PATH_SEPARATOR. #define RES_PATH_SEPARATOR '/' static SharedBuffer* gEmptyStringBuf = NULL; static char* gEmptyString = NULL; extern int gDarwinCantLoadAllObjects; int gDarwinIsReallyAnnoying; static inline char* getEmptyString() { gEmptyStringBuf->acquire(); return gEmptyString; } void initialize_string8() { // HACK: This dummy dependency forces linking libutils Static.cpp, // which is needed to initialize String8/String16 classes. // These variables are named for Darwin, but are needed elsewhere too, // including static linking on any platform. gDarwinIsReallyAnnoying = gDarwinCantLoadAllObjects; SharedBuffer* buf = SharedBuffer::alloc(1); char* str = (char*)buf->data(); *str = 0; gEmptyStringBuf = buf; gEmptyString = str; } void terminate_string8() { SharedBuffer::bufferFromData(gEmptyString)->release(); gEmptyStringBuf = NULL; gEmptyString = NULL; } // --------------------------------------------------------------------------- static char* allocFromUTF8(const char* in, size_t len) { if (len > 0) { SharedBuffer* buf = SharedBuffer::alloc(len+1); ALOG_ASSERT(buf, "Unable to allocate shared buffer"); if (buf) { char* str = (char*)buf->data(); memcpy(str, in, len); str[len] = 0; return str; } return NULL; } return getEmptyString(); } static char* allocFromUTF16(const char16_t* in, size_t len) { if (len == 0) return getEmptyString(); const ssize_t bytes = utf16_to_utf8_length(in, len); if (bytes < 0) { return getEmptyString(); } SharedBuffer* buf = SharedBuffer::alloc(bytes+1); ALOG_ASSERT(buf, "Unable to allocate shared buffer"); if (!buf) { return getEmptyString(); } char* str = (char*)buf->data(); utf16_to_utf8(in, len, str); return str; } static char* allocFromUTF32(const char32_t* in, size_t len) { if (len == 0) { return getEmptyString(); } const ssize_t bytes = utf32_to_utf8_length(in, len); if (bytes < 0) { return getEmptyString(); } SharedBuffer* buf = SharedBuffer::alloc(bytes+1); ALOG_ASSERT(buf, "Unable to allocate shared buffer"); if (!buf) { return getEmptyString(); } char* str = (char*) buf->data(); utf32_to_utf8(in, len, str); return str; } // --------------------------------------------------------------------------- String8::String8() : mString(getEmptyString()) { } String8::String8(const String8& o) : mString(o.mString) { SharedBuffer::bufferFromData(mString)->acquire(); } String8::String8(const char* o) : mString(allocFromUTF8(o, strlen(o))) { if (mString == NULL) { mString = getEmptyString(); } } String8::String8(const char* o, size_t len) : mString(allocFromUTF8(o, len)) { if (mString == NULL) { mString = getEmptyString(); } } String8::String8(const String16& o) : mString(allocFromUTF16(o.string(), o.size())) { } String8::String8(const char16_t* o) : mString(allocFromUTF16(o, strlen16(o))) { } String8::String8(const char16_t* o, size_t len) : mString(allocFromUTF16(o, len)) { } String8::String8(const char32_t* o) : mString(allocFromUTF32(o, strlen32(o))) { } String8::String8(const char32_t* o, size_t len) : mString(allocFromUTF32(o, len)) { } String8::~String8() { SharedBuffer::bufferFromData(mString)->release(); } String8 String8::format(const char* fmt, ...) { va_list args; va_start(args, fmt); String8 result(formatV(fmt, args)); va_end(args); return result; } String8 String8::formatV(const char* fmt, va_list args) { String8 result; result.appendFormatV(fmt, args); return result; } void String8::clear() { SharedBuffer::bufferFromData(mString)->release(); mString = getEmptyString(); } void String8::setTo(const String8& other) { SharedBuffer::bufferFromData(other.mString)->acquire(); SharedBuffer::bufferFromData(mString)->release(); mString = other.mString; } status_t String8::setTo(const char* other) { const char *newString = allocFromUTF8(other, strlen(other)); SharedBuffer::bufferFromData(mString)->release(); mString = newString; if (mString) return NO_ERROR; mString = getEmptyString(); return NO_MEMORY; } status_t String8::setTo(const char* other, size_t len) { const char *newString = allocFromUTF8(other, len); SharedBuffer::bufferFromData(mString)->release(); mString = newString; if (mString) return NO_ERROR; mString = getEmptyString(); return NO_MEMORY; } status_t String8::setTo(const char16_t* other, size_t len) { const char *newString = allocFromUTF16(other, len); SharedBuffer::bufferFromData(mString)->release(); mString = newString; if (mString) return NO_ERROR; mString = getEmptyString(); return NO_MEMORY; } status_t String8::setTo(const char32_t* other, size_t len) { const char *newString = allocFromUTF32(other, len); SharedBuffer::bufferFromData(mString)->release(); mString = newString; if (mString) return NO_ERROR; mString = getEmptyString(); return NO_MEMORY; } status_t String8::append(const String8& other) { const size_t otherLen = other.bytes(); if (bytes() == 0) { setTo(other); return NO_ERROR; } else if (otherLen == 0) { return NO_ERROR; } return real_append(other.string(), otherLen); } status_t String8::append(const char* other) { return append(other, strlen(other)); } status_t String8::append(const char* other, size_t otherLen) { if (bytes() == 0) { return setTo(other, otherLen); } else if (otherLen == 0) { return NO_ERROR; } return real_append(other, otherLen); } status_t String8::appendFormat(const char* fmt, ...) { va_list args; va_start(args, fmt); status_t result = appendFormatV(fmt, args); va_end(args); return result; } status_t String8::appendFormatV(const char* fmt, va_list args) { int result = NO_ERROR; int n = vsnprintf(NULL, 0, fmt, args); if (n != 0) { size_t oldLength = length(); char* buf = lockBuffer(oldLength + n); if (buf) { vsnprintf(buf + oldLength, n + 1, fmt, args); } else { result = NO_MEMORY; } } return result; } status_t String8::real_append(const char* other, size_t otherLen) { const size_t myLen = bytes(); SharedBuffer* buf = SharedBuffer::bufferFromData(mString) ->editResize(myLen+otherLen+1); if (buf) { char* str = (char*)buf->data(); mString = str; str += myLen; memcpy(str, other, otherLen); str[otherLen] = '\0'; return NO_ERROR; } return NO_MEMORY; } char* String8::lockBuffer(size_t size) { SharedBuffer* buf = SharedBuffer::bufferFromData(mString) ->editResize(size+1); if (buf) { char* str = (char*)buf->data(); mString = str; return str; } return NULL; } void String8::unlockBuffer() { unlockBuffer(strlen(mString)); } status_t String8::unlockBuffer(size_t size) { if (size != this->size()) { SharedBuffer* buf = SharedBuffer::bufferFromData(mString) ->editResize(size+1); if (! buf) { return NO_MEMORY; } char* str = (char*)buf->data(); str[size] = 0; mString = str; } return NO_ERROR; } ssize_t String8::find(const char* other, size_t start) const { size_t len = size(); if (start >= len) { return -1; } const char* s = mString+start; const char* p = strstr(s, other); return p ? p-mString : -1; } void String8::toLower() { toLower(0, size()); } void String8::toLower(size_t start, size_t length) { const size_t len = size(); if (start >= len) { return; } if (start+length > len) { length = len-start; } char* buf = lockBuffer(len); buf += start; while (length > 0) { *buf = tolower(*buf); buf++; length--; } unlockBuffer(len); } void String8::toUpper() { toUpper(0, size()); } void String8::toUpper(size_t start, size_t length) { const size_t len = size(); if (start >= len) { return; } if (start+length > len) { length = len-start; } char* buf = lockBuffer(len); buf += start; while (length > 0) { *buf = toupper(*buf); buf++; length--; } unlockBuffer(len); } size_t String8::getUtf32Length() const { return utf8_to_utf32_length(mString, length()); } int32_t String8::getUtf32At(size_t index, size_t *next_index) const { return utf32_from_utf8_at(mString, length(), index, next_index); } void String8::getUtf32(char32_t* dst) const { utf8_to_utf32(mString, length(), dst); } TextOutput& operator<<(TextOutput& to, const String8& val) { to << val.string(); return to; } // --------------------------------------------------------------------------- // Path functions void String8::setPathName(const char* name) { setPathName(name, strlen(name)); } void String8::setPathName(const char* name, size_t len) { char* buf = lockBuffer(len); memcpy(buf, name, len); // remove trailing path separator, if present if (len > 0 && buf[len-1] == OS_PATH_SEPARATOR) len--; buf[len] = '\0'; unlockBuffer(len); } String8 String8::getPathLeaf(void) const { const char* cp; const char*const buf = mString; cp = strrchr(buf, OS_PATH_SEPARATOR); if (cp == NULL) return String8(*this); else return String8(cp+1); } String8 String8::getPathDir(void) const { const char* cp; const char*const str = mString; cp = strrchr(str, OS_PATH_SEPARATOR); if (cp == NULL) return String8(""); else return String8(str, cp - str); } String8 String8::walkPath(String8* outRemains) const { const char* cp; const char*const str = mString; const char* buf = str; cp = strchr(buf, OS_PATH_SEPARATOR); if (cp == buf) { // don't include a leading '/'. buf = buf+1; cp = strchr(buf, OS_PATH_SEPARATOR); } if (cp == NULL) { String8 res = buf != str ? String8(buf) : *this; if (outRemains) *outRemains = String8(""); return res; } String8 res(buf, cp-buf); if (outRemains) *outRemains = String8(cp+1); return res; } /* * Helper function for finding the start of an extension in a pathname. * * Returns a pointer inside mString, or NULL if no extension was found. */ char* String8::find_extension(void) const { const char* lastSlash; const char* lastDot; int extLen; const char* const str = mString; // only look at the filename lastSlash = strrchr(str, OS_PATH_SEPARATOR); if (lastSlash == NULL) lastSlash = str; else lastSlash++; // find the last dot lastDot = strrchr(lastSlash, '.'); if (lastDot == NULL) return NULL; // looks good, ship it return const_cast(lastDot); } String8 String8::getPathExtension(void) const { char* ext; ext = find_extension(); if (ext != NULL) return String8(ext); else return String8(""); } String8 String8::getBasePath(void) const { char* ext; const char* const str = mString; ext = find_extension(); if (ext == NULL) return String8(*this); else return String8(str, ext - str); } String8& String8::appendPath(const char* name) { // TODO: The test below will fail for Win32 paths. Fix later or ignore. if (name[0] != OS_PATH_SEPARATOR) { if (*name == '\0') { // nothing to do return *this; } size_t len = length(); if (len == 0) { // no existing filename, just use the new one setPathName(name); return *this; } // make room for oldPath + '/' + newPath int newlen = strlen(name); char* buf = lockBuffer(len+1+newlen); // insert a '/' if needed if (buf[len-1] != OS_PATH_SEPARATOR) buf[len++] = OS_PATH_SEPARATOR; memcpy(buf+len, name, newlen+1); len += newlen; unlockBuffer(len); return *this; } else { setPathName(name); return *this; } } String8& String8::convertToResPath() { #if OS_PATH_SEPARATOR != RES_PATH_SEPARATOR size_t len = length(); if (len > 0) { char * buf = lockBuffer(len); for (char * end = buf + len; buf < end; ++buf) { if (*buf == OS_PATH_SEPARATOR) *buf = RES_PATH_SEPARATOR; } unlockBuffer(len); } #endif return *this; } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/StringArray.cpp0000644000015700001700000000510012200324306024545 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Sortable array of strings. STL-ish, but STL-free. // #include #include #include namespace android { // // An expanding array of strings. Add, get, sort, delete. // StringArray::StringArray() : mMax(0), mCurrent(0), mArray(NULL) { } StringArray:: ~StringArray() { for (int i = 0; i < mCurrent; i++) delete[] mArray[i]; delete[] mArray; } // // Add a string. A copy of the string is made. // bool StringArray::push_back(const char* str) { if (mCurrent >= mMax) { char** tmp; if (mMax == 0) mMax = 16; // initial storage else mMax *= 2; tmp = new char*[mMax]; if (tmp == NULL) return false; memcpy(tmp, mArray, mCurrent * sizeof(char*)); delete[] mArray; mArray = tmp; } int len = strlen(str); mArray[mCurrent] = new char[len+1]; memcpy(mArray[mCurrent], str, len+1); mCurrent++; return true; } // // Delete an entry. // void StringArray::erase(int idx) { if (idx < 0 || idx >= mCurrent) return; delete[] mArray[idx]; if (idx < mCurrent-1) { memmove(&mArray[idx], &mArray[idx+1], (mCurrent-1 - idx) * sizeof(char*)); } mCurrent--; } // // Sort the array. // void StringArray::sort(int (*compare)(const void*, const void*)) { qsort(mArray, mCurrent, sizeof(char*), compare); } // // Pass this to the sort routine to do an ascending alphabetical sort. // int StringArray::cmpAscendingAlpha(const void* pstr1, const void* pstr2) { return strcmp(*(const char**)pstr1, *(const char**)pstr2); } // // Set entry N to specified string. // [should use operator[] here] // void StringArray::setEntry(int idx, const char* str) { if (idx < 0 || idx >= mCurrent) return; delete[] mArray[idx]; int len = strlen(str); mArray[idx] = new char[len+1]; memcpy(mArray[idx], str, len+1); } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/README0000644000015700001700000002520012200324306022457 0ustar pbuserpbgroup00000000000000Android Utility Function Library ================================ If you need a feature that is native to Linux but not present on other platforms, construct a platform-dependent implementation that shares the Linux interface. That way the actual device runs as "light" as possible. If that isn't feasible, create a system-independent interface and hide the details. The ultimate goal is *not* to create a super-duper platform abstraction layer. The goal is to provide an optimized solution for Linux with reasonable implementations for other platforms. Resource overlay ================ Introduction ------------ Overlay packages are special .apk files which provide no code but additional resource values (and possibly new configurations) for resources in other packages. When an application requests resources, the system will return values from either the application's original package or any associated overlay package. Any redirection is completely transparent to the calling application. Resource values have the following precedence table, listed in descending precedence. * overlay package, matching config (eg res/values-en-land) * original package, matching config * overlay package, no config (eg res/values) * original package, no config During compilation, overlay packages are differentiated from regular packages by passing the -o flag to aapt. Background ---------- This section provides generic background material on resources in Android. How resources are bundled in .apk files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Android .apk files are .zip files, usually housing .dex code, certificates and resources, though packages containing resources but no code are possible. Resources can be divided into the following categories; a `configuration' indicates a set of phone language, display density, network operator, etc. * assets: uncompressed, raw files packaged as part of an .apk and explicitly referenced by filename. These files are independent of configuration. * res/drawable: bitmap or xml graphics. Each file may have different values depending on configuration. * res/values: integers, strings, etc. Each resource may have different values depending on configuration. Resource meta information and information proper is stored in a binary format in a named file resources.arsc, bundled as part of the .apk. Resource IDs and lookup ~~~~~~~~~~~~~~~~~~~~~~~ During compilation, the aapt tool gathers application resources and generates a resources.arsc file. Each resource name is assigned an integer ID 0xppttiii (translated to a symbolic name via R.java), where * pp: corresponds to the package namespace (details below). * tt: corresponds to the resource type (string, int, etc). Every resource of the same type within the same package has the same tt value, but depending on available types, the actual numerical value may be different between packages. * iiii: sequential number, assigned in the order resources are found. Resource values are specified paired with a set of configuration constraints (the default being the empty set), eg res/values-sv-port which imposes restrictions on language (Swedish) and display orientation (portrait). During lookup, every constraint set is matched against the current configuration, and the value corresponding to the best matching constraint set is returned (ResourceTypes.{h,cpp}). Parsing of resources.arsc is handled by ResourceTypes.cpp; this utility is governed by AssetManager.cpp, which tracks loaded resources per process. Assets are looked up by path and filename in AssetManager.cpp. The path to resources in res/drawable are located by ResourceTypes.cpp and then handled like assets by AssetManager.cpp. Other resources are handled solely by ResourceTypes.cpp. Package ID as namespace ~~~~~~~~~~~~~~~~~~~~~~~ The pp part of a resource ID defines a namespace. Android currently defines two namespaces: * 0x01: system resources (pre-installed in framework-res.apk) * 0x7f: application resources (bundled in the application .apk) ResourceTypes.cpp supports package IDs between 0x01 and 0x7f (inclusive); values outside this range are invalid. Each running (Dalvik) process is assigned a unique instance of AssetManager, which in turn keeps a forest structure of loaded resource.arsc files. Normally, this forest is structured as follows, where mPackageMap is the internal vector employed in ResourceTypes.cpp. mPackageMap[0x00] -> system package mPackageMap[0x01] -> NULL mPackageMap[0x02] -> NULL ... mPackageMap[0x7f - 2] -> NULL mPackageMap[0x7f - 1] -> application package The resource overlay extension ------------------------------ The resource overlay mechanism aims to (partly) shadow and extend existing resources with new values for defined and new configurations. Technically, this is achieved by adding resource-only packages (called overlay packages) to existing resource namespaces, like so: mPackageMap[0x00] -> system package -> system overlay package mPackageMap[0x01] -> NULL mPackageMap[0x02] -> NULL ... mPackageMap[0x7f - 2] -> NULL mPackageMap[0x7f - 1] -> application package -> overlay 1 -> overlay 2 The use of overlay resources is completely transparent to applications; no additional resource identifiers are introduced, only configuration/value pairs. Any number of overlay packages may be loaded at a time; overlay packages are agnostic to what they target -- both system and application resources are fair game. The package targeted by an overlay package is called the target or original package. Resource overlay operates on symbolic resources names. Hence, to override the string/str1 resources in a package, the overlay package would include a resource also named string/str1. The end user does not have to worry about the numeric resources IDs assigned by aapt, as this is resolved automatically by the system. As of this writing, the use of resource overlay has not been fully explored. Until it has, only OEMs are trusted to use resource overlay. For this reason, overlay packages must reside in /system/overlay. Resource ID mapping ~~~~~~~~~~~~~~~~~~~ Resource identifiers must be coherent within the same namespace (ie PackageGroup in ResourceTypes.cpp). Calling applications will refer to resources using the IDs defined in the original package, but there is no guarantee aapt has assigned the same ID to the corresponding resource in an overlay package. To translate between the two, a resource ID mapping {original ID -> overlay ID} is created during package installation (PackageManagerService.java) and used during resource lookup. The mapping is stored in /data/resource-cache, with a @idmap file name suffix. The idmap file format is documented in a separate section, below. Package management ~~~~~~~~~~~~~~~~~~ Packages are managed by the PackageManagerService. Addition and removal of packages are monitored via the inotify framework, exposed via android.os.FileObserver. During initialization of a Dalvik process, ActivityThread.java requests the process' AssetManager (by proxy, via AssetManager.java and JNI) to load a list of packages. This list includes overlay packages, if present. When a target package or a corresponding overlay package is installed, the target package's process is stopped and a new idmap is generated. This is similar to how applications are stopped when their packages are upgraded. Creating overlay packages ------------------------- Overlay packages should contain no code, define (some) resources with the same type and name as in the original package, and be compiled with the -o flag passed to aapt. The aapt -o flag instructs aapt to create an overlay package. Technically, this means the package will be assigned package id 0x00. There are no restrictions on overlay packages names, though the naming convention .overlay. is recommended. Example overlay package ~~~~~~~~~~~~~~~~~~~~~~~ To overlay the resource bool/b in package com.foo.bar, to be applied when the display is in landscape mode, create a new package with no source code and a single .xml file under res/values-land, with an entry for bool/b. Compile with aapt -o and place the results in /system/overlay by adding the following to Android.mk: LOCAL_AAPT_FLAGS := -o com.foo.bar LOCAL_MODULE_PATH := $(TARGET_OUT)/overlay The ID map (idmap) file format ------------------------------ The idmap format is designed for lookup performance. However, leading and trailing undefined overlay values are discarded to reduce the memory footprint. idmap grammar ~~~~~~~~~~~~~ All atoms (names in square brackets) are uint32_t integers. The idmap-magic constant spells "idmp" in ASCII. Offsets are given relative to the data_header, not to the beginning of the file. map := header data header := idmap-magic idmap-magic := <0x706d6469> data := data_header type_block+ data_header := header_block{m} header_block := <0> | type_block := entry{n} entry := idmap example ~~~~~~~~~~~~~ Given a pair of target and overlay packages with CRC sums 0x216a8fe2 and 0x6b9beaec, each defining the following resources Name Target package Overlay package string/str0 0x7f010000 - string/str1 0x7f010001 0x7f010000 string/str2 0x7f010002 - string/str3 0x7f010003 0x7f010001 string/str4 0x7f010004 - bool/bool0 0x7f020000 - integer/int0 0x7f030000 0x7f020000 integer/int1 0x7f030001 - the corresponding resource map is 0x706d6469 0x216a8fe2 0x6b9beaec 0x00000003 \ 0x00000004 0x00000000 0x00000009 0x00000003 \ 0x00000001 0x7f010000 0x00000000 0x7f010001 \ 0x00000001 0x00000000 0x7f020000 or, formatted differently 0x706d6469 # magic: all idmap files begin with this constant 0x216a8fe2 # CRC32 of the resources.arsc file in the original package 0x6b9beaec # CRC32 of the resources.arsc file in the overlay package 0x00000003 # header; three types (string, bool, integer) in the target package 0x00000004 # header_block for type 0 (string) is located at offset 4 0x00000000 # no bool type exists in overlay package -> no header_block 0x00000009 # header_block for type 2 (integer) is located at offset 9 0x00000003 # header_block for string; overlay IDs span 3 elements 0x00000001 # the first string in target package is entry 1 == offset 0x7f010000 # target 0x7f01001 -> overlay 0x7f010000 0x00000000 # str2 not defined in overlay package 0x7f010001 # target 0x7f010003 -> overlay 0x7f010001 0x00000001 # header_block for integer; overlay IDs span 1 element 0x00000000 # offset == 0 0x7f020000 # target 0x7f030000 -> overlay 0x7f020000 android-audiosystem-1.8+13.10.20130807/lib/utils/BackupHelpers.cpp0000644000015700001700000013324712200324306025046 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "file_backup_helper" #include #include #include #include #include #include #include #include #include // for utimes #include #include #include #include #include #include #include namespace android { #define MAGIC0 0x70616e53 // Snap #define MAGIC1 0x656c6946 // File /* * File entity data format (v1): * * - 4-byte version number of the metadata, little endian (0x00000001 for v1) * - 12 bytes of metadata * - the file data itself * * i.e. a 16-byte metadata header followed by the raw file data. If the * restore code does not recognize the metadata version, it can still * interpret the file data itself correctly. * * file_metadata_v1: * * - 4 byte version number === 0x00000001 (little endian) * - 4-byte access mode (little-endian) * - undefined (8 bytes) */ struct file_metadata_v1 { int version; int mode; int undefined_1; int undefined_2; }; const static int CURRENT_METADATA_VERSION = 1; #if 1 #define LOGP(f, x...) #else #if TEST_BACKUP_HELPERS #define LOGP(f, x...) printf(f "\n", x) #else #define LOGP(x...) ALOGD(x) #endif #endif const static int ROUND_UP[4] = { 0, 3, 2, 1 }; static inline int round_up(int n) { return n + ROUND_UP[n % 4]; } static int read_snapshot_file(int fd, KeyedVector* snapshot) { int bytesRead = 0; int amt; SnapshotHeader header; amt = read(fd, &header, sizeof(header)); if (amt != sizeof(header)) { return errno; } bytesRead += amt; if (header.magic0 != MAGIC0 || header.magic1 != MAGIC1) { ALOGW("read_snapshot_file header.magic0=0x%08x magic1=0x%08x", header.magic0, header.magic1); return 1; } for (int i=0; iadd(String8(filename, file.nameLen), file); } bytesRead += amt; if (filename != filenameBuf) { free(filename); } if (amt != nameBufSize) { ALOGW("read_snapshot_file filename truncated/error with read at %d bytes\n", bytesRead); return 1; } } if (header.totalSize != bytesRead) { ALOGW("read_snapshot_file length mismatch: header.totalSize=%d bytesRead=%d\n", header.totalSize, bytesRead); return 1; } return 0; } static int write_snapshot_file(int fd, const KeyedVector& snapshot) { int fileCount = 0; int bytesWritten = sizeof(SnapshotHeader); // preflight size const int N = snapshot.size(); for (int i=0; iWriteEntityHeader(key, -1); } static int write_update_file(BackupDataWriter* dataStream, int fd, int mode, const String8& key, char const* realFilename) { LOGP("write_update_file %s (%s) : mode 0%o\n", realFilename, key.string(), mode); const int bufsize = 4*1024; int err; int amt; int fileSize; int bytesLeft; file_metadata_v1 metadata; char* buf = (char*)malloc(bufsize); int crc = crc32(0L, Z_NULL, 0); fileSize = lseek(fd, 0, SEEK_END); lseek(fd, 0, SEEK_SET); if (sizeof(metadata) != 16) { ALOGE("ERROR: metadata block is the wrong size!"); } bytesLeft = fileSize + sizeof(metadata); err = dataStream->WriteEntityHeader(key, bytesLeft); if (err != 0) { free(buf); return err; } // store the file metadata first metadata.version = tolel(CURRENT_METADATA_VERSION); metadata.mode = tolel(mode); metadata.undefined_1 = metadata.undefined_2 = 0; err = dataStream->WriteEntityData(&metadata, sizeof(metadata)); if (err != 0) { free(buf); return err; } bytesLeft -= sizeof(metadata); // bytesLeft should == fileSize now // now store the file content while ((amt = read(fd, buf, bufsize)) != 0 && bytesLeft > 0) { bytesLeft -= amt; if (bytesLeft < 0) { amt += bytesLeft; // Plus a negative is minus. Don't write more than we promised. } err = dataStream->WriteEntityData(buf, amt); if (err != 0) { free(buf); return err; } } if (bytesLeft != 0) { if (bytesLeft > 0) { // Pad out the space we promised in the buffer. We can't corrupt the buffer, // even though the data we're sending is probably bad. memset(buf, 0, bufsize); while (bytesLeft > 0) { amt = bytesLeft < bufsize ? bytesLeft : bufsize; bytesLeft -= amt; err = dataStream->WriteEntityData(buf, amt); if (err != 0) { free(buf); return err; } } } ALOGE("write_update_file size mismatch for %s. expected=%d actual=%d." " You aren't doing proper locking!", realFilename, fileSize, fileSize-bytesLeft); } free(buf); return NO_ERROR; } static int write_update_file(BackupDataWriter* dataStream, const String8& key, char const* realFilename) { int err; struct stat st; err = stat(realFilename, &st); if (err < 0) { return errno; } int fd = open(realFilename, O_RDONLY); if (fd == -1) { return errno; } err = write_update_file(dataStream, fd, st.st_mode, key, realFilename); close(fd); return err; } static int compute_crc32(int fd) { const int bufsize = 4*1024; int amt; char* buf = (char*)malloc(bufsize); int crc = crc32(0L, Z_NULL, 0); lseek(fd, 0, SEEK_SET); while ((amt = read(fd, buf, bufsize)) != 0) { crc = crc32(crc, (Bytef*)buf, amt); } free(buf); return crc; } int back_up_files(int oldSnapshotFD, BackupDataWriter* dataStream, int newSnapshotFD, char const* const* files, char const* const* keys, int fileCount) { int err; KeyedVector oldSnapshot; KeyedVector newSnapshot; if (oldSnapshotFD != -1) { err = read_snapshot_file(oldSnapshotFD, &oldSnapshot); if (err != 0) { // On an error, treat this as a full backup. oldSnapshot.clear(); } } for (int i=0; i= 0) { LOGP("back_up_files key already in use '%s'", key.string()); return -1; } } newSnapshot.add(key, r); } int n = 0; int N = oldSnapshot.size(); int m = 0; while (nWriteEntityHeader(p, -1); n++; } else if (cmp > 0) { // file added LOGP("file added: %s", g.file.string()); write_update_file(dataStream, q, g.file.string()); m++; } else { // both files exist, check them const FileState& f = oldSnapshot.valueAt(n); int fd = open(g.file.string(), O_RDONLY); if (fd < 0) { // We can't open the file. Don't report it as a delete either. Let the // server keep the old version. Maybe they'll be able to deal with it // on restore. LOGP("Unable to open file %s - skipping", g.file.string()); } else { g.s.crc32 = compute_crc32(fd); LOGP("%s", q.string()); LOGP(" new: modTime=%d,%d mode=%04o size=%-3d crc32=0x%08x", f.modTime_sec, f.modTime_nsec, f.mode, f.size, f.crc32); LOGP(" old: modTime=%d,%d mode=%04o size=%-3d crc32=0x%08x", g.s.modTime_sec, g.s.modTime_nsec, g.s.mode, g.s.size, g.s.crc32); if (f.modTime_sec != g.s.modTime_sec || f.modTime_nsec != g.s.modTime_nsec || f.mode != g.s.mode || f.size != g.s.size || f.crc32 != g.s.crc32) { write_update_file(dataStream, fd, g.s.mode, p, g.file.string()); } close(fd); } n++; m++; } } // these were deleted while (nWriteEntityHeader(oldSnapshot.keyAt(n), -1); n++; } // these were added while (m 9) len++; if (len > 99) len++; if (len > 999) len++; // since PATH_MAX is 4096 we don't expect to have to generate any single // header entry longer than 9999 characters return sprintf(buf, "%d %s=%s\n", len, key, value); } // Wire format to the backup manager service is chunked: each chunk is prefixed by // a 4-byte count of its size. A chunk size of zero (four zero bytes) indicates EOD. void send_tarfile_chunk(BackupDataWriter* writer, const char* buffer, size_t size) { uint32_t chunk_size_no = htonl(size); writer->WriteEntityData(&chunk_size_no, 4); if (size != 0) writer->WriteEntityData(buffer, size); } int write_tarfile(const String8& packageName, const String8& domain, const String8& rootpath, const String8& filepath, BackupDataWriter* writer) { // In the output stream everything is stored relative to the root const char* relstart = filepath.string() + rootpath.length(); if (*relstart == '/') relstart++; // won't be true when path == rootpath String8 relpath(relstart); // If relpath is empty, it means this is the top of one of the standard named // domain directories, so we should just skip it if (relpath.length() == 0) { return 0; } // Too long a name for the ustar format? // "apps/" + packagename + '/' + domainpath < 155 chars // relpath < 100 chars bool needExtended = false; if ((5 + packageName.length() + 1 + domain.length() >= 155) || (relpath.length() >= 100)) { needExtended = true; } // Non-7bit-clean path also means needing pax extended format if (!needExtended) { for (size_t i = 0; i < filepath.length(); i++) { if ((filepath[i] & 0x80) != 0) { needExtended = true; break; } } } int err = 0; struct stat64 s; if (lstat64(filepath.string(), &s) != 0) { err = errno; ALOGE("Error %d (%s) from lstat64(%s)", err, strerror(err), filepath.string()); return err; } String8 fullname; // for pax later on String8 prefix; const int isdir = S_ISDIR(s.st_mode); if (isdir) s.st_size = 0; // directories get no actual data in the tar stream // !!! TODO: use mmap when possible to avoid churning the buffer cache // !!! TODO: this will break with symlinks; need to use readlink(2) int fd = open(filepath.string(), O_RDONLY); if (fd < 0) { err = errno; ALOGE("Error %d (%s) from open(%s)", err, strerror(err), filepath.string()); return err; } // read/write up to this much at a time. const size_t BUFSIZE = 32 * 1024; char* buf = new char[BUFSIZE]; char* paxHeader = buf + 512; // use a different chunk of it as separate scratch char* paxData = buf + 1024; if (buf == NULL) { ALOGE("Out of mem allocating transfer buffer"); err = ENOMEM; goto cleanup; } // Good to go -- first construct the standard tar header at the start of the buffer memset(buf, 0, BUFSIZE); // Magic fields for the ustar file format strcat(buf + 257, "ustar"); strcat(buf + 263, "00"); // [ 265 : 32 ] user name, ignored on restore // [ 297 : 32 ] group name, ignored on restore // [ 100 : 8 ] file mode snprintf(buf + 100, 8, "%06o ", s.st_mode & ~S_IFMT); // [ 108 : 8 ] uid -- ignored in Android format; uids are remapped at restore time // [ 116 : 8 ] gid -- ignored in Android format snprintf(buf + 108, 8, "0%lo", s.st_uid); snprintf(buf + 116, 8, "0%lo", s.st_gid); // [ 124 : 12 ] file size in bytes if (s.st_size > 077777777777LL) { // very large files need a pax extended size header needExtended = true; } snprintf(buf + 124, 12, "%011llo", (isdir) ? 0LL : s.st_size); // [ 136 : 12 ] last mod time as a UTC time_t snprintf(buf + 136, 12, "%0lo", s.st_mtime); // [ 156 : 1 ] link/file type uint8_t type; if (isdir) { type = '5'; // tar magic: '5' == directory } else if (S_ISREG(s.st_mode)) { type = '0'; // tar magic: '0' == normal file } else { ALOGW("Error: unknown file mode 0%o [%s]", s.st_mode, filepath.string()); goto cleanup; } buf[156] = type; // [ 157 : 100 ] name of linked file [not implemented] { // Prefix and main relative path. Path lengths have been preflighted. if (packageName.length() > 0) { prefix = "apps/"; prefix += packageName; } if (domain.length() > 0) { prefix.appendPath(domain); } // pax extended means we don't put in a prefix field, and put a different // string in the basic name field. We can also construct the full path name // out of the substrings we've now built. fullname = prefix; fullname.appendPath(relpath); // ustar: // [ 0 : 100 ]; file name/path // [ 345 : 155 ] filename path prefix // We only use the prefix area if fullname won't fit in the path if (fullname.length() > 100) { strncpy(buf, relpath.string(), 100); strncpy(buf + 345, prefix.string(), 155); } else { strncpy(buf, fullname.string(), 100); } } // [ 329 : 8 ] and [ 337 : 8 ] devmajor/devminor, not used ALOGI(" Name: %s", fullname.string()); // If we're using a pax extended header, build & write that here; lengths are // already preflighted if (needExtended) { char sizeStr[32]; // big enough for a 64-bit unsigned value in decimal char* p = paxData; // construct the pax extended header data block memset(paxData, 0, BUFSIZE - (paxData - buf)); int len; // size header -- calc len in digits by actually rendering the number // to a string - brute force but simple snprintf(sizeStr, sizeof(sizeStr), "%lld", s.st_size); p += write_pax_header_entry(p, "size", sizeStr); // fullname was generated above with the ustar paths p += write_pax_header_entry(p, "path", fullname.string()); // Now we know how big the pax data is int paxLen = p - paxData; // Now build the pax *header* templated on the ustar header memcpy(paxHeader, buf, 512); String8 leaf = fullname.getPathLeaf(); memset(paxHeader, 0, 100); // rewrite the name area snprintf(paxHeader, 100, "PaxHeader/%s", leaf.string()); memset(paxHeader + 345, 0, 155); // rewrite the prefix area strncpy(paxHeader + 345, prefix.string(), 155); paxHeader[156] = 'x'; // mark it as a pax extended header // [ 124 : 12 ] size of pax extended header data memset(paxHeader + 124, 0, 12); snprintf(paxHeader + 124, 12, "%011o", p - paxData); // Checksum and write the pax block header calc_tar_checksum(paxHeader); send_tarfile_chunk(writer, paxHeader, 512); // Now write the pax data itself int paxblocks = (paxLen + 511) / 512; send_tarfile_chunk(writer, paxData, 512 * paxblocks); } // Checksum and write the 512-byte ustar file header block to the output calc_tar_checksum(buf); send_tarfile_chunk(writer, buf, 512); // Now write the file data itself, for real files. We honor tar's convention that // only full 512-byte blocks are sent to write(). if (!isdir) { off64_t toWrite = s.st_size; while (toWrite > 0) { size_t toRead = (toWrite < BUFSIZE) ? toWrite : BUFSIZE; ssize_t nRead = read(fd, buf, toRead); if (nRead < 0) { err = errno; ALOGE("Unable to read file [%s], err=%d (%s)", filepath.string(), err, strerror(err)); break; } else if (nRead == 0) { ALOGE("EOF but expect %lld more bytes in [%s]", (long long) toWrite, filepath.string()); err = EIO; break; } // At EOF we might have a short block; NUL-pad that to a 512-byte multiple. This // depends on the OS guarantee that for ordinary files, read() will never return // less than the number of bytes requested. ssize_t partial = (nRead+512) % 512; if (partial > 0) { ssize_t remainder = 512 - partial; memset(buf + nRead, 0, remainder); nRead += remainder; } send_tarfile_chunk(writer, buf, nRead); toWrite -= nRead; } } cleanup: delete [] buf; done: close(fd); return err; } // end tarfile #define RESTORE_BUF_SIZE (8*1024) RestoreHelperBase::RestoreHelperBase() { m_buf = malloc(RESTORE_BUF_SIZE); m_loggedUnknownMetadata = false; } RestoreHelperBase::~RestoreHelperBase() { free(m_buf); } status_t RestoreHelperBase::WriteFile(const String8& filename, BackupDataReader* in) { ssize_t err; size_t dataSize; String8 key; int fd; void* buf = m_buf; ssize_t amt; int mode; int crc; struct stat st; FileRec r; err = in->ReadEntityHeader(&key, &dataSize); if (err != NO_ERROR) { return err; } // Get the metadata block off the head of the file entity and use that to // set up the output file file_metadata_v1 metadata; amt = in->ReadEntityData(&metadata, sizeof(metadata)); if (amt != sizeof(metadata)) { ALOGW("Could not read metadata for %s -- %ld / %s", filename.string(), (long)amt, strerror(errno)); return EIO; } metadata.version = fromlel(metadata.version); metadata.mode = fromlel(metadata.mode); if (metadata.version > CURRENT_METADATA_VERSION) { if (!m_loggedUnknownMetadata) { m_loggedUnknownMetadata = true; ALOGW("Restoring file with unsupported metadata version %d (currently %d)", metadata.version, CURRENT_METADATA_VERSION); } } mode = metadata.mode; // Write the file and compute the crc crc = crc32(0L, Z_NULL, 0); fd = open(filename.string(), O_CREAT|O_RDWR|O_TRUNC, mode); if (fd == -1) { ALOGW("Could not open file %s -- %s", filename.string(), strerror(errno)); return errno; } while ((amt = in->ReadEntityData(buf, RESTORE_BUF_SIZE)) > 0) { err = write(fd, buf, amt); if (err != amt) { close(fd); ALOGW("Error '%s' writing '%s'", strerror(errno), filename.string()); return errno; } crc = crc32(crc, (Bytef*)buf, amt); } close(fd); // Record for the snapshot err = stat(filename.string(), &st); if (err != 0) { ALOGW("Error stating file that we just created %s", filename.string()); return errno; } r.file = filename; r.deleted = false; r.s.modTime_sec = st.st_mtime; r.s.modTime_nsec = 0; // workaround sim breakage //r.s.modTime_nsec = st.st_mtime_nsec; r.s.mode = st.st_mode; r.s.size = st.st_size; r.s.crc32 = crc; m_files.add(key, r); return NO_ERROR; } status_t RestoreHelperBase::WriteSnapshot(int fd) { return write_snapshot_file(fd, m_files);; } #if TEST_BACKUP_HELPERS #define SCRATCH_DIR "/data/backup_helper_test/" static int write_text_file(const char* path, const char* data) { int amt; int fd; int len; fd = creat(path, 0666); if (fd == -1) { fprintf(stderr, "creat %s failed\n", path); return errno; } len = strlen(data); amt = write(fd, data, len); if (amt != len) { fprintf(stderr, "error (%s) writing to file %s\n", strerror(errno), path); return errno; } close(fd); return 0; } static int compare_file(const char* path, const unsigned char* data, int len) { int fd; int amt; fd = open(path, O_RDONLY); if (fd == -1) { fprintf(stderr, "compare_file error (%s) opening %s\n", strerror(errno), path); return errno; } unsigned char* contents = (unsigned char*)malloc(len); if (contents == NULL) { fprintf(stderr, "malloc(%d) failed\n", len); return ENOMEM; } bool sizesMatch = true; amt = lseek(fd, 0, SEEK_END); if (amt != len) { fprintf(stderr, "compare_file file length should be %d, was %d\n", len, amt); sizesMatch = false; } lseek(fd, 0, SEEK_SET); int readLen = amt < len ? amt : len; amt = read(fd, contents, readLen); if (amt != readLen) { fprintf(stderr, "compare_file read expected %d bytes but got %d\n", len, amt); } bool contentsMatch = true; for (int i=0; i snapshot; const char* filename = SCRATCH_DIR "backup_helper_test_empty.snap"; system("rm -r " SCRATCH_DIR); mkdir(SCRATCH_DIR, 0777); // write fd = creat(filename, 0666); if (fd == -1) { fprintf(stderr, "error creating %s\n", filename); return 1; } err = write_snapshot_file(fd, snapshot); close(fd); if (err != 0) { fprintf(stderr, "write_snapshot_file reported error %d (%s)\n", err, strerror(err)); return err; } static const unsigned char correct_data[] = { 0x53, 0x6e, 0x61, 0x70, 0x00, 0x00, 0x00, 0x00, 0x46, 0x69, 0x6c, 0x65, 0x10, 0x00, 0x00, 0x00 }; err = compare_file(filename, correct_data, sizeof(correct_data)); if (err != 0) { return err; } // read fd = open(filename, O_RDONLY); if (fd == -1) { fprintf(stderr, "error opening for read %s\n", filename); return 1; } KeyedVector readSnapshot; err = read_snapshot_file(fd, &readSnapshot); if (err != 0) { fprintf(stderr, "read_snapshot_file failed %d\n", err); return err; } if (readSnapshot.size() != 0) { fprintf(stderr, "readSnapshot should be length 0\n"); return 1; } return 0; } int backup_helper_test_four() { int err; int fd; KeyedVector snapshot; const char* filename = SCRATCH_DIR "backup_helper_test_four.snap"; system("rm -r " SCRATCH_DIR); mkdir(SCRATCH_DIR, 0777); // write fd = creat(filename, 0666); if (fd == -1) { fprintf(stderr, "error opening %s\n", filename); return 1; } String8 filenames[4]; FileState states[4]; FileRec r; r.deleted = false; states[0].modTime_sec = 0xfedcba98; states[0].modTime_nsec = 0xdeadbeef; states[0].mode = 0777; // decimal 511, hex 0x000001ff states[0].size = 0xababbcbc; states[0].crc32 = 0x12345678; states[0].nameLen = -12; r.s = states[0]; filenames[0] = String8("bytes_of_padding"); snapshot.add(filenames[0], r); states[1].modTime_sec = 0x93400031; states[1].modTime_nsec = 0xdeadbeef; states[1].mode = 0666; // decimal 438, hex 0x000001b6 states[1].size = 0x88557766; states[1].crc32 = 0x22334422; states[1].nameLen = -1; r.s = states[1]; filenames[1] = String8("bytes_of_padding3"); snapshot.add(filenames[1], r); states[2].modTime_sec = 0x33221144; states[2].modTime_nsec = 0xdeadbeef; states[2].mode = 0744; // decimal 484, hex 0x000001e4 states[2].size = 0x11223344; states[2].crc32 = 0x01122334; states[2].nameLen = 0; r.s = states[2]; filenames[2] = String8("bytes_of_padding_2"); snapshot.add(filenames[2], r); states[3].modTime_sec = 0x33221144; states[3].modTime_nsec = 0xdeadbeef; states[3].mode = 0755; // decimal 493, hex 0x000001ed states[3].size = 0x11223344; states[3].crc32 = 0x01122334; states[3].nameLen = 0; r.s = states[3]; filenames[3] = String8("bytes_of_padding__1"); snapshot.add(filenames[3], r); err = write_snapshot_file(fd, snapshot); close(fd); if (err != 0) { fprintf(stderr, "write_snapshot_file reported error %d (%s)\n", err, strerror(err)); return err; } static const unsigned char correct_data[] = { // header 0x53, 0x6e, 0x61, 0x70, 0x04, 0x00, 0x00, 0x00, 0x46, 0x69, 0x6c, 0x65, 0xbc, 0x00, 0x00, 0x00, // bytes_of_padding 0x98, 0xba, 0xdc, 0xfe, 0xef, 0xbe, 0xad, 0xde, 0xff, 0x01, 0x00, 0x00, 0xbc, 0xbc, 0xab, 0xab, 0x78, 0x56, 0x34, 0x12, 0x10, 0x00, 0x00, 0x00, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x6f, 0x66, 0x5f, 0x70, 0x61, 0x64, 0x64, 0x69, 0x6e, 0x67, // bytes_of_padding3 0x31, 0x00, 0x40, 0x93, 0xef, 0xbe, 0xad, 0xde, 0xb6, 0x01, 0x00, 0x00, 0x66, 0x77, 0x55, 0x88, 0x22, 0x44, 0x33, 0x22, 0x11, 0x00, 0x00, 0x00, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x6f, 0x66, 0x5f, 0x70, 0x61, 0x64, 0x64, 0x69, 0x6e, 0x67, 0x33, 0xab, 0xab, 0xab, // bytes of padding2 0x44, 0x11, 0x22, 0x33, 0xef, 0xbe, 0xad, 0xde, 0xe4, 0x01, 0x00, 0x00, 0x44, 0x33, 0x22, 0x11, 0x34, 0x23, 0x12, 0x01, 0x12, 0x00, 0x00, 0x00, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x6f, 0x66, 0x5f, 0x70, 0x61, 0x64, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x32, 0xab, 0xab, // bytes of padding3 0x44, 0x11, 0x22, 0x33, 0xef, 0xbe, 0xad, 0xde, 0xed, 0x01, 0x00, 0x00, 0x44, 0x33, 0x22, 0x11, 0x34, 0x23, 0x12, 0x01, 0x13, 0x00, 0x00, 0x00, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x6f, 0x66, 0x5f, 0x70, 0x61, 0x64, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x5f, 0x31, 0xab }; err = compare_file(filename, correct_data, sizeof(correct_data)); if (err != 0) { return err; } // read fd = open(filename, O_RDONLY); if (fd == -1) { fprintf(stderr, "error opening for read %s\n", filename); return 1; } KeyedVector readSnapshot; err = read_snapshot_file(fd, &readSnapshot); if (err != 0) { fprintf(stderr, "read_snapshot_file failed %d\n", err); return err; } if (readSnapshot.size() != 4) { fprintf(stderr, "readSnapshot should be length 4 is %d\n", readSnapshot.size()); return 1; } bool matched = true; for (size_t i=0; i #include #include #include #include #include #include #include #include #include #if defined(HAVE_PTHREADS) # include # include # include #elif defined(HAVE_WIN32_THREADS) # include # include # include # define HAVE_CREATETHREAD // Cygwin, vs. HAVE__BEGINTHREADEX for MinGW #endif #if defined(HAVE_PRCTL) #include #endif /* * =========================================================================== * Thread wrappers * =========================================================================== */ using namespace android; // ---------------------------------------------------------------------------- #if defined(HAVE_PTHREADS) // ---------------------------------------------------------------------------- /* * Create and run a new thread. * * We create it "detached", so it cleans up after itself. */ typedef void* (*android_pthread_entry)(void*); static pthread_once_t gDoSchedulingGroupOnce = PTHREAD_ONCE_INIT; static bool gDoSchedulingGroup = true; static void checkDoSchedulingGroup(void) { char buf[PROPERTY_VALUE_MAX]; int len = property_get("debug.sys.noschedgroups", buf, ""); if (len > 0) { int temp; if (sscanf(buf, "%d", &temp) == 1) { gDoSchedulingGroup = temp == 0; } } } struct thread_data_t { thread_func_t entryFunction; void* userData; int priority; char * threadName; // we use this trampoline when we need to set the priority with // nice/setpriority. static int trampoline(const thread_data_t* t) { thread_func_t f = t->entryFunction; void* u = t->userData; int prio = t->priority; char * name = t->threadName; delete t; setpriority(PRIO_PROCESS, 0, prio); pthread_once(&gDoSchedulingGroupOnce, checkDoSchedulingGroup); if (gDoSchedulingGroup) { if (prio >= ANDROID_PRIORITY_BACKGROUND) { set_sched_policy(androidGetTid(), SP_BACKGROUND); } else { set_sched_policy(androidGetTid(), SP_FOREGROUND); } } if (name) { #if defined(HAVE_PRCTL) // Mac OS doesn't have this, and we build libutil for the host too int hasAt = 0; int hasDot = 0; char *s = name; while (*s) { if (*s == '.') hasDot = 1; else if (*s == '@') hasAt = 1; s++; } int len = s - name; if (len < 15 || hasAt || !hasDot) { s = name; } else { s = name + len - 15; } prctl(PR_SET_NAME, (unsigned long) s, 0, 0, 0); #endif free(name); } return f(u); } }; int androidCreateRawThreadEtc(android_thread_func_t entryFunction, void *userData, const char* threadName, int32_t threadPriority, size_t threadStackSize, android_thread_id_t *threadId) { pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); #ifdef HAVE_ANDROID_OS /* valgrind is rejecting RT-priority create reqs */ if (threadPriority != PRIORITY_DEFAULT || threadName != NULL) { // We could avoid the trampoline if there was a way to get to the // android_thread_id_t (pid) from pthread_t thread_data_t* t = new thread_data_t; t->priority = threadPriority; t->threadName = threadName ? strdup(threadName) : NULL; t->entryFunction = entryFunction; t->userData = userData; entryFunction = (android_thread_func_t)&thread_data_t::trampoline; userData = t; } #endif if (threadStackSize) { pthread_attr_setstacksize(&attr, threadStackSize); } errno = 0; pthread_t thread; int result = pthread_create(&thread, &attr, (android_pthread_entry)entryFunction, userData); pthread_attr_destroy(&attr); if (result != 0) { ALOGE("androidCreateRawThreadEtc failed (entry=%p, res=%d, errno=%d)\n" "(android threadPriority=%d)", entryFunction, result, errno, threadPriority); return 0; } // Note that *threadID is directly available to the parent only, as it is // assigned after the child starts. Use memory barrier / lock if the child // or other threads also need access. if (threadId != NULL) { *threadId = (android_thread_id_t)thread; // XXX: this is not portable } return 1; } android_thread_id_t androidGetThreadId() { return (android_thread_id_t)pthread_self(); } // ---------------------------------------------------------------------------- #elif defined(HAVE_WIN32_THREADS) // ---------------------------------------------------------------------------- /* * Trampoline to make us __stdcall-compliant. * * We're expected to delete "vDetails" when we're done. */ struct threadDetails { int (*func)(void*); void* arg; }; static __stdcall unsigned int threadIntermediary(void* vDetails) { struct threadDetails* pDetails = (struct threadDetails*) vDetails; int result; result = (*(pDetails->func))(pDetails->arg); delete pDetails; LOG(LOG_VERBOSE, "thread", "thread exiting\n"); return (unsigned int) result; } /* * Create and run a new thread. */ static bool doCreateThread(android_thread_func_t fn, void* arg, android_thread_id_t *id) { HANDLE hThread; struct threadDetails* pDetails = new threadDetails; // must be on heap unsigned int thrdaddr; pDetails->func = fn; pDetails->arg = arg; #if defined(HAVE__BEGINTHREADEX) hThread = (HANDLE) _beginthreadex(NULL, 0, threadIntermediary, pDetails, 0, &thrdaddr); if (hThread == 0) #elif defined(HAVE_CREATETHREAD) hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) threadIntermediary, (void*) pDetails, 0, (DWORD*) &thrdaddr); if (hThread == NULL) #endif { LOG(LOG_WARN, "thread", "WARNING: thread create failed\n"); return false; } #if defined(HAVE_CREATETHREAD) /* close the management handle */ CloseHandle(hThread); #endif if (id != NULL) { *id = (android_thread_id_t)thrdaddr; } return true; } int androidCreateRawThreadEtc(android_thread_func_t fn, void *userData, const char* threadName, int32_t threadPriority, size_t threadStackSize, android_thread_id_t *threadId) { return doCreateThread( fn, userData, threadId); } android_thread_id_t androidGetThreadId() { return (android_thread_id_t)GetCurrentThreadId(); } // ---------------------------------------------------------------------------- #else #error "Threads not supported" #endif // ---------------------------------------------------------------------------- int androidCreateThread(android_thread_func_t fn, void* arg) { return createThreadEtc(fn, arg); } int androidCreateThreadGetID(android_thread_func_t fn, void *arg, android_thread_id_t *id) { return createThreadEtc(fn, arg, "android:unnamed_thread", PRIORITY_DEFAULT, 0, id); } static android_create_thread_fn gCreateThreadFn = androidCreateRawThreadEtc; int androidCreateThreadEtc(android_thread_func_t entryFunction, void *userData, const char* threadName, int32_t threadPriority, size_t threadStackSize, android_thread_id_t *threadId) { return gCreateThreadFn(entryFunction, userData, threadName, threadPriority, threadStackSize, threadId); } void androidSetCreateThreadFunc(android_create_thread_fn func) { gCreateThreadFn = func; } pid_t androidGetTid() { #ifdef HAVE_GETTID return gettid(); #else return getpid(); #endif } int androidSetThreadSchedulingGroup(pid_t tid, int grp) { if (grp > ANDROID_TGROUP_MAX || grp < 0) { return BAD_VALUE; } #if defined(HAVE_PTHREADS) pthread_once(&gDoSchedulingGroupOnce, checkDoSchedulingGroup); if (gDoSchedulingGroup) { // set_sched_policy does not support tid == 0 if (tid == 0) { tid = androidGetTid(); } if (set_sched_policy(tid, (grp == ANDROID_TGROUP_BG_NONINTERACT) ? SP_BACKGROUND : SP_FOREGROUND)) { return PERMISSION_DENIED; } } #endif return NO_ERROR; } int androidSetThreadPriority(pid_t tid, int pri) { int rc = 0; #if defined(HAVE_PTHREADS) int lasterr = 0; pthread_once(&gDoSchedulingGroupOnce, checkDoSchedulingGroup); if (gDoSchedulingGroup) { // set_sched_policy does not support tid == 0 int policy_tid; if (tid == 0) { policy_tid = androidGetTid(); } else { policy_tid = tid; } if (pri >= ANDROID_PRIORITY_BACKGROUND) { rc = set_sched_policy(policy_tid, SP_BACKGROUND); } else if (getpriority(PRIO_PROCESS, tid) >= ANDROID_PRIORITY_BACKGROUND) { rc = set_sched_policy(policy_tid, SP_FOREGROUND); } } if (rc) { lasterr = errno; } if (setpriority(PRIO_PROCESS, tid, pri) < 0) { rc = INVALID_OPERATION; } else { errno = lasterr; } #endif return rc; } int androidGetThreadPriority(pid_t tid) { #if defined(HAVE_PTHREADS) return getpriority(PRIO_PROCESS, tid); #else return ANDROID_PRIORITY_NORMAL; #endif } int androidGetThreadSchedulingGroup(pid_t tid) { int ret = ANDROID_TGROUP_DEFAULT; #if defined(HAVE_PTHREADS) // convention is to not call get/set_sched_policy methods if disabled by property pthread_once(&gDoSchedulingGroupOnce, checkDoSchedulingGroup); if (gDoSchedulingGroup) { SchedPolicy policy; // get_sched_policy does not support tid == 0 if (tid == 0) { tid = androidGetTid(); } if (get_sched_policy(tid, &policy) < 0) { ret = INVALID_OPERATION; } else { switch (policy) { case SP_BACKGROUND: ret = ANDROID_TGROUP_BG_NONINTERACT; break; case SP_FOREGROUND: ret = ANDROID_TGROUP_FG_BOOST; break; default: // should not happen, as enum SchedPolicy does not have any other values ret = INVALID_OPERATION; break; } } } #endif return ret; } namespace android { /* * =========================================================================== * Mutex class * =========================================================================== */ #if defined(HAVE_PTHREADS) // implemented as inlines in threads.h #elif defined(HAVE_WIN32_THREADS) Mutex::Mutex() { HANDLE hMutex; assert(sizeof(hMutex) == sizeof(mState)); hMutex = CreateMutex(NULL, FALSE, NULL); mState = (void*) hMutex; } Mutex::Mutex(const char* name) { // XXX: name not used for now HANDLE hMutex; assert(sizeof(hMutex) == sizeof(mState)); hMutex = CreateMutex(NULL, FALSE, NULL); mState = (void*) hMutex; } Mutex::Mutex(int type, const char* name) { // XXX: type and name not used for now HANDLE hMutex; assert(sizeof(hMutex) == sizeof(mState)); hMutex = CreateMutex(NULL, FALSE, NULL); mState = (void*) hMutex; } Mutex::~Mutex() { CloseHandle((HANDLE) mState); } status_t Mutex::lock() { DWORD dwWaitResult; dwWaitResult = WaitForSingleObject((HANDLE) mState, INFINITE); return dwWaitResult != WAIT_OBJECT_0 ? -1 : NO_ERROR; } void Mutex::unlock() { if (!ReleaseMutex((HANDLE) mState)) LOG(LOG_WARN, "thread", "WARNING: bad result from unlocking mutex\n"); } status_t Mutex::tryLock() { DWORD dwWaitResult; dwWaitResult = WaitForSingleObject((HANDLE) mState, 0); if (dwWaitResult != WAIT_OBJECT_0 && dwWaitResult != WAIT_TIMEOUT) LOG(LOG_WARN, "thread", "WARNING: bad result from try-locking mutex\n"); return (dwWaitResult == WAIT_OBJECT_0) ? 0 : -1; } #else #error "Somebody forgot to implement threads for this platform." #endif /* * =========================================================================== * Condition class * =========================================================================== */ #if defined(HAVE_PTHREADS) // implemented as inlines in threads.h #elif defined(HAVE_WIN32_THREADS) /* * Windows doesn't have a condition variable solution. It's possible * to create one, but it's easy to get it wrong. For a discussion, and * the origin of this implementation, see: * * http://www.cs.wustl.edu/~schmidt/win32-cv-1.html * * The implementation shown on the page does NOT follow POSIX semantics. * As an optimization they require acquiring the external mutex before * calling signal() and broadcast(), whereas POSIX only requires grabbing * it before calling wait(). The implementation here has been un-optimized * to have the correct behavior. */ typedef struct WinCondition { // Number of waiting threads. int waitersCount; // Serialize access to waitersCount. CRITICAL_SECTION waitersCountLock; // Semaphore used to queue up threads waiting for the condition to // become signaled. HANDLE sema; // An auto-reset event used by the broadcast/signal thread to wait // for all the waiting thread(s) to wake up and be released from // the semaphore. HANDLE waitersDone; // This mutex wouldn't be necessary if we required that the caller // lock the external mutex before calling signal() and broadcast(). // I'm trying to mimic pthread semantics though. HANDLE internalMutex; // Keeps track of whether we were broadcasting or signaling. This // allows us to optimize the code if we're just signaling. bool wasBroadcast; status_t wait(WinCondition* condState, HANDLE hMutex, nsecs_t* abstime) { // Increment the wait count, avoiding race conditions. EnterCriticalSection(&condState->waitersCountLock); condState->waitersCount++; //printf("+++ wait: incr waitersCount to %d (tid=%ld)\n", // condState->waitersCount, getThreadId()); LeaveCriticalSection(&condState->waitersCountLock); DWORD timeout = INFINITE; if (abstime) { nsecs_t reltime = *abstime - systemTime(); if (reltime < 0) reltime = 0; timeout = reltime/1000000; } // Atomically release the external mutex and wait on the semaphore. DWORD res = SignalObjectAndWait(hMutex, condState->sema, timeout, FALSE); //printf("+++ wait: awake (tid=%ld)\n", getThreadId()); // Reacquire lock to avoid race conditions. EnterCriticalSection(&condState->waitersCountLock); // No longer waiting. condState->waitersCount--; // Check to see if we're the last waiter after a broadcast. bool lastWaiter = (condState->wasBroadcast && condState->waitersCount == 0); //printf("+++ wait: lastWaiter=%d (wasBc=%d wc=%d)\n", // lastWaiter, condState->wasBroadcast, condState->waitersCount); LeaveCriticalSection(&condState->waitersCountLock); // If we're the last waiter thread during this particular broadcast // then signal broadcast() that we're all awake. It'll drop the // internal mutex. if (lastWaiter) { // Atomically signal the "waitersDone" event and wait until we // can acquire the internal mutex. We want to do this in one step // because it ensures that everybody is in the mutex FIFO before // any thread has a chance to run. Without it, another thread // could wake up, do work, and hop back in ahead of us. SignalObjectAndWait(condState->waitersDone, condState->internalMutex, INFINITE, FALSE); } else { // Grab the internal mutex. WaitForSingleObject(condState->internalMutex, INFINITE); } // Release the internal and grab the external. ReleaseMutex(condState->internalMutex); WaitForSingleObject(hMutex, INFINITE); return res == WAIT_OBJECT_0 ? NO_ERROR : -1; } } WinCondition; /* * Constructor. Set up the WinCondition stuff. */ Condition::Condition() { WinCondition* condState = new WinCondition; condState->waitersCount = 0; condState->wasBroadcast = false; // semaphore: no security, initial value of 0 condState->sema = CreateSemaphore(NULL, 0, 0x7fffffff, NULL); InitializeCriticalSection(&condState->waitersCountLock); // auto-reset event, not signaled initially condState->waitersDone = CreateEvent(NULL, FALSE, FALSE, NULL); // used so we don't have to lock external mutex on signal/broadcast condState->internalMutex = CreateMutex(NULL, FALSE, NULL); mState = condState; } /* * Destructor. Free Windows resources as well as our allocated storage. */ Condition::~Condition() { WinCondition* condState = (WinCondition*) mState; if (condState != NULL) { CloseHandle(condState->sema); CloseHandle(condState->waitersDone); delete condState; } } status_t Condition::wait(Mutex& mutex) { WinCondition* condState = (WinCondition*) mState; HANDLE hMutex = (HANDLE) mutex.mState; return ((WinCondition*)mState)->wait(condState, hMutex, NULL); } status_t Condition::waitRelative(Mutex& mutex, nsecs_t reltime) { WinCondition* condState = (WinCondition*) mState; HANDLE hMutex = (HANDLE) mutex.mState; nsecs_t absTime = systemTime()+reltime; return ((WinCondition*)mState)->wait(condState, hMutex, &absTime); } /* * Signal the condition variable, allowing one thread to continue. */ void Condition::signal() { WinCondition* condState = (WinCondition*) mState; // Lock the internal mutex. This ensures that we don't clash with // broadcast(). WaitForSingleObject(condState->internalMutex, INFINITE); EnterCriticalSection(&condState->waitersCountLock); bool haveWaiters = (condState->waitersCount > 0); LeaveCriticalSection(&condState->waitersCountLock); // If no waiters, then this is a no-op. Otherwise, knock the semaphore // down a notch. if (haveWaiters) ReleaseSemaphore(condState->sema, 1, 0); // Release internal mutex. ReleaseMutex(condState->internalMutex); } /* * Signal the condition variable, allowing all threads to continue. * * First we have to wake up all threads waiting on the semaphore, then * we wait until all of the threads have actually been woken before * releasing the internal mutex. This ensures that all threads are woken. */ void Condition::broadcast() { WinCondition* condState = (WinCondition*) mState; // Lock the internal mutex. This keeps the guys we're waking up // from getting too far. WaitForSingleObject(condState->internalMutex, INFINITE); EnterCriticalSection(&condState->waitersCountLock); bool haveWaiters = false; if (condState->waitersCount > 0) { haveWaiters = true; condState->wasBroadcast = true; } if (haveWaiters) { // Wake up all the waiters. ReleaseSemaphore(condState->sema, condState->waitersCount, 0); LeaveCriticalSection(&condState->waitersCountLock); // Wait for all awakened threads to acquire the counting semaphore. // The last guy who was waiting sets this. WaitForSingleObject(condState->waitersDone, INFINITE); // Reset wasBroadcast. (No crit section needed because nobody // else can wake up to poke at it.) condState->wasBroadcast = 0; } else { // nothing to do LeaveCriticalSection(&condState->waitersCountLock); } // Release internal mutex. ReleaseMutex(condState->internalMutex); } #else #error "condition variables not supported on this platform" #endif // ---------------------------------------------------------------------------- /* * This is our thread object! */ Thread::Thread(bool canCallJava) : mCanCallJava(canCallJava), mThread(thread_id_t(-1)), mLock("Thread::mLock"), mStatus(NO_ERROR), mExitPending(false), mRunning(false) #ifdef HAVE_ANDROID_OS , mTid(-1) #endif { } Thread::~Thread() { } status_t Thread::readyToRun() { return NO_ERROR; } status_t Thread::run(const char* name, int32_t priority, size_t stack) { Mutex::Autolock _l(mLock); if (mRunning) { // thread already started return INVALID_OPERATION; } // reset status and exitPending to their default value, so we can // try again after an error happened (either below, or in readyToRun()) mStatus = NO_ERROR; mExitPending = false; mThread = thread_id_t(-1); // hold a strong reference on ourself mHoldSelf = this; mRunning = true; bool res; if (mCanCallJava) { res = createThreadEtc(_threadLoop, this, name, priority, stack, &mThread); } else { res = androidCreateRawThreadEtc(_threadLoop, this, name, priority, stack, &mThread); } if (res == false) { mStatus = UNKNOWN_ERROR; // something happened! mRunning = false; mThread = thread_id_t(-1); mHoldSelf.clear(); // "this" may have gone away after this. return UNKNOWN_ERROR; } // Do not refer to mStatus here: The thread is already running (may, in fact // already have exited with a valid mStatus result). The NO_ERROR indication // here merely indicates successfully starting the thread and does not // imply successful termination/execution. return NO_ERROR; // Exiting scope of mLock is a memory barrier and allows new thread to run } int Thread::_threadLoop(void* user) { Thread* const self = static_cast(user); sp strong(self->mHoldSelf); wp weak(strong); self->mHoldSelf.clear(); #ifdef HAVE_ANDROID_OS // this is very useful for debugging with gdb self->mTid = gettid(); #endif bool first = true; do { bool result; if (first) { first = false; self->mStatus = self->readyToRun(); result = (self->mStatus == NO_ERROR); if (result && !self->exitPending()) { // Binder threads (and maybe others) rely on threadLoop // running at least once after a successful ::readyToRun() // (unless, of course, the thread has already been asked to exit // at that point). // This is because threads are essentially used like this: // (new ThreadSubclass())->run(); // The caller therefore does not retain a strong reference to // the thread and the thread would simply disappear after the // successful ::readyToRun() call instead of entering the // threadLoop at least once. result = self->threadLoop(); } } else { result = self->threadLoop(); } // establish a scope for mLock { Mutex::Autolock _l(self->mLock); if (result == false || self->mExitPending) { self->mExitPending = true; self->mRunning = false; // clear thread ID so that requestExitAndWait() does not exit if // called by a new thread using the same thread ID as this one. self->mThread = thread_id_t(-1); // note that interested observers blocked in requestExitAndWait are // awoken by broadcast, but blocked on mLock until break exits scope self->mThreadExitedCondition.broadcast(); break; } } // Release our strong reference, to let a chance to the thread // to die a peaceful death. strong.clear(); // And immediately, re-acquire a strong reference for the next loop strong = weak.promote(); } while(strong != 0); return 0; } void Thread::requestExit() { Mutex::Autolock _l(mLock); mExitPending = true; } status_t Thread::requestExitAndWait() { Mutex::Autolock _l(mLock); if (mThread == getThreadId()) { ALOGW( "Thread (this=%p): don't call waitForExit() from this " "Thread object's thread. It's a guaranteed deadlock!", this); return WOULD_BLOCK; } mExitPending = true; while (mRunning == true) { mThreadExitedCondition.wait(mLock); } // This next line is probably not needed any more, but is being left for // historical reference. Note that each interested party will clear flag. mExitPending = false; return mStatus; } status_t Thread::join() { Mutex::Autolock _l(mLock); if (mThread == getThreadId()) { ALOGW( "Thread (this=%p): don't call join() from this " "Thread object's thread. It's a guaranteed deadlock!", this); return WOULD_BLOCK; } while (mRunning == true) { mThreadExitedCondition.wait(mLock); } return mStatus; } bool Thread::exitPending() const { Mutex::Autolock _l(mLock); return mExitPending; } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/Asset.cpp0000644000015700001700000005236712200324306023400 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Provide access to a read-only asset. // #define LOG_TAG "asset" //#define NDEBUG 0 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace android; #ifndef O_BINARY # define O_BINARY 0 #endif static Mutex gAssetLock; static int32_t gCount = 0; static Asset* gHead = NULL; static Asset* gTail = NULL; int32_t Asset::getGlobalCount() { AutoMutex _l(gAssetLock); return gCount; } String8 Asset::getAssetAllocations() { AutoMutex _l(gAssetLock); String8 res; Asset* cur = gHead; while (cur != NULL) { if (cur->isAllocated()) { res.append(" "); res.append(cur->getAssetSource()); off64_t size = (cur->getLength()+512)/1024; char buf[64]; sprintf(buf, ": %dK\n", (int)size); res.append(buf); } cur = cur->mNext; } return res; } Asset::Asset(void) : mAccessMode(ACCESS_UNKNOWN) { AutoMutex _l(gAssetLock); gCount++; mNext = mPrev = NULL; if (gTail == NULL) { gHead = gTail = this; } else { mPrev = gTail; gTail->mNext = this; gTail = this; } //ALOGI("Creating Asset %p #%d\n", this, gCount); } Asset::~Asset(void) { AutoMutex _l(gAssetLock); gCount--; if (gHead == this) { gHead = mNext; } if (gTail == this) { gTail = mPrev; } if (mNext != NULL) { mNext->mPrev = mPrev; } if (mPrev != NULL) { mPrev->mNext = mNext; } mNext = mPrev = NULL; //ALOGI("Destroying Asset in %p #%d\n", this, gCount); } /* * Create a new Asset from a file on disk. There is a fair chance that * the file doesn't actually exist. * * We can use "mode" to decide how we want to go about it. */ /*static*/ Asset* Asset::createFromFile(const char* fileName, AccessMode mode) { _FileAsset* pAsset; status_t result; off64_t length; int fd; fd = open(fileName, O_RDONLY | O_BINARY); if (fd < 0) return NULL; /* * Under Linux, the lseek fails if we actually opened a directory. To * be correct we should test the file type explicitly, but since we * always open things read-only it doesn't really matter, so there's * no value in incurring the extra overhead of an fstat() call. */ // TODO(kroot): replace this with fstat despite the plea above. #if 1 length = lseek64(fd, 0, SEEK_END); if (length < 0) { ::close(fd); return NULL; } (void) lseek64(fd, 0, SEEK_SET); #else struct stat st; if (fstat(fd, &st) < 0) { ::close(fd); return NULL; } if (!S_ISREG(st.st_mode)) { ::close(fd); return NULL; } #endif pAsset = new _FileAsset; result = pAsset->openChunk(fileName, fd, 0, length); if (result != NO_ERROR) { delete pAsset; return NULL; } pAsset->mAccessMode = mode; return pAsset; } /* * Create a new Asset from a compressed file on disk. There is a fair chance * that the file doesn't actually exist. * * We currently support gzip files. We might want to handle .bz2 someday. */ /*static*/ Asset* Asset::createFromCompressedFile(const char* fileName, AccessMode mode) { _CompressedAsset* pAsset; status_t result; off64_t fileLen; bool scanResult; long offset; int method; long uncompressedLen, compressedLen; int fd; fd = open(fileName, O_RDONLY | O_BINARY); if (fd < 0) return NULL; fileLen = lseek(fd, 0, SEEK_END); if (fileLen < 0) { ::close(fd); return NULL; } (void) lseek(fd, 0, SEEK_SET); /* want buffered I/O for the file scan; must dup so fclose() is safe */ FILE* fp = fdopen(dup(fd), "rb"); if (fp == NULL) { ::close(fd); return NULL; } unsigned long crc32; scanResult = ZipUtils::examineGzip(fp, &method, &uncompressedLen, &compressedLen, &crc32); offset = ftell(fp); fclose(fp); if (!scanResult) { ALOGD("File '%s' is not in gzip format\n", fileName); ::close(fd); return NULL; } pAsset = new _CompressedAsset; result = pAsset->openChunk(fd, offset, method, uncompressedLen, compressedLen); if (result != NO_ERROR) { delete pAsset; return NULL; } pAsset->mAccessMode = mode; return pAsset; } #if 0 /* * Create a new Asset from part of an open file. */ /*static*/ Asset* Asset::createFromFileSegment(int fd, off64_t offset, size_t length, AccessMode mode) { _FileAsset* pAsset; status_t result; pAsset = new _FileAsset; result = pAsset->openChunk(NULL, fd, offset, length); if (result != NO_ERROR) return NULL; pAsset->mAccessMode = mode; return pAsset; } /* * Create a new Asset from compressed data in an open file. */ /*static*/ Asset* Asset::createFromCompressedData(int fd, off64_t offset, int compressionMethod, size_t uncompressedLen, size_t compressedLen, AccessMode mode) { _CompressedAsset* pAsset; status_t result; pAsset = new _CompressedAsset; result = pAsset->openChunk(fd, offset, compressionMethod, uncompressedLen, compressedLen); if (result != NO_ERROR) return NULL; pAsset->mAccessMode = mode; return pAsset; } #endif /* * Create a new Asset from a memory mapping. */ /*static*/ Asset* Asset::createFromUncompressedMap(FileMap* dataMap, AccessMode mode) { _FileAsset* pAsset; status_t result; pAsset = new _FileAsset; result = pAsset->openChunk(dataMap); if (result != NO_ERROR) return NULL; pAsset->mAccessMode = mode; return pAsset; } /* * Create a new Asset from compressed data in a memory mapping. */ /*static*/ Asset* Asset::createFromCompressedMap(FileMap* dataMap, int method, size_t uncompressedLen, AccessMode mode) { _CompressedAsset* pAsset; status_t result; pAsset = new _CompressedAsset; result = pAsset->openChunk(dataMap, method, uncompressedLen); if (result != NO_ERROR) return NULL; pAsset->mAccessMode = mode; return pAsset; } /* * Do generic seek() housekeeping. Pass in the offset/whence values from * the seek request, along with the current chunk offset and the chunk * length. * * Returns the new chunk offset, or -1 if the seek is illegal. */ off64_t Asset::handleSeek(off64_t offset, int whence, off64_t curPosn, off64_t maxPosn) { off64_t newOffset; switch (whence) { case SEEK_SET: newOffset = offset; break; case SEEK_CUR: newOffset = curPosn + offset; break; case SEEK_END: newOffset = maxPosn + offset; break; default: ALOGW("unexpected whence %d\n", whence); // this was happening due to an off64_t size mismatch assert(false); return (off64_t) -1; } if (newOffset < 0 || newOffset > maxPosn) { ALOGW("seek out of range: want %ld, end=%ld\n", (long) newOffset, (long) maxPosn); return (off64_t) -1; } return newOffset; } /* * =========================================================================== * _FileAsset * =========================================================================== */ /* * Constructor. */ _FileAsset::_FileAsset(void) : mStart(0), mLength(0), mOffset(0), mFp(NULL), mFileName(NULL), mMap(NULL), mBuf(NULL) { } /* * Destructor. Release resources. */ _FileAsset::~_FileAsset(void) { close(); } /* * Operate on a chunk of an uncompressed file. * * Zero-length chunks are allowed. */ status_t _FileAsset::openChunk(const char* fileName, int fd, off64_t offset, size_t length) { assert(mFp == NULL); // no reopen assert(mMap == NULL); assert(fd >= 0); assert(offset >= 0); /* * Seek to end to get file length. */ off64_t fileLength; fileLength = lseek64(fd, 0, SEEK_END); if (fileLength == (off64_t) -1) { // probably a bad file descriptor ALOGD("failed lseek (errno=%d)\n", errno); return UNKNOWN_ERROR; } if ((off64_t) (offset + length) > fileLength) { ALOGD("start (%ld) + len (%ld) > end (%ld)\n", (long) offset, (long) length, (long) fileLength); return BAD_INDEX; } /* after fdopen, the fd will be closed on fclose() */ mFp = fdopen(fd, "rb"); if (mFp == NULL) return UNKNOWN_ERROR; mStart = offset; mLength = length; assert(mOffset == 0); /* seek the FILE* to the start of chunk */ if (fseek(mFp, mStart, SEEK_SET) != 0) { assert(false); } mFileName = fileName != NULL ? strdup(fileName) : NULL; return NO_ERROR; } /* * Create the chunk from the map. */ status_t _FileAsset::openChunk(FileMap* dataMap) { assert(mFp == NULL); // no reopen assert(mMap == NULL); assert(dataMap != NULL); mMap = dataMap; mStart = -1; // not used mLength = dataMap->getDataLength(); assert(mOffset == 0); return NO_ERROR; } /* * Read a chunk of data. */ ssize_t _FileAsset::read(void* buf, size_t count) { size_t maxLen; size_t actual; assert(mOffset >= 0 && mOffset <= mLength); if (getAccessMode() == ACCESS_BUFFER) { /* * On first access, read or map the entire file. The caller has * requested buffer access, either because they're going to be * using the buffer or because what they're doing has appropriate * performance needs and access patterns. */ if (mBuf == NULL) getBuffer(false); } /* adjust count if we're near EOF */ maxLen = mLength - mOffset; if (count > maxLen) count = maxLen; if (!count) return 0; if (mMap != NULL) { /* copy from mapped area */ //printf("map read\n"); memcpy(buf, (char*)mMap->getDataPtr() + mOffset, count); actual = count; } else if (mBuf != NULL) { /* copy from buffer */ //printf("buf read\n"); memcpy(buf, (char*)mBuf + mOffset, count); actual = count; } else { /* read from the file */ //printf("file read\n"); if (ftell(mFp) != mStart + mOffset) { ALOGE("Hosed: %ld != %ld+%ld\n", ftell(mFp), (long) mStart, (long) mOffset); assert(false); } /* * This returns 0 on error or eof. We need to use ferror() or feof() * to tell the difference, but we don't currently have those on the * device. However, we know how much data is *supposed* to be in the * file, so if we don't read the full amount we know something is * hosed. */ actual = fread(buf, 1, count, mFp); if (actual == 0) // something failed -- I/O error? return -1; assert(actual == count); } mOffset += actual; return actual; } /* * Seek to a new position. */ off64_t _FileAsset::seek(off64_t offset, int whence) { off64_t newPosn; off64_t actualOffset; // compute new position within chunk newPosn = handleSeek(offset, whence, mOffset, mLength); if (newPosn == (off64_t) -1) return newPosn; actualOffset = mStart + newPosn; if (mFp != NULL) { if (fseek(mFp, (long) actualOffset, SEEK_SET) != 0) return (off64_t) -1; } mOffset = actualOffset - mStart; return mOffset; } /* * Close the asset. */ void _FileAsset::close(void) { if (mMap != NULL) { mMap->release(); mMap = NULL; } if (mBuf != NULL) { delete[] mBuf; mBuf = NULL; } if (mFileName != NULL) { free(mFileName); mFileName = NULL; } if (mFp != NULL) { // can only be NULL when called from destructor // (otherwise we would never return this object) fclose(mFp); mFp = NULL; } } /* * Return a read-only pointer to a buffer. * * We can either read the whole thing in or map the relevant piece of * the source file. Ideally a map would be established at a higher * level and we'd be using a different object, but we didn't, so we * deal with it here. */ const void* _FileAsset::getBuffer(bool wordAligned) { /* subsequent requests just use what we did previously */ if (mBuf != NULL) return mBuf; if (mMap != NULL) { if (!wordAligned) { return mMap->getDataPtr(); } return ensureAlignment(mMap); } assert(mFp != NULL); if (mLength < kReadVsMapThreshold) { unsigned char* buf; long allocLen; /* zero-length files are allowed; not sure about zero-len allocs */ /* (works fine with gcc + x86linux) */ allocLen = mLength; if (mLength == 0) allocLen = 1; buf = new unsigned char[allocLen]; if (buf == NULL) { ALOGE("alloc of %ld bytes failed\n", (long) allocLen); return NULL; } ALOGV("Asset %p allocating buffer size %d (smaller than threshold)", this, (int)allocLen); if (mLength > 0) { long oldPosn = ftell(mFp); fseek(mFp, mStart, SEEK_SET); if (fread(buf, 1, mLength, mFp) != (size_t) mLength) { ALOGE("failed reading %ld bytes\n", (long) mLength); delete[] buf; return NULL; } fseek(mFp, oldPosn, SEEK_SET); } ALOGV(" getBuffer: loaded into buffer\n"); mBuf = buf; return mBuf; } else { FileMap* map; map = new FileMap; if (!map->create(NULL, fileno(mFp), mStart, mLength, true)) { map->release(); return NULL; } ALOGV(" getBuffer: mapped\n"); mMap = map; if (!wordAligned) { return mMap->getDataPtr(); } return ensureAlignment(mMap); } } int _FileAsset::openFileDescriptor(off64_t* outStart, off64_t* outLength) const { if (mMap != NULL) { const char* fname = mMap->getFileName(); if (fname == NULL) { fname = mFileName; } if (fname == NULL) { return -1; } *outStart = mMap->getDataOffset(); *outLength = mMap->getDataLength(); return open(fname, O_RDONLY | O_BINARY); } if (mFileName == NULL) { return -1; } *outStart = mStart; *outLength = mLength; return open(mFileName, O_RDONLY | O_BINARY); } const void* _FileAsset::ensureAlignment(FileMap* map) { void* data = map->getDataPtr(); if ((((size_t)data)&0x3) == 0) { // We can return this directly if it is aligned on a word // boundary. ALOGV("Returning aligned FileAsset %p (%s).", this, getAssetSource()); return data; } // If not aligned on a word boundary, then we need to copy it into // our own buffer. ALOGV("Copying FileAsset %p (%s) to buffer size %d to make it aligned.", this, getAssetSource(), (int)mLength); unsigned char* buf = new unsigned char[mLength]; if (buf == NULL) { ALOGE("alloc of %ld bytes failed\n", (long) mLength); return NULL; } memcpy(buf, data, mLength); mBuf = buf; return buf; } /* * =========================================================================== * _CompressedAsset * =========================================================================== */ /* * Constructor. */ _CompressedAsset::_CompressedAsset(void) : mStart(0), mCompressedLen(0), mUncompressedLen(0), mOffset(0), mMap(NULL), mFd(-1), mZipInflater(NULL), mBuf(NULL) { } /* * Destructor. Release resources. */ _CompressedAsset::~_CompressedAsset(void) { close(); } /* * Open a chunk of compressed data inside a file. * * This currently just sets up some values and returns. On the first * read, we expand the entire file into a buffer and return data from it. */ status_t _CompressedAsset::openChunk(int fd, off64_t offset, int compressionMethod, size_t uncompressedLen, size_t compressedLen) { assert(mFd < 0); // no re-open assert(mMap == NULL); assert(fd >= 0); assert(offset >= 0); assert(compressedLen > 0); if (compressionMethod != ZipFileRO::kCompressDeflated) { assert(false); return UNKNOWN_ERROR; } mStart = offset; mCompressedLen = compressedLen; mUncompressedLen = uncompressedLen; assert(mOffset == 0); mFd = fd; assert(mBuf == NULL); if (uncompressedLen > StreamingZipInflater::OUTPUT_CHUNK_SIZE) { mZipInflater = new StreamingZipInflater(mFd, offset, uncompressedLen, compressedLen); } return NO_ERROR; } /* * Open a chunk of compressed data in a mapped region. * * Nothing is expanded until the first read call. */ status_t _CompressedAsset::openChunk(FileMap* dataMap, int compressionMethod, size_t uncompressedLen) { assert(mFd < 0); // no re-open assert(mMap == NULL); assert(dataMap != NULL); if (compressionMethod != ZipFileRO::kCompressDeflated) { assert(false); return UNKNOWN_ERROR; } mMap = dataMap; mStart = -1; // not used mCompressedLen = dataMap->getDataLength(); mUncompressedLen = uncompressedLen; assert(mOffset == 0); if (uncompressedLen > StreamingZipInflater::OUTPUT_CHUNK_SIZE) { mZipInflater = new StreamingZipInflater(dataMap, uncompressedLen); } return NO_ERROR; } /* * Read data from a chunk of compressed data. * * [For now, that's just copying data out of a buffer.] */ ssize_t _CompressedAsset::read(void* buf, size_t count) { size_t maxLen; size_t actual; assert(mOffset >= 0 && mOffset <= mUncompressedLen); /* If we're relying on a streaming inflater, go through that */ if (mZipInflater) { actual = mZipInflater->read(buf, count); } else { if (mBuf == NULL) { if (getBuffer(false) == NULL) return -1; } assert(mBuf != NULL); /* adjust count if we're near EOF */ maxLen = mUncompressedLen - mOffset; if (count > maxLen) count = maxLen; if (!count) return 0; /* copy from buffer */ //printf("comp buf read\n"); memcpy(buf, (char*)mBuf + mOffset, count); actual = count; } mOffset += actual; return actual; } /* * Handle a seek request. * * If we're working in a streaming mode, this is going to be fairly * expensive, because it requires plowing through a bunch of compressed * data. */ off64_t _CompressedAsset::seek(off64_t offset, int whence) { off64_t newPosn; // compute new position within chunk newPosn = handleSeek(offset, whence, mOffset, mUncompressedLen); if (newPosn == (off64_t) -1) return newPosn; if (mZipInflater) { mZipInflater->seekAbsolute(newPosn); } mOffset = newPosn; return mOffset; } /* * Close the asset. */ void _CompressedAsset::close(void) { if (mMap != NULL) { mMap->release(); mMap = NULL; } delete[] mBuf; mBuf = NULL; delete mZipInflater; mZipInflater = NULL; if (mFd > 0) { ::close(mFd); mFd = -1; } } /* * Get a pointer to a read-only buffer of data. * * The first time this is called, we expand the compressed data into a * buffer. */ const void* _CompressedAsset::getBuffer(bool wordAligned) { unsigned char* buf = NULL; if (mBuf != NULL) return mBuf; /* * Allocate a buffer and read the file into it. */ buf = new unsigned char[mUncompressedLen]; if (buf == NULL) { ALOGW("alloc %ld bytes failed\n", (long) mUncompressedLen); goto bail; } if (mMap != NULL) { if (!ZipFileRO::inflateBuffer(buf, mMap->getDataPtr(), mUncompressedLen, mCompressedLen)) goto bail; } else { assert(mFd >= 0); /* * Seek to the start of the compressed data. */ if (lseek(mFd, mStart, SEEK_SET) != mStart) goto bail; /* * Expand the data into it. */ if (!ZipUtils::inflateToBuffer(mFd, buf, mUncompressedLen, mCompressedLen)) goto bail; } /* * Success - now that we have the full asset in RAM we * no longer need the streaming inflater */ delete mZipInflater; mZipInflater = NULL; mBuf = buf; buf = NULL; bail: delete[] buf; return mBuf; } android-audiosystem-1.8+13.10.20130807/lib/utils/SharedBuffer.cpp0000644000015700001700000000535412200324306024653 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include // --------------------------------------------------------------------------- namespace android { SharedBuffer* SharedBuffer::alloc(size_t size) { SharedBuffer* sb = static_cast(malloc(sizeof(SharedBuffer) + size)); if (sb) { sb->mRefs = 1; sb->mSize = size; } return sb; } ssize_t SharedBuffer::dealloc(const SharedBuffer* released) { if (released->mRefs != 0) return -1; // XXX: invalid operation free(const_cast(released)); return 0; } SharedBuffer* SharedBuffer::edit() const { if (onlyOwner()) { return const_cast(this); } SharedBuffer* sb = alloc(mSize); if (sb) { memcpy(sb->data(), data(), size()); release(); } return sb; } SharedBuffer* SharedBuffer::editResize(size_t newSize) const { if (onlyOwner()) { SharedBuffer* buf = const_cast(this); if (buf->mSize == newSize) return buf; buf = (SharedBuffer*)realloc(buf, sizeof(SharedBuffer) + newSize); if (buf != NULL) { buf->mSize = newSize; return buf; } } SharedBuffer* sb = alloc(newSize); if (sb) { const size_t mySize = mSize; memcpy(sb->data(), data(), newSize < mySize ? newSize : mySize); release(); } return sb; } SharedBuffer* SharedBuffer::attemptEdit() const { if (onlyOwner()) { return const_cast(this); } return 0; } SharedBuffer* SharedBuffer::reset(size_t new_size) const { // cheap-o-reset. SharedBuffer* sb = alloc(new_size); if (sb) { release(); } return sb; } void SharedBuffer::acquire() const { android_atomic_inc(&mRefs); } int32_t SharedBuffer::release(uint32_t flags) const { int32_t prev = 1; if (onlyOwner() || ((prev = android_atomic_dec(&mRefs)) == 1)) { mRefs = 0; if ((flags & eKeepStorage) == 0) { free(const_cast(this)); } } return prev; } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/AssetManager.cpp0000644000015700001700000017125212200324306024666 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Provide access to read-only assets. // #define LOG_TAG "asset" //#define LOG_NDEBUG 0 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef TEMP_FAILURE_RETRY /* Used to retry syscalls that can return EINTR. */ #define TEMP_FAILURE_RETRY(exp) ({ \ typeof (exp) _rc; \ do { \ _rc = (exp); \ } while (_rc == -1 && errno == EINTR); \ _rc; }) #endif using namespace android; /* * Names for default app, locale, and vendor. We might want to change * these to be an actual locale, e.g. always use en-US as the default. */ static const char* kDefaultLocale = "default"; static const char* kDefaultVendor = "default"; static const char* kAssetsRoot = "assets"; static const char* kAppZipName = NULL; //"classes.jar"; static const char* kSystemAssets = "framework/framework-res.apk"; static const char* kIdmapCacheDir = "resource-cache"; static const char* kExcludeExtension = ".EXCLUDE"; static Asset* const kExcludedAsset = (Asset*) 0xd000000d; static volatile int32_t gCount = 0; namespace { // Transform string /a/b/c.apk to /data/resource-cache/a@b@c.apk@idmap String8 idmapPathForPackagePath(const String8& pkgPath) { const char* root = getenv("ANDROID_DATA"); LOG_ALWAYS_FATAL_IF(root == NULL, "ANDROID_DATA not set"); String8 path(root); path.appendPath(kIdmapCacheDir); char buf[256]; // 256 chars should be enough for anyone... strncpy(buf, pkgPath.string(), 255); buf[255] = '\0'; char* filename = buf; while (*filename && *filename == '/') { ++filename; } char* p = filename; while (*p) { if (*p == '/') { *p = '@'; } ++p; } path.appendPath(filename); path.append("@idmap"); return path; } } /* * =========================================================================== * AssetManager * =========================================================================== */ int32_t AssetManager::getGlobalCount() { return gCount; } AssetManager::AssetManager(CacheMode cacheMode) : mLocale(NULL), mVendor(NULL), mResources(NULL), mConfig(new ResTable_config), mCacheMode(cacheMode), mCacheValid(false) { int count = android_atomic_inc(&gCount)+1; //ALOGI("Creating AssetManager %p #%d\n", this, count); memset(mConfig, 0, sizeof(ResTable_config)); } AssetManager::~AssetManager(void) { int count = android_atomic_dec(&gCount); //ALOGI("Destroying AssetManager in %p #%d\n", this, count); delete mConfig; delete mResources; // don't have a String class yet, so make sure we clean up delete[] mLocale; delete[] mVendor; } bool AssetManager::addAssetPath(const String8& path, void** cookie) { AutoMutex _l(mLock); asset_path ap; String8 realPath(path); if (kAppZipName) { realPath.appendPath(kAppZipName); } ap.type = ::getFileType(realPath.string()); if (ap.type == kFileTypeRegular) { ap.path = realPath; } else { ap.path = path; ap.type = ::getFileType(path.string()); if (ap.type != kFileTypeDirectory && ap.type != kFileTypeRegular) { ALOGW("Asset path %s is neither a directory nor file (type=%d).", path.string(), (int)ap.type); return false; } } // Skip if we have it already. for (size_t i=0; ifindEntryByName(entryFilename); if (entry == NULL) { return false; } if (!zip->getEntryInfo(entry, NULL, NULL, NULL, NULL, NULL, (long*)pCrc)) { return false; } return true; } bool AssetManager::createIdmapFileLocked(const String8& originalPath, const String8& overlayPath, const String8& idmapPath) { ALOGD("%s: originalPath=%s overlayPath=%s idmapPath=%s\n", __FUNCTION__, originalPath.string(), overlayPath.string(), idmapPath.string()); ResTable tables[2]; const String8* paths[2] = { &originalPath, &overlayPath }; uint32_t originalCrc, overlayCrc; bool retval = false; ssize_t offset = 0; int fd = 0; uint32_t* data = NULL; size_t size; for (int i = 0; i < 2; ++i) { asset_path ap; ap.type = kFileTypeRegular; ap.path = *paths[i]; Asset* ass = openNonAssetInPathLocked("resources.arsc", Asset::ACCESS_BUFFER, ap); if (ass == NULL) { ALOGW("failed to find resources.arsc in %s\n", ap.path.string()); goto error; } tables[i].add(ass, (void*)1, false); } if (!getZipEntryCrcLocked(originalPath, "resources.arsc", &originalCrc)) { ALOGW("failed to retrieve crc for resources.arsc in %s\n", originalPath.string()); goto error; } if (!getZipEntryCrcLocked(overlayPath, "resources.arsc", &overlayCrc)) { ALOGW("failed to retrieve crc for resources.arsc in %s\n", overlayPath.string()); goto error; } if (tables[0].createIdmap(tables[1], originalCrc, overlayCrc, (void**)&data, &size) != NO_ERROR) { ALOGW("failed to generate idmap data for file %s\n", idmapPath.string()); goto error; } // This should be abstracted (eg replaced by a stand-alone // application like dexopt, triggered by something equivalent to // installd). fd = TEMP_FAILURE_RETRY(::open(idmapPath.string(), O_WRONLY | O_CREAT | O_TRUNC, 0644)); if (fd == -1) { ALOGW("failed to write idmap file %s (open: %s)\n", idmapPath.string(), strerror(errno)); goto error_free; } for (;;) { ssize_t written = TEMP_FAILURE_RETRY(write(fd, data + offset, size)); if (written < 0) { ALOGW("failed to write idmap file %s (write: %s)\n", idmapPath.string(), strerror(errno)); goto error_close; } size -= (size_t)written; offset += written; if (size == 0) { break; } } retval = true; error_close: TEMP_FAILURE_RETRY(close(fd)); error_free: free(data); error: return retval; } bool AssetManager::addDefaultAssets() { const char* root = getenv("ANDROID_ROOT"); LOG_ALWAYS_FATAL_IF(root == NULL, "ANDROID_ROOT not set"); String8 path(root); path.appendPath(kSystemAssets); return addAssetPath(path, NULL); } void* AssetManager::nextAssetPath(void* cookie) const { AutoMutex _l(mLock); size_t next = ((size_t)cookie)+1; return next > mAssetPaths.size() ? NULL : (void*)next; } String8 AssetManager::getAssetPath(void* cookie) const { AutoMutex _l(mLock); const size_t which = ((size_t)cookie)-1; if (which < mAssetPaths.size()) { return mAssetPaths[which].path; } return String8(); } /* * Set the current locale. Use NULL to indicate no locale. * * Close and reopen Zip archives as appropriate, and reset cached * information in the locale-specific sections of the tree. */ void AssetManager::setLocale(const char* locale) { AutoMutex _l(mLock); setLocaleLocked(locale); } void AssetManager::setLocaleLocked(const char* locale) { if (mLocale != NULL) { /* previously set, purge cached data */ purgeFileNameCacheLocked(); //mZipSet.purgeLocale(); delete[] mLocale; } mLocale = strdupNew(locale); updateResourceParamsLocked(); } /* * Set the current vendor. Use NULL to indicate no vendor. * * Close and reopen Zip archives as appropriate, and reset cached * information in the vendor-specific sections of the tree. */ void AssetManager::setVendor(const char* vendor) { AutoMutex _l(mLock); if (mVendor != NULL) { /* previously set, purge cached data */ purgeFileNameCacheLocked(); //mZipSet.purgeVendor(); delete[] mVendor; } mVendor = strdupNew(vendor); } void AssetManager::setConfiguration(const ResTable_config& config, const char* locale) { AutoMutex _l(mLock); *mConfig = config; if (locale) { setLocaleLocked(locale); } else if (config.language[0] != 0) { char spec[9]; spec[0] = config.language[0]; spec[1] = config.language[1]; if (config.country[0] != 0) { spec[2] = '_'; spec[3] = config.country[0]; spec[4] = config.country[1]; spec[5] = 0; } else { spec[3] = 0; } setLocaleLocked(spec); } else { updateResourceParamsLocked(); } } void AssetManager::getConfiguration(ResTable_config* outConfig) const { AutoMutex _l(mLock); *outConfig = *mConfig; } /* * Open an asset. * * The data could be; * - In a file on disk (assetBase + fileName). * - In a compressed file on disk (assetBase + fileName.gz). * - In a Zip archive, uncompressed or compressed. * * It can be in a number of different directories and Zip archives. * The search order is: * - [appname] * - locale + vendor * - "default" + vendor * - locale + "default" * - "default + "default" * - "common" * - (same as above) * * To find a particular file, we have to try up to eight paths with * all three forms of data. * * We should probably reject requests for "illegal" filenames, e.g. those * with illegal characters or "../" backward relative paths. */ Asset* AssetManager::open(const char* fileName, AccessMode mode) { AutoMutex _l(mLock); LOG_FATAL_IF(mAssetPaths.size() == 0, "No assets added to AssetManager"); if (mCacheMode != CACHE_OFF && !mCacheValid) loadFileNameCacheLocked(); String8 assetName(kAssetsRoot); assetName.appendPath(fileName); /* * For each top-level asset path, search for the asset. */ size_t i = mAssetPaths.size(); while (i > 0) { i--; ALOGV("Looking for asset '%s' in '%s'\n", assetName.string(), mAssetPaths.itemAt(i).path.string()); Asset* pAsset = openNonAssetInPathLocked(assetName.string(), mode, mAssetPaths.itemAt(i)); if (pAsset != NULL) { return pAsset != kExcludedAsset ? pAsset : NULL; } } return NULL; } /* * Open a non-asset file as if it were an asset. * * The "fileName" is the partial path starting from the application * name. */ Asset* AssetManager::openNonAsset(const char* fileName, AccessMode mode) { AutoMutex _l(mLock); LOG_FATAL_IF(mAssetPaths.size() == 0, "No assets added to AssetManager"); if (mCacheMode != CACHE_OFF && !mCacheValid) loadFileNameCacheLocked(); /* * For each top-level asset path, search for the asset. */ size_t i = mAssetPaths.size(); while (i > 0) { i--; ALOGV("Looking for non-asset '%s' in '%s'\n", fileName, mAssetPaths.itemAt(i).path.string()); Asset* pAsset = openNonAssetInPathLocked( fileName, mode, mAssetPaths.itemAt(i)); if (pAsset != NULL) { return pAsset != kExcludedAsset ? pAsset : NULL; } } return NULL; } Asset* AssetManager::openNonAsset(void* cookie, const char* fileName, AccessMode mode) { const size_t which = ((size_t)cookie)-1; AutoMutex _l(mLock); LOG_FATAL_IF(mAssetPaths.size() == 0, "No assets added to AssetManager"); if (mCacheMode != CACHE_OFF && !mCacheValid) loadFileNameCacheLocked(); if (which < mAssetPaths.size()) { ALOGV("Looking for non-asset '%s' in '%s'\n", fileName, mAssetPaths.itemAt(which).path.string()); Asset* pAsset = openNonAssetInPathLocked( fileName, mode, mAssetPaths.itemAt(which)); if (pAsset != NULL) { return pAsset != kExcludedAsset ? pAsset : NULL; } } return NULL; } /* * Get the type of a file in the asset namespace. * * This currently only works for regular files. All others (including * directories) will return kFileTypeNonexistent. */ FileType AssetManager::getFileType(const char* fileName) { Asset* pAsset = NULL; /* * Open the asset. This is less efficient than simply finding the * file, but it's not too bad (we don't uncompress or mmap data until * the first read() call). */ pAsset = open(fileName, Asset::ACCESS_STREAMING); delete pAsset; if (pAsset == NULL) return kFileTypeNonexistent; else return kFileTypeRegular; } const ResTable* AssetManager::getResTable(bool required) const { ResTable* rt = mResources; if (rt) { return rt; } // Iterate through all asset packages, collecting resources from each. AutoMutex _l(mLock); if (mResources != NULL) { return mResources; } if (required) { LOG_FATAL_IF(mAssetPaths.size() == 0, "No assets added to AssetManager"); } if (mCacheMode != CACHE_OFF && !mCacheValid) const_cast(this)->loadFileNameCacheLocked(); const size_t N = mAssetPaths.size(); for (size_t i=0; i(this)-> mZipSet.getZipResourceTable(ap.path); } if (sharedRes == NULL) { ass = const_cast(this)-> mZipSet.getZipResourceTableAsset(ap.path); if (ass == NULL) { ALOGV("loading resource table %s\n", ap.path.string()); ass = const_cast(this)-> openNonAssetInPathLocked("resources.arsc", Asset::ACCESS_BUFFER, ap); if (ass != NULL && ass != kExcludedAsset) { ass = const_cast(this)-> mZipSet.setZipResourceTableAsset(ap.path, ass); } } if (i == 0 && ass != NULL) { // If this is the first resource table in the asset // manager, then we are going to cache it so that we // can quickly copy it out for others. ALOGV("Creating shared resources for %s", ap.path.string()); sharedRes = new ResTable(); sharedRes->add(ass, (void*)(i+1), false, idmap); sharedRes = const_cast(this)-> mZipSet.setZipResourceTable(ap.path, sharedRes); } } } else { ALOGV("loading resource table %s\n", ap.path.string()); Asset* ass = const_cast(this)-> openNonAssetInPathLocked("resources.arsc", Asset::ACCESS_BUFFER, ap); shared = false; } if ((ass != NULL || sharedRes != NULL) && ass != kExcludedAsset) { if (rt == NULL) { mResources = rt = new ResTable(); updateResourceParamsLocked(); } ALOGV("Installing resource asset %p in to table %p\n", ass, mResources); if (sharedRes != NULL) { ALOGV("Copying existing resources for %s", ap.path.string()); rt->add(sharedRes); } else { ALOGV("Parsing resources for %s", ap.path.string()); rt->add(ass, (void*)(i+1), !shared, idmap); } if (!shared) { delete ass; } } if (idmap != NULL) { delete idmap; } } if (required && !rt) ALOGW("Unable to find resources file resources.arsc"); if (!rt) { mResources = rt = new ResTable(); } return rt; } void AssetManager::updateResourceParamsLocked() const { ResTable* res = mResources; if (!res) { return; } size_t llen = mLocale ? strlen(mLocale) : 0; mConfig->language[0] = 0; mConfig->language[1] = 0; mConfig->country[0] = 0; mConfig->country[1] = 0; if (llen >= 2) { mConfig->language[0] = mLocale[0]; mConfig->language[1] = mLocale[1]; } if (llen >= 5) { mConfig->country[0] = mLocale[3]; mConfig->country[1] = mLocale[4]; } mConfig->size = sizeof(*mConfig); res->setParameters(mConfig); } Asset* AssetManager::openIdmapLocked(const struct asset_path& ap) const { Asset* ass = NULL; if (ap.idmap.size() != 0) { ass = const_cast(this)-> openAssetFromFileLocked(ap.idmap, Asset::ACCESS_BUFFER); if (ass) { ALOGV("loading idmap %s\n", ap.idmap.string()); } else { ALOGW("failed to load idmap %s\n", ap.idmap.string()); } } return ass; } const ResTable& AssetManager::getResources(bool required) const { const ResTable* rt = getResTable(required); return *rt; } bool AssetManager::isUpToDate() { AutoMutex _l(mLock); return mZipSet.isUpToDate(); } void AssetManager::getLocales(Vector* locales) const { ResTable* res = mResources; if (res != NULL) { res->getLocales(locales); } } /* * Open a non-asset file as if it were an asset, searching for it in the * specified app. * * Pass in a NULL values for "appName" if the common app directory should * be used. */ Asset* AssetManager::openNonAssetInPathLocked(const char* fileName, AccessMode mode, const asset_path& ap) { Asset* pAsset = NULL; /* look at the filesystem on disk */ if (ap.type == kFileTypeDirectory) { String8 path(ap.path); path.appendPath(fileName); pAsset = openAssetFromFileLocked(path, mode); if (pAsset == NULL) { /* try again, this time with ".gz" */ path.append(".gz"); pAsset = openAssetFromFileLocked(path, mode); } if (pAsset != NULL) { //printf("FOUND NA '%s' on disk\n", fileName); pAsset->setAssetSource(path); } /* look inside the zip file */ } else { String8 path(fileName); /* check the appropriate Zip file */ ZipFileRO* pZip; ZipEntryRO entry; pZip = getZipFileLocked(ap); if (pZip != NULL) { //printf("GOT zip, checking NA '%s'\n", (const char*) path); entry = pZip->findEntryByName(path.string()); if (entry != NULL) { //printf("FOUND NA in Zip file for %s\n", appName ? appName : kAppCommon); pAsset = openAssetFromZipLocked(pZip, entry, mode, path); } } if (pAsset != NULL) { /* create a "source" name, for debug/display */ pAsset->setAssetSource( createZipSourceNameLocked(ZipSet::getPathName(ap.path.string()), String8(""), String8(fileName))); } } return pAsset; } /* * Open an asset, searching for it in the directory hierarchy for the * specified app. * * Pass in a NULL values for "appName" if the common app directory should * be used. */ Asset* AssetManager::openInPathLocked(const char* fileName, AccessMode mode, const asset_path& ap) { Asset* pAsset = NULL; /* * Try various combinations of locale and vendor. */ if (mLocale != NULL && mVendor != NULL) pAsset = openInLocaleVendorLocked(fileName, mode, ap, mLocale, mVendor); if (pAsset == NULL && mVendor != NULL) pAsset = openInLocaleVendorLocked(fileName, mode, ap, NULL, mVendor); if (pAsset == NULL && mLocale != NULL) pAsset = openInLocaleVendorLocked(fileName, mode, ap, mLocale, NULL); if (pAsset == NULL) pAsset = openInLocaleVendorLocked(fileName, mode, ap, NULL, NULL); return pAsset; } /* * Open an asset, searching for it in the directory hierarchy for the * specified locale and vendor. * * We also search in "app.jar". * * Pass in NULL values for "appName", "locale", and "vendor" if the * defaults should be used. */ Asset* AssetManager::openInLocaleVendorLocked(const char* fileName, AccessMode mode, const asset_path& ap, const char* locale, const char* vendor) { Asset* pAsset = NULL; if (ap.type == kFileTypeDirectory) { if (mCacheMode == CACHE_OFF) { /* look at the filesystem on disk */ String8 path(createPathNameLocked(ap, locale, vendor)); path.appendPath(fileName); String8 excludeName(path); excludeName.append(kExcludeExtension); if (::getFileType(excludeName.string()) != kFileTypeNonexistent) { /* say no more */ //printf("+++ excluding '%s'\n", (const char*) excludeName); return kExcludedAsset; } pAsset = openAssetFromFileLocked(path, mode); if (pAsset == NULL) { /* try again, this time with ".gz" */ path.append(".gz"); pAsset = openAssetFromFileLocked(path, mode); } if (pAsset != NULL) pAsset->setAssetSource(path); } else { /* find in cache */ String8 path(createPathNameLocked(ap, locale, vendor)); path.appendPath(fileName); AssetDir::FileInfo tmpInfo; bool found = false; String8 excludeName(path); excludeName.append(kExcludeExtension); if (mCache.indexOf(excludeName) != NAME_NOT_FOUND) { /* go no farther */ //printf("+++ Excluding '%s'\n", (const char*) excludeName); return kExcludedAsset; } /* * File compression extensions (".gz") don't get stored in the * name cache, so we have to try both here. */ if (mCache.indexOf(path) != NAME_NOT_FOUND) { found = true; pAsset = openAssetFromFileLocked(path, mode); if (pAsset == NULL) { /* try again, this time with ".gz" */ path.append(".gz"); pAsset = openAssetFromFileLocked(path, mode); } } if (pAsset != NULL) pAsset->setAssetSource(path); /* * Don't continue the search into the Zip files. Our cached info * said it was a file on disk; to be consistent with openDir() * we want to return the loose asset. If the cached file gets * removed, we fail. * * The alternative is to update our cache when files get deleted, * or make some sort of "best effort" promise, but for now I'm * taking the hard line. */ if (found) { if (pAsset == NULL) ALOGD("Expected file not found: '%s'\n", path.string()); return pAsset; } } } /* * Either it wasn't found on disk or on the cached view of the disk. * Dig through the currently-opened set of Zip files. If caching * is disabled, the Zip file may get reopened. */ if (pAsset == NULL && ap.type == kFileTypeRegular) { String8 path; path.appendPath((locale != NULL) ? locale : kDefaultLocale); path.appendPath((vendor != NULL) ? vendor : kDefaultVendor); path.appendPath(fileName); /* check the appropriate Zip file */ ZipFileRO* pZip; ZipEntryRO entry; pZip = getZipFileLocked(ap); if (pZip != NULL) { //printf("GOT zip, checking '%s'\n", (const char*) path); entry = pZip->findEntryByName(path.string()); if (entry != NULL) { //printf("FOUND in Zip file for %s/%s-%s\n", // appName, locale, vendor); pAsset = openAssetFromZipLocked(pZip, entry, mode, path); } } if (pAsset != NULL) { /* create a "source" name, for debug/display */ pAsset->setAssetSource(createZipSourceNameLocked(ZipSet::getPathName(ap.path.string()), String8(""), String8(fileName))); } } return pAsset; } /* * Create a "source name" for a file from a Zip archive. */ String8 AssetManager::createZipSourceNameLocked(const String8& zipFileName, const String8& dirName, const String8& fileName) { String8 sourceName("zip:"); sourceName.append(zipFileName); sourceName.append(":"); if (dirName.length() > 0) { sourceName.appendPath(dirName); } sourceName.appendPath(fileName); return sourceName; } /* * Create a path to a loose asset (asset-base/app/locale/vendor). */ String8 AssetManager::createPathNameLocked(const asset_path& ap, const char* locale, const char* vendor) { String8 path(ap.path); path.appendPath((locale != NULL) ? locale : kDefaultLocale); path.appendPath((vendor != NULL) ? vendor : kDefaultVendor); return path; } /* * Create a path to a loose asset (asset-base/app/rootDir). */ String8 AssetManager::createPathNameLocked(const asset_path& ap, const char* rootDir) { String8 path(ap.path); if (rootDir != NULL) path.appendPath(rootDir); return path; } /* * Return a pointer to one of our open Zip archives. Returns NULL if no * matching Zip file exists. * * Right now we have 2 possible Zip files (1 each in app/"common"). * * If caching is set to CACHE_OFF, to get the expected behavior we * need to reopen the Zip file on every request. That would be silly * and expensive, so instead we just check the file modification date. * * Pass in NULL values for "appName", "locale", and "vendor" if the * generics should be used. */ ZipFileRO* AssetManager::getZipFileLocked(const asset_path& ap) { ALOGV("getZipFileLocked() in %p\n", this); return mZipSet.getZip(ap.path); } /* * Try to open an asset from a file on disk. * * If the file is compressed with gzip, we seek to the start of the * deflated data and pass that in (just like we would for a Zip archive). * * For uncompressed data, we may already have an mmap()ed version sitting * around. If so, we want to hand that to the Asset instead. * * This returns NULL if the file doesn't exist, couldn't be opened, or * claims to be a ".gz" but isn't. */ Asset* AssetManager::openAssetFromFileLocked(const String8& pathName, AccessMode mode) { Asset* pAsset = NULL; if (strcasecmp(pathName.getPathExtension().string(), ".gz") == 0) { //printf("TRYING '%s'\n", (const char*) pathName); pAsset = Asset::createFromCompressedFile(pathName.string(), mode); } else { //printf("TRYING '%s'\n", (const char*) pathName); pAsset = Asset::createFromFile(pathName.string(), mode); } return pAsset; } /* * Given an entry in a Zip archive, create a new Asset object. * * If the entry is uncompressed, we may want to create or share a * slice of shared memory. */ Asset* AssetManager::openAssetFromZipLocked(const ZipFileRO* pZipFile, const ZipEntryRO entry, AccessMode mode, const String8& entryName) { Asset* pAsset = NULL; // TODO: look for previously-created shared memory slice? int method; size_t uncompressedLen; //printf("USING Zip '%s'\n", pEntry->getFileName()); //pZipFile->getEntryInfo(entry, &method, &uncompressedLen, &compressedLen, // &offset); if (!pZipFile->getEntryInfo(entry, &method, &uncompressedLen, NULL, NULL, NULL, NULL)) { ALOGW("getEntryInfo failed\n"); return NULL; } FileMap* dataMap = pZipFile->createEntryFileMap(entry); if (dataMap == NULL) { ALOGW("create map from entry failed\n"); return NULL; } if (method == ZipFileRO::kCompressStored) { pAsset = Asset::createFromUncompressedMap(dataMap, mode); ALOGV("Opened uncompressed entry %s in zip %s mode %d: %p", entryName.string(), dataMap->getFileName(), mode, pAsset); } else { pAsset = Asset::createFromCompressedMap(dataMap, method, uncompressedLen, mode); ALOGV("Opened compressed entry %s in zip %s mode %d: %p", entryName.string(), dataMap->getFileName(), mode, pAsset); } if (pAsset == NULL) { /* unexpected */ ALOGW("create from segment failed\n"); } return pAsset; } /* * Open a directory in the asset namespace. * * An "asset directory" is simply the combination of all files in all * locations, with ".gz" stripped for loose files. With app, locale, and * vendor defined, we have 8 directories and 2 Zip archives to scan. * * Pass in "" for the root dir. */ AssetDir* AssetManager::openDir(const char* dirName) { AutoMutex _l(mLock); AssetDir* pDir = NULL; SortedVector* pMergedInfo = NULL; LOG_FATAL_IF(mAssetPaths.size() == 0, "No assets added to AssetManager"); assert(dirName != NULL); //printf("+++ openDir(%s) in '%s'\n", dirName, (const char*) mAssetBase); if (mCacheMode != CACHE_OFF && !mCacheValid) loadFileNameCacheLocked(); pDir = new AssetDir; /* * Scan the various directories, merging what we find into a single * vector. We want to scan them in reverse priority order so that * the ".EXCLUDE" processing works correctly. Also, if we decide we * want to remember where the file is coming from, we'll get the right * version. * * We start with Zip archives, then do loose files. */ pMergedInfo = new SortedVector; size_t i = mAssetPaths.size(); while (i > 0) { i--; const asset_path& ap = mAssetPaths.itemAt(i); if (ap.type == kFileTypeRegular) { ALOGV("Adding directory %s from zip %s", dirName, ap.path.string()); scanAndMergeZipLocked(pMergedInfo, ap, kAssetsRoot, dirName); } else { ALOGV("Adding directory %s from dir %s", dirName, ap.path.string()); scanAndMergeDirLocked(pMergedInfo, ap, kAssetsRoot, dirName); } } #if 0 printf("FILE LIST:\n"); for (i = 0; i < (size_t) pMergedInfo->size(); i++) { printf(" %d: (%d) '%s'\n", i, pMergedInfo->itemAt(i).getFileType(), (const char*) pMergedInfo->itemAt(i).getFileName()); } #endif pDir->setFileList(pMergedInfo); return pDir; } /* * Open a directory in the non-asset namespace. * * An "asset directory" is simply the combination of all files in all * locations, with ".gz" stripped for loose files. With app, locale, and * vendor defined, we have 8 directories and 2 Zip archives to scan. * * Pass in "" for the root dir. */ AssetDir* AssetManager::openNonAssetDir(void* cookie, const char* dirName) { AutoMutex _l(mLock); AssetDir* pDir = NULL; SortedVector* pMergedInfo = NULL; LOG_FATAL_IF(mAssetPaths.size() == 0, "No assets added to AssetManager"); assert(dirName != NULL); //printf("+++ openDir(%s) in '%s'\n", dirName, (const char*) mAssetBase); if (mCacheMode != CACHE_OFF && !mCacheValid) loadFileNameCacheLocked(); pDir = new AssetDir; pMergedInfo = new SortedVector; const size_t which = ((size_t)cookie)-1; if (which < mAssetPaths.size()) { const asset_path& ap = mAssetPaths.itemAt(which); if (ap.type == kFileTypeRegular) { ALOGV("Adding directory %s from zip %s", dirName, ap.path.string()); scanAndMergeZipLocked(pMergedInfo, ap, NULL, dirName); } else { ALOGV("Adding directory %s from dir %s", dirName, ap.path.string()); scanAndMergeDirLocked(pMergedInfo, ap, NULL, dirName); } } #if 0 printf("FILE LIST:\n"); for (i = 0; i < (size_t) pMergedInfo->size(); i++) { printf(" %d: (%d) '%s'\n", i, pMergedInfo->itemAt(i).getFileType(), (const char*) pMergedInfo->itemAt(i).getFileName()); } #endif pDir->setFileList(pMergedInfo); return pDir; } /* * Scan the contents of the specified directory and merge them into the * "pMergedInfo" vector, removing previous entries if we find "exclude" * directives. * * Returns "false" if we found nothing to contribute. */ bool AssetManager::scanAndMergeDirLocked(SortedVector* pMergedInfo, const asset_path& ap, const char* rootDir, const char* dirName) { SortedVector* pContents; String8 path; assert(pMergedInfo != NULL); //printf("scanAndMergeDir: %s %s %s %s\n", appName, locale, vendor,dirName); if (mCacheValid) { int i, start, count; pContents = new SortedVector; /* * Get the basic partial path and find it in the cache. That's * the start point for the search. */ path = createPathNameLocked(ap, rootDir); if (dirName[0] != '\0') path.appendPath(dirName); start = mCache.indexOf(path); if (start == NAME_NOT_FOUND) { //printf("+++ not found in cache: dir '%s'\n", (const char*) path); delete pContents; return false; } /* * The match string looks like "common/default/default/foo/bar/". * The '/' on the end ensures that we don't match on the directory * itself or on ".../foo/barfy/". */ path.append("/"); count = mCache.size(); /* * Pick out the stuff in the current dir by examining the pathname. * It needs to match the partial pathname prefix, and not have a '/' * (fssep) anywhere after the prefix. */ for (i = start+1; i < count; i++) { if (mCache[i].getFileName().length() > path.length() && strncmp(mCache[i].getFileName().string(), path.string(), path.length()) == 0) { const char* name = mCache[i].getFileName().string(); // XXX THIS IS BROKEN! Looks like we need to store the full // path prefix separately from the file path. if (strchr(name + path.length(), '/') == NULL) { /* grab it, reducing path to just the filename component */ AssetDir::FileInfo tmp = mCache[i]; tmp.setFileName(tmp.getFileName().getPathLeaf()); pContents->add(tmp); } } else { /* no longer in the dir or its subdirs */ break; } } } else { path = createPathNameLocked(ap, rootDir); if (dirName[0] != '\0') path.appendPath(dirName); pContents = scanDirLocked(path); if (pContents == NULL) return false; } // if we wanted to do an incremental cache fill, we would do it here /* * Process "exclude" directives. If we find a filename that ends with * ".EXCLUDE", we look for a matching entry in the "merged" set, and * remove it if we find it. We also delete the "exclude" entry. */ int i, count, exclExtLen; count = pContents->size(); exclExtLen = strlen(kExcludeExtension); for (i = 0; i < count; i++) { const char* name; int nameLen; name = pContents->itemAt(i).getFileName().string(); nameLen = strlen(name); if (nameLen > exclExtLen && strcmp(name + (nameLen - exclExtLen), kExcludeExtension) == 0) { String8 match(name, nameLen - exclExtLen); int matchIdx; matchIdx = AssetDir::FileInfo::findEntry(pMergedInfo, match); if (matchIdx > 0) { ALOGV("Excluding '%s' [%s]\n", pMergedInfo->itemAt(matchIdx).getFileName().string(), pMergedInfo->itemAt(matchIdx).getSourceName().string()); pMergedInfo->removeAt(matchIdx); } else { //printf("+++ no match on '%s'\n", (const char*) match); } ALOGD("HEY: size=%d removing %d\n", (int)pContents->size(), i); pContents->removeAt(i); i--; // adjust "for" loop count--; // and loop limit } } mergeInfoLocked(pMergedInfo, pContents); delete pContents; return true; } /* * Scan the contents of the specified directory, and stuff what we find * into a newly-allocated vector. * * Files ending in ".gz" will have their extensions removed. * * We should probably think about skipping files with "illegal" names, * e.g. illegal characters (/\:) or excessive length. * * Returns NULL if the specified directory doesn't exist. */ SortedVector* AssetManager::scanDirLocked(const String8& path) { SortedVector* pContents = NULL; DIR* dir; struct dirent* entry; FileType fileType; ALOGV("Scanning dir '%s'\n", path.string()); dir = opendir(path.string()); if (dir == NULL) return NULL; pContents = new SortedVector; while (1) { entry = readdir(dir); if (entry == NULL) break; if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) continue; #ifdef _DIRENT_HAVE_D_TYPE if (entry->d_type == DT_REG) fileType = kFileTypeRegular; else if (entry->d_type == DT_DIR) fileType = kFileTypeDirectory; else fileType = kFileTypeUnknown; #else // stat the file fileType = ::getFileType(path.appendPathCopy(entry->d_name).string()); #endif if (fileType != kFileTypeRegular && fileType != kFileTypeDirectory) continue; AssetDir::FileInfo info; info.set(String8(entry->d_name), fileType); if (strcasecmp(info.getFileName().getPathExtension().string(), ".gz") == 0) info.setFileName(info.getFileName().getBasePath()); info.setSourceName(path.appendPathCopy(info.getFileName())); pContents->add(info); } closedir(dir); return pContents; } /* * Scan the contents out of the specified Zip archive, and merge what we * find into "pMergedInfo". If the Zip archive in question doesn't exist, * we return immediately. * * Returns "false" if we found nothing to contribute. */ bool AssetManager::scanAndMergeZipLocked(SortedVector* pMergedInfo, const asset_path& ap, const char* rootDir, const char* baseDirName) { ZipFileRO* pZip; Vector dirs; AssetDir::FileInfo info; SortedVector contents; String8 sourceName, zipName, dirName; pZip = mZipSet.getZip(ap.path); if (pZip == NULL) { ALOGW("Failure opening zip %s\n", ap.path.string()); return false; } zipName = ZipSet::getPathName(ap.path.string()); /* convert "sounds" to "rootDir/sounds" */ if (rootDir != NULL) dirName = rootDir; dirName.appendPath(baseDirName); /* * Scan through the list of files, looking for a match. The files in * the Zip table of contents are not in sorted order, so we have to * process the entire list. We're looking for a string that begins * with the characters in "dirName", is followed by a '/', and has no * subsequent '/' in the stuff that follows. * * What makes this especially fun is that directories are not stored * explicitly in Zip archives, so we have to infer them from context. * When we see "sounds/foo.wav" we have to leave a note to ourselves * to insert a directory called "sounds" into the list. We store * these in temporary vector so that we only return each one once. * * Name comparisons are case-sensitive to match UNIX filesystem * semantics. */ int dirNameLen = dirName.length(); for (int i = 0; i < pZip->getNumEntries(); i++) { ZipEntryRO entry; char nameBuf[256]; entry = pZip->findEntryByIndex(i); if (pZip->getEntryFileName(entry, nameBuf, sizeof(nameBuf)) != 0) { // TODO: fix this if we expect to have long names ALOGE("ARGH: name too long?\n"); continue; } //printf("Comparing %s in %s?\n", nameBuf, dirName.string()); if (dirNameLen == 0 || (strncmp(nameBuf, dirName.string(), dirNameLen) == 0 && nameBuf[dirNameLen] == '/')) { const char* cp; const char* nextSlash; cp = nameBuf + dirNameLen; if (dirNameLen != 0) cp++; // advance past the '/' nextSlash = strchr(cp, '/'); //xxx this may break if there are bare directory entries if (nextSlash == NULL) { /* this is a file in the requested directory */ info.set(String8(nameBuf).getPathLeaf(), kFileTypeRegular); info.setSourceName( createZipSourceNameLocked(zipName, dirName, info.getFileName())); contents.add(info); //printf("FOUND: file '%s'\n", info.getFileName().string()); } else { /* this is a subdir; add it if we don't already have it*/ String8 subdirName(cp, nextSlash - cp); size_t j; size_t N = dirs.size(); for (j = 0; j < N; j++) { if (subdirName == dirs[j]) { break; } } if (j == N) { dirs.add(subdirName); } //printf("FOUND: dir '%s'\n", subdirName.string()); } } } /* * Add the set of unique directories. */ for (int i = 0; i < (int) dirs.size(); i++) { info.set(dirs[i], kFileTypeDirectory); info.setSourceName( createZipSourceNameLocked(zipName, dirName, info.getFileName())); contents.add(info); } mergeInfoLocked(pMergedInfo, &contents); return true; } /* * Merge two vectors of FileInfo. * * The merged contents will be stuffed into *pMergedInfo. * * If an entry for a file exists in both "pMergedInfo" and "pContents", * we use the newer "pContents" entry. */ void AssetManager::mergeInfoLocked(SortedVector* pMergedInfo, const SortedVector* pContents) { /* * Merge what we found in this directory with what we found in * other places. * * Two basic approaches: * (1) Create a new array that holds the unique values of the two * arrays. * (2) Take the elements from pContents and shove them into pMergedInfo. * * Because these are vectors of complex objects, moving elements around * inside the vector requires constructing new objects and allocating * storage for members. With approach #1, we're always adding to the * end, whereas with #2 we could be inserting multiple elements at the * front of the vector. Approach #1 requires a full copy of the * contents of pMergedInfo, but approach #2 requires the same copy for * every insertion at the front of pMergedInfo. * * (We should probably use a SortedVector interface that allows us to * just stuff items in, trusting us to maintain the sort order.) */ SortedVector* pNewSorted; int mergeMax, contMax; int mergeIdx, contIdx; pNewSorted = new SortedVector; mergeMax = pMergedInfo->size(); contMax = pContents->size(); mergeIdx = contIdx = 0; while (mergeIdx < mergeMax || contIdx < contMax) { if (mergeIdx == mergeMax) { /* hit end of "merge" list, copy rest of "contents" */ pNewSorted->add(pContents->itemAt(contIdx)); contIdx++; } else if (contIdx == contMax) { /* hit end of "cont" list, copy rest of "merge" */ pNewSorted->add(pMergedInfo->itemAt(mergeIdx)); mergeIdx++; } else if (pMergedInfo->itemAt(mergeIdx) == pContents->itemAt(contIdx)) { /* items are identical, add newer and advance both indices */ pNewSorted->add(pContents->itemAt(contIdx)); mergeIdx++; contIdx++; } else if (pMergedInfo->itemAt(mergeIdx) < pContents->itemAt(contIdx)) { /* "merge" is lower, add that one */ pNewSorted->add(pMergedInfo->itemAt(mergeIdx)); mergeIdx++; } else { /* "cont" is lower, add that one */ assert(pContents->itemAt(contIdx) < pMergedInfo->itemAt(mergeIdx)); pNewSorted->add(pContents->itemAt(contIdx)); contIdx++; } } /* * Overwrite the "merged" list with the new stuff. */ *pMergedInfo = *pNewSorted; delete pNewSorted; #if 0 // for Vector, rather than SortedVector int i, j; for (i = pContents->size() -1; i >= 0; i--) { bool add = true; for (j = pMergedInfo->size() -1; j >= 0; j--) { /* case-sensitive comparisons, to behave like UNIX fs */ if (strcmp(pContents->itemAt(i).mFileName, pMergedInfo->itemAt(j).mFileName) == 0) { /* match, don't add this entry */ add = false; break; } } if (add) pMergedInfo->add(pContents->itemAt(i)); } #endif } /* * Load all files into the file name cache. We want to do this across * all combinations of { appname, locale, vendor }, performing a recursive * directory traversal. * * This is not the most efficient data structure. Also, gathering the * information as we needed it (file-by-file or directory-by-directory) * would be faster. However, on the actual device, 99% of the files will * live in Zip archives, so this list will be very small. The trouble * is that we have to check the "loose" files first, so it's important * that we don't beat the filesystem silly looking for files that aren't * there. * * Note on thread safety: this is the only function that causes updates * to mCache, and anybody who tries to use it will call here if !mCacheValid, * so we need to employ a mutex here. */ void AssetManager::loadFileNameCacheLocked(void) { assert(!mCacheValid); assert(mCache.size() == 0); #ifdef DO_TIMINGS // need to link against -lrt for this now DurationTimer timer; timer.start(); #endif fncScanLocked(&mCache, ""); #ifdef DO_TIMINGS timer.stop(); ALOGD("Cache scan took %.3fms\n", timer.durationUsecs() / 1000.0); #endif #if 0 int i; printf("CACHED FILE LIST (%d entries):\n", mCache.size()); for (i = 0; i < (int) mCache.size(); i++) { printf(" %d: (%d) '%s'\n", i, mCache.itemAt(i).getFileType(), (const char*) mCache.itemAt(i).getFileName()); } #endif mCacheValid = true; } /* * Scan up to 8 versions of the specified directory. */ void AssetManager::fncScanLocked(SortedVector* pMergedInfo, const char* dirName) { size_t i = mAssetPaths.size(); while (i > 0) { i--; const asset_path& ap = mAssetPaths.itemAt(i); fncScanAndMergeDirLocked(pMergedInfo, ap, NULL, NULL, dirName); if (mLocale != NULL) fncScanAndMergeDirLocked(pMergedInfo, ap, mLocale, NULL, dirName); if (mVendor != NULL) fncScanAndMergeDirLocked(pMergedInfo, ap, NULL, mVendor, dirName); if (mLocale != NULL && mVendor != NULL) fncScanAndMergeDirLocked(pMergedInfo, ap, mLocale, mVendor, dirName); } } /* * Recursively scan this directory and all subdirs. * * This is similar to scanAndMergeDir, but we don't remove the .EXCLUDE * files, and we prepend the extended partial path to the filenames. */ bool AssetManager::fncScanAndMergeDirLocked( SortedVector* pMergedInfo, const asset_path& ap, const char* locale, const char* vendor, const char* dirName) { SortedVector* pContents; String8 partialPath; String8 fullPath; // XXX This is broken -- the filename cache needs to hold the base // asset path separately from its filename. partialPath = createPathNameLocked(ap, locale, vendor); if (dirName[0] != '\0') { partialPath.appendPath(dirName); } fullPath = partialPath; pContents = scanDirLocked(fullPath); if (pContents == NULL) { return false; // directory did not exist } /* * Scan all subdirectories of the current dir, merging what we find * into "pMergedInfo". */ for (int i = 0; i < (int) pContents->size(); i++) { if (pContents->itemAt(i).getFileType() == kFileTypeDirectory) { String8 subdir(dirName); subdir.appendPath(pContents->itemAt(i).getFileName()); fncScanAndMergeDirLocked(pMergedInfo, ap, locale, vendor, subdir.string()); } } /* * To be consistent, we want entries for the root directory. If * we're the root, add one now. */ if (dirName[0] == '\0') { AssetDir::FileInfo tmpInfo; tmpInfo.set(String8(""), kFileTypeDirectory); tmpInfo.setSourceName(createPathNameLocked(ap, locale, vendor)); pContents->add(tmpInfo); } /* * We want to prepend the extended partial path to every entry in * "pContents". It's the same value for each entry, so this will * not change the sorting order of the vector contents. */ for (int i = 0; i < (int) pContents->size(); i++) { const AssetDir::FileInfo& info = pContents->itemAt(i); pContents->editItemAt(i).setFileName(partialPath.appendPathCopy(info.getFileName())); } mergeInfoLocked(pMergedInfo, pContents); return true; } /* * Trash the cache. */ void AssetManager::purgeFileNameCacheLocked(void) { mCacheValid = false; mCache.clear(); } /* * =========================================================================== * AssetManager::SharedZip * =========================================================================== */ Mutex AssetManager::SharedZip::gLock; DefaultKeyedVector > AssetManager::SharedZip::gOpen; AssetManager::SharedZip::SharedZip(const String8& path, time_t modWhen) : mPath(path), mZipFile(NULL), mModWhen(modWhen), mResourceTableAsset(NULL), mResourceTable(NULL) { //ALOGI("Creating SharedZip %p %s\n", this, (const char*)mPath); mZipFile = new ZipFileRO; ALOGV("+++ opening zip '%s'\n", mPath.string()); if (mZipFile->open(mPath.string()) != NO_ERROR) { ALOGD("failed to open Zip archive '%s'\n", mPath.string()); delete mZipFile; mZipFile = NULL; } } sp AssetManager::SharedZip::get(const String8& path) { AutoMutex _l(gLock); time_t modWhen = getFileModDate(path); sp zip = gOpen.valueFor(path).promote(); if (zip != NULL && zip->mModWhen == modWhen) { return zip; } zip = new SharedZip(path, modWhen); gOpen.add(path, zip); return zip; } ZipFileRO* AssetManager::SharedZip::getZip() { return mZipFile; } Asset* AssetManager::SharedZip::getResourceTableAsset() { ALOGV("Getting from SharedZip %p resource asset %p\n", this, mResourceTableAsset); return mResourceTableAsset; } Asset* AssetManager::SharedZip::setResourceTableAsset(Asset* asset) { { AutoMutex _l(gLock); if (mResourceTableAsset == NULL) { mResourceTableAsset = asset; // This is not thread safe the first time it is called, so // do it here with the global lock held. asset->getBuffer(true); return asset; } } delete asset; return mResourceTableAsset; } ResTable* AssetManager::SharedZip::getResourceTable() { ALOGV("Getting from SharedZip %p resource table %p\n", this, mResourceTable); return mResourceTable; } ResTable* AssetManager::SharedZip::setResourceTable(ResTable* res) { { AutoMutex _l(gLock); if (mResourceTable == NULL) { mResourceTable = res; return res; } } delete res; return mResourceTable; } bool AssetManager::SharedZip::isUpToDate() { time_t modWhen = getFileModDate(mPath.string()); return mModWhen == modWhen; } AssetManager::SharedZip::~SharedZip() { //ALOGI("Destroying SharedZip %p %s\n", this, (const char*)mPath); if (mResourceTable != NULL) { delete mResourceTable; } if (mResourceTableAsset != NULL) { delete mResourceTableAsset; } if (mZipFile != NULL) { delete mZipFile; ALOGV("Closed '%s'\n", mPath.string()); } } /* * =========================================================================== * AssetManager::ZipSet * =========================================================================== */ /* * Constructor. */ AssetManager::ZipSet::ZipSet(void) { } /* * Destructor. Close any open archives. */ AssetManager::ZipSet::~ZipSet(void) { size_t N = mZipFile.size(); for (size_t i = 0; i < N; i++) closeZip(i); } /* * Close a Zip file and reset the entry. */ void AssetManager::ZipSet::closeZip(int idx) { mZipFile.editItemAt(idx) = NULL; } /* * Retrieve the appropriate Zip file from the set. */ ZipFileRO* AssetManager::ZipSet::getZip(const String8& path) { int idx = getIndex(path); sp zip = mZipFile[idx]; if (zip == NULL) { zip = SharedZip::get(path); mZipFile.editItemAt(idx) = zip; } return zip->getZip(); } Asset* AssetManager::ZipSet::getZipResourceTableAsset(const String8& path) { int idx = getIndex(path); sp zip = mZipFile[idx]; if (zip == NULL) { zip = SharedZip::get(path); mZipFile.editItemAt(idx) = zip; } return zip->getResourceTableAsset(); } Asset* AssetManager::ZipSet::setZipResourceTableAsset(const String8& path, Asset* asset) { int idx = getIndex(path); sp zip = mZipFile[idx]; // doesn't make sense to call before previously accessing. return zip->setResourceTableAsset(asset); } ResTable* AssetManager::ZipSet::getZipResourceTable(const String8& path) { int idx = getIndex(path); sp zip = mZipFile[idx]; if (zip == NULL) { zip = SharedZip::get(path); mZipFile.editItemAt(idx) = zip; } return zip->getResourceTable(); } ResTable* AssetManager::ZipSet::setZipResourceTable(const String8& path, ResTable* res) { int idx = getIndex(path); sp zip = mZipFile[idx]; // doesn't make sense to call before previously accessing. return zip->setResourceTable(res); } /* * Generate the partial pathname for the specified archive. The caller * gets to prepend the asset root directory. * * Returns something like "common/en-US-noogle.jar". */ /*static*/ String8 AssetManager::ZipSet::getPathName(const char* zipPath) { return String8(zipPath); } bool AssetManager::ZipSet::isUpToDate() { const size_t N = mZipFile.size(); for (size_t i=0; iisUpToDate()) { return false; } } return true; } /* * Compute the zip file's index. * * "appName", "locale", and "vendor" should be set to NULL to indicate the * default directory. */ int AssetManager::ZipSet::getIndex(const String8& zip) const { const size_t N = mZipPath.size(); for (size_t i=0; i #include #include #include #include #include #include #include #include #ifdef HAVE_WIN32_THREADS #include #endif nsecs_t systemTime(int clock) { #if defined(HAVE_POSIX_CLOCKS) static const clockid_t clocks[] = { CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_PROCESS_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID }; struct timespec t; t.tv_sec = t.tv_nsec = 0; clock_gettime(clocks[clock], &t); return nsecs_t(t.tv_sec)*1000000000LL + t.tv_nsec; #else // we don't support the clocks here. struct timeval t; t.tv_sec = t.tv_usec = 0; gettimeofday(&t, NULL); return nsecs_t(t.tv_sec)*1000000000LL + nsecs_t(t.tv_usec)*1000LL; #endif } int toMillisecondTimeoutDelay(nsecs_t referenceTime, nsecs_t timeoutTime) { int timeoutDelayMillis; if (timeoutTime > referenceTime) { uint64_t timeoutDelay = uint64_t(timeoutTime - referenceTime); if (timeoutDelay > uint64_t((INT_MAX - 1) * 1000000LL)) { timeoutDelayMillis = -1; } else { timeoutDelayMillis = (timeoutDelay + 999999LL) / 1000000LL; } } else { timeoutDelayMillis = 0; } return timeoutDelayMillis; } /* * =========================================================================== * DurationTimer * =========================================================================== */ using namespace android; // Start the timer. void DurationTimer::start(void) { gettimeofday(&mStartWhen, NULL); } // Stop the timer. void DurationTimer::stop(void) { gettimeofday(&mStopWhen, NULL); } // Get the duration in microseconds. long long DurationTimer::durationUsecs(void) const { return (long) subtractTimevals(&mStopWhen, &mStartWhen); } // Subtract two timevals. Returns the difference (ptv1-ptv2) in // microseconds. /*static*/ long long DurationTimer::subtractTimevals(const struct timeval* ptv1, const struct timeval* ptv2) { long long stop = ((long long) ptv1->tv_sec) * 1000000LL + ((long long) ptv1->tv_usec); long long start = ((long long) ptv2->tv_sec) * 1000000LL + ((long long) ptv2->tv_usec); return stop - start; } // Add the specified amount of time to the timeval. /*static*/ void DurationTimer::addToTimeval(struct timeval* ptv, long usec) { if (usec < 0) { ALOG(LOG_WARN, "", "Negative values not supported in addToTimeval\n"); return; } // normalize tv_usec if necessary if (ptv->tv_usec >= 1000000) { ptv->tv_sec += ptv->tv_usec / 1000000; ptv->tv_usec %= 1000000; } ptv->tv_usec += usec % 1000000; if (ptv->tv_usec >= 1000000) { ptv->tv_usec -= 1000000; ptv->tv_sec++; } ptv->tv_sec += usec / 1000000; } android-audiosystem-1.8+13.10.20130807/lib/utils/ZipFileRO.cpp0000644000015700001700000006651612200324306024125 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Read-only access to Zip archives, with minimal heap allocation. // #define LOG_TAG "zipro" //#define LOG_NDEBUG 0 #include #include #include #include #include #include #include #include #include #include #if HAVE_PRINTF_ZD # define ZD "%zd" # define ZD_TYPE ssize_t #else # define ZD "%ld" # define ZD_TYPE long #endif /* * We must open binary files using open(path, ... | O_BINARY) under Windows. * Otherwise strange read errors will happen. */ #ifndef O_BINARY # define O_BINARY 0 #endif /* * TEMP_FAILURE_RETRY is defined by some, but not all, versions of * . (Alas, it is not as standard as we'd hoped!) So, if it's * not already defined, then define it here. */ #ifndef TEMP_FAILURE_RETRY /* Used to retry syscalls that can return EINTR. */ #define TEMP_FAILURE_RETRY(exp) ({ \ typeof (exp) _rc; \ do { \ _rc = (exp); \ } while (_rc == -1 && errno == EINTR); \ _rc; }) #endif using namespace android; /* * Zip file constants. */ #define kEOCDSignature 0x06054b50 #define kEOCDLen 22 #define kEOCDNumEntries 8 // offset to #of entries in file #define kEOCDSize 12 // size of the central directory #define kEOCDFileOffset 16 // offset to central directory #define kMaxCommentLen 65535 // longest possible in ushort #define kMaxEOCDSearch (kMaxCommentLen + kEOCDLen) #define kLFHSignature 0x04034b50 #define kLFHLen 30 // excluding variable-len fields #define kLFHNameLen 26 // offset to filename length #define kLFHExtraLen 28 // offset to extra length #define kCDESignature 0x02014b50 #define kCDELen 46 // excluding variable-len fields #define kCDEMethod 10 // offset to compression method #define kCDEModWhen 12 // offset to modification timestamp #define kCDECRC 16 // offset to entry CRC #define kCDECompLen 20 // offset to compressed length #define kCDEUncompLen 24 // offset to uncompressed length #define kCDENameLen 28 // offset to filename length #define kCDEExtraLen 30 // offset to extra length #define kCDECommentLen 32 // offset to comment length #define kCDELocalOffset 42 // offset to local hdr /* * The values we return for ZipEntryRO use 0 as an invalid value, so we * want to adjust the hash table index by a fixed amount. Using a large * value helps insure that people don't mix & match arguments, e.g. to * findEntryByIndex(). */ #define kZipEntryAdj 10000 ZipFileRO::~ZipFileRO() { free(mHashTable); if (mDirectoryMap) mDirectoryMap->release(); if (mFd >= 0) TEMP_FAILURE_RETRY(close(mFd)); if (mFileName) free(mFileName); } /* * Convert a ZipEntryRO to a hash table index, verifying that it's in a * valid range. */ int ZipFileRO::entryToIndex(const ZipEntryRO entry) const { long ent = ((long) entry) - kZipEntryAdj; if (ent < 0 || ent >= mHashTableSize || mHashTable[ent].name == NULL) { ALOGW("Invalid ZipEntryRO %p (%ld)\n", entry, ent); return -1; } return ent; } /* * Open the specified file read-only. We memory-map the entire thing and * close the file before returning. */ status_t ZipFileRO::open(const char* zipFileName) { int fd = -1; assert(mDirectoryMap == NULL); /* * Open and map the specified file. */ fd = ::open(zipFileName, O_RDONLY | O_BINARY); if (fd < 0) { ALOGW("Unable to open zip '%s': %s\n", zipFileName, strerror(errno)); return NAME_NOT_FOUND; } mFileLength = lseek64(fd, 0, SEEK_END); if (mFileLength < kEOCDLen) { TEMP_FAILURE_RETRY(close(fd)); return UNKNOWN_ERROR; } if (mFileName != NULL) { free(mFileName); } mFileName = strdup(zipFileName); mFd = fd; /* * Find the Central Directory and store its size and number of entries. */ if (!mapCentralDirectory()) { goto bail; } /* * Verify Central Directory and create data structures for fast access. */ if (!parseZipArchive()) { goto bail; } return OK; bail: free(mFileName); mFileName = NULL; TEMP_FAILURE_RETRY(close(fd)); return UNKNOWN_ERROR; } /* * Parse the Zip archive, verifying its contents and initializing internal * data structures. */ bool ZipFileRO::mapCentralDirectory(void) { ssize_t readAmount = kMaxEOCDSearch; if (readAmount > (ssize_t) mFileLength) readAmount = mFileLength; unsigned char* scanBuf = (unsigned char*) malloc(readAmount); if (scanBuf == NULL) { ALOGW("couldn't allocate scanBuf: %s", strerror(errno)); free(scanBuf); return false; } /* * Make sure this is a Zip archive. */ if (lseek64(mFd, 0, SEEK_SET) != 0) { ALOGW("seek to start failed: %s", strerror(errno)); free(scanBuf); return false; } ssize_t actual = TEMP_FAILURE_RETRY(read(mFd, scanBuf, sizeof(int32_t))); if (actual != (ssize_t) sizeof(int32_t)) { ALOGI("couldn't read first signature from zip archive: %s", strerror(errno)); free(scanBuf); return false; } { unsigned int header = get4LE(scanBuf); if (header == kEOCDSignature) { ALOGI("Found Zip archive, but it looks empty\n"); free(scanBuf); return false; } else if (header != kLFHSignature) { ALOGV("Not a Zip archive (found 0x%08x)\n", header); free(scanBuf); return false; } } /* * Perform the traditional EOCD snipe hunt. * * We're searching for the End of Central Directory magic number, * which appears at the start of the EOCD block. It's followed by * 18 bytes of EOCD stuff and up to 64KB of archive comment. We * need to read the last part of the file into a buffer, dig through * it to find the magic number, parse some values out, and use those * to determine the extent of the CD. * * We start by pulling in the last part of the file. */ off64_t searchStart = mFileLength - readAmount; if (lseek64(mFd, searchStart, SEEK_SET) != searchStart) { ALOGW("seek %ld failed: %s\n", (long) searchStart, strerror(errno)); free(scanBuf); return false; } actual = TEMP_FAILURE_RETRY(read(mFd, scanBuf, readAmount)); if (actual != (ssize_t) readAmount) { ALOGW("Zip: read " ZD ", expected " ZD ". Failed: %s\n", (ZD_TYPE) actual, (ZD_TYPE) readAmount, strerror(errno)); free(scanBuf); return false; } /* * Scan backward for the EOCD magic. In an archive without a trailing * comment, we'll find it on the first try. (We may want to consider * doing an initial minimal read; if we don't find it, retry with a * second read as above.) */ int i; for (i = readAmount - kEOCDLen; i >= 0; i--) { if (scanBuf[i] == 0x50 && get4LE(&scanBuf[i]) == kEOCDSignature) { ALOGV("+++ Found EOCD at buf+%d\n", i); break; } } if (i < 0) { ALOGD("Zip: EOCD not found, %s is not zip\n", mFileName); free(scanBuf); return false; } off64_t eocdOffset = searchStart + i; const unsigned char* eocdPtr = scanBuf + i; assert(eocdOffset < mFileLength); /* * Grab the CD offset and size, and the number of entries in the * archive. After that, we can release our EOCD hunt buffer. */ unsigned int numEntries = get2LE(eocdPtr + kEOCDNumEntries); unsigned int dirSize = get4LE(eocdPtr + kEOCDSize); unsigned int dirOffset = get4LE(eocdPtr + kEOCDFileOffset); free(scanBuf); // Verify that they look reasonable. if ((long long) dirOffset + (long long) dirSize > (long long) eocdOffset) { ALOGW("bad offsets (dir %ld, size %u, eocd %ld)\n", (long) dirOffset, dirSize, (long) eocdOffset); return false; } if (numEntries == 0) { ALOGW("empty archive?\n"); return false; } ALOGV("+++ numEntries=%d dirSize=%d dirOffset=%d\n", numEntries, dirSize, dirOffset); mDirectoryMap = new FileMap(); if (mDirectoryMap == NULL) { ALOGW("Unable to create directory map: %s", strerror(errno)); return false; } if (!mDirectoryMap->create(mFileName, mFd, dirOffset, dirSize, true)) { ALOGW("Unable to map '%s' (" ZD " to " ZD "): %s\n", mFileName, (ZD_TYPE) dirOffset, (ZD_TYPE) (dirOffset + dirSize), strerror(errno)); return false; } mNumEntries = numEntries; mDirectoryOffset = dirOffset; return true; } bool ZipFileRO::parseZipArchive(void) { bool result = false; const unsigned char* cdPtr = (const unsigned char*) mDirectoryMap->getDataPtr(); size_t cdLength = mDirectoryMap->getDataLength(); int numEntries = mNumEntries; /* * Create hash table. We have a minimum 75% load factor, possibly as * low as 50% after we round off to a power of 2. */ mHashTableSize = roundUpPower2(1 + (numEntries * 4) / 3); mHashTable = (HashEntry*) calloc(mHashTableSize, sizeof(HashEntry)); /* * Walk through the central directory, adding entries to the hash * table. */ const unsigned char* ptr = cdPtr; for (int i = 0; i < numEntries; i++) { if (get4LE(ptr) != kCDESignature) { ALOGW("Missed a central dir sig (at %d)\n", i); goto bail; } if (ptr + kCDELen > cdPtr + cdLength) { ALOGW("Ran off the end (at %d)\n", i); goto bail; } long localHdrOffset = (long) get4LE(ptr + kCDELocalOffset); if (localHdrOffset >= mDirectoryOffset) { ALOGW("bad LFH offset %ld at entry %d\n", localHdrOffset, i); goto bail; } unsigned int fileNameLen, extraLen, commentLen, hash; fileNameLen = get2LE(ptr + kCDENameLen); extraLen = get2LE(ptr + kCDEExtraLen); commentLen = get2LE(ptr + kCDECommentLen); /* add the CDE filename to the hash table */ hash = computeHash((const char*)ptr + kCDELen, fileNameLen); addToHash((const char*)ptr + kCDELen, fileNameLen, hash); ptr += kCDELen + fileNameLen + extraLen + commentLen; if ((size_t)(ptr - cdPtr) > cdLength) { ALOGW("bad CD advance (%d vs " ZD ") at entry %d\n", (int) (ptr - cdPtr), (ZD_TYPE) cdLength, i); goto bail; } } ALOGV("+++ zip good scan %d entries\n", numEntries); result = true; bail: return result; } /* * Simple string hash function for non-null-terminated strings. */ /*static*/ unsigned int ZipFileRO::computeHash(const char* str, int len) { unsigned int hash = 0; while (len--) hash = hash * 31 + *str++; return hash; } /* * Add a new entry to the hash table. */ void ZipFileRO::addToHash(const char* str, int strLen, unsigned int hash) { int ent = hash & (mHashTableSize-1); /* * We over-allocate the table, so we're guaranteed to find an empty slot. */ while (mHashTable[ent].name != NULL) ent = (ent + 1) & (mHashTableSize-1); mHashTable[ent].name = str; mHashTable[ent].nameLen = strLen; } /* * Find a matching entry. * * Returns NULL if not found. */ ZipEntryRO ZipFileRO::findEntryByName(const char* fileName) const { /* * If the ZipFileRO instance is not initialized, the entry number will * end up being garbage since mHashTableSize is -1. */ if (mHashTableSize <= 0) { return NULL; } int nameLen = strlen(fileName); unsigned int hash = computeHash(fileName, nameLen); int ent = hash & (mHashTableSize-1); while (mHashTable[ent].name != NULL) { if (mHashTable[ent].nameLen == nameLen && memcmp(mHashTable[ent].name, fileName, nameLen) == 0) { /* match */ return (ZipEntryRO)(long)(ent + kZipEntryAdj); } ent = (ent + 1) & (mHashTableSize-1); } return NULL; } /* * Find the Nth entry. * * This currently involves walking through the sparse hash table, counting * non-empty entries. If we need to speed this up we can either allocate * a parallel lookup table or (perhaps better) provide an iterator interface. */ ZipEntryRO ZipFileRO::findEntryByIndex(int idx) const { if (idx < 0 || idx >= mNumEntries) { ALOGW("Invalid index %d\n", idx); return NULL; } for (int ent = 0; ent < mHashTableSize; ent++) { if (mHashTable[ent].name != NULL) { if (idx-- == 0) return (ZipEntryRO) (ent + kZipEntryAdj); } } return NULL; } /* * Get the useful fields from the zip entry. * * Returns "false" if the offsets to the fields or the contents of the fields * appear to be bogus. */ bool ZipFileRO::getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen, size_t* pCompLen, off64_t* pOffset, long* pModWhen, long* pCrc32) const { bool ret = false; const int ent = entryToIndex(entry); if (ent < 0) return false; HashEntry hashEntry = mHashTable[ent]; /* * Recover the start of the central directory entry from the filename * pointer. The filename is the first entry past the fixed-size data, * so we can just subtract back from that. */ const unsigned char* ptr = (const unsigned char*) hashEntry.name; off64_t cdOffset = mDirectoryOffset; ptr -= kCDELen; int method = get2LE(ptr + kCDEMethod); if (pMethod != NULL) *pMethod = method; if (pModWhen != NULL) *pModWhen = get4LE(ptr + kCDEModWhen); if (pCrc32 != NULL) *pCrc32 = get4LE(ptr + kCDECRC); size_t compLen = get4LE(ptr + kCDECompLen); if (pCompLen != NULL) *pCompLen = compLen; size_t uncompLen = get4LE(ptr + kCDEUncompLen); if (pUncompLen != NULL) *pUncompLen = uncompLen; /* * If requested, determine the offset of the start of the data. All we * have is the offset to the Local File Header, which is variable size, * so we have to read the contents of the struct to figure out where * the actual data starts. * * We also need to make sure that the lengths are not so large that * somebody trying to map the compressed or uncompressed data runs * off the end of the mapped region. * * Note we don't verify compLen/uncompLen if they don't request the * dataOffset, because dataOffset is expensive to determine. However, * if they don't have the file offset, they're not likely to be doing * anything with the contents. */ if (pOffset != NULL) { long localHdrOffset = get4LE(ptr + kCDELocalOffset); if (localHdrOffset + kLFHLen >= cdOffset) { ALOGE("ERROR: bad local hdr offset in zip\n"); return false; } unsigned char lfhBuf[kLFHLen]; #ifdef HAVE_PREAD /* * This file descriptor might be from zygote's preloaded assets, * so we need to do an pread64() instead of a lseek64() + read() to * guarantee atomicity across the processes with the shared file * descriptors. */ ssize_t actual = TEMP_FAILURE_RETRY(pread64(mFd, lfhBuf, sizeof(lfhBuf), localHdrOffset)); if (actual != sizeof(lfhBuf)) { ALOGW("failed reading lfh from offset %ld\n", localHdrOffset); return false; } if (get4LE(lfhBuf) != kLFHSignature) { ALOGW("didn't find signature at start of lfh; wanted: offset=%ld data=0x%08x; " "got: data=0x%08lx\n", localHdrOffset, kLFHSignature, get4LE(lfhBuf)); return false; } #else /* HAVE_PREAD */ /* * For hosts don't have pread64() we cannot guarantee atomic reads from * an offset in a file. Android should never run on those platforms. * File descriptors inherited from a fork() share file offsets and * there would be nothing to protect from two different processes * calling lseek64() concurrently. */ { AutoMutex _l(mFdLock); if (lseek64(mFd, localHdrOffset, SEEK_SET) != localHdrOffset) { ALOGW("failed seeking to lfh at offset %ld\n", localHdrOffset); return false; } ssize_t actual = TEMP_FAILURE_RETRY(read(mFd, lfhBuf, sizeof(lfhBuf))); if (actual != sizeof(lfhBuf)) { ALOGW("failed reading lfh from offset %ld\n", localHdrOffset); return false; } if (get4LE(lfhBuf) != kLFHSignature) { off64_t actualOffset = lseek64(mFd, 0, SEEK_CUR); ALOGW("didn't find signature at start of lfh; wanted: offset=%ld data=0x%08x; " "got: offset=" ZD " data=0x%08lx\n", localHdrOffset, kLFHSignature, (ZD_TYPE) actualOffset, get4LE(lfhBuf)); return false; } } #endif /* HAVE_PREAD */ off64_t dataOffset = localHdrOffset + kLFHLen + get2LE(lfhBuf + kLFHNameLen) + get2LE(lfhBuf + kLFHExtraLen); if (dataOffset >= cdOffset) { ALOGW("bad data offset %ld in zip\n", (long) dataOffset); return false; } /* check lengths */ if ((off64_t)(dataOffset + compLen) > cdOffset) { ALOGW("bad compressed length in zip (%ld + " ZD " > %ld)\n", (long) dataOffset, (ZD_TYPE) compLen, (long) cdOffset); return false; } if (method == kCompressStored && (off64_t)(dataOffset + uncompLen) > cdOffset) { ALOGE("ERROR: bad uncompressed length in zip (%ld + " ZD " > %ld)\n", (long) dataOffset, (ZD_TYPE) uncompLen, (long) cdOffset); return false; } *pOffset = dataOffset; } return true; } /* * Copy the entry's filename to the buffer. */ int ZipFileRO::getEntryFileName(ZipEntryRO entry, char* buffer, int bufLen) const { int ent = entryToIndex(entry); if (ent < 0) return -1; int nameLen = mHashTable[ent].nameLen; if (bufLen < nameLen+1) return nameLen+1; memcpy(buffer, mHashTable[ent].name, nameLen); buffer[nameLen] = '\0'; return 0; } /* * Create a new FileMap object that spans the data in "entry". */ FileMap* ZipFileRO::createEntryFileMap(ZipEntryRO entry) const { /* * TODO: the efficient way to do this is to modify FileMap to allow * sub-regions of a file to be mapped. A reference-counting scheme * can manage the base memory mapping. For now, we just create a brand * new mapping off of the Zip archive file descriptor. */ FileMap* newMap; size_t compLen; off64_t offset; if (!getEntryInfo(entry, NULL, NULL, &compLen, &offset, NULL, NULL)) return NULL; newMap = new FileMap(); if (!newMap->create(mFileName, mFd, offset, compLen, true)) { newMap->release(); return NULL; } return newMap; } /* * Uncompress an entry, in its entirety, into the provided output buffer. * * This doesn't verify the data's CRC, which might be useful for * uncompressed data. The caller should be able to manage it. */ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, void* buffer) const { const size_t kSequentialMin = 32768; bool result = false; int ent = entryToIndex(entry); if (ent < 0) return -1; int method; size_t uncompLen, compLen; off64_t offset; const unsigned char* ptr; getEntryInfo(entry, &method, &uncompLen, &compLen, &offset, NULL, NULL); FileMap* file = createEntryFileMap(entry); if (file == NULL) { goto bail; } ptr = (const unsigned char*) file->getDataPtr(); /* * Experiment with madvise hint. When we want to uncompress a file, * we pull some stuff out of the central dir entry and then hit a * bunch of compressed or uncompressed data sequentially. The CDE * visit will cause a limited amount of read-ahead because it's at * the end of the file. We could end up doing lots of extra disk * access if the file we're prying open is small. Bottom line is we * probably don't want to turn MADV_SEQUENTIAL on and leave it on. * * So, if the compressed size of the file is above a certain minimum * size, temporarily boost the read-ahead in the hope that the extra * pair of system calls are negated by a reduction in page faults. */ if (compLen > kSequentialMin) file->advise(FileMap::SEQUENTIAL); if (method == kCompressStored) { memcpy(buffer, ptr, uncompLen); } else { if (!inflateBuffer(buffer, ptr, uncompLen, compLen)) goto unmap; } if (compLen > kSequentialMin) file->advise(FileMap::NORMAL); result = true; unmap: file->release(); bail: return result; } /* * Uncompress an entry, in its entirety, to an open file descriptor. * * This doesn't verify the data's CRC, but probably should. */ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, int fd) const { bool result = false; int ent = entryToIndex(entry); if (ent < 0) return -1; int method; size_t uncompLen, compLen; off64_t offset; const unsigned char* ptr; getEntryInfo(entry, &method, &uncompLen, &compLen, &offset, NULL, NULL); FileMap* file = createEntryFileMap(entry); if (file == NULL) { goto bail; } ptr = (const unsigned char*) file->getDataPtr(); if (method == kCompressStored) { ssize_t actual = write(fd, ptr, uncompLen); if (actual < 0) { ALOGE("Write failed: %s\n", strerror(errno)); goto unmap; } else if ((size_t) actual != uncompLen) { ALOGE("Partial write during uncompress (" ZD " of " ZD ")\n", (ZD_TYPE) actual, (ZD_TYPE) uncompLen); goto unmap; } else { ALOGI("+++ successful write\n"); } } else { if (!inflateBuffer(fd, ptr, uncompLen, compLen)) goto unmap; } result = true; unmap: file->release(); bail: return result; } /* * Uncompress "deflate" data from one buffer to another. */ /*static*/ bool ZipFileRO::inflateBuffer(void* outBuf, const void* inBuf, size_t uncompLen, size_t compLen) { bool result = false; z_stream zstream; int zerr; /* * Initialize the zlib stream struct. */ memset(&zstream, 0, sizeof(zstream)); zstream.zalloc = Z_NULL; zstream.zfree = Z_NULL; zstream.opaque = Z_NULL; zstream.next_in = (Bytef*)inBuf; zstream.avail_in = compLen; zstream.next_out = (Bytef*) outBuf; zstream.avail_out = uncompLen; zstream.data_type = Z_UNKNOWN; /* * Use the undocumented "negative window bits" feature to tell zlib * that there's no zlib header waiting for it. */ zerr = inflateInit2(&zstream, -MAX_WBITS); if (zerr != Z_OK) { if (zerr == Z_VERSION_ERROR) { ALOGE("Installed zlib is not compatible with linked version (%s)\n", ZLIB_VERSION); } else { ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); } goto bail; } /* * Expand data. */ zerr = inflate(&zstream, Z_FINISH); if (zerr != Z_STREAM_END) { ALOGW("Zip inflate failed, zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)\n", zerr, zstream.next_in, zstream.avail_in, zstream.next_out, zstream.avail_out); goto z_bail; } /* paranoia */ if (zstream.total_out != uncompLen) { ALOGW("Size mismatch on inflated file (%ld vs " ZD ")\n", zstream.total_out, (ZD_TYPE) uncompLen); goto z_bail; } result = true; z_bail: inflateEnd(&zstream); /* free up any allocated structures */ bail: return result; } /* * Uncompress "deflate" data from one buffer to an open file descriptor. */ /*static*/ bool ZipFileRO::inflateBuffer(int fd, const void* inBuf, size_t uncompLen, size_t compLen) { bool result = false; const size_t kWriteBufSize = 32768; unsigned char writeBuf[kWriteBufSize]; z_stream zstream; int zerr; /* * Initialize the zlib stream struct. */ memset(&zstream, 0, sizeof(zstream)); zstream.zalloc = Z_NULL; zstream.zfree = Z_NULL; zstream.opaque = Z_NULL; zstream.next_in = (Bytef*)inBuf; zstream.avail_in = compLen; zstream.next_out = (Bytef*) writeBuf; zstream.avail_out = sizeof(writeBuf); zstream.data_type = Z_UNKNOWN; /* * Use the undocumented "negative window bits" feature to tell zlib * that there's no zlib header waiting for it. */ zerr = inflateInit2(&zstream, -MAX_WBITS); if (zerr != Z_OK) { if (zerr == Z_VERSION_ERROR) { ALOGE("Installed zlib is not compatible with linked version (%s)\n", ZLIB_VERSION); } else { ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); } goto bail; } /* * Loop while we have more to do. */ do { /* * Expand data. */ zerr = inflate(&zstream, Z_NO_FLUSH); if (zerr != Z_OK && zerr != Z_STREAM_END) { ALOGW("zlib inflate: zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)\n", zerr, zstream.next_in, zstream.avail_in, zstream.next_out, zstream.avail_out); goto z_bail; } /* write when we're full or when we're done */ if (zstream.avail_out == 0 || (zerr == Z_STREAM_END && zstream.avail_out != sizeof(writeBuf))) { long writeSize = zstream.next_out - writeBuf; int cc = write(fd, writeBuf, writeSize); if (cc != (int) writeSize) { ALOGW("write failed in inflate (%d vs %ld)\n", cc, writeSize); goto z_bail; } zstream.next_out = writeBuf; zstream.avail_out = sizeof(writeBuf); } } while (zerr == Z_OK); assert(zerr == Z_STREAM_END); /* other errors should've been caught */ /* paranoia */ if (zstream.total_out != uncompLen) { ALOGW("Size mismatch on inflated file (%ld vs " ZD ")\n", zstream.total_out, (ZD_TYPE) uncompLen); goto z_bail; } result = true; z_bail: inflateEnd(&zstream); /* free up any allocated structures */ bail: return result; } android-audiosystem-1.8+13.10.20130807/lib/utils/Android.mk0000644000015700001700000000556012200324306023517 0ustar pbuserpbgroup00000000000000# Copyright (C) 2008 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. LOCAL_PATH:= $(call my-dir) # libutils is a little unique: It's built twice, once for the host # and once for the device. commonSources:= \ Asset.cpp \ AssetDir.cpp \ AssetManager.cpp \ BlobCache.cpp \ BufferedTextOutput.cpp \ CallStack.cpp \ Debug.cpp \ FileMap.cpp \ Flattenable.cpp \ LinearTransform.cpp \ ObbFile.cpp \ PropertyMap.cpp \ RefBase.cpp \ ResourceTypes.cpp \ SharedBuffer.cpp \ Static.cpp \ StopWatch.cpp \ StreamingZipInflater.cpp \ String8.cpp \ String16.cpp \ StringArray.cpp \ SystemClock.cpp \ TextOutput.cpp \ Threads.cpp \ Timers.cpp \ Tokenizer.cpp \ Unicode.cpp \ VectorImpl.cpp \ ZipFileCRO.cpp \ ZipFileRO.cpp \ ZipUtils.cpp \ misc.cpp # For the host # ===================================================== include $(CLEAR_VARS) LOCAL_SRC_FILES:= $(commonSources) LOCAL_MODULE:= libutils LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) LOCAL_C_INCLUDES += external/zlib ifeq ($(HOST_OS),windows) ifeq ($(strip $(USE_CYGWIN),),) # Under MinGW, ctype.h doesn't need multi-byte support LOCAL_CFLAGS += -DMB_CUR_MAX=1 endif endif ifeq ($(TARGET_OS),linux) LOCAL_LDLIBS += -lrt -ldl endif include $(BUILD_HOST_STATIC_LIBRARY) # For the device # ===================================================== include $(CLEAR_VARS) # we have the common sources, plus some device-specific stuff LOCAL_SRC_FILES:= \ $(commonSources) \ BackupData.cpp \ BackupHelpers.cpp \ Looper.cpp ifeq ($(TARGET_OS),linux) LOCAL_LDLIBS += -lrt -ldl endif LOCAL_C_INCLUDES += \ external/zlib \ external/icu4c/common LOCAL_LDLIBS += -lpthread LOCAL_SHARED_LIBRARIES := \ libz \ liblog \ libcutils \ libdl LOCAL_MODULE:= libutils include $(BUILD_SHARED_LIBRARY) ifeq ($(TARGET_OS),linux) include $(CLEAR_VARS) LOCAL_C_INCLUDES += external/zlib external/icu4c/common LOCAL_LDLIBS := -lrt -ldl -lpthread LOCAL_MODULE := libutils LOCAL_SRC_FILES := $(commonSources) BackupData.cpp BackupHelpers.cpp include $(BUILD_STATIC_LIBRARY) endif # Include subdirectory makefiles # ============================================================ # If we're building with ONE_SHOT_MAKEFILE (mm, mmm), then what the framework # team really wants is to build the stuff defined by this makefile. ifeq (,$(ONE_SHOT_MAKEFILE)) include $(call first-makefiles-under,$(LOCAL_PATH)) endif android-audiosystem-1.8+13.10.20130807/lib/utils/tests/0000755000015700001700000000000012200324404022741 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/lib/utils/tests/Looper_test.cpp0000644000015700001700000006421612200324306025756 0ustar pbuserpbgroup00000000000000// // Copyright 2010 The Android Open Source Project // #include #include #include #include #include #include #include "TestHelpers.h" // # of milliseconds to fudge stopwatch measurements #define TIMING_TOLERANCE_MS 25 namespace android { enum { MSG_TEST1 = 1, MSG_TEST2 = 2, MSG_TEST3 = 3, MSG_TEST4 = 4, }; class DelayedWake : public DelayedTask { sp mLooper; public: DelayedWake(int delayMillis, const sp looper) : DelayedTask(delayMillis), mLooper(looper) { } protected: virtual void doTask() { mLooper->wake(); } }; class DelayedWriteSignal : public DelayedTask { Pipe* mPipe; public: DelayedWriteSignal(int delayMillis, Pipe* pipe) : DelayedTask(delayMillis), mPipe(pipe) { } protected: virtual void doTask() { mPipe->writeSignal(); } }; class CallbackHandler { public: void setCallback(const sp& looper, int fd, int events) { looper->addFd(fd, 0, events, staticHandler, this); } protected: virtual ~CallbackHandler() { } virtual int handler(int fd, int events) = 0; private: static int staticHandler(int fd, int events, void* data) { return static_cast(data)->handler(fd, events); } }; class StubCallbackHandler : public CallbackHandler { public: int nextResult; int callbackCount; int fd; int events; StubCallbackHandler(int nextResult) : nextResult(nextResult), callbackCount(0), fd(-1), events(-1) { } protected: virtual int handler(int fd, int events) { callbackCount += 1; this->fd = fd; this->events = events; return nextResult; } }; class StubMessageHandler : public MessageHandler { public: Vector messages; virtual void handleMessage(const Message& message) { messages.push(message); } }; class LooperTest : public testing::Test { protected: sp mLooper; virtual void SetUp() { mLooper = new Looper(true); } virtual void TearDown() { mLooper.clear(); } }; TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndNotAwoken_WaitsForTimeout) { StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(100); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should approx. equal timeout"; EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) << "pollOnce result should be ALOOPER_POLL_TIMEOUT"; } TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndAwokenBeforeWaiting_ImmediatelyReturns) { mLooper->wake(); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(1000); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should approx. zero because wake() was called before waiting"; EXPECT_EQ(ALOOPER_POLL_WAKE, result) << "pollOnce result should be ALOOPER_POLL_CALLBACK because loop was awoken"; } TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndAwokenWhileWaiting_PromptlyReturns) { sp delayedWake = new DelayedWake(100, mLooper); delayedWake->run(); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(1000); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should approx. equal wake delay"; EXPECT_EQ(ALOOPER_POLL_WAKE, result) << "pollOnce result should be ALOOPER_POLL_CALLBACK because loop was awoken"; } TEST_F(LooperTest, PollOnce_WhenZeroTimeoutAndNoRegisteredFDs_ImmediatelyReturns) { StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(0); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should be approx. zero"; EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) << "pollOnce result should be ALOOPER_POLL_TIMEOUT"; } TEST_F(LooperTest, PollOnce_WhenZeroTimeoutAndNoSignalledFDs_ImmediatelyReturns) { Pipe pipe; StubCallbackHandler handler(true); handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(0); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should be approx. zero"; EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) << "pollOnce result should be ALOOPER_POLL_TIMEOUT"; EXPECT_EQ(0, handler.callbackCount) << "callback should not have been invoked because FD was not signalled"; } TEST_F(LooperTest, PollOnce_WhenZeroTimeoutAndSignalledFD_ImmediatelyInvokesCallbackAndReturns) { Pipe pipe; StubCallbackHandler handler(true); ASSERT_EQ(OK, pipe.writeSignal()); handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(0); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should be approx. zero"; EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) << "pollOnce result should be ALOOPER_POLL_CALLBACK because FD was signalled"; EXPECT_EQ(1, handler.callbackCount) << "callback should be invoked exactly once"; EXPECT_EQ(pipe.receiveFd, handler.fd) << "callback should have received pipe fd as parameter"; EXPECT_EQ(ALOOPER_EVENT_INPUT, handler.events) << "callback should have received ALOOPER_EVENT_INPUT as events"; } TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndNoSignalledFDs_WaitsForTimeoutAndReturns) { Pipe pipe; StubCallbackHandler handler(true); handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(100); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should approx. equal timeout"; EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) << "pollOnce result should be ALOOPER_POLL_TIMEOUT"; EXPECT_EQ(0, handler.callbackCount) << "callback should not have been invoked because FD was not signalled"; } TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndSignalledFDBeforeWaiting_ImmediatelyInvokesCallbackAndReturns) { Pipe pipe; StubCallbackHandler handler(true); pipe.writeSignal(); handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(100); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); ASSERT_EQ(OK, pipe.readSignal()) << "signal should actually have been written"; EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should be approx. zero"; EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) << "pollOnce result should be ALOOPER_POLL_CALLBACK because FD was signalled"; EXPECT_EQ(1, handler.callbackCount) << "callback should be invoked exactly once"; EXPECT_EQ(pipe.receiveFd, handler.fd) << "callback should have received pipe fd as parameter"; EXPECT_EQ(ALOOPER_EVENT_INPUT, handler.events) << "callback should have received ALOOPER_EVENT_INPUT as events"; } TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndSignalledFDWhileWaiting_PromptlyInvokesCallbackAndReturns) { Pipe pipe; StubCallbackHandler handler(true); sp delayedWriteSignal = new DelayedWriteSignal(100, & pipe); handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); delayedWriteSignal->run(); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(1000); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); ASSERT_EQ(OK, pipe.readSignal()) << "signal should actually have been written"; EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should approx. equal signal delay"; EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) << "pollOnce result should be ALOOPER_POLL_CALLBACK because FD was signalled"; EXPECT_EQ(1, handler.callbackCount) << "callback should be invoked exactly once"; EXPECT_EQ(pipe.receiveFd, handler.fd) << "callback should have received pipe fd as parameter"; EXPECT_EQ(ALOOPER_EVENT_INPUT, handler.events) << "callback should have received ALOOPER_EVENT_INPUT as events"; } TEST_F(LooperTest, PollOnce_WhenCallbackAddedThenRemoved_CallbackShouldNotBeInvoked) { Pipe pipe; StubCallbackHandler handler(true); handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); pipe.writeSignal(); // would cause FD to be considered signalled mLooper->removeFd(pipe.receiveFd); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(100); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); ASSERT_EQ(OK, pipe.readSignal()) << "signal should actually have been written"; EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should approx. equal timeout because FD was no longer registered"; EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) << "pollOnce result should be ALOOPER_POLL_TIMEOUT"; EXPECT_EQ(0, handler.callbackCount) << "callback should not be invoked"; } TEST_F(LooperTest, PollOnce_WhenCallbackReturnsFalse_CallbackShouldNotBeInvokedAgainLater) { Pipe pipe; StubCallbackHandler handler(false); handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); // First loop: Callback is registered and FD is signalled. pipe.writeSignal(); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(0); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); ASSERT_EQ(OK, pipe.readSignal()) << "signal should actually have been written"; EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should approx. equal zero because FD was already signalled"; EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) << "pollOnce result should be ALOOPER_POLL_CALLBACK because FD was signalled"; EXPECT_EQ(1, handler.callbackCount) << "callback should be invoked"; // Second loop: Callback is no longer registered and FD is signalled. pipe.writeSignal(); stopWatch.reset(); result = mLooper->pollOnce(0); elapsedMillis = ns2ms(stopWatch.elapsedTime()); ASSERT_EQ(OK, pipe.readSignal()) << "signal should actually have been written"; EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should approx. equal zero because timeout was zero"; EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) << "pollOnce result should be ALOOPER_POLL_TIMEOUT"; EXPECT_EQ(1, handler.callbackCount) << "callback should not be invoked this time"; } TEST_F(LooperTest, PollOnce_WhenNonCallbackFdIsSignalled_ReturnsIdent) { const int expectedIdent = 5; void* expectedData = this; Pipe pipe; pipe.writeSignal(); mLooper->addFd(pipe.receiveFd, expectedIdent, ALOOPER_EVENT_INPUT, NULL, expectedData); StopWatch stopWatch("pollOnce"); int fd; int events; void* data; int result = mLooper->pollOnce(100, &fd, &events, &data); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); ASSERT_EQ(OK, pipe.readSignal()) << "signal should actually have been written"; EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should be approx. zero"; EXPECT_EQ(expectedIdent, result) << "pollOnce result should be the ident of the FD that was signalled"; EXPECT_EQ(pipe.receiveFd, fd) << "pollOnce should have returned the received pipe fd"; EXPECT_EQ(ALOOPER_EVENT_INPUT, events) << "pollOnce should have returned ALOOPER_EVENT_INPUT as events"; EXPECT_EQ(expectedData, data) << "pollOnce should have returned the data"; } TEST_F(LooperTest, AddFd_WhenCallbackAdded_ReturnsOne) { Pipe pipe; int result = mLooper->addFd(pipe.receiveFd, 0, ALOOPER_EVENT_INPUT, NULL, NULL); EXPECT_EQ(1, result) << "addFd should return 1 because FD was added"; } TEST_F(LooperTest, AddFd_WhenIdentIsNegativeAndCallbackIsNull_ReturnsError) { Pipe pipe; int result = mLooper->addFd(pipe.receiveFd, -1, ALOOPER_EVENT_INPUT, NULL, NULL); EXPECT_EQ(-1, result) << "addFd should return -1 because arguments were invalid"; } TEST_F(LooperTest, AddFd_WhenNoCallbackAndAllowNonCallbacksIsFalse_ReturnsError) { Pipe pipe; sp looper = new Looper(false /*allowNonCallbacks*/); int result = looper->addFd(pipe.receiveFd, 0, 0, NULL, NULL); EXPECT_EQ(-1, result) << "addFd should return -1 because arguments were invalid"; } TEST_F(LooperTest, RemoveFd_WhenCallbackNotAdded_ReturnsZero) { int result = mLooper->removeFd(1); EXPECT_EQ(0, result) << "removeFd should return 0 because FD not registered"; } TEST_F(LooperTest, RemoveFd_WhenCallbackAddedThenRemovedTwice_ReturnsOnceFirstTimeAndReturnsZeroSecondTime) { Pipe pipe; StubCallbackHandler handler(false); handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); // First time. int result = mLooper->removeFd(pipe.receiveFd); EXPECT_EQ(1, result) << "removeFd should return 1 first time because FD was registered"; // Second time. result = mLooper->removeFd(pipe.receiveFd); EXPECT_EQ(0, result) << "removeFd should return 0 second time because FD was no longer registered"; } TEST_F(LooperTest, PollOnce_WhenCallbackAddedTwice_OnlySecondCallbackShouldBeInvoked) { Pipe pipe; StubCallbackHandler handler1(true); StubCallbackHandler handler2(true); handler1.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); handler2.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); // replace it pipe.writeSignal(); // would cause FD to be considered signalled StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(100); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); ASSERT_EQ(OK, pipe.readSignal()) << "signal should actually have been written"; EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should approx. zero because FD was already signalled"; EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) << "pollOnce result should be ALOOPER_POLL_CALLBACK because FD was signalled"; EXPECT_EQ(0, handler1.callbackCount) << "original handler callback should not be invoked because it was replaced"; EXPECT_EQ(1, handler2.callbackCount) << "replacement handler callback should be invoked"; } TEST_F(LooperTest, SendMessage_WhenOneMessageIsEnqueue_ShouldInvokeHandlerDuringNextPoll) { sp handler = new StubMessageHandler(); mLooper->sendMessage(handler, Message(MSG_TEST1)); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(100); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should approx. zero because message was already sent"; EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent"; EXPECT_EQ(size_t(1), handler->messages.size()) << "handled message"; EXPECT_EQ(MSG_TEST1, handler->messages[0].what) << "handled message"; } TEST_F(LooperTest, SendMessage_WhenMultipleMessagesAreEnqueued_ShouldInvokeHandlersInOrderDuringNextPoll) { sp handler1 = new StubMessageHandler(); sp handler2 = new StubMessageHandler(); mLooper->sendMessage(handler1, Message(MSG_TEST1)); mLooper->sendMessage(handler2, Message(MSG_TEST2)); mLooper->sendMessage(handler1, Message(MSG_TEST3)); mLooper->sendMessage(handler1, Message(MSG_TEST4)); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(1000); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should approx. zero because message was already sent"; EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent"; EXPECT_EQ(size_t(3), handler1->messages.size()) << "handled message"; EXPECT_EQ(MSG_TEST1, handler1->messages[0].what) << "handled message"; EXPECT_EQ(MSG_TEST3, handler1->messages[1].what) << "handled message"; EXPECT_EQ(MSG_TEST4, handler1->messages[2].what) << "handled message"; EXPECT_EQ(size_t(1), handler2->messages.size()) << "handled message"; EXPECT_EQ(MSG_TEST2, handler2->messages[0].what) << "handled message"; } TEST_F(LooperTest, SendMessageDelayed_WhenSentToTheFuture_ShouldInvokeHandlerAfterDelayTime) { sp handler = new StubMessageHandler(); mLooper->sendMessageDelayed(ms2ns(100), handler, Message(MSG_TEST1)); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(1000); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) << "first poll should end quickly because next message timeout was computed"; EXPECT_EQ(ALOOPER_POLL_WAKE, result) << "pollOnce result should be ALOOPER_POLL_WAKE due to wakeup"; EXPECT_EQ(size_t(0), handler->messages.size()) << "no message handled yet"; result = mLooper->pollOnce(1000); elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_EQ(size_t(1), handler->messages.size()) << "handled message"; EXPECT_EQ(MSG_TEST1, handler->messages[0].what) << "handled message"; EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS) << "second poll should end around the time of the delayed message dispatch"; EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent"; result = mLooper->pollOnce(100); elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_NEAR(100 + 100, elapsedMillis, TIMING_TOLERANCE_MS) << "third poll should timeout"; EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) << "pollOnce result should be ALOOPER_POLL_TIMEOUT because there were no messages left"; } TEST_F(LooperTest, SendMessageDelayed_WhenSentToThePast_ShouldInvokeHandlerDuringNextPoll) { sp handler = new StubMessageHandler(); mLooper->sendMessageDelayed(ms2ns(-1000), handler, Message(MSG_TEST1)); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(100); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should approx. zero because message was already sent"; EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent"; EXPECT_EQ(size_t(1), handler->messages.size()) << "handled message"; EXPECT_EQ(MSG_TEST1, handler->messages[0].what) << "handled message"; } TEST_F(LooperTest, SendMessageDelayed_WhenSentToThePresent_ShouldInvokeHandlerDuringNextPoll) { sp handler = new StubMessageHandler(); mLooper->sendMessageDelayed(0, handler, Message(MSG_TEST1)); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(100); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should approx. zero because message was already sent"; EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent"; EXPECT_EQ(size_t(1), handler->messages.size()) << "handled message"; EXPECT_EQ(MSG_TEST1, handler->messages[0].what) << "handled message"; } TEST_F(LooperTest, SendMessageAtTime_WhenSentToTheFuture_ShouldInvokeHandlerAfterDelayTime) { nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); sp handler = new StubMessageHandler(); mLooper->sendMessageAtTime(now + ms2ns(100), handler, Message(MSG_TEST1)); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(1000); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) << "first poll should end quickly because next message timeout was computed"; EXPECT_EQ(ALOOPER_POLL_WAKE, result) << "pollOnce result should be ALOOPER_POLL_WAKE due to wakeup"; EXPECT_EQ(size_t(0), handler->messages.size()) << "no message handled yet"; result = mLooper->pollOnce(1000); elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_EQ(size_t(1), handler->messages.size()) << "handled message"; EXPECT_EQ(MSG_TEST1, handler->messages[0].what) << "handled message"; EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS) << "second poll should end around the time of the delayed message dispatch"; EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent"; result = mLooper->pollOnce(100); elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_NEAR(100 + 100, elapsedMillis, TIMING_TOLERANCE_MS) << "third poll should timeout"; EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) << "pollOnce result should be ALOOPER_POLL_TIMEOUT because there were no messages left"; } TEST_F(LooperTest, SendMessageAtTime_WhenSentToThePast_ShouldInvokeHandlerDuringNextPoll) { nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); sp handler = new StubMessageHandler(); mLooper->sendMessageAtTime(now - ms2ns(1000), handler, Message(MSG_TEST1)); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(100); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should approx. zero because message was already sent"; EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent"; EXPECT_EQ(size_t(1), handler->messages.size()) << "handled message"; EXPECT_EQ(MSG_TEST1, handler->messages[0].what) << "handled message"; } TEST_F(LooperTest, SendMessageAtTime_WhenSentToThePresent_ShouldInvokeHandlerDuringNextPoll) { nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); sp handler = new StubMessageHandler(); mLooper->sendMessageAtTime(now, handler, Message(MSG_TEST1)); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(100); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should approx. zero because message was already sent"; EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent"; EXPECT_EQ(size_t(1), handler->messages.size()) << "handled message"; EXPECT_EQ(MSG_TEST1, handler->messages[0].what) << "handled message"; } TEST_F(LooperTest, RemoveMessage_WhenRemovingAllMessagesForHandler_ShouldRemoveThoseMessage) { sp handler = new StubMessageHandler(); mLooper->sendMessage(handler, Message(MSG_TEST1)); mLooper->sendMessage(handler, Message(MSG_TEST2)); mLooper->sendMessage(handler, Message(MSG_TEST3)); mLooper->removeMessages(handler); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(0); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should approx. zero because message was sent so looper was awoken"; EXPECT_EQ(ALOOPER_POLL_WAKE, result) << "pollOnce result should be ALOOPER_POLL_WAKE because looper was awoken"; EXPECT_EQ(size_t(0), handler->messages.size()) << "no messages to handle"; result = mLooper->pollOnce(0); EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) << "pollOnce result should be ALOOPER_POLL_TIMEOUT because there was nothing to do"; EXPECT_EQ(size_t(0), handler->messages.size()) << "no messages to handle"; } TEST_F(LooperTest, RemoveMessage_WhenRemovingSomeMessagesForHandler_ShouldRemoveThoseMessage) { sp handler = new StubMessageHandler(); mLooper->sendMessage(handler, Message(MSG_TEST1)); mLooper->sendMessage(handler, Message(MSG_TEST2)); mLooper->sendMessage(handler, Message(MSG_TEST3)); mLooper->sendMessage(handler, Message(MSG_TEST4)); mLooper->removeMessages(handler, MSG_TEST3); mLooper->removeMessages(handler, MSG_TEST1); StopWatch stopWatch("pollOnce"); int result = mLooper->pollOnce(0); int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) << "elapsed time should approx. zero because message was sent so looper was awoken"; EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) << "pollOnce result should be ALOOPER_POLL_CALLBACK because two messages were sent"; EXPECT_EQ(size_t(2), handler->messages.size()) << "no messages to handle"; EXPECT_EQ(MSG_TEST2, handler->messages[0].what) << "handled message"; EXPECT_EQ(MSG_TEST4, handler->messages[1].what) << "handled message"; result = mLooper->pollOnce(0); EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) << "pollOnce result should be ALOOPER_POLL_TIMEOUT because there was nothing to do"; EXPECT_EQ(size_t(2), handler->messages.size()) << "no more messages to handle"; } } // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/tests/BlobCache_test.cpp0000644000015700001700000003012412200324306026307 0ustar pbuserpbgroup00000000000000/* ** Copyright 2011, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include #include #include #include #include namespace android { class BlobCacheTest : public ::testing::Test { protected: enum { MAX_KEY_SIZE = 6, MAX_VALUE_SIZE = 8, MAX_TOTAL_SIZE = 13, }; virtual void SetUp() { mBC = new BlobCache(MAX_KEY_SIZE, MAX_VALUE_SIZE, MAX_TOTAL_SIZE); } virtual void TearDown() { mBC.clear(); } sp mBC; }; TEST_F(BlobCacheTest, CacheSingleValueSucceeds) { char buf[4] = { 0xee, 0xee, 0xee, 0xee }; mBC->set("abcd", 4, "efgh", 4); ASSERT_EQ(size_t(4), mBC->get("abcd", 4, buf, 4)); ASSERT_EQ('e', buf[0]); ASSERT_EQ('f', buf[1]); ASSERT_EQ('g', buf[2]); ASSERT_EQ('h', buf[3]); } TEST_F(BlobCacheTest, CacheTwoValuesSucceeds) { char buf[2] = { 0xee, 0xee }; mBC->set("ab", 2, "cd", 2); mBC->set("ef", 2, "gh", 2); ASSERT_EQ(size_t(2), mBC->get("ab", 2, buf, 2)); ASSERT_EQ('c', buf[0]); ASSERT_EQ('d', buf[1]); ASSERT_EQ(size_t(2), mBC->get("ef", 2, buf, 2)); ASSERT_EQ('g', buf[0]); ASSERT_EQ('h', buf[1]); } TEST_F(BlobCacheTest, GetOnlyWritesInsideBounds) { char buf[6] = { 0xee, 0xee, 0xee, 0xee, 0xee, 0xee }; mBC->set("abcd", 4, "efgh", 4); ASSERT_EQ(size_t(4), mBC->get("abcd", 4, buf+1, 4)); ASSERT_EQ(0xee, buf[0]); ASSERT_EQ('e', buf[1]); ASSERT_EQ('f', buf[2]); ASSERT_EQ('g', buf[3]); ASSERT_EQ('h', buf[4]); ASSERT_EQ(0xee, buf[5]); } TEST_F(BlobCacheTest, GetOnlyWritesIfBufferIsLargeEnough) { char buf[3] = { 0xee, 0xee, 0xee }; mBC->set("abcd", 4, "efgh", 4); ASSERT_EQ(size_t(4), mBC->get("abcd", 4, buf, 3)); ASSERT_EQ(0xee, buf[0]); ASSERT_EQ(0xee, buf[1]); ASSERT_EQ(0xee, buf[2]); } TEST_F(BlobCacheTest, GetDoesntAccessNullBuffer) { mBC->set("abcd", 4, "efgh", 4); ASSERT_EQ(size_t(4), mBC->get("abcd", 4, NULL, 0)); } TEST_F(BlobCacheTest, MultipleSetsCacheLatestValue) { char buf[4] = { 0xee, 0xee, 0xee, 0xee }; mBC->set("abcd", 4, "efgh", 4); mBC->set("abcd", 4, "ijkl", 4); ASSERT_EQ(size_t(4), mBC->get("abcd", 4, buf, 4)); ASSERT_EQ('i', buf[0]); ASSERT_EQ('j', buf[1]); ASSERT_EQ('k', buf[2]); ASSERT_EQ('l', buf[3]); } TEST_F(BlobCacheTest, SecondSetKeepsFirstValueIfTooLarge) { char buf[MAX_VALUE_SIZE+1] = { 0xee, 0xee, 0xee, 0xee }; mBC->set("abcd", 4, "efgh", 4); mBC->set("abcd", 4, buf, MAX_VALUE_SIZE+1); ASSERT_EQ(size_t(4), mBC->get("abcd", 4, buf, 4)); ASSERT_EQ('e', buf[0]); ASSERT_EQ('f', buf[1]); ASSERT_EQ('g', buf[2]); ASSERT_EQ('h', buf[3]); } TEST_F(BlobCacheTest, DoesntCacheIfKeyIsTooBig) { char key[MAX_KEY_SIZE+1]; char buf[4] = { 0xee, 0xee, 0xee, 0xee }; for (int i = 0; i < MAX_KEY_SIZE+1; i++) { key[i] = 'a'; } mBC->set(key, MAX_KEY_SIZE+1, "bbbb", 4); ASSERT_EQ(size_t(0), mBC->get(key, MAX_KEY_SIZE+1, buf, 4)); ASSERT_EQ(0xee, buf[0]); ASSERT_EQ(0xee, buf[1]); ASSERT_EQ(0xee, buf[2]); ASSERT_EQ(0xee, buf[3]); } TEST_F(BlobCacheTest, DoesntCacheIfValueIsTooBig) { char buf[MAX_VALUE_SIZE+1]; for (int i = 0; i < MAX_VALUE_SIZE+1; i++) { buf[i] = 'b'; } mBC->set("abcd", 4, buf, MAX_VALUE_SIZE+1); for (int i = 0; i < MAX_VALUE_SIZE+1; i++) { buf[i] = 0xee; } ASSERT_EQ(size_t(0), mBC->get("abcd", 4, buf, MAX_VALUE_SIZE+1)); for (int i = 0; i < MAX_VALUE_SIZE+1; i++) { SCOPED_TRACE(i); ASSERT_EQ(0xee, buf[i]); } } TEST_F(BlobCacheTest, DoesntCacheIfKeyValuePairIsTooBig) { // Check a testing assumptions ASSERT_TRUE(MAX_TOTAL_SIZE < MAX_KEY_SIZE + MAX_VALUE_SIZE); ASSERT_TRUE(MAX_KEY_SIZE < MAX_TOTAL_SIZE); enum { bufSize = MAX_TOTAL_SIZE - MAX_KEY_SIZE + 1 }; char key[MAX_KEY_SIZE]; char buf[bufSize]; for (int i = 0; i < MAX_KEY_SIZE; i++) { key[i] = 'a'; } for (int i = 0; i < bufSize; i++) { buf[i] = 'b'; } mBC->set(key, MAX_KEY_SIZE, buf, MAX_VALUE_SIZE); ASSERT_EQ(size_t(0), mBC->get(key, MAX_KEY_SIZE, NULL, 0)); } TEST_F(BlobCacheTest, CacheMaxKeySizeSucceeds) { char key[MAX_KEY_SIZE]; char buf[4] = { 0xee, 0xee, 0xee, 0xee }; for (int i = 0; i < MAX_KEY_SIZE; i++) { key[i] = 'a'; } mBC->set(key, MAX_KEY_SIZE, "wxyz", 4); ASSERT_EQ(size_t(4), mBC->get(key, MAX_KEY_SIZE, buf, 4)); ASSERT_EQ('w', buf[0]); ASSERT_EQ('x', buf[1]); ASSERT_EQ('y', buf[2]); ASSERT_EQ('z', buf[3]); } TEST_F(BlobCacheTest, CacheMaxValueSizeSucceeds) { char buf[MAX_VALUE_SIZE]; for (int i = 0; i < MAX_VALUE_SIZE; i++) { buf[i] = 'b'; } mBC->set("abcd", 4, buf, MAX_VALUE_SIZE); for (int i = 0; i < MAX_VALUE_SIZE; i++) { buf[i] = 0xee; } ASSERT_EQ(size_t(MAX_VALUE_SIZE), mBC->get("abcd", 4, buf, MAX_VALUE_SIZE)); for (int i = 0; i < MAX_VALUE_SIZE; i++) { SCOPED_TRACE(i); ASSERT_EQ('b', buf[i]); } } TEST_F(BlobCacheTest, CacheMaxKeyValuePairSizeSucceeds) { // Check a testing assumption ASSERT_TRUE(MAX_KEY_SIZE < MAX_TOTAL_SIZE); enum { bufSize = MAX_TOTAL_SIZE - MAX_KEY_SIZE }; char key[MAX_KEY_SIZE]; char buf[bufSize]; for (int i = 0; i < MAX_KEY_SIZE; i++) { key[i] = 'a'; } for (int i = 0; i < bufSize; i++) { buf[i] = 'b'; } mBC->set(key, MAX_KEY_SIZE, buf, bufSize); ASSERT_EQ(size_t(bufSize), mBC->get(key, MAX_KEY_SIZE, NULL, 0)); } TEST_F(BlobCacheTest, CacheMinKeyAndValueSizeSucceeds) { char buf[1] = { 0xee }; mBC->set("x", 1, "y", 1); ASSERT_EQ(size_t(1), mBC->get("x", 1, buf, 1)); ASSERT_EQ('y', buf[0]); } TEST_F(BlobCacheTest, CacheSizeDoesntExceedTotalLimit) { for (int i = 0; i < 256; i++) { uint8_t k = i; mBC->set(&k, 1, "x", 1); } int numCached = 0; for (int i = 0; i < 256; i++) { uint8_t k = i; if (mBC->get(&k, 1, NULL, 0) == 1) { numCached++; } } ASSERT_GE(MAX_TOTAL_SIZE / 2, numCached); } TEST_F(BlobCacheTest, ExceedingTotalLimitHalvesCacheSize) { // Fill up the entire cache with 1 char key/value pairs. const int maxEntries = MAX_TOTAL_SIZE / 2; for (int i = 0; i < maxEntries; i++) { uint8_t k = i; mBC->set(&k, 1, "x", 1); } // Insert one more entry, causing a cache overflow. { uint8_t k = maxEntries; mBC->set(&k, 1, "x", 1); } // Count the number of entries in the cache. int numCached = 0; for (int i = 0; i < maxEntries+1; i++) { uint8_t k = i; if (mBC->get(&k, 1, NULL, 0) == 1) { numCached++; } } ASSERT_EQ(maxEntries/2 + 1, numCached); } class BlobCacheFlattenTest : public BlobCacheTest { protected: virtual void SetUp() { BlobCacheTest::SetUp(); mBC2 = new BlobCache(MAX_KEY_SIZE, MAX_VALUE_SIZE, MAX_TOTAL_SIZE); } virtual void TearDown() { mBC2.clear(); BlobCacheTest::TearDown(); } void roundTrip() { size_t size = mBC->getFlattenedSize(); uint8_t* flat = new uint8_t[size]; ASSERT_EQ(OK, mBC->flatten(flat, size, NULL, 0)); ASSERT_EQ(OK, mBC2->unflatten(flat, size, NULL, 0)); delete[] flat; } sp mBC2; }; TEST_F(BlobCacheFlattenTest, FlattenOneValue) { char buf[4] = { 0xee, 0xee, 0xee, 0xee }; mBC->set("abcd", 4, "efgh", 4); roundTrip(); ASSERT_EQ(size_t(4), mBC2->get("abcd", 4, buf, 4)); ASSERT_EQ('e', buf[0]); ASSERT_EQ('f', buf[1]); ASSERT_EQ('g', buf[2]); ASSERT_EQ('h', buf[3]); } TEST_F(BlobCacheFlattenTest, FlattenFullCache) { // Fill up the entire cache with 1 char key/value pairs. const int maxEntries = MAX_TOTAL_SIZE / 2; for (int i = 0; i < maxEntries; i++) { uint8_t k = i; mBC->set(&k, 1, &k, 1); } roundTrip(); // Verify the deserialized cache for (int i = 0; i < maxEntries; i++) { uint8_t k = i; uint8_t v = 0xee; ASSERT_EQ(size_t(1), mBC2->get(&k, 1, &v, 1)); ASSERT_EQ(k, v); } } TEST_F(BlobCacheFlattenTest, FlattenDoesntChangeCache) { // Fill up the entire cache with 1 char key/value pairs. const int maxEntries = MAX_TOTAL_SIZE / 2; for (int i = 0; i < maxEntries; i++) { uint8_t k = i; mBC->set(&k, 1, &k, 1); } size_t size = mBC->getFlattenedSize(); uint8_t* flat = new uint8_t[size]; ASSERT_EQ(OK, mBC->flatten(flat, size, NULL, 0)); delete[] flat; // Verify the cache that we just serialized for (int i = 0; i < maxEntries; i++) { uint8_t k = i; uint8_t v = 0xee; ASSERT_EQ(size_t(1), mBC->get(&k, 1, &v, 1)); ASSERT_EQ(k, v); } } TEST_F(BlobCacheFlattenTest, FlattenCatchesBufferTooSmall) { // Fill up the entire cache with 1 char key/value pairs. const int maxEntries = MAX_TOTAL_SIZE / 2; for (int i = 0; i < maxEntries; i++) { uint8_t k = i; mBC->set(&k, 1, &k, 1); } size_t size = mBC->getFlattenedSize() - 1; uint8_t* flat = new uint8_t[size]; ASSERT_EQ(BAD_VALUE, mBC->flatten(flat, size, NULL, 0)); delete[] flat; } TEST_F(BlobCacheFlattenTest, UnflattenCatchesBadMagic) { char buf[4] = { 0xee, 0xee, 0xee, 0xee }; mBC->set("abcd", 4, "efgh", 4); size_t size = mBC->getFlattenedSize(); uint8_t* flat = new uint8_t[size]; ASSERT_EQ(OK, mBC->flatten(flat, size, NULL, 0)); flat[1] = ~flat[1]; // Bad magic should cause an error. ASSERT_EQ(BAD_VALUE, mBC2->unflatten(flat, size, NULL, 0)); delete[] flat; // The error should cause the unflatten to result in an empty cache ASSERT_EQ(size_t(0), mBC2->get("abcd", 4, buf, 4)); } TEST_F(BlobCacheFlattenTest, UnflattenCatchesBadBlobCacheVersion) { char buf[4] = { 0xee, 0xee, 0xee, 0xee }; mBC->set("abcd", 4, "efgh", 4); size_t size = mBC->getFlattenedSize(); uint8_t* flat = new uint8_t[size]; ASSERT_EQ(OK, mBC->flatten(flat, size, NULL, 0)); flat[5] = ~flat[5]; // Version mismatches shouldn't cause errors, but should not use the // serialized entries ASSERT_EQ(OK, mBC2->unflatten(flat, size, NULL, 0)); delete[] flat; // The version mismatch should cause the unflatten to result in an empty // cache ASSERT_EQ(size_t(0), mBC2->get("abcd", 4, buf, 4)); } TEST_F(BlobCacheFlattenTest, UnflattenCatchesBadBlobCacheDeviceVersion) { char buf[4] = { 0xee, 0xee, 0xee, 0xee }; mBC->set("abcd", 4, "efgh", 4); size_t size = mBC->getFlattenedSize(); uint8_t* flat = new uint8_t[size]; ASSERT_EQ(OK, mBC->flatten(flat, size, NULL, 0)); flat[10] = ~flat[10]; // Version mismatches shouldn't cause errors, but should not use the // serialized entries ASSERT_EQ(OK, mBC2->unflatten(flat, size, NULL, 0)); delete[] flat; // The version mismatch should cause the unflatten to result in an empty // cache ASSERT_EQ(size_t(0), mBC2->get("abcd", 4, buf, 4)); } TEST_F(BlobCacheFlattenTest, UnflattenCatchesBufferTooSmall) { char buf[4] = { 0xee, 0xee, 0xee, 0xee }; mBC->set("abcd", 4, "efgh", 4); size_t size = mBC->getFlattenedSize(); uint8_t* flat = new uint8_t[size]; ASSERT_EQ(OK, mBC->flatten(flat, size, NULL, 0)); // A buffer truncation shouldt cause an error ASSERT_EQ(BAD_VALUE, mBC2->unflatten(flat, size-1, NULL, 0)); delete[] flat; // The error should cause the unflatten to result in an empty cache ASSERT_EQ(size_t(0), mBC2->get("abcd", 4, buf, 4)); } } // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/tests/ObbFile_test.cpp0000644000015700001700000000577012200324306026020 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "ObbFile_test" #include #include #include #include #include #include #include namespace android { #define TEST_FILENAME "/test.obb" class ObbFileTest : public testing::Test { protected: sp mObbFile; char* mExternalStorage; char* mFileName; virtual void SetUp() { mObbFile = new ObbFile(); mExternalStorage = getenv("EXTERNAL_STORAGE"); const int totalLen = strlen(mExternalStorage) + strlen(TEST_FILENAME) + 1; mFileName = new char[totalLen]; snprintf(mFileName, totalLen, "%s%s", mExternalStorage, TEST_FILENAME); int fd = ::open(mFileName, O_CREAT | O_TRUNC); if (fd < 0) { FAIL() << "Couldn't create " << mFileName << " for tests"; } } virtual void TearDown() { } }; TEST_F(ObbFileTest, ReadFailure) { EXPECT_FALSE(mObbFile->readFrom(-1)) << "No failure on invalid file descriptor"; } TEST_F(ObbFileTest, WriteThenRead) { const char* packageName = "com.example.obbfile"; const int32_t versionNum = 1; mObbFile->setPackageName(String8(packageName)); mObbFile->setVersion(versionNum); #define SALT_SIZE 8 unsigned char salt[SALT_SIZE] = {0x01, 0x10, 0x55, 0xAA, 0xFF, 0x00, 0x5A, 0xA5}; EXPECT_TRUE(mObbFile->setSalt(salt, SALT_SIZE)) << "Salt should be successfully set"; EXPECT_TRUE(mObbFile->writeTo(mFileName)) << "couldn't write to fake .obb file"; mObbFile = new ObbFile(); EXPECT_TRUE(mObbFile->readFrom(mFileName)) << "couldn't read from fake .obb file"; EXPECT_EQ(versionNum, mObbFile->getVersion()) << "version didn't come out the same as it went in"; const char* currentPackageName = mObbFile->getPackageName().string(); EXPECT_STREQ(packageName, currentPackageName) << "package name didn't come out the same as it went in"; size_t saltLen; const unsigned char* newSalt = mObbFile->getSalt(&saltLen); EXPECT_EQ(sizeof(salt), saltLen) << "salt sizes were not the same"; for (int i = 0; i < sizeof(salt); i++) { EXPECT_EQ(salt[i], newSalt[i]) << "salt character " << i << " should be equal"; } EXPECT_TRUE(memcmp(newSalt, salt, sizeof(salt)) == 0) << "salts should be the same"; } } android-audiosystem-1.8+13.10.20130807/lib/utils/tests/Android.mk0000644000015700001700000000174412200324306024661 0ustar pbuserpbgroup00000000000000# Build the unit tests. LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) # Build the unit tests. test_src_files := \ BlobCache_test.cpp \ ObbFile_test.cpp \ Looper_test.cpp \ String8_test.cpp \ Unicode_test.cpp \ ZipFileRO_test.cpp \ shared_libraries := \ libz \ liblog \ libcutils \ libutils \ libstlport static_libraries := \ libgtest \ libgtest_main c_includes := \ external/zlib \ external/icu4c/common \ bionic \ bionic/libstdc++/include \ external/gtest/include \ external/stlport/stlport module_tags := eng tests $(foreach file,$(test_src_files), \ $(eval include $(CLEAR_VARS)) \ $(eval LOCAL_SHARED_LIBRARIES := $(shared_libraries)) \ $(eval LOCAL_STATIC_LIBRARIES := $(static_libraries)) \ $(eval LOCAL_C_INCLUDES := $(c_includes)) \ $(eval LOCAL_SRC_FILES := $(file)) \ $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \ $(eval LOCAL_MODULE_TAGS := $(module_tags)) \ $(eval include $(BUILD_EXECUTABLE)) \ ) android-audiosystem-1.8+13.10.20130807/lib/utils/tests/Unicode_test.cpp0000644000015700001700000000615612200324306026103 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "Unicode_test" #include #include #include namespace android { class UnicodeTest : public testing::Test { protected: virtual void SetUp() { } virtual void TearDown() { } }; TEST_F(UnicodeTest, UTF8toUTF16ZeroLength) { ssize_t measured; const uint8_t str[] = { }; measured = utf8_to_utf16_length(str, 0); EXPECT_EQ(0, measured) << "Zero length input should return zero length output."; } TEST_F(UnicodeTest, UTF8toUTF16ASCIILength) { ssize_t measured; // U+0030 or ASCII '0' const uint8_t str[] = { 0x30 }; measured = utf8_to_utf16_length(str, sizeof(str)); EXPECT_EQ(1, measured) << "ASCII glyphs should have a length of 1 char16_t"; } TEST_F(UnicodeTest, UTF8toUTF16Plane1Length) { ssize_t measured; // U+2323 SMILE const uint8_t str[] = { 0xE2, 0x8C, 0xA3 }; measured = utf8_to_utf16_length(str, sizeof(str)); EXPECT_EQ(1, measured) << "Plane 1 glyphs should have a length of 1 char16_t"; } TEST_F(UnicodeTest, UTF8toUTF16SurrogateLength) { ssize_t measured; // U+10000 const uint8_t str[] = { 0xF0, 0x90, 0x80, 0x80 }; measured = utf8_to_utf16_length(str, sizeof(str)); EXPECT_EQ(2, measured) << "Surrogate pairs should have a length of 2 char16_t"; } TEST_F(UnicodeTest, UTF8toUTF16TruncatedUTF8) { ssize_t measured; // Truncated U+2323 SMILE // U+2323 SMILE const uint8_t str[] = { 0xE2, 0x8C }; measured = utf8_to_utf16_length(str, sizeof(str)); EXPECT_EQ(-1, measured) << "Truncated UTF-8 should return -1 to indicate invalid"; } TEST_F(UnicodeTest, UTF8toUTF16Normal) { const uint8_t str[] = { 0x30, // U+0030, 1 UTF-16 character 0xC4, 0x80, // U+0100, 1 UTF-16 character 0xE2, 0x8C, 0xA3, // U+2323, 1 UTF-16 character 0xF0, 0x90, 0x80, 0x80, // U+10000, 2 UTF-16 character }; char16_t output[1 + 1 + 1 + 2 + 1]; // Room for NULL utf8_to_utf16(str, sizeof(str), output); EXPECT_EQ(0x0030, output[0]) << "should be U+0030"; EXPECT_EQ(0x0100, output[1]) << "should be U+0100"; EXPECT_EQ(0x2323, output[2]) << "should be U+2323"; EXPECT_EQ(0xD800, output[3]) << "should be first half of surrogate U+10000"; EXPECT_EQ(0xDC00, output[4]) << "should be second half of surrogate U+10000"; EXPECT_EQ(NULL, output[5]) << "should be NULL terminated"; } } android-audiosystem-1.8+13.10.20130807/lib/utils/tests/String8_test.cpp0000644000015700001700000000405512200324306026047 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "String8_test" #include #include #include namespace android { class String8Test : public testing::Test { protected: virtual void SetUp() { } virtual void TearDown() { } }; TEST_F(String8Test, Cstr) { String8 tmp("Hello, world!"); EXPECT_STREQ(tmp.string(), "Hello, world!"); } TEST_F(String8Test, OperatorPlus) { String8 src1("Hello, "); // Test adding String8 + const char* const char* ccsrc2 = "world!"; String8 dst1 = src1 + ccsrc2; EXPECT_STREQ(dst1.string(), "Hello, world!"); EXPECT_STREQ(src1.string(), "Hello, "); EXPECT_STREQ(ccsrc2, "world!"); // Test adding String8 + String8 String8 ssrc2("world!"); String8 dst2 = src1 + ssrc2; EXPECT_STREQ(dst2.string(), "Hello, world!"); EXPECT_STREQ(src1.string(), "Hello, "); EXPECT_STREQ(ssrc2.string(), "world!"); } TEST_F(String8Test, OperatorPlusEquals) { String8 src1("My voice"); // Testing String8 += String8 String8 src2(" is my passport."); src1 += src2; EXPECT_STREQ(src1.string(), "My voice is my passport."); EXPECT_STREQ(src2.string(), " is my passport."); // Adding const char* to the previous string. const char* src3 = " Verify me."; src1 += src3; EXPECT_STREQ(src1.string(), "My voice is my passport. Verify me."); EXPECT_STREQ(src2.string(), " is my passport."); EXPECT_STREQ(src3, " Verify me."); } } android-audiosystem-1.8+13.10.20130807/lib/utils/tests/TestHelpers.h0000644000015700001700000000327712200324306025366 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef TESTHELPERS_H #define TESTHELPERS_H #include namespace android { class Pipe { public: int sendFd; int receiveFd; Pipe() { int fds[2]; ::pipe(fds); receiveFd = fds[0]; sendFd = fds[1]; } ~Pipe() { if (sendFd != -1) { ::close(sendFd); } if (receiveFd != -1) { ::close(receiveFd); } } status_t writeSignal() { ssize_t nWritten = ::write(sendFd, "*", 1); return nWritten == 1 ? 0 : -errno; } status_t readSignal() { char buf[1]; ssize_t nRead = ::read(receiveFd, buf, 1); return nRead == 1 ? 0 : nRead == 0 ? -EPIPE : -errno; } }; class DelayedTask : public Thread { int mDelayMillis; public: DelayedTask(int delayMillis) : mDelayMillis(delayMillis) { } protected: virtual ~DelayedTask() { } virtual void doTask() = 0; virtual bool threadLoop() { usleep(mDelayMillis * 1000); doTask(); return false; } }; } // namespace android #endif // TESTHELPERS_H android-audiosystem-1.8+13.10.20130807/lib/utils/tests/ZipFileRO_test.cpp0000644000015700001700000000305112200324306026307 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "ZipFileRO_test" #include #include #include #include #include namespace android { class ZipFileROTest : public testing::Test { protected: virtual void SetUp() { } virtual void TearDown() { } }; TEST_F(ZipFileROTest, ZipTimeConvertSuccess) { struct tm t; // 2011-06-29 14:40:40 long when = 0x3EDD7514; ZipFileRO::zipTimeToTimespec(when, &t); EXPECT_EQ(2011, t.tm_year + 1900) << "Year was improperly converted."; EXPECT_EQ(6, t.tm_mon) << "Month was improperly converted."; EXPECT_EQ(29, t.tm_mday) << "Day was improperly converted."; EXPECT_EQ(14, t.tm_hour) << "Hour was improperly converted."; EXPECT_EQ(40, t.tm_min) << "Minute was improperly converted."; EXPECT_EQ(40, t.tm_sec) << "Second was improperly converted."; } } android-audiosystem-1.8+13.10.20130807/lib/utils/BufferedTextOutput.cpp0000644000015700001700000001671412200324306026125 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include #include #include #include #include #include // --------------------------------------------------------------------------- namespace android { struct BufferedTextOutput::BufferState : public RefBase { BufferState(int32_t _seq) : seq(_seq) , buffer(NULL) , bufferPos(0) , bufferSize(0) , atFront(true) , indent(0) , bundle(0) { } ~BufferState() { free(buffer); } status_t append(const char* txt, size_t len) { if ((len+bufferPos) > bufferSize) { void* b = realloc(buffer, ((len+bufferPos)*3)/2); if (!b) return NO_MEMORY; buffer = (char*)b; } memcpy(buffer+bufferPos, txt, len); bufferPos += len; return NO_ERROR; } void restart() { bufferPos = 0; atFront = true; if (bufferSize > 256) { void* b = realloc(buffer, 256); if (b) { buffer = (char*)b; bufferSize = 256; } } } const int32_t seq; char* buffer; size_t bufferPos; size_t bufferSize; bool atFront; int32_t indent; int32_t bundle; }; struct BufferedTextOutput::ThreadState { Vector > states; }; static mutex_t gMutex; static thread_store_t tls; BufferedTextOutput::ThreadState* BufferedTextOutput::getThreadState() { ThreadState* ts = (ThreadState*) thread_store_get( &tls ); if (ts) return ts; ts = new ThreadState; thread_store_set( &tls, ts, threadDestructor ); return ts; } void BufferedTextOutput::threadDestructor(void *st) { delete ((ThreadState*)st); } static volatile int32_t gSequence = 0; static volatile int32_t gFreeBufferIndex = -1; static int32_t allocBufferIndex() { int32_t res = -1; mutex_lock(&gMutex); if (gFreeBufferIndex >= 0) { res = gFreeBufferIndex; gFreeBufferIndex = gTextBuffers[res]; gTextBuffers.editItemAt(res) = -1; } else { res = gTextBuffers.size(); gTextBuffers.add(-1); } mutex_unlock(&gMutex); return res; } static void freeBufferIndex(int32_t idx) { mutex_lock(&gMutex); gTextBuffers.editItemAt(idx) = gFreeBufferIndex; gFreeBufferIndex = idx; mutex_unlock(&gMutex); } // --------------------------------------------------------------------------- BufferedTextOutput::BufferedTextOutput(uint32_t flags) : mFlags(flags) , mSeq(android_atomic_inc(&gSequence)) , mIndex(allocBufferIndex()) { mGlobalState = new BufferState(mSeq); if (mGlobalState) mGlobalState->incStrong(this); } BufferedTextOutput::~BufferedTextOutput() { if (mGlobalState) mGlobalState->decStrong(this); freeBufferIndex(mIndex); } status_t BufferedTextOutput::print(const char* txt, size_t len) { //printf("BufferedTextOutput: printing %d\n", len); AutoMutex _l(mLock); BufferState* b = getBuffer(); const char* const end = txt+len; status_t err; while (txt < end) { // Find the next line. const char* first = txt; while (txt < end && *txt != '\n') txt++; // Include this and all following empty lines. while (txt < end && *txt == '\n') txt++; // Special cases for first data on a line. if (b->atFront) { if (b->indent > 0) { // If this is the start of a line, add the indent. const char* prefix = stringForIndent(b->indent); err = b->append(prefix, strlen(prefix)); if (err != NO_ERROR) return err; } else if (*(txt-1) == '\n' && !b->bundle) { // Fast path: if we are not indenting or bundling, and // have been given one or more complete lines, just write // them out without going through the buffer. // Slurp up all of the lines. const char* lastLine = txt+1; while (txt < end) { if (*txt++ == '\n') lastLine = txt; } struct iovec vec; vec.iov_base = (void*)first; vec.iov_len = lastLine-first; //printf("Writing %d bytes of data!\n", vec.iov_len); writeLines(vec, 1); txt = lastLine; continue; } } // Append the new text to the buffer. err = b->append(first, txt-first); if (err != NO_ERROR) return err; b->atFront = *(txt-1) == '\n'; // If we have finished a line and are not bundling, write // it out. //printf("Buffer is now %d bytes\n", b->bufferPos); if (b->atFront && !b->bundle) { struct iovec vec; vec.iov_base = b->buffer; vec.iov_len = b->bufferPos; //printf("Writing %d bytes of data!\n", vec.iov_len); writeLines(vec, 1); b->restart(); } } return NO_ERROR; } void BufferedTextOutput::moveIndent(int delta) { AutoMutex _l(mLock); BufferState* b = getBuffer(); b->indent += delta; if (b->indent < 0) b->indent = 0; } void BufferedTextOutput::pushBundle() { AutoMutex _l(mLock); BufferState* b = getBuffer(); b->bundle++; } void BufferedTextOutput::popBundle() { AutoMutex _l(mLock); BufferState* b = getBuffer(); b->bundle--; LOG_FATAL_IF(b->bundle < 0, "TextOutput::popBundle() called more times than pushBundle()"); if (b->bundle < 0) b->bundle = 0; if (b->bundle == 0) { // Last bundle, write out data if it is complete. If it is not // complete, don't write until the last line is done... this may // or may not be the write thing to do, but it's the easiest. if (b->bufferPos > 0 && b->atFront) { struct iovec vec; vec.iov_base = b->buffer; vec.iov_len = b->bufferPos; writeLines(vec, 1); b->restart(); } } } BufferedTextOutput::BufferState* BufferedTextOutput::getBuffer() const { if ((mFlags&MULTITHREADED) != 0) { ThreadState* ts = getThreadState(); if (ts) { while (ts->states.size() <= (size_t)mIndex) ts->states.add(NULL); BufferState* bs = ts->states[mIndex].get(); if (bs != NULL && bs->seq == mSeq) return bs; ts->states.editItemAt(mIndex) = new BufferState(mIndex); bs = ts->states[mIndex].get(); if (bs != NULL) return bs; } } return mGlobalState; } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/Static.cpp0000644000015700001700000000441112200324306023533 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // All static variables go here, to control initialization and // destruction order in the library. #include #include #include namespace android { class LibUtilsFirstStatics { public: LibUtilsFirstStatics() { initialize_string8(); initialize_string16(); } ~LibUtilsFirstStatics() { terminate_string16(); terminate_string8(); } }; static LibUtilsFirstStatics gFirstStatics; int gDarwinCantLoadAllObjects = 1; // ------------ Text output streams Vector gTextBuffers; class LogTextOutput : public BufferedTextOutput { public: LogTextOutput() : BufferedTextOutput(MULTITHREADED) { } virtual ~LogTextOutput() { }; protected: virtual status_t writeLines(const struct iovec& vec, size_t N) { //android_writevLog(&vec, N); <-- this is now a no-op if (N != 1) ALOGI("WARNING: writeLines N=%d\n", N); ALOGI("%.*s", vec.iov_len, (const char*) vec.iov_base); return NO_ERROR; } }; class FdTextOutput : public BufferedTextOutput { public: FdTextOutput(int fd) : BufferedTextOutput(MULTITHREADED), mFD(fd) { } virtual ~FdTextOutput() { }; protected: virtual status_t writeLines(const struct iovec& vec, size_t N) { writev(mFD, &vec, N); return NO_ERROR; } private: int mFD; }; static LogTextOutput gLogTextOutput; static FdTextOutput gStdoutTextOutput(STDOUT_FILENO); static FdTextOutput gStderrTextOutput(STDERR_FILENO); TextOutput& alog(gLogTextOutput); TextOutput& aout(gStdoutTextOutput); TextOutput& aerr(gStderrTextOutput); } // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/Looper.cpp0000644000015700001700000005575112200324306023561 0ustar pbuserpbgroup00000000000000// // Copyright 2010 The Android Open Source Project // // A looper implementation based on epoll(). // #define LOG_TAG "Looper" //#define LOG_NDEBUG 0 // Debugs poll and wake interactions. #define DEBUG_POLL_AND_WAKE 0 // Debugs callback registration and invocation. #define DEBUG_CALLBACKS 0 #include #include #include #include #include #include namespace android { // --- WeakMessageHandler --- WeakMessageHandler::WeakMessageHandler(const wp& handler) : mHandler(handler) { } void WeakMessageHandler::handleMessage(const Message& message) { sp handler = mHandler.promote(); if (handler != NULL) { handler->handleMessage(message); } } // --- Looper --- #ifdef LOOPER_USES_EPOLL // Hint for number of file descriptors to be associated with the epoll instance. static const int EPOLL_SIZE_HINT = 8; // Maximum number of file descriptors for which to retrieve poll events each iteration. static const int EPOLL_MAX_EVENTS = 16; #endif static pthread_once_t gTLSOnce = PTHREAD_ONCE_INIT; static pthread_key_t gTLSKey = 0; Looper::Looper(bool allowNonCallbacks) : mAllowNonCallbacks(allowNonCallbacks), mSendingMessage(false), mResponseIndex(0), mNextMessageUptime(LLONG_MAX) { int wakeFds[2]; int result = pipe(wakeFds); LOG_ALWAYS_FATAL_IF(result != 0, "Could not create wake pipe. errno=%d", errno); mWakeReadPipeFd = wakeFds[0]; mWakeWritePipeFd = wakeFds[1]; result = fcntl(mWakeReadPipeFd, F_SETFL, O_NONBLOCK); LOG_ALWAYS_FATAL_IF(result != 0, "Could not make wake read pipe non-blocking. errno=%d", errno); result = fcntl(mWakeWritePipeFd, F_SETFL, O_NONBLOCK); LOG_ALWAYS_FATAL_IF(result != 0, "Could not make wake write pipe non-blocking. errno=%d", errno); #ifdef LOOPER_USES_EPOLL // Allocate the epoll instance and register the wake pipe. mEpollFd = epoll_create(EPOLL_SIZE_HINT); LOG_ALWAYS_FATAL_IF(mEpollFd < 0, "Could not create epoll instance. errno=%d", errno); struct epoll_event eventItem; memset(& eventItem, 0, sizeof(epoll_event)); // zero out unused members of data field union eventItem.events = EPOLLIN; eventItem.data.fd = mWakeReadPipeFd; result = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, mWakeReadPipeFd, & eventItem); LOG_ALWAYS_FATAL_IF(result != 0, "Could not add wake read pipe to epoll instance. errno=%d", errno); #else // Add the wake pipe to the head of the request list with a null callback. struct pollfd requestedFd; requestedFd.fd = mWakeReadPipeFd; requestedFd.events = POLLIN; mRequestedFds.push(requestedFd); Request request; request.fd = mWakeReadPipeFd; request.callback = NULL; request.ident = 0; request.data = NULL; mRequests.push(request); mPolling = false; mWaiters = 0; #endif #ifdef LOOPER_STATISTICS mPendingWakeTime = -1; mPendingWakeCount = 0; mSampledWakeCycles = 0; mSampledWakeCountSum = 0; mSampledWakeLatencySum = 0; mSampledPolls = 0; mSampledZeroPollCount = 0; mSampledZeroPollLatencySum = 0; mSampledTimeoutPollCount = 0; mSampledTimeoutPollLatencySum = 0; #endif } Looper::~Looper() { close(mWakeReadPipeFd); close(mWakeWritePipeFd); #ifdef LOOPER_USES_EPOLL close(mEpollFd); #endif } void Looper::initTLSKey() { int result = pthread_key_create(& gTLSKey, threadDestructor); LOG_ALWAYS_FATAL_IF(result != 0, "Could not allocate TLS key."); } void Looper::threadDestructor(void *st) { Looper* const self = static_cast(st); if (self != NULL) { self->decStrong((void*)threadDestructor); } } void Looper::setForThread(const sp& looper) { sp old = getForThread(); // also has side-effect of initializing TLS if (looper != NULL) { looper->incStrong((void*)threadDestructor); } pthread_setspecific(gTLSKey, looper.get()); if (old != NULL) { old->decStrong((void*)threadDestructor); } } sp Looper::getForThread() { int result = pthread_once(& gTLSOnce, initTLSKey); LOG_ALWAYS_FATAL_IF(result != 0, "pthread_once failed"); return (Looper*)pthread_getspecific(gTLSKey); } sp Looper::prepare(int opts) { bool allowNonCallbacks = opts & ALOOPER_PREPARE_ALLOW_NON_CALLBACKS; sp looper = Looper::getForThread(); if (looper == NULL) { looper = new Looper(allowNonCallbacks); Looper::setForThread(looper); } if (looper->getAllowNonCallbacks() != allowNonCallbacks) { ALOGW("Looper already prepared for this thread with a different value for the " "ALOOPER_PREPARE_ALLOW_NON_CALLBACKS option."); } return looper; } bool Looper::getAllowNonCallbacks() const { return mAllowNonCallbacks; } int Looper::pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData) { int result = 0; for (;;) { while (mResponseIndex < mResponses.size()) { const Response& response = mResponses.itemAt(mResponseIndex++); ALooper_callbackFunc callback = response.request.callback; if (!callback) { int ident = response.request.ident; int fd = response.request.fd; int events = response.events; void* data = response.request.data; #if DEBUG_POLL_AND_WAKE ALOGD("%p ~ pollOnce - returning signalled identifier %d: " "fd=%d, events=0x%x, data=%p", this, ident, fd, events, data); #endif if (outFd != NULL) *outFd = fd; if (outEvents != NULL) *outEvents = events; if (outData != NULL) *outData = data; return ident; } } if (result != 0) { #if DEBUG_POLL_AND_WAKE ALOGD("%p ~ pollOnce - returning result %d", this, result); #endif if (outFd != NULL) *outFd = 0; if (outEvents != NULL) *outEvents = NULL; if (outData != NULL) *outData = NULL; return result; } result = pollInner(timeoutMillis); } } int Looper::pollInner(int timeoutMillis) { #if DEBUG_POLL_AND_WAKE ALOGD("%p ~ pollOnce - waiting: timeoutMillis=%d", this, timeoutMillis); #endif // Adjust the timeout based on when the next message is due. if (timeoutMillis != 0 && mNextMessageUptime != LLONG_MAX) { nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); int messageTimeoutMillis = toMillisecondTimeoutDelay(now, mNextMessageUptime); if (messageTimeoutMillis >= 0 && (timeoutMillis < 0 || messageTimeoutMillis < timeoutMillis)) { timeoutMillis = messageTimeoutMillis; } #if DEBUG_POLL_AND_WAKE ALOGD("%p ~ pollOnce - next message in %lldns, adjusted timeout: timeoutMillis=%d", this, mNextMessageUptime - now, timeoutMillis); #endif } // Poll. int result = ALOOPER_POLL_WAKE; mResponses.clear(); mResponseIndex = 0; #ifdef LOOPER_STATISTICS nsecs_t pollStartTime = systemTime(SYSTEM_TIME_MONOTONIC); #endif #ifdef LOOPER_USES_EPOLL struct epoll_event eventItems[EPOLL_MAX_EVENTS]; int eventCount = epoll_wait(mEpollFd, eventItems, EPOLL_MAX_EVENTS, timeoutMillis); #else // Wait for wakeAndLock() waiters to run then set mPolling to true. mLock.lock(); while (mWaiters != 0) { mResume.wait(mLock); } mPolling = true; mLock.unlock(); size_t requestedCount = mRequestedFds.size(); int eventCount = poll(mRequestedFds.editArray(), requestedCount, timeoutMillis); #endif // Acquire lock. mLock.lock(); // Check for poll error. if (eventCount < 0) { if (errno == EINTR) { goto Done; } ALOGW("Poll failed with an unexpected error, errno=%d", errno); result = ALOOPER_POLL_ERROR; goto Done; } // Check for poll timeout. if (eventCount == 0) { #if DEBUG_POLL_AND_WAKE ALOGD("%p ~ pollOnce - timeout", this); #endif result = ALOOPER_POLL_TIMEOUT; goto Done; } // Handle all events. #if DEBUG_POLL_AND_WAKE ALOGD("%p ~ pollOnce - handling events from %d fds", this, eventCount); #endif #ifdef LOOPER_USES_EPOLL for (int i = 0; i < eventCount; i++) { int fd = eventItems[i].data.fd; uint32_t epollEvents = eventItems[i].events; if (fd == mWakeReadPipeFd) { if (epollEvents & EPOLLIN) { awoken(); } else { ALOGW("Ignoring unexpected epoll events 0x%x on wake read pipe.", epollEvents); } } else { ssize_t requestIndex = mRequests.indexOfKey(fd); if (requestIndex >= 0) { int events = 0; if (epollEvents & EPOLLIN) events |= ALOOPER_EVENT_INPUT; if (epollEvents & EPOLLOUT) events |= ALOOPER_EVENT_OUTPUT; if (epollEvents & EPOLLERR) events |= ALOOPER_EVENT_ERROR; if (epollEvents & EPOLLHUP) events |= ALOOPER_EVENT_HANGUP; pushResponse(events, mRequests.valueAt(requestIndex)); } else { ALOGW("Ignoring unexpected epoll events 0x%x on fd %d that is " "no longer registered.", epollEvents, fd); } } } Done: ; #else for (size_t i = 0; i < requestedCount; i++) { const struct pollfd& requestedFd = mRequestedFds.itemAt(i); short pollEvents = requestedFd.revents; if (pollEvents) { if (requestedFd.fd == mWakeReadPipeFd) { if (pollEvents & POLLIN) { awoken(); } else { ALOGW("Ignoring unexpected poll events 0x%x on wake read pipe.", pollEvents); } } else { int events = 0; if (pollEvents & POLLIN) events |= ALOOPER_EVENT_INPUT; if (pollEvents & POLLOUT) events |= ALOOPER_EVENT_OUTPUT; if (pollEvents & POLLERR) events |= ALOOPER_EVENT_ERROR; if (pollEvents & POLLHUP) events |= ALOOPER_EVENT_HANGUP; if (pollEvents & POLLNVAL) events |= ALOOPER_EVENT_INVALID; pushResponse(events, mRequests.itemAt(i)); } if (--eventCount == 0) { break; } } } Done: // Set mPolling to false and wake up the wakeAndLock() waiters. mPolling = false; if (mWaiters != 0) { mAwake.broadcast(); } #endif #ifdef LOOPER_STATISTICS nsecs_t pollEndTime = systemTime(SYSTEM_TIME_MONOTONIC); mSampledPolls += 1; if (timeoutMillis == 0) { mSampledZeroPollCount += 1; mSampledZeroPollLatencySum += pollEndTime - pollStartTime; } else if (timeoutMillis > 0 && result == ALOOPER_POLL_TIMEOUT) { mSampledTimeoutPollCount += 1; mSampledTimeoutPollLatencySum += pollEndTime - pollStartTime - milliseconds_to_nanoseconds(timeoutMillis); } if (mSampledPolls == SAMPLED_POLLS_TO_AGGREGATE) { ALOGD("%p ~ poll latency statistics: %0.3fms zero timeout, %0.3fms non-zero timeout", this, 0.000001f * float(mSampledZeroPollLatencySum) / mSampledZeroPollCount, 0.000001f * float(mSampledTimeoutPollLatencySum) / mSampledTimeoutPollCount); mSampledPolls = 0; mSampledZeroPollCount = 0; mSampledZeroPollLatencySum = 0; mSampledTimeoutPollCount = 0; mSampledTimeoutPollLatencySum = 0; } #endif // Invoke pending message callbacks. mNextMessageUptime = LLONG_MAX; while (mMessageEnvelopes.size() != 0) { nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); const MessageEnvelope& messageEnvelope = mMessageEnvelopes.itemAt(0); if (messageEnvelope.uptime <= now) { // Remove the envelope from the list. // We keep a strong reference to the handler until the call to handleMessage // finishes. Then we drop it so that the handler can be deleted *before* // we reacquire our lock. { // obtain handler sp handler = messageEnvelope.handler; Message message = messageEnvelope.message; mMessageEnvelopes.removeAt(0); mSendingMessage = true; mLock.unlock(); #if DEBUG_POLL_AND_WAKE || DEBUG_CALLBACKS ALOGD("%p ~ pollOnce - sending message: handler=%p, what=%d", this, handler.get(), message.what); #endif handler->handleMessage(message); } // release handler mLock.lock(); mSendingMessage = false; result = ALOOPER_POLL_CALLBACK; } else { // The last message left at the head of the queue determines the next wakeup time. mNextMessageUptime = messageEnvelope.uptime; break; } } // Release lock. mLock.unlock(); // Invoke all response callbacks. for (size_t i = 0; i < mResponses.size(); i++) { const Response& response = mResponses.itemAt(i); ALooper_callbackFunc callback = response.request.callback; if (callback) { int fd = response.request.fd; int events = response.events; void* data = response.request.data; #if DEBUG_POLL_AND_WAKE || DEBUG_CALLBACKS ALOGD("%p ~ pollOnce - invoking fd event callback %p: fd=%d, events=0x%x, data=%p", this, callback, fd, events, data); #endif int callbackResult = callback(fd, events, data); if (callbackResult == 0) { removeFd(fd); } result = ALOOPER_POLL_CALLBACK; } } return result; } int Looper::pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outData) { if (timeoutMillis <= 0) { int result; do { result = pollOnce(timeoutMillis, outFd, outEvents, outData); } while (result == ALOOPER_POLL_CALLBACK); return result; } else { nsecs_t endTime = systemTime(SYSTEM_TIME_MONOTONIC) + milliseconds_to_nanoseconds(timeoutMillis); for (;;) { int result = pollOnce(timeoutMillis, outFd, outEvents, outData); if (result != ALOOPER_POLL_CALLBACK) { return result; } nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); timeoutMillis = toMillisecondTimeoutDelay(now, endTime); if (timeoutMillis == 0) { return ALOOPER_POLL_TIMEOUT; } } } } void Looper::wake() { #if DEBUG_POLL_AND_WAKE ALOGD("%p ~ wake", this); #endif #ifdef LOOPER_STATISTICS // FIXME: Possible race with awoken() but this code is for testing only and is rarely enabled. if (mPendingWakeCount++ == 0) { mPendingWakeTime = systemTime(SYSTEM_TIME_MONOTONIC); } #endif ssize_t nWrite; do { nWrite = write(mWakeWritePipeFd, "W", 1); } while (nWrite == -1 && errno == EINTR); if (nWrite != 1) { if (errno != EAGAIN) { ALOGW("Could not write wake signal, errno=%d", errno); } } } void Looper::awoken() { #if DEBUG_POLL_AND_WAKE ALOGD("%p ~ awoken", this); #endif #ifdef LOOPER_STATISTICS if (mPendingWakeCount == 0) { ALOGD("%p ~ awoken: spurious!", this); } else { mSampledWakeCycles += 1; mSampledWakeCountSum += mPendingWakeCount; mSampledWakeLatencySum += systemTime(SYSTEM_TIME_MONOTONIC) - mPendingWakeTime; mPendingWakeCount = 0; mPendingWakeTime = -1; if (mSampledWakeCycles == SAMPLED_WAKE_CYCLES_TO_AGGREGATE) { ALOGD("%p ~ wake statistics: %0.3fms wake latency, %0.3f wakes per cycle", this, 0.000001f * float(mSampledWakeLatencySum) / mSampledWakeCycles, float(mSampledWakeCountSum) / mSampledWakeCycles); mSampledWakeCycles = 0; mSampledWakeCountSum = 0; mSampledWakeLatencySum = 0; } } #endif char buffer[16]; ssize_t nRead; do { nRead = read(mWakeReadPipeFd, buffer, sizeof(buffer)); } while ((nRead == -1 && errno == EINTR) || nRead == sizeof(buffer)); } void Looper::pushResponse(int events, const Request& request) { Response response; response.events = events; response.request = request; mResponses.push(response); } int Looper::addFd(int fd, int ident, int events, ALooper_callbackFunc callback, void* data) { #if DEBUG_CALLBACKS ALOGD("%p ~ addFd - fd=%d, ident=%d, events=0x%x, callback=%p, data=%p", this, fd, ident, events, callback, data); #endif if (! callback) { if (! mAllowNonCallbacks) { ALOGE("Invalid attempt to set NULL callback but not allowed for this looper."); return -1; } if (ident < 0) { ALOGE("Invalid attempt to set NULL callback with ident <= 0."); return -1; } } #ifdef LOOPER_USES_EPOLL int epollEvents = 0; if (events & ALOOPER_EVENT_INPUT) epollEvents |= EPOLLIN; if (events & ALOOPER_EVENT_OUTPUT) epollEvents |= EPOLLOUT; { // acquire lock AutoMutex _l(mLock); Request request; request.fd = fd; request.ident = ident; request.callback = callback; request.data = data; struct epoll_event eventItem; memset(& eventItem, 0, sizeof(epoll_event)); // zero out unused members of data field union eventItem.events = epollEvents; eventItem.data.fd = fd; ssize_t requestIndex = mRequests.indexOfKey(fd); if (requestIndex < 0) { int epollResult = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, fd, & eventItem); if (epollResult < 0) { ALOGE("Error adding epoll events for fd %d, errno=%d", fd, errno); return -1; } mRequests.add(fd, request); } else { int epollResult = epoll_ctl(mEpollFd, EPOLL_CTL_MOD, fd, & eventItem); if (epollResult < 0) { ALOGE("Error modifying epoll events for fd %d, errno=%d", fd, errno); return -1; } mRequests.replaceValueAt(requestIndex, request); } } // release lock #else int pollEvents = 0; if (events & ALOOPER_EVENT_INPUT) pollEvents |= POLLIN; if (events & ALOOPER_EVENT_OUTPUT) pollEvents |= POLLOUT; wakeAndLock(); // acquire lock struct pollfd requestedFd; requestedFd.fd = fd; requestedFd.events = pollEvents; Request request; request.fd = fd; request.ident = ident; request.callback = callback; request.data = data; ssize_t index = getRequestIndexLocked(fd); if (index < 0) { mRequestedFds.push(requestedFd); mRequests.push(request); } else { mRequestedFds.replaceAt(requestedFd, size_t(index)); mRequests.replaceAt(request, size_t(index)); } mLock.unlock(); // release lock #endif return 1; } int Looper::removeFd(int fd) { #if DEBUG_CALLBACKS ALOGD("%p ~ removeFd - fd=%d", this, fd); #endif #ifdef LOOPER_USES_EPOLL { // acquire lock AutoMutex _l(mLock); ssize_t requestIndex = mRequests.indexOfKey(fd); if (requestIndex < 0) { return 0; } int epollResult = epoll_ctl(mEpollFd, EPOLL_CTL_DEL, fd, NULL); if (epollResult < 0) { ALOGE("Error removing epoll events for fd %d, errno=%d", fd, errno); return -1; } mRequests.removeItemsAt(requestIndex); } // release lock return 1; #else wakeAndLock(); // acquire lock ssize_t index = getRequestIndexLocked(fd); if (index >= 0) { mRequestedFds.removeAt(size_t(index)); mRequests.removeAt(size_t(index)); } mLock.unlock(); // release lock return index >= 0; #endif } #ifndef LOOPER_USES_EPOLL ssize_t Looper::getRequestIndexLocked(int fd) { size_t requestCount = mRequestedFds.size(); for (size_t i = 0; i < requestCount; i++) { if (mRequestedFds.itemAt(i).fd == fd) { return i; } } return -1; } void Looper::wakeAndLock() { mLock.lock(); mWaiters += 1; while (mPolling) { wake(); mAwake.wait(mLock); } mWaiters -= 1; if (mWaiters == 0) { mResume.signal(); } } #endif void Looper::sendMessage(const sp& handler, const Message& message) { nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); sendMessageAtTime(now, handler, message); } void Looper::sendMessageDelayed(nsecs_t uptimeDelay, const sp& handler, const Message& message) { nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); sendMessageAtTime(now + uptimeDelay, handler, message); } void Looper::sendMessageAtTime(nsecs_t uptime, const sp& handler, const Message& message) { #if DEBUG_CALLBACKS ALOGD("%p ~ sendMessageAtTime - uptime=%lld, handler=%p, what=%d", this, uptime, handler.get(), message.what); #endif size_t i = 0; { // acquire lock AutoMutex _l(mLock); size_t messageCount = mMessageEnvelopes.size(); while (i < messageCount && uptime >= mMessageEnvelopes.itemAt(i).uptime) { i += 1; } MessageEnvelope messageEnvelope(uptime, handler, message); mMessageEnvelopes.insertAt(messageEnvelope, i, 1); // Optimization: If the Looper is currently sending a message, then we can skip // the call to wake() because the next thing the Looper will do after processing // messages is to decide when the next wakeup time should be. In fact, it does // not even matter whether this code is running on the Looper thread. if (mSendingMessage) { return; } } // release lock // Wake the poll loop only when we enqueue a new message at the head. if (i == 0) { wake(); } } void Looper::removeMessages(const sp& handler) { #if DEBUG_CALLBACKS ALOGD("%p ~ removeMessages - handler=%p", this, handler.get()); #endif { // acquire lock AutoMutex _l(mLock); for (size_t i = mMessageEnvelopes.size(); i != 0; ) { const MessageEnvelope& messageEnvelope = mMessageEnvelopes.itemAt(--i); if (messageEnvelope.handler == handler) { mMessageEnvelopes.removeAt(i); } } } // release lock } void Looper::removeMessages(const sp& handler, int what) { #if DEBUG_CALLBACKS ALOGD("%p ~ removeMessages - handler=%p, what=%d", this, handler.get(), what); #endif { // acquire lock AutoMutex _l(mLock); for (size_t i = mMessageEnvelopes.size(); i != 0; ) { const MessageEnvelope& messageEnvelope = mMessageEnvelopes.itemAt(--i); if (messageEnvelope.handler == handler && messageEnvelope.message.what == what) { mMessageEnvelopes.removeAt(i); } } } // release lock } } // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/build0000755000015700001700000000013012200324306022617 0ustar pbuserpbgroup00000000000000#!/bin/sh target='armel' make clean make -e ARCH=$target make -e ARCH=$target install android-audiosystem-1.8+13.10.20130807/lib/utils/MODULE_LICENSE_APACHE20000644000015700001700000000000012200324306024723 0ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/lib/utils/LinearTransform.cpp0000644000015700001700000001623412200324306025420 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define __STDC_LIMIT_MACROS #include #include #include namespace android { template static inline T ABS(T x) { return (x < 0) ? -x : x; } // Static math methods involving linear transformations static bool scale_u64_to_u64( uint64_t val, uint32_t N, uint32_t D, uint64_t* res, bool round_up_not_down) { uint64_t tmp1, tmp2; uint32_t r; assert(res); assert(D); // Let U32(X) denote a uint32_t containing the upper 32 bits of a 64 bit // integer X. // Let L32(X) denote a uint32_t containing the lower 32 bits of a 64 bit // integer X. // Let X[A, B] with A <= B denote bits A through B of the integer X. // Let (A | B) denote the concatination of two 32 bit ints, A and B. // IOW X = (A | B) => U32(X) == A && L32(X) == B // // compute M = val * N (a 96 bit int) // --------------------------------- // tmp2 = U32(val) * N (a 64 bit int) // tmp1 = L32(val) * N (a 64 bit int) // which means // M = val * N = (tmp2 << 32) + tmp1 tmp2 = (val >> 32) * N; tmp1 = (val & UINT32_MAX) * N; // compute M[32, 95] // tmp2 = tmp2 + U32(tmp1) // = (U32(val) * N) + U32(L32(val) * N) // = M[32, 95] tmp2 += tmp1 >> 32; // if M[64, 95] >= D, then M/D has bits > 63 set and we have // an overflow. if ((tmp2 >> 32) >= D) { *res = UINT64_MAX; return false; } // Divide. Going in we know // tmp2 = M[32, 95] // U32(tmp2) < D r = tmp2 % D; tmp2 /= D; // At this point // tmp1 = L32(val) * N // tmp2 = M[32, 95] / D // = (M / D)[32, 95] // r = M[32, 95] % D // U32(tmp2) = 0 // // compute tmp1 = (r | M[0, 31]) tmp1 = (tmp1 & UINT32_MAX) | ((uint64_t)r << 32); // Divide again. Keep the remainder around in order to round properly. r = tmp1 % D; tmp1 /= D; // At this point // tmp2 = (M / D)[32, 95] // tmp1 = (M / D)[ 0, 31] // r = M % D // U32(tmp1) = 0 // U32(tmp2) = 0 // Pack the result and deal with the round-up case (As well as the // remote possiblility over overflow in such a case). *res = (tmp2 << 32) | tmp1; if (r && round_up_not_down) { ++(*res); if (!(*res)) { *res = UINT64_MAX; return false; } } return true; } static bool linear_transform_s64_to_s64( int64_t val, int64_t basis1, int32_t N, uint32_t D, int64_t basis2, int64_t* out) { uint64_t scaled, res; uint64_t abs_val; bool is_neg; if (!out) return false; // Compute abs(val - basis_64). Keep track of whether or not this delta // will be negative after the scale opertaion. if (val < basis1) { is_neg = true; abs_val = basis1 - val; } else { is_neg = false; abs_val = val - basis1; } if (N < 0) is_neg = !is_neg; if (!scale_u64_to_u64(abs_val, ABS(N), D, &scaled, is_neg)) return false; // overflow/undeflow // if scaled is >= 0x8000, then we are going to overflow or // underflow unless ABS(basis2) is large enough to pull us back into the // non-overflow/underflow region. if (scaled & INT64_MIN) { if (is_neg && (basis2 < 0)) return false; // certain underflow if (!is_neg && (basis2 >= 0)) return false; // certain overflow if (ABS(basis2) <= static_cast(scaled & INT64_MAX)) return false; // not enough // Looks like we are OK *out = (is_neg ? (-scaled) : scaled) + basis2; } else { // Scaled fits within signed bounds, so we just need to check for // over/underflow for two signed integers. Basically, if both scaled // and basis2 have the same sign bit, and the result has a different // sign bit, then we have under/overflow. An easy way to compute this // is // (scaled_signbit XNOR basis_signbit) && // (scaled_signbit XOR res_signbit) // == // (scaled_signbit XOR basis_signbit XOR 1) && // (scaled_signbit XOR res_signbit) if (is_neg) scaled = -scaled; res = scaled + basis2; if ((scaled ^ basis2 ^ INT64_MIN) & (scaled ^ res) & INT64_MIN) return false; *out = res; } return true; } bool LinearTransform::doForwardTransform(int64_t a_in, int64_t* b_out) const { if (0 == a_to_b_denom) return false; return linear_transform_s64_to_s64(a_in, a_zero, a_to_b_numer, a_to_b_denom, b_zero, b_out); } bool LinearTransform::doReverseTransform(int64_t b_in, int64_t* a_out) const { if (0 == a_to_b_numer) return false; return linear_transform_s64_to_s64(b_in, b_zero, a_to_b_denom, a_to_b_numer, a_zero, a_out); } template void LinearTransform::reduce(T* N, T* D) { T a, b; if (!N || !D || !(*D)) { assert(false); return; } a = *N; b = *D; if (a == 0) { *D = 1; return; } // This implements Euclid's method to find GCD. if (a < b) { T tmp = a; a = b; b = tmp; } while (1) { // a is now the greater of the two. const T remainder = a % b; if (remainder == 0) { *N /= b; *D /= b; return; } // by swapping remainder and b, we are guaranteeing that a is // still the greater of the two upon entrance to the loop. a = b; b = remainder; } }; template void LinearTransform::reduce(uint64_t* N, uint64_t* D); template void LinearTransform::reduce(uint32_t* N, uint32_t* D); void LinearTransform::reduce(int32_t* N, uint32_t* D) { if (N && D && *D) { if (*N < 0) { *N = -(*N); reduce(reinterpret_cast(N), D); *N = -(*N); } else { reduce(reinterpret_cast(N), D); } } } } // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/BackupData.cpp0000644000015700001700000002174712200324306024316 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "backup_data" #include #include #include #include #include #include namespace android { static const bool DEBUG = false; /* * File Format (v1): * * All ints are stored little-endian. * * - An app_header_v1 struct. * - The name of the package, utf-8, null terminated, padded to 4-byte boundary. * - A sequence of zero or more key/value paires (entities), each with * - A entity_header_v1 struct * - The key, utf-8, null terminated, padded to 4-byte boundary. * - The value, padded to 4 byte boundary */ const static int ROUND_UP[4] = { 0, 3, 2, 1 }; static inline size_t round_up(size_t n) { return n + ROUND_UP[n % 4]; } static inline size_t padding_extra(size_t n) { return ROUND_UP[n % 4]; } BackupDataWriter::BackupDataWriter(int fd) :m_fd(fd), m_status(NO_ERROR), m_pos(0), m_entityCount(0) { } BackupDataWriter::~BackupDataWriter() { } // Pad out anything they've previously written to the next 4 byte boundary. status_t BackupDataWriter::write_padding_for(int n) { ssize_t amt; ssize_t paddingSize; paddingSize = padding_extra(n); if (paddingSize > 0) { uint32_t padding = 0xbcbcbcbc; if (DEBUG) ALOGI("writing %d padding bytes for %d", paddingSize, n); amt = write(m_fd, &padding, paddingSize); if (amt != paddingSize) { m_status = errno; return m_status; } m_pos += amt; } return NO_ERROR; } status_t BackupDataWriter::WriteEntityHeader(const String8& key, size_t dataSize) { if (m_status != NO_ERROR) { return m_status; } ssize_t amt; amt = write_padding_for(m_pos); if (amt != 0) { return amt; } String8 k; if (m_keyPrefix.length() > 0) { k = m_keyPrefix; k += ":"; k += key; } else { k = key; } if (DEBUG) { ALOGD("Writing header: prefix='%s' key='%s' dataSize=%d", m_keyPrefix.string(), key.string(), dataSize); } entity_header_v1 header; ssize_t keyLen; keyLen = k.length(); header.type = tolel(BACKUP_HEADER_ENTITY_V1); header.keyLen = tolel(keyLen); header.dataSize = tolel(dataSize); if (DEBUG) ALOGI("writing entity header, %d bytes", sizeof(entity_header_v1)); amt = write(m_fd, &header, sizeof(entity_header_v1)); if (amt != sizeof(entity_header_v1)) { m_status = errno; return m_status; } m_pos += amt; if (DEBUG) ALOGI("writing entity header key, %d bytes", keyLen+1); amt = write(m_fd, k.string(), keyLen+1); if (amt != keyLen+1) { m_status = errno; return m_status; } m_pos += amt; amt = write_padding_for(keyLen+1); m_entityCount++; return amt; } status_t BackupDataWriter::WriteEntityData(const void* data, size_t size) { if (DEBUG) ALOGD("Writing data: size=%lu", (unsigned long) size); if (m_status != NO_ERROR) { if (DEBUG) { ALOGD("Not writing data - stream in error state %d (%s)", m_status, strerror(m_status)); } return m_status; } // We don't write padding here, because they're allowed to call this several // times with smaller buffers. We write it at the end of WriteEntityHeader // instead. ssize_t amt = write(m_fd, data, size); if (amt != (ssize_t)size) { m_status = errno; if (DEBUG) ALOGD("write returned error %d (%s)", m_status, strerror(m_status)); return m_status; } m_pos += amt; return NO_ERROR; } void BackupDataWriter::SetKeyPrefix(const String8& keyPrefix) { m_keyPrefix = keyPrefix; } BackupDataReader::BackupDataReader(int fd) :m_fd(fd), m_done(false), m_status(NO_ERROR), m_pos(0), m_entityCount(0) { memset(&m_header, 0, sizeof(m_header)); } BackupDataReader::~BackupDataReader() { } status_t BackupDataReader::Status() { return m_status; } #define CHECK_SIZE(actual, expected) \ do { \ if ((actual) != (expected)) { \ if ((actual) == 0) { \ m_status = EIO; \ m_done = true; \ } else { \ m_status = errno; \ ALOGD("CHECK_SIZE(a=%ld e=%ld) failed at line %d m_status='%s'", \ long(actual), long(expected), __LINE__, strerror(m_status)); \ } \ return m_status; \ } \ } while(0) #define SKIP_PADDING() \ do { \ status_t err = skip_padding(); \ if (err != NO_ERROR) { \ ALOGD("SKIP_PADDING FAILED at line %d", __LINE__); \ m_status = err; \ return err; \ } \ } while(0) status_t BackupDataReader::ReadNextHeader(bool* done, int* type) { *done = m_done; if (m_status != NO_ERROR) { return m_status; } int amt; amt = skip_padding(); if (amt == EIO) { *done = m_done = true; return NO_ERROR; } else if (amt != NO_ERROR) { return amt; } amt = read(m_fd, &m_header, sizeof(m_header)); *done = m_done = (amt == 0); if (*done) { return NO_ERROR; } CHECK_SIZE(amt, sizeof(m_header)); m_pos += sizeof(m_header); if (type) { *type = m_header.type; } // validate and fix up the fields. m_header.type = fromlel(m_header.type); switch (m_header.type) { case BACKUP_HEADER_ENTITY_V1: { m_header.entity.keyLen = fromlel(m_header.entity.keyLen); if (m_header.entity.keyLen <= 0) { ALOGD("Entity header at %d has keyLen<=0: 0x%08x\n", (int)m_pos, (int)m_header.entity.keyLen); m_status = EINVAL; } m_header.entity.dataSize = fromlel(m_header.entity.dataSize); m_entityCount++; // read the rest of the header (filename) size_t size = m_header.entity.keyLen; char* buf = m_key.lockBuffer(size); if (buf == NULL) { m_status = ENOMEM; return m_status; } int amt = read(m_fd, buf, size+1); CHECK_SIZE(amt, (int)size+1); m_key.unlockBuffer(size); m_pos += size+1; SKIP_PADDING(); m_dataEndPos = m_pos + m_header.entity.dataSize; break; } default: ALOGD("Chunk header at %d has invalid type: 0x%08x", (int)(m_pos - sizeof(m_header)), (int)m_header.type); m_status = EINVAL; } return m_status; } bool BackupDataReader::HasEntities() { return m_status == NO_ERROR && m_header.type == BACKUP_HEADER_ENTITY_V1; } status_t BackupDataReader::ReadEntityHeader(String8* key, size_t* dataSize) { if (m_status != NO_ERROR) { return m_status; } if (m_header.type != BACKUP_HEADER_ENTITY_V1) { return EINVAL; } *key = m_key; *dataSize = m_header.entity.dataSize; return NO_ERROR; } status_t BackupDataReader::SkipEntityData() { if (m_status != NO_ERROR) { return m_status; } if (m_header.type != BACKUP_HEADER_ENTITY_V1) { return EINVAL; } if (m_header.entity.dataSize > 0) { int pos = lseek(m_fd, m_dataEndPos, SEEK_SET); if (pos == -1) { return errno; } } SKIP_PADDING(); return NO_ERROR; } ssize_t BackupDataReader::ReadEntityData(void* data, size_t size) { if (m_status != NO_ERROR) { return -1; } int remaining = m_dataEndPos - m_pos; //ALOGD("ReadEntityData size=%d m_pos=0x%x m_dataEndPos=0x%x remaining=%d\n", // size, m_pos, m_dataEndPos, remaining); if (remaining <= 0) { return 0; } if (((int)size) > remaining) { size = remaining; } //ALOGD(" reading %d bytes", size); int amt = read(m_fd, data, size); if (amt < 0) { m_status = errno; return -1; } if (amt == 0) { m_status = EIO; m_done = true; } m_pos += amt; return amt; } status_t BackupDataReader::skip_padding() { ssize_t amt; ssize_t paddingSize; paddingSize = padding_extra(m_pos); if (paddingSize > 0) { uint32_t padding; amt = read(m_fd, &padding, paddingSize); CHECK_SIZE(amt, paddingSize); m_pos += amt; } return NO_ERROR; } } // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/RefBase.cpp0000644000015700001700000004372612200324306023627 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "RefBase" #include #include #include #include #include #include #include #include #include #include #include #include #include // compile with refcounting debugging enabled #define DEBUG_REFS 0 #define DEBUG_REFS_FATAL_SANITY_CHECKS 0 #define DEBUG_REFS_ENABLED_BY_DEFAULT 1 #define DEBUG_REFS_CALLSTACK_ENABLED 1 // log all reference counting operations #define PRINT_REFS 0 // --------------------------------------------------------------------------- namespace android { #define INITIAL_STRONG_VALUE (1<<28) // --------------------------------------------------------------------------- class RefBase::weakref_impl : public RefBase::weakref_type { public: volatile int32_t mStrong; volatile int32_t mWeak; RefBase* const mBase; volatile int32_t mFlags; #if !DEBUG_REFS weakref_impl(RefBase* base) : mStrong(INITIAL_STRONG_VALUE) , mWeak(0) , mBase(base) , mFlags(0) { } void addStrongRef(const void* /*id*/) { } void removeStrongRef(const void* /*id*/) { } void renameStrongRefId(const void* /*old_id*/, const void* /*new_id*/) { } void addWeakRef(const void* /*id*/) { } void removeWeakRef(const void* /*id*/) { } void renameWeakRefId(const void* /*old_id*/, const void* /*new_id*/) { } void printRefs() const { } void trackMe(bool, bool) { } #else weakref_impl(RefBase* base) : mStrong(INITIAL_STRONG_VALUE) , mWeak(0) , mBase(base) , mFlags(0) , mStrongRefs(NULL) , mWeakRefs(NULL) , mTrackEnabled(!!DEBUG_REFS_ENABLED_BY_DEFAULT) , mRetain(false) { } ~weakref_impl() { bool dumpStack = false; if (!mRetain && mStrongRefs != NULL) { dumpStack = true; #if DEBUG_REFS_FATAL_SANITY_CHECKS LOG_ALWAYS_FATAL("Strong references remain!"); #else ALOGE("Strong references remain:"); #endif ref_entry* refs = mStrongRefs; while (refs) { char inc = refs->ref >= 0 ? '+' : '-'; ALOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref); #if DEBUG_REFS_CALLSTACK_ENABLED refs->stack.dump(); #endif refs = refs->next; } } if (!mRetain && mWeakRefs != NULL) { dumpStack = true; #if DEBUG_REFS_FATAL_SANITY_CHECKS LOG_ALWAYS_FATAL("Weak references remain:"); #else ALOGE("Weak references remain!"); #endif ref_entry* refs = mWeakRefs; while (refs) { char inc = refs->ref >= 0 ? '+' : '-'; ALOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref); #if DEBUG_REFS_CALLSTACK_ENABLED refs->stack.dump(); #endif refs = refs->next; } } if (dumpStack) { ALOGE("above errors at:"); CallStack stack; stack.update(); stack.dump(); } } void addStrongRef(const void* id) { //LOGD_IF(mTrackEnabled, // "addStrongRef: RefBase=%p, id=%p", mBase, id); addRef(&mStrongRefs, id, mStrong); } void removeStrongRef(const void* id) { //LOGD_IF(mTrackEnabled, // "removeStrongRef: RefBase=%p, id=%p", mBase, id); if (!mRetain) { removeRef(&mStrongRefs, id); } else { addRef(&mStrongRefs, id, -mStrong); } } void renameStrongRefId(const void* old_id, const void* new_id) { //LOGD_IF(mTrackEnabled, // "renameStrongRefId: RefBase=%p, oid=%p, nid=%p", // mBase, old_id, new_id); renameRefsId(mStrongRefs, old_id, new_id); } void addWeakRef(const void* id) { addRef(&mWeakRefs, id, mWeak); } void removeWeakRef(const void* id) { if (!mRetain) { removeRef(&mWeakRefs, id); } else { addRef(&mWeakRefs, id, -mWeak); } } void renameWeakRefId(const void* old_id, const void* new_id) { renameRefsId(mWeakRefs, old_id, new_id); } void trackMe(bool track, bool retain) { mTrackEnabled = track; mRetain = retain; } void printRefs() const { String8 text; { Mutex::Autolock _l(mMutex); char buf[128]; sprintf(buf, "Strong references on RefBase %p (weakref_type %p):\n", mBase, this); text.append(buf); printRefsLocked(&text, mStrongRefs); sprintf(buf, "Weak references on RefBase %p (weakref_type %p):\n", mBase, this); text.append(buf); printRefsLocked(&text, mWeakRefs); } { char name[100]; snprintf(name, 100, "/data/%p.stack", this); int rc = open(name, O_RDWR | O_CREAT | O_APPEND); if (rc >= 0) { write(rc, text.string(), text.length()); close(rc); ALOGD("STACK TRACE for %p saved in %s", this, name); } else ALOGE("FAILED TO PRINT STACK TRACE for %p in %s: %s", this, name, strerror(errno)); } } private: struct ref_entry { ref_entry* next; const void* id; #if DEBUG_REFS_CALLSTACK_ENABLED CallStack stack; #endif int32_t ref; }; void addRef(ref_entry** refs, const void* id, int32_t mRef) { if (mTrackEnabled) { AutoMutex _l(mMutex); ref_entry* ref = new ref_entry; // Reference count at the time of the snapshot, but before the // update. Positive value means we increment, negative--we // decrement the reference count. ref->ref = mRef; ref->id = id; #if DEBUG_REFS_CALLSTACK_ENABLED ref->stack.update(2); #endif ref->next = *refs; *refs = ref; } } void removeRef(ref_entry** refs, const void* id) { if (mTrackEnabled) { AutoMutex _l(mMutex); ref_entry* const head = *refs; ref_entry* ref = head; while (ref != NULL) { if (ref->id == id) { *refs = ref->next; delete ref; return; } refs = &ref->next; ref = *refs; } #if DEBUG_REFS_FATAL_SANITY_CHECKS LOG_ALWAYS_FATAL("RefBase: removing id %p on RefBase %p" "(weakref_type %p) that doesn't exist!", id, mBase, this); #endif ALOGE("RefBase: removing id %p on RefBase %p" "(weakref_type %p) that doesn't exist!", id, mBase, this); ref = head; while (ref) { char inc = ref->ref >= 0 ? '+' : '-'; ALOGD("\t%c ID %p (ref %d):", inc, ref->id, ref->ref); ref = ref->next; } CallStack stack; stack.update(); stack.dump(); } } void renameRefsId(ref_entry* r, const void* old_id, const void* new_id) { if (mTrackEnabled) { AutoMutex _l(mMutex); ref_entry* ref = r; while (ref != NULL) { if (ref->id == old_id) { ref->id = new_id; } ref = ref->next; } } } void printRefsLocked(String8* out, const ref_entry* refs) const { char buf[128]; while (refs) { char inc = refs->ref >= 0 ? '+' : '-'; sprintf(buf, "\t%c ID %p (ref %d):\n", inc, refs->id, refs->ref); out->append(buf); #if DEBUG_REFS_CALLSTACK_ENABLED out->append(refs->stack.toString("\t\t")); #else out->append("\t\t(call stacks disabled)"); #endif refs = refs->next; } } mutable Mutex mMutex; ref_entry* mStrongRefs; ref_entry* mWeakRefs; bool mTrackEnabled; // Collect stack traces on addref and removeref, instead of deleting the stack references // on removeref that match the address ones. bool mRetain; #endif }; // --------------------------------------------------------------------------- void RefBase::incStrong(const void* id) const { weakref_impl* const refs = mRefs; refs->incWeak(id); refs->addStrongRef(id); const int32_t c = android_atomic_inc(&refs->mStrong); ALOG_ASSERT(c > 0, "incStrong() called on %p after last strong ref", refs); #if PRINT_REFS ALOGD("incStrong of %p from %p: cnt=%d\n", this, id, c); #endif if (c != INITIAL_STRONG_VALUE) { return; } android_atomic_add(-INITIAL_STRONG_VALUE, &refs->mStrong); refs->mBase->onFirstRef(); } void RefBase::decStrong(const void* id) const { weakref_impl* const refs = mRefs; refs->removeStrongRef(id); const int32_t c = android_atomic_dec(&refs->mStrong); #if PRINT_REFS ALOGD("decStrong of %p from %p: cnt=%d\n", this, id, c); #endif ALOG_ASSERT(c >= 1, "decStrong() called on %p too many times", refs); if (c == 1) { refs->mBase->onLastStrongRef(id); if ((refs->mFlags&OBJECT_LIFETIME_MASK) == OBJECT_LIFETIME_STRONG) { delete this; } } refs->decWeak(id); } void RefBase::forceIncStrong(const void* id) const { weakref_impl* const refs = mRefs; refs->incWeak(id); refs->addStrongRef(id); const int32_t c = android_atomic_inc(&refs->mStrong); ALOG_ASSERT(c >= 0, "forceIncStrong called on %p after ref count underflow", refs); #if PRINT_REFS ALOGD("forceIncStrong of %p from %p: cnt=%d\n", this, id, c); #endif switch (c) { case INITIAL_STRONG_VALUE: android_atomic_add(-INITIAL_STRONG_VALUE, &refs->mStrong); // fall through... case 0: refs->mBase->onFirstRef(); } } int32_t RefBase::getStrongCount() const { return mRefs->mStrong; } RefBase* RefBase::weakref_type::refBase() const { return static_cast(this)->mBase; } void RefBase::weakref_type::incWeak(const void* id) { weakref_impl* const impl = static_cast(this); impl->addWeakRef(id); const int32_t c = android_atomic_inc(&impl->mWeak); ALOG_ASSERT(c >= 0, "incWeak called on %p after last weak ref", this); } void RefBase::weakref_type::decWeak(const void* id) { weakref_impl* const impl = static_cast(this); impl->removeWeakRef(id); const int32_t c = android_atomic_dec(&impl->mWeak); ALOG_ASSERT(c >= 1, "decWeak called on %p too many times", this); if (c != 1) return; if ((impl->mFlags&OBJECT_LIFETIME_WEAK) == OBJECT_LIFETIME_STRONG) { // This is the regular lifetime case. The object is destroyed // when the last strong reference goes away. Since weakref_impl // outlive the object, it is not destroyed in the dtor, and // we'll have to do it here. if (impl->mStrong == INITIAL_STRONG_VALUE) { // Special case: we never had a strong reference, so we need to // destroy the object now. delete impl->mBase; } else { // ALOGV("Freeing refs %p of old RefBase %p\n", this, impl->mBase); delete impl; } } else { // less common case: lifetime is OBJECT_LIFETIME_{WEAK|FOREVER} impl->mBase->onLastWeakRef(id); if ((impl->mFlags&OBJECT_LIFETIME_MASK) == OBJECT_LIFETIME_WEAK) { // this is the OBJECT_LIFETIME_WEAK case. The last weak-reference // is gone, we can destroy the object. delete impl->mBase; } } } bool RefBase::weakref_type::attemptIncStrong(const void* id) { incWeak(id); weakref_impl* const impl = static_cast(this); int32_t curCount = impl->mStrong; ALOG_ASSERT(curCount >= 0, "attemptIncStrong called on %p after underflow", this); while (curCount > 0 && curCount != INITIAL_STRONG_VALUE) { if (android_atomic_cmpxchg(curCount, curCount+1, &impl->mStrong) == 0) { break; } curCount = impl->mStrong; } if (curCount <= 0 || curCount == INITIAL_STRONG_VALUE) { bool allow; if (curCount == INITIAL_STRONG_VALUE) { // Attempting to acquire first strong reference... this is allowed // if the object does NOT have a longer lifetime (meaning the // implementation doesn't need to see this), or if the implementation // allows it to happen. allow = (impl->mFlags&OBJECT_LIFETIME_WEAK) != OBJECT_LIFETIME_WEAK || impl->mBase->onIncStrongAttempted(FIRST_INC_STRONG, id); } else { // Attempting to revive the object... this is allowed // if the object DOES have a longer lifetime (so we can safely // call the object with only a weak ref) and the implementation // allows it to happen. allow = (impl->mFlags&OBJECT_LIFETIME_WEAK) == OBJECT_LIFETIME_WEAK && impl->mBase->onIncStrongAttempted(FIRST_INC_STRONG, id); } if (!allow) { decWeak(id); return false; } curCount = android_atomic_inc(&impl->mStrong); // If the strong reference count has already been incremented by // someone else, the implementor of onIncStrongAttempted() is holding // an unneeded reference. So call onLastStrongRef() here to remove it. // (No, this is not pretty.) Note that we MUST NOT do this if we // are in fact acquiring the first reference. if (curCount > 0 && curCount < INITIAL_STRONG_VALUE) { impl->mBase->onLastStrongRef(id); } } impl->addStrongRef(id); #if PRINT_REFS ALOGD("attemptIncStrong of %p from %p: cnt=%d\n", this, id, curCount); #endif if (curCount == INITIAL_STRONG_VALUE) { android_atomic_add(-INITIAL_STRONG_VALUE, &impl->mStrong); impl->mBase->onFirstRef(); } return true; } bool RefBase::weakref_type::attemptIncWeak(const void* id) { weakref_impl* const impl = static_cast(this); int32_t curCount = impl->mWeak; ALOG_ASSERT(curCount >= 0, "attemptIncWeak called on %p after underflow", this); while (curCount > 0) { if (android_atomic_cmpxchg(curCount, curCount+1, &impl->mWeak) == 0) { break; } curCount = impl->mWeak; } if (curCount > 0) { impl->addWeakRef(id); } return curCount > 0; } int32_t RefBase::weakref_type::getWeakCount() const { return static_cast(this)->mWeak; } void RefBase::weakref_type::printRefs() const { static_cast(this)->printRefs(); } void RefBase::weakref_type::trackMe(bool enable, bool retain) { static_cast(this)->trackMe(enable, retain); } RefBase::weakref_type* RefBase::createWeak(const void* id) const { mRefs->incWeak(id); return mRefs; } RefBase::weakref_type* RefBase::getWeakRefs() const { return mRefs; } RefBase::RefBase() : mRefs(new weakref_impl(this)) { } RefBase::~RefBase() { if (mRefs->mStrong == INITIAL_STRONG_VALUE) { // we never acquired a strong (and/or weak) reference on this object. delete mRefs; } else { // life-time of this object is extended to WEAK or FOREVER, in // which case weakref_impl doesn't out-live the object and we // can free it now. if ((mRefs->mFlags & OBJECT_LIFETIME_MASK) != OBJECT_LIFETIME_STRONG) { // It's possible that the weak count is not 0 if the object // re-acquired a weak reference in its destructor if (mRefs->mWeak == 0) { delete mRefs; } } } // for debugging purposes, clear this. const_cast(mRefs) = NULL; } void RefBase::extendObjectLifetime(int32_t mode) { android_atomic_or(mode, &mRefs->mFlags); } void RefBase::onFirstRef() { } void RefBase::onLastStrongRef(const void* /*id*/) { } bool RefBase::onIncStrongAttempted(uint32_t flags, const void* id) { return (flags&FIRST_INC_STRONG) ? true : false; } void RefBase::onLastWeakRef(const void* /*id*/) { } // --------------------------------------------------------------------------- void RefBase::moveReferences(void* dst, void const* src, size_t n, const ReferenceConverterBase& caster) { #if DEBUG_REFS const size_t itemSize = caster.getReferenceTypeSize(); for (size_t i=0 ; i(intptr_t(dst) + i*itemSize); void const* s = reinterpret_cast(intptr_t(src) + i*itemSize); RefBase* ref(reinterpret_cast(caster.getReferenceBase(d))); ref->mRefs->renameStrongRefId(s, d); ref->mRefs->renameWeakRefId(s, d); } #endif } // --------------------------------------------------------------------------- TextOutput& printStrongPointer(TextOutput& to, const void* val) { to << "sp<>(" << val << ")"; return to; } TextOutput& printWeakPointer(TextOutput& to, const void* val) { to << "wp<>(" << val << ")"; return to; } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/SystemClock.cpp0000644000015700001700000000653612200324306024556 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * System clock functions. */ #ifdef HAVE_ANDROID_OS #include #include #include #include #endif #include #include #include #include #include #include #include #define LOG_TAG "SystemClock" #include "utils/Log.h" namespace android { /* * Set the current time. This only works when running as root. */ int setCurrentTimeMillis(int64_t millis) { #if WIN32 // not implemented return -1; #else struct timeval tv; #ifdef HAVE_ANDROID_OS struct timespec ts; int fd; int res; #endif int ret = 0; if (millis <= 0 || millis / 1000LL >= INT_MAX) { return -1; } tv.tv_sec = (time_t) (millis / 1000LL); tv.tv_usec = (suseconds_t) ((millis % 1000LL) * 1000LL); ALOGD("Setting time of day to sec=%d\n", (int) tv.tv_sec); #ifdef HAVE_ANDROID_OS fd = open("/dev/alarm", O_RDWR); if(fd < 0) { ALOGW("Unable to open alarm driver: %s\n", strerror(errno)); return -1; } ts.tv_sec = tv.tv_sec; ts.tv_nsec = tv.tv_usec * 1000; res = ioctl(fd, ANDROID_ALARM_SET_RTC, &ts); if(res < 0) { ALOGW("Unable to set rtc to %ld: %s\n", tv.tv_sec, strerror(errno)); ret = -1; } close(fd); #else if (settimeofday(&tv, NULL) != 0) { ALOGW("Unable to set clock to %d.%d: %s\n", (int) tv.tv_sec, (int) tv.tv_usec, strerror(errno)); ret = -1; } #endif return ret; #endif // WIN32 } /* * native public static long uptimeMillis(); */ int64_t uptimeMillis() { int64_t when = systemTime(SYSTEM_TIME_MONOTONIC); return (int64_t) nanoseconds_to_milliseconds(when); } /* * native public static long elapsedRealtime(); */ int64_t elapsedRealtime() { #ifdef HAVE_ANDROID_OS static int s_fd = -1; if (s_fd == -1) { int fd = open("/dev/alarm", O_RDONLY); if (android_atomic_cmpxchg(-1, fd, &s_fd)) { close(fd); } } struct timespec ts; int result = ioctl(s_fd, ANDROID_ALARM_GET_TIME(ANDROID_ALARM_ELAPSED_REALTIME), &ts); if (result == 0) { int64_t when = seconds_to_nanoseconds(ts.tv_sec) + ts.tv_nsec; return (int64_t) nanoseconds_to_milliseconds(when); } else { // XXX: there was an error, probably because the driver didn't // exist ... this should return // a real error, like an exception! int64_t when = systemTime(SYSTEM_TIME_MONOTONIC); return (int64_t) nanoseconds_to_milliseconds(when); } #else int64_t when = systemTime(SYSTEM_TIME_MONOTONIC); return (int64_t) nanoseconds_to_milliseconds(when); #endif } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/Makefile0000644000015700001700000000443612200324306023247 0ustar pbuserpbgroup00000000000000make_home := ../.. top_srcdir := ../.. include $(make_home)/project_make WARN = -Wall include $(make_home)/package_make include ../Makefile.defines ####################### # CUSTOMIZE MACROS HERE ####################### # name your library here PKG_LIB = utils # at least one of following lines must be uncommented # CFILES is .c # CCFILES is .cc # CPPFILES is .cpp # CXXFILES is .cxx CPPFILES = Asset.cpp \ AssetDir.cpp \ AssetManager.cpp \ BufferedTextOutput.cpp \ BackupData.cpp \ BackupHelpers.cpp \ BlobCache.cpp \ CallStack.cpp \ Debug.cpp \ FileMap.cpp \ Flattenable.cpp \ LinearTransform.cpp \ Looper.cpp \ misc.cpp \ ObbFile.cpp \ PropertyMap.cpp \ RefBase.cpp \ ResourceTypes.cpp \ SharedBuffer.cpp \ Static.cpp \ StopWatch.cpp \ StreamingZipInflater.cpp \ String8.cpp \ String16.cpp \ StringArray.cpp \ SystemClock.cpp \ TextOutput.cpp \ Threads.cpp \ Timers.cpp \ Tokenizer.cpp \ Unicode.cpp \ VectorImpl.cpp \ ZipFileCRO.cpp \ ZipFileRO.cpp \ ZipUtils.cpp # BufferedTextOutput.cpp \ #CCFILES = #CPPFILES = #CXXFILES = FORCE_CXX_LINK = TRUE # if this library depends on private static library built # by this package, uncomment next line #STATIC_LIBS = # modify compiler command-line options CFLAGS = -fPIC -DHAVE_OFF64_T $(CONFIG_DEFINES) # modify linker command-line options LDFLAGS += -L ../liblog SHARED_LIBS += -llog -lz -lrt # build private static library private_lib = YES # build simple shared library # single header file exported, should be .../lib/include/$(PKG_LIB).h PKGCONFIG = NO # build pkgconfig shared library # change PKGCONFIG to YES and add following three macros # PKG_LIBDESC is one line description of library # PKG_REQUIRES is list of required pkgconfig libraries # PKG_HEADERS is list of header files to export #PKG_LIBDESC = #PKG_REQUIRES = #PKG_HEADERS = MAKESUBDIR = YES LIBSUBDIR = /$(install_lib_rel) HDRSUBDIR = /$(install_hdr_rel) ############################ # END OF MACROS TO CUSTOMIZE ############################ all: $(TARGET) #-include $(DEPENDS) include $(make_home)/target_lib android-audiosystem-1.8+13.10.20130807/lib/utils/StopWatch.cpp0000644000015700001700000000376612200324306024234 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "StopWatch" #include #include #include #include #include #include /*****************************************************************************/ namespace android { StopWatch::StopWatch(const char *name, int clock, uint32_t flags) : mName(name), mClock(clock), mFlags(flags) { reset(); } StopWatch::~StopWatch() { nsecs_t elapsed = elapsedTime(); const int n = mNumLaps; ALOGD("StopWatch %s (us): %lld ", mName, ns2us(elapsed)); for (int i=0 ; i= 8) { elapsed = 0; } else { const int n = mNumLaps; mLaps[n].soFar = elapsed; mLaps[n].thisLap = n ? (elapsed - mLaps[n-1].soFar) : elapsed; mNumLaps = n+1; } return elapsed; } nsecs_t StopWatch::elapsedTime() const { return systemTime(mClock) - mStartTime; } void StopWatch::reset() { mNumLaps = 0; mStartTime = systemTime(mClock); } /*****************************************************************************/ }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/PropertyMap.cpp0000644000015700001700000001442012200324306024567 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "PropertyMap" #include #include #include #include // Enables debug output for the parser. #define DEBUG_PARSER 0 // Enables debug output for parser performance. #define DEBUG_PARSER_PERFORMANCE 0 namespace android { static const char* WHITESPACE = " \t\r"; static const char* WHITESPACE_OR_PROPERTY_DELIMITER = " \t\r="; // --- PropertyMap --- PropertyMap::PropertyMap() { } PropertyMap::~PropertyMap() { } void PropertyMap::clear() { mProperties.clear(); } void PropertyMap::addProperty(const String8& key, const String8& value) { mProperties.add(key, value); } bool PropertyMap::hasProperty(const String8& key) const { return mProperties.indexOfKey(key) >= 0; } bool PropertyMap::tryGetProperty(const String8& key, String8& outValue) const { ssize_t index = mProperties.indexOfKey(key); if (index < 0) { return false; } outValue = mProperties.valueAt(index); return true; } bool PropertyMap::tryGetProperty(const String8& key, bool& outValue) const { int32_t intValue; if (!tryGetProperty(key, intValue)) { return false; } outValue = intValue; return true; } bool PropertyMap::tryGetProperty(const String8& key, int32_t& outValue) const { String8 stringValue; if (! tryGetProperty(key, stringValue) || stringValue.length() == 0) { return false; } char* end; int value = strtol(stringValue.string(), & end, 10); if (*end != '\0') { ALOGW("Property key '%s' has invalid value '%s'. Expected an integer.", key.string(), stringValue.string()); return false; } outValue = value; return true; } bool PropertyMap::tryGetProperty(const String8& key, float& outValue) const { String8 stringValue; if (! tryGetProperty(key, stringValue) || stringValue.length() == 0) { return false; } char* end; float value = strtof(stringValue.string(), & end); if (*end != '\0') { ALOGW("Property key '%s' has invalid value '%s'. Expected a float.", key.string(), stringValue.string()); return false; } outValue = value; return true; } void PropertyMap::addAll(const PropertyMap* map) { for (size_t i = 0; i < map->mProperties.size(); i++) { mProperties.add(map->mProperties.keyAt(i), map->mProperties.valueAt(i)); } } status_t PropertyMap::load(const String8& filename, PropertyMap** outMap) { *outMap = NULL; Tokenizer* tokenizer; status_t status = Tokenizer::open(filename, &tokenizer); if (status) { ALOGE("Error %d opening property file %s.", status, filename.string()); } else { PropertyMap* map = new PropertyMap(); if (!map) { ALOGE("Error allocating property map."); status = NO_MEMORY; } else { #if DEBUG_PARSER_PERFORMANCE nsecs_t startTime = systemTime(SYSTEM_TIME_MONOTONIC); #endif Parser parser(map, tokenizer); status = parser.parse(); #if DEBUG_PARSER_PERFORMANCE nsecs_t elapsedTime = systemTime(SYSTEM_TIME_MONOTONIC) - startTime; ALOGD("Parsed property file '%s' %d lines in %0.3fms.", tokenizer->getFilename().string(), tokenizer->getLineNumber(), elapsedTime / 1000000.0); #endif if (status) { delete map; } else { *outMap = map; } } delete tokenizer; } return status; } // --- PropertyMap::Parser --- PropertyMap::Parser::Parser(PropertyMap* map, Tokenizer* tokenizer) : mMap(map), mTokenizer(tokenizer) { } PropertyMap::Parser::~Parser() { } status_t PropertyMap::Parser::parse() { while (!mTokenizer->isEof()) { #if DEBUG_PARSER ALOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(), mTokenizer->peekRemainderOfLine().string()); #endif mTokenizer->skipDelimiters(WHITESPACE); if (!mTokenizer->isEol() && mTokenizer->peekChar() != '#') { String8 keyToken = mTokenizer->nextToken(WHITESPACE_OR_PROPERTY_DELIMITER); if (keyToken.isEmpty()) { ALOGE("%s: Expected non-empty property key.", mTokenizer->getLocation().string()); return BAD_VALUE; } mTokenizer->skipDelimiters(WHITESPACE); if (mTokenizer->nextChar() != '=') { ALOGE("%s: Expected '=' between property key and value.", mTokenizer->getLocation().string()); return BAD_VALUE; } mTokenizer->skipDelimiters(WHITESPACE); String8 valueToken = mTokenizer->nextToken(WHITESPACE); if (valueToken.find("\\", 0) >= 0 || valueToken.find("\"", 0) >= 0) { ALOGE("%s: Found reserved character '\\' or '\"' in property value.", mTokenizer->getLocation().string()); return BAD_VALUE; } mTokenizer->skipDelimiters(WHITESPACE); if (!mTokenizer->isEol()) { ALOGE("%s: Expected end of line, got '%s'.", mTokenizer->getLocation().string(), mTokenizer->peekRemainderOfLine().string()); return BAD_VALUE; } if (mMap->hasProperty(keyToken)) { ALOGE("%s: Duplicate property value for key '%s'.", mTokenizer->getLocation().string(), keyToken.string()); return BAD_VALUE; } mMap->addProperty(keyToken, valueToken); } mTokenizer->nextLine(); } return NO_ERROR; } } // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/BlobCache.cpp0000644000015700001700000002750412200324306024116 0ustar pbuserpbgroup00000000000000/* ** Copyright 2011, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #define LOG_TAG "BlobCache" //#define LOG_NDEBUG 0 #include #include #include #include #include namespace android { // BlobCache::Header::mMagicNumber value static const uint32_t blobCacheMagic = '_Bb$'; // BlobCache::Header::mBlobCacheVersion value static const uint32_t blobCacheVersion = 1; // BlobCache::Header::mDeviceVersion value static const uint32_t blobCacheDeviceVersion = 1; BlobCache::BlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxTotalSize): mMaxKeySize(maxKeySize), mMaxValueSize(maxValueSize), mMaxTotalSize(maxTotalSize), mTotalSize(0) { nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); #ifdef _WIN32 srand(now); #else mRandState[0] = (now >> 0) & 0xFFFF; mRandState[1] = (now >> 16) & 0xFFFF; mRandState[2] = (now >> 32) & 0xFFFF; #endif ALOGV("initializing random seed using %lld", now); } void BlobCache::set(const void* key, size_t keySize, const void* value, size_t valueSize) { if (mMaxKeySize < keySize) { ALOGV("set: not caching because the key is too large: %d (limit: %d)", keySize, mMaxKeySize); return; } if (mMaxValueSize < valueSize) { ALOGV("set: not caching because the value is too large: %d (limit: %d)", valueSize, mMaxValueSize); return; } if (mMaxTotalSize < keySize + valueSize) { ALOGV("set: not caching because the combined key/value size is too " "large: %d (limit: %d)", keySize + valueSize, mMaxTotalSize); return; } if (keySize == 0) { ALOGW("set: not caching because keySize is 0"); return; } if (valueSize <= 0) { ALOGW("set: not caching because valueSize is 0"); return; } sp dummyKey(new Blob(key, keySize, false)); CacheEntry dummyEntry(dummyKey, NULL); while (true) { ssize_t index = mCacheEntries.indexOf(dummyEntry); if (index < 0) { // Create a new cache entry. sp keyBlob(new Blob(key, keySize, true)); sp valueBlob(new Blob(value, valueSize, true)); size_t newTotalSize = mTotalSize + keySize + valueSize; if (mMaxTotalSize < newTotalSize) { if (isCleanable()) { // Clean the cache and try again. clean(); continue; } else { ALOGV("set: not caching new key/value pair because the " "total cache size limit would be exceeded: %d " "(limit: %d)", keySize + valueSize, mMaxTotalSize); break; } } mCacheEntries.add(CacheEntry(keyBlob, valueBlob)); mTotalSize = newTotalSize; ALOGV("set: created new cache entry with %d byte key and %d byte value", keySize, valueSize); } else { // Update the existing cache entry. sp valueBlob(new Blob(value, valueSize, true)); sp oldValueBlob(mCacheEntries[index].getValue()); size_t newTotalSize = mTotalSize + valueSize - oldValueBlob->getSize(); if (mMaxTotalSize < newTotalSize) { if (isCleanable()) { // Clean the cache and try again. clean(); continue; } else { ALOGV("set: not caching new value because the total cache " "size limit would be exceeded: %d (limit: %d)", keySize + valueSize, mMaxTotalSize); break; } } mCacheEntries.editItemAt(index).setValue(valueBlob); mTotalSize = newTotalSize; ALOGV("set: updated existing cache entry with %d byte key and %d byte " "value", keySize, valueSize); } break; } } size_t BlobCache::get(const void* key, size_t keySize, void* value, size_t valueSize) { if (mMaxKeySize < keySize) { ALOGV("get: not searching because the key is too large: %d (limit %d)", keySize, mMaxKeySize); return 0; } sp dummyKey(new Blob(key, keySize, false)); CacheEntry dummyEntry(dummyKey, NULL); ssize_t index = mCacheEntries.indexOf(dummyEntry); if (index < 0) { ALOGV("get: no cache entry found for key of size %d", keySize); return 0; } // The key was found. Return the value if the caller's buffer is large // enough. sp valueBlob(mCacheEntries[index].getValue()); size_t valueBlobSize = valueBlob->getSize(); if (valueBlobSize <= valueSize) { ALOGV("get: copying %d bytes to caller's buffer", valueBlobSize); memcpy(value, valueBlob->getData(), valueBlobSize); } else { ALOGV("get: caller's buffer is too small for value: %d (needs %d)", valueSize, valueBlobSize); } return valueBlobSize; } static inline size_t align4(size_t size) { return (size + 3) & ~3; } size_t BlobCache::getFlattenedSize() const { size_t size = sizeof(Header); for (size_t i = 0; i < mCacheEntries.size(); i++) { const CacheEntry& e(mCacheEntries[i]); sp keyBlob = e.getKey(); sp valueBlob = e.getValue(); size = align4(size); size += sizeof(EntryHeader) + keyBlob->getSize() + valueBlob->getSize(); } return size; } size_t BlobCache::getFdCount() const { return 0; } status_t BlobCache::flatten(void* buffer, size_t size, int fds[], size_t count) const { if (count != 0) { ALOGE("flatten: nonzero fd count: %d", count); return BAD_VALUE; } // Write the cache header if (size < sizeof(Header)) { ALOGE("flatten: not enough room for cache header"); return BAD_VALUE; } Header* header = reinterpret_cast(buffer); header->mMagicNumber = blobCacheMagic; header->mBlobCacheVersion = blobCacheVersion; header->mDeviceVersion = blobCacheDeviceVersion; header->mNumEntries = mCacheEntries.size(); // Write cache entries uint8_t* byteBuffer = reinterpret_cast(buffer); off_t byteOffset = align4(sizeof(Header)); for (size_t i = 0; i < mCacheEntries.size(); i++) { const CacheEntry& e(mCacheEntries[i]); sp keyBlob = e.getKey(); sp valueBlob = e.getValue(); size_t keySize = keyBlob->getSize(); size_t valueSize = valueBlob->getSize(); size_t entrySize = sizeof(EntryHeader) + keySize + valueSize; if (byteOffset + entrySize > size) { ALOGE("flatten: not enough room for cache entries"); return BAD_VALUE; } EntryHeader* eheader = reinterpret_cast( &byteBuffer[byteOffset]); eheader->mKeySize = keySize; eheader->mValueSize = valueSize; memcpy(eheader->mData, keyBlob->getData(), keySize); memcpy(eheader->mData + keySize, valueBlob->getData(), valueSize); byteOffset += align4(entrySize); } return OK; } status_t BlobCache::unflatten(void const* buffer, size_t size, int fds[], size_t count) { // All errors should result in the BlobCache being in an empty state. mCacheEntries.clear(); if (count != 0) { ALOGE("unflatten: nonzero fd count: %d", count); return BAD_VALUE; } // Read the cache header if (size < sizeof(Header)) { ALOGE("unflatten: not enough room for cache header"); return BAD_VALUE; } const Header* header = reinterpret_cast(buffer); if (header->mMagicNumber != blobCacheMagic) { ALOGE("unflatten: bad magic number: %d", header->mMagicNumber); return BAD_VALUE; } if (header->mBlobCacheVersion != blobCacheVersion || header->mDeviceVersion != blobCacheDeviceVersion) { // We treat version mismatches as an empty cache. return OK; } // Read cache entries const uint8_t* byteBuffer = reinterpret_cast(buffer); off_t byteOffset = align4(sizeof(Header)); size_t numEntries = header->mNumEntries; for (size_t i = 0; i < numEntries; i++) { if (byteOffset + sizeof(EntryHeader) > size) { mCacheEntries.clear(); ALOGE("unflatten: not enough room for cache entry headers"); return BAD_VALUE; } const EntryHeader* eheader = reinterpret_cast( &byteBuffer[byteOffset]); size_t keySize = eheader->mKeySize; size_t valueSize = eheader->mValueSize; size_t entrySize = sizeof(EntryHeader) + keySize + valueSize; if (byteOffset + entrySize > size) { mCacheEntries.clear(); ALOGE("unflatten: not enough room for cache entry headers"); return BAD_VALUE; } const uint8_t* data = eheader->mData; set(data, keySize, data + keySize, valueSize); byteOffset += align4(entrySize); } return OK; } long int BlobCache::blob_random() { #ifdef _WIN32 return rand(); #else return nrand48(mRandState); #endif } void BlobCache::clean() { // Remove a random cache entry until the total cache size gets below half // the maximum total cache size. while (mTotalSize > mMaxTotalSize / 2) { size_t i = size_t(blob_random() % (mCacheEntries.size())); const CacheEntry& entry(mCacheEntries[i]); mTotalSize -= entry.getKey()->getSize() + entry.getValue()->getSize(); mCacheEntries.removeAt(i); } } bool BlobCache::isCleanable() const { return mTotalSize > mMaxTotalSize / 2; } BlobCache::Blob::Blob(const void* data, size_t size, bool copyData): mData(copyData ? malloc(size) : data), mSize(size), mOwnsData(copyData) { if (data != NULL && copyData) { memcpy(const_cast(mData), data, size); } } BlobCache::Blob::~Blob() { if (mOwnsData) { free(const_cast(mData)); } } bool BlobCache::Blob::operator<(const Blob& rhs) const { if (mSize == rhs.mSize) { return memcmp(mData, rhs.mData, mSize) < 0; } else { return mSize < rhs.mSize; } } const void* BlobCache::Blob::getData() const { return mData; } size_t BlobCache::Blob::getSize() const { return mSize; } BlobCache::CacheEntry::CacheEntry() { } BlobCache::CacheEntry::CacheEntry(const sp& key, const sp& value): mKey(key), mValue(value) { } BlobCache::CacheEntry::CacheEntry(const CacheEntry& ce): mKey(ce.mKey), mValue(ce.mValue) { } bool BlobCache::CacheEntry::operator<(const CacheEntry& rhs) const { return *mKey < *rhs.mKey; } const BlobCache::CacheEntry& BlobCache::CacheEntry::operator=(const CacheEntry& rhs) { mKey = rhs.mKey; mValue = rhs.mValue; return *this; } sp BlobCache::CacheEntry::getKey() const { return mKey; } sp BlobCache::CacheEntry::getValue() const { return mValue; } void BlobCache::CacheEntry::setValue(const sp& value) { mValue = value; } } // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/Tokenizer.cpp0000644000015700001700000001101712200324306024256 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "Tokenizer" #include #include #include #include #include #include #include #include // Enables debug output for the tokenizer. #define DEBUG_TOKENIZER 0 namespace android { static inline bool isDelimiter(char ch, const char* delimiters) { return strchr(delimiters, ch) != NULL; } Tokenizer::Tokenizer(const String8& filename, FileMap* fileMap, char* buffer, size_t length) : mFilename(filename), mFileMap(fileMap), mBuffer(buffer), mLength(length), mCurrent(buffer), mLineNumber(1) { } Tokenizer::~Tokenizer() { if (mFileMap) { mFileMap->release(); } else { delete[] mBuffer; } } status_t Tokenizer::open(const String8& filename, Tokenizer** outTokenizer) { *outTokenizer = NULL; int result = NO_ERROR; int fd = ::open(filename.string(), O_RDONLY); if (fd < 0) { result = -errno; ALOGE("Error opening file '%s', %s.", filename.string(), strerror(errno)); } else { struct stat stat; if (fstat(fd, &stat)) { result = -errno; ALOGE("Error getting size of file '%s', %s.", filename.string(), strerror(errno)); } else { size_t length = size_t(stat.st_size); FileMap* fileMap = new FileMap(); char* buffer; if (fileMap->create(NULL, fd, 0, length, true)) { fileMap->advise(FileMap::SEQUENTIAL); buffer = static_cast(fileMap->getDataPtr()); } else { fileMap->release(); fileMap = NULL; // Fall back to reading into a buffer since we can't mmap files in sysfs. // The length we obtained from stat is wrong too (it will always be 4096) // so we must trust that read will read the entire file. buffer = new char[length]; ssize_t nrd = read(fd, buffer, length); if (nrd < 0) { result = -errno; ALOGE("Error reading file '%s', %s.", filename.string(), strerror(errno)); delete[] buffer; buffer = NULL; } else { length = size_t(nrd); } } if (!result) { *outTokenizer = new Tokenizer(filename, fileMap, buffer, length); } } close(fd); } return result; } String8 Tokenizer::getLocation() const { String8 result; result.appendFormat("%s:%d", mFilename.string(), mLineNumber); return result; } String8 Tokenizer::peekRemainderOfLine() const { const char* end = getEnd(); const char* eol = mCurrent; while (eol != end) { char ch = *eol; if (ch == '\n') { break; } eol += 1; } return String8(mCurrent, eol - mCurrent); } String8 Tokenizer::nextToken(const char* delimiters) { #if DEBUG_TOKENIZER ALOGD("nextToken"); #endif const char* end = getEnd(); const char* tokenStart = mCurrent; while (mCurrent != end) { char ch = *mCurrent; if (ch == '\n' || isDelimiter(ch, delimiters)) { break; } mCurrent += 1; } return String8(tokenStart, mCurrent - tokenStart); } void Tokenizer::nextLine() { #if DEBUG_TOKENIZER ALOGD("nextLine"); #endif const char* end = getEnd(); while (mCurrent != end) { char ch = *(mCurrent++); if (ch == '\n') { mLineNumber += 1; break; } } } void Tokenizer::skipDelimiters(const char* delimiters) { #if DEBUG_TOKENIZER ALOGD("skipDelimiters"); #endif const char* end = getEnd(); while (mCurrent != end) { char ch = *mCurrent; if (ch == '\n' || !isDelimiter(ch, delimiters)) { break; } mCurrent += 1; } } } // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/ZipUtils.cpp0000644000015700001700000002270012200324306024070 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Misc zip/gzip utility functions. // #define LOG_TAG "ziputil" #include #include #include #include #include #include #include using namespace android; /* * Utility function that expands zip/gzip "deflate" compressed data * into a buffer. * * "fd" is an open file positioned at the start of the "deflate" data * "buf" must hold at least "uncompressedLen" bytes. */ /*static*/ bool ZipUtils::inflateToBuffer(int fd, void* buf, long uncompressedLen, long compressedLen) { bool result = false; const unsigned long kReadBufSize = 32768; unsigned char* readBuf = NULL; z_stream zstream; int zerr; unsigned long compRemaining; assert(uncompressedLen >= 0); assert(compressedLen >= 0); readBuf = new unsigned char[kReadBufSize]; if (readBuf == NULL) goto bail; compRemaining = compressedLen; /* * Initialize the zlib stream. */ memset(&zstream, 0, sizeof(zstream)); zstream.zalloc = Z_NULL; zstream.zfree = Z_NULL; zstream.opaque = Z_NULL; zstream.next_in = NULL; zstream.avail_in = 0; zstream.next_out = (Bytef*) buf; zstream.avail_out = uncompressedLen; zstream.data_type = Z_UNKNOWN; /* * Use the undocumented "negative window bits" feature to tell zlib * that there's no zlib header waiting for it. */ zerr = inflateInit2(&zstream, -MAX_WBITS); if (zerr != Z_OK) { if (zerr == Z_VERSION_ERROR) { ALOGE("Installed zlib is not compatible with linked version (%s)\n", ZLIB_VERSION); } else { ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); } goto bail; } /* * Loop while we have data. */ do { unsigned long getSize; /* read as much as we can */ if (zstream.avail_in == 0) { getSize = (compRemaining > kReadBufSize) ? kReadBufSize : compRemaining; ALOGV("+++ reading %ld bytes (%ld left)\n", getSize, compRemaining); int cc = read(fd, readBuf, getSize); if (cc != (int) getSize) { ALOGD("inflate read failed (%d vs %ld)\n", cc, getSize); goto z_bail; } compRemaining -= getSize; zstream.next_in = readBuf; zstream.avail_in = getSize; } /* uncompress the data */ zerr = inflate(&zstream, Z_NO_FLUSH); if (zerr != Z_OK && zerr != Z_STREAM_END) { ALOGD("zlib inflate call failed (zerr=%d)\n", zerr); goto z_bail; } /* output buffer holds all, so no need to write the output */ } while (zerr == Z_OK); assert(zerr == Z_STREAM_END); /* other errors should've been caught */ if ((long) zstream.total_out != uncompressedLen) { ALOGW("Size mismatch on inflated file (%ld vs %ld)\n", zstream.total_out, uncompressedLen); goto z_bail; } // success! result = true; z_bail: inflateEnd(&zstream); /* free up any allocated structures */ bail: delete[] readBuf; return result; } /* * Utility function that expands zip/gzip "deflate" compressed data * into a buffer. * * (This is a clone of the previous function, but it takes a FILE* instead * of an fd. We could pass fileno(fd) to the above, but we can run into * trouble when "fp" has a different notion of what fd's file position is.) * * "fp" is an open file positioned at the start of the "deflate" data * "buf" must hold at least "uncompressedLen" bytes. */ /*static*/ bool ZipUtils::inflateToBuffer(FILE* fp, void* buf, long uncompressedLen, long compressedLen) { bool result = false; const unsigned long kReadBufSize = 32768; unsigned char* readBuf = NULL; z_stream zstream; int zerr; unsigned long compRemaining; assert(uncompressedLen >= 0); assert(compressedLen >= 0); readBuf = new unsigned char[kReadBufSize]; if (readBuf == NULL) goto bail; compRemaining = compressedLen; /* * Initialize the zlib stream. */ memset(&zstream, 0, sizeof(zstream)); zstream.zalloc = Z_NULL; zstream.zfree = Z_NULL; zstream.opaque = Z_NULL; zstream.next_in = NULL; zstream.avail_in = 0; zstream.next_out = (Bytef*) buf; zstream.avail_out = uncompressedLen; zstream.data_type = Z_UNKNOWN; /* * Use the undocumented "negative window bits" feature to tell zlib * that there's no zlib header waiting for it. */ zerr = inflateInit2(&zstream, -MAX_WBITS); if (zerr != Z_OK) { if (zerr == Z_VERSION_ERROR) { ALOGE("Installed zlib is not compatible with linked version (%s)\n", ZLIB_VERSION); } else { ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); } goto bail; } /* * Loop while we have data. */ do { unsigned long getSize; /* read as much as we can */ if (zstream.avail_in == 0) { getSize = (compRemaining > kReadBufSize) ? kReadBufSize : compRemaining; ALOGV("+++ reading %ld bytes (%ld left)\n", getSize, compRemaining); int cc = fread(readBuf, 1, getSize, fp); if (cc != (int) getSize) { ALOGD("inflate read failed (%d vs %ld)\n", cc, getSize); goto z_bail; } compRemaining -= getSize; zstream.next_in = readBuf; zstream.avail_in = getSize; } /* uncompress the data */ zerr = inflate(&zstream, Z_NO_FLUSH); if (zerr != Z_OK && zerr != Z_STREAM_END) { ALOGD("zlib inflate call failed (zerr=%d)\n", zerr); goto z_bail; } /* output buffer holds all, so no need to write the output */ } while (zerr == Z_OK); assert(zerr == Z_STREAM_END); /* other errors should've been caught */ if ((long) zstream.total_out != uncompressedLen) { ALOGW("Size mismatch on inflated file (%ld vs %ld)\n", zstream.total_out, uncompressedLen); goto z_bail; } // success! result = true; z_bail: inflateEnd(&zstream); /* free up any allocated structures */ bail: delete[] readBuf; return result; } /* * Look at the contents of a gzip archive. We want to know where the * data starts, and how long it will be after it is uncompressed. * * We expect to find the CRC and length as the last 8 bytes on the file. * This is a pretty reasonable thing to expect for locally-compressed * files, but there's a small chance that some extra padding got thrown * on (the man page talks about compressed data written to tape). We * don't currently deal with that here. If "gzip -l" whines, we're going * to fail too. * * On exit, "fp" is pointing at the start of the compressed data. */ /*static*/ bool ZipUtils::examineGzip(FILE* fp, int* pCompressionMethod, long* pUncompressedLen, long* pCompressedLen, unsigned long* pCRC32) { enum { // flags FTEXT = 0x01, FHCRC = 0x02, FEXTRA = 0x04, FNAME = 0x08, FCOMMENT = 0x10, }; int ic; int method, flags; int i; ic = getc(fp); if (ic != 0x1f || getc(fp) != 0x8b) return false; // not gzip method = getc(fp); flags = getc(fp); /* quick sanity checks */ if (method == EOF || flags == EOF) return false; if (method != ZipFileRO::kCompressDeflated) return false; /* skip over 4 bytes of mod time, 1 byte XFL, 1 byte OS */ for (i = 0; i < 6; i++) (void) getc(fp); /* consume "extra" field, if present */ if ((flags & FEXTRA) != 0) { int len; len = getc(fp); len |= getc(fp) << 8; while (len-- && getc(fp) != EOF) ; } /* consume filename, if present */ if ((flags & FNAME) != 0) { do { ic = getc(fp); } while (ic != 0 && ic != EOF); } /* consume comment, if present */ if ((flags & FCOMMENT) != 0) { do { ic = getc(fp); } while (ic != 0 && ic != EOF); } /* consume 16-bit header CRC, if present */ if ((flags & FHCRC) != 0) { (void) getc(fp); (void) getc(fp); } if (feof(fp) || ferror(fp)) return false; /* seek to the end; CRC and length are in the last 8 bytes */ long curPosn = ftell(fp); unsigned char buf[8]; fseek(fp, -8, SEEK_END); *pCompressedLen = ftell(fp) - curPosn; if (fread(buf, 1, 8, fp) != 8) return false; /* seek back to start of compressed data */ fseek(fp, curPosn, SEEK_SET); *pCompressionMethod = method; *pCRC32 = ZipFileRO::get4LE(&buf[0]); *pUncompressedLen = ZipFileRO::get4LE(&buf[4]); return true; } android-audiosystem-1.8+13.10.20130807/lib/utils/AssetDir.cpp0000644000015700001700000000334612200324306024030 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Provide access to a virtual directory in "asset space". Most of the // implementation is in the header file or in friend functions in // AssetManager. // #include using namespace android; /* * Find a matching entry in a vector of FileInfo. Because it's sorted, we * can use a binary search. * * Assumes the vector is sorted in ascending order. */ /*static*/ int AssetDir::FileInfo::findEntry(const SortedVector* pVector, const String8& fileName) { FileInfo tmpInfo; tmpInfo.setFileName(fileName); return pVector->indexOf(tmpInfo); #if 0 // don't need this after all (uses 1/2 compares of SortedVector though) int lo, hi, cur; lo = 0; hi = pVector->size() -1; while (lo <= hi) { int cmp; cur = (hi + lo) / 2; cmp = strcmp(pVector->itemAt(cur).getFileName(), fileName); if (cmp == 0) { /* match, bail */ return cur; } else if (cmp < 0) { /* too low */ lo = cur + 1; } else { /* too high */ hi = cur -1; } } return -1; #endif } android-audiosystem-1.8+13.10.20130807/lib/utils/Flattenable.cpp0000644000015700001700000000133312200324306024525 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include namespace android { Flattenable::~Flattenable() { } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/CallStack.cpp0000644000015700001700000002064312200324306024152 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "CallStack" #include #include #include #if HAVE_DLADDR #include #endif #if HAVE_CXXABI #include #endif #include #include #include #include #include /*****************************************************************************/ namespace android { typedef struct { size_t count; size_t ignore; const void** addrs; } stack_crawl_state_t; static _Unwind_Reason_Code trace_function(_Unwind_Context *context, void *arg) { stack_crawl_state_t* state = (stack_crawl_state_t*)arg; if (state->count) { void* ip = (void*)_Unwind_GetIP(context); if (ip) { if (state->ignore) { state->ignore--; } else { state->addrs[0] = ip; state->addrs++; state->count--; } } } return _URC_NO_REASON; } static int backtrace(const void** addrs, size_t ignore, size_t size) { stack_crawl_state_t state; state.count = size; state.ignore = ignore; state.addrs = addrs; _Unwind_Backtrace(trace_function, (void*)&state); return size - state.count; } /*****************************************************************************/ static const char *lookup_symbol(const void* addr, void **offset, char* name, size_t bufSize) { #if HAVE_DLADDR Dl_info info; if (dladdr(addr, &info)) { *offset = info.dli_saddr; return info.dli_sname; } #endif return NULL; } static int32_t linux_gcc_demangler(const char *mangled_name, char *unmangled_name, size_t buffersize) { size_t out_len = 0; #if HAVE_CXXABI int status = 0; char *demangled = abi::__cxa_demangle(mangled_name, 0, &out_len, &status); if (status == 0) { // OK if (out_len < buffersize) memcpy(unmangled_name, demangled, out_len); else out_len = 0; free(demangled); } else { out_len = 0; } #endif return out_len; } /*****************************************************************************/ class MapInfo { struct mapinfo { struct mapinfo *next; uint64_t start; uint64_t end; char name[]; }; const char *map_to_name(uint64_t pc, const char* def, uint64_t* start) { mapinfo* mi = getMapInfoList(); while(mi) { if ((pc >= mi->start) && (pc < mi->end)) { if (start) *start = mi->start; return mi->name; } mi = mi->next; } if (start) *start = 0; return def; } mapinfo *parse_maps_line(char *line) { mapinfo *mi; int len = strlen(line); if (len < 1) return 0; line[--len] = 0; if (len < 50) return 0; if (line[20] != 'x') return 0; mi = (mapinfo*)malloc(sizeof(mapinfo) + (len - 47)); if (mi == 0) return 0; mi->start = strtoull(line, 0, 16); mi->end = strtoull(line + 9, 0, 16); mi->next = 0; strcpy(mi->name, line + 49); return mi; } mapinfo* getMapInfoList() { Mutex::Autolock _l(mLock); if (milist == 0) { char data[1024]; FILE *fp; sprintf(data, "/proc/%d/maps", getpid()); fp = fopen(data, "r"); if (fp) { while(fgets(data, 1024, fp)) { mapinfo *mi = parse_maps_line(data); if(mi) { mi->next = milist; milist = mi; } } fclose(fp); } } return milist; } mapinfo* milist; Mutex mLock; static MapInfo sMapInfo; public: MapInfo() : milist(0) { } ~MapInfo() { while (milist) { mapinfo *next = milist->next; free(milist); milist = next; } } static const char *mapAddressToName(const void* pc, const char* def, void const** start) { uint64_t s; char const* name = sMapInfo.map_to_name(uint64_t(uintptr_t(pc)), def, &s); if (start) { *start = (void*)s; } return name; } }; /*****************************************************************************/ MapInfo MapInfo::sMapInfo; /*****************************************************************************/ CallStack::CallStack() : mCount(0) { } CallStack::CallStack(const CallStack& rhs) : mCount(rhs.mCount) { if (mCount) { memcpy(mStack, rhs.mStack, mCount*sizeof(void*)); } } CallStack::~CallStack() { } CallStack& CallStack::operator = (const CallStack& rhs) { mCount = rhs.mCount; if (mCount) { memcpy(mStack, rhs.mStack, mCount*sizeof(void*)); } return *this; } bool CallStack::operator == (const CallStack& rhs) const { if (mCount != rhs.mCount) return false; return !mCount || (memcmp(mStack, rhs.mStack, mCount*sizeof(void*)) == 0); } bool CallStack::operator != (const CallStack& rhs) const { return !operator == (rhs); } bool CallStack::operator < (const CallStack& rhs) const { if (mCount != rhs.mCount) return mCount < rhs.mCount; return memcmp(mStack, rhs.mStack, mCount*sizeof(void*)) < 0; } bool CallStack::operator >= (const CallStack& rhs) const { return !operator < (rhs); } bool CallStack::operator > (const CallStack& rhs) const { if (mCount != rhs.mCount) return mCount > rhs.mCount; return memcmp(mStack, rhs.mStack, mCount*sizeof(void*)) > 0; } bool CallStack::operator <= (const CallStack& rhs) const { return !operator > (rhs); } const void* CallStack::operator [] (int index) const { if (index >= int(mCount)) return 0; return mStack[index]; } void CallStack::clear() { mCount = 0; } void CallStack::update(int32_t ignoreDepth, int32_t maxDepth) { if (maxDepth > MAX_DEPTH) maxDepth = MAX_DEPTH; mCount = backtrace(mStack, ignoreDepth, maxDepth); } // Return the stack frame name on the designated level String8 CallStack::toStringSingleLevel(const char* prefix, int32_t level) const { String8 res; char namebuf[1024]; char tmp[256]; char tmp1[32]; char tmp2[32]; void *offs; const void* ip = mStack[level]; if (!ip) return res; if (prefix) res.append(prefix); snprintf(tmp1, 32, "#%02d ", level); res.append(tmp1); const char* name = lookup_symbol(ip, &offs, namebuf, sizeof(namebuf)); if (name) { if (linux_gcc_demangler(name, tmp, 256) != 0) name = tmp; snprintf(tmp1, 32, "0x%p: <", ip); snprintf(tmp2, 32, ">+0x%p", offs); res.append(tmp1); res.append(name); res.append(tmp2); } else { void const* start = 0; name = MapInfo::mapAddressToName(ip, "", &start); snprintf(tmp, 256, "pc %08lx %s", long(uintptr_t(ip)-uintptr_t(start)), name); res.append(tmp); } res.append("\n"); return res; } // Dump a stack trace to the log void CallStack::dump(const char* prefix) const { /* * Sending a single long log may be truncated since the stack levels can * get very deep. So we request function names of each frame individually. */ for (int i=0; i #include #include #include #include #include #include #include #include #include #include namespace android { static SharedBuffer* gEmptyStringBuf = NULL; static char16_t* gEmptyString = NULL; static inline char16_t* getEmptyString() { gEmptyStringBuf->acquire(); return gEmptyString; } void initialize_string16() { SharedBuffer* buf = SharedBuffer::alloc(sizeof(char16_t)); char16_t* str = (char16_t*)buf->data(); *str = 0; gEmptyStringBuf = buf; gEmptyString = str; } void terminate_string16() { SharedBuffer::bufferFromData(gEmptyString)->release(); gEmptyStringBuf = NULL; gEmptyString = NULL; } // --------------------------------------------------------------------------- static char16_t* allocFromUTF8(const char* u8str, size_t u8len) { if (u8len == 0) return getEmptyString(); const uint8_t* u8cur = (const uint8_t*) u8str; const ssize_t u16len = utf8_to_utf16_length(u8cur, u8len); if (u16len < 0) { return getEmptyString(); } const uint8_t* const u8end = u8cur + u8len; SharedBuffer* buf = SharedBuffer::alloc(sizeof(char16_t)*(u16len+1)); if (buf) { u8cur = (const uint8_t*) u8str; char16_t* u16str = (char16_t*)buf->data(); utf8_to_utf16(u8cur, u8len, u16str); //printf("Created UTF-16 string from UTF-8 \"%s\":", in); //printHexData(1, str, buf->size(), 16, 1); //printf("\n"); return u16str; } return getEmptyString(); } // --------------------------------------------------------------------------- String16::String16() : mString(getEmptyString()) { } String16::String16(const String16& o) : mString(o.mString) { SharedBuffer::bufferFromData(mString)->acquire(); } String16::String16(const String16& o, size_t len, size_t begin) : mString(getEmptyString()) { setTo(o, len, begin); } String16::String16(const char16_t* o) { size_t len = strlen16(o); SharedBuffer* buf = SharedBuffer::alloc((len+1)*sizeof(char16_t)); ALOG_ASSERT(buf, "Unable to allocate shared buffer"); if (buf) { char16_t* str = (char16_t*)buf->data(); strcpy16(str, o); mString = str; return; } mString = getEmptyString(); } String16::String16(const char16_t* o, size_t len) { SharedBuffer* buf = SharedBuffer::alloc((len+1)*sizeof(char16_t)); ALOG_ASSERT(buf, "Unable to allocate shared buffer"); if (buf) { char16_t* str = (char16_t*)buf->data(); memcpy(str, o, len*sizeof(char16_t)); str[len] = 0; mString = str; return; } mString = getEmptyString(); } String16::String16(const String8& o) : mString(allocFromUTF8(o.string(), o.size())) { } String16::String16(const char* o) : mString(allocFromUTF8(o, strlen(o))) { } String16::String16(const char* o, size_t len) : mString(allocFromUTF8(o, len)) { } String16::~String16() { SharedBuffer::bufferFromData(mString)->release(); } void String16::setTo(const String16& other) { SharedBuffer::bufferFromData(other.mString)->acquire(); SharedBuffer::bufferFromData(mString)->release(); mString = other.mString; } status_t String16::setTo(const String16& other, size_t len, size_t begin) { const size_t N = other.size(); if (begin >= N) { SharedBuffer::bufferFromData(mString)->release(); mString = getEmptyString(); return NO_ERROR; } if ((begin+len) > N) len = N-begin; if (begin == 0 && len == N) { setTo(other); return NO_ERROR; } if (&other == this) { LOG_ALWAYS_FATAL("Not implemented"); } return setTo(other.string()+begin, len); } status_t String16::setTo(const char16_t* other) { return setTo(other, strlen16(other)); } status_t String16::setTo(const char16_t* other, size_t len) { SharedBuffer* buf = SharedBuffer::bufferFromData(mString) ->editResize((len+1)*sizeof(char16_t)); if (buf) { char16_t* str = (char16_t*)buf->data(); memmove(str, other, len*sizeof(char16_t)); str[len] = 0; mString = str; return NO_ERROR; } return NO_MEMORY; } status_t String16::append(const String16& other) { const size_t myLen = size(); const size_t otherLen = other.size(); if (myLen == 0) { setTo(other); return NO_ERROR; } else if (otherLen == 0) { return NO_ERROR; } SharedBuffer* buf = SharedBuffer::bufferFromData(mString) ->editResize((myLen+otherLen+1)*sizeof(char16_t)); if (buf) { char16_t* str = (char16_t*)buf->data(); memcpy(str+myLen, other, (otherLen+1)*sizeof(char16_t)); mString = str; return NO_ERROR; } return NO_MEMORY; } status_t String16::append(const char16_t* chrs, size_t otherLen) { const size_t myLen = size(); if (myLen == 0) { setTo(chrs, otherLen); return NO_ERROR; } else if (otherLen == 0) { return NO_ERROR; } SharedBuffer* buf = SharedBuffer::bufferFromData(mString) ->editResize((myLen+otherLen+1)*sizeof(char16_t)); if (buf) { char16_t* str = (char16_t*)buf->data(); memcpy(str+myLen, chrs, otherLen*sizeof(char16_t)); str[myLen+otherLen] = 0; mString = str; return NO_ERROR; } return NO_MEMORY; } status_t String16::insert(size_t pos, const char16_t* chrs) { return insert(pos, chrs, strlen16(chrs)); } status_t String16::insert(size_t pos, const char16_t* chrs, size_t len) { const size_t myLen = size(); if (myLen == 0) { return setTo(chrs, len); return NO_ERROR; } else if (len == 0) { return NO_ERROR; } if (pos > myLen) pos = myLen; #if 0 printf("Insert in to %s: pos=%d, len=%d, myLen=%d, chrs=%s\n", String8(*this).string(), pos, len, myLen, String8(chrs, len).string()); #endif SharedBuffer* buf = SharedBuffer::bufferFromData(mString) ->editResize((myLen+len+1)*sizeof(char16_t)); if (buf) { char16_t* str = (char16_t*)buf->data(); if (pos < myLen) { memmove(str+pos+len, str+pos, (myLen-pos)*sizeof(char16_t)); } memcpy(str+pos, chrs, len*sizeof(char16_t)); str[myLen+len] = 0; mString = str; #if 0 printf("Result (%d chrs): %s\n", size(), String8(*this).string()); #endif return NO_ERROR; } return NO_MEMORY; } ssize_t String16::findFirst(char16_t c) const { const char16_t* str = string(); const char16_t* p = str; const char16_t* e = p + size(); while (p < e) { if (*p == c) { return p-str; } p++; } return -1; } ssize_t String16::findLast(char16_t c) const { const char16_t* str = string(); const char16_t* p = str; const char16_t* e = p + size(); while (p < e) { e--; if (*e == c) { return e-str; } } return -1; } bool String16::startsWith(const String16& prefix) const { const size_t ps = prefix.size(); if (ps > size()) return false; return strzcmp16(mString, ps, prefix.string(), ps) == 0; } bool String16::startsWith(const char16_t* prefix) const { const size_t ps = strlen16(prefix); if (ps > size()) return false; return strncmp16(mString, prefix, ps) == 0; } status_t String16::makeLower() { const size_t N = size(); const char16_t* str = string(); char16_t* edit = NULL; for (size_t i=0; i= 'A' && v <= 'Z') { if (!edit) { SharedBuffer* buf = SharedBuffer::bufferFromData(mString)->edit(); if (!buf) { return NO_MEMORY; } edit = (char16_t*)buf->data(); mString = str = edit; } edit[i] = tolower((char)v); } } return NO_ERROR; } status_t String16::replaceAll(char16_t replaceThis, char16_t withThis) { const size_t N = size(); const char16_t* str = string(); char16_t* edit = NULL; for (size_t i=0; iedit(); if (!buf) { return NO_MEMORY; } edit = (char16_t*)buf->data(); mString = str = edit; } edit[i] = withThis; } } return NO_ERROR; } status_t String16::remove(size_t len, size_t begin) { const size_t N = size(); if (begin >= N) { SharedBuffer::bufferFromData(mString)->release(); mString = getEmptyString(); return NO_ERROR; } if ((begin+len) > N) len = N-begin; if (begin == 0 && len == N) { return NO_ERROR; } if (begin > 0) { SharedBuffer* buf = SharedBuffer::bufferFromData(mString) ->editResize((N+1)*sizeof(char16_t)); if (!buf) { return NO_MEMORY; } char16_t* str = (char16_t*)buf->data(); memmove(str, str+begin, (N-begin+1)*sizeof(char16_t)); mString = str; } SharedBuffer* buf = SharedBuffer::bufferFromData(mString) ->editResize((len+1)*sizeof(char16_t)); if (buf) { char16_t* str = (char16_t*)buf->data(); str[len] = 0; mString = str; return NO_ERROR; } return NO_MEMORY; } TextOutput& operator<<(TextOutput& to, const String16& val) { to << String8(val).string(); return to; } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/StreamingZipInflater.cpp0000644000015700001700000001761512200324306026417 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "szipinf" #include #include #include #include #include #include static inline size_t min_of(size_t a, size_t b) { return (a < b) ? a : b; } using namespace android; /* * Streaming access to compressed asset data in an open fd */ StreamingZipInflater::StreamingZipInflater(int fd, off64_t compDataStart, size_t uncompSize, size_t compSize) { mFd = fd; mDataMap = NULL; mInFileStart = compDataStart; mOutTotalSize = uncompSize; mInTotalSize = compSize; mInBufSize = StreamingZipInflater::INPUT_CHUNK_SIZE; mInBuf = new uint8_t[mInBufSize]; mOutBufSize = StreamingZipInflater::OUTPUT_CHUNK_SIZE; mOutBuf = new uint8_t[mOutBufSize]; initInflateState(); } /* * Streaming access to compressed data held in an mmapped region of memory */ StreamingZipInflater::StreamingZipInflater(FileMap* dataMap, size_t uncompSize) { mFd = -1; mDataMap = dataMap; mOutTotalSize = uncompSize; mInTotalSize = dataMap->getDataLength(); mInBuf = (uint8_t*) dataMap->getDataPtr(); mInBufSize = mInTotalSize; mOutBufSize = StreamingZipInflater::OUTPUT_CHUNK_SIZE; mOutBuf = new uint8_t[mOutBufSize]; initInflateState(); } StreamingZipInflater::~StreamingZipInflater() { // tear down the in-flight zip state just in case ::inflateEnd(&mInflateState); if (mDataMap == NULL) { delete [] mInBuf; } delete [] mOutBuf; } void StreamingZipInflater::initInflateState() { ALOGV("Initializing inflate state"); memset(&mInflateState, 0, sizeof(mInflateState)); mInflateState.zalloc = Z_NULL; mInflateState.zfree = Z_NULL; mInflateState.opaque = Z_NULL; mInflateState.next_in = (Bytef*)mInBuf; mInflateState.next_out = (Bytef*) mOutBuf; mInflateState.avail_out = mOutBufSize; mInflateState.data_type = Z_UNKNOWN; mOutLastDecoded = mOutDeliverable = mOutCurPosition = 0; mInNextChunkOffset = 0; mStreamNeedsInit = true; if (mDataMap == NULL) { ::lseek(mFd, mInFileStart, SEEK_SET); mInflateState.avail_in = 0; // set when a chunk is read in } else { mInflateState.avail_in = mInBufSize; } } /* * Basic approach: * * 1. If we have undelivered uncompressed data, send it. At this point * either we've satisfied the request, or we've exhausted the available * output data in mOutBuf. * * 2. While we haven't sent enough data to satisfy the request: * 0. if the request is for more data than exists, bail. * a. if there is no input data to decode, read some into the input buffer * and readjust the z_stream input pointers * b. point the output to the start of the output buffer and decode what we can * c. deliver whatever output data we can */ ssize_t StreamingZipInflater::read(void* outBuf, size_t count) { uint8_t* dest = (uint8_t*) outBuf; size_t bytesRead = 0; size_t toRead = min_of(count, size_t(mOutTotalSize - mOutCurPosition)); while (toRead > 0) { // First, write from whatever we already have decoded and ready to go size_t deliverable = min_of(toRead, mOutLastDecoded - mOutDeliverable); if (deliverable > 0) { if (outBuf != NULL) memcpy(dest, mOutBuf + mOutDeliverable, deliverable); mOutDeliverable += deliverable; mOutCurPosition += deliverable; dest += deliverable; bytesRead += deliverable; toRead -= deliverable; } // need more data? time to decode some. if (toRead > 0) { // if we don't have any data to decode, read some in. If we're working // from mmapped data this won't happen, because the clipping to total size // will prevent reading off the end of the mapped input chunk. if (mInflateState.avail_in == 0) { int err = readNextChunk(); if (err < 0) { ALOGE("Unable to access asset data: %d", err); if (!mStreamNeedsInit) { ::inflateEnd(&mInflateState); initInflateState(); } return -1; } } // we know we've drained whatever is in the out buffer now, so just // start from scratch there, reading all the input we have at present. mInflateState.next_out = (Bytef*) mOutBuf; mInflateState.avail_out = mOutBufSize; /* ALOGV("Inflating to outbuf: avail_in=%u avail_out=%u next_in=%p next_out=%p", mInflateState.avail_in, mInflateState.avail_out, mInflateState.next_in, mInflateState.next_out); */ int result = Z_OK; if (mStreamNeedsInit) { ALOGV("Initializing zlib to inflate"); result = inflateInit2(&mInflateState, -MAX_WBITS); mStreamNeedsInit = false; } if (result == Z_OK) result = ::inflate(&mInflateState, Z_SYNC_FLUSH); if (result < 0) { // Whoops, inflation failed ALOGE("Error inflating asset: %d", result); ::inflateEnd(&mInflateState); initInflateState(); return -1; } else { if (result == Z_STREAM_END) { // we know we have to have reached the target size here and will // not try to read any further, so just wind things up. ::inflateEnd(&mInflateState); } // Note how much data we got, and off we go mOutDeliverable = 0; mOutLastDecoded = mOutBufSize - mInflateState.avail_out; } } } return bytesRead; } int StreamingZipInflater::readNextChunk() { assert(mDataMap == NULL); if (mInNextChunkOffset < mInTotalSize) { size_t toRead = min_of(mInBufSize, mInTotalSize - mInNextChunkOffset); if (toRead > 0) { ssize_t didRead = ::read(mFd, mInBuf, toRead); //ALOGV("Reading input chunk, size %08x didread %08x", toRead, didRead); if (didRead < 0) { // TODO: error ALOGE("Error reading asset data"); return didRead; } else { mInNextChunkOffset += didRead; mInflateState.next_in = (Bytef*) mInBuf; mInflateState.avail_in = didRead; } } } return 0; } // seeking backwards requires uncompressing fom the beginning, so is very // expensive. seeking forwards only requires uncompressing from the current // position to the destination. off64_t StreamingZipInflater::seekAbsolute(off64_t absoluteInputPosition) { if (absoluteInputPosition < mOutCurPosition) { // rewind and reprocess the data from the beginning if (!mStreamNeedsInit) { ::inflateEnd(&mInflateState); } initInflateState(); read(NULL, absoluteInputPosition); } else if (absoluteInputPosition > mOutCurPosition) { read(NULL, absoluteInputPosition - mOutCurPosition); } // else if the target position *is* our current position, do nothing return absoluteInputPosition; } android-audiosystem-1.8+13.10.20130807/lib/utils/Unicode.cpp0000644000015700001700000003551212200324306023700 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #ifdef HAVE_WINSOCK # undef nhtol # undef htonl # undef nhtos # undef htons # ifdef HAVE_LITTLE_ENDIAN # define ntohl(x) ( ((x) << 24) | (((x) >> 24) & 255) | (((x) << 8) & 0xff0000) | (((x) >> 8) & 0xff00) ) # define htonl(x) ntohl(x) # define ntohs(x) ( (((x) << 8) & 0xff00) | (((x) >> 8) & 255) ) # define htons(x) ntohs(x) # else # define ntohl(x) (x) # define htonl(x) (x) # define ntohs(x) (x) # define htons(x) (x) # endif #else # include #endif extern "C" { static const char32_t kByteMask = 0x000000BF; static const char32_t kByteMark = 0x00000080; // Surrogates aren't valid for UTF-32 characters, so define some // constants that will let us screen them out. static const char32_t kUnicodeSurrogateHighStart = 0x0000D800; static const char32_t kUnicodeSurrogateHighEnd = 0x0000DBFF; static const char32_t kUnicodeSurrogateLowStart = 0x0000DC00; static const char32_t kUnicodeSurrogateLowEnd = 0x0000DFFF; static const char32_t kUnicodeSurrogateStart = kUnicodeSurrogateHighStart; static const char32_t kUnicodeSurrogateEnd = kUnicodeSurrogateLowEnd; static const char32_t kUnicodeMaxCodepoint = 0x0010FFFF; // Mask used to set appropriate bits in first byte of UTF-8 sequence, // indexed by number of bytes in the sequence. // 0xxxxxxx // -> (00-7f) 7bit. Bit mask for the first byte is 0x00000000 // 110yyyyx 10xxxxxx // -> (c0-df)(80-bf) 11bit. Bit mask is 0x000000C0 // 1110yyyy 10yxxxxx 10xxxxxx // -> (e0-ef)(80-bf)(80-bf) 16bit. Bit mask is 0x000000E0 // 11110yyy 10yyxxxx 10xxxxxx 10xxxxxx // -> (f0-f7)(80-bf)(80-bf)(80-bf) 21bit. Bit mask is 0x000000F0 static const char32_t kFirstByteMark[] = { 0x00000000, 0x00000000, 0x000000C0, 0x000000E0, 0x000000F0 }; // -------------------------------------------------------------------------- // UTF-32 // -------------------------------------------------------------------------- /** * Return number of UTF-8 bytes required for the character. If the character * is invalid, return size of 0. */ static inline size_t utf32_codepoint_utf8_length(char32_t srcChar) { // Figure out how many bytes the result will require. if (srcChar < 0x00000080) { return 1; } else if (srcChar < 0x00000800) { return 2; } else if (srcChar < 0x00010000) { if ((srcChar < kUnicodeSurrogateStart) || (srcChar > kUnicodeSurrogateEnd)) { return 3; } else { // Surrogates are invalid UTF-32 characters. return 0; } } // Max code point for Unicode is 0x0010FFFF. else if (srcChar <= kUnicodeMaxCodepoint) { return 4; } else { // Invalid UTF-32 character. return 0; } } // Write out the source character to . static inline void utf32_codepoint_to_utf8(uint8_t* dstP, char32_t srcChar, size_t bytes) { dstP += bytes; switch (bytes) { /* note: everything falls through. */ case 4: *--dstP = (uint8_t)((srcChar | kByteMark) & kByteMask); srcChar >>= 6; case 3: *--dstP = (uint8_t)((srcChar | kByteMark) & kByteMask); srcChar >>= 6; case 2: *--dstP = (uint8_t)((srcChar | kByteMark) & kByteMask); srcChar >>= 6; case 1: *--dstP = (uint8_t)(srcChar | kFirstByteMark[bytes]); } } size_t strlen32(const char32_t *s) { const char32_t *ss = s; while ( *ss ) ss++; return ss-s; } size_t strnlen32(const char32_t *s, size_t maxlen) { const char32_t *ss = s; while ((maxlen > 0) && *ss) { ss++; maxlen--; } return ss-s; } static inline int32_t utf32_at_internal(const char* cur, size_t *num_read) { const char first_char = *cur; if ((first_char & 0x80) == 0) { // ASCII *num_read = 1; return *cur; } cur++; char32_t mask, to_ignore_mask; size_t num_to_read = 0; char32_t utf32 = first_char; for (num_to_read = 1, mask = 0x40, to_ignore_mask = 0xFFFFFF80; (first_char & mask); num_to_read++, to_ignore_mask |= mask, mask >>= 1) { // 0x3F == 00111111 utf32 = (utf32 << 6) + (*cur++ & 0x3F); } to_ignore_mask |= mask; utf32 &= ~(to_ignore_mask << (6 * (num_to_read - 1))); *num_read = num_to_read; return static_cast(utf32); } int32_t utf32_from_utf8_at(const char *src, size_t src_len, size_t index, size_t *next_index) { if (index >= src_len) { return -1; } size_t dummy_index; if (next_index == NULL) { next_index = &dummy_index; } size_t num_read; int32_t ret = utf32_at_internal(src + index, &num_read); if (ret >= 0) { *next_index = index + num_read; } return ret; } ssize_t utf32_to_utf8_length(const char32_t *src, size_t src_len) { if (src == NULL || src_len == 0) { return -1; } size_t ret = 0; const char32_t *end = src + src_len; while (src < end) { ret += utf32_codepoint_utf8_length(*src++); } return ret; } void utf32_to_utf8(const char32_t* src, size_t src_len, char* dst) { if (src == NULL || src_len == 0 || dst == NULL) { return; } const char32_t *cur_utf32 = src; const char32_t *end_utf32 = src + src_len; char *cur = dst; while (cur_utf32 < end_utf32) { size_t len = utf32_codepoint_utf8_length(*cur_utf32); utf32_codepoint_to_utf8((uint8_t *)cur, *cur_utf32++, len); cur += len; } *cur = '\0'; } // -------------------------------------------------------------------------- // UTF-16 // -------------------------------------------------------------------------- int strcmp16(const char16_t *s1, const char16_t *s2) { char16_t ch; int d = 0; while ( 1 ) { d = (int)(ch = *s1++) - (int)*s2++; if ( d || !ch ) break; } return d; } int strncmp16(const char16_t *s1, const char16_t *s2, size_t n) { char16_t ch; int d = 0; while ( n-- ) { d = (int)(ch = *s1++) - (int)*s2++; if ( d || !ch ) break; } return d; } char16_t *strcpy16(char16_t *dst, const char16_t *src) { char16_t *q = dst; const char16_t *p = src; char16_t ch; do { *q++ = ch = *p++; } while ( ch ); return dst; } size_t strlen16(const char16_t *s) { const char16_t *ss = s; while ( *ss ) ss++; return ss-s; } char16_t *strncpy16(char16_t *dst, const char16_t *src, size_t n) { char16_t *q = dst; const char16_t *p = src; char ch; while (n) { n--; *q++ = ch = *p++; if ( !ch ) break; } *q = 0; return dst; } size_t strnlen16(const char16_t *s, size_t maxlen) { const char16_t *ss = s; /* Important: the maxlen test must precede the reference through ss; since the byte beyond the maximum may segfault */ while ((maxlen > 0) && *ss) { ss++; maxlen--; } return ss-s; } int strzcmp16(const char16_t *s1, size_t n1, const char16_t *s2, size_t n2) { const char16_t* e1 = s1+n1; const char16_t* e2 = s2+n2; while (s1 < e1 && s2 < e2) { const int d = (int)*s1++ - (int)*s2++; if (d) { return d; } } return n1 < n2 ? (0 - (int)*s2) : (n1 > n2 ? ((int)*s1 - 0) : 0); } int strzcmp16_h_n(const char16_t *s1H, size_t n1, const char16_t *s2N, size_t n2) { const char16_t* e1 = s1H+n1; const char16_t* e2 = s2N+n2; while (s1H < e1 && s2N < e2) { const char16_t c2 = ntohs(*s2N); const int d = (int)*s1H++ - (int)c2; s2N++; if (d) { return d; } } return n1 < n2 ? (0 - (int)ntohs(*s2N)) : (n1 > n2 ? ((int)*s1H - 0) : 0); } void utf16_to_utf8(const char16_t* src, size_t src_len, char* dst) { if (src == NULL || src_len == 0 || dst == NULL) { return; } const char16_t* cur_utf16 = src; const char16_t* const end_utf16 = src + src_len; char *cur = dst; while (cur_utf16 < end_utf16) { char32_t utf32; // surrogate pairs if ((*cur_utf16 & 0xFC00) == 0xD800) { utf32 = (*cur_utf16++ - 0xD800) << 10; utf32 |= *cur_utf16++ - 0xDC00; utf32 += 0x10000; } else { utf32 = (char32_t) *cur_utf16++; } const size_t len = utf32_codepoint_utf8_length(utf32); utf32_codepoint_to_utf8((uint8_t*)cur, utf32, len); cur += len; } *cur = '\0'; } // -------------------------------------------------------------------------- // UTF-8 // -------------------------------------------------------------------------- ssize_t utf8_length(const char *src) { const char *cur = src; size_t ret = 0; while (*cur != '\0') { const char first_char = *cur++; if ((first_char & 0x80) == 0) { // ASCII ret += 1; continue; } // (UTF-8's character must not be like 10xxxxxx, // but 110xxxxx, 1110xxxx, ... or 1111110x) if ((first_char & 0x40) == 0) { return -1; } int32_t mask, to_ignore_mask; size_t num_to_read = 0; char32_t utf32 = 0; for (num_to_read = 1, mask = 0x40, to_ignore_mask = 0x80; num_to_read < 5 && (first_char & mask); num_to_read++, to_ignore_mask |= mask, mask >>= 1) { if ((*cur & 0xC0) != 0x80) { // must be 10xxxxxx return -1; } // 0x3F == 00111111 utf32 = (utf32 << 6) + (*cur++ & 0x3F); } // "first_char" must be (110xxxxx - 11110xxx) if (num_to_read == 5) { return -1; } to_ignore_mask |= mask; utf32 |= ((~to_ignore_mask) & first_char) << (6 * (num_to_read - 1)); if (utf32 > kUnicodeMaxCodepoint) { return -1; } ret += num_to_read; } return ret; } ssize_t utf16_to_utf8_length(const char16_t *src, size_t src_len) { if (src == NULL || src_len == 0) { return -1; } size_t ret = 0; const char16_t* const end = src + src_len; while (src < end) { if ((*src & 0xFC00) == 0xD800 && (src + 1) < end && (*++src & 0xFC00) == 0xDC00) { // surrogate pairs are always 4 bytes. ret += 4; src++; } else { ret += utf32_codepoint_utf8_length((char32_t) *src++); } } return ret; } /** * Returns 1-4 based on the number of leading bits. * * 1111 -> 4 * 1110 -> 3 * 110x -> 2 * 10xx -> 1 * 0xxx -> 1 */ static inline size_t utf8_codepoint_len(uint8_t ch) { return ((0xe5000000 >> ((ch >> 3) & 0x1e)) & 3) + 1; } static inline void utf8_shift_and_mask(uint32_t* codePoint, const uint8_t byte) { *codePoint <<= 6; *codePoint |= 0x3F & byte; } size_t utf8_to_utf32_length(const char *src, size_t src_len) { if (src == NULL || src_len == 0) { return 0; } size_t ret = 0; const char* cur; const char* end; size_t num_to_skip; for (cur = src, end = src + src_len, num_to_skip = 1; cur < end; cur += num_to_skip, ret++) { const char first_char = *cur; num_to_skip = 1; if ((first_char & 0x80) == 0) { // ASCII continue; } int32_t mask; for (mask = 0x40; (first_char & mask); num_to_skip++, mask >>= 1) { } } return ret; } void utf8_to_utf32(const char* src, size_t src_len, char32_t* dst) { if (src == NULL || src_len == 0 || dst == NULL) { return; } const char* cur = src; const char* const end = src + src_len; char32_t* cur_utf32 = dst; while (cur < end) { size_t num_read; *cur_utf32++ = static_cast(utf32_at_internal(cur, &num_read)); cur += num_read; } *cur_utf32 = 0; } static inline uint32_t utf8_to_utf32_codepoint(const uint8_t *src, size_t length) { uint32_t unicode; switch (length) { case 1: return src[0]; case 2: unicode = src[0] & 0x1f; utf8_shift_and_mask(&unicode, src[1]); return unicode; case 3: unicode = src[0] & 0x0f; utf8_shift_and_mask(&unicode, src[1]); utf8_shift_and_mask(&unicode, src[2]); return unicode; case 4: unicode = src[0] & 0x07; utf8_shift_and_mask(&unicode, src[1]); utf8_shift_and_mask(&unicode, src[2]); utf8_shift_and_mask(&unicode, src[3]); return unicode; default: return 0xffff; } //printf("Char at %p: len=%d, utf-16=%p\n", src, length, (void*)result); } ssize_t utf8_to_utf16_length(const uint8_t* u8str, size_t u8len) { const uint8_t* const u8end = u8str + u8len; const uint8_t* u8cur = u8str; /* Validate that the UTF-8 is the correct len */ size_t u16measuredLen = 0; while (u8cur < u8end) { u16measuredLen++; int u8charLen = utf8_codepoint_len(*u8cur); uint32_t codepoint = utf8_to_utf32_codepoint(u8cur, u8charLen); if (codepoint > 0xFFFF) u16measuredLen++; // this will be a surrogate pair in utf16 u8cur += u8charLen; } /** * Make sure that we ended where we thought we would and the output UTF-16 * will be exactly how long we were told it would be. */ if (u8cur != u8end) { return -1; } return u16measuredLen; } char16_t* utf8_to_utf16_no_null_terminator(const uint8_t* u8str, size_t u8len, char16_t* u16str) { const uint8_t* const u8end = u8str + u8len; const uint8_t* u8cur = u8str; char16_t* u16cur = u16str; while (u8cur < u8end) { size_t u8len = utf8_codepoint_len(*u8cur); uint32_t codepoint = utf8_to_utf32_codepoint(u8cur, u8len); // Convert the UTF32 codepoint to one or more UTF16 codepoints if (codepoint <= 0xFFFF) { // Single UTF16 character *u16cur++ = (char16_t) codepoint; } else { // Multiple UTF16 characters with surrogates codepoint = codepoint - 0x10000; *u16cur++ = (char16_t) ((codepoint >> 10) + 0xD800); *u16cur++ = (char16_t) ((codepoint & 0x3FF) + 0xDC00); } u8cur += u8len; } return u16cur; } void utf8_to_utf16(const uint8_t* u8str, size_t u8len, char16_t* u16str) { char16_t* end = utf8_to_utf16_no_null_terminator(u8str, u8len, u16str); *end = 0; } } android-audiosystem-1.8+13.10.20130807/lib/utils/VectorImpl.cpp0000644000015700001700000004334612200324306024402 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "Vector" #include #include #include #include #include #include #include /*****************************************************************************/ namespace android { // ---------------------------------------------------------------------------- const size_t kMinVectorCapacity = 4; static inline size_t max(size_t a, size_t b) { return a>b ? a : b; } // ---------------------------------------------------------------------------- VectorImpl::VectorImpl(size_t itemSize, uint32_t flags) : mStorage(0), mCount(0), mFlags(flags), mItemSize(itemSize) { } VectorImpl::VectorImpl(const VectorImpl& rhs) : mStorage(rhs.mStorage), mCount(rhs.mCount), mFlags(rhs.mFlags), mItemSize(rhs.mItemSize) { if (mStorage) { SharedBuffer::sharedBuffer(mStorage)->acquire(); } } VectorImpl::~VectorImpl() { ALOG_ASSERT(!mCount, "[%p] " "subclasses of VectorImpl must call finish_vector()" " in their destructor. Leaking %d bytes.", this, (int)(mCount*mItemSize)); // We can't call _do_destroy() here because the vtable is already gone. } VectorImpl& VectorImpl::operator = (const VectorImpl& rhs) { ALOG_ASSERT(mItemSize == rhs.mItemSize, "Vector<> have different types (this=%p, rhs=%p)", this, &rhs); if (this != &rhs) { release_storage(); if (rhs.mCount) { mStorage = rhs.mStorage; mCount = rhs.mCount; SharedBuffer::sharedBuffer(mStorage)->acquire(); } else { mStorage = 0; mCount = 0; } } return *this; } void* VectorImpl::editArrayImpl() { if (mStorage) { SharedBuffer* sb = SharedBuffer::sharedBuffer(mStorage)->attemptEdit(); if (sb == 0) { sb = SharedBuffer::alloc(capacity() * mItemSize); if (sb) { _do_copy(sb->data(), mStorage, mCount); release_storage(); mStorage = sb->data(); } } } return mStorage; } size_t VectorImpl::capacity() const { if (mStorage) { return SharedBuffer::sharedBuffer(mStorage)->size() / mItemSize; } return 0; } ssize_t VectorImpl::insertVectorAt(const VectorImpl& vector, size_t index) { return insertArrayAt(vector.arrayImpl(), index, vector.size()); } ssize_t VectorImpl::appendVector(const VectorImpl& vector) { return insertVectorAt(vector, size()); } ssize_t VectorImpl::insertArrayAt(const void* array, size_t index, size_t length) { if (index > size()) return BAD_INDEX; void* where = _grow(index, length); if (where) { _do_copy(where, array, length); } return where ? index : (ssize_t)NO_MEMORY; } ssize_t VectorImpl::appendArray(const void* array, size_t length) { return insertArrayAt(array, size(), length); } ssize_t VectorImpl::insertAt(size_t index, size_t numItems) { return insertAt(0, index, numItems); } ssize_t VectorImpl::insertAt(const void* item, size_t index, size_t numItems) { if (index > size()) return BAD_INDEX; void* where = _grow(index, numItems); if (where) { if (item) { _do_splat(where, item, numItems); } else { _do_construct(where, numItems); } } return where ? index : (ssize_t)NO_MEMORY; } static int sortProxy(const void* lhs, const void* rhs, void* func) { return (*(VectorImpl::compar_t)func)(lhs, rhs); } status_t VectorImpl::sort(VectorImpl::compar_t cmp) { return sort(sortProxy, (void*)cmp); } status_t VectorImpl::sort(VectorImpl::compar_r_t cmp, void* state) { // the sort must be stable. we're using insertion sort which // is well suited for small and already sorted arrays // for big arrays, it could be better to use mergesort const ssize_t count = size(); if (count > 1) { void* array = const_cast(arrayImpl()); void* temp = 0; ssize_t i = 1; while (i < count) { void* item = reinterpret_cast(array) + mItemSize*(i); void* curr = reinterpret_cast(array) + mItemSize*(i-1); if (cmp(curr, item, state) > 0) { if (!temp) { // we're going to have to modify the array... array = editArrayImpl(); if (!array) return NO_MEMORY; temp = malloc(mItemSize); if (!temp) return NO_MEMORY; item = reinterpret_cast(array) + mItemSize*(i); curr = reinterpret_cast(array) + mItemSize*(i-1); } else { _do_destroy(temp, 1); } _do_copy(temp, item, 1); ssize_t j = i-1; void* next = reinterpret_cast(array) + mItemSize*(i); do { _do_destroy(next, 1); _do_copy(next, curr, 1); next = curr; --j; curr = reinterpret_cast(array) + mItemSize*(j); } while (j>=0 && (cmp(curr, temp, state) > 0)); _do_destroy(next, 1); _do_copy(next, temp, 1); } i++; } if (temp) { _do_destroy(temp, 1); free(temp); } } return NO_ERROR; } void VectorImpl::pop() { if (size()) removeItemsAt(size()-1, 1); } void VectorImpl::push() { push(0); } void VectorImpl::push(const void* item) { insertAt(item, size()); } ssize_t VectorImpl::add() { return add(0); } ssize_t VectorImpl::add(const void* item) { return insertAt(item, size()); } ssize_t VectorImpl::replaceAt(size_t index) { return replaceAt(0, index); } ssize_t VectorImpl::replaceAt(const void* prototype, size_t index) { ALOG_ASSERT(index size()) return BAD_VALUE; _shrink(index, count); return index; } void VectorImpl::finish_vector() { release_storage(); mStorage = 0; mCount = 0; } void VectorImpl::clear() { _shrink(0, mCount); } void* VectorImpl::editItemLocation(size_t index) { ALOG_ASSERT(index(buffer) + index*mItemSize; return 0; } const void* VectorImpl::itemLocation(size_t index) const { ALOG_ASSERT(index(buffer) + index*mItemSize; return 0; } ssize_t VectorImpl::setCapacity(size_t new_capacity) { size_t current_capacity = capacity(); ssize_t amount = new_capacity - size(); if (amount <= 0) { // we can't reduce the capacity return current_capacity; } SharedBuffer* sb = SharedBuffer::alloc(new_capacity * mItemSize); if (sb) { void* array = sb->data(); _do_copy(array, mStorage, size()); release_storage(); mStorage = const_cast(array); } else { return NO_MEMORY; } return new_capacity; } void VectorImpl::release_storage() { if (mStorage) { const SharedBuffer* sb = SharedBuffer::sharedBuffer(mStorage); if (sb->release(SharedBuffer::eKeepStorage) == 1) { _do_destroy(mStorage, mCount); SharedBuffer::dealloc(sb); } } } void* VectorImpl::_grow(size_t where, size_t amount) { // ALOGV("_grow(this=%p, where=%d, amount=%d) count=%d, capacity=%d", // this, (int)where, (int)amount, (int)mCount, (int)capacity()); ALOG_ASSERT(where <= mCount, "[%p] _grow: where=%d, amount=%d, count=%d", this, (int)where, (int)amount, (int)mCount); // caller already checked const size_t new_size = mCount + amount; if (capacity() < new_size) { const size_t new_capacity = max(kMinVectorCapacity, ((new_size*3)+1)/2); // ALOGV("grow vector %p, new_capacity=%d", this, (int)new_capacity); if ((mStorage) && (mCount==where) && (mFlags & HAS_TRIVIAL_COPY) && (mFlags & HAS_TRIVIAL_DTOR)) { const SharedBuffer* cur_sb = SharedBuffer::sharedBuffer(mStorage); SharedBuffer* sb = cur_sb->editResize(new_capacity * mItemSize); mStorage = sb->data(); } else { SharedBuffer* sb = SharedBuffer::alloc(new_capacity * mItemSize); if (sb) { void* array = sb->data(); if (where != 0) { _do_copy(array, mStorage, where); } if (where != mCount) { const void* from = reinterpret_cast(mStorage) + where*mItemSize; void* dest = reinterpret_cast(array) + (where+amount)*mItemSize; _do_copy(dest, from, mCount-where); } release_storage(); mStorage = const_cast(array); } } } else { if (where != mCount) { void* array = editArrayImpl(); const void* from = reinterpret_cast(array) + where*mItemSize; void* to = reinterpret_cast(array) + (where+amount)*mItemSize; _do_move_forward(to, from, mCount - where); } } mCount = new_size; void* free_space = const_cast(itemLocation(where)); return free_space; } void VectorImpl::_shrink(size_t where, size_t amount) { if (!mStorage) return; // ALOGV("_shrink(this=%p, where=%d, amount=%d) count=%d, capacity=%d", // this, (int)where, (int)amount, (int)mCount, (int)capacity()); ALOG_ASSERT(where + amount <= mCount, "[%p] _shrink: where=%d, amount=%d, count=%d", this, (int)where, (int)amount, (int)mCount); // caller already checked const size_t new_size = mCount - amount; if (new_size*3 < capacity()) { const size_t new_capacity = max(kMinVectorCapacity, new_size*2); // ALOGV("shrink vector %p, new_capacity=%d", this, (int)new_capacity); if ((where == new_size) && (mFlags & HAS_TRIVIAL_COPY) && (mFlags & HAS_TRIVIAL_DTOR)) { const SharedBuffer* cur_sb = SharedBuffer::sharedBuffer(mStorage); SharedBuffer* sb = cur_sb->editResize(new_capacity * mItemSize); mStorage = sb->data(); } else { SharedBuffer* sb = SharedBuffer::alloc(new_capacity * mItemSize); if (sb) { void* array = sb->data(); if (where != 0) { _do_copy(array, mStorage, where); } if (where != new_size) { const void* from = reinterpret_cast(mStorage) + (where+amount)*mItemSize; void* dest = reinterpret_cast(array) + where*mItemSize; _do_copy(dest, from, new_size - where); } release_storage(); mStorage = const_cast(array); } } } else { void* array = editArrayImpl(); void* to = reinterpret_cast(array) + where*mItemSize; _do_destroy(to, amount); if (where != new_size) { const void* from = reinterpret_cast(array) + (where+amount)*mItemSize; _do_move_backward(to, from, new_size - where); } } mCount = new_size; } size_t VectorImpl::itemSize() const { return mItemSize; } void VectorImpl::_do_construct(void* storage, size_t num) const { if (!(mFlags & HAS_TRIVIAL_CTOR)) { do_construct(storage, num); } } void VectorImpl::_do_destroy(void* storage, size_t num) const { if (!(mFlags & HAS_TRIVIAL_DTOR)) { do_destroy(storage, num); } } void VectorImpl::_do_copy(void* dest, const void* from, size_t num) const { if (!(mFlags & HAS_TRIVIAL_COPY)) { do_copy(dest, from, num); } else { memcpy(dest, from, num*itemSize()); } } void VectorImpl::_do_splat(void* dest, const void* item, size_t num) const { do_splat(dest, item, num); } void VectorImpl::_do_move_forward(void* dest, const void* from, size_t num) const { do_move_forward(dest, from, num); } void VectorImpl::_do_move_backward(void* dest, const void* from, size_t num) const { do_move_backward(dest, from, num); } void VectorImpl::reservedVectorImpl1() { } void VectorImpl::reservedVectorImpl2() { } void VectorImpl::reservedVectorImpl3() { } void VectorImpl::reservedVectorImpl4() { } void VectorImpl::reservedVectorImpl5() { } void VectorImpl::reservedVectorImpl6() { } void VectorImpl::reservedVectorImpl7() { } void VectorImpl::reservedVectorImpl8() { } /*****************************************************************************/ SortedVectorImpl::SortedVectorImpl(size_t itemSize, uint32_t flags) : VectorImpl(itemSize, flags) { } SortedVectorImpl::SortedVectorImpl(const VectorImpl& rhs) : VectorImpl(rhs) { } SortedVectorImpl::~SortedVectorImpl() { } SortedVectorImpl& SortedVectorImpl::operator = (const SortedVectorImpl& rhs) { return static_cast( VectorImpl::operator = (static_cast(rhs)) ); } ssize_t SortedVectorImpl::indexOf(const void* item) const { return _indexOrderOf(item); } size_t SortedVectorImpl::orderOf(const void* item) const { size_t o; _indexOrderOf(item, &o); return o; } ssize_t SortedVectorImpl::_indexOrderOf(const void* item, size_t* order) const { // binary search ssize_t err = NAME_NOT_FOUND; ssize_t l = 0; ssize_t h = size()-1; ssize_t mid; const void* a = arrayImpl(); const size_t s = itemSize(); while (l <= h) { mid = l + (h - l)/2; const void* const curr = reinterpret_cast(a) + (mid*s); const int c = do_compare(curr, item); if (c == 0) { err = l = mid; break; } else if (c < 0) { l = mid + 1; } else { h = mid - 1; } } if (order) *order = l; return err; } ssize_t SortedVectorImpl::add(const void* item) { size_t order; ssize_t index = _indexOrderOf(item, &order); if (index < 0) { index = VectorImpl::insertAt(item, order, 1); } else { index = VectorImpl::replaceAt(item, index); } return index; } ssize_t SortedVectorImpl::merge(const VectorImpl& vector) { // naive merge... if (!vector.isEmpty()) { const void* buffer = vector.arrayImpl(); const size_t is = itemSize(); size_t s = vector.size(); for (size_t i=0 ; i(buffer) + i*is ); if (err<0) { return err; } } } return NO_ERROR; } ssize_t SortedVectorImpl::merge(const SortedVectorImpl& vector) { // we've merging a sorted vector... nice! ssize_t err = NO_ERROR; if (!vector.isEmpty()) { // first take care of the case where the vectors are sorted together if (do_compare(vector.itemLocation(vector.size()-1), arrayImpl()) <= 0) { err = VectorImpl::insertVectorAt(static_cast(vector), 0); } else if (do_compare(vector.arrayImpl(), itemLocation(size()-1)) >= 0) { err = VectorImpl::appendVector(static_cast(vector)); } else { // this could be made a little better err = merge(static_cast(vector)); } } return err; } ssize_t SortedVectorImpl::remove(const void* item) { ssize_t i = indexOf(item); if (i>=0) { VectorImpl::removeItemsAt(i, 1); } return i; } void SortedVectorImpl::reservedSortedVectorImpl1() { }; void SortedVectorImpl::reservedSortedVectorImpl2() { }; void SortedVectorImpl::reservedSortedVectorImpl3() { }; void SortedVectorImpl::reservedSortedVectorImpl4() { }; void SortedVectorImpl::reservedSortedVectorImpl5() { }; void SortedVectorImpl::reservedSortedVectorImpl6() { }; void SortedVectorImpl::reservedSortedVectorImpl7() { }; void SortedVectorImpl::reservedSortedVectorImpl8() { }; /*****************************************************************************/ }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/TextOutput.cpp0000644000015700001700000000672412200324306024462 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include namespace android { // --------------------------------------------------------------------------- TextOutput::TextOutput() { } TextOutput::~TextOutput() { } // --------------------------------------------------------------------------- TextOutput& operator<<(TextOutput& to, bool val) { if (val) to.print("true", 4); else to.print("false", 5); return to; } TextOutput& operator<<(TextOutput& to, int val) { char buf[16]; sprintf(buf, "%d", val); to.print(buf, strlen(buf)); return to; } TextOutput& operator<<(TextOutput& to, long val) { char buf[16]; sprintf(buf, "%ld", val); to.print(buf, strlen(buf)); return to; } TextOutput& operator<<(TextOutput& to, unsigned int val) { char buf[16]; sprintf(buf, "%u", val); to.print(buf, strlen(buf)); return to; } TextOutput& operator<<(TextOutput& to, unsigned long val) { char buf[16]; sprintf(buf, "%lu", val); to.print(buf, strlen(buf)); return to; } TextOutput& operator<<(TextOutput& to, long long val) { char buf[32]; sprintf(buf, "%Ld", val); to.print(buf, strlen(buf)); return to; } TextOutput& operator<<(TextOutput& to, unsigned long long val) { char buf[32]; sprintf(buf, "%Lu", val); to.print(buf, strlen(buf)); return to; } static TextOutput& print_float(TextOutput& to, double value) { char buf[64]; sprintf(buf, "%g", value); if( !strchr(buf, '.') && !strchr(buf, 'e') && !strchr(buf, 'E') ) { strncat(buf, ".0", sizeof(buf)-1); } to.print(buf, strlen(buf)); return to; } TextOutput& operator<<(TextOutput& to, float val) { return print_float(to,val); } TextOutput& operator<<(TextOutput& to, double val) { return print_float(to,val); } TextOutput& operator<<(TextOutput& to, const void* val) { char buf[16]; sprintf(buf, "%p", val); to.print(buf, strlen(buf)); return to; } static void textOutputPrinter(void* cookie, const char* txt) { ((TextOutput*)cookie)->print(txt, strlen(txt)); } TextOutput& operator<<(TextOutput& to, const TypeCode& val) { printTypeCode(val.typeCode(), textOutputPrinter, (void*)&to); return to; } HexDump::HexDump(const void *buf, size_t size, size_t bytesPerLine) : mBuffer(buf) , mSize(size) , mBytesPerLine(bytesPerLine) , mSingleLineCutoff(16) , mAlignment(4) , mCArrayStyle(false) { if (bytesPerLine >= 16) mAlignment = 4; else if (bytesPerLine >= 8) mAlignment = 2; else mAlignment = 1; } TextOutput& operator<<(TextOutput& to, const HexDump& val) { printHexData(0, val.buffer(), val.size(), val.bytesPerLine(), val.singleLineCutoff(), val.alignment(), val.carrayStyle(), textOutputPrinter, (void*)&to); return to; } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/NOTICE0000644000015700001700000002470712200324306022516 0ustar pbuserpbgroup00000000000000 Copyright (c) 2005-2008, The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS android-audiosystem-1.8+13.10.20130807/lib/utils/FileMap.cpp0000644000015700001700000001334312200324306023625 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Shared file mapping class. // #define LOG_TAG "filemap" #include #include #include #include #ifdef HAVE_POSIX_FILEMAP #include #endif #include #include #include #include using namespace android; /*static*/ long FileMap::mPageSize = -1; /* * Constructor. Create an empty object. */ FileMap::FileMap(void) : mRefCount(1), mFileName(NULL), mBasePtr(NULL), mBaseLength(0), mDataPtr(NULL), mDataLength(0) { } /* * Destructor. */ FileMap::~FileMap(void) { assert(mRefCount == 0); //printf("+++ removing FileMap %p %u\n", mDataPtr, mDataLength); mRefCount = -100; // help catch double-free if (mFileName != NULL) { free(mFileName); } #ifdef HAVE_POSIX_FILEMAP if (mBasePtr && munmap(mBasePtr, mBaseLength) != 0) { ALOGD("munmap(%p, %d) failed\n", mBasePtr, (int) mBaseLength); } #endif #ifdef HAVE_WIN32_FILEMAP if (mBasePtr && UnmapViewOfFile(mBasePtr) == 0) { ALOGD("UnmapViewOfFile(%p) failed, error = %ld\n", mBasePtr, GetLastError() ); } if (mFileMapping != INVALID_HANDLE_VALUE) { CloseHandle(mFileMapping); } CloseHandle(mFileHandle); #endif } /* * Create a new mapping on an open file. * * Closing the file descriptor does not unmap the pages, so we don't * claim ownership of the fd. * * Returns "false" on failure. */ bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t length, bool readOnly) { #ifdef HAVE_WIN32_FILEMAP int adjust; off64_t adjOffset; size_t adjLength; if (mPageSize == -1) { SYSTEM_INFO si; GetSystemInfo( &si ); mPageSize = si.dwAllocationGranularity; } DWORD protect = readOnly ? PAGE_READONLY : PAGE_READWRITE; mFileHandle = (HANDLE) _get_osfhandle(fd); mFileMapping = CreateFileMapping( mFileHandle, NULL, protect, 0, 0, NULL); if (mFileMapping == NULL) { ALOGE("CreateFileMapping(%p, %lx) failed with error %ld\n", mFileHandle, protect, GetLastError() ); return false; } adjust = offset % mPageSize; adjOffset = offset - adjust; adjLength = length + adjust; mBasePtr = MapViewOfFile( mFileMapping, readOnly ? FILE_MAP_READ : FILE_MAP_ALL_ACCESS, 0, (DWORD)(adjOffset), adjLength ); if (mBasePtr == NULL) { ALOGE("MapViewOfFile(%ld, %ld) failed with error %ld\n", adjOffset, adjLength, GetLastError() ); CloseHandle(mFileMapping); mFileMapping = INVALID_HANDLE_VALUE; return false; } #endif #ifdef HAVE_POSIX_FILEMAP int prot, flags, adjust; off64_t adjOffset; size_t adjLength; void* ptr; assert(mRefCount == 1); assert(fd >= 0); assert(offset >= 0); assert(length > 0); /* init on first use */ if (mPageSize == -1) { #if NOT_USING_KLIBC mPageSize = sysconf(_SC_PAGESIZE); if (mPageSize == -1) { ALOGE("could not get _SC_PAGESIZE\n"); return false; } #else /* this holds for Linux, Darwin, Cygwin, and doesn't pain the ARM */ mPageSize = 4096; #endif } adjust = offset % mPageSize; try_again: adjOffset = offset - adjust; adjLength = length + adjust; flags = MAP_SHARED; prot = PROT_READ; if (!readOnly) prot |= PROT_WRITE; ptr = mmap(NULL, adjLength, prot, flags, fd, adjOffset); if (ptr == MAP_FAILED) { // Cygwin does not seem to like file mapping files from an offset. // So if we fail, try again with offset zero if (adjOffset > 0) { adjust = offset; goto try_again; } ALOGE("mmap(%ld,%ld) failed: %s\n", (long) adjOffset, (long) adjLength, strerror(errno)); return false; } mBasePtr = ptr; #endif /* HAVE_POSIX_FILEMAP */ mFileName = origFileName != NULL ? strdup(origFileName) : NULL; mBaseLength = adjLength; mDataOffset = offset; mDataPtr = (char*) mBasePtr + adjust; mDataLength = length; assert(mBasePtr != NULL); ALOGV("MAP: base %p/%d data %p/%d\n", mBasePtr, (int) mBaseLength, mDataPtr, (int) mDataLength); return true; } /* * Provide guidance to the system. */ int FileMap::advise(MapAdvice advice) { #if HAVE_MADVISE int cc, sysAdvice; switch (advice) { case NORMAL: sysAdvice = MADV_NORMAL; break; case RANDOM: sysAdvice = MADV_RANDOM; break; case SEQUENTIAL: sysAdvice = MADV_SEQUENTIAL; break; case WILLNEED: sysAdvice = MADV_WILLNEED; break; case DONTNEED: sysAdvice = MADV_DONTNEED; break; default: assert(false); return -1; } cc = madvise(mBasePtr, mBaseLength, sysAdvice); if (cc != 0) ALOGW("madvise(%d) failed: %s\n", sysAdvice, strerror(errno)); return cc; #else return -1; #endif // HAVE_MADVISE } android-audiosystem-1.8+13.10.20130807/lib/utils/misc.cpp0000644000015700001700000000752512200324306023250 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // // Miscellaneous utility functions. // #include #include #include #include #include #include using namespace android; namespace android { /* * Like strdup(), but uses C++ "new" operator instead of malloc. */ char* strdupNew(const char* str) { char* newStr; int len; if (str == NULL) return NULL; len = strlen(str); newStr = new char[len+1]; memcpy(newStr, str, len+1); return newStr; } /* * Concatenate an argument vector. */ char* concatArgv(int argc, const char* const argv[]) { char* newStr = NULL; int len, totalLen, posn, idx; /* * First, figure out the total length. */ totalLen = idx = 0; while (1) { if (idx == argc || argv[idx] == NULL) break; if (idx) totalLen++; // leave a space between args totalLen += strlen(argv[idx]); idx++; } /* * Alloc the string. */ newStr = new char[totalLen +1]; if (newStr == NULL) return NULL; /* * Finally, allocate the string and copy data over. */ idx = posn = 0; while (1) { if (idx == argc || argv[idx] == NULL) break; if (idx) newStr[posn++] = ' '; len = strlen(argv[idx]); memcpy(&newStr[posn], argv[idx], len); posn += len; idx++; } assert(posn == totalLen); newStr[posn] = '\0'; return newStr; } /* * Count the #of args in an argument vector. Don't count the final NULL. */ int countArgv(const char* const argv[]) { int count = 0; while (argv[count] != NULL) count++; return count; } #include /* * Get a file's type. */ FileType getFileType(const char* fileName) { struct stat sb; if (stat(fileName, &sb) < 0) { if (errno == ENOENT || errno == ENOTDIR) return kFileTypeNonexistent; else { fprintf(stderr, "getFileType got errno=%d on '%s'\n", errno, fileName); return kFileTypeUnknown; } } else { if (S_ISREG(sb.st_mode)) return kFileTypeRegular; else if (S_ISDIR(sb.st_mode)) return kFileTypeDirectory; else if (S_ISCHR(sb.st_mode)) return kFileTypeCharDev; else if (S_ISBLK(sb.st_mode)) return kFileTypeBlockDev; else if (S_ISFIFO(sb.st_mode)) return kFileTypeFifo; #ifdef HAVE_SYMLINKS else if (S_ISLNK(sb.st_mode)) return kFileTypeSymlink; else if (S_ISSOCK(sb.st_mode)) return kFileTypeSocket; #endif else return kFileTypeUnknown; } } /* * Get a file's modification date. */ time_t getFileModDate(const char* fileName) { struct stat sb; if (stat(fileName, &sb) < 0) return (time_t) -1; return sb.st_mtime; } /* * Round up to the next highest power of 2. * * Found on http://graphics.stanford.edu/~seander/bithacks.html. */ unsigned int roundUpPower2(unsigned int val) { val--; val |= val >> 1; val |= val >> 2; val |= val >> 4; val |= val >> 8; val |= val >> 16; val++; return val; } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/utils/ObbFile.cpp0000644000015700001700000002252712200324306023616 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include #include #define LOG_TAG "ObbFile" #include #include #include //#define DEBUG 1 #define kFooterTagSize 8 /* last two 32-bit integers */ #define kFooterMinSize 33 /* 32-bit signature version (4 bytes) * 32-bit package version (4 bytes) * 32-bit flags (4 bytes) * 64-bit salt (8 bytes) * 32-bit package name size (4 bytes) * >=1-character package name (1 byte) * 32-bit footer size (4 bytes) * 32-bit footer marker (4 bytes) */ #define kMaxBufSize 32768 /* Maximum file read buffer */ #define kSignature 0x01059983U /* ObbFile signature */ #define kSigVersion 1 /* We only know about signature version 1 */ /* offsets in version 1 of the header */ #define kPackageVersionOffset 4 #define kFlagsOffset 8 #define kSaltOffset 12 #define kPackageNameLenOffset 20 #define kPackageNameOffset 24 /* * TEMP_FAILURE_RETRY is defined by some, but not all, versions of * . (Alas, it is not as standard as we'd hoped!) So, if it's * not already defined, then define it here. */ #ifndef TEMP_FAILURE_RETRY /* Used to retry syscalls that can return EINTR. */ #define TEMP_FAILURE_RETRY(exp) ({ \ typeof (exp) _rc; \ do { \ _rc = (exp); \ } while (_rc == -1 && errno == EINTR); \ _rc; }) #endif namespace android { ObbFile::ObbFile() : mPackageName("") , mVersion(-1) , mFlags(0) { memset(mSalt, 0, sizeof(mSalt)); } ObbFile::~ObbFile() { } bool ObbFile::readFrom(const char* filename) { int fd; bool success = false; fd = ::open(filename, O_RDONLY); if (fd < 0) { ALOGW("couldn't open file %s: %s", filename, strerror(errno)); goto out; } success = readFrom(fd); close(fd); if (!success) { ALOGW("failed to read from %s (fd=%d)\n", filename, fd); } out: return success; } bool ObbFile::readFrom(int fd) { if (fd < 0) { ALOGW("attempt to read from invalid fd\n"); return false; } return parseObbFile(fd); } bool ObbFile::parseObbFile(int fd) { off64_t fileLength = lseek64(fd, 0, SEEK_END); if (fileLength < kFooterMinSize) { if (fileLength < 0) { ALOGW("error seeking in ObbFile: %s\n", strerror(errno)); } else { ALOGW("file is only %lld (less than %d minimum)\n", fileLength, kFooterMinSize); } return false; } ssize_t actual; size_t footerSize; { lseek64(fd, fileLength - kFooterTagSize, SEEK_SET); char *footer = new char[kFooterTagSize]; actual = TEMP_FAILURE_RETRY(read(fd, footer, kFooterTagSize)); if (actual != kFooterTagSize) { ALOGW("couldn't read footer signature: %s\n", strerror(errno)); return false; } unsigned int fileSig = get4LE((unsigned char*)footer + sizeof(int32_t)); if (fileSig != kSignature) { ALOGW("footer didn't match magic string (expected 0x%08x; got 0x%08x)\n", kSignature, fileSig); return false; } footerSize = get4LE((unsigned char*)footer); if (footerSize > (size_t)fileLength - kFooterTagSize || footerSize > kMaxBufSize) { ALOGW("claimed footer size is too large (0x%08zx; file size is 0x%08llx)\n", footerSize, fileLength); return false; } if (footerSize < (kFooterMinSize - kFooterTagSize)) { ALOGW("claimed footer size is too small (0x%zx; minimum size is 0x%x)\n", footerSize, kFooterMinSize - kFooterTagSize); return false; } } off64_t fileOffset = fileLength - footerSize - kFooterTagSize; if (lseek64(fd, fileOffset, SEEK_SET) != fileOffset) { ALOGW("seek %lld failed: %s\n", fileOffset, strerror(errno)); return false; } mFooterStart = fileOffset; char* scanBuf = (char*)malloc(footerSize); if (scanBuf == NULL) { ALOGW("couldn't allocate scanBuf: %s\n", strerror(errno)); return false; } actual = TEMP_FAILURE_RETRY(read(fd, scanBuf, footerSize)); // readAmount is guaranteed to be less than kMaxBufSize if (actual != (ssize_t)footerSize) { ALOGI("couldn't read ObbFile footer: %s\n", strerror(errno)); free(scanBuf); return false; } #ifdef DEBUG for (int i = 0; i < footerSize; ++i) { ALOGI("char: 0x%02x\n", scanBuf[i]); } #endif uint32_t sigVersion = get4LE((unsigned char*)scanBuf); if (sigVersion != kSigVersion) { ALOGW("Unsupported ObbFile version %d\n", sigVersion); free(scanBuf); return false; } mVersion = (int32_t) get4LE((unsigned char*)scanBuf + kPackageVersionOffset); mFlags = (int32_t) get4LE((unsigned char*)scanBuf + kFlagsOffset); memcpy(&mSalt, (unsigned char*)scanBuf + kSaltOffset, sizeof(mSalt)); size_t packageNameLen = get4LE((unsigned char*)scanBuf + kPackageNameLenOffset); if (packageNameLen == 0 || packageNameLen > (footerSize - kPackageNameOffset)) { ALOGW("bad ObbFile package name length (0x%04zx; 0x%04zx possible)\n", packageNameLen, footerSize - kPackageNameOffset); free(scanBuf); return false; } char* packageName = reinterpret_cast(scanBuf + kPackageNameOffset); mPackageName = String8(const_cast(packageName), packageNameLen); free(scanBuf); #ifdef DEBUG ALOGI("Obb scan succeeded: packageName=%s, version=%d\n", mPackageName.string(), mVersion); #endif return true; } bool ObbFile::writeTo(const char* filename) { int fd; bool success = false; fd = ::open(filename, O_WRONLY); if (fd < 0) { goto out; } success = writeTo(fd); close(fd); out: if (!success) { ALOGW("failed to write to %s: %s\n", filename, strerror(errno)); } return success; } bool ObbFile::writeTo(int fd) { if (fd < 0) { return false; } lseek64(fd, 0, SEEK_END); if (mPackageName.size() == 0 || mVersion == -1) { ALOGW("tried to write uninitialized ObbFile data\n"); return false; } unsigned char intBuf[sizeof(uint32_t)+1]; memset(&intBuf, 0, sizeof(intBuf)); put4LE(intBuf, kSigVersion); if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) { ALOGW("couldn't write signature version: %s\n", strerror(errno)); return false; } put4LE(intBuf, mVersion); if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) { ALOGW("couldn't write package version\n"); return false; } put4LE(intBuf, mFlags); if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) { ALOGW("couldn't write package version\n"); return false; } if (write(fd, mSalt, sizeof(mSalt)) != (ssize_t)sizeof(mSalt)) { ALOGW("couldn't write salt: %s\n", strerror(errno)); return false; } size_t packageNameLen = mPackageName.size(); put4LE(intBuf, packageNameLen); if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) { ALOGW("couldn't write package name length: %s\n", strerror(errno)); return false; } if (write(fd, mPackageName.string(), packageNameLen) != (ssize_t)packageNameLen) { ALOGW("couldn't write package name: %s\n", strerror(errno)); return false; } put4LE(intBuf, kPackageNameOffset + packageNameLen); if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) { ALOGW("couldn't write footer size: %s\n", strerror(errno)); return false; } put4LE(intBuf, kSignature); if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) { ALOGW("couldn't write footer magic signature: %s\n", strerror(errno)); return false; } return true; } bool ObbFile::removeFrom(const char* filename) { int fd; bool success = false; fd = ::open(filename, O_RDWR); if (fd < 0) { goto out; } success = removeFrom(fd); close(fd); out: if (!success) { ALOGW("failed to remove signature from %s: %s\n", filename, strerror(errno)); } return success; } bool ObbFile::removeFrom(int fd) { if (fd < 0) { return false; } if (!readFrom(fd)) { return false; } ftruncate(fd, mFooterStart); return true; } } android-audiosystem-1.8+13.10.20130807/lib/utils/ZipFileCRO.cpp0000644000015700001700000000341512200324306024215 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include using namespace android; ZipFileCRO ZipFileXRO_open(const char* path) { ZipFileRO* zip = new ZipFileRO(); if (zip->open(path) == NO_ERROR) { return (ZipFileCRO)zip; } return NULL; } void ZipFileCRO_destroy(ZipFileCRO zipToken) { ZipFileRO* zip = (ZipFileRO*)zipToken; delete zip; } ZipEntryCRO ZipFileCRO_findEntryByName(ZipFileCRO zipToken, const char* fileName) { ZipFileRO* zip = (ZipFileRO*)zipToken; return (ZipEntryCRO)zip->findEntryByName(fileName); } bool ZipFileCRO_getEntryInfo(ZipFileCRO zipToken, ZipEntryRO entryToken, int* pMethod, size_t* pUncompLen, size_t* pCompLen, off64_t* pOffset, long* pModWhen, long* pCrc32) { ZipFileRO* zip = (ZipFileRO*)zipToken; ZipEntryRO entry = (ZipEntryRO)entryToken; return zip->getEntryInfo(entry, pMethod, pUncompLen, pCompLen, pOffset, pModWhen, pCrc32); } bool ZipFileCRO_uncompressEntry(ZipFileCRO zipToken, ZipEntryRO entryToken, int fd) { ZipFileRO* zip = (ZipFileRO*)zipToken; ZipEntryRO entry = (ZipEntryRO)entryToken; return zip->uncompressEntry(entry, fd); } android-audiosystem-1.8+13.10.20130807/lib/liblog/0000755000015700001700000000000012200324404021707 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/lib/liblog/logprint.c0000644000015700001700000007306012200324306023720 0ustar pbuserpbgroup00000000000000/* //device/libs/cutils/logprint.c ** ** Copyright 2006, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #define _GNU_SOURCE /* for asprintf */ #define COLOR_BLUE 75 #define COLOR_DEFAULT 231 #define COLOR_GREEN 40 #define COLOR_ORANGE 166 #define COLOR_RED 196 #define COLOR_YELLOW 226 #include #include #include #include #include #include #include #include #include #include typedef struct FilterInfo_t { char *mTag; android_LogPriority mPri; struct FilterInfo_t *p_next; } FilterInfo; struct AndroidLogFormat_t { android_LogPriority global_pri; FilterInfo *filters; AndroidLogPrintFormat format; AndroidLogColoredOutput colored_output; }; static FilterInfo * filterinfo_new(const char * tag, android_LogPriority pri) { FilterInfo *p_ret; p_ret = (FilterInfo *)calloc(1, sizeof(FilterInfo)); p_ret->mTag = strdup(tag); p_ret->mPri = pri; return p_ret; } static void filterinfo_free(FilterInfo *p_info) { if (p_info == NULL) { return; } free(p_info->mTag); p_info->mTag = NULL; } /* * Note: also accepts 0-9 priorities * returns ANDROID_LOG_UNKNOWN if the character is unrecognized */ static android_LogPriority filterCharToPri (char c) { android_LogPriority pri; c = tolower(c); if (c >= '0' && c <= '9') { if (c >= ('0'+ANDROID_LOG_SILENT)) { pri = ANDROID_LOG_VERBOSE; } else { pri = (android_LogPriority)(c - '0'); } } else if (c == 'v') { pri = ANDROID_LOG_VERBOSE; } else if (c == 'd') { pri = ANDROID_LOG_DEBUG; } else if (c == 'i') { pri = ANDROID_LOG_INFO; } else if (c == 'w') { pri = ANDROID_LOG_WARN; } else if (c == 'e') { pri = ANDROID_LOG_ERROR; } else if (c == 'f') { pri = ANDROID_LOG_FATAL; } else if (c == 's') { pri = ANDROID_LOG_SILENT; } else if (c == '*') { pri = ANDROID_LOG_DEFAULT; } else { pri = ANDROID_LOG_UNKNOWN; } return pri; } static char filterPriToChar (android_LogPriority pri) { switch (pri) { case ANDROID_LOG_VERBOSE: return 'V'; case ANDROID_LOG_DEBUG: return 'D'; case ANDROID_LOG_INFO: return 'I'; case ANDROID_LOG_WARN: return 'W'; case ANDROID_LOG_ERROR: return 'E'; case ANDROID_LOG_FATAL: return 'F'; case ANDROID_LOG_SILENT: return 'S'; case ANDROID_LOG_DEFAULT: case ANDROID_LOG_UNKNOWN: default: return '?'; } } static int colorFromPri (android_LogPriority pri) { switch (pri) { case ANDROID_LOG_VERBOSE: return COLOR_DEFAULT; case ANDROID_LOG_DEBUG: return COLOR_BLUE; case ANDROID_LOG_INFO: return COLOR_GREEN; case ANDROID_LOG_WARN: return COLOR_ORANGE; case ANDROID_LOG_ERROR: return COLOR_RED; case ANDROID_LOG_FATAL: return COLOR_RED; case ANDROID_LOG_SILENT: return COLOR_DEFAULT; case ANDROID_LOG_DEFAULT: case ANDROID_LOG_UNKNOWN: default: return COLOR_DEFAULT; } } static android_LogPriority filterPriForTag( AndroidLogFormat *p_format, const char *tag) { FilterInfo *p_curFilter; for (p_curFilter = p_format->filters ; p_curFilter != NULL ; p_curFilter = p_curFilter->p_next ) { if (0 == strcmp(tag, p_curFilter->mTag)) { if (p_curFilter->mPri == ANDROID_LOG_DEFAULT) { return p_format->global_pri; } else { return p_curFilter->mPri; } } } return p_format->global_pri; } /** for debugging */ static void dumpFilters(AndroidLogFormat *p_format) { FilterInfo *p_fi; for (p_fi = p_format->filters ; p_fi != NULL ; p_fi = p_fi->p_next) { char cPri = filterPriToChar(p_fi->mPri); if (p_fi->mPri == ANDROID_LOG_DEFAULT) { cPri = filterPriToChar(p_format->global_pri); } fprintf(stderr,"%s:%c\n", p_fi->mTag, cPri); } fprintf(stderr,"*:%c\n", filterPriToChar(p_format->global_pri)); } /** * returns 1 if this log line should be printed based on its priority * and tag, and 0 if it should not */ int android_log_shouldPrintLine ( AndroidLogFormat *p_format, const char *tag, android_LogPriority pri) { return pri >= filterPriForTag(p_format, tag); } AndroidLogFormat *android_log_format_new() { AndroidLogFormat *p_ret; p_ret = calloc(1, sizeof(AndroidLogFormat)); p_ret->global_pri = ANDROID_LOG_VERBOSE; p_ret->format = FORMAT_BRIEF; p_ret->colored_output = OUTPUT_COLOR_OFF; return p_ret; } void android_log_format_free(AndroidLogFormat *p_format) { FilterInfo *p_info, *p_info_old; p_info = p_format->filters; while (p_info != NULL) { p_info_old = p_info; p_info = p_info->p_next; free(p_info_old); } free(p_format); } void android_log_setPrintFormat(AndroidLogFormat *p_format, AndroidLogPrintFormat format) { p_format->format=format; } void android_log_setColoredOutput(AndroidLogFormat *p_format) { p_format->colored_output = OUTPUT_COLOR_ON; } /** * Returns FORMAT_OFF on invalid string */ AndroidLogPrintFormat android_log_formatFromString(const char * formatString) { static AndroidLogPrintFormat format; if (strcmp(formatString, "brief") == 0) format = FORMAT_BRIEF; else if (strcmp(formatString, "process") == 0) format = FORMAT_PROCESS; else if (strcmp(formatString, "tag") == 0) format = FORMAT_TAG; else if (strcmp(formatString, "thread") == 0) format = FORMAT_THREAD; else if (strcmp(formatString, "raw") == 0) format = FORMAT_RAW; else if (strcmp(formatString, "time") == 0) format = FORMAT_TIME; else if (strcmp(formatString, "threadtime") == 0) format = FORMAT_THREADTIME; else if (strcmp(formatString, "long") == 0) format = FORMAT_LONG; else format = FORMAT_OFF; return format; } /** * filterExpression: a single filter expression * eg "AT:d" * * returns 0 on success and -1 on invalid expression * * Assumes single threaded execution */ int android_log_addFilterRule(AndroidLogFormat *p_format, const char *filterExpression) { size_t i=0; size_t tagNameLength; android_LogPriority pri = ANDROID_LOG_DEFAULT; tagNameLength = strcspn(filterExpression, ":"); if (tagNameLength == 0) { goto error; } if(filterExpression[tagNameLength] == ':') { pri = filterCharToPri(filterExpression[tagNameLength+1]); if (pri == ANDROID_LOG_UNKNOWN) { goto error; } } if(0 == strncmp("*", filterExpression, tagNameLength)) { // This filter expression refers to the global filter // The default level for this is DEBUG if the priority // is unspecified if (pri == ANDROID_LOG_DEFAULT) { pri = ANDROID_LOG_DEBUG; } p_format->global_pri = pri; } else { // for filter expressions that don't refer to the global // filter, the default is verbose if the priority is unspecified if (pri == ANDROID_LOG_DEFAULT) { pri = ANDROID_LOG_VERBOSE; } char *tagName; // Presently HAVE_STRNDUP is never defined, so the second case is always taken // Darwin doesn't have strnup, everything else does #ifdef HAVE_STRNDUP tagName = strndup(filterExpression, tagNameLength); #else //a few extra bytes copied... tagName = strdup(filterExpression); tagName[tagNameLength] = '\0'; #endif /*HAVE_STRNDUP*/ FilterInfo *p_fi = filterinfo_new(tagName, pri); free(tagName); p_fi->p_next = p_format->filters; p_format->filters = p_fi; } return 0; error: return -1; } /** * filterString: a comma/whitespace-separated set of filter expressions * * eg "AT:d *:i" * * returns 0 on success and -1 on invalid expression * * Assumes single threaded execution * */ int android_log_addFilterString(AndroidLogFormat *p_format, const char *filterString) { char *filterStringCopy = strdup (filterString); char *p_cur = filterStringCopy; char *p_ret; int err; // Yes, I'm using strsep while (NULL != (p_ret = strsep(&p_cur, " \t,"))) { // ignore whitespace-only entries if(p_ret[0] != '\0') { err = android_log_addFilterRule(p_format, p_ret); if (err < 0) { goto error; } } } free (filterStringCopy); return 0; error: free (filterStringCopy); return -1; } static inline char * strip_end(char *str) { char *end = str + strlen(str) - 1; while (end >= str && isspace(*end)) *end-- = '\0'; return str; } /** * Splits a wire-format buffer into an AndroidLogEntry * entry allocated by caller. Pointers will point directly into buf * * Returns 0 on success and -1 on invalid wire format (entry will be * in unspecified state) */ int android_log_processLogBuffer(struct logger_entry *buf, AndroidLogEntry *entry) { entry->tv_sec = buf->sec; entry->tv_nsec = buf->nsec; entry->pid = buf->pid; entry->tid = buf->tid; /* * format: \0\0 * * tag str * starts at buf->msg+1 * msg * starts at buf->msg+1+len(tag)+1 * * The message may have been truncated by the kernel log driver. * When that happens, we must null-terminate the message ourselves. */ if (buf->len < 3) { // An well-formed entry must consist of at least a priority // and two null characters fprintf(stderr, "+++ LOG: entry too small\n"); return -1; } int msgStart = -1; int msgEnd = -1; int i; for (i = 1; i < buf->len; i++) { if (buf->msg[i] == '\0') { if (msgStart == -1) { msgStart = i + 1; } else { msgEnd = i; break; } } } if (msgStart == -1) { fprintf(stderr, "+++ LOG: malformed log message\n"); return -1; } if (msgEnd == -1) { // incoming message not null-terminated; force it msgEnd = buf->len - 1; buf->msg[msgEnd] = '\0'; } entry->priority = buf->msg[0]; entry->tag = buf->msg + 1; entry->message = buf->msg + msgStart; entry->messageLen = msgEnd - msgStart; return 0; } /* * Extract a 4-byte value from a byte stream. */ static inline uint32_t get4LE(const uint8_t* src) { return src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24); } /* * Extract an 8-byte value from a byte stream. */ static inline uint64_t get8LE(const uint8_t* src) { uint32_t low, high; low = src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24); high = src[4] | (src[5] << 8) | (src[6] << 16) | (src[7] << 24); return ((long long) high << 32) | (long long) low; } /* * Recursively convert binary log data to printable form. * * This needs to be recursive because you can have lists of lists. * * If we run out of room, we stop processing immediately. It's important * for us to check for space on every output element to avoid producing * garbled output. * * Returns 0 on success, 1 on buffer full, -1 on failure. */ static int android_log_printBinaryEvent(const unsigned char** pEventData, size_t* pEventDataLen, char** pOutBuf, size_t* pOutBufLen) { const unsigned char* eventData = *pEventData; size_t eventDataLen = *pEventDataLen; char* outBuf = *pOutBuf; size_t outBufLen = *pOutBufLen; unsigned char type; size_t outCount; int result = 0; if (eventDataLen < 1) return -1; type = *eventData++; eventDataLen--; //fprintf(stderr, "--- type=%d (rem len=%d)\n", type, eventDataLen); switch (type) { case EVENT_TYPE_INT: /* 32-bit signed int */ { int ival; if (eventDataLen < 4) return -1; ival = get4LE(eventData); eventData += 4; eventDataLen -= 4; outCount = snprintf(outBuf, outBufLen, "%d", ival); if (outCount < outBufLen) { outBuf += outCount; outBufLen -= outCount; } else { /* halt output */ goto no_room; } } break; case EVENT_TYPE_LONG: /* 64-bit signed long */ { long long lval; if (eventDataLen < 8) return -1; lval = get8LE(eventData); eventData += 8; eventDataLen -= 8; outCount = snprintf(outBuf, outBufLen, "%lld", lval); if (outCount < outBufLen) { outBuf += outCount; outBufLen -= outCount; } else { /* halt output */ goto no_room; } } break; case EVENT_TYPE_STRING: /* UTF-8 chars, not NULL-terminated */ { unsigned int strLen; if (eventDataLen < 4) return -1; strLen = get4LE(eventData); eventData += 4; eventDataLen -= 4; if (eventDataLen < strLen) return -1; if (strLen < outBufLen) { memcpy(outBuf, eventData, strLen); outBuf += strLen; outBufLen -= strLen; } else if (outBufLen > 0) { /* copy what we can */ memcpy(outBuf, eventData, outBufLen); outBuf += outBufLen; outBufLen -= outBufLen; goto no_room; } eventData += strLen; eventDataLen -= strLen; break; } case EVENT_TYPE_LIST: /* N items, all different types */ { unsigned char count; int i; if (eventDataLen < 1) return -1; count = *eventData++; eventDataLen--; if (outBufLen > 0) { *outBuf++ = '['; outBufLen--; } else { goto no_room; } for (i = 0; i < count; i++) { result = android_log_printBinaryEvent(&eventData, &eventDataLen, &outBuf, &outBufLen); if (result != 0) goto bail; if (i < count-1) { if (outBufLen > 0) { *outBuf++ = ','; outBufLen--; } else { goto no_room; } } } if (outBufLen > 0) { *outBuf++ = ']'; outBufLen--; } else { goto no_room; } } break; default: fprintf(stderr, "Unknown binary event type %d\n", type); return -1; } bail: *pEventData = eventData; *pEventDataLen = eventDataLen; *pOutBuf = outBuf; *pOutBufLen = outBufLen; return result; no_room: result = 1; goto bail; } /** * Convert a binary log entry to ASCII form. * * For convenience we mimic the processLogBuffer API. There is no * pre-defined output length for the binary data, since we're free to format * it however we choose, which means we can't really use a fixed-size buffer * here. */ int android_log_processBinaryLogBuffer(struct logger_entry *buf, AndroidLogEntry *entry, const EventTagMap* map, char* messageBuf, int messageBufLen) { size_t inCount; unsigned int tagIndex; const unsigned char* eventData; entry->tv_sec = buf->sec; entry->tv_nsec = buf->nsec; entry->priority = ANDROID_LOG_INFO; entry->pid = buf->pid; entry->tid = buf->tid; /* * Pull the tag out. */ eventData = (const unsigned char*) buf->msg; inCount = buf->len; if (inCount < 4) return -1; tagIndex = get4LE(eventData); eventData += 4; inCount -= 4; if (map != NULL) { entry->tag = android_lookupEventTag(map, tagIndex); } else { entry->tag = NULL; } /* * If we don't have a map, or didn't find the tag number in the map, * stuff a generated tag value into the start of the output buffer and * shift the buffer pointers down. */ if (entry->tag == NULL) { int tagLen; tagLen = snprintf(messageBuf, messageBufLen, "[%d]", tagIndex); entry->tag = messageBuf; messageBuf += tagLen+1; messageBufLen -= tagLen+1; } /* * Format the event log data into the buffer. */ char* outBuf = messageBuf; size_t outRemaining = messageBufLen-1; /* leave one for nul byte */ int result; result = android_log_printBinaryEvent(&eventData, &inCount, &outBuf, &outRemaining); if (result < 0) { fprintf(stderr, "Binary log entry conversion failed\n"); return -1; } else if (result == 1) { if (outBuf > messageBuf) { /* leave an indicator */ *(outBuf-1) = '!'; } else { /* no room to output anything at all */ *outBuf++ = '!'; outRemaining--; } /* pretend we ate all the data */ inCount = 0; } /* eat the silly terminating '\n' */ if (inCount == 1 && *eventData == '\n') { eventData++; inCount--; } if (inCount != 0) { fprintf(stderr, "Warning: leftover binary log data (%zu bytes)\n", inCount); } /* * Terminate the buffer. The NUL byte does not count as part of * entry->messageLen. */ *outBuf = '\0'; entry->messageLen = outBuf - messageBuf; assert(entry->messageLen == (messageBufLen-1) - outRemaining); entry->message = messageBuf; return 0; } /** * Formats a log message into a buffer * * Uses defaultBuffer if it can, otherwise malloc()'s a new buffer * If return value != defaultBuffer, caller must call free() * Returns NULL on malloc error */ char *android_log_formatLogLine ( AndroidLogFormat *p_format, char *defaultBuffer, size_t defaultBufferSize, const AndroidLogEntry *entry, size_t *p_outLength) { #if defined(HAVE_LOCALTIME_R) struct tm tmBuf; #endif struct tm* ptm; char timeBuf[32]; char headerBuf[128]; char prefixBuf[128], suffixBuf[128]; char priChar; int prefixSuffixIsHeaderFooter = 0; char * ret = NULL; priChar = filterPriToChar(entry->priority); /* * Get the current date/time in pretty form * * It's often useful when examining a log with "less" to jump to * a specific point in the file by searching for the date/time stamp. * For this reason it's very annoying to have regexp meta characters * in the time stamp. Don't use forward slashes, parenthesis, * brackets, asterisks, or other special chars here. */ #if defined(HAVE_LOCALTIME_R) ptm = localtime_r(&(entry->tv_sec), &tmBuf); #else ptm = localtime(&(entry->tv_sec)); #endif //strftime(timeBuf, sizeof(timeBuf), "%Y-%m-%d %H:%M:%S", ptm); strftime(timeBuf, sizeof(timeBuf), "%m-%d %H:%M:%S", ptm); /* * Construct a buffer containing the log header and log message. */ size_t prefixLen, suffixLen; size_t prefixColorLen = 0; char * prefixBufTmp = prefixBuf; size_t prefixBufTmpRemainLen = sizeof(prefixBuf); if (p_format->colored_output == OUTPUT_COLOR_ON) { prefixColorLen = snprintf(prefixBufTmp, prefixBufTmpRemainLen, "%c[%d;%d;%dm", 0x1B, 38, 5, colorFromPri(entry->priority)); if(prefixColorLen >= prefixBufTmpRemainLen) prefixColorLen = prefixBufTmpRemainLen - 1; prefixBufTmp += prefixColorLen; prefixBufTmpRemainLen -= prefixColorLen; } switch (p_format->format) { case FORMAT_TAG: prefixLen = snprintf(prefixBufTmp, prefixBufTmpRemainLen, "%c/%-8s: ", priChar, entry->tag); strcpy(suffixBuf, "\n"); suffixLen = 1; break; case FORMAT_PROCESS: prefixLen = snprintf(prefixBufTmp, prefixBufTmpRemainLen, "%c(%5d) ", priChar, entry->pid); suffixLen = snprintf(suffixBuf, sizeof(suffixBuf), " (%s)\n", entry->tag); break; case FORMAT_THREAD: prefixLen = snprintf(prefixBufTmp, prefixBufTmpRemainLen, "%c(%5d:%5d) ", priChar, entry->pid, entry->tid); strcpy(suffixBuf, "\n"); suffixLen = 1; break; case FORMAT_RAW: prefixBuf[0] = 0; prefixLen = 0; strcpy(suffixBuf, "\n"); suffixLen = 1; break; case FORMAT_TIME: prefixLen = snprintf(prefixBufTmp, prefixBufTmpRemainLen, "%s.%03ld %c/%-8s(%5d): ", timeBuf, entry->tv_nsec / 1000000, priChar, entry->tag, entry->pid); strcpy(suffixBuf, "\n"); suffixLen = 1; break; case FORMAT_THREADTIME: prefixLen = snprintf(prefixBufTmp, prefixBufTmpRemainLen, "%s.%03ld %5d %5d %c %-8s: ", timeBuf, entry->tv_nsec / 1000000, entry->pid, entry->tid, priChar, entry->tag); strcpy(suffixBuf, "\n"); suffixLen = 1; break; case FORMAT_LONG: prefixLen = snprintf(prefixBufTmp, prefixBufTmpRemainLen, "[ %s.%03ld %5d:%5d %c/%-8s ]\n", timeBuf, entry->tv_nsec / 1000000, entry->pid, entry->tid, priChar, entry->tag); strcpy(suffixBuf, "\n\n"); suffixLen = 2; prefixSuffixIsHeaderFooter = 1; break; case FORMAT_BRIEF: default: prefixLen = snprintf(prefixBufTmp, prefixBufTmpRemainLen, "%c/%-8s(%5d): ", priChar, entry->tag, entry->pid); strcpy(suffixBuf, "\n"); suffixLen = 1; break; } /* snprintf has a weird return value. It returns what would have been * written given a large enough buffer. In the case that the prefix is * longer then our buffer(128), it messes up the calculations below * possibly causing heap corruption. To avoid this we double check and * set the length at the maximum (size minus null byte) */ if(prefixLen >= prefixBufTmpRemainLen) prefixLen = prefixBufTmpRemainLen - 1; if(suffixLen >= sizeof(suffixBuf)) suffixLen = sizeof(suffixBuf) - 1; size_t suffixColorLen = 0; char * suffixBufTmp = suffixBuf + suffixLen; size_t suffixBufTmpRemainLen = sizeof(suffixBuf) - suffixLen; if (p_format->colored_output == OUTPUT_COLOR_ON) { suffixColorLen = snprintf(suffixBufTmp, suffixBufTmpRemainLen, "%c[%dm", 0x1B, 0); if(suffixColorLen >= suffixBufTmpRemainLen) suffixColorLen = suffixBufTmpRemainLen - 1; } /* the following code is tragically unreadable */ size_t numLines; size_t i; char *p; size_t bufferSize; const char *pm; if (prefixSuffixIsHeaderFooter) { // we're just wrapping message with a header/footer numLines = 1; } else { pm = entry->message; numLines = 0; // The line-end finding here must match the line-end finding // in for ( ... numLines...) loop below while (pm < (entry->message + entry->messageLen)) { if (*pm++ == '\n') numLines++; } // plus one line for anything not newline-terminated at the end if (pm > entry->message && *(pm-1) != '\n') numLines++; } // this is an upper bound--newlines in message may be counted // extraneously bufferSize = (numLines * (prefixColorLen + prefixLen + suffixLen + suffixColorLen)) + entry->messageLen + 1; if (defaultBufferSize >= bufferSize) { ret = defaultBuffer; } else { ret = (char *)malloc(bufferSize); if (ret == NULL) { return ret; } } ret[0] = '\0'; /* to start strcat off */ p = ret; pm = entry->message; if (prefixSuffixIsHeaderFooter) { strcat(p, prefixBuf); p += prefixColorLen + prefixLen; strncat(p, entry->message, entry->messageLen); p += entry->messageLen; strcat(p, suffixBuf); p += suffixLen + suffixColorLen; } else { while(pm < (entry->message + entry->messageLen)) { const char *lineStart; size_t lineLen; lineStart = pm; // Find the next end-of-line in message while (pm < (entry->message + entry->messageLen) && *pm != '\n') pm++; lineLen = pm - lineStart; strcat(p, prefixBuf); p += prefixColorLen + prefixLen; strncat(p, lineStart, lineLen); p += lineLen; strcat(p, suffixBuf); p += suffixLen + suffixColorLen; if (*pm == '\n') pm++; } } if (p_outLength != NULL) { *p_outLength = p - ret; } return ret; } /** * Either print or do not print log line, based on filter * * Returns count bytes written */ int android_log_printLogLine( AndroidLogFormat *p_format, int fd, const AndroidLogEntry *entry) { int ret; char defaultBuffer[512]; char *outBuffer = NULL; size_t totalLen; outBuffer = android_log_formatLogLine(p_format, defaultBuffer, sizeof(defaultBuffer), entry, &totalLen); if (!outBuffer) return -1; do { ret = write(fd, outBuffer, totalLen); } while (ret < 0 && errno == EINTR); if (ret < 0) { fprintf(stderr, "+++ LOG: write failed (errno=%d)\n", errno); ret = 0; goto done; } if (((size_t)ret) < totalLen) { fprintf(stderr, "+++ LOG: write partial (%d of %d)\n", ret, (int)totalLen); goto done; } done: if (outBuffer != defaultBuffer) { free(outBuffer); } return ret; } void logprint_run_tests() { #if 0 fprintf(stderr, "tests disabled\n"); #else int err; const char *tag; AndroidLogFormat *p_format; p_format = android_log_format_new(); fprintf(stderr, "running tests\n"); tag = "random"; android_log_addFilterRule(p_format,"*:i"); assert (ANDROID_LOG_INFO == filterPriForTag(p_format, "random")); assert(android_log_shouldPrintLine(p_format, tag, ANDROID_LOG_DEBUG) == 0); android_log_addFilterRule(p_format, "*"); assert (ANDROID_LOG_DEBUG == filterPriForTag(p_format, "random")); assert(android_log_shouldPrintLine(p_format, tag, ANDROID_LOG_DEBUG) > 0); android_log_addFilterRule(p_format, "*:v"); assert (ANDROID_LOG_VERBOSE == filterPriForTag(p_format, "random")); assert(android_log_shouldPrintLine(p_format, tag, ANDROID_LOG_DEBUG) > 0); android_log_addFilterRule(p_format, "*:i"); assert (ANDROID_LOG_INFO == filterPriForTag(p_format, "random")); assert(android_log_shouldPrintLine(p_format, tag, ANDROID_LOG_DEBUG) == 0); android_log_addFilterRule(p_format, "random"); assert (ANDROID_LOG_VERBOSE == filterPriForTag(p_format, "random")); assert(android_log_shouldPrintLine(p_format, tag, ANDROID_LOG_DEBUG) > 0); android_log_addFilterRule(p_format, "random:v"); assert (ANDROID_LOG_VERBOSE == filterPriForTag(p_format, "random")); assert(android_log_shouldPrintLine(p_format, tag, ANDROID_LOG_DEBUG) > 0); android_log_addFilterRule(p_format, "random:d"); assert (ANDROID_LOG_DEBUG == filterPriForTag(p_format, "random")); assert(android_log_shouldPrintLine(p_format, tag, ANDROID_LOG_DEBUG) > 0); android_log_addFilterRule(p_format, "random:w"); assert (ANDROID_LOG_WARN == filterPriForTag(p_format, "random")); assert(android_log_shouldPrintLine(p_format, tag, ANDROID_LOG_DEBUG) == 0); android_log_addFilterRule(p_format, "crap:*"); assert (ANDROID_LOG_VERBOSE== filterPriForTag(p_format, "crap")); assert(android_log_shouldPrintLine(p_format, "crap", ANDROID_LOG_VERBOSE) > 0); // invalid expression err = android_log_addFilterRule(p_format, "random:z"); assert (err < 0); assert (ANDROID_LOG_WARN == filterPriForTag(p_format, "random")); assert(android_log_shouldPrintLine(p_format, tag, ANDROID_LOG_DEBUG) == 0); // Issue #550946 err = android_log_addFilterString(p_format, " "); assert(err == 0); assert(ANDROID_LOG_WARN == filterPriForTag(p_format, "random")); // note trailing space err = android_log_addFilterString(p_format, "*:s random:d "); assert(err == 0); assert(ANDROID_LOG_DEBUG == filterPriForTag(p_format, "random")); err = android_log_addFilterString(p_format, "*:s random:z"); assert(err < 0); #if 0 char *ret; char defaultBuffer[512]; ret = android_log_formatLogLine(p_format, defaultBuffer, sizeof(defaultBuffer), 0, ANDROID_LOG_ERROR, 123, 123, 123, "random", "nofile", strlen("Hello"), "Hello", NULL); #endif fprintf(stderr, "tests complete\n"); #endif } android-audiosystem-1.8+13.10.20130807/lib/liblog/event_tag_map.c0000644000015700001700000002517612200324306024700 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "cutils/event_tag_map.h" #include "cutils/log.h" #include #include #include #include #include #include #define OUT_TAG "EventTagMap" /* * Single entry. */ typedef struct EventTag { unsigned int tagIndex; const char* tagStr; } EventTag; /* * Map. */ struct EventTagMap { /* memory-mapped source file; we get strings from here */ void* mapAddr; size_t mapLen; /* array of event tags, sorted numerically by tag index */ EventTag* tagArray; int numTags; }; /* fwd */ static int processFile(EventTagMap* map); static int countMapLines(const EventTagMap* map); static int parseMapLines(EventTagMap* map); static int scanTagLine(char** pData, EventTag* tag, int lineNum); static int sortTags(EventTagMap* map); static void dumpTags(const EventTagMap* map); /* * Open the map file and allocate a structure to manage it. * * We create a private mapping because we want to terminate the log tag * strings with '\0'. */ EventTagMap* android_openEventTagMap(const char* fileName) { EventTagMap* newTagMap; off_t end; int fd = -1; newTagMap = calloc(1, sizeof(EventTagMap)); if (newTagMap == NULL) return NULL; fd = open(fileName, O_RDONLY); if (fd < 0) { fprintf(stderr, "%s: unable to open map '%s': %s\n", OUT_TAG, fileName, strerror(errno)); goto fail; } end = lseek(fd, 0L, SEEK_END); (void) lseek(fd, 0L, SEEK_SET); if (end < 0) { fprintf(stderr, "%s: unable to seek map '%s'\n", OUT_TAG, fileName); goto fail; } newTagMap->mapAddr = mmap(NULL, end, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); if (newTagMap->mapAddr == MAP_FAILED) { fprintf(stderr, "%s: mmap(%s) failed: %s\n", OUT_TAG, fileName, strerror(errno)); goto fail; } newTagMap->mapLen = end; if (processFile(newTagMap) != 0) goto fail; return newTagMap; fail: android_closeEventTagMap(newTagMap); if (fd >= 0) close(fd); return NULL; } /* * Close the map. */ void android_closeEventTagMap(EventTagMap* map) { if (map == NULL) return; munmap(map->mapAddr, map->mapLen); free(map); } /* * Look up an entry in the map. * * The entries are sorted by tag number, so we can do a binary search. */ const char* android_lookupEventTag(const EventTagMap* map, int tag) { int hi, lo, mid; lo = 0; hi = map->numTags-1; while (lo <= hi) { int cmp; mid = (lo+hi)/2; cmp = map->tagArray[mid].tagIndex - tag; if (cmp < 0) { /* tag is bigger */ lo = mid + 1; } else if (cmp > 0) { /* tag is smaller */ hi = mid - 1; } else { /* found */ return map->tagArray[mid].tagStr; } } return NULL; } /* * Determine whether "c" is a whitespace char. */ static inline int isCharWhitespace(char c) { return (c == ' ' || c == '\n' || c == '\r' || c == '\t'); } /* * Determine whether "c" is a valid tag char. */ static inline int isCharValidTag(char c) { return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || (c == '_')); } /* * Determine whether "c" is a valid decimal digit. */ static inline int isCharDigit(char c) { return (c >= '0' && c <= '9'); } /* * Crunch through the file, parsing the contents and creating a tag index. */ static int processFile(EventTagMap* map) { EventTag* tagArray = NULL; /* get a tag count */ map->numTags = countMapLines(map); if (map->numTags < 0) return -1; //printf("+++ found %d tags\n", map->numTags); /* allocate storage for the tag index array */ map->tagArray = calloc(1, sizeof(EventTag) * map->numTags); if (map->tagArray == NULL) return -1; /* parse the file, null-terminating tag strings */ if (parseMapLines(map) != 0) { fprintf(stderr, "%s: file parse failed\n", OUT_TAG); return -1; } /* sort the tags and check for duplicates */ if (sortTags(map) != 0) return -1; return 0; } /* * Run through all lines in the file, determining whether they're blank, * comments, or possibly have a tag entry. * * This is a very "loose" scan. We don't try to detect syntax errors here. * The later pass is more careful, but the number of tags found there must * match the number of tags found here. * * Returns the number of potential tag entries found. */ static int countMapLines(const EventTagMap* map) { int numTags, unknown; const char* cp; const char* endp; cp = (const char*) map->mapAddr; endp = cp + map->mapLen; numTags = 0; unknown = 1; while (cp < endp) { if (*cp == '\n') { unknown = 1; } else if (unknown) { if (isCharDigit(*cp)) { /* looks like a tag to me */ numTags++; unknown = 0; } else if (isCharWhitespace(*cp)) { /* might be leading whitespace before tag num, keep going */ } else { /* assume comment; second pass can complain in detail */ unknown = 0; } } else { /* we've made up our mind; just scan to end of line */ } cp++; } return numTags; } /* * Parse the tags out of the file. */ static int parseMapLines(EventTagMap* map) { int tagNum, lineStart, lineNum; char* cp; char* endp; cp = (char*) map->mapAddr; endp = cp + map->mapLen; /* insist on EOL at EOF; simplifies parsing and null-termination */ if (*(endp-1) != '\n') { fprintf(stderr, "%s: map file missing EOL on last line\n", OUT_TAG); return -1; } tagNum = 0; lineStart = 1; lineNum = 1; while (cp < endp) { //printf("{%02x}", *cp); fflush(stdout); if (*cp == '\n') { lineStart = 1; lineNum++; } else if (lineStart) { if (*cp == '#') { /* comment; just scan to end */ lineStart = 0; } else if (isCharDigit(*cp)) { /* looks like a tag; scan it out */ if (tagNum >= map->numTags) { fprintf(stderr, "%s: more tags than expected (%d)\n", OUT_TAG, tagNum); return -1; } if (scanTagLine(&cp, &map->tagArray[tagNum], lineNum) != 0) return -1; tagNum++; lineNum++; // we eat the '\n' /* leave lineStart==1 */ } else if (isCharWhitespace(*cp)) { /* looks like leading whitespace; keep scanning */ } else { fprintf(stderr, "%s: unexpected chars (0x%02x) in tag number on line %d\n", OUT_TAG, *cp, lineNum); return -1; } } else { /* this is a blank or comment line */ } cp++; } if (tagNum != map->numTags) { fprintf(stderr, "%s: parsed %d tags, expected %d\n", OUT_TAG, tagNum, map->numTags); return -1; } return 0; } /* * Scan one tag line. * * "*pData" should be pointing to the first digit in the tag number. On * successful return, it will be pointing to the last character in the * tag line (i.e. the character before the start of the next line). * * Returns 0 on success, nonzero on failure. */ static int scanTagLine(char** pData, EventTag* tag, int lineNum) { char* cp = *pData; char* startp; char* endp; unsigned long val; startp = cp; while (isCharDigit(*++cp)) ; *cp = '\0'; val = strtoul(startp, &endp, 10); assert(endp == cp); if (endp != cp) fprintf(stderr, "ARRRRGH\n"); tag->tagIndex = val; while (*++cp != '\n' && isCharWhitespace(*cp)) ; if (*cp == '\n') { fprintf(stderr, "%s: missing tag string on line %d\n", OUT_TAG, lineNum); return -1; } tag->tagStr = cp; while (isCharValidTag(*++cp)) ; if (*cp == '\n') { /* null terminate and return */ *cp = '\0'; } else if (isCharWhitespace(*cp)) { /* CRLF or trailin spaces; zap this char, then scan for the '\n' */ *cp = '\0'; /* just ignore the rest of the line till \n TODO: read the tag description that follows the tag name */ while (*++cp != '\n') { } } else { fprintf(stderr, "%s: invalid tag chars on line %d\n", OUT_TAG, lineNum); return -1; } *pData = cp; //printf("+++ Line %d: got %d '%s'\n", lineNum, tag->tagIndex, tag->tagStr); return 0; } /* * Compare two EventTags. */ static int compareEventTags(const void* v1, const void* v2) { const EventTag* tag1 = (const EventTag*) v1; const EventTag* tag2 = (const EventTag*) v2; return tag1->tagIndex - tag2->tagIndex; } /* * Sort the EventTag array so we can do fast lookups by tag index. After * the sort we do a quick check for duplicate tag indices. * * Returns 0 on success. */ static int sortTags(EventTagMap* map) { int i; qsort(map->tagArray, map->numTags, sizeof(EventTag), compareEventTags); for (i = 1; i < map->numTags; i++) { if (map->tagArray[i].tagIndex == map->tagArray[i-1].tagIndex) { fprintf(stderr, "%s: duplicate tag entries (%d:%s and %d:%s)\n", OUT_TAG, map->tagArray[i].tagIndex, map->tagArray[i].tagStr, map->tagArray[i-1].tagIndex, map->tagArray[i-1].tagStr); return -1; } } return 0; } /* * Dump the tag array for debugging. */ static void dumpTags(const EventTagMap* map) { int i; for (i = 0; i < map->numTags; i++) { const EventTag* tag = &map->tagArray[i]; printf(" %3d: %6d '%s'\n", i, tag->tagIndex, tag->tagStr); } } android-audiosystem-1.8+13.10.20130807/lib/liblog/Android.mk0000644000015700001700000000456212200324306023630 0ustar pbuserpbgroup00000000000000# # Copyright (C) 2008 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # LOCAL_PATH := $(my-dir) include $(CLEAR_VARS) liblog_sources := logd_write.c # some files must not be compiled when building against Mingw # they correspond to features not used by our host development tools # which are also hard or even impossible to port to native Win32 WITH_MINGW := ifeq ($(HOST_OS),windows) ifeq ($(strip $(USE_CYGWIN)),) WITH_MINGW := true endif endif # USE_MINGW is defined when we build against Mingw on Linux ifneq ($(strip $(USE_MINGW)),) WITH_MINGW := true endif ifndef WITH_MINGW liblog_sources += \ logprint.c \ event_tag_map.c endif liblog_host_sources := $(liblog_sources) fake_log_device.c # Shared and static library for host # ======================================================== LOCAL_MODULE := liblog LOCAL_SRC_FILES := $(liblog_host_sources) LOCAL_LDLIBS := -lpthread LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1 include $(BUILD_HOST_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := liblog LOCAL_WHOLE_STATIC_LIBRARIES := liblog include $(BUILD_HOST_SHARED_LIBRARY) # Static library for host, 64-bit # ======================================================== include $(CLEAR_VARS) LOCAL_MODULE := lib64log LOCAL_SRC_FILES := $(liblog_host_sources) LOCAL_LDLIBS := -lpthread LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1 -m64 include $(BUILD_HOST_STATIC_LIBRARY) ifeq ($(TARGET_USES_MOTOROLA_LOG),true) LIBLOG_CFLAGS := -DMOTOROLA_LOG endif # Shared and static library for target # ======================================================== include $(CLEAR_VARS) LOCAL_CFLAGS += $(LIBLOG_CFLAGS) LOCAL_MODULE := liblog LOCAL_SRC_FILES := $(liblog_sources) include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_CFLAGS += $(LIBLOG_CFLAGS) LOCAL_MODULE := liblog LOCAL_WHOLE_STATIC_LIBRARIES := liblog include $(BUILD_SHARED_LIBRARY) android-audiosystem-1.8+13.10.20130807/lib/liblog/fake_log_device.c0000644000015700001700000004555112200324306025154 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Intercepts log messages intended for the Android log device. * When running in the context of the simulator, the messages are * passed on to the underlying (fake) log device. When not in the * simulator, messages are printed to stderr. */ #include "cutils/logd.h" #include #include #include #include #include #ifdef HAVE_PTHREADS #include #endif #define kMaxTagLen 16 /* from the long-dead utils/Log.cpp */ #define kTagSetSize 16 /* arbitrary */ #if 0 #define TRACE(...) printf("fake_log_device: " __VA_ARGS__) #else #define TRACE(...) ((void)0) #endif /* from the long-dead utils/Log.cpp */ typedef enum { FORMAT_OFF = 0, FORMAT_BRIEF, FORMAT_PROCESS, FORMAT_TAG, FORMAT_THREAD, FORMAT_RAW, FORMAT_TIME, FORMAT_THREADTIME, FORMAT_LONG } LogFormat; /* * Log driver state. */ typedef struct LogState { /* the fake fd that's seen by the user */ int fakeFd; /* a printable name for this fake device */ char *debugName; /* nonzero if this is a binary log */ int isBinary; /* global minimum priority */ int globalMinPriority; /* output format */ LogFormat outputFormat; /* tags and priorities */ struct { char tag[kMaxTagLen]; int minPriority; } tagSet[kTagSetSize]; } LogState; #ifdef HAVE_PTHREADS /* * Locking. Since we're emulating a device, we need to be prepared * to have multiple callers at the same time. This lock is used * to both protect the fd list and to prevent LogStates from being * freed out from under a user. */ static pthread_mutex_t fakeLogDeviceLock = PTHREAD_MUTEX_INITIALIZER; static void lock() { pthread_mutex_lock(&fakeLogDeviceLock); } static void unlock() { pthread_mutex_unlock(&fakeLogDeviceLock); } #else // !HAVE_PTHREADS #define lock() ((void)0) #define unlock() ((void)0) #endif // !HAVE_PTHREADS /* * File descriptor management. */ #define FAKE_FD_BASE 10000 #define MAX_OPEN_LOGS 16 static LogState *openLogTable[MAX_OPEN_LOGS]; /* * Allocate an fd and associate a new LogState with it. * The fd is available via the fakeFd field of the return value. */ static LogState *createLogState() { size_t i; for (i = 0; i < sizeof(openLogTable); i++) { if (openLogTable[i] == NULL) { openLogTable[i] = calloc(1, sizeof(LogState)); openLogTable[i]->fakeFd = FAKE_FD_BASE + i; return openLogTable[i]; } } return NULL; } /* * Translate an fd to a LogState. */ static LogState *fdToLogState(int fd) { if (fd >= FAKE_FD_BASE && fd < FAKE_FD_BASE + MAX_OPEN_LOGS) { return openLogTable[fd - FAKE_FD_BASE]; } return NULL; } /* * Unregister the fake fd and free the memory it pointed to. */ static void deleteFakeFd(int fd) { LogState *ls; lock(); ls = fdToLogState(fd); if (ls != NULL) { openLogTable[fd - FAKE_FD_BASE] = NULL; free(ls->debugName); free(ls); } unlock(); } /* * Configure logging based on ANDROID_LOG_TAGS environment variable. We * need to parse a string that looks like * * *:v jdwp:d dalvikvm:d dalvikvm-gc:i dalvikvmi:i * * The tag (or '*' for the global level) comes first, followed by a colon * and a letter indicating the minimum priority level we're expected to log. * This can be used to reveal or conceal logs with specific tags. * * We also want to check ANDROID_PRINTF_LOG to determine how the output * will look. */ static void configureInitialState(const char* pathName, LogState* logState) { static const int kDevLogLen = sizeof("/dev/alog/") - 1; logState->debugName = strdup(pathName); /* identify binary logs */ if (strcmp(pathName + kDevLogLen, "events") == 0) { logState->isBinary = 1; } /* global min priority defaults to "info" level */ logState->globalMinPriority = ANDROID_LOG_INFO; /* * This is based on the the long-dead utils/Log.cpp code. */ const char* tags = getenv("ANDROID_LOG_TAGS"); TRACE("Found ANDROID_LOG_TAGS='%s'\n", tags); if (tags != NULL) { int entry = 0; while (*tags != '\0') { char tagName[kMaxTagLen]; int i, minPrio; while (isspace(*tags)) tags++; i = 0; while (*tags != '\0' && !isspace(*tags) && *tags != ':' && i < kMaxTagLen) { tagName[i++] = *tags++; } if (i == kMaxTagLen) { TRACE("ERROR: env tag too long (%d chars max)\n", kMaxTagLen-1); return; } tagName[i] = '\0'; /* default priority, if there's no ":" part; also zero out '*' */ minPrio = ANDROID_LOG_VERBOSE; if (tagName[0] == '*' && tagName[1] == '\0') { minPrio = ANDROID_LOG_DEBUG; tagName[0] = '\0'; } if (*tags == ':') { tags++; if (*tags >= '0' && *tags <= '9') { if (*tags >= ('0' + ANDROID_LOG_SILENT)) minPrio = ANDROID_LOG_VERBOSE; else minPrio = *tags - '\0'; } else { switch (*tags) { case 'v': minPrio = ANDROID_LOG_VERBOSE; break; case 'd': minPrio = ANDROID_LOG_DEBUG; break; case 'i': minPrio = ANDROID_LOG_INFO; break; case 'w': minPrio = ANDROID_LOG_WARN; break; case 'e': minPrio = ANDROID_LOG_ERROR; break; case 'f': minPrio = ANDROID_LOG_FATAL; break; case 's': minPrio = ANDROID_LOG_SILENT; break; default: minPrio = ANDROID_LOG_DEFAULT; break; } } tags++; if (*tags != '\0' && !isspace(*tags)) { TRACE("ERROR: garbage in tag env; expected whitespace\n"); TRACE(" env='%s'\n", tags); return; } } if (tagName[0] == 0) { logState->globalMinPriority = minPrio; TRACE("+++ global min prio %d\n", logState->globalMinPriority); } else { logState->tagSet[entry].minPriority = minPrio; strcpy(logState->tagSet[entry].tag, tagName); TRACE("+++ entry %d: %s:%d\n", entry, logState->tagSet[entry].tag, logState->tagSet[entry].minPriority); entry++; } } } /* * Taken from the long-dead utils/Log.cpp */ const char* fstr = getenv("ANDROID_PRINTF_LOG"); LogFormat format; if (fstr == NULL) { format = FORMAT_BRIEF; } else { if (strcmp(fstr, "brief") == 0) format = FORMAT_BRIEF; else if (strcmp(fstr, "process") == 0) format = FORMAT_PROCESS; else if (strcmp(fstr, "tag") == 0) format = FORMAT_PROCESS; else if (strcmp(fstr, "thread") == 0) format = FORMAT_PROCESS; else if (strcmp(fstr, "raw") == 0) format = FORMAT_PROCESS; else if (strcmp(fstr, "time") == 0) format = FORMAT_PROCESS; else if (strcmp(fstr, "long") == 0) format = FORMAT_PROCESS; else format = (LogFormat) atoi(fstr); // really?! } logState->outputFormat = format; } /* * Return a human-readable string for the priority level. Always returns * a valid string. */ static const char* getPriorityString(int priority) { /* the first character of each string should be unique */ static const char* priorityStrings[] = { "Verbose", "Debug", "Info", "Warn", "Error", "Assert" }; int idx; idx = (int) priority - (int) ANDROID_LOG_VERBOSE; if (idx < 0 || idx >= (int) (sizeof(priorityStrings) / sizeof(priorityStrings[0]))) return "?unknown?"; return priorityStrings[idx]; } #ifndef HAVE_WRITEV /* * Some platforms like WIN32 do not have writev(). * Make up something to replace it. */ static ssize_t fake_writev(int fd, const struct iovec *iov, int iovcnt) { int result = 0; struct iovec* end = iov + iovcnt; for (; iov < end; iov++) { int w = write(fd, iov->iov_base, iov->iov_len); if (w != iov->iov_len) { if (w < 0) return w; return result + w; } result += w; } return result; } #define writev fake_writev #endif /* * Write a filtered log message to stderr. * * Log format parsing taken from the long-dead utils/Log.cpp. */ static void showLog(LogState *state, int logPrio, const char* tag, const char* msg) { #if defined(HAVE_LOCALTIME_R) struct tm tmBuf; #endif struct tm* ptm; char timeBuf[32]; char prefixBuf[128], suffixBuf[128]; char priChar; time_t when; pid_t pid, tid; TRACE("LOG %d: %s %s", logPrio, tag, msg); priChar = getPriorityString(logPrio)[0]; when = time(NULL); pid = tid = getpid(); // find gettid()? /* * Get the current date/time in pretty form * * It's often useful when examining a log with "less" to jump to * a specific point in the file by searching for the date/time stamp. * For this reason it's very annoying to have regexp meta characters * in the time stamp. Don't use forward slashes, parenthesis, * brackets, asterisks, or other special chars here. */ #if defined(HAVE_LOCALTIME_R) ptm = localtime_r(&when, &tmBuf); #else ptm = localtime(&when); #endif //strftime(timeBuf, sizeof(timeBuf), "%Y-%m-%d %H:%M:%S", ptm); strftime(timeBuf, sizeof(timeBuf), "%m-%d %H:%M:%S", ptm); /* * Construct a buffer containing the log header and log message. */ size_t prefixLen, suffixLen; switch (state->outputFormat) { case FORMAT_TAG: prefixLen = snprintf(prefixBuf, sizeof(prefixBuf), "%c/%-8s: ", priChar, tag); strcpy(suffixBuf, "\n"); suffixLen = 1; break; case FORMAT_PROCESS: prefixLen = snprintf(prefixBuf, sizeof(prefixBuf), "%c(%5d) ", priChar, pid); suffixLen = snprintf(suffixBuf, sizeof(suffixBuf), " (%s)\n", tag); break; case FORMAT_THREAD: prefixLen = snprintf(prefixBuf, sizeof(prefixBuf), "%c(%5d:%5d) ", priChar, pid, tid); strcpy(suffixBuf, "\n"); suffixLen = 1; break; case FORMAT_RAW: prefixBuf[0] = 0; prefixLen = 0; strcpy(suffixBuf, "\n"); suffixLen = 1; break; case FORMAT_TIME: prefixLen = snprintf(prefixBuf, sizeof(prefixBuf), "%s %-8s\n\t", timeBuf, tag); strcpy(suffixBuf, "\n"); suffixLen = 1; break; case FORMAT_THREADTIME: prefixLen = snprintf(prefixBuf, sizeof(prefixBuf), "%s %5d %5d %c %-8s \n\t", timeBuf, pid, tid, priChar, tag); strcpy(suffixBuf, "\n"); suffixLen = 1; break; case FORMAT_LONG: prefixLen = snprintf(prefixBuf, sizeof(prefixBuf), "[ %s %5d:%5d %c/%-8s ]\n", timeBuf, pid, tid, priChar, tag); strcpy(suffixBuf, "\n\n"); suffixLen = 2; break; default: prefixLen = snprintf(prefixBuf, sizeof(prefixBuf), "%c/%-8s(%5d): ", priChar, tag, pid); strcpy(suffixBuf, "\n"); suffixLen = 1; break; } /* * Figure out how many lines there will be. */ const char* end = msg + strlen(msg); size_t numLines = 0; const char* p = msg; while (p < end) { if (*p++ == '\n') numLines++; } if (p > msg && *(p-1) != '\n') numLines++; /* * Create an array of iovecs large enough to write all of * the lines with a prefix and a suffix. */ const size_t INLINE_VECS = 6; const size_t MAX_LINES = ((size_t)~0)/(3*sizeof(struct iovec*)); struct iovec stackVec[INLINE_VECS]; struct iovec* vec = stackVec; size_t numVecs; if (numLines > MAX_LINES) numLines = MAX_LINES; numVecs = numLines*3; // 3 iovecs per line. if (numVecs > INLINE_VECS) { vec = (struct iovec*)malloc(sizeof(struct iovec)*numVecs); if (vec == NULL) { msg = "LOG: write failed, no memory"; numVecs = 3; numLines = 1; vec = stackVec; } } /* * Fill in the iovec pointers. */ p = msg; struct iovec* v = vec; int totalLen = 0; while (numLines > 0 && p < end) { if (prefixLen > 0) { v->iov_base = prefixBuf; v->iov_len = prefixLen; totalLen += prefixLen; v++; } const char* start = p; while (p < end && *p != '\n') p++; if ((p-start) > 0) { v->iov_base = (void*)start; v->iov_len = p-start; totalLen += p-start; v++; } if (*p == '\n') p++; if (suffixLen > 0) { v->iov_base = suffixBuf; v->iov_len = suffixLen; totalLen += suffixLen; v++; } numLines -= 1; } /* * Write the entire message to the log file with a single writev() call. * We need to use this rather than a collection of printf()s on a FILE* * because of multi-threading and multi-process issues. * * If the file was not opened with O_APPEND, this will produce interleaved * output when called on the same file from multiple processes. * * If the file descriptor is actually a network socket, the writev() * call may return with a partial write. Putting the writev() call in * a loop can result in interleaved data. This can be alleviated * somewhat by wrapping the writev call in the Mutex. */ for(;;) { int cc = writev(fileno(stderr), vec, v-vec); if (cc == totalLen) break; if (cc < 0) { if(errno == EINTR) continue; /* can't really log the failure; for now, throw out a stderr */ fprintf(stderr, "+++ LOG: write failed (errno=%d)\n", errno); break; } else { /* shouldn't happen when writing to file or tty */ fprintf(stderr, "+++ LOG: write partial (%d of %d)\n", cc, totalLen); break; } } /* if we allocated storage for the iovecs, free it */ if (vec != stackVec) free(vec); } /* * Receive a log message. We happen to know that "vector" has three parts: * * priority (1 byte) * tag (N bytes -- null-terminated ASCII string) * message (N bytes -- null-terminated ASCII string) */ static ssize_t logWritev(int fd, const struct iovec* vector, int count) { LogState* state; /* Make sure that no-one frees the LogState while we're using it. * Also guarantees that only one thread is in showLog() at a given * time (if it matters). */ lock(); state = fdToLogState(fd); if (state == NULL) { errno = EBADF; goto error; } if (state->isBinary) { TRACE("%s: ignoring binary log\n", state->debugName); goto bail; } if (count != 3) { TRACE("%s: writevLog with count=%d not expected\n", state->debugName, count); goto error; } /* pull out the three fields */ int logPrio = *(const char*)vector[0].iov_base; const char* tag = (const char*) vector[1].iov_base; const char* msg = (const char*) vector[2].iov_base; /* see if this log tag is configured */ int i; int minPrio = state->globalMinPriority; for (i = 0; i < kTagSetSize; i++) { if (state->tagSet[i].minPriority == ANDROID_LOG_UNKNOWN) break; /* reached end of configured values */ if (strcmp(state->tagSet[i].tag, tag) == 0) { //TRACE("MATCH tag '%s'\n", tag); minPrio = state->tagSet[i].minPriority; break; } } if (logPrio >= minPrio) { showLog(state, logPrio, tag, msg); } else { //TRACE("+++ NOLOG(%d): %s %s", logPrio, tag, msg); } bail: unlock(); return vector[0].iov_len + vector[1].iov_len + vector[2].iov_len; error: unlock(); return -1; } /* * Free up our state and close the fake descriptor. */ static int logClose(int fd) { deleteFakeFd(fd); return 0; } /* * Open a log output device and return a fake fd. */ static int logOpen(const char* pathName, int flags) { LogState *logState; int fd = -1; lock(); logState = createLogState(); if (logState != NULL) { configureInitialState(pathName, logState); fd = logState->fakeFd; } else { errno = ENFILE; } unlock(); return fd; } /* * Runtime redirection. If this binary is running in the simulator, * just pass log messages to the emulated device. If it's running * outside of the simulator, write the log messages to stderr. */ static int (*redirectOpen)(const char *pathName, int flags) = NULL; static int (*redirectClose)(int fd) = NULL; static ssize_t (*redirectWritev)(int fd, const struct iovec* vector, int count) = NULL; static void setRedirects() { const char *ws; /* Wrapsim sets this environment variable on children that it's * created using its LD_PRELOAD wrapper. */ ws = getenv("ANDROID_WRAPSIM"); if (ws != NULL && strcmp(ws, "1") == 0) { /* We're running inside wrapsim, so we can just write to the device. */ redirectOpen = (int (*)(const char *pathName, int flags))open; redirectClose = close; redirectWritev = writev; } else { /* There's no device to delegate to; handle the logging ourselves. */ redirectOpen = logOpen; redirectClose = logClose; redirectWritev = logWritev; } } int fakeLogOpen(const char *pathName, int flags) { if (redirectOpen == NULL) { setRedirects(); } return redirectOpen(pathName, flags); } int fakeLogClose(int fd) { /* Assume that open() was called first. */ return redirectClose(fd); } ssize_t fakeLogWritev(int fd, const struct iovec* vector, int count) { /* Assume that open() was called first. */ return redirectWritev(fd, vector, count); } android-audiosystem-1.8+13.10.20130807/lib/liblog/logd_write.c0000644000015700001700000002716512200324306024226 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #ifdef HAVE_PTHREADS #include #endif #include #include #include #include #include #include #ifdef MOTOROLA_LOG #if HAVE_LIBC_SYSTEM_PROPERTIES #include #endif #endif #include #include #include #define LOG_BUF_SIZE 1024 #if FAKE_LOG_DEVICE // This will be defined when building for the host. #define log_open(pathname, flags) fakeLogOpen(pathname, flags) #define log_writev(filedes, vector, count) fakeLogWritev(filedes, vector, count) #define log_close(filedes) fakeLogClose(filedes) #else #define log_open(pathname, flags) open(pathname, flags) #define log_writev(filedes, vector, count) writev(filedes, vector, count) #define log_close(filedes) close(filedes) #endif static int __write_to_log_init(log_id_t, struct iovec *vec, size_t nr); static int (*write_to_log)(log_id_t, struct iovec *vec, size_t nr) = __write_to_log_init; #ifdef HAVE_PTHREADS static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER; #endif static int log_fds[(int)LOG_ID_MAX] = { -1, -1, -1, -1 }; /* * This is used by the C++ code to decide if it should write logs through * the C code. Basically, if /dev/log/... is available, we're running in * the simulator rather than a desktop tool and want to use the device. */ static enum { kLogUninitialized, kLogNotAvailable, kLogAvailable } g_log_status = kLogUninitialized; int __android_log_dev_available(void) { if (g_log_status == kLogUninitialized) { if (access("/dev/"LOGGER_LOG_MAIN, W_OK) == 0) g_log_status = kLogAvailable; else g_log_status = kLogNotAvailable; } return (g_log_status == kLogAvailable); } #ifdef HTCLOG signed int __htclog_read_masks(char *buf, signed int len) { return 0; } int __htclog_init_mask(const char *a1, unsigned int a2, int a3) { return 0; } int __htclog_print_private(int a1, const char *a2, const char *fmt, ...) { return 0; } #endif #ifdef MOTOROLA_LOG /* Fallback when there is neither log.tag. nor log.tag.DEFAULT. * this is compile-time defaulted to "info". The log startup code * looks at the build tags to see about whether it should be DEBUG... * -- just as is done in frameworks/base/core/jni/android_util_Log.cpp */ static int prio_fallback = ANDROID_LOG_INFO; /* * public interface so native code can see "should i log this" * and behave similar to java Log.isLoggable() calls. * * NB: we have (level,tag) here to match the other __android_log entries. * The Java side uses (tag,level) for its ordering. * since the args are (int,char*) vs (char*,char*) we won't get strange * swapped-the-strings errors. */ #define LOGGING_PREFIX "log.tag." #define LOGGING_DEFAULT "log.tag.DEFAULT" int __android_log_loggable(int prio, const char *tag) { int nprio; #if HAVE_LIBC_SYSTEM_PROPERTIES char keybuf[PROP_NAME_MAX]; char results[PROP_VALUE_MAX]; int n; /* we can NOT cache the log.tag. and log.tag.DEFAULT * values because either one can be changed dynamically. * * damn, says the performance compulsive. */ n = 0; results[0] = '\0'; if (tag) { memcpy (keybuf, LOGGING_PREFIX, strlen (LOGGING_PREFIX) + 1); /* watch out for buffer overflow */ strncpy (keybuf + strlen (LOGGING_PREFIX), tag, sizeof (keybuf) - strlen (LOGGING_PREFIX)); keybuf[sizeof (keybuf) - 1] = '\0'; n = __system_property_get (keybuf, results); } if (n == 0) { /* nothing yet, look for the global */ memcpy (keybuf, LOGGING_DEFAULT, sizeof (LOGGING_DEFAULT)); n = __system_property_get (keybuf, results); } if (n == 0) { nprio = prio_fallback; } else { switch (results[0]) { case 'E': nprio = ANDROID_LOG_ERROR; break; case 'W': nprio = ANDROID_LOG_WARN; break; case 'I': nprio = ANDROID_LOG_INFO; break; case 'D': nprio = ANDROID_LOG_DEBUG; break; case 'V': nprio = ANDROID_LOG_VERBOSE; break; case 'S': nprio = ANDROID_LOG_SILENT; break; default: /* unspecified or invalid */ nprio = prio_fallback; break; } } #else /* no system property routines, fallback to a default */ nprio = prio_fallback; #endif return ((prio >= nprio) ? 1 : 0); } #endif static int __write_to_log_null(log_id_t log_fd, struct iovec *vec, size_t nr) { return -1; } static int __write_to_log_kernel(log_id_t log_id, struct iovec *vec, size_t nr) { ssize_t ret; int log_fd; if (/*(int)log_id >= 0 &&*/ (int)log_id < (int)LOG_ID_MAX) { log_fd = log_fds[(int)log_id]; } else { return EBADF; } do { ret = log_writev(log_fd, vec, nr); } while (ret < 0 && errno == EINTR); return ret; } static int __write_to_log_init(log_id_t log_id, struct iovec *vec, size_t nr) { #ifdef HAVE_PTHREADS pthread_mutex_lock(&log_init_lock); #endif #ifdef ANDROID_LOG_STDOUT /* In case we want log to stdout, don't push them to the android log system */ write_to_log = __write_to_log_null; log_fds[LOG_ID_MAIN] = -1; log_fds[LOG_ID_RADIO] = -1; log_fds[LOG_ID_EVENTS] = -1; #endif if (write_to_log == __write_to_log_init) { log_fds[LOG_ID_MAIN] = log_open("/dev/"LOGGER_LOG_MAIN, O_WRONLY); log_fds[LOG_ID_RADIO] = log_open("/dev/"LOGGER_LOG_RADIO, O_WRONLY); log_fds[LOG_ID_EVENTS] = log_open("/dev/"LOGGER_LOG_EVENTS, O_WRONLY); log_fds[LOG_ID_SYSTEM] = log_open("/dev/"LOGGER_LOG_SYSTEM, O_WRONLY); write_to_log = __write_to_log_kernel; if (log_fds[LOG_ID_MAIN] < 0 || log_fds[LOG_ID_RADIO] < 0 || log_fds[LOG_ID_EVENTS] < 0) { log_close(log_fds[LOG_ID_MAIN]); log_close(log_fds[LOG_ID_RADIO]); log_close(log_fds[LOG_ID_EVENTS]); log_fds[LOG_ID_MAIN] = -1; log_fds[LOG_ID_RADIO] = -1; log_fds[LOG_ID_EVENTS] = -1; write_to_log = __write_to_log_null; } if (log_fds[LOG_ID_SYSTEM] < 0) { log_fds[LOG_ID_SYSTEM] = log_fds[LOG_ID_MAIN]; } } #ifdef HAVE_PTHREADS pthread_mutex_unlock(&log_init_lock); #endif return write_to_log(log_id, vec, nr); } int __android_log_write(int prio, const char *tag, const char *msg) { struct iovec vec[3]; log_id_t log_id = LOG_ID_MAIN; if (!tag) tag = ""; /* XXX: This needs to go! */ if (!strcmp(tag, "HTC_RIL") || !strncmp(tag, "RIL", 3) || /* Any log tag with "RIL" as the prefix */ !strncmp(tag, "IMS", 3) || /* Any log tag with "IMS" as the prefix */ !strcmp(tag, "AT") || !strcmp(tag, "GSM") || !strcmp(tag, "STK") || !strcmp(tag, "CDMA") || !strcmp(tag, "PHONE") || !strcmp(tag, "SMS") || !strcmp(tag, "KINETO") || !strncmp(tag, "KIPC", 4) || !strncmp(tag, "Kineto", 6) || !strncmp(tag, "QCRIL", 5) || !strncmp(tag, "QC-RIL", 6) || !strncmp(tag, "QC-QMI", 6) || !strncmp(tag, "QC-ONCRPC", 9) || !strncmp(tag, "QC-DSI", 6) || !strcmp(tag, "QC-NETMGR-LIB") || !strcmp(tag, "QC-QDP") ) log_id = LOG_ID_RADIO; vec[0].iov_base = (unsigned char *) &prio; vec[0].iov_len = 1; vec[1].iov_base = (void *) tag; vec[1].iov_len = strlen(tag) + 1; vec[2].iov_base = (void *) msg; vec[2].iov_len = strlen(msg) + 1; return write_to_log(log_id, vec, 3); } int __android_log_buf_write(int bufID, int prio, const char *tag, const char *msg) { struct iovec vec[3]; if (!tag) tag = ""; /* XXX: This needs to go! */ if (!strcmp(tag, "HTC_RIL") || !strncmp(tag, "RIL", 3) || /* Any log tag with "RIL" as the prefix */ !strncmp(tag, "IMS", 3) || /* Any log tag with "IMS" as the prefix */ !strcmp(tag, "AT") || !strcmp(tag, "GSM") || !strcmp(tag, "STK") || !strcmp(tag, "CDMA") || !strcmp(tag, "PHONE") || !strcmp(tag, "SMS") || !strcmp(tag, "KINETO") || !strncmp(tag, "KIPC", 4) || !strncmp(tag, "Kineto", 6) || !strncmp(tag, "QCRIL", 5) || !strncmp(tag, "QC-RIL", 6) || !strncmp(tag, "QC-QMI", 6) || !strncmp(tag, "QC-ONCRPC", 9) || !strncmp(tag, "QC-DSI", 6) ) bufID = LOG_ID_RADIO; vec[0].iov_base = (unsigned char *) &prio; vec[0].iov_len = 1; vec[1].iov_base = (void *) tag; vec[1].iov_len = strlen(tag) + 1; vec[2].iov_base = (void *) msg; vec[2].iov_len = strlen(msg) + 1; return write_to_log(bufID, vec, 3); } int __android_log_vprint(int prio, const char *tag, const char *fmt, va_list ap) { char buf[LOG_BUF_SIZE]; vsnprintf(buf, LOG_BUF_SIZE, fmt, ap); return __android_log_write(prio, tag, buf); } int __android_log_print(int prio, const char *tag, const char *fmt, ...) { va_list ap; char buf[LOG_BUF_SIZE]; va_start(ap, fmt); #ifdef ANDROID_LOG_STDOUT if (getenv("ANDROID_LOG_STDOUT")) { printf("[%s] ", tag); vprintf(fmt, ap); printf("\n"); } #endif vsnprintf(buf, LOG_BUF_SIZE, fmt, ap); va_end(ap); return __android_log_write(prio, tag, buf); } int __android_log_buf_print(int bufID, int prio, const char *tag, const char *fmt, ...) { va_list ap; char buf[LOG_BUF_SIZE]; va_start(ap, fmt); vsnprintf(buf, LOG_BUF_SIZE, fmt, ap); va_end(ap); return __android_log_buf_write(bufID, prio, tag, buf); } void __android_log_assert(const char *cond, const char *tag, const char *fmt, ...) { char buf[LOG_BUF_SIZE]; if (fmt) { va_list ap; va_start(ap, fmt); vsnprintf(buf, LOG_BUF_SIZE, fmt, ap); va_end(ap); } else { /* Msg not provided, log condition. N.B. Do not use cond directly as * format string as it could contain spurious '%' syntax (e.g. * "%d" in "blocks%devs == 0"). */ if (cond) snprintf(buf, LOG_BUF_SIZE, "Assertion failed: %s", cond); else strcpy(buf, "Unspecified assertion failed"); } __android_log_write(ANDROID_LOG_FATAL, tag, buf); __builtin_trap(); /* trap so we have a chance to debug the situation */ } int __android_log_bwrite(int32_t tag, const void *payload, size_t len) { struct iovec vec[2]; vec[0].iov_base = &tag; vec[0].iov_len = sizeof(tag); vec[1].iov_base = (void*)payload; vec[1].iov_len = len; return write_to_log(LOG_ID_EVENTS, vec, 2); } /* * Like __android_log_bwrite, but takes the type as well. Doesn't work * for the general case where we're generating lists of stuff, but very * handy if we just want to dump an integer into the log. */ int __android_log_btwrite(int32_t tag, char type, const void *payload, size_t len) { struct iovec vec[3]; vec[0].iov_base = &tag; vec[0].iov_len = sizeof(tag); vec[1].iov_base = &type; vec[1].iov_len = sizeof(type); vec[2].iov_base = (void*)payload; vec[2].iov_len = len; return write_to_log(LOG_ID_EVENTS, vec, 3); } android-audiosystem-1.8+13.10.20130807/lib/liblog/build0000755000015700001700000000013012200324306022727 0ustar pbuserpbgroup00000000000000#!/bin/sh target='armel' make clean make -e ARCH=$target make -e ARCH=$target install android-audiosystem-1.8+13.10.20130807/lib/liblog/Makefile0000644000015700001700000000267412200324306023361 0ustar pbuserpbgroup00000000000000make_home := ../.. top_srcdir := ../.. include $(make_home)/project_make WARN = -Wall include $(make_home)/package_make include ../Makefile.defines ####################### # CUSTOMIZE MACROS HERE ####################### # name your library here PKG_LIB = log # at least one of following lines must be uncommented # CFILES is .c # CCFILES is .cc # CPPFILES is .cpp # CXXFILES is .cxx CFILES = logd_write.c logprint.c event_tag_map.c fake_log_device.c #CCFILES = #CPPFILES = #CXXFILES = # if this library depends on private static library built # by this package, uncomment next line #STATIC_LIBS = # modify compiler command-line options CFLAGS = -fPIC -DHAVE_ANDROID_OS=1 -DANDROID_LOG_STDOUT $(CONFIG_DEFINES) # modify linker command-line options #LDFLAGS = # build private static library private_lib = YES # build simple shared library # single header file exported, should be .../lib/include/$(PKG_LIB).h PKGCONFIG = NO # build pkgconfig shared library # change PKGCONFIG to YES and add following three macros # PKG_LIBDESC is one line description of library # PKG_REQUIRES is list of required pkgconfig libraries # PKG_HEADERS is list of header files to export #PKG_LIBDESC = #PKG_REQUIRES = #PKG_HEADERS = MAKESUBDIR = YES LIBSUBDIR = /$(install_lib_rel) HDRSUBDIR = /$(install_hdr_rel) ############################ # END OF MACROS TO CUSTOMIZE ############################ all: $(TARGET) #-include $(DEPENDS) include $(make_home)/target_lib android-audiosystem-1.8+13.10.20130807/lib/liblog/NOTICE0000644000015700001700000002470712200324306022626 0ustar pbuserpbgroup00000000000000 Copyright (c) 2005-2008, The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS android-audiosystem-1.8+13.10.20130807/lib/Config.defines.arm0000644000015700001700000000250212200324306023761 0ustar pbuserpbgroup00000000000000# Android config -- "android-arm". Used for ARM device builds. CONFIG_DEFINES:= \ -DHAVE_PTHREADS \ -DHAVE_FUTEX \ -DHAVE_FUTEX_WRAPPERS=1 \ -DHAVE_FORKEXEC \ -DHAVE_OOM_ADJ \ -DHAVE_ANDROID_IPC \ -DHAVE_POSIX_FILEMAP \ -DHAVE_TERMIO_H \ -D HAVE_SYS_UIO_H \ -DHAVE_SYMLINKS \ -DHAVE_IOCTL \ -DHAVE_POSIX_CLOCKS \ -DHAVE_TIMEDWAIT_MONOTONIC \ -DHAVE_EPOLL \ -DHAVE_ENDIAN_H \ -DHAVE_LITTLE_ENDIAN \ -DHAVE_BACKTRACE=0 \ -DHAVE_DLADDR=0 \ -DHAVE_CXXABI=0 \ -DHAVE_SCHED_SETSCHEDULER \ -D__linux__ \ -DHAVE_MALLOC_H \ -DHAVE_LINUX_LOCAL_SOCKET_NAMESPACE=1 \ -DHAVE_INOTIFY=1 \ -DHAVE_MADVISE=1 \ -DHAVE_TM_GMTOFF=1 \ -DHAVE_DIRENT_D_TYPE=1 \ -DARCH_ARM \ -DOS_SHARED_LIB_FORMAT_STR="lib%s.so" \ -DHAVE__MEMCMP16=1 \ -DMINCORE_POINTER_TYPE="unsigned char *" \ -DHAVE_SA_NOCLDWAIT \ -DOS_PATH_SEPARATOR="'/'" \ -DOS_CASE_SENSITIVE \ -DHAVE_SYS_SOCKET_H=1 \ -DHAVE_PRCTL=1 \ -DHAVE_WRITEV=1 \ -DHAVE_STDINT_H=1 \ -DHAVE_STDBOOL_H=1 \ -DHAVE_SCHED_H=1 # -DHAVE_SYS_SENDFILE_H=1 \ # -DHAVE_STRLCPY=1 \ # -DHAVE_GETTID \ # -DHAVE_ANDROID_OS=1 \ # -DHAVE_LIBC_SYSTEM_PROPERTIES=1 \ # -DHAVE_MS_C_RUNTIME # -DHAVE_LOCALTIME_R # -DHAVE_GETHOSTBYNAME_R # -DHAVE_WINSOCK # -D_FILE_OFFSET_BITS 64 # -D_LARGEFILE_SOURCE 1 # -DHAVE_SYSTEM_PROPERTY_SERVER # -DHAVE_SHORT_ENUMS android-audiosystem-1.8+13.10.20130807/lib/binder/0000755000015700001700000000000012200324404021702 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/lib/binder/IInterface.cpp0000644000015700001700000000216112200324306024420 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include namespace android { // --------------------------------------------------------------------------- IInterface::IInterface() : RefBase() { } IInterface::~IInterface() { } sp IInterface::asBinder() { return this ? onAsBinder() : NULL; } sp IInterface::asBinder() const { return this ? const_cast(this)->onAsBinder() : NULL; } // --------------------------------------------------------------------------- }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/binder/IPermissionController.cpp0000644000015700001700000000500512200324306026714 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "PermissionController" #include #include #include #include #include #include namespace android { // ---------------------------------------------------------------------- class BpPermissionController : public BpInterface { public: BpPermissionController(const sp& impl) : BpInterface(impl) { } virtual bool checkPermission(const String16& permission, int32_t pid, int32_t uid) { Parcel data, reply; data.writeInterfaceToken(IPermissionController::getInterfaceDescriptor()); data.writeString16(permission); data.writeInt32(pid); data.writeInt32(uid); remote()->transact(CHECK_PERMISSION_TRANSACTION, data, &reply); // fail on exception if (reply.readExceptionCode() != 0) return 0; return reply.readInt32() != 0; } }; IMPLEMENT_META_INTERFACE(PermissionController, "android.os.IPermissionController"); // ---------------------------------------------------------------------- status_t BnPermissionController::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { //printf("PermissionController received: "); data.print(); switch(code) { case CHECK_PERMISSION_TRANSACTION: { CHECK_INTERFACE(IPermissionController, data, reply); String16 permission = data.readString16(); int32_t pid = data.readInt32(); int32_t uid = data.readInt32(); bool res = checkPermission(permission, pid, uid); reply->writeNoException(); reply->writeInt32(res ? 1 : 0); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/binder/IServiceManager.cpp0000644000015700001700000001677512200324306025433 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "ServiceManager" #include #include #include #include #include #include #include #include #include namespace android { sp defaultServiceManager() { if (gDefaultServiceManager != NULL) return gDefaultServiceManager; { AutoMutex _l(gDefaultServiceManagerLock); if (gDefaultServiceManager == NULL) { gDefaultServiceManager = interface_cast( ProcessState::self()->getContextObject(NULL)); } } return gDefaultServiceManager; } bool checkCallingPermission(const String16& permission) { return checkCallingPermission(permission, NULL, NULL); } static String16 _permission("permission"); bool checkCallingPermission(const String16& permission, int32_t* outPid, int32_t* outUid) { IPCThreadState* ipcState = IPCThreadState::self(); pid_t pid = ipcState->getCallingPid(); uid_t uid = ipcState->getCallingUid(); if (outPid) *outPid = pid; if (outUid) *outUid = uid; return checkPermission(permission, pid, uid); } bool checkPermission(const String16& permission, pid_t pid, uid_t uid) { sp pc; gDefaultServiceManagerLock.lock(); pc = gPermissionController; gDefaultServiceManagerLock.unlock(); int64_t startTime = 0; while (true) { if (pc != NULL) { bool res = pc->checkPermission(permission, pid, uid); if (res) { if (startTime != 0) { ALOGI("Check passed after %d seconds for %s from uid=%d pid=%d", (int)((uptimeMillis()-startTime)/1000), String8(permission).string(), uid, pid); } return res; } // Is this a permission failure, or did the controller go away? if (pc->asBinder()->isBinderAlive()) { ALOGW("Permission failure: %s from uid=%d pid=%d", String8(permission).string(), uid, pid); return false; } // Object is dead! gDefaultServiceManagerLock.lock(); if (gPermissionController == pc) { gPermissionController = NULL; } gDefaultServiceManagerLock.unlock(); } // Need to retrieve the permission controller. sp binder = defaultServiceManager()->checkService(_permission); if (binder == NULL) { // Wait for the permission controller to come back... if (startTime == 0) { startTime = uptimeMillis(); ALOGI("Waiting to check permission %s from uid=%d pid=%d", String8(permission).string(), uid, pid); } sleep(1); } else { pc = interface_cast(binder); // Install the new permission controller, and try again. gDefaultServiceManagerLock.lock(); gPermissionController = pc; gDefaultServiceManagerLock.unlock(); } } } // ---------------------------------------------------------------------- class BpServiceManager : public BpInterface { public: BpServiceManager(const sp& impl) : BpInterface(impl) { } virtual sp getService(const String16& name) const { unsigned n; for (n = 0; n < 5; n++){ sp svc = checkService(name); if (svc != NULL) return svc; ALOGI("Waiting for service %s...\n", String8(name).string()); sleep(1); } return NULL; } virtual sp checkService( const String16& name) const { Parcel data, reply; data.writeInterfaceToken(IServiceManager::getInterfaceDescriptor()); data.writeString16(name); remote()->transact(CHECK_SERVICE_TRANSACTION, data, &reply); return reply.readStrongBinder(); } virtual status_t addService(const String16& name, const sp& service, bool allowIsolated) { Parcel data, reply; data.writeInterfaceToken(IServiceManager::getInterfaceDescriptor()); data.writeString16(name); data.writeStrongBinder(service); data.writeInt32(allowIsolated ? 1 : 0); status_t err = remote()->transact(ADD_SERVICE_TRANSACTION, data, &reply); return err == NO_ERROR ? reply.readExceptionCode() : err; } virtual Vector listServices() { Vector res; int n = 0; for (;;) { Parcel data, reply; data.writeInterfaceToken(IServiceManager::getInterfaceDescriptor()); data.writeInt32(n++); status_t err = remote()->transact(LIST_SERVICES_TRANSACTION, data, &reply); if (err != NO_ERROR) break; res.add(reply.readString16()); } return res; } }; IMPLEMENT_META_INTERFACE(ServiceManager, "android.os.IServiceManager"); // ---------------------------------------------------------------------- status_t BnServiceManager::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { //printf("ServiceManager received: "); data.print(); switch(code) { case GET_SERVICE_TRANSACTION: { CHECK_INTERFACE(IServiceManager, data, reply); String16 which = data.readString16(); sp b = const_cast(this)->getService(which); reply->writeStrongBinder(b); return NO_ERROR; } break; case CHECK_SERVICE_TRANSACTION: { CHECK_INTERFACE(IServiceManager, data, reply); String16 which = data.readString16(); sp b = const_cast(this)->checkService(which); reply->writeStrongBinder(b); return NO_ERROR; } break; case ADD_SERVICE_TRANSACTION: { CHECK_INTERFACE(IServiceManager, data, reply); String16 which = data.readString16(); sp b = data.readStrongBinder(); status_t err = addService(which, b); reply->writeInt32(err); return NO_ERROR; } break; case LIST_SERVICES_TRANSACTION: { CHECK_INTERFACE(IServiceManager, data, reply); Vector list = listServices(); const size_t N = list.size(); reply->writeInt32(N); for (size_t i=0; iwriteString16(list[i]); } return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/binder/IPCThreadState.cpp0000644000015700001700000010376512200324306025167 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "IPCThreadState" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_PTHREADS #include #include #include #endif #ifdef HAVE_WIN32_THREADS #include #endif #if LOG_NDEBUG #define IF_LOG_TRANSACTIONS() if (false) #define IF_LOG_COMMANDS() if (false) #define LOG_REMOTEREFS(...) #define IF_LOG_REMOTEREFS() if (false) #define LOG_THREADPOOL(...) #define LOG_ONEWAY(...) #else #define IF_LOG_TRANSACTIONS() IF_ALOG(LOG_VERBOSE, "transact") #define IF_LOG_COMMANDS() IF_ALOG(LOG_VERBOSE, "ipc") #define LOG_REMOTEREFS(...) ALOG(LOG_DEBUG, "remoterefs", __VA_ARGS__) #define IF_LOG_REMOTEREFS() IF_ALOG(LOG_DEBUG, "remoterefs") #define LOG_THREADPOOL(...) ALOG(LOG_DEBUG, "threadpool", __VA_ARGS__) #define LOG_ONEWAY(...) ALOG(LOG_DEBUG, "ipc", __VA_ARGS__) #endif // --------------------------------------------------------------------------- namespace android { static const char* getReturnString(size_t idx); static const char* getCommandString(size_t idx); static const void* printReturnCommand(TextOutput& out, const void* _cmd); static const void* printCommand(TextOutput& out, const void* _cmd); // This will result in a missing symbol failure if the IF_LOG_COMMANDS() // conditionals don't get stripped... but that is probably what we want. #if !LOG_NDEBUG static const char *kReturnStrings[] = { "BR_ERROR", "BR_OK", "BR_TRANSACTION", "BR_REPLY", "BR_ACQUIRE_RESULT", "BR_DEAD_REPLY", "BR_TRANSACTION_COMPLETE", "BR_INCREFS", "BR_ACQUIRE", "BR_RELEASE", "BR_DECREFS", "BR_ATTEMPT_ACQUIRE", "BR_NOOP", "BR_SPAWN_LOOPER", "BR_FINISHED", "BR_DEAD_BINDER", "BR_CLEAR_DEATH_NOTIFICATION_DONE", "BR_FAILED_REPLY" }; static const char *kCommandStrings[] = { "BC_TRANSACTION", "BC_REPLY", "BC_ACQUIRE_RESULT", "BC_FREE_BUFFER", "BC_INCREFS", "BC_ACQUIRE", "BC_RELEASE", "BC_DECREFS", "BC_INCREFS_DONE", "BC_ACQUIRE_DONE", "BC_ATTEMPT_ACQUIRE", "BC_REGISTER_LOOPER", "BC_ENTER_LOOPER", "BC_EXIT_LOOPER", "BC_REQUEST_DEATH_NOTIFICATION", "BC_CLEAR_DEATH_NOTIFICATION", "BC_DEAD_BINDER_DONE" }; static const char* getReturnString(size_t idx) { if (idx < sizeof(kReturnStrings) / sizeof(kReturnStrings[0])) return kReturnStrings[idx]; else return "unknown"; } static const char* getCommandString(size_t idx) { if (idx < sizeof(kCommandStrings) / sizeof(kCommandStrings[0])) return kCommandStrings[idx]; else return "unknown"; } static const void* printBinderTransactionData(TextOutput& out, const void* data) { const binder_transaction_data* btd = (const binder_transaction_data*)data; if (btd->target.handle < 1024) { /* want to print descriptors in decimal; guess based on value */ out << "target.desc=" << btd->target.handle; } else { out << "target.ptr=" << btd->target.ptr; } out << " (cookie " << btd->cookie << ")" << endl << "code=" << TypeCode(btd->code) << ", flags=" << (void*)btd->flags << endl << "data=" << btd->data.ptr.buffer << " (" << (void*)btd->data_size << " bytes)" << endl << "offsets=" << btd->data.ptr.offsets << " (" << (void*)btd->offsets_size << " bytes)"; return btd+1; } static const void* printReturnCommand(TextOutput& out, const void* _cmd) { static const size_t N = sizeof(kReturnStrings)/sizeof(kReturnStrings[0]); const int32_t* cmd = (const int32_t*)_cmd; int32_t code = *cmd++; size_t cmdIndex = code & 0xff; if (code == (int32_t) BR_ERROR) { out << "BR_ERROR: " << (void*)(*cmd++) << endl; return cmd; } else if (cmdIndex >= N) { out << "Unknown reply: " << code << endl; return cmd; } out << kReturnStrings[cmdIndex]; switch (code) { case BR_TRANSACTION: case BR_REPLY: { out << ": " << indent; cmd = (const int32_t *)printBinderTransactionData(out, cmd); out << dedent; } break; case BR_ACQUIRE_RESULT: { const int32_t res = *cmd++; out << ": " << res << (res ? " (SUCCESS)" : " (FAILURE)"); } break; case BR_INCREFS: case BR_ACQUIRE: case BR_RELEASE: case BR_DECREFS: { const int32_t b = *cmd++; const int32_t c = *cmd++; out << ": target=" << (void*)b << " (cookie " << (void*)c << ")"; } break; case BR_ATTEMPT_ACQUIRE: { const int32_t p = *cmd++; const int32_t b = *cmd++; const int32_t c = *cmd++; out << ": target=" << (void*)b << " (cookie " << (void*)c << "), pri=" << p; } break; case BR_DEAD_BINDER: case BR_CLEAR_DEATH_NOTIFICATION_DONE: { const int32_t c = *cmd++; out << ": death cookie " << (void*)c; } break; default: // no details to show for: BR_OK, BR_DEAD_REPLY, // BR_TRANSACTION_COMPLETE, BR_FINISHED break; } out << endl; return cmd; } static const void* printCommand(TextOutput& out, const void* _cmd) { static const size_t N = sizeof(kCommandStrings)/sizeof(kCommandStrings[0]); const int32_t* cmd = (const int32_t*)_cmd; int32_t code = *cmd++; size_t cmdIndex = code & 0xff; if (cmdIndex >= N) { out << "Unknown command: " << code << endl; return cmd; } out << kCommandStrings[cmdIndex]; switch (code) { case BC_TRANSACTION: case BC_REPLY: { out << ": " << indent; cmd = (const int32_t *)printBinderTransactionData(out, cmd); out << dedent; } break; case BC_ACQUIRE_RESULT: { const int32_t res = *cmd++; out << ": " << res << (res ? " (SUCCESS)" : " (FAILURE)"); } break; case BC_FREE_BUFFER: { const int32_t buf = *cmd++; out << ": buffer=" << (void*)buf; } break; case BC_INCREFS: case BC_ACQUIRE: case BC_RELEASE: case BC_DECREFS: { const int32_t d = *cmd++; out << ": desc=" << d; } break; case BC_INCREFS_DONE: case BC_ACQUIRE_DONE: { const int32_t b = *cmd++; const int32_t c = *cmd++; out << ": target=" << (void*)b << " (cookie " << (void*)c << ")"; } break; case BC_ATTEMPT_ACQUIRE: { const int32_t p = *cmd++; const int32_t d = *cmd++; out << ": desc=" << d << ", pri=" << p; } break; case BC_REQUEST_DEATH_NOTIFICATION: case BC_CLEAR_DEATH_NOTIFICATION: { const int32_t h = *cmd++; const int32_t c = *cmd++; out << ": handle=" << h << " (death cookie " << (void*)c << ")"; } break; case BC_DEAD_BINDER_DONE: { const int32_t c = *cmd++; out << ": death cookie " << (void*)c; } break; default: // no details to show for: BC_REGISTER_LOOPER, BC_ENTER_LOOPER, // BC_EXIT_LOOPER break; } out << endl; return cmd; } #endif static pthread_mutex_t gTLSMutex = PTHREAD_MUTEX_INITIALIZER; static bool gHaveTLS = false; static pthread_key_t gTLS = 0; static bool gShutdown = false; static bool gDisableBackgroundScheduling = false; IPCThreadState* IPCThreadState::self() { if (gHaveTLS) { restart: const pthread_key_t k = gTLS; IPCThreadState* st = (IPCThreadState*)pthread_getspecific(k); if (st) return st; return new IPCThreadState; } if (gShutdown) return NULL; pthread_mutex_lock(&gTLSMutex); if (!gHaveTLS) { if (pthread_key_create(&gTLS, threadDestructor) != 0) { pthread_mutex_unlock(&gTLSMutex); return NULL; } gHaveTLS = true; } pthread_mutex_unlock(&gTLSMutex); goto restart; } IPCThreadState* IPCThreadState::selfOrNull() { if (gHaveTLS) { const pthread_key_t k = gTLS; IPCThreadState* st = (IPCThreadState*)pthread_getspecific(k); return st; } return NULL; } void IPCThreadState::shutdown() { gShutdown = true; if (gHaveTLS) { // XXX Need to wait for all thread pool threads to exit! IPCThreadState* st = (IPCThreadState*)pthread_getspecific(gTLS); if (st) { delete st; pthread_setspecific(gTLS, NULL); } gHaveTLS = false; } } void IPCThreadState::disableBackgroundScheduling(bool disable) { gDisableBackgroundScheduling = disable; } sp IPCThreadState::process() { return mProcess; } status_t IPCThreadState::clearLastError() { const status_t err = mLastError; mLastError = NO_ERROR; return err; } int IPCThreadState::getCallingPid() { return mCallingPid; } int IPCThreadState::getCallingUid() { return mCallingUid; } int64_t IPCThreadState::clearCallingIdentity() { int64_t token = ((int64_t)mCallingUid<<32) | mCallingPid; clearCaller(); return token; } void IPCThreadState::setStrictModePolicy(int32_t policy) { mStrictModePolicy = policy; } int32_t IPCThreadState::getStrictModePolicy() const { return mStrictModePolicy; } void IPCThreadState::setLastTransactionBinderFlags(int32_t flags) { mLastTransactionBinderFlags = flags; } int32_t IPCThreadState::getLastTransactionBinderFlags() const { return mLastTransactionBinderFlags; } void IPCThreadState::restoreCallingIdentity(int64_t token) { mCallingUid = (int)(token>>32); mCallingPid = (int)token; } void IPCThreadState::clearCaller() { mCallingPid = getpid(); mCallingUid = getuid(); } void IPCThreadState::flushCommands() { if (mProcess->mDriverFD <= 0) return; talkWithDriver(false); } void IPCThreadState::joinThreadPool(bool isMain) { LOG_THREADPOOL("**** THREAD %p (PID %d) IS JOINING THE THREAD POOL\n", (void*)pthread_self(), getpid()); mOut.writeInt32(isMain ? BC_ENTER_LOOPER : BC_REGISTER_LOOPER); // This thread may have been spawned by a thread that was in the background // scheduling group, so first we will make sure it is in the foreground // one to avoid performing an initial transaction in the background. set_sched_policy(mMyThreadId, SP_FOREGROUND); status_t result; do { int32_t cmd; // When we've cleared the incoming command queue, process any pending derefs if (mIn.dataPosition() >= mIn.dataSize()) { size_t numPending = mPendingWeakDerefs.size(); if (numPending > 0) { for (size_t i = 0; i < numPending; i++) { RefBase::weakref_type* refs = mPendingWeakDerefs[i]; refs->decWeak(mProcess.get()); } mPendingWeakDerefs.clear(); } numPending = mPendingStrongDerefs.size(); if (numPending > 0) { for (size_t i = 0; i < numPending; i++) { BBinder* obj = mPendingStrongDerefs[i]; obj->decStrong(mProcess.get()); } mPendingStrongDerefs.clear(); } } // now get the next command to be processed, waiting if necessary result = talkWithDriver(); if (result >= NO_ERROR) { size_t IN = mIn.dataAvail(); if (IN < sizeof(int32_t)) continue; cmd = mIn.readInt32(); IF_LOG_COMMANDS() { alog << "Processing top-level Command: " << getReturnString(cmd) << endl; } result = executeCommand(cmd); } // After executing the command, ensure that the thread is returned to the // foreground cgroup before rejoining the pool. The driver takes care of // restoring the priority, but doesn't do anything with cgroups so we // need to take care of that here in userspace. Note that we do make // sure to go in the foreground after executing a transaction, but // there are other callbacks into user code that could have changed // our group so we want to make absolutely sure it is put back. set_sched_policy(mMyThreadId, SP_FOREGROUND); // Let this thread exit the thread pool if it is no longer // needed and it is not the main process thread. if(result == TIMED_OUT && !isMain) { break; } } while (result != -ECONNREFUSED && result != -EBADF); LOG_THREADPOOL("**** THREAD %p (PID %d) IS LEAVING THE THREAD POOL err=%p\n", (void*)pthread_self(), getpid(), (void*)result); mOut.writeInt32(BC_EXIT_LOOPER); talkWithDriver(false); } void IPCThreadState::stopProcess(bool immediate) { //ALOGI("**** STOPPING PROCESS"); flushCommands(); int fd = mProcess->mDriverFD; mProcess->mDriverFD = -1; close(fd); //kill(getpid(), SIGKILL); } status_t IPCThreadState::transact(int32_t handle, uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { status_t err = data.errorCheck(); flags |= TF_ACCEPT_FDS; IF_LOG_TRANSACTIONS() { TextOutput::Bundle _b(alog); alog << "BC_TRANSACTION thr " << (void*)pthread_self() << " / hand " << handle << " / code " << TypeCode(code) << ": " << indent << data << dedent << endl; } if (err == NO_ERROR) { LOG_ONEWAY(">>>> SEND from pid %d uid %d %s", getpid(), getuid(), (flags & TF_ONE_WAY) == 0 ? "READ REPLY" : "ONE WAY"); err = writeTransactionData(BC_TRANSACTION, flags, handle, code, data, NULL); } if (err != NO_ERROR) { if (reply) reply->setError(err); return (mLastError = err); } if ((flags & TF_ONE_WAY) == 0) { #if 0 if (code == 4) { // relayout ALOGI(">>>>>> CALLING transaction 4"); } else { ALOGI(">>>>>> CALLING transaction %d", code); } #endif if (reply) { err = waitForResponse(reply); } else { Parcel fakeReply; err = waitForResponse(&fakeReply); } #if 0 if (code == 4) { // relayout ALOGI("<<<<<< RETURNING transaction 4"); } else { ALOGI("<<<<<< RETURNING transaction %d", code); } #endif IF_LOG_TRANSACTIONS() { TextOutput::Bundle _b(alog); alog << "BR_REPLY thr " << (void*)pthread_self() << " / hand " << handle << ": "; if (reply) alog << indent << *reply << dedent << endl; else alog << "(none requested)" << endl; } } else { err = waitForResponse(NULL, NULL); } return err; } void IPCThreadState::incStrongHandle(int32_t handle) { LOG_REMOTEREFS("IPCThreadState::incStrongHandle(%d)\n", handle); mOut.writeInt32(BC_ACQUIRE); mOut.writeInt32(handle); } void IPCThreadState::decStrongHandle(int32_t handle) { LOG_REMOTEREFS("IPCThreadState::decStrongHandle(%d)\n", handle); mOut.writeInt32(BC_RELEASE); mOut.writeInt32(handle); } void IPCThreadState::incWeakHandle(int32_t handle) { LOG_REMOTEREFS("IPCThreadState::incWeakHandle(%d)\n", handle); mOut.writeInt32(BC_INCREFS); mOut.writeInt32(handle); } void IPCThreadState::decWeakHandle(int32_t handle) { LOG_REMOTEREFS("IPCThreadState::decWeakHandle(%d)\n", handle); mOut.writeInt32(BC_DECREFS); mOut.writeInt32(handle); } status_t IPCThreadState::attemptIncStrongHandle(int32_t handle) { LOG_REMOTEREFS("IPCThreadState::attemptIncStrongHandle(%d)\n", handle); mOut.writeInt32(BC_ATTEMPT_ACQUIRE); mOut.writeInt32(0); // xxx was thread priority mOut.writeInt32(handle); status_t result = UNKNOWN_ERROR; waitForResponse(NULL, &result); #if LOG_REFCOUNTS printf("IPCThreadState::attemptIncStrongHandle(%ld) = %s\n", handle, result == NO_ERROR ? "SUCCESS" : "FAILURE"); #endif return result; } void IPCThreadState::expungeHandle(int32_t handle, IBinder* binder) { #if LOG_REFCOUNTS printf("IPCThreadState::expungeHandle(%ld)\n", handle); #endif self()->mProcess->expungeHandle(handle, binder); } status_t IPCThreadState::requestDeathNotification(int32_t handle, BpBinder* proxy) { mOut.writeInt32(BC_REQUEST_DEATH_NOTIFICATION); mOut.writeInt32((int32_t)handle); mOut.writeInt32((int32_t)proxy); return NO_ERROR; } status_t IPCThreadState::clearDeathNotification(int32_t handle, BpBinder* proxy) { mOut.writeInt32(BC_CLEAR_DEATH_NOTIFICATION); mOut.writeInt32((int32_t)handle); mOut.writeInt32((int32_t)proxy); return NO_ERROR; } IPCThreadState::IPCThreadState() : mProcess(ProcessState::self()), mMyThreadId(androidGetTid()), mStrictModePolicy(0), mLastTransactionBinderFlags(0) { pthread_setspecific(gTLS, this); clearCaller(); mIn.setDataCapacity(256); mOut.setDataCapacity(256); } IPCThreadState::~IPCThreadState() { } status_t IPCThreadState::sendReply(const Parcel& reply, uint32_t flags) { status_t err; status_t statusBuffer; err = writeTransactionData(BC_REPLY, flags, -1, 0, reply, &statusBuffer); if (err < NO_ERROR) return err; return waitForResponse(NULL, NULL); } status_t IPCThreadState::waitForResponse(Parcel *reply, status_t *acquireResult) { int32_t cmd; int32_t err; while (1) { if ((err=talkWithDriver()) < NO_ERROR) break; err = mIn.errorCheck(); if (err < NO_ERROR) break; if (mIn.dataAvail() == 0) continue; cmd = mIn.readInt32(); IF_LOG_COMMANDS() { alog << "Processing waitForResponse Command: " << getReturnString(cmd) << endl; } switch (cmd) { case BR_TRANSACTION_COMPLETE: if (!reply && !acquireResult) goto finish; break; case BR_DEAD_REPLY: err = DEAD_OBJECT; goto finish; case BR_FAILED_REPLY: err = FAILED_TRANSACTION; goto finish; case BR_ACQUIRE_RESULT: { ALOG_ASSERT(acquireResult != NULL, "Unexpected brACQUIRE_RESULT"); const int32_t result = mIn.readInt32(); if (!acquireResult) continue; *acquireResult = result ? NO_ERROR : INVALID_OPERATION; } goto finish; case BR_REPLY: { binder_transaction_data tr; err = mIn.read(&tr, sizeof(tr)); ALOG_ASSERT(err == NO_ERROR, "Not enough command data for brREPLY"); if (err != NO_ERROR) goto finish; if (reply) { if ((tr.flags & TF_STATUS_CODE) == 0) { reply->ipcSetDataReference( reinterpret_cast(tr.data.ptr.buffer), tr.data_size, reinterpret_cast(tr.data.ptr.offsets), tr.offsets_size/sizeof(size_t), freeBuffer, this); } else { err = *static_cast(tr.data.ptr.buffer); freeBuffer(NULL, reinterpret_cast(tr.data.ptr.buffer), tr.data_size, reinterpret_cast(tr.data.ptr.offsets), tr.offsets_size/sizeof(size_t), this); } } else { freeBuffer(NULL, reinterpret_cast(tr.data.ptr.buffer), tr.data_size, reinterpret_cast(tr.data.ptr.offsets), tr.offsets_size/sizeof(size_t), this); continue; } } goto finish; default: err = executeCommand(cmd); if (err != NO_ERROR) goto finish; break; } } finish: if (err != NO_ERROR) { if (acquireResult) *acquireResult = err; if (reply) reply->setError(err); mLastError = err; } return err; } status_t IPCThreadState::talkWithDriver(bool doReceive) { if (mProcess->mDriverFD <= 0) { return -EBADF; } binder_write_read bwr; // Is the read buffer empty? const bool needRead = mIn.dataPosition() >= mIn.dataSize(); // We don't want to write anything if we are still reading // from data left in the input buffer and the caller // has requested to read the next data. const size_t outAvail = (!doReceive || needRead) ? mOut.dataSize() : 0; bwr.write_size = outAvail; bwr.write_buffer = (long unsigned int)mOut.data(); // This is what we'll read. if (doReceive && needRead) { bwr.read_size = mIn.dataCapacity(); bwr.read_buffer = (long unsigned int)mIn.data(); } else { bwr.read_size = 0; bwr.read_buffer = 0; } IF_LOG_COMMANDS() { TextOutput::Bundle _b(alog); if (outAvail != 0) { alog << "Sending commands to driver: " << indent; const void* cmds = (const void*)bwr.write_buffer; const void* end = ((const uint8_t*)cmds)+bwr.write_size; alog << HexDump(cmds, bwr.write_size) << endl; while (cmds < end) cmds = printCommand(alog, cmds); alog << dedent; } alog << "Size of receive buffer: " << bwr.read_size << ", needRead: " << needRead << ", doReceive: " << doReceive << endl; } // Return immediately if there is nothing to do. if ((bwr.write_size == 0) && (bwr.read_size == 0)) return NO_ERROR; bwr.write_consumed = 0; bwr.read_consumed = 0; status_t err; do { IF_LOG_COMMANDS() { alog << "About to read/write, write size = " << mOut.dataSize() << endl; } #if defined(HAVE_ANDROID_OS) if (ioctl(mProcess->mDriverFD, BINDER_WRITE_READ, &bwr) >= 0) err = NO_ERROR; else err = -errno; #else err = INVALID_OPERATION; #endif if (mProcess->mDriverFD <= 0) { err = -EBADF; } IF_LOG_COMMANDS() { alog << "Finished read/write, write size = " << mOut.dataSize() << endl; } } while (err == -EINTR); IF_LOG_COMMANDS() { alog << "Our err: " << (void*)err << ", write consumed: " << bwr.write_consumed << " (of " << mOut.dataSize() << "), read consumed: " << bwr.read_consumed << endl; } if (err >= NO_ERROR) { if (bwr.write_consumed > 0) { if (bwr.write_consumed < (ssize_t)mOut.dataSize()) mOut.remove(0, bwr.write_consumed); else mOut.setDataSize(0); } if (bwr.read_consumed > 0) { mIn.setDataSize(bwr.read_consumed); mIn.setDataPosition(0); } IF_LOG_COMMANDS() { TextOutput::Bundle _b(alog); alog << "Remaining data size: " << mOut.dataSize() << endl; alog << "Received commands from driver: " << indent; const void* cmds = mIn.data(); const void* end = mIn.data() + mIn.dataSize(); alog << HexDump(cmds, mIn.dataSize()) << endl; while (cmds < end) cmds = printReturnCommand(alog, cmds); alog << dedent; } return NO_ERROR; } return err; } status_t IPCThreadState::writeTransactionData(int32_t cmd, uint32_t binderFlags, int32_t handle, uint32_t code, const Parcel& data, status_t* statusBuffer) { binder_transaction_data tr; tr.target.handle = handle; tr.code = code; tr.flags = binderFlags; tr.cookie = 0; tr.sender_pid = 0; tr.sender_euid = 0; const status_t err = data.errorCheck(); if (err == NO_ERROR) { tr.data_size = data.ipcDataSize(); tr.data.ptr.buffer = data.ipcData(); tr.offsets_size = data.ipcObjectsCount()*sizeof(size_t); tr.data.ptr.offsets = data.ipcObjects(); } else if (statusBuffer) { tr.flags |= TF_STATUS_CODE; *statusBuffer = err; tr.data_size = sizeof(status_t); tr.data.ptr.buffer = statusBuffer; tr.offsets_size = 0; tr.data.ptr.offsets = NULL; } else { return (mLastError = err); } mOut.writeInt32(cmd); mOut.write(&tr, sizeof(tr)); return NO_ERROR; } sp the_context_object; void setTheContextObject(sp obj) { the_context_object = obj; } status_t IPCThreadState::executeCommand(int32_t cmd) { BBinder* obj; RefBase::weakref_type* refs; status_t result = NO_ERROR; switch (cmd) { case BR_ERROR: result = mIn.readInt32(); break; case BR_OK: break; case BR_ACQUIRE: refs = (RefBase::weakref_type*)mIn.readInt32(); obj = (BBinder*)mIn.readInt32(); ALOG_ASSERT(refs->refBase() == obj, "BR_ACQUIRE: object %p does not match cookie %p (expected %p)", refs, obj, refs->refBase()); obj->incStrong(mProcess.get()); IF_LOG_REMOTEREFS() { LOG_REMOTEREFS("BR_ACQUIRE from driver on %p", obj); obj->printRefs(); } mOut.writeInt32(BC_ACQUIRE_DONE); mOut.writeInt32((int32_t)refs); mOut.writeInt32((int32_t)obj); break; case BR_RELEASE: refs = (RefBase::weakref_type*)mIn.readInt32(); obj = (BBinder*)mIn.readInt32(); ALOG_ASSERT(refs->refBase() == obj, "BR_RELEASE: object %p does not match cookie %p (expected %p)", refs, obj, refs->refBase()); IF_LOG_REMOTEREFS() { LOG_REMOTEREFS("BR_RELEASE from driver on %p", obj); obj->printRefs(); } mPendingStrongDerefs.push(obj); break; case BR_INCREFS: refs = (RefBase::weakref_type*)mIn.readInt32(); obj = (BBinder*)mIn.readInt32(); refs->incWeak(mProcess.get()); mOut.writeInt32(BC_INCREFS_DONE); mOut.writeInt32((int32_t)refs); mOut.writeInt32((int32_t)obj); break; case BR_DECREFS: refs = (RefBase::weakref_type*)mIn.readInt32(); obj = (BBinder*)mIn.readInt32(); // NOTE: This assertion is not valid, because the object may no // longer exist (thus the (BBinder*)cast above resulting in a different // memory address). //ALOG_ASSERT(refs->refBase() == obj, // "BR_DECREFS: object %p does not match cookie %p (expected %p)", // refs, obj, refs->refBase()); mPendingWeakDerefs.push(refs); break; case BR_ATTEMPT_ACQUIRE: refs = (RefBase::weakref_type*)mIn.readInt32(); obj = (BBinder*)mIn.readInt32(); { const bool success = refs->attemptIncStrong(mProcess.get()); ALOG_ASSERT(success && refs->refBase() == obj, "BR_ATTEMPT_ACQUIRE: object %p does not match cookie %p (expected %p)", refs, obj, refs->refBase()); mOut.writeInt32(BC_ACQUIRE_RESULT); mOut.writeInt32((int32_t)success); } break; case BR_TRANSACTION: { binder_transaction_data tr; result = mIn.read(&tr, sizeof(tr)); ALOG_ASSERT(result == NO_ERROR, "Not enough command data for brTRANSACTION"); if (result != NO_ERROR) break; Parcel buffer; buffer.ipcSetDataReference( reinterpret_cast(tr.data.ptr.buffer), tr.data_size, reinterpret_cast(tr.data.ptr.offsets), tr.offsets_size/sizeof(size_t), freeBuffer, this); const pid_t origPid = mCallingPid; const uid_t origUid = mCallingUid; mCallingPid = tr.sender_pid; mCallingUid = tr.sender_euid; int curPrio = getpriority(PRIO_PROCESS, mMyThreadId); if (gDisableBackgroundScheduling) { if (curPrio > ANDROID_PRIORITY_NORMAL) { // We have inherited a reduced priority from the caller, but do not // want to run in that state in this process. The driver set our // priority already (though not our scheduling class), so bounce // it back to the default before invoking the transaction. setpriority(PRIO_PROCESS, mMyThreadId, ANDROID_PRIORITY_NORMAL); } } else { if (curPrio >= ANDROID_PRIORITY_BACKGROUND) { // We want to use the inherited priority from the caller. // Ensure this thread is in the background scheduling class, // since the driver won't modify scheduling classes for us. // The scheduling group is reset to default by the caller // once this method returns after the transaction is complete. set_sched_policy(mMyThreadId, SP_BACKGROUND); } } //ALOGI(">>>> TRANSACT from pid %d uid %d\n", mCallingPid, mCallingUid); Parcel reply; IF_LOG_TRANSACTIONS() { TextOutput::Bundle _b(alog); alog << "BR_TRANSACTION thr " << (void*)pthread_self() << " / obj " << tr.target.ptr << " / code " << TypeCode(tr.code) << ": " << indent << buffer << dedent << endl << "Data addr = " << reinterpret_cast(tr.data.ptr.buffer) << ", offsets addr=" << reinterpret_cast(tr.data.ptr.offsets) << endl; } if (tr.target.ptr) { sp b((BBinder*)tr.cookie); const status_t error = b->transact(tr.code, buffer, &reply, tr.flags); if (error < NO_ERROR) reply.setError(error); } else { const status_t error = the_context_object->transact(tr.code, buffer, &reply, tr.flags); if (error < NO_ERROR) reply.setError(error); } //ALOGI("<<<< TRANSACT from pid %d restore pid %d uid %d\n", // mCallingPid, origPid, origUid); if ((tr.flags & TF_ONE_WAY) == 0) { LOG_ONEWAY("Sending reply to %d!", mCallingPid); sendReply(reply, 0); } else { LOG_ONEWAY("NOT sending reply to %d!", mCallingPid); } mCallingPid = origPid; mCallingUid = origUid; IF_LOG_TRANSACTIONS() { TextOutput::Bundle _b(alog); alog << "BC_REPLY thr " << (void*)pthread_self() << " / obj " << tr.target.ptr << ": " << indent << reply << dedent << endl; } } break; case BR_DEAD_BINDER: { BpBinder *proxy = (BpBinder*)mIn.readInt32(); proxy->sendObituary(); mOut.writeInt32(BC_DEAD_BINDER_DONE); mOut.writeInt32((int32_t)proxy); } break; case BR_CLEAR_DEATH_NOTIFICATION_DONE: { BpBinder *proxy = (BpBinder*)mIn.readInt32(); proxy->getWeakRefs()->decWeak(proxy); } break; case BR_FINISHED: result = TIMED_OUT; break; case BR_NOOP: break; case BR_SPAWN_LOOPER: mProcess->spawnPooledThread(false); break; default: printf("*** BAD COMMAND %d received from Binder driver\n", cmd); result = UNKNOWN_ERROR; break; } if (result != NO_ERROR) { mLastError = result; } return result; } void IPCThreadState::threadDestructor(void *st) { IPCThreadState* const self = static_cast(st); if (self) { self->flushCommands(); #if defined(HAVE_ANDROID_OS) if (self->mProcess->mDriverFD > 0) { ioctl(self->mProcess->mDriverFD, BINDER_THREAD_EXIT, 0); } #endif delete self; } } void IPCThreadState::freeBuffer(Parcel* parcel, const uint8_t* data, size_t dataSize, const size_t* objects, size_t objectsSize, void* cookie) { //ALOGI("Freeing parcel %p", &parcel); IF_LOG_COMMANDS() { alog << "Writing BC_FREE_BUFFER for " << data << endl; } ALOG_ASSERT(data != NULL, "Called with NULL data"); if (parcel != NULL) parcel->closeFileDescriptors(); IPCThreadState* state = self(); state->mOut.writeInt32(BC_FREE_BUFFER); state->mOut.writeInt32((int32_t)data); } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/binder/IMemory.cpp0000644000015700001700000003404012200324306023771 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "IMemory" #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef USE_V4L2_ION #include "ion.h" #endif #define VERBOSE 0 namespace android { // --------------------------------------------------------------------------- class HeapCache : public IBinder::DeathRecipient { public: HeapCache(); virtual ~HeapCache(); virtual void binderDied(const wp& who); sp find_heap(const sp& binder); void free_heap(const sp& binder); sp get_heap(const sp& binder); void dump_heaps(); private: // For IMemory.cpp struct heap_info_t { sp heap; int32_t count; }; void free_heap(const wp& binder); Mutex mHeapCacheLock; KeyedVector< wp, heap_info_t > mHeapCache; }; static sp gHeapCache = new HeapCache(); /******************************************************************************/ enum { HEAP_ID = IBinder::FIRST_CALL_TRANSACTION }; class BpMemoryHeap : public BpInterface { public: BpMemoryHeap(const sp& impl); virtual ~BpMemoryHeap(); virtual int getHeapID() const; virtual void* getBase() const; virtual size_t getSize() const; virtual uint32_t getFlags() const; virtual uint32_t getOffset() const; private: friend class IMemory; friend class HeapCache; // for debugging in this module static inline sp find_heap(const sp& binder) { return gHeapCache->find_heap(binder); } static inline void free_heap(const sp& binder) { gHeapCache->free_heap(binder); } static inline sp get_heap(const sp& binder) { return gHeapCache->get_heap(binder); } static inline void dump_heaps() { gHeapCache->dump_heaps(); } void assertMapped() const; void assertReallyMapped() const; mutable volatile int32_t mHeapId; mutable void* mBase; mutable size_t mSize; mutable uint32_t mFlags; mutable uint32_t mOffset; mutable bool mRealHeap; mutable Mutex mLock; }; // ---------------------------------------------------------------------------- enum { GET_MEMORY = IBinder::FIRST_CALL_TRANSACTION }; class BpMemory : public BpInterface { public: BpMemory(const sp& impl); virtual ~BpMemory(); virtual sp getMemory(ssize_t* offset=0, size_t* size=0) const; private: mutable sp mHeap; mutable ssize_t mOffset; mutable size_t mSize; }; /******************************************************************************/ void* IMemory::fastPointer(const sp& binder, ssize_t offset) const { sp realHeap = BpMemoryHeap::get_heap(binder); void* const base = realHeap->base(); if (base == MAP_FAILED) return 0; return static_cast(base) + offset; } void* IMemory::pointer() const { ssize_t offset; sp heap = getMemory(&offset); void* const base = heap!=0 ? heap->base() : MAP_FAILED; if (base == MAP_FAILED) return 0; return static_cast(base) + offset; } size_t IMemory::size() const { size_t size; getMemory(NULL, &size); return size; } ssize_t IMemory::offset() const { ssize_t offset; getMemory(&offset); return offset; } /******************************************************************************/ BpMemory::BpMemory(const sp& impl) : BpInterface(impl), mOffset(0), mSize(0) { } BpMemory::~BpMemory() { } sp BpMemory::getMemory(ssize_t* offset, size_t* size) const { if (mHeap == 0) { Parcel data, reply; data.writeInterfaceToken(IMemory::getInterfaceDescriptor()); if (remote()->transact(GET_MEMORY, data, &reply) == NO_ERROR) { sp heap = reply.readStrongBinder(); ssize_t o = reply.readInt32(); size_t s = reply.readInt32(); if (heap != 0) { mHeap = interface_cast(heap); if (mHeap != 0) { mOffset = o; mSize = s; } } } } if (offset) *offset = mOffset; if (size) *size = mSize; return mHeap; } // --------------------------------------------------------------------------- IMPLEMENT_META_INTERFACE(Memory, "android.utils.IMemory"); BnMemory::BnMemory() { } BnMemory::~BnMemory() { } status_t BnMemory::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch(code) { case GET_MEMORY: { CHECK_INTERFACE(IMemory, data, reply); ssize_t offset; size_t size; reply->writeStrongBinder( getMemory(&offset, &size)->asBinder() ); reply->writeInt32(offset); reply->writeInt32(size); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } } /******************************************************************************/ BpMemoryHeap::BpMemoryHeap(const sp& impl) : BpInterface(impl), mHeapId(-1), mBase(MAP_FAILED), mSize(0), mFlags(0), mOffset(0), mRealHeap(false) { } BpMemoryHeap::~BpMemoryHeap() { if (mHeapId != -1) { close(mHeapId); if (mRealHeap) { // by construction we're the last one if (mBase != MAP_FAILED) { sp binder = const_cast(this)->asBinder(); if (VERBOSE) { ALOGD("UNMAPPING binder=%p, heap=%p, size=%d, fd=%d", binder.get(), this, mSize, mHeapId); CallStack stack; stack.update(); stack.dump("callstack"); } munmap(mBase, mSize); } } else { // remove from list only if it was mapped before sp binder = const_cast(this)->asBinder(); free_heap(binder); } } } void BpMemoryHeap::assertMapped() const { if (mHeapId == -1) { sp binder(const_cast(this)->asBinder()); sp heap(static_cast(find_heap(binder).get())); heap->assertReallyMapped(); if (heap->mBase != MAP_FAILED) { Mutex::Autolock _l(mLock); if (mHeapId == -1) { mBase = heap->mBase; mSize = heap->mSize; mOffset = heap->mOffset; android_atomic_write( dup( heap->mHeapId ), &mHeapId ); } } else { // something went wrong free_heap(binder); } } } void BpMemoryHeap::assertReallyMapped() const { if (mHeapId == -1) { // remote call without mLock held, worse case scenario, we end up // calling transact() from multiple threads, but that's not a problem, // only mmap below must be in the critical section. Parcel data, reply; data.writeInterfaceToken(IMemoryHeap::getInterfaceDescriptor()); status_t err = remote()->transact(HEAP_ID, data, &reply); int parcel_fd = reply.readFileDescriptor(); ssize_t size = reply.readInt32(); uint32_t flags = reply.readInt32(); uint32_t offset = reply.readInt32(); ALOGE_IF(err, "binder=%p transaction failed fd=%d, size=%ld, err=%d (%s)", asBinder().get(), parcel_fd, size, err, strerror(-err)); #ifdef USE_V4L2_ION int ion_client = -1; if (flags & USE_ION_FD) { ion_client = ion_client_create(); ALOGE_IF(ion_client < 0, "BpMemoryHeap : ion client creation error"); } #endif int fd = dup( parcel_fd ); ALOGE_IF(fd==-1, "cannot dup fd=%d, size=%ld, err=%d (%s)", parcel_fd, size, err, strerror(errno)); int access = PROT_READ; if (!(flags & READ_ONLY)) { access |= PROT_WRITE; } Mutex::Autolock _l(mLock); if (mHeapId == -1) { mRealHeap = true; #ifdef USE_V4L2_ION if (flags & USE_ION_FD) { if (ion_client < 0) mBase = MAP_FAILED; else mBase = ion_map(fd, size, offset); } else #endif mBase = mmap(0, size, access, MAP_SHARED, fd, offset); if (mBase == MAP_FAILED) { ALOGE("cannot map BpMemoryHeap (binder=%p), size=%ld, fd=%d (%s)", asBinder().get(), size, fd, strerror(errno)); close(fd); } else { mSize = size; mFlags = flags; mOffset = offset; android_atomic_write(fd, &mHeapId); } } #ifdef USE_V4L2_ION if (ion_client < 0) ion_client = -1; else ion_client_destroy(ion_client); #endif } } int BpMemoryHeap::getHeapID() const { assertMapped(); return mHeapId; } void* BpMemoryHeap::getBase() const { assertMapped(); return mBase; } size_t BpMemoryHeap::getSize() const { assertMapped(); return mSize; } uint32_t BpMemoryHeap::getFlags() const { assertMapped(); return mFlags; } uint32_t BpMemoryHeap::getOffset() const { assertMapped(); return mOffset; } // --------------------------------------------------------------------------- IMPLEMENT_META_INTERFACE(MemoryHeap, "android.utils.IMemoryHeap"); BnMemoryHeap::BnMemoryHeap() { } BnMemoryHeap::~BnMemoryHeap() { } status_t BnMemoryHeap::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch(code) { case HEAP_ID: { CHECK_INTERFACE(IMemoryHeap, data, reply); reply->writeFileDescriptor(getHeapID()); reply->writeInt32(getSize()); reply->writeInt32(getFlags()); reply->writeInt32(getOffset()); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } } /*****************************************************************************/ HeapCache::HeapCache() : DeathRecipient() { } HeapCache::~HeapCache() { } void HeapCache::binderDied(const wp& binder) { //ALOGD("binderDied binder=%p", binder.unsafe_get()); free_heap(binder); } sp HeapCache::find_heap(const sp& binder) { Mutex::Autolock _l(mHeapCacheLock); ssize_t i = mHeapCache.indexOfKey(binder); if (i>=0) { heap_info_t& info = mHeapCache.editValueAt(i); ALOGD_IF(VERBOSE, "found binder=%p, heap=%p, size=%d, fd=%d, count=%d", binder.get(), info.heap.get(), static_cast(info.heap.get())->mSize, static_cast(info.heap.get())->mHeapId, info.count); android_atomic_inc(&info.count); return info.heap; } else { heap_info_t info; info.heap = interface_cast(binder); info.count = 1; //ALOGD("adding binder=%p, heap=%p, count=%d", // binder.get(), info.heap.get(), info.count); mHeapCache.add(binder, info); return info.heap; } } void HeapCache::free_heap(const sp& binder) { free_heap( wp(binder) ); } void HeapCache::free_heap(const wp& binder) { sp rel; { Mutex::Autolock _l(mHeapCacheLock); ssize_t i = mHeapCache.indexOfKey(binder); if (i>=0) { heap_info_t& info(mHeapCache.editValueAt(i)); int32_t c = android_atomic_dec(&info.count); if (c == 1) { ALOGD_IF(VERBOSE, "removing binder=%p, heap=%p, size=%d, fd=%d, count=%d", binder.unsafe_get(), info.heap.get(), static_cast(info.heap.get())->mSize, static_cast(info.heap.get())->mHeapId, info.count); rel = mHeapCache.valueAt(i).heap; mHeapCache.removeItemsAt(i); } } else { ALOGE("free_heap binder=%p not found!!!", binder.unsafe_get()); } } } sp HeapCache::get_heap(const sp& binder) { sp realHeap; Mutex::Autolock _l(mHeapCacheLock); ssize_t i = mHeapCache.indexOfKey(binder); if (i>=0) realHeap = mHeapCache.valueAt(i).heap; else realHeap = interface_cast(binder); return realHeap; } void HeapCache::dump_heaps() { Mutex::Autolock _l(mHeapCacheLock); int c = mHeapCache.size(); for (int i=0 ; i(info.heap.get())); ALOGD("hey=%p, heap=%p, count=%d, (fd=%d, base=%p, size=%d)", mHeapCache.keyAt(i).unsafe_get(), info.heap.get(), info.count, h->mHeapId, h->mBase, h->mSize); } } // --------------------------------------------------------------------------- }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/binder/Android.mk0000644000015700001700000000313512200324306023616 0ustar pbuserpbgroup00000000000000# Copyright (C) 2009 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # we have the common sources, plus some device-specific stuff sources := \ Binder.cpp \ BpBinder.cpp \ IInterface.cpp \ IMemory.cpp \ IPCThreadState.cpp \ IPermissionController.cpp \ IServiceManager.cpp \ MemoryDealer.cpp \ MemoryBase.cpp \ MemoryHeapBase.cpp \ Parcel.cpp \ PermissionCache.cpp \ ProcessState.cpp \ Static.cpp ifeq ($(BOARD_NEEDS_MEMORYHEAPPMEM),true) sources += \ MemoryHeapPmem.cpp endif LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) ifeq ($(BOARD_USE_V4L2_ION), true) LOCAL_CFLAGS += -DUSE_V4L2_ION sources += \ MemoryHeapBaseIon.cpp LOCAL_C_INCLUDES := hardware/samsung/exynos4/hal/include LOCAL_SHARED_LIBRARIES := libsecion endif LOCAL_LDLIBS += -lpthread LOCAL_MODULE := libbinder LOCAL_SHARED_LIBRARIES += liblog libcutils libutils LOCAL_SRC_FILES := $(sources) include $(BUILD_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_LDLIBS += -lpthread LOCAL_MODULE := libbinder LOCAL_SRC_FILES := $(sources) include $(BUILD_STATIC_LIBRARY) android-audiosystem-1.8+13.10.20130807/lib/binder/Binder.cpp0000644000015700001700000001346212200324306023620 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include #include #include namespace android { // --------------------------------------------------------------------------- IBinder::IBinder() : RefBase() { } IBinder::~IBinder() { } // --------------------------------------------------------------------------- sp IBinder::queryLocalInterface(const String16& descriptor) { return NULL; } BBinder* IBinder::localBinder() { return NULL; } BpBinder* IBinder::remoteBinder() { return NULL; } bool IBinder::checkSubclass(const void* /*subclassID*/) const { return false; } // --------------------------------------------------------------------------- class BBinder::Extras { public: Mutex mLock; BpBinder::ObjectManager mObjects; }; // --------------------------------------------------------------------------- BBinder::BBinder() : mExtras(NULL) { } bool BBinder::isBinderAlive() const { return true; } status_t BBinder::pingBinder() { return NO_ERROR; } const String16& BBinder::getInterfaceDescriptor() const { // This is a local static rather than a global static, // to avoid static initializer ordering issues. static String16 sEmptyDescriptor; ALOGW("reached BBinder::getInterfaceDescriptor (this=%p)", this); return sEmptyDescriptor; } status_t BBinder::transact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { data.setDataPosition(0); status_t err = NO_ERROR; switch (code) { case PING_TRANSACTION: reply->writeInt32(pingBinder()); break; default: err = onTransact(code, data, reply, flags); break; } if (reply != NULL) { reply->setDataPosition(0); } return err; } status_t BBinder::linkToDeath( const sp& recipient, void* cookie, uint32_t flags) { return INVALID_OPERATION; } status_t BBinder::unlinkToDeath( const wp& recipient, void* cookie, uint32_t flags, wp* outRecipient) { return INVALID_OPERATION; } status_t BBinder::dump(int fd, const Vector& args) { return NO_ERROR; } void BBinder::attachObject( const void* objectID, void* object, void* cleanupCookie, object_cleanup_func func) { Extras* e = mExtras; if (!e) { e = new Extras; if (android_atomic_cmpxchg(0, reinterpret_cast(e), reinterpret_cast(&mExtras)) != 0) { delete e; e = mExtras; } if (e == 0) return; // out of memory } AutoMutex _l(e->mLock); e->mObjects.attach(objectID, object, cleanupCookie, func); } void* BBinder::findObject(const void* objectID) const { Extras* e = mExtras; if (!e) return NULL; AutoMutex _l(e->mLock); return e->mObjects.find(objectID); } void BBinder::detachObject(const void* objectID) { Extras* e = mExtras; if (!e) return; AutoMutex _l(e->mLock); e->mObjects.detach(objectID); } BBinder* BBinder::localBinder() { return this; } BBinder::~BBinder() { if (mExtras) delete mExtras; } status_t BBinder::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case INTERFACE_TRANSACTION: reply->writeString16(getInterfaceDescriptor()); return NO_ERROR; case DUMP_TRANSACTION: { int fd = data.readFileDescriptor(); int argc = data.readInt32(); Vector args; for (int i = 0; i < argc && data.dataAvail() > 0; i++) { args.add(data.readString16()); } return dump(fd, args); } // case SYSPROPS_TRANSACTION: { // report_sysprop_change(); // return NO_ERROR; // } default: return UNKNOWN_TRANSACTION; } } // --------------------------------------------------------------------------- enum { // This is used to transfer ownership of the remote binder from // the BpRefBase object holding it (when it is constructed), to the // owner of the BpRefBase object when it first acquires that BpRefBase. kRemoteAcquired = 0x00000001 }; BpRefBase::BpRefBase(const sp& o) : mRemote(o.get()), mRefs(NULL), mState(0) { extendObjectLifetime(OBJECT_LIFETIME_WEAK); if (mRemote) { mRemote->incStrong(this); // Removed on first IncStrong(). mRefs = mRemote->createWeak(this); // Held for our entire lifetime. } } BpRefBase::~BpRefBase() { if (mRemote) { if (!(mState&kRemoteAcquired)) { mRemote->decStrong(this); } mRefs->decWeak(this); } } void BpRefBase::onFirstRef() { android_atomic_or(kRemoteAcquired, &mState); } void BpRefBase::onLastStrongRef(const void* id) { if (mRemote) { mRemote->decStrong(this); } } bool BpRefBase::onIncStrongAttempted(uint32_t flags, const void* id) { return mRemote ? mRefs->attemptIncStrong(this) : false; } // --------------------------------------------------------------------------- }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/binder/Static.cpp0000644000015700001700000000243512200324306023642 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // All static variables go here, to control initialization and // destruction order in the library. #include #include #include namespace android { // ------------ ProcessState.cpp Mutex gProcessMutex; sp gProcess; class LibUtilsIPCtStatics { public: LibUtilsIPCtStatics() { } ~LibUtilsIPCtStatics() { IPCThreadState::shutdown(); } }; static LibUtilsIPCtStatics gIPCStatics; // ------------ ServiceManager.cpp Mutex gDefaultServiceManagerLock; sp gDefaultServiceManager; sp gPermissionController; } // namespace android android-audiosystem-1.8+13.10.20130807/lib/binder/MemoryHeapPmem.cpp0000644000015700001700000001562212200324306025302 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "MemoryHeapPmem" #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_ANDROID_OS #include #endif namespace android { // --------------------------------------------------------------------------- MemoryHeapPmem::MemoryPmem::MemoryPmem(const sp& heap) : BnMemory(), mClientHeap(heap) { } MemoryHeapPmem::MemoryPmem::~MemoryPmem() { if (mClientHeap != NULL) { mClientHeap->remove(this); } } // --------------------------------------------------------------------------- class SubRegionMemory : public MemoryHeapPmem::MemoryPmem { public: SubRegionMemory(const sp& heap, ssize_t offset, size_t size); virtual ~SubRegionMemory(); virtual sp getMemory(ssize_t* offset, size_t* size) const; private: friend class MemoryHeapPmem; void revoke(); size_t mSize; ssize_t mOffset; }; SubRegionMemory::SubRegionMemory(const sp& heap, ssize_t offset, size_t size) : MemoryHeapPmem::MemoryPmem(heap), mSize(size), mOffset(offset) { #ifndef NDEBUG void* const start_ptr = (void*)(intptr_t(getHeap()->base()) + offset); memset(start_ptr, 0xda, size); #endif #ifdef HAVE_ANDROID_OS if (size > 0) { const size_t pagesize = getpagesize(); size = (size + pagesize-1) & ~(pagesize-1); int our_fd = heap->heapID(); struct pmem_region sub = { offset, size }; int err = ioctl(our_fd, PMEM_MAP, &sub); ALOGE_IF(err<0, "PMEM_MAP failed (%s), " "mFD=%d, sub.offset=%lu, sub.size=%lu", strerror(errno), our_fd, sub.offset, sub.len); } #endif } sp SubRegionMemory::getMemory(ssize_t* offset, size_t* size) const { if (offset) *offset = mOffset; if (size) *size = mSize; return getHeap(); } SubRegionMemory::~SubRegionMemory() { revoke(); } void SubRegionMemory::revoke() { // NOTE: revoke() doesn't need to be protected by a lock because it // can only be called from MemoryHeapPmem::revoke(), which means // that we can't be in ~SubRegionMemory(), or in ~SubRegionMemory(), // which means MemoryHeapPmem::revoke() wouldn't have been able to // promote() it. #ifdef HAVE_ANDROID_OS if (mSize != 0) { const sp& heap(getHeap()); int our_fd = heap->heapID(); struct pmem_region sub; sub.offset = mOffset; sub.len = mSize; int err = ioctl(our_fd, PMEM_UNMAP, &sub); ALOGE_IF(err<0, "PMEM_UNMAP failed (%s), " "mFD=%d, sub.offset=%lu, sub.size=%lu", strerror(errno), our_fd, sub.offset, sub.len); mSize = 0; } #endif } // --------------------------------------------------------------------------- MemoryHeapPmem::MemoryHeapPmem(const sp& pmemHeap, uint32_t flags) : MemoryHeapBase() { char const * const device = pmemHeap->getDevice(); #ifdef HAVE_ANDROID_OS if (device) { int fd = open(device, O_RDWR | (flags & NO_CACHING ? O_SYNC : 0)); ALOGE_IF(fd<0, "couldn't open %s (%s)", device, strerror(errno)); if (fd >= 0) { int err = ioctl(fd, PMEM_CONNECT, pmemHeap->heapID()); if (err < 0) { ALOGE("PMEM_CONNECT failed (%s), mFD=%d, sub-fd=%d", strerror(errno), fd, pmemHeap->heapID()); close(fd); } else { // everything went well... mParentHeap = pmemHeap; MemoryHeapBase::init(fd, pmemHeap->getBase(), pmemHeap->getSize(), pmemHeap->getFlags() | flags, device); } } } #else mParentHeap = pmemHeap; MemoryHeapBase::init( dup(pmemHeap->heapID()), pmemHeap->getBase(), pmemHeap->getSize(), pmemHeap->getFlags() | flags, device); #endif } MemoryHeapPmem::~MemoryHeapPmem() { } sp MemoryHeapPmem::mapMemory(size_t offset, size_t size) { sp memory = createMemory(offset, size); if (memory != 0) { Mutex::Autolock _l(mLock); mAllocations.add(memory); } return memory; } sp MemoryHeapPmem::createMemory( size_t offset, size_t size) { sp memory; if (heapID() > 0) memory = new SubRegionMemory(this, offset, size); return memory; } status_t MemoryHeapPmem::slap() { #ifdef HAVE_ANDROID_OS size_t size = getSize(); const size_t pagesize = getpagesize(); size = (size + pagesize-1) & ~(pagesize-1); int our_fd = getHeapID(); struct pmem_region sub = { 0, size }; int err = ioctl(our_fd, PMEM_MAP, &sub); ALOGE_IF(err<0, "PMEM_MAP failed (%s), " "mFD=%d, sub.offset=%lu, sub.size=%lu", strerror(errno), our_fd, sub.offset, sub.len); return -errno; #else return NO_ERROR; #endif } status_t MemoryHeapPmem::unslap() { #ifdef HAVE_ANDROID_OS size_t size = getSize(); const size_t pagesize = getpagesize(); size = (size + pagesize-1) & ~(pagesize-1); int our_fd = getHeapID(); struct pmem_region sub = { 0, size }; int err = ioctl(our_fd, PMEM_UNMAP, &sub); ALOGE_IF(err<0, "PMEM_UNMAP failed (%s), " "mFD=%d, sub.offset=%lu, sub.size=%lu", strerror(errno), our_fd, sub.offset, sub.len); return -errno; #else return NO_ERROR; #endif } void MemoryHeapPmem::revoke() { SortedVector< wp > allocations; { // scope for lock Mutex::Autolock _l(mLock); allocations = mAllocations; } ssize_t count = allocations.size(); for (ssize_t i=0 ; i memory(allocations[i].promote()); if (memory != 0) memory->revoke(); } } void MemoryHeapPmem::remove(const wp& memory) { Mutex::Autolock _l(mLock); mAllocations.remove(memory); } // --------------------------------------------------------------------------- }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/binder/build0000755000015700001700000000013012200324306022722 0ustar pbuserpbgroup00000000000000#!/bin/sh target='armel' make clean make -e ARCH=$target make -e ARCH=$target install android-audiosystem-1.8+13.10.20130807/lib/binder/MemoryHeapBase.cpp0000644000015700001700000001172512200324306025256 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "MemoryHeapBase" #include #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_ANDROID_OS #include #endif namespace android { // --------------------------------------------------------------------------- MemoryHeapBase::MemoryHeapBase() : mFD(-1), mSize(0), mBase(MAP_FAILED), mDevice(NULL), mNeedUnmap(false), mOffset(0) { } MemoryHeapBase::MemoryHeapBase(size_t size, uint32_t flags, char const * name) : mFD(-1), mSize(0), mBase(MAP_FAILED), mFlags(flags), mDevice(0), mNeedUnmap(false), mOffset(0) { const size_t pagesize = getpagesize(); size = ((size + pagesize-1) & ~(pagesize-1)); int fd = ashmem_create_region(name == NULL ? "MemoryHeapBase" : name, size); ALOGE_IF(fd<0, "error creating ashmem region: %s", strerror(errno)); if (fd >= 0) { if (mapfd(fd, size) == NO_ERROR) { if (flags & READ_ONLY) { ashmem_set_prot_region(fd, PROT_READ); } } } } MemoryHeapBase::MemoryHeapBase(const char* device, size_t size, uint32_t flags) : mFD(-1), mSize(0), mBase(MAP_FAILED), mFlags(flags), mDevice(0), mNeedUnmap(false), mOffset(0) { int open_flags = O_RDWR; if (flags & NO_CACHING) open_flags |= O_SYNC; int fd = open(device, open_flags); ALOGE_IF(fd<0, "error opening %s: %s", device, strerror(errno)); if (fd >= 0) { const size_t pagesize = getpagesize(); size = ((size + pagesize-1) & ~(pagesize-1)); if (mapfd(fd, size) == NO_ERROR) { mDevice = device; } } } MemoryHeapBase::MemoryHeapBase(int fd, size_t size, uint32_t flags, uint32_t offset) : mFD(-1), mSize(0), mBase(MAP_FAILED), mFlags(flags), mDevice(0), mNeedUnmap(false), mOffset(0) { const size_t pagesize = getpagesize(); size = ((size + pagesize-1) & ~(pagesize-1)); mapfd(dup(fd), size, offset); } status_t MemoryHeapBase::init(int fd, void *base, int size, int flags, const char* device) { if (mFD != -1) { return INVALID_OPERATION; } mFD = fd; mBase = base; mSize = size; mFlags = flags; mDevice = device; return NO_ERROR; } status_t MemoryHeapBase::mapfd(int fd, size_t size, uint32_t offset) { if (size == 0) { // try to figure out the size automatically #ifdef HAVE_ANDROID_OS // first try the PMEM ioctl pmem_region reg; int err = ioctl(fd, PMEM_GET_TOTAL_SIZE, ®); if (err == 0) size = reg.len; #endif if (size == 0) { // try fstat struct stat sb; if (fstat(fd, &sb) == 0) size = sb.st_size; } // if it didn't work, let mmap() fail. } if ((mFlags & DONT_MAP_LOCALLY) == 0) { void* base = (uint8_t*)mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, offset); if (base == MAP_FAILED) { ALOGE("mmap(fd=%d, size=%u) failed (%s)", fd, uint32_t(size), strerror(errno)); close(fd); return -errno; } //ALOGD("mmap(fd=%d, base=%p, size=%lu)", fd, base, size); mBase = base; mNeedUnmap = true; } else { mBase = 0; // not MAP_FAILED mNeedUnmap = false; } mFD = fd; mSize = size; mOffset = offset; return NO_ERROR; } MemoryHeapBase::~MemoryHeapBase() { dispose(); } void MemoryHeapBase::dispose() { int fd = android_atomic_or(-1, &mFD); if (fd >= 0) { if (mNeedUnmap) { //ALOGD("munmap(fd=%d, base=%p, size=%lu)", fd, mBase, mSize); munmap(mBase, mSize); } mBase = 0; mSize = 0; close(fd); } } int MemoryHeapBase::getHeapID() const { return mFD; } void* MemoryHeapBase::getBase() const { return mBase; } size_t MemoryHeapBase::getSize() const { return mSize; } uint32_t MemoryHeapBase::getFlags() const { return mFlags; } const char* MemoryHeapBase::getDevice() const { return mDevice; } uint32_t MemoryHeapBase::getOffset() const { return mOffset; } // --------------------------------------------------------------------------- }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/binder/BpBinder.cpp0000644000015700001700000002353412200324306024103 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "BpBinder" //#define LOG_NDEBUG 0 #include #include #include #include //#undef ALOGV //#define ALOGV(...) fprintf(stderr, __VA_ARGS__) namespace android { // --------------------------------------------------------------------------- BpBinder::ObjectManager::ObjectManager() { } BpBinder::ObjectManager::~ObjectManager() { kill(); } void BpBinder::ObjectManager::attach( const void* objectID, void* object, void* cleanupCookie, IBinder::object_cleanup_func func) { entry_t e; e.object = object; e.cleanupCookie = cleanupCookie; e.func = func; if (mObjects.indexOfKey(objectID) >= 0) { ALOGE("Trying to attach object ID %p to binder ObjectManager %p with object %p, but object ID already in use", objectID, this, object); return; } mObjects.add(objectID, e); } void* BpBinder::ObjectManager::find(const void* objectID) const { const ssize_t i = mObjects.indexOfKey(objectID); if (i < 0) return NULL; return mObjects.valueAt(i).object; } void BpBinder::ObjectManager::detach(const void* objectID) { mObjects.removeItem(objectID); } void BpBinder::ObjectManager::kill() { const size_t N = mObjects.size(); ALOGV("Killing %d objects in manager %p", N, this); for (size_t i=0; iincWeakHandle(handle); } bool BpBinder::isDescriptorCached() const { Mutex::Autolock _l(mLock); return mDescriptorCache.size() ? true : false; } const String16& BpBinder::getInterfaceDescriptor() const { if (isDescriptorCached() == false) { Parcel send, reply; // do the IPC without a lock held. status_t err = const_cast(this)->transact( INTERFACE_TRANSACTION, send, &reply); if (err == NO_ERROR) { String16 res(reply.readString16()); Mutex::Autolock _l(mLock); // mDescriptorCache could have been assigned while the lock was // released. if (mDescriptorCache.size() == 0) mDescriptorCache = res; } } // we're returning a reference to a non-static object here. Usually this // is not something smart to do, however, with binder objects it is // (usually) safe because they are reference-counted. return mDescriptorCache; } bool BpBinder::isBinderAlive() const { return mAlive != 0; } status_t BpBinder::pingBinder() { Parcel send; Parcel reply; status_t err = transact(PING_TRANSACTION, send, &reply); if (err != NO_ERROR) return err; if (reply.dataSize() < sizeof(status_t)) return NOT_ENOUGH_DATA; return (status_t)reply.readInt32(); } status_t BpBinder::dump(int fd, const Vector& args) { Parcel send; Parcel reply; send.writeFileDescriptor(fd); const size_t numArgs = args.size(); send.writeInt32(numArgs); for (size_t i = 0; i < numArgs; i++) { send.writeString16(args[i]); } status_t err = transact(DUMP_TRANSACTION, send, &reply); return err; } status_t BpBinder::transact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { // Once a binder has died, it will never come back to life. if (mAlive) { status_t status = IPCThreadState::self()->transact( mHandle, code, data, reply, flags); if (status == DEAD_OBJECT) mAlive = 0; return status; } return DEAD_OBJECT; } status_t BpBinder::linkToDeath( const sp& recipient, void* cookie, uint32_t flags) { Obituary ob; ob.recipient = recipient; ob.cookie = cookie; ob.flags = flags; LOG_ALWAYS_FATAL_IF(recipient == NULL, "linkToDeath(): recipient must be non-NULL"); { AutoMutex _l(mLock); if (!mObitsSent) { if (!mObituaries) { mObituaries = new Vector; if (!mObituaries) { return NO_MEMORY; } ALOGV("Requesting death notification: %p handle %d\n", this, mHandle); getWeakRefs()->incWeak(this); IPCThreadState* self = IPCThreadState::self(); self->requestDeathNotification(mHandle, this); self->flushCommands(); } ssize_t res = mObituaries->add(ob); return res >= (ssize_t)NO_ERROR ? (status_t)NO_ERROR : res; } } return DEAD_OBJECT; } status_t BpBinder::unlinkToDeath( const wp& recipient, void* cookie, uint32_t flags, wp* outRecipient) { AutoMutex _l(mLock); if (mObitsSent) { return DEAD_OBJECT; } const size_t N = mObituaries ? mObituaries->size() : 0; for (size_t i=0; iitemAt(i); if ((obit.recipient == recipient || (recipient == NULL && obit.cookie == cookie)) && obit.flags == flags) { const uint32_t allFlags = obit.flags|flags; if (outRecipient != NULL) { *outRecipient = mObituaries->itemAt(i).recipient; } mObituaries->removeAt(i); if (mObituaries->size() == 0) { ALOGV("Clearing death notification: %p handle %d\n", this, mHandle); IPCThreadState* self = IPCThreadState::self(); self->clearDeathNotification(mHandle, this); self->flushCommands(); delete mObituaries; mObituaries = NULL; } return NO_ERROR; } } return NAME_NOT_FOUND; } void BpBinder::sendObituary() { ALOGV("Sending obituary for proxy %p handle %d, mObitsSent=%s\n", this, mHandle, mObitsSent ? "true" : "false"); mAlive = 0; if (mObitsSent) return; mLock.lock(); Vector* obits = mObituaries; if(obits != NULL) { ALOGV("Clearing sent death notification: %p handle %d\n", this, mHandle); IPCThreadState* self = IPCThreadState::self(); self->clearDeathNotification(mHandle, this); self->flushCommands(); mObituaries = NULL; } mObitsSent = 1; mLock.unlock(); ALOGV("Reporting death of proxy %p for %d recipients\n", this, obits ? obits->size() : 0); if (obits != NULL) { const size_t N = obits->size(); for (size_t i=0; iitemAt(i)); } delete obits; } } void BpBinder::reportOneDeath(const Obituary& obit) { sp recipient = obit.recipient.promote(); ALOGV("Reporting death to recipient: %p\n", recipient.get()); if (recipient == NULL) return; recipient->binderDied(this); } void BpBinder::attachObject( const void* objectID, void* object, void* cleanupCookie, object_cleanup_func func) { AutoMutex _l(mLock); ALOGV("Attaching object %p to binder %p (manager=%p)", object, this, &mObjects); mObjects.attach(objectID, object, cleanupCookie, func); } void* BpBinder::findObject(const void* objectID) const { AutoMutex _l(mLock); return mObjects.find(objectID); } void BpBinder::detachObject(const void* objectID) { AutoMutex _l(mLock); mObjects.detach(objectID); } BpBinder* BpBinder::remoteBinder() { return this; } BpBinder::~BpBinder() { ALOGV("Destroying BpBinder %p handle %d\n", this, mHandle); IPCThreadState* ipc = IPCThreadState::self(); mLock.lock(); Vector* obits = mObituaries; if(obits != NULL) { if (ipc) ipc->clearDeathNotification(mHandle, this); mObituaries = NULL; } mLock.unlock(); if (obits != NULL) { // XXX Should we tell any remaining DeathRecipient // objects that the last strong ref has gone away, so they // are no longer linked? delete obits; } if (ipc) { ipc->expungeHandle(mHandle, this); ipc->decWeakHandle(mHandle); } } void BpBinder::onFirstRef() { ALOGV("onFirstRef BpBinder %p handle %d\n", this, mHandle); IPCThreadState* ipc = IPCThreadState::self(); if (ipc) ipc->incStrongHandle(mHandle); } void BpBinder::onLastStrongRef(const void* id) { ALOGV("onLastStrongRef BpBinder %p handle %d\n", this, mHandle); IF_ALOGV() { printRefs(); } IPCThreadState* ipc = IPCThreadState::self(); if (ipc) ipc->decStrongHandle(mHandle); } bool BpBinder::onIncStrongAttempted(uint32_t flags, const void* id) { ALOGV("onIncStrongAttempted BpBinder %p handle %d\n", this, mHandle); IPCThreadState* ipc = IPCThreadState::self(); return ipc ? ipc->attemptIncStrongHandle(mHandle) == NO_ERROR : false; } // --------------------------------------------------------------------------- }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/binder/MemoryBase.cpp0000644000015700001700000000232512200324306024454 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include namespace android { // --------------------------------------------------------------------------- MemoryBase::MemoryBase(const sp& heap, ssize_t offset, size_t size) : mSize(size), mOffset(offset), mHeap(heap) { } sp MemoryBase::getMemory(ssize_t* offset, size_t* size) const { if (offset) *offset = mOffset; if (size) *size = mSize; return mHeap; } MemoryBase::~MemoryBase() { } // --------------------------------------------------------------------------- }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/binder/Makefile0000644000015700001700000000344612200324306023352 0ustar pbuserpbgroup00000000000000make_home := ../../ top_srcdir := ../../ include $(make_home)/project_make WARN = -Wall include $(make_home)/package_make include ../Makefile.defines ####################### # CUSTOMIZE MACROS HERE ####################### # name your library here PKG_LIB = binder # at least one of following lines must be uncommented # CFILES is .c # CCFILES is .cc # CPPFILES is .cpp # CXXFILES is .cxx CPPFILES = Binder.cpp \ BpBinder.cpp \ IInterface.cpp \ IMemory.cpp \ IPCThreadState.cpp \ IPermissionController.cpp \ IServiceManager.cpp \ MemoryBase.cpp \ MemoryDealer.cpp \ MemoryHeapBase.cpp \ Parcel.cpp \ PermissionCache.cpp \ ProcessState.cpp \ Static.cpp #CCFILES = #CPPFILES = #CXXFILES = FORCE_CXX_LINK = TRUE # if this library depends on private static library built # by this package, uncomment next line #STATIC_LIBS = # modify compiler command-line options CFLAGS = -fPIC -DHAVE_ANDROID_OS=1 -DANDROID_LOG_STDOUT $(CONFIG_DEFINES) # modify linker command-line options LDFLAGS += -L ../liblog SHARED_LIBS += -llog # build private static library private_lib = YES # build simple shared library # single header file exported, should be .../lib/include/$(PKG_LIB).h PKGCONFIG = NO # build pkgconfig shared library # change PKGCONFIG to YES and add following three macros # PKG_LIBDESC is one line description of library # PKG_REQUIRES is list of required pkgconfig libraries # PKG_HEADERS is list of header files to export #PKG_LIBDESC = #PKG_REQUIRES = #PKG_HEADERS = MAKESUBDIR = YES LIBSUBDIR = /$(install_lib_rel) HDRSUBDIR = /$(install_hdr_rel) ############################ # END OF MACROS TO CUSTOMIZE ############################ all: $(TARGET) #-include $(DEPENDS) include $(make_home)/target_lib android-audiosystem-1.8+13.10.20130807/lib/binder/Parcel.cpp0000644000015700001700000012560012200324306023621 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "Parcel" //#define LOG_NDEBUG 0 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef INT32_MAX #define INT32_MAX ((int32_t)(2147483647)) #endif #define LOG_REFS(...) //#define LOG_REFS(...) ALOG(LOG_DEBUG, "Parcel", __VA_ARGS__) // --------------------------------------------------------------------------- #define PAD_SIZE(s) (((s)+3)&~3) // Note: must be kept in sync with android/os/StrictMode.java's PENALTY_GATHER #define STRICT_MODE_PENALTY_GATHER 0x100 // Note: must be kept in sync with android/os/Parcel.java's EX_HAS_REPLY_HEADER #define EX_HAS_REPLY_HEADER -128 // Maximum size of a blob to transfer in-place. static const size_t IN_PLACE_BLOB_LIMIT = 40 * 1024; // XXX This can be made public if we want to provide // support for typed data. struct small_flat_data { uint32_t type; uint32_t data; }; namespace android { void acquire_object(const sp& proc, const flat_binder_object& obj, const void* who) { switch (obj.type) { case BINDER_TYPE_BINDER: if (obj.binder) { LOG_REFS("Parcel %p acquiring reference on local %p", who, obj.cookie); static_cast(obj.cookie)->incStrong(who); } return; case BINDER_TYPE_WEAK_BINDER: if (obj.binder) static_cast(obj.binder)->incWeak(who); return; case BINDER_TYPE_HANDLE: { const sp b = proc->getStrongProxyForHandle(obj.handle); if (b != NULL) { LOG_REFS("Parcel %p acquiring reference on remote %p", who, b.get()); b->incStrong(who); } return; } case BINDER_TYPE_WEAK_HANDLE: { const wp b = proc->getWeakProxyForHandle(obj.handle); if (b != NULL) b.get_refs()->incWeak(who); return; } case BINDER_TYPE_FD: { // intentionally blank -- nothing to do to acquire this, but we do // recognize it as a legitimate object type. return; } } ALOGD("Invalid object type 0x%08lx", obj.type); } void release_object(const sp& proc, const flat_binder_object& obj, const void* who) { switch (obj.type) { case BINDER_TYPE_BINDER: if (obj.binder) { LOG_REFS("Parcel %p releasing reference on local %p", who, obj.cookie); static_cast(obj.cookie)->decStrong(who); } return; case BINDER_TYPE_WEAK_BINDER: if (obj.binder) static_cast(obj.binder)->decWeak(who); return; case BINDER_TYPE_HANDLE: { const sp b = proc->getStrongProxyForHandle(obj.handle); if (b != NULL) { LOG_REFS("Parcel %p releasing reference on remote %p", who, b.get()); b->decStrong(who); } return; } case BINDER_TYPE_WEAK_HANDLE: { const wp b = proc->getWeakProxyForHandle(obj.handle); if (b != NULL) b.get_refs()->decWeak(who); return; } case BINDER_TYPE_FD: { if (obj.cookie != (void*)0) close(obj.handle); return; } } ALOGE("Invalid object type 0x%08lx", obj.type); } inline static status_t finish_flatten_binder( const sp& binder, const flat_binder_object& flat, Parcel* out) { return out->writeObject(flat, false); } status_t flatten_binder(const sp& proc, const sp& binder, Parcel* out) { flat_binder_object obj; obj.flags = 0x7f | FLAT_BINDER_FLAG_ACCEPTS_FDS; if (binder != NULL) { IBinder *local = binder->localBinder(); if (!local) { BpBinder *proxy = binder->remoteBinder(); if (proxy == NULL) { ALOGE("null proxy"); } const int32_t handle = proxy ? proxy->handle() : 0; obj.type = BINDER_TYPE_HANDLE; obj.handle = handle; obj.cookie = NULL; } else { obj.type = BINDER_TYPE_BINDER; obj.binder = local->getWeakRefs(); obj.cookie = local; } } else { obj.type = BINDER_TYPE_BINDER; obj.binder = NULL; obj.cookie = NULL; } return finish_flatten_binder(binder, obj, out); } status_t flatten_binder(const sp& proc, const wp& binder, Parcel* out) { flat_binder_object obj; obj.flags = 0x7f | FLAT_BINDER_FLAG_ACCEPTS_FDS; if (binder != NULL) { sp real = binder.promote(); if (real != NULL) { IBinder *local = real->localBinder(); if (!local) { BpBinder *proxy = real->remoteBinder(); if (proxy == NULL) { ALOGE("null proxy"); } const int32_t handle = proxy ? proxy->handle() : 0; obj.type = BINDER_TYPE_WEAK_HANDLE; obj.handle = handle; obj.cookie = NULL; } else { obj.type = BINDER_TYPE_WEAK_BINDER; obj.binder = binder.get_refs(); obj.cookie = binder.unsafe_get(); } return finish_flatten_binder(real, obj, out); } // XXX How to deal? In order to flatten the given binder, // we need to probe it for information, which requires a primary // reference... but we don't have one. // // The OpenBinder implementation uses a dynamic_cast<> here, // but we can't do that with the different reference counting // implementation we are using. ALOGE("Unable to unflatten Binder weak reference!"); obj.type = BINDER_TYPE_BINDER; obj.binder = NULL; obj.cookie = NULL; return finish_flatten_binder(NULL, obj, out); } else { obj.type = BINDER_TYPE_BINDER; obj.binder = NULL; obj.cookie = NULL; return finish_flatten_binder(NULL, obj, out); } } inline static status_t finish_unflatten_binder( BpBinder* proxy, const flat_binder_object& flat, const Parcel& in) { return NO_ERROR; } status_t unflatten_binder(const sp& proc, const Parcel& in, sp* out) { const flat_binder_object* flat = in.readObject(false); if (flat) { switch (flat->type) { case BINDER_TYPE_BINDER: *out = static_cast(flat->cookie); return finish_unflatten_binder(NULL, *flat, in); case BINDER_TYPE_HANDLE: *out = proc->getStrongProxyForHandle(flat->handle); return finish_unflatten_binder( static_cast(out->get()), *flat, in); } } return BAD_TYPE; } status_t unflatten_binder(const sp& proc, const Parcel& in, wp* out) { const flat_binder_object* flat = in.readObject(false); if (flat) { switch (flat->type) { case BINDER_TYPE_BINDER: *out = static_cast(flat->cookie); return finish_unflatten_binder(NULL, *flat, in); case BINDER_TYPE_WEAK_BINDER: if (flat->binder != NULL) { out->set_object_and_refs( static_cast(flat->cookie), static_cast(flat->binder)); } else { *out = NULL; } return finish_unflatten_binder(NULL, *flat, in); case BINDER_TYPE_HANDLE: case BINDER_TYPE_WEAK_HANDLE: *out = proc->getWeakProxyForHandle(flat->handle); return finish_unflatten_binder( static_cast(out->unsafe_get()), *flat, in); } } return BAD_TYPE; } // --------------------------------------------------------------------------- Parcel::Parcel() { initState(); } Parcel::~Parcel() { freeDataNoInit(); } const uint8_t* Parcel::data() const { return mData; } size_t Parcel::dataSize() const { return (mDataSize > mDataPos ? mDataSize : mDataPos); } size_t Parcel::dataAvail() const { // TODO: decide what to do about the possibility that this can // report an available-data size that exceeds a Java int's max // positive value, causing havoc. Fortunately this will only // happen if someone constructs a Parcel containing more than two // gigabytes of data, which on typical phone hardware is simply // not possible. return dataSize() - dataPosition(); } size_t Parcel::dataPosition() const { return mDataPos; } size_t Parcel::dataCapacity() const { return mDataCapacity; } status_t Parcel::setDataSize(size_t size) { status_t err; err = continueWrite(size); if (err == NO_ERROR) { mDataSize = size; ALOGV("setDataSize Setting data size of %p to %d\n", this, mDataSize); } return err; } void Parcel::setDataPosition(size_t pos) const { mDataPos = pos; mNextObjectHint = 0; } status_t Parcel::setDataCapacity(size_t size) { if (size > mDataCapacity) return continueWrite(size); return NO_ERROR; } status_t Parcel::setData(const uint8_t* buffer, size_t len) { status_t err = restartWrite(len); if (err == NO_ERROR) { memcpy(const_cast(data()), buffer, len); mDataSize = len; mFdsKnown = false; } return err; } status_t Parcel::appendFrom(const Parcel *parcel, size_t offset, size_t len) { const sp proc(ProcessState::self()); status_t err; const uint8_t *data = parcel->mData; const size_t *objects = parcel->mObjects; size_t size = parcel->mObjectsSize; int startPos = mDataPos; int firstIndex = -1, lastIndex = -2; if (len == 0) { return NO_ERROR; } // range checks against the source parcel size if ((offset > parcel->mDataSize) || (len > parcel->mDataSize) || (offset + len > parcel->mDataSize)) { return BAD_VALUE; } // Count objects in range for (int i = 0; i < (int) size; i++) { size_t off = objects[i]; if ((off >= offset) && (off < offset + len)) { if (firstIndex == -1) { firstIndex = i; } lastIndex = i; } } int numObjects = lastIndex - firstIndex + 1; if ((mDataSize+len) > mDataCapacity) { // grow data err = growData(len); if (err != NO_ERROR) { return err; } } // append data memcpy(mData + mDataPos, data + offset, len); mDataPos += len; mDataSize += len; err = NO_ERROR; if (numObjects > 0) { // grow objects if (mObjectsCapacity < mObjectsSize + numObjects) { int newSize = ((mObjectsSize + numObjects)*3)/2; size_t *objects = (size_t*)realloc(mObjects, newSize*sizeof(size_t)); if (objects == (size_t*)0) { return NO_MEMORY; } mObjects = objects; mObjectsCapacity = newSize; } // append and acquire objects int idx = mObjectsSize; for (int i = firstIndex; i <= lastIndex; i++) { size_t off = objects[i] - offset + startPos; mObjects[idx++] = off; mObjectsSize++; flat_binder_object* flat = reinterpret_cast(mData + off); acquire_object(proc, *flat, this); if (flat->type == BINDER_TYPE_FD) { // If this is a file descriptor, we need to dup it so the // new Parcel now owns its own fd, and can declare that we // officially know we have fds. flat->handle = dup(flat->handle); flat->cookie = (void*)1; mHasFds = mFdsKnown = true; if (!mAllowFds) { err = FDS_NOT_ALLOWED; } } } } return err; } bool Parcel::pushAllowFds(bool allowFds) { const bool origValue = mAllowFds; if (!allowFds) { mAllowFds = false; } return origValue; } void Parcel::restoreAllowFds(bool lastValue) { mAllowFds = lastValue; } bool Parcel::hasFileDescriptors() const { if (!mFdsKnown) { scanForFds(); } return mHasFds; } // Write RPC headers. (previously just the interface token) status_t Parcel::writeInterfaceToken(const String16& interface) { writeInt32(IPCThreadState::self()->getStrictModePolicy() | STRICT_MODE_PENALTY_GATHER); // currently the interface identification token is just its name as a string return writeString16(interface); } bool Parcel::checkInterface(IBinder* binder) const { return enforceInterface(binder->getInterfaceDescriptor()); } bool Parcel::enforceInterface(const String16& interface, IPCThreadState* threadState) const { int32_t strictPolicy = readInt32(); if (threadState == NULL) { threadState = IPCThreadState::self(); } if ((threadState->getLastTransactionBinderFlags() & IBinder::FLAG_ONEWAY) != 0) { // For one-way calls, the callee is running entirely // disconnected from the caller, so disable StrictMode entirely. // Not only does disk/network usage not impact the caller, but // there's no way to commuicate back any violations anyway. threadState->setStrictModePolicy(0); } else { threadState->setStrictModePolicy(strictPolicy); } const String16 str(readString16()); if (str == interface) { return true; } else { ALOGW("**** enforceInterface() expected '%s' but read '%s'\n", String8(interface).string(), String8(str).string()); return false; } } const size_t* Parcel::objects() const { return mObjects; } size_t Parcel::objectsCount() const { return mObjectsSize; } status_t Parcel::errorCheck() const { return mError; } void Parcel::setError(status_t err) { mError = err; } status_t Parcel::finishWrite(size_t len) { //printf("Finish write of %d\n", len); mDataPos += len; ALOGV("finishWrite Setting data pos of %p to %d\n", this, mDataPos); if (mDataPos > mDataSize) { mDataSize = mDataPos; ALOGV("finishWrite Setting data size of %p to %d\n", this, mDataSize); } //printf("New pos=%d, size=%d\n", mDataPos, mDataSize); return NO_ERROR; } status_t Parcel::writeUnpadded(const void* data, size_t len) { size_t end = mDataPos + len; if (end < mDataPos) { // integer overflow return BAD_VALUE; } if (end <= mDataCapacity) { restart_write: memcpy(mData+mDataPos, data, len); return finishWrite(len); } status_t err = growData(len); if (err == NO_ERROR) goto restart_write; return err; } status_t Parcel::write(const void* data, size_t len) { void* const d = writeInplace(len); if (d) { memcpy(d, data, len); return NO_ERROR; } return mError; } void* Parcel::writeInplace(size_t len) { const size_t padded = PAD_SIZE(len); // sanity check for integer overflow if (mDataPos+padded < mDataPos) { return NULL; } if ((mDataPos+padded) <= mDataCapacity) { restart_write: //printf("Writing %ld bytes, padded to %ld\n", len, padded); uint8_t* const data = mData+mDataPos; // Need to pad at end? if (padded != len) { #if BYTE_ORDER == BIG_ENDIAN static const uint32_t mask[4] = { 0x00000000, 0xffffff00, 0xffff0000, 0xff000000 }; #endif #if BYTE_ORDER == LITTLE_ENDIAN static const uint32_t mask[4] = { 0x00000000, 0x00ffffff, 0x0000ffff, 0x000000ff }; #endif //printf("Applying pad mask: %p to %p\n", (void*)mask[padded-len], // *reinterpret_cast(data+padded-4)); *reinterpret_cast(data+padded-4) &= mask[padded-len]; } finishWrite(padded); return data; } status_t err = growData(padded); if (err == NO_ERROR) goto restart_write; return NULL; } status_t Parcel::writeInt32(int32_t val) { return writeAligned(val); } status_t Parcel::writeInt64(int64_t val) { return writeAligned(val); } status_t Parcel::writeFloat(float val) { return writeAligned(val); } status_t Parcel::writeDouble(double val) { return writeAligned(val); } status_t Parcel::writeIntPtr(intptr_t val) { return writeAligned(val); } status_t Parcel::writeCString(const char* str) { return write(str, strlen(str)+1); } status_t Parcel::writeString8(const String8& str) { status_t err = writeInt32(str.bytes()); // only write string if its length is more than zero characters, // as readString8 will only read if the length field is non-zero. // this is slightly different from how writeString16 works. if (str.bytes() > 0 && err == NO_ERROR) { err = write(str.string(), str.bytes()+1); } return err; } status_t Parcel::writeString16(const String16& str) { return writeString16(str.string(), str.size()); } status_t Parcel::writeString16(const char16_t* str, size_t len) { if (str == NULL) return writeInt32(-1); status_t err = writeInt32(len); if (err == NO_ERROR) { len *= sizeof(char16_t); uint8_t* data = (uint8_t*)writeInplace(len+sizeof(char16_t)); if (data) { memcpy(data, str, len); *reinterpret_cast(data+len) = 0; return NO_ERROR; } err = mError; } return err; } status_t Parcel::writeStrongBinder(const sp& val) { return flatten_binder(ProcessState::self(), val, this); } status_t Parcel::writeWeakBinder(const wp& val) { return flatten_binder(ProcessState::self(), val, this); } status_t Parcel::writeNativeHandle(const native_handle* handle) { if (!handle || handle->version != sizeof(native_handle)) return BAD_TYPE; status_t err; err = writeInt32(handle->numFds); if (err != NO_ERROR) return err; err = writeInt32(handle->numInts); if (err != NO_ERROR) return err; for (int i=0 ; err==NO_ERROR && inumFds ; i++) err = writeDupFileDescriptor(handle->data[i]); if (err != NO_ERROR) { ALOGD("write native handle, write dup fd failed"); return err; } err = write(handle->data + handle->numFds, sizeof(int)*handle->numInts); return err; } status_t Parcel::writeFileDescriptor(int fd, bool takeOwnership) { flat_binder_object obj; obj.type = BINDER_TYPE_FD; obj.flags = 0x7f | FLAT_BINDER_FLAG_ACCEPTS_FDS; obj.handle = fd; obj.cookie = (void*) (takeOwnership ? 1 : 0); return writeObject(obj, true); } status_t Parcel::writeDupFileDescriptor(int fd) { int dupFd = dup(fd); if (dupFd < 0) { return -errno; } status_t err = writeFileDescriptor(dupFd, true /*takeOwnership*/); if (err) { close(dupFd); } return err; } status_t Parcel::writeBlob(size_t len, WritableBlob* outBlob) { status_t status; if (!mAllowFds || len <= IN_PLACE_BLOB_LIMIT) { ALOGV("writeBlob: write in place"); status = writeInt32(0); if (status) return status; void* ptr = writeInplace(len); if (!ptr) return NO_MEMORY; outBlob->init(false /*mapped*/, ptr, len); return NO_ERROR; } ALOGV("writeBlob: write to ashmem"); int fd = ashmem_create_region("Parcel Blob", len); if (fd < 0) return NO_MEMORY; int result = ashmem_set_prot_region(fd, PROT_READ | PROT_WRITE); if (result < 0) { status = result; } else { void* ptr = ::mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (ptr == MAP_FAILED) { status = -errno; } else { result = ashmem_set_prot_region(fd, PROT_READ); if (result < 0) { status = result; } else { status = writeInt32(1); if (!status) { status = writeFileDescriptor(fd, true /*takeOwnership*/); if (!status) { outBlob->init(true /*mapped*/, ptr, len); return NO_ERROR; } } } } ::munmap(ptr, len); } ::close(fd); return status; } status_t Parcel::write(const Flattenable& val) { status_t err; // size if needed size_t len = val.getFlattenedSize(); size_t fd_count = val.getFdCount(); err = this->writeInt32(len); if (err) return err; err = this->writeInt32(fd_count); if (err) return err; // payload void* buf = this->writeInplace(PAD_SIZE(len)); if (buf == NULL) return BAD_VALUE; int* fds = NULL; if (fd_count) { fds = new int[fd_count]; } err = val.flatten(buf, len, fds, fd_count); for (size_t i=0 ; iwriteDupFileDescriptor( fds[i] ); } if (fd_count) { delete [] fds; } return err; } status_t Parcel::writeObject(const flat_binder_object& val, bool nullMetaData) { const bool enoughData = (mDataPos+sizeof(val)) <= mDataCapacity; const bool enoughObjects = mObjectsSize < mObjectsCapacity; if (enoughData && enoughObjects) { restart_write: *reinterpret_cast(mData+mDataPos) = val; // Need to write meta-data? if (nullMetaData || val.binder != NULL) { mObjects[mObjectsSize] = mDataPos; acquire_object(ProcessState::self(), val, this); mObjectsSize++; } // remember if it's a file descriptor if (val.type == BINDER_TYPE_FD) { if (!mAllowFds) { return FDS_NOT_ALLOWED; } mHasFds = mFdsKnown = true; } return finishWrite(sizeof(flat_binder_object)); } if (!enoughData) { const status_t err = growData(sizeof(val)); if (err != NO_ERROR) return err; } if (!enoughObjects) { size_t newSize = ((mObjectsSize+2)*3)/2; size_t* objects = (size_t*)realloc(mObjects, newSize*sizeof(size_t)); if (objects == NULL) return NO_MEMORY; mObjects = objects; mObjectsCapacity = newSize; } goto restart_write; } status_t Parcel::writeNoException() { return writeInt32(0); } void Parcel::remove(size_t start, size_t amt) { LOG_ALWAYS_FATAL("Parcel::remove() not yet implemented!"); } status_t Parcel::read(void* outData, size_t len) const { if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) { memcpy(outData, mData+mDataPos, len); mDataPos += PAD_SIZE(len); ALOGV("read Setting data pos of %p to %d\n", this, mDataPos); return NO_ERROR; } return NOT_ENOUGH_DATA; } const void* Parcel::readInplace(size_t len) const { if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) { const void* data = mData+mDataPos; mDataPos += PAD_SIZE(len); ALOGV("readInplace Setting data pos of %p to %d\n", this, mDataPos); return data; } return NULL; } template status_t Parcel::readAligned(T *pArg) const { COMPILE_TIME_ASSERT_FUNCTION_SCOPE(PAD_SIZE(sizeof(T)) == sizeof(T)); if ((mDataPos+sizeof(T)) <= mDataSize) { const void* data = mData+mDataPos; mDataPos += sizeof(T); *pArg = *reinterpret_cast(data); return NO_ERROR; } else { return NOT_ENOUGH_DATA; } } template T Parcel::readAligned() const { T result; if (readAligned(&result) != NO_ERROR) { result = 0; } return result; } template status_t Parcel::writeAligned(T val) { COMPILE_TIME_ASSERT_FUNCTION_SCOPE(PAD_SIZE(sizeof(T)) == sizeof(T)); if ((mDataPos+sizeof(val)) <= mDataCapacity) { restart_write: *reinterpret_cast(mData+mDataPos) = val; return finishWrite(sizeof(val)); } status_t err = growData(sizeof(val)); if (err == NO_ERROR) goto restart_write; return err; } status_t Parcel::readInt32(int32_t *pArg) const { return readAligned(pArg); } int32_t Parcel::readInt32() const { return readAligned(); } status_t Parcel::readInt64(int64_t *pArg) const { return readAligned(pArg); } int64_t Parcel::readInt64() const { return readAligned(); } status_t Parcel::readFloat(float *pArg) const { return readAligned(pArg); } float Parcel::readFloat() const { return readAligned(); } status_t Parcel::readDouble(double *pArg) const { return readAligned(pArg); } double Parcel::readDouble() const { return readAligned(); } status_t Parcel::readIntPtr(intptr_t *pArg) const { return readAligned(pArg); } intptr_t Parcel::readIntPtr() const { return readAligned(); } const char* Parcel::readCString() const { const size_t avail = mDataSize-mDataPos; if (avail > 0) { const char* str = reinterpret_cast(mData+mDataPos); // is the string's trailing NUL within the parcel's valid bounds? const char* eos = reinterpret_cast(memchr(str, 0, avail)); if (eos) { const size_t len = eos - str; mDataPos += PAD_SIZE(len+1); ALOGV("readCString Setting data pos of %p to %d\n", this, mDataPos); return str; } } return NULL; } String8 Parcel::readString8() const { int32_t size = readInt32(); // watch for potential int overflow adding 1 for trailing NUL if (size > 0 && size < INT32_MAX) { const char* str = (const char*)readInplace(size+1); if (str) return String8(str, size); } return String8(); } String16 Parcel::readString16() const { size_t len; const char16_t* str = readString16Inplace(&len); if (str) return String16(str, len); ALOGE("Reading a NULL string not supported here."); return String16(); } const char16_t* Parcel::readString16Inplace(size_t* outLen) const { int32_t size = readInt32(); // watch for potential int overflow from size+1 if (size >= 0 && size < INT32_MAX) { *outLen = size; const char16_t* str = (const char16_t*)readInplace((size+1)*sizeof(char16_t)); if (str != NULL) { return str; } } *outLen = 0; return NULL; } sp Parcel::readStrongBinder() const { sp val; unflatten_binder(ProcessState::self(), *this, &val); return val; } wp Parcel::readWeakBinder() const { wp val; unflatten_binder(ProcessState::self(), *this, &val); return val; } int32_t Parcel::readExceptionCode() const { int32_t exception_code = readAligned(); if (exception_code == EX_HAS_REPLY_HEADER) { int32_t header_start = dataPosition(); int32_t header_size = readAligned(); // Skip over fat responses headers. Not used (or propagated) in // native code setDataPosition(header_start + header_size); // And fat response headers are currently only used when there are no // exceptions, so return no error: return 0; } return exception_code; } native_handle* Parcel::readNativeHandle() const { int numFds, numInts; status_t err; err = readInt32(&numFds); if (err != NO_ERROR) return 0; err = readInt32(&numInts); if (err != NO_ERROR) return 0; native_handle* h = native_handle_create(numFds, numInts); for (int i=0 ; err==NO_ERROR && idata[i] = dup(readFileDescriptor()); if (h->data[i] < 0) err = BAD_VALUE; } err = read(h->data + numFds, sizeof(int)*numInts); if (err != NO_ERROR) { native_handle_close(h); native_handle_delete(h); h = 0; } return h; } int Parcel::readFileDescriptor() const { const flat_binder_object* flat = readObject(true); if (flat) { switch (flat->type) { case BINDER_TYPE_FD: //ALOGI("Returning file descriptor %ld from parcel %p\n", flat->handle, this); return flat->handle; } } return BAD_TYPE; } status_t Parcel::readBlob(size_t len, ReadableBlob* outBlob) const { int32_t useAshmem; status_t status = readInt32(&useAshmem); if (status) return status; if (!useAshmem) { ALOGV("readBlob: read in place"); const void* ptr = readInplace(len); if (!ptr) return BAD_VALUE; outBlob->init(false /*mapped*/, const_cast(ptr), len); return NO_ERROR; } ALOGV("readBlob: read from ashmem"); int fd = readFileDescriptor(); if (fd == int(BAD_TYPE)) return BAD_VALUE; void* ptr = ::mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0); if (!ptr) return NO_MEMORY; outBlob->init(true /*mapped*/, ptr, len); return NO_ERROR; } status_t Parcel::read(Flattenable& val) const { // size const size_t len = this->readInt32(); const size_t fd_count = this->readInt32(); // payload void const* buf = this->readInplace(PAD_SIZE(len)); if (buf == NULL) return BAD_VALUE; int* fds = NULL; if (fd_count) { fds = new int[fd_count]; } status_t err = NO_ERROR; for (size_t i=0 ; ireadFileDescriptor()); if (fds[i] < 0) err = BAD_VALUE; } if (err == NO_ERROR) { err = val.unflatten(buf, len, fds, fd_count); } if (fd_count) { delete [] fds; } return err; } const flat_binder_object* Parcel::readObject(bool nullMetaData) const { const size_t DPOS = mDataPos; if ((DPOS+sizeof(flat_binder_object)) <= mDataSize) { const flat_binder_object* obj = reinterpret_cast(mData+DPOS); mDataPos = DPOS + sizeof(flat_binder_object); if (!nullMetaData && (obj->cookie == NULL && obj->binder == NULL)) { // When transferring a NULL object, we don't write it into // the object list, so we don't want to check for it when // reading. ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos); return obj; } // Ensure that this object is valid... size_t* const OBJS = mObjects; const size_t N = mObjectsSize; size_t opos = mNextObjectHint; if (N > 0) { ALOGV("Parcel %p looking for obj at %d, hint=%d\n", this, DPOS, opos); // Start at the current hint position, looking for an object at // the current data position. if (opos < N) { while (opos < (N-1) && OBJS[opos] < DPOS) { opos++; } } else { opos = N-1; } if (OBJS[opos] == DPOS) { // Found it! ALOGV("Parcel found obj %d at index %d with forward search", this, DPOS, opos); mNextObjectHint = opos+1; ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos); return obj; } // Look backwards for it... while (opos > 0 && OBJS[opos] > DPOS) { opos--; } if (OBJS[opos] == DPOS) { // Found it! ALOGV("Parcel found obj %d at index %d with backward search", this, DPOS, opos); mNextObjectHint = opos+1; ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos); return obj; } } ALOGW("Attempt to read object from Parcel %p at offset %d that is not in the object list", this, DPOS); } return NULL; } void Parcel::closeFileDescriptors() { size_t i = mObjectsSize; if (i > 0) { //ALOGI("Closing file descriptors for %d objects...", mObjectsSize); } while (i > 0) { i--; const flat_binder_object* flat = reinterpret_cast(mData+mObjects[i]); if (flat->type == BINDER_TYPE_FD) { //ALOGI("Closing fd: %ld\n", flat->handle); close(flat->handle); } } } const uint8_t* Parcel::ipcData() const { return mData; } size_t Parcel::ipcDataSize() const { return (mDataSize > mDataPos ? mDataSize : mDataPos); } const size_t* Parcel::ipcObjects() const { return mObjects; } size_t Parcel::ipcObjectsCount() const { return mObjectsSize; } void Parcel::ipcSetDataReference(const uint8_t* data, size_t dataSize, const size_t* objects, size_t objectsCount, release_func relFunc, void* relCookie) { freeDataNoInit(); mError = NO_ERROR; mData = const_cast(data); mDataSize = mDataCapacity = dataSize; //ALOGI("setDataReference Setting data size of %p to %lu (pid=%d)\n", this, mDataSize, getpid()); mDataPos = 0; ALOGV("setDataReference Setting data pos of %p to %d\n", this, mDataPos); mObjects = const_cast(objects); mObjectsSize = mObjectsCapacity = objectsCount; mNextObjectHint = 0; mOwner = relFunc; mOwnerCookie = relCookie; scanForFds(); } void Parcel::print(TextOutput& to, uint32_t flags) const { to << "Parcel("; if (errorCheck() != NO_ERROR) { const status_t err = errorCheck(); to << "Error: " << (void*)err << " \"" << strerror(-err) << "\""; } else if (dataSize() > 0) { const uint8_t* DATA = data(); to << indent << HexDump(DATA, dataSize()) << dedent; const size_t* OBJS = objects(); const size_t N = objectsCount(); for (size_t i=0; i(DATA+OBJS[i]); to << endl << "Object #" << i << " @ " << (void*)OBJS[i] << ": " << TypeCode(flat->type & 0x7f7f7f00) << " = " << flat->binder; } } else { to << "NULL"; } to << ")"; } void Parcel::releaseObjects() { const sp proc(ProcessState::self()); size_t i = mObjectsSize; uint8_t* const data = mData; size_t* const objects = mObjects; while (i > 0) { i--; const flat_binder_object* flat = reinterpret_cast(data+objects[i]); release_object(proc, *flat, this); } } void Parcel::acquireObjects() { const sp proc(ProcessState::self()); size_t i = mObjectsSize; uint8_t* const data = mData; size_t* const objects = mObjects; while (i > 0) { i--; const flat_binder_object* flat = reinterpret_cast(data+objects[i]); acquire_object(proc, *flat, this); } } void Parcel::freeData() { freeDataNoInit(); initState(); } void Parcel::freeDataNoInit() { if (mOwner) { //ALOGI("Freeing data ref of %p (pid=%d)\n", this, getpid()); mOwner(this, mData, mDataSize, mObjects, mObjectsSize, mOwnerCookie); } else { releaseObjects(); if (mData) free(mData); if (mObjects) free(mObjects); } } status_t Parcel::growData(size_t len) { size_t newSize = ((mDataSize+len)*3)/2; return (newSize <= mDataSize) ? (status_t) NO_MEMORY : continueWrite(newSize); } status_t Parcel::restartWrite(size_t desired) { if (mOwner) { freeData(); return continueWrite(desired); } uint8_t* data = (uint8_t*)realloc(mData, desired); if (!data && desired > mDataCapacity) { mError = NO_MEMORY; return NO_MEMORY; } releaseObjects(); if (data) { mData = data; mDataCapacity = desired; } mDataSize = mDataPos = 0; ALOGV("restartWrite Setting data size of %p to %d\n", this, mDataSize); ALOGV("restartWrite Setting data pos of %p to %d\n", this, mDataPos); free(mObjects); mObjects = NULL; mObjectsSize = mObjectsCapacity = 0; mNextObjectHint = 0; mHasFds = false; mFdsKnown = true; mAllowFds = true; return NO_ERROR; } status_t Parcel::continueWrite(size_t desired) { // If shrinking, first adjust for any objects that appear // after the new data size. size_t objectsSize = mObjectsSize; if (desired < mDataSize) { if (desired == 0) { objectsSize = 0; } else { while (objectsSize > 0) { if (mObjects[objectsSize-1] < desired) break; objectsSize--; } } } if (mOwner) { // If the size is going to zero, just release the owner's data. if (desired == 0) { freeData(); return NO_ERROR; } // If there is a different owner, we need to take // posession. uint8_t* data = (uint8_t*)malloc(desired); if (!data) { mError = NO_MEMORY; return NO_MEMORY; } size_t* objects = NULL; if (objectsSize) { objects = (size_t*)malloc(objectsSize*sizeof(size_t)); if (!objects) { mError = NO_MEMORY; return NO_MEMORY; } // Little hack to only acquire references on objects // we will be keeping. size_t oldObjectsSize = mObjectsSize; mObjectsSize = objectsSize; acquireObjects(); mObjectsSize = oldObjectsSize; } if (mData) { memcpy(data, mData, mDataSize < desired ? mDataSize : desired); } if (objects && mObjects) { memcpy(objects, mObjects, objectsSize*sizeof(size_t)); } //ALOGI("Freeing data ref of %p (pid=%d)\n", this, getpid()); mOwner(this, mData, mDataSize, mObjects, mObjectsSize, mOwnerCookie); mOwner = NULL; mData = data; mObjects = objects; mDataSize = (mDataSize < desired) ? mDataSize : desired; ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize); mDataCapacity = desired; mObjectsSize = mObjectsCapacity = objectsSize; mNextObjectHint = 0; } else if (mData) { if (objectsSize < mObjectsSize) { // Need to release refs on any objects we are dropping. const sp proc(ProcessState::self()); for (size_t i=objectsSize; i(mData+mObjects[i]); if (flat->type == BINDER_TYPE_FD) { // will need to rescan because we may have lopped off the only FDs mFdsKnown = false; } release_object(proc, *flat, this); } size_t* objects = (size_t*)realloc(mObjects, objectsSize*sizeof(size_t)); if (objects) { mObjects = objects; } mObjectsSize = objectsSize; mNextObjectHint = 0; } // We own the data, so we can just do a realloc(). if (desired > mDataCapacity) { uint8_t* data = (uint8_t*)realloc(mData, desired); if (data) { mData = data; mDataCapacity = desired; } else if (desired > mDataCapacity) { mError = NO_MEMORY; return NO_MEMORY; } } else { if (mDataSize > desired) { mDataSize = desired; ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize); } if (mDataPos > desired) { mDataPos = desired; ALOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos); } } } else { // This is the first data. Easy! uint8_t* data = (uint8_t*)malloc(desired); if (!data) { mError = NO_MEMORY; return NO_MEMORY; } if(!(mDataCapacity == 0 && mObjects == NULL && mObjectsCapacity == 0)) { ALOGE("continueWrite: %d/%p/%d/%d", mDataCapacity, mObjects, mObjectsCapacity, desired); } mData = data; mDataSize = mDataPos = 0; ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize); ALOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos); mDataCapacity = desired; } return NO_ERROR; } void Parcel::initState() { mError = NO_ERROR; mData = 0; mDataSize = 0; mDataCapacity = 0; mDataPos = 0; ALOGV("initState Setting data size of %p to %d\n", this, mDataSize); ALOGV("initState Setting data pos of %p to %d\n", this, mDataPos); mObjects = NULL; mObjectsSize = 0; mObjectsCapacity = 0; mNextObjectHint = 0; mHasFds = false; mFdsKnown = true; mAllowFds = true; mOwner = NULL; } void Parcel::scanForFds() const { bool hasFds = false; for (size_t i=0; i(mData + mObjects[i]); if (flat->type == BINDER_TYPE_FD) { hasFds = true; break; } } mHasFds = hasFds; mFdsKnown = true; } // --- Parcel::Blob --- Parcel::Blob::Blob() : mMapped(false), mData(NULL), mSize(0) { } Parcel::Blob::~Blob() { release(); } void Parcel::Blob::release() { if (mMapped && mData) { ::munmap(mData, mSize); } clear(); } void Parcel::Blob::init(bool mapped, void* data, size_t size) { mMapped = mapped; mData = data; mSize = size; } void Parcel::Blob::clear() { mMapped = false; mData = NULL; mSize = 0; } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/binder/MemoryHeapBaseIon.cpp0000644000015700001700000000527612200324306025730 0ustar pbuserpbgroup00000000000000/* * Copyright Samsung Electronics Co.,LTD. * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /*! * \file MemoryHeapBaseIon.cpp * \brief source file for MemoryHeapBaseIon * \author MinGu, Jeon(mingu85.jeon) * \date 2011/11/20 * * Revision History: * - 2011/11/20 : MinGu, Jeon(mingu85.jeon)) \n * Initial version */ #include #include #include #include #include #include #include #include #include #include #include #include #include "ion.h" namespace android { MemoryHeapBaseIon::MemoryHeapBaseIon(size_t size, uint32_t flags, char const *name) { mIonClient = ion_client_create(); if (mIonClient < 0) { mIonClient = -1; ALOGE("MemoryHeapBaseIon : ION client creation failed"); } void* base = NULL; int fd = ion_alloc(mIonClient, size, 0, ION_HEAP_EXYNOS_MASK); if (fd < 0) { ALOGE("MemoryHeapBaseIon : ION memory allocation failed"); } else { flags |= USE_ION_FD; base = ion_map(fd, size, 0); if (base != MAP_FAILED) init(fd, base, size, flags, NULL); else ALOGE("MemoryHeapBaseIon : mmap failed"); } } MemoryHeapBaseIon::MemoryHeapBaseIon(int fd, size_t size, uint32_t flags, uint32_t offset) { ALOGE_IF(fd < 0, "MemoryHeapBaseIon : file discriptor error. fd is not for ION Memory"); mIonClient = ion_client_create(); if (mIonClient < 0) { mIonClient = -1; ALOGE("MemoryHeapBaseIon : ION client creation failed"); } void* base = NULL; if (fd >= 0) { int dup_fd = dup(fd); flags |= USE_ION_FD; base = ion_map(dup_fd, size, 0); if (base != MAP_FAILED) init(dup_fd, base, size, flags, NULL); else ALOGE("MemoryHeapBaseIon : mmap failed"); } } MemoryHeapBaseIon::~MemoryHeapBaseIon() { if (mIonClient != -1) { ion_unmap(getBase(), getSize()); ion_free(getHeapID()); ion_client_destroy(mIonClient); mIonClient = -1; } } }; android-audiosystem-1.8+13.10.20130807/lib/binder/MemoryDealer.cpp0000644000015700001700000003173012200324306025000 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "MemoryDealer" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace android { // ---------------------------------------------------------------------------- /* * A simple templatized doubly linked-list implementation */ template class LinkedList { NODE* mFirst; NODE* mLast; public: LinkedList() : mFirst(0), mLast(0) { } bool isEmpty() const { return mFirst == 0; } NODE const* head() const { return mFirst; } NODE* head() { return mFirst; } NODE const* tail() const { return mLast; } NODE* tail() { return mLast; } void insertAfter(NODE* node, NODE* newNode) { newNode->prev = node; newNode->next = node->next; if (node->next == 0) mLast = newNode; else node->next->prev = newNode; node->next = newNode; } void insertBefore(NODE* node, NODE* newNode) { newNode->prev = node->prev; newNode->next = node; if (node->prev == 0) mFirst = newNode; else node->prev->next = newNode; node->prev = newNode; } void insertHead(NODE* newNode) { if (mFirst == 0) { mFirst = mLast = newNode; newNode->prev = newNode->next = 0; } else { newNode->prev = 0; newNode->next = mFirst; mFirst->prev = newNode; mFirst = newNode; } } void insertTail(NODE* newNode) { if (mLast == 0) { insertHead(newNode); } else { newNode->prev = mLast; newNode->next = 0; mLast->next = newNode; mLast = newNode; } } NODE* remove(NODE* node) { if (node->prev == 0) mFirst = node->next; else node->prev->next = node->next; if (node->next == 0) mLast = node->prev; else node->next->prev = node->prev; return node; } }; // ---------------------------------------------------------------------------- class Allocation : public MemoryBase { public: Allocation(const sp& dealer, const sp& heap, ssize_t offset, size_t size); virtual ~Allocation(); private: sp mDealer; }; // ---------------------------------------------------------------------------- class SimpleBestFitAllocator { enum { PAGE_ALIGNED = 0x00000001 }; public: SimpleBestFitAllocator(size_t size); ~SimpleBestFitAllocator(); size_t allocate(size_t size, uint32_t flags = 0); status_t deallocate(size_t offset); size_t size() const; void dump(const char* what) const; void dump(String8& res, const char* what) const; private: struct chunk_t { chunk_t(size_t start, size_t size) : start(start), size(size), free(1), prev(0), next(0) { } size_t start; size_t size : 28; int free : 4; mutable chunk_t* prev; mutable chunk_t* next; }; ssize_t alloc(size_t size, uint32_t flags); chunk_t* dealloc(size_t start); void dump_l(const char* what) const; void dump_l(String8& res, const char* what) const; static const int kMemoryAlign; mutable Mutex mLock; LinkedList mList; size_t mHeapSize; }; // ---------------------------------------------------------------------------- Allocation::Allocation( const sp& dealer, const sp& heap, ssize_t offset, size_t size) : MemoryBase(heap, offset, size), mDealer(dealer) { #ifndef NDEBUG void* const start_ptr = (void*)(intptr_t(heap->base()) + offset); memset(start_ptr, 0xda, size); #endif } Allocation::~Allocation() { size_t freedOffset = getOffset(); size_t freedSize = getSize(); if (freedSize) { /* NOTE: it's VERY important to not free allocations of size 0 because * they're special as they don't have any record in the allocator * and could alias some real allocation (their offset is zero). */ // keep the size to unmap in excess size_t pagesize = getpagesize(); size_t start = freedOffset; size_t end = start + freedSize; start &= ~(pagesize-1); end = (end + pagesize-1) & ~(pagesize-1); // give back to the kernel the pages we don't need size_t free_start = freedOffset; size_t free_end = free_start + freedSize; if (start < free_start) start = free_start; if (end > free_end) end = free_end; start = (start + pagesize-1) & ~(pagesize-1); end &= ~(pagesize-1); if (start < end) { void* const start_ptr = (void*)(intptr_t(getHeap()->base()) + start); size_t size = end-start; #ifndef NDEBUG memset(start_ptr, 0xdf, size); #endif // MADV_REMOVE is not defined on Dapper based Goobuntu #ifdef MADV_REMOVE if (size) { int err = madvise(start_ptr, size, MADV_REMOVE); ALOGW_IF(err, "madvise(%p, %u, MADV_REMOVE) returned %s", start_ptr, size, err<0 ? strerror(errno) : "Ok"); } #endif } // This should be done after madvise(MADV_REMOVE), otherwise madvise() // might kick out the memory region that's allocated and/or written // right after the deallocation. mDealer->deallocate(freedOffset); } } // ---------------------------------------------------------------------------- MemoryDealer::MemoryDealer(size_t size, const char* name) : mHeap(new MemoryHeapBase(size, 0, name)), mAllocator(new SimpleBestFitAllocator(size)) { } MemoryDealer::~MemoryDealer() { delete mAllocator; } sp MemoryDealer::allocate(size_t size) { sp memory; const ssize_t offset = allocator()->allocate(size); if (offset >= 0) { memory = new Allocation(this, heap(), offset, size); } return memory; } void MemoryDealer::deallocate(size_t offset) { allocator()->deallocate(offset); } void MemoryDealer::dump(const char* what) const { allocator()->dump(what); } const sp& MemoryDealer::heap() const { return mHeap; } SimpleBestFitAllocator* MemoryDealer::allocator() const { return mAllocator; } // ---------------------------------------------------------------------------- // align all the memory blocks on a cache-line boundary const int SimpleBestFitAllocator::kMemoryAlign = 32; SimpleBestFitAllocator::SimpleBestFitAllocator(size_t size) { size_t pagesize = getpagesize(); mHeapSize = ((size + pagesize-1) & ~(pagesize-1)); chunk_t* node = new chunk_t(0, mHeapSize / kMemoryAlign); mList.insertHead(node); } SimpleBestFitAllocator::~SimpleBestFitAllocator() { while(!mList.isEmpty()) { delete mList.remove(mList.head()); } } size_t SimpleBestFitAllocator::size() const { return mHeapSize; } size_t SimpleBestFitAllocator::allocate(size_t size, uint32_t flags) { Mutex::Autolock _l(mLock); ssize_t offset = alloc(size, flags); return offset; } status_t SimpleBestFitAllocator::deallocate(size_t offset) { Mutex::Autolock _l(mLock); chunk_t const * const freed = dealloc(offset); if (freed) { return NO_ERROR; } return NAME_NOT_FOUND; } ssize_t SimpleBestFitAllocator::alloc(size_t size, uint32_t flags) { if (size == 0) { return 0; } size = (size + kMemoryAlign-1) / kMemoryAlign; chunk_t* free_chunk = 0; chunk_t* cur = mList.head(); size_t pagesize = getpagesize(); while (cur) { int extra = 0; if (flags & PAGE_ALIGNED) extra = ( -cur->start & ((pagesize/kMemoryAlign)-1) ) ; // best fit if (cur->free && (cur->size >= (size+extra))) { if ((!free_chunk) || (cur->size < free_chunk->size)) { free_chunk = cur; } if (cur->size == size) { break; } } cur = cur->next; } if (free_chunk) { const size_t free_size = free_chunk->size; free_chunk->free = 0; free_chunk->size = size; if (free_size > size) { int extra = 0; if (flags & PAGE_ALIGNED) extra = ( -free_chunk->start & ((pagesize/kMemoryAlign)-1) ) ; if (extra) { chunk_t* split = new chunk_t(free_chunk->start, extra); free_chunk->start += extra; mList.insertBefore(free_chunk, split); } ALOGE_IF((flags&PAGE_ALIGNED) && ((free_chunk->start*kMemoryAlign)&(pagesize-1)), "PAGE_ALIGNED requested, but page is not aligned!!!"); const ssize_t tail_free = free_size - (size+extra); if (tail_free > 0) { chunk_t* split = new chunk_t( free_chunk->start + free_chunk->size, tail_free); mList.insertAfter(free_chunk, split); } } return (free_chunk->start)*kMemoryAlign; } return NO_MEMORY; } SimpleBestFitAllocator::chunk_t* SimpleBestFitAllocator::dealloc(size_t start) { start = start / kMemoryAlign; chunk_t* cur = mList.head(); while (cur) { if (cur->start == start) { LOG_FATAL_IF(cur->free, "block at offset 0x%08lX of size 0x%08lX already freed", cur->start*kMemoryAlign, cur->size*kMemoryAlign); // merge freed blocks together chunk_t* freed = cur; cur->free = 1; do { chunk_t* const p = cur->prev; chunk_t* const n = cur->next; if (p && (p->free || !cur->size)) { freed = p; p->size += cur->size; mList.remove(cur); delete cur; } cur = n; } while (cur && cur->free); #ifndef NDEBUG if (!freed->free) { dump_l("dealloc (!freed->free)"); } #endif LOG_FATAL_IF(!freed->free, "freed block at offset 0x%08lX of size 0x%08lX is not free!", freed->start * kMemoryAlign, freed->size * kMemoryAlign); return freed; } cur = cur->next; } return 0; } void SimpleBestFitAllocator::dump(const char* what) const { Mutex::Autolock _l(mLock); dump_l(what); } void SimpleBestFitAllocator::dump_l(const char* what) const { String8 result; dump_l(result, what); ALOGD("%s", result.string()); } void SimpleBestFitAllocator::dump(String8& result, const char* what) const { Mutex::Autolock _l(mLock); dump_l(result, what); } void SimpleBestFitAllocator::dump_l(String8& result, const char* what) const { size_t size = 0; int32_t i = 0; chunk_t const* cur = mList.head(); const size_t SIZE = 256; char buffer[SIZE]; snprintf(buffer, SIZE, " %s (%p, size=%u)\n", what, this, (unsigned int)mHeapSize); result.append(buffer); while (cur) { const char* errs[] = {"", "| link bogus NP", "| link bogus PN", "| link bogus NP+PN" }; int np = ((cur->next) && cur->next->prev != cur) ? 1 : 0; int pn = ((cur->prev) && cur->prev->next != cur) ? 2 : 0; snprintf(buffer, SIZE, " %3u: %08x | 0x%08X | 0x%08X | %s %s\n", i, int(cur), int(cur->start*kMemoryAlign), int(cur->size*kMemoryAlign), int(cur->free) ? "F" : "A", errs[np|pn]); result.append(buffer); if (!cur->free) size += cur->size*kMemoryAlign; i++; cur = cur->next; } snprintf(buffer, SIZE, " size allocated: %u (%u KB)\n", int(size), int(size/1024)); result.append(buffer); } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/binder/.version0000644000015700001700000000003612200324306023370 0ustar pbuserpbgroup00000000000000CM10.1 Android version 4.2.1 android-audiosystem-1.8+13.10.20130807/lib/binder/ProcessState.cpp0000644000015700001700000002407512200324306025036 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "ProcessState" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define BINDER_VM_SIZE ((1*1024*1024) - (4096 *2)) // --------------------------------------------------------------------------- namespace android { // Global variables int mArgC; const char* const* mArgV; int mArgLen; class PoolThread : public Thread { public: PoolThread(bool isMain) : mIsMain(isMain) { } protected: virtual bool threadLoop() { IPCThreadState::self()->joinThreadPool(mIsMain); return false; } const bool mIsMain; }; sp ProcessState::self() { Mutex::Autolock _l(gProcessMutex); if (gProcess != NULL) { return gProcess; } gProcess = new ProcessState; return gProcess; } void ProcessState::setContextObject(const sp& object) { setContextObject(object, String16("default")); } sp ProcessState::getContextObject(const sp& caller) { return getStrongProxyForHandle(0); } void ProcessState::setContextObject(const sp& object, const String16& name) { AutoMutex _l(mLock); mContexts.add(name, object); } sp ProcessState::getContextObject(const String16& name, const sp& caller) { mLock.lock(); sp object( mContexts.indexOfKey(name) >= 0 ? mContexts.valueFor(name) : NULL); mLock.unlock(); //printf("Getting context object %s for %p\n", String8(name).string(), caller.get()); if (object != NULL) return object; // Don't attempt to retrieve contexts if we manage them if (mManagesContexts) { ALOGE("getContextObject(%s) failed, but we manage the contexts!\n", String8(name).string()); return NULL; } IPCThreadState* ipc = IPCThreadState::self(); { Parcel data, reply; // no interface token on this magic transaction data.writeString16(name); data.writeStrongBinder(caller); status_t result = ipc->transact(0 /*magic*/, 0, data, &reply, 0); if (result == NO_ERROR) { object = reply.readStrongBinder(); } } ipc->flushCommands(); if (object != NULL) setContextObject(object, name); return object; } void ProcessState::startThreadPool() { AutoMutex _l(mLock); if (!mThreadPoolStarted) { mThreadPoolStarted = true; spawnPooledThread(true); } } bool ProcessState::isContextManager(void) const { return mManagesContexts; } bool ProcessState::becomeContextManager(context_check_func checkFunc, void* userData) { if (!mManagesContexts) { AutoMutex _l(mLock); mBinderContextCheckFunc = checkFunc; mBinderContextUserData = userData; int dummy = 0; status_t result = ioctl(mDriverFD, BINDER_SET_CONTEXT_MGR, &dummy); if (result == 0) { mManagesContexts = true; } else if (result == -1) { mBinderContextCheckFunc = NULL; mBinderContextUserData = NULL; ALOGE("Binder ioctl to become context manager failed: %s\n", strerror(errno)); } } return mManagesContexts; } ProcessState::handle_entry* ProcessState::lookupHandleLocked(int32_t handle) { const size_t N=mHandleToObject.size(); if (N <= (size_t)handle) { handle_entry e; e.binder = NULL; e.refs = NULL; status_t err = mHandleToObject.insertAt(e, N, handle+1-N); if (err < NO_ERROR) return NULL; } return &mHandleToObject.editItemAt(handle); } sp ProcessState::getStrongProxyForHandle(int32_t handle) { sp result; AutoMutex _l(mLock); handle_entry* e = lookupHandleLocked(handle); if (e != NULL) { // We need to create a new BpBinder if there isn't currently one, OR we // are unable to acquire a weak reference on this current one. See comment // in getWeakProxyForHandle() for more info about this. IBinder* b = e->binder; if (b == NULL || !e->refs->attemptIncWeak(this)) { b = new BpBinder(handle); e->binder = b; if (b) e->refs = b->getWeakRefs(); result = b; } else { // This little bit of nastyness is to allow us to add a primary // reference to the remote proxy when this team doesn't have one // but another team is sending the handle to us. result.force_set(b); e->refs->decWeak(this); } } return result; } wp ProcessState::getWeakProxyForHandle(int32_t handle) { wp result; AutoMutex _l(mLock); handle_entry* e = lookupHandleLocked(handle); if (e != NULL) { // We need to create a new BpBinder if there isn't currently one, OR we // are unable to acquire a weak reference on this current one. The // attemptIncWeak() is safe because we know the BpBinder destructor will always // call expungeHandle(), which acquires the same lock we are holding now. // We need to do this because there is a race condition between someone // releasing a reference on this BpBinder, and a new reference on its handle // arriving from the driver. IBinder* b = e->binder; if (b == NULL || !e->refs->attemptIncWeak(this)) { b = new BpBinder(handle); result = b; e->binder = b; if (b) e->refs = b->getWeakRefs(); } else { result = b; e->refs->decWeak(this); } } return result; } void ProcessState::expungeHandle(int32_t handle, IBinder* binder) { AutoMutex _l(mLock); handle_entry* e = lookupHandleLocked(handle); // This handle may have already been replaced with a new BpBinder // (if someone failed the AttemptIncWeak() above); we don't want // to overwrite it. if (e && e->binder == binder) e->binder = NULL; } void ProcessState::setArgs(int argc, const char* const argv[]) { mArgC = argc; mArgV = (const char **)argv; mArgLen = 0; for (int i=0; i t = new PoolThread(isMain); t->run(buf); } } status_t ProcessState::setThreadPoolMaxThreadCount(size_t maxThreads) { status_t result = NO_ERROR; if (ioctl(mDriverFD, BINDER_SET_MAX_THREADS, &maxThreads) == -1) { result = -errno; ALOGE("Binder ioctl to set max threads failed: %s", strerror(-result)); } return result; } static int open_driver() { int fd = open("/dev/binder", O_RDWR); if (fd >= 0) { fcntl(fd, F_SETFD, FD_CLOEXEC); int vers; status_t result = ioctl(fd, BINDER_VERSION, &vers); if (result == -1) { ALOGE("Binder ioctl to obtain version failed: %s", strerror(errno)); close(fd); fd = -1; } if (result != 0 || vers != BINDER_CURRENT_PROTOCOL_VERSION) { ALOGE("Binder driver protocol does not match user space protocol!"); close(fd); fd = -1; } size_t maxThreads = 15; result = ioctl(fd, BINDER_SET_MAX_THREADS, &maxThreads); if (result == -1) { ALOGE("Binder ioctl to set max threads failed: %s", strerror(errno)); } } else { ALOGW("Opening '/dev/binder' failed: %s\n", strerror(errno)); } return fd; } ProcessState::ProcessState() : mDriverFD(open_driver()) , mVMStart(MAP_FAILED) , mManagesContexts(false) , mBinderContextCheckFunc(NULL) , mBinderContextUserData(NULL) , mThreadPoolStarted(false) , mThreadPoolSeq(1) { if (mDriverFD >= 0) { // XXX Ideally, there should be a specific define for whether we // have mmap (or whether we could possibly have the kernel module // availabla). #if !defined(HAVE_WIN32_IPC) // mmap the binder, providing a chunk of virtual address space to receive transactions. mVMStart = mmap(0, BINDER_VM_SIZE, PROT_READ, MAP_PRIVATE | MAP_NORESERVE, mDriverFD, 0); if (mVMStart == MAP_FAILED) { // *sigh* ALOGE("Using /dev/binder failed: unable to mmap transaction memory.\n"); close(mDriverFD); mDriverFD = -1; } #else mDriverFD = -1; #endif } LOG_ALWAYS_FATAL_IF(mDriverFD < 0, "Binder driver could not be opened. Terminating."); } ProcessState::~ProcessState() { } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/binder/PermissionCache.cpp0000644000015700001700000000670012200324306025466 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "PermissionCache" #include #include #include #include #include #include namespace android { // ---------------------------------------------------------------------------- ANDROID_SINGLETON_STATIC_INSTANCE(PermissionCache) ; // ---------------------------------------------------------------------------- PermissionCache::PermissionCache() { } status_t PermissionCache::check(bool* granted, const String16& permission, uid_t uid) const { Mutex::Autolock _l(mLock); Entry e; e.name = permission; e.uid = uid; ssize_t index = mCache.indexOf(e); if (index >= 0) { *granted = mCache.itemAt(index).granted; return NO_ERROR; } return NAME_NOT_FOUND; } void PermissionCache::cache(const String16& permission, uid_t uid, bool granted) { Mutex::Autolock _l(mLock); Entry e; ssize_t index = mPermissionNamesPool.indexOf(permission); if (index > 0) { e.name = mPermissionNamesPool.itemAt(index); } else { mPermissionNamesPool.add(permission); e.name = permission; } // note, we don't need to store the pid, which is not actually used in // permission checks e.uid = uid; e.granted = granted; index = mCache.indexOf(e); if (index < 0) { mCache.add(e); } } void PermissionCache::purge() { Mutex::Autolock _l(mLock); mCache.clear(); } bool PermissionCache::checkCallingPermission(const String16& permission) { return PermissionCache::checkCallingPermission(permission, NULL, NULL); } bool PermissionCache::checkCallingPermission( const String16& permission, int32_t* outPid, int32_t* outUid) { IPCThreadState* ipcState = IPCThreadState::self(); pid_t pid = ipcState->getCallingPid(); uid_t uid = ipcState->getCallingUid(); if (outPid) *outPid = pid; if (outUid) *outUid = uid; return PermissionCache::checkPermission(permission, pid, uid); } bool PermissionCache::checkPermission( const String16& permission, pid_t pid, uid_t uid) { if ((uid == 0) || (pid == getpid())) { // root and ourselves is always okay return true; } PermissionCache& pc(PermissionCache::getInstance()); bool granted = false; if (pc.check(&granted, permission, uid) != NO_ERROR) { nsecs_t t = -systemTime(); granted = android::checkPermission(permission, pid, uid); t += systemTime(); ALOGD("checking %s for uid=%d => %s (%d us)", String8(permission).string(), uid, granted?"granted":"denied", (int)ns2us(t)); pc.cache(permission, uid, granted); } return granted; } // --------------------------------------------------------------------------- }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/wctlplugin/0000755000015700001700000000000012200324404022627 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/lib/wctlplugin/build0000755000015700001700000000013012200324306023647 0ustar pbuserpbgroup00000000000000#!/bin/sh target='armel' make clean make -e ARCH=$target make -e ARCH=$target install android-audiosystem-1.8+13.10.20130807/lib/wctlplugin/Makefile0000644000015700001700000000266612200324306024302 0ustar pbuserpbgroup00000000000000make_home := ../../ top_srcdir := ../../ oss_pkg_config_args = "alsa" include $(make_home)/project_make include $(make_home)/package_make ####################### # CUSTOMIZE MACROS HERE ####################### # name your library here PKG_LIB = asound_module_ctl_android # at least one of following lines must be uncommented # CFILES is .c # CCFILES is .cc # CPPFILES is .cpp # CXXFILES is .cxx CFILES = ctl_android.c #CCFILES = #CPPFILES = #CXXFILES = # if this library depends on private static library built # by this package, uncomment next line #STATIC_LIBS = # modify compiler command-line options CFLAGS = -fPIC -DPIC # modify linker command-line options LDFLAGS += $(PKGLDFLAGS) -L ../waudio SHARED_LIBS += -lwaudio -lasound # build private static library private_lib = NO # build simple shared library # single header file exported, should be .../lib/include/$(PKG_LIB).h PKGCONFIG = NO # build pkgconfig shared library # change PKGCONFIG to YES and add following three macros # PKG_LIBDESC is one line description of library # PKG_REQUIRES is list of required pkgconfig libraries # PKG_HEADERS is list of header files to export #PKG_LIBDESC = #PKG_REQUIRES = #PKG_HEADERS = MAKESUBDIR = YES LIBSUBDIR = /usr/lib/$(DEB_HOST_MULTIARCH)/alsa-lib HDRSUBDIR = /usr/include/alsa ############################ # END OF MACROS TO CUSTOMIZE ############################ all: $(TARGET) #-include $(DEPENDS) include $(make_home)/target_lib android-audiosystem-1.8+13.10.20130807/lib/wctlplugin/ctl_android.c0000755000015700001700000001710612200324306025266 0ustar pbuserpbgroup00000000000000/* * ALSA <-> Audioflinger CTL plugin * * Copyright (c) 2010 by Motorola Corporation * Copyright (C) 2011-2012 Canonical, Ltd. * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include "waudio.h" #define ANDROID_AUDIO_ID "0" #define ANDROID_AUDIO_DRIVER "android-audio-router" #define ANDROID_AUDIO_NAME "android-audio-router" #define ANDROID_AUDIO_LONGNAME "android-audio-router to audioflinger" #define ANDROID_AUDIO_MIXERNAME "android-audio-router to audioflinger" enum { VOLUME_MASTER = 0, VOLUME_MASTER_MUTE, VOLUME_PULSE_STREAM, VOLUME_PULSE_STREAM_MUTE, VOLUME_MICROPHONE_MUTE, VOLUME_COUNT }; typedef struct snd_ctl_android { snd_ctl_ext_t ext; } snd_ctl_android_t; static const char *const vol_name[VOLUME_COUNT] = { [VOLUME_MASTER] = "Master Playback Volume", [VOLUME_MASTER_MUTE] = "Master Playback Switch", [VOLUME_PULSE_STREAM] = "PulseAudio Stream Volume", [VOLUME_PULSE_STREAM_MUTE] = "PulseAudio Stream Switch", [VOLUME_MICROPHONE_MUTE] = "Microphone Switch" }; static void android_close(snd_ctl_ext_t *ext) { snd_ctl_android_t *android = ext->private_data; free(android); } static int android_elem_count(snd_ctl_ext_t *ext) { snd_ctl_android_t *android = ext->private_data; assert(android); return VOLUME_COUNT; } static int android_elem_list(snd_ctl_ext_t *ext, unsigned int offset, snd_ctl_elem_id_t *id) { snd_ctl_android_t *android = ext->private_data; assert(android); snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_MIXER); if (offset < VOLUME_COUNT) snd_ctl_elem_id_set_name(id, vol_name[offset]); return 0; } static snd_ctl_ext_key_t android_find_elem(snd_ctl_ext_t *ext, const snd_ctl_elem_id_t *id) { snd_ctl_android_t *android = ext->private_data; const char *name; unsigned int numid, i; assert(android); numid = snd_ctl_elem_id_get_numid(id); if (numid > 0 && numid <= VOLUME_COUNT) return numid - 1; name = snd_ctl_elem_id_get_name(id); for (i = 0; i < VOLUME_COUNT; i++) { if (strcmp(name, vol_name[i]) == 0) return i; } return SND_CTL_EXT_KEY_NOT_FOUND; } static int android_get_attribute(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int *type, unsigned int *acc, unsigned int *count) { snd_ctl_android_t *android = ext->private_data; if (key > VOLUME_COUNT -1) return -EINVAL; assert(android); switch (key) { case VOLUME_MASTER: *type = SND_CTL_ELEM_TYPE_INTEGER; break; case VOLUME_MASTER_MUTE: *type = SND_CTL_ELEM_TYPE_BOOLEAN; break; case VOLUME_PULSE_STREAM: *type = SND_CTL_ELEM_TYPE_INTEGER; break; case VOLUME_PULSE_STREAM_MUTE: *type = SND_CTL_ELEM_TYPE_BOOLEAN; break; case VOLUME_MICROPHONE_MUTE: *type = SND_CTL_ELEM_TYPE_BOOLEAN; break; default: *type = SND_CTL_ELEM_TYPE_BOOLEAN; break; } *acc = SND_CTL_EXT_ACCESS_READWRITE; *count = 1; return 0; } static int android_get_integer_info(snd_ctl_ext_t *ext ATTRIBUTE_UNUSED, snd_ctl_ext_key_t key, long *imin, long *imax, long *istep) { switch (key) { case VOLUME_MASTER: *istep = 1; *imin = 0; *imax = 10; break; case VOLUME_PULSE_STREAM: *istep = 1; *imin = 0; *imax = 10; break; default: break; } return 0; } static int android_read_integer(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value) { snd_ctl_android_t *android = ext->private_data; int err = 0, mute = 0; float fvol = 0; assert(android); switch (key) { case VOLUME_MASTER: if (AudioSystem_getMasterVolume(&fvol) == OK) { *value = (int) (fvol * 10); } break; case VOLUME_MASTER_MUTE: if (AudioSystem_getMasterMute(&mute) == OK) *value = mute ^ 1; break; case VOLUME_PULSE_STREAM: if (AudioSystem_getStreamVolume(AUDIO_STREAM_MUSIC, &fvol, 0) == OK) { *value = (int) (fvol * 10); } break; case VOLUME_PULSE_STREAM_MUTE: if (AudioSystem_getStreamMute(AUDIO_STREAM_MUSIC, &mute) == OK) *value = mute ^ 1; break; case VOLUME_MICROPHONE_MUTE: if (AudioSystem_isMicrophoneMuted(&mute) == OK) *value = mute ^ 1; break; default: err = -EINVAL; break; } return err; } static int android_write_integer(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value) { snd_ctl_android_t *android = ext->private_data; int err = 0; float fvalue; assert(android); switch (key) { case VOLUME_MASTER: fvalue = (float) *value / 10; if (AudioSystem_setMasterVolume(fvalue) != OK) printf("error in master set volume\n"); break; case VOLUME_MASTER_MUTE: if (AudioSystem_setMasterMute(*value ^ 1) != OK) printf("error in master set mute\n"); break; case VOLUME_PULSE_STREAM: fvalue = (float) *value / 10; if (AudioSystem_setStreamVolume(AUDIO_STREAM_MUSIC, fvalue, 0) != OK) printf("error in pulse stream set volume\n"); break; case VOLUME_PULSE_STREAM_MUTE: if (AudioSystem_setStreamMute(AUDIO_STREAM_MUSIC, *value ^ 1) != OK) printf("error in pulse stream set mute\n"); break; case VOLUME_MICROPHONE_MUTE: if (AudioSystem_muteMicrophone(*value ^ 1) != OK) printf("error in microphone set mute\n"); break; default: err = -EINVAL; break; } return err; } static int android_read_event(snd_ctl_ext_t *ext ATTRIBUTE_UNUSED, snd_ctl_elem_id_t *id ATTRIBUTE_UNUSED, unsigned int *event_mask ATTRIBUTE_UNUSED) { return -EAGAIN; } static snd_ctl_ext_callback_t android_ext_callback = { .close = android_close, .elem_count = android_elem_count, .elem_list = android_elem_list, .find_elem = android_find_elem, .get_attribute = android_get_attribute, .get_integer_info = android_get_integer_info, .read_integer = android_read_integer, .write_integer = android_write_integer, .read_event = android_read_event, }; SND_CTL_PLUGIN_DEFINE_FUNC(android) { snd_config_iterator_t it, next; int err; snd_ctl_android_t *android; snd_config_for_each(it, next, conf) { snd_config_t *n = snd_config_iterator_entry(it); const char *id; if (snd_config_get_id(n, &id) < 0) continue; if (strcmp(id, "comment") == 0 || strcmp(id, "type") == 0 || strcmp(id, "hint") == 0 || strcmp(id, "device") == 0) continue; SNDERR("Unknown field %s", id); return -EINVAL; } android = calloc(1, sizeof(*android)); android->ext.version = SND_CTL_EXT_VERSION; android->ext.card_idx = 0; strncpy(android->ext.id, ANDROID_AUDIO_ID, sizeof(android->ext.id) - 1); strncpy(android->ext.driver, ANDROID_AUDIO_DRIVER, sizeof(android->ext.driver) - 1); strncpy(android->ext.name, ANDROID_AUDIO_NAME, sizeof(android->ext.name) - 1); strncpy(android->ext.longname, ANDROID_AUDIO_LONGNAME, sizeof(android->ext.longname) - 1); strncpy(android->ext.mixername, ANDROID_AUDIO_MIXERNAME, sizeof(android->ext.mixername) - 1); android->ext.poll_fd = -1; android->ext.callback = &android_ext_callback; android->ext.private_data = android; err = snd_ctl_ext_create(&android->ext, name, mode); if (err < 0) goto error; *handlep = android->ext.handle; return 0; error: free(android); return err; } SND_CTL_PLUGIN_SYMBOL(android); android-audiosystem-1.8+13.10.20130807/lib/Config.defines.x860000644000015700001700000000250212200324306023627 0ustar pbuserpbgroup00000000000000# Android config -- "android-x86". Used for X86 device builds. CONFIG_DEFINES:= \ -DHAVE_PTHREADS \ -DHAVE_FUTEX \ -DHAVE_FUTEX_WRAPPERS=1 \ -DHAVE_FORKEXEC \ -DHAVE_OOM_ADJ \ -DHAVE_ANDROID_IPC \ -DHAVE_POSIX_FILEMAP \ -DHAVE_TERMIO_H \ -D HAVE_SYS_UIO_H \ -DHAVE_SYMLINKS \ -DHAVE_IOCTL \ -DHAVE_POSIX_CLOCKS \ -DHAVE_TIMEDWAIT_MONOTONIC \ -DHAVE_EPOLL \ -DHAVE_ENDIAN_H \ -DHAVE_LITTLE_ENDIAN \ -DHAVE_BACKTRACE=0 \ -DHAVE_DLADDR=0 \ -DHAVE_CXXABI=0 \ -DHAVE_SCHED_SETSCHEDULER \ -D__linux__ \ -DHAVE_MALLOC_H \ -DHAVE_LINUX_LOCAL_SOCKET_NAMESPACE=1 \ -DHAVE_INOTIFY=1 \ -DHAVE_MADVISE=1 \ -DHAVE_TM_GMTOFF=1 \ -DHAVE_DIRENT_D_TYPE=1 \ -DARCH_X86 \ -DOS_SHARED_LIB_FORMAT_STR="lib%s.so" \ -DHAVE__MEMCMP16=1 \ -DMINCORE_POINTER_TYPE="unsigned char *" \ -DHAVE_SA_NOCLDWAIT \ -DOS_PATH_SEPARATOR="'/'" \ -DOS_CASE_SENSITIVE \ -DHAVE_SYS_SOCKET_H=1 \ -DHAVE_PRCTL=1 \ -DHAVE_WRITEV=1 \ -DHAVE_STDINT_H=1 \ -DHAVE_STDBOOL_H=1 \ -DHAVE_SCHED_H=1 # -DHAVE_SYS_SENDFILE_H=1 \ # -DHAVE_STRLCPY=1 \ # -DHAVE_GETTID \ # -DHAVE_ANDROID_OS=1 \ # -DHAVE_LIBC_SYSTEM_PROPERTIES=1 \ # -DHAVE_MS_C_RUNTIME # -DHAVE_LOCALTIME_R # -DHAVE_GETHOSTBYNAME_R # -DHAVE_WINSOCK # -D_FILE_OFFSET_BITS 64 # -D_LARGEFILE_SOURCE 1 # -DHAVE_SYSTEM_PROPERTY_SERVER # -DHAVE_SHORT_ENUMS android-audiosystem-1.8+13.10.20130807/lib/libcutils/0000755000015700001700000000000012200324404022431 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/lib/libcutils/open_memstream.c0000644000015700001700000002455612200324306025625 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef HAVE_OPEN_MEMSTREAM /* * Implementation of the POSIX open_memstream() function, which Linux has * but BSD lacks. * * Summary: * - Works like a file-backed FILE* opened with fopen(name, "w"), but the * backing is a chunk of memory rather than a file. * - The buffer expands as you write more data. Seeking past the end * of the file and then writing to it zero-fills the gap. * - The values at "*bufp" and "*sizep" should be considered read-only, * and are only valid immediately after an fflush() or fclose(). * - A '\0' is maintained just past the end of the file. This is not included * in "*sizep". (The behavior w.r.t. fseek() is not clearly defined. * The spec says the null byte is written when a write() advances EOF, * but it looks like glibc ensures the null byte is always found at EOF, * even if you just seeked backwards. The example on the opengroup.org * page suggests that this is the expected behavior. The null must be * present after a no-op fflush(), which we can't see, so we have to save * and restore it. Annoying, but allows file truncation.) * - After fclose(), the caller must eventually free(*bufp). * * This is built out of funopen(), which BSD has but Linux lacks. There is * no flush() operator, so we need to keep the user pointers up to date * after each operation. * * I don't think Windows has any of the above, but we don't need to use * them there, so we just supply a stub. */ #include #include #include #include #include #include #include #include #if 0 # define DBUG(x) printf x #else # define DBUG(x) ((void)0) #endif #ifdef HAVE_FUNOPEN /* * Definition of a seekable, write-only memory stream. */ typedef struct { char** bufp; /* pointer to buffer pointer */ size_t* sizep; /* pointer to eof */ size_t allocSize; /* size of buffer */ size_t eof; /* furthest point we've written to */ size_t offset; /* current write offset */ char saved; /* required by NUL handling */ } MemStream; #define kInitialSize 1024 /* * Ensure that we have enough storage to write "size" bytes at the * current offset. We also have to take into account the extra '\0' * that we maintain just past EOF. * * Returns 0 on success. */ static int ensureCapacity(MemStream* stream, int writeSize) { DBUG(("+++ ensureCap off=%d size=%d\n", stream->offset, writeSize)); size_t neededSize = stream->offset + writeSize + 1; if (neededSize <= stream->allocSize) return 0; size_t newSize; if (stream->allocSize == 0) { newSize = kInitialSize; } else { newSize = stream->allocSize; newSize += newSize / 2; /* expand by 3/2 */ } if (newSize < neededSize) newSize = neededSize; DBUG(("+++ realloc %p->%p to size=%d\n", stream->bufp, *stream->bufp, newSize)); char* newBuf = (char*) realloc(*stream->bufp, newSize); if (newBuf == NULL) return -1; *stream->bufp = newBuf; stream->allocSize = newSize; return 0; } /* * Write data to a memstream, expanding the buffer if necessary. * * If we previously seeked beyond EOF, zero-fill the gap. * * Returns the number of bytes written. */ static int write_memstream(void* cookie, const char* buf, int size) { MemStream* stream = (MemStream*) cookie; if (ensureCapacity(stream, size) < 0) return -1; /* seeked past EOF earlier? */ if (stream->eof < stream->offset) { DBUG(("+++ zero-fill gap from %d to %d\n", stream->eof, stream->offset-1)); memset(*stream->bufp + stream->eof, '\0', stream->offset - stream->eof); } /* copy data, advance write pointer */ memcpy(*stream->bufp + stream->offset, buf, size); stream->offset += size; if (stream->offset > stream->eof) { /* EOF has advanced, update it and append null byte */ DBUG(("+++ EOF advanced to %d, appending nul\n", stream->offset)); assert(stream->offset < stream->allocSize); stream->eof = stream->offset; } else { /* within previously-written area; save char we're about to stomp */ DBUG(("+++ within written area, saving '%c' at %d\n", *(*stream->bufp + stream->offset), stream->offset)); stream->saved = *(*stream->bufp + stream->offset); } *(*stream->bufp + stream->offset) = '\0'; *stream->sizep = stream->offset; return size; } /* * Seek within a memstream. * * Returns the new offset, or -1 on failure. */ static fpos_t seek_memstream(void* cookie, fpos_t offset, int whence) { MemStream* stream = (MemStream*) cookie; off_t newPosn = (off_t) offset; if (whence == SEEK_CUR) { newPosn += stream->offset; } else if (whence == SEEK_END) { newPosn += stream->eof; } if (newPosn < 0 || ((fpos_t)((size_t) newPosn)) != newPosn) { /* bad offset - negative or huge */ DBUG(("+++ bogus seek offset %ld\n", (long) newPosn)); errno = EINVAL; return (fpos_t) -1; } if (stream->offset < stream->eof) { /* * We were pointing to an area we'd already written to, which means * we stomped on a character and must now restore it. */ DBUG(("+++ restoring char '%c' at %d\n", stream->saved, stream->offset)); *(*stream->bufp + stream->offset) = stream->saved; } stream->offset = (size_t) newPosn; if (stream->offset < stream->eof) { /* * We're seeked backward into the stream. Preserve the character * at EOF and stomp it with a NUL. */ stream->saved = *(*stream->bufp + stream->offset); *(*stream->bufp + stream->offset) = '\0'; *stream->sizep = stream->offset; } else { /* * We're positioned at, or possibly beyond, the EOF. We want to * publish the current EOF, not the current position. */ *stream->sizep = stream->eof; } return newPosn; } /* * Close the memstream. We free everything but the data buffer. */ static int close_memstream(void* cookie) { free(cookie); return 0; } /* * Prepare a memstream. */ FILE* open_memstream(char** bufp, size_t* sizep) { FILE* fp; MemStream* stream; if (bufp == NULL || sizep == NULL) { errno = EINVAL; return NULL; } stream = (MemStream*) calloc(1, sizeof(MemStream)); if (stream == NULL) return NULL; fp = funopen(stream, NULL, write_memstream, seek_memstream, close_memstream); if (fp == NULL) { free(stream); return NULL; } *sizep = 0; *bufp = NULL; stream->bufp = bufp; stream->sizep = sizep; return fp; } #else /*not HAVE_FUNOPEN*/ FILE* open_memstream(char** bufp, size_t* sizep) { abort(); } #endif /*HAVE_FUNOPEN*/ #if 0 #define _GNU_SOURCE #include #include #include /* * Simple regression test. * * To test on desktop Linux with valgrind, it's possible to make a simple * change to open_memstream() to use fopencookie instead: * * cookie_io_functions_t iofuncs = * { NULL, write_memstream, seek_memstream, close_memstream }; * fp = fopencookie(stream, "w", iofuncs); * * (Some tweaks to seek_memstream are also required, as that takes a * pointer to an offset rather than an offset, and returns 0 or -1.) */ int testMemStream(void) { FILE *stream; char *buf; size_t len; off_t eob; printf("Test1\n"); /* std example */ stream = open_memstream(&buf, &len); fprintf(stream, "hello my world"); fflush(stream); printf("buf=%s, len=%zu\n", buf, len); eob = ftello(stream); fseeko(stream, 0, SEEK_SET); fprintf(stream, "good-bye"); fseeko(stream, eob, SEEK_SET); fclose(stream); printf("buf=%s, len=%zu\n", buf, len); free(buf); printf("Test2\n"); /* std example without final seek-to-end */ stream = open_memstream(&buf, &len); fprintf(stream, "hello my world"); fflush(stream); printf("buf=%s, len=%zu\n", buf, len); eob = ftello(stream); fseeko(stream, 0, SEEK_SET); fprintf(stream, "good-bye"); //fseeko(stream, eob, SEEK_SET); fclose(stream); printf("buf=%s, len=%zu\n", buf, len); free(buf); printf("Test3\n"); /* fancy example; should expand buffer with writes */ static const int kCmpLen = 1024 + 128; char* cmp = malloc(kCmpLen); memset(cmp, 0, 1024); memset(cmp+1024, 0xff, kCmpLen-1024); sprintf(cmp, "This-is-a-tes1234"); sprintf(cmp + 1022, "abcdef"); stream = open_memstream (&buf, &len); setvbuf(stream, NULL, _IONBF, 0); /* note: crashes in glibc with this */ fprintf(stream, "This-is-a-test"); fseek(stream, -1, SEEK_CUR); /* broken in glibc; can use {13,SEEK_SET} */ fprintf(stream, "1234"); fseek(stream, 1022, SEEK_SET); fputc('a', stream); fputc('b', stream); fputc('c', stream); fputc('d', stream); fputc('e', stream); fputc('f', stream); fflush(stream); if (memcmp(buf, cmp, len+1) != 0) { printf("mismatch\n"); } else { printf("match\n"); } printf("Test4\n"); stream = open_memstream (&buf, &len); fseek(stream, 5000, SEEK_SET); fseek(stream, 4096, SEEK_SET); fseek(stream, -1, SEEK_SET); /* should have no effect */ fputc('x', stream); if (ftell(stream) == 4097) printf("good\n"); else printf("BAD: offset is %ld\n", ftell(stream)); printf("DONE\n"); return 0; } /* expected output: Test1 buf=hello my world, len=14 buf=good-bye world, len=14 Test2 buf=hello my world, len=14 buf=good-bye, len=8 Test3 match Test4 good DONE */ #endif #endif /*!HAVE_OPEN_MEMSTREAM*/ android-audiosystem-1.8+13.10.20130807/lib/libcutils/record_stream.c0000644000015700001700000001072712200324306025436 0ustar pbuserpbgroup00000000000000/* libs/cutils/record_stream.c ** ** Copyright 2006, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include #include #include #include #include #include #include #ifdef HAVE_WINSOCK #include /* for ntohl */ #else #include #endif #define HEADER_SIZE 4 struct RecordStream { int fd; size_t maxRecordLen; unsigned char *buffer; unsigned char *unconsumed; unsigned char *read_end; unsigned char *buffer_end; }; extern RecordStream *record_stream_new(int fd, size_t maxRecordLen) { RecordStream *ret; assert (maxRecordLen <= 0xffff); ret = (RecordStream *)calloc(1, sizeof(RecordStream)); ret->fd = fd; ret->maxRecordLen = maxRecordLen; ret->buffer = (unsigned char *)malloc (maxRecordLen + HEADER_SIZE); ret->unconsumed = ret->buffer; ret->read_end = ret->buffer; ret->buffer_end = ret->buffer + maxRecordLen + HEADER_SIZE; return ret; } extern void record_stream_free(RecordStream *rs) { free(rs->buffer); free(rs); } /* returns NULL; if there isn't a full record in the buffer */ static unsigned char * getEndOfRecord (unsigned char *p_begin, unsigned char *p_end) { size_t len; unsigned char * p_ret; if (p_end < p_begin + HEADER_SIZE) { return NULL; } //First four bytes are length len = ntohl(*((uint32_t *)p_begin)); p_ret = p_begin + HEADER_SIZE + len; if (p_end < p_ret) { return NULL; } return p_ret; } static void *getNextRecord (RecordStream *p_rs, size_t *p_outRecordLen) { unsigned char *record_start, *record_end; record_end = getEndOfRecord (p_rs->unconsumed, p_rs->read_end); if (record_end != NULL) { /* one full line in the buffer */ record_start = p_rs->unconsumed + HEADER_SIZE; p_rs->unconsumed = record_end; *p_outRecordLen = record_end - record_start; return record_start; } return NULL; } /** * Reads the next record from stream fd * Records are prefixed by a 16-bit big endian length value * Records may not be larger than maxRecordLen * * Doesn't guard against EINTR * * p_outRecord and p_outRecordLen may not be NULL * * Return 0 on success, -1 on fail * Returns 0 with *p_outRecord set to NULL on end of stream * Returns -1 / errno = EAGAIN if it needs to read again */ int record_stream_get_next (RecordStream *p_rs, void ** p_outRecord, size_t *p_outRecordLen) { void *ret; ssize_t countRead; /* is there one record already in the buffer? */ ret = getNextRecord (p_rs, p_outRecordLen); if (ret != NULL) { *p_outRecord = ret; return 0; } // if the buffer is full and we don't have a full record if (p_rs->unconsumed == p_rs->buffer && p_rs->read_end == p_rs->buffer_end ) { // this should never happen //ALOGE("max record length exceeded\n"); assert (0); errno = EFBIG; return -1; } if (p_rs->unconsumed != p_rs->buffer) { // move remainder to the beginning of the buffer size_t toMove; toMove = p_rs->read_end - p_rs->unconsumed; if (toMove) { memmove(p_rs->buffer, p_rs->unconsumed, toMove); } p_rs->read_end = p_rs->buffer + toMove; p_rs->unconsumed = p_rs->buffer; } countRead = read (p_rs->fd, p_rs->read_end, p_rs->buffer_end - p_rs->read_end); if (countRead <= 0) { /* note: end-of-stream drops through here too */ *p_outRecord = NULL; return countRead; } p_rs->read_end += countRead; ret = getNextRecord (p_rs, p_outRecordLen); if (ret == NULL) { /* not enough of a buffer to for a whole command */ errno = EAGAIN; return -1; } *p_outRecord = ret; return 0; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/iosched_policy.c0000644000015700001700000000312412200324306025573 0ustar pbuserpbgroup00000000000000 /* libs/cutils/iosched_policy.c ** ** Copyright 2007, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include #include #include #include #include #include #ifdef HAVE_SCHED_H #include extern int ioprio_set(int which, int who, int ioprio); enum { WHO_PROCESS = 1, WHO_PGRP, WHO_USER, }; #define CLASS_SHIFT 13 #define IOPRIO_NORM 4 int android_set_ioprio(int pid, IoSchedClass clazz, int ioprio) { #if defined(HAVE_ANDROID_OS) && !defined(HAVE_UBUNTU_OS) if (ioprio_set(WHO_PROCESS, pid, ioprio | (clazz << CLASS_SHIFT))) { return -1; } #endif return 0; } int android_get_ioprio(int pid, IoSchedClass *clazz, int *ioprio) { #if defined(HAVE_ANDROID_OS) && !defined(HAVE_UBUNTU_OS) int rc; if ((rc = ioprio_get(WHO_PROCESS, pid)) < 0) { return -1; } *clazz = (rc >> CLASS_SHIFT); *ioprio = (rc & 0xff); #else *clazz = IoSchedClass_NONE; *ioprio = 0; #endif return 0; } #endif /* HAVE_SCHED_H */ android-audiosystem-1.8+13.10.20130807/lib/libcutils/dir_hash.c0000644000015700001700000002014312200324306024357 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include #include #include #include #include #include #include #include /** * Copies, if it fits within max_output_string bytes, into output_string * a hash of the contents, size, permissions, uid, and gid of the file * specified by path, using the specified algorithm. Returns the length * of the output string, or a negative number if the buffer is too short. */ int get_file_hash(HashAlgorithm algorithm, const char *path, char *output_string, size_t max_output_string) { SHA1_CTX context; struct stat sb; unsigned char md[SHA1_DIGEST_LENGTH]; int used; size_t n; if (algorithm != SHA_1) { errno = EINVAL; return -1; } if (stat(path, &sb) != 0) { return -1; } if (S_ISLNK(sb.st_mode)) { char buf[PATH_MAX]; int len; len = readlink(path, buf, sizeof(buf)); if (len < 0) { return -1; } SHA1Init(&context); SHA1Update(&context, (unsigned char *) buf, len); SHA1Final(md, &context); } else if (S_ISREG(sb.st_mode)) { char buf[10000]; FILE *f = fopen(path, "rb"); int len; if (f == NULL) { return -1; } SHA1Init(&context); while ((len = fread(buf, 1, sizeof(buf), f)) > 0) { SHA1Update(&context, (unsigned char *) buf, len); } if (ferror(f)) { fclose(f); return -1; } fclose(f); SHA1Final(md, &context); } if (S_ISLNK(sb.st_mode) || S_ISREG(sb.st_mode)) { used = b64_ntop(md, SHA1_DIGEST_LENGTH, output_string, max_output_string); if (used < 0) { errno = ENOSPC; return -1; } n = snprintf(output_string + used, max_output_string - used, " %d 0%o %d %d", (int) sb.st_size, sb.st_mode, (int) sb.st_uid, (int) sb.st_gid); } else { n = snprintf(output_string, max_output_string, "- - 0%o %d %d", sb.st_mode, (int) sb.st_uid, (int) sb.st_gid); } if (n >= max_output_string - used) { errno = ENOSPC; return -(used + n); } return used + n; } struct list { char *name; struct list *next; }; static int cmp(const void *a, const void *b) { struct list *const *ra = a; struct list *const *rb = b; return strcmp((*ra)->name, (*rb)->name); } static int recurse(HashAlgorithm algorithm, const char *directory_path, struct list **out) { struct list *list = NULL; struct list *f; struct dirent *de; DIR *d = opendir(directory_path); if (d == NULL) { return -1; } while ((de = readdir(d)) != NULL) { if (strcmp(de->d_name, ".") == 0) { continue; } if (strcmp(de->d_name, "..") == 0) { continue; } char *name = malloc(strlen(de->d_name) + 1); struct list *node = malloc(sizeof(struct list)); if (name == NULL || node == NULL) { struct list *next; for (f = list; f != NULL; f = next) { next = f->next; free(f->name); free(f); } free(name); free(node); return -1; } strcpy(name, de->d_name); node->name = name; node->next = list; list = node; } closedir(d); for (f = list; f != NULL; f = f->next) { struct stat sb; char *name; char outstr[NAME_MAX + 100]; char *keep; struct list *res; name = malloc(strlen(f->name) + strlen(directory_path) + 2); if (name == NULL) { struct list *next; for (f = list; f != NULL; f = f->next) { next = f->next; free(f->name); free(f); } for (f = *out; f != NULL; f = f->next) { next = f->next; free(f->name); free(f); } *out = NULL; return -1; } sprintf(name, "%s/%s", directory_path, f->name); int len = get_file_hash(algorithm, name, outstr, sizeof(outstr)); if (len < 0) { // should not happen return -1; } keep = malloc(len + strlen(name) + 3); res = malloc(sizeof(struct list)); if (keep == NULL || res == NULL) { struct list *next; for (f = list; f != NULL; f = f->next) { next = f->next; free(f->name); free(f); } for (f = *out; f != NULL; f = f->next) { next = f->next; free(f->name); free(f); } *out = NULL; free(keep); free(res); return -1; } sprintf(keep, "%s %s\n", name, outstr); res->name = keep; res->next = *out; *out = res; if ((stat(name, &sb) == 0) && S_ISDIR(sb.st_mode)) { if (recurse(algorithm, name, out) < 0) { struct list *next; for (f = list; f != NULL; f = next) { next = f->next; free(f->name); free(f); } return -1; } } } struct list *next; for (f = list; f != NULL; f = next) { next = f->next; free(f->name); free(f); } } /** * Allocates a string containing the names and hashes of all files recursively * reached under the specified directory_path, using the specified algorithm. * The string is returned as *output_string; the return value is the length * of the string, or a negative number if there was a failure. */ int get_recursive_hash_manifest(HashAlgorithm algorithm, const char *directory_path, char **output_string) { struct list *out = NULL; struct list *r; struct list **list; int count = 0; int len = 0; int retlen = 0; int i; char *buf; if (recurse(algorithm, directory_path, &out) < 0) { return -1; } for (r = out; r != NULL; r = r->next) { count++; len += strlen(r->name); } list = malloc(count * sizeof(struct list *)); if (list == NULL) { struct list *next; for (r = out; r != NULL; r = next) { next = r->next; free(r->name); free(r); } return -1; } count = 0; for (r = out; r != NULL; r = r->next) { list[count++] = r; } qsort(list, count, sizeof(struct list *), cmp); buf = malloc(len + 1); if (buf == NULL) { struct list *next; for (r = out; r != NULL; r = next) { next = r->next; free(r->name); free(r); } free(list); return -1; } for (i = 0; i < count; i++) { int n = strlen(list[i]->name); strcpy(buf + retlen, list[i]->name); retlen += n; } free(list); struct list *next; for (r = out; r != NULL; r = next) { next = r->next; free(r->name); free(r); } *output_string = buf; return retlen; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/ashmem-host.c0000644000015700001700000000611712200324306025030 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Implementation of the user-space ashmem API for the simulator, which lacks * an ashmem-enabled kernel. See ashmem-dev.c for the real ashmem-based version. */ #include #include #include #include #include #include #include #include #include #include #include int ashmem_create_region(const char *ignored, size_t size) { static const char txt[] = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; char name[64]; unsigned int retries = 0; pid_t pid = getpid(); int fd; srand(time(NULL) + pid); retry: /* not beautiful, its just wolf-like loop unrolling */ snprintf(name, sizeof(name), "/tmp/android-ashmem-%d-%c%c%c%c%c%c%c%c", pid, txt[(int) ((sizeof(txt) - 1) * (rand() / (RAND_MAX + 1.0)))], txt[(int) ((sizeof(txt) - 1) * (rand() / (RAND_MAX + 1.0)))], txt[(int) ((sizeof(txt) - 1) * (rand() / (RAND_MAX + 1.0)))], txt[(int) ((sizeof(txt) - 1) * (rand() / (RAND_MAX + 1.0)))], txt[(int) ((sizeof(txt) - 1) * (rand() / (RAND_MAX + 1.0)))], txt[(int) ((sizeof(txt) - 1) * (rand() / (RAND_MAX + 1.0)))], txt[(int) ((sizeof(txt) - 1) * (rand() / (RAND_MAX + 1.0)))], txt[(int) ((sizeof(txt) - 1) * (rand() / (RAND_MAX + 1.0)))]); /* open O_EXCL & O_CREAT: we are either the sole owner or we fail */ fd = open(name, O_RDWR | O_CREAT | O_EXCL, 0600); if (fd == -1) { /* unlikely, but if we failed because `name' exists, retry */ if (errno == EEXIST && ++retries < 6) goto retry; return -1; } /* truncate the file to `len' bytes */ if (ftruncate(fd, size) == -1) goto error; if (unlink(name) == -1) goto error; return fd; error: close(fd); return -1; } int ashmem_set_prot_region(int fd, int prot) { return 0; } int ashmem_pin_region(int fd, size_t offset, size_t len) { return ASHMEM_NOT_PURGED; } int ashmem_unpin_region(int fd, size_t offset, size_t len) { return ASHMEM_IS_UNPINNED; } int ashmem_get_size_region(int fd) { struct stat buf; int result; result = fstat(fd, &buf); if (result == -1) { return -1; } // Check if this is an "ashmem" region. // TODO: This is very hacky, and can easily break. We need some reliable indicator. if (!(buf.st_nlink == 0 && S_ISREG(buf.st_mode))) { errno = ENOTTY; return -1; } return (int)buf.st_size; // TODO: care about overflow (> 2GB file)? } android-audiosystem-1.8+13.10.20130807/lib/libcutils/str_parms.c0000644000015700001700000002042712200324306024615 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "str_params" //#define LOG_NDEBUG 0 #define _GNU_SOURCE 1 #include #include #include #include #include #include #include #include #include struct str_parms { Hashmap *map; }; static bool str_eq(void *key_a, void *key_b) { return !strcmp((const char *)key_a, (const char *)key_b); } /* use djb hash unless we find it inadequate */ static int str_hash_fn(void *str) { uint32_t hash = 5381; char *p; for (p = str; p && *p; p++) hash = ((hash << 5) + hash) + *p; return (int)hash; } struct str_parms *str_parms_create(void) { struct str_parms *str_parms; str_parms = calloc(1, sizeof(struct str_parms)); if (!str_parms) return NULL; str_parms->map = hashmapCreate(5, str_hash_fn, str_eq); if (!str_parms->map) goto err; return str_parms; err: free(str_parms); return NULL; } struct remove_ctxt { struct str_parms *str_parms; const char *key; }; static bool remove_pair(void *key, void *value, void *context) { struct remove_ctxt *ctxt = context; bool should_continue; /* * - if key is not supplied, then we are removing all entries, * so remove key and continue (i.e. return true) * - if key is supplied and matches, then remove it and don't * continue (return false). Otherwise, return true and keep searching * for key. * */ if (!ctxt->key) { should_continue = true; goto do_remove; } else if (!strcmp(ctxt->key, key)) { should_continue = false; goto do_remove; } return true; do_remove: hashmapRemove(ctxt->str_parms->map, key); free(key); free(value); return should_continue; } void str_parms_del(struct str_parms *str_parms, const char *key) { struct remove_ctxt ctxt = { .str_parms = str_parms, .key = key, }; hashmapForEach(str_parms->map, remove_pair, &ctxt); } void str_parms_destroy(struct str_parms *str_parms) { struct remove_ctxt ctxt = { .str_parms = str_parms, }; hashmapForEach(str_parms->map, remove_pair, &ctxt); hashmapFree(str_parms->map); free(str_parms); } struct str_parms *str_parms_create_str(const char *_string) { struct str_parms *str_parms; char *str; char *kvpair; char *tmpstr; int items = 0; str_parms = str_parms_create(); if (!str_parms) goto err_create_str_parms; str = strdup(_string); if (!str) goto err_strdup; ALOGV("%s: source string == '%s'\n", __func__, _string); kvpair = strtok_r(str, ";", &tmpstr); while (kvpair && *kvpair) { char *eq = strchr(kvpair, '='); /* would love strchrnul */ char *value; char *key; void *old_val; if (eq == kvpair) goto next_pair; if (eq) { key = strndup(kvpair, eq - kvpair); if (*(++eq)) value = strdup(eq); else value = strdup(""); } else { key = strdup(kvpair); value = strdup(""); } /* if we replaced a value, free it */ old_val = hashmapPut(str_parms->map, key, value); if (old_val) { free(old_val); free(key); } items++; next_pair: kvpair = strtok_r(NULL, ";", &tmpstr); } if (!items) ALOGV("%s: no items found in string\n", __func__); free(str); return str_parms; err_strdup: str_parms_destroy(str_parms); err_create_str_parms: return NULL; } int str_parms_add_str(struct str_parms *str_parms, const char *key, const char *value) { void *old_val; void *tmp_key; void *tmp_val; tmp_key = strdup(key); tmp_val = strdup(value); old_val = hashmapPut(str_parms->map, tmp_key, tmp_val); if (old_val) { free(old_val); free(tmp_key); } else if (errno == ENOMEM) { free(tmp_key); free(tmp_val); return -ENOMEM; } return 0; } int str_parms_add_int(struct str_parms *str_parms, const char *key, int value) { char val_str[12]; int ret; ret = snprintf(val_str, sizeof(val_str), "%d", value); if (ret < 0) return -EINVAL; ret = str_parms_add_str(str_parms, key, val_str); return ret; } int str_parms_add_float(struct str_parms *str_parms, const char *key, float value) { char val_str[23]; int ret; ret = snprintf(val_str, sizeof(val_str), "%.10f", value); if (ret < 0) return -EINVAL; ret = str_parms_add_str(str_parms, key, val_str); return ret; } int str_parms_get_str(struct str_parms *str_parms, const char *key, char *val, int len) { char *value; value = hashmapGet(str_parms->map, (void *)key); if (value) return strlcpy(val, value, len); return -ENOENT; } int str_parms_get_int(struct str_parms *str_parms, const char *key, int *val) { char *value; char *end; value = hashmapGet(str_parms->map, (void *)key); if (!value) return -ENOENT; *val = (int)strtol(value, &end, 0); if (*value != '\0' && *end == '\0') return 0; return -EINVAL; } int str_parms_get_float(struct str_parms *str_parms, const char *key, float *val) { float out; char *value; char *end; value = hashmapGet(str_parms->map, (void *)key); if (!value) return -ENOENT; out = strtof(value, &end); if (*value != '\0' && *end == '\0') return 0; return -EINVAL; } static bool combine_strings(void *key, void *value, void *context) { char **old_str = context; char *new_str; int ret; ret = asprintf(&new_str, "%s%s%s=%s", *old_str ? *old_str : "", *old_str ? ";" : "", (char *)key, (char *)value); if (*old_str) free(*old_str); if (ret >= 0) { *old_str = new_str; return true; } *old_str = NULL; return false; } char *str_parms_to_str(struct str_parms *str_parms) { char *str = NULL; if (hashmapSize(str_parms->map) > 0) hashmapForEach(str_parms->map, combine_strings, &str); else str = strdup(""); return str; } static bool dump_entry(void *key, void *value, void *context) { ALOGI("key: '%s' value: '%s'\n", (char *)key, (char *)value); return true; } void str_parms_dump(struct str_parms *str_parms) { hashmapForEach(str_parms->map, dump_entry, str_parms); } #ifdef TEST_STR_PARMS static void test_str_parms_str(const char *str) { struct str_parms *str_parms; char *out_str; int ret; str_parms = str_parms_create_str(str); str_parms_add_str(str_parms, "dude", "woah"); str_parms_add_str(str_parms, "dude", "woah"); str_parms_del(str_parms, "dude"); str_parms_dump(str_parms); out_str = str_parms_to_str(str_parms); str_parms_destroy(str_parms); ALOGI("%s: '%s' stringified is '%s'", __func__, str, out_str); free(out_str); } int main(void) { struct str_parms *str_parms; test_str_parms_str(""); test_str_parms_str(";"); test_str_parms_str("="); test_str_parms_str("=;"); test_str_parms_str("=bar"); test_str_parms_str("=bar;"); test_str_parms_str("foo="); test_str_parms_str("foo=;"); test_str_parms_str("foo=bar"); test_str_parms_str("foo=bar;"); test_str_parms_str("foo=bar;baz"); test_str_parms_str("foo=bar;baz="); test_str_parms_str("foo=bar;baz=bat"); test_str_parms_str("foo=bar;baz=bat;"); test_str_parms_str("foo=bar;baz=bat;foo=bar"); return 0; } #endif android-audiosystem-1.8+13.10.20130807/lib/libcutils/uio.c0000644000015700001700000000362112200324306023374 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef HAVE_SYS_UIO_H #include #include int readv( int fd, struct iovec* vecs, int count ) { int total = 0; for ( ; count > 0; count--, vecs++ ) { const char* buf = vecs->iov_base; int len = vecs->iov_len; while (len > 0) { int ret = read( fd, buf, len ); if (ret < 0) { if (total == 0) total = -1; goto Exit; } if (ret == 0) goto Exit; total += ret; buf += ret; len -= ret; } } Exit: return total; } int writev( int fd, const struct iovec* vecs, int count ) { int total = 0; for ( ; count > 0; count--, vecs++ ) { const char* buf = (const char*)vecs->iov_base; int len = (int)vecs->iov_len; while (len > 0) { int ret = write( fd, buf, len ); if (ret < 0) { if (total == 0) total = -1; goto Exit; } if (ret == 0) goto Exit; total += ret; buf += ret; len -= ret; } } Exit: return total; } #endif /* !HAVE_SYS_UIO_H */ android-audiosystem-1.8+13.10.20130807/lib/libcutils/selector.c0000644000015700001700000001706212200324306024424 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "selector" #include #include #include #include #include #include #include #include #include #include "loghack.h" struct Selector { Array* selectableFds; bool looping; fd_set readFds; fd_set writeFds; fd_set exceptFds; int maxFd; int wakeupPipe[2]; SelectableFd* wakeupFd; bool inSelect; pthread_mutex_t inSelectLock; }; /** Reads and ignores wake up data. */ static void eatWakeupData(SelectableFd* wakeupFd) { static char garbage[64]; if (read(wakeupFd->fd, garbage, sizeof(garbage)) < 0) { if (errno == EINTR) { ALOGI("read() interrupted."); } else { LOG_ALWAYS_FATAL("This should never happen: %s", strerror(errno)); } } } static void setInSelect(Selector* selector, bool inSelect) { pthread_mutex_lock(&selector->inSelectLock); selector->inSelect = inSelect; pthread_mutex_unlock(&selector->inSelectLock); } static bool isInSelect(Selector* selector) { pthread_mutex_lock(&selector->inSelectLock); bool inSelect = selector->inSelect; pthread_mutex_unlock(&selector->inSelectLock); return inSelect; } void selectorWakeUp(Selector* selector) { if (!isInSelect(selector)) { // We only need to write wake-up data if we're blocked in select(). return; } static char garbage[1]; if (write(selector->wakeupPipe[1], garbage, sizeof(garbage)) < 0) { if (errno == EINTR) { ALOGI("read() interrupted."); } else { LOG_ALWAYS_FATAL("This should never happen: %s", strerror(errno)); } } } Selector* selectorCreate(void) { Selector* selector = calloc(1, sizeof(Selector)); if (selector == NULL) { LOG_ALWAYS_FATAL("malloc() error."); } selector->selectableFds = arrayCreate(); // Set up wake-up pipe. if (pipe(selector->wakeupPipe) < 0) { LOG_ALWAYS_FATAL("pipe() error: %s", strerror(errno)); } ALOGD("Wakeup fd: %d", selector->wakeupPipe[0]); SelectableFd* wakeupFd = selectorAdd(selector, selector->wakeupPipe[0]); if (wakeupFd == NULL) { LOG_ALWAYS_FATAL("malloc() error."); } wakeupFd->onReadable = &eatWakeupData; pthread_mutex_init(&selector->inSelectLock, NULL); return selector; } SelectableFd* selectorAdd(Selector* selector, int fd) { assert(selector != NULL); SelectableFd* selectableFd = calloc(1, sizeof(SelectableFd)); if (selectableFd != NULL) { selectableFd->selector = selector; selectableFd->fd = fd; arrayAdd(selector->selectableFds, selectableFd); } return selectableFd; } /** * Adds an fd to the given set if the callback is non-null. Returns true * if the fd was added. */ static inline bool maybeAdd(SelectableFd* selectableFd, void (*callback)(SelectableFd*), fd_set* fdSet) { if (callback != NULL) { FD_SET(selectableFd->fd, fdSet); return true; } return false; } /** * Removes stale file descriptors and initializes file descriptor sets. */ static void prepareForSelect(Selector* selector) { fd_set* exceptFds = &selector->exceptFds; fd_set* readFds = &selector->readFds; fd_set* writeFds = &selector->writeFds; FD_ZERO(exceptFds); FD_ZERO(readFds); FD_ZERO(writeFds); Array* selectableFds = selector->selectableFds; int i = 0; selector->maxFd = 0; int size = arraySize(selectableFds); while (i < size) { SelectableFd* selectableFd = arrayGet(selectableFds, i); if (selectableFd->remove) { // This descriptor should be removed. arrayRemove(selectableFds, i); size--; if (selectableFd->onRemove != NULL) { selectableFd->onRemove(selectableFd); } free(selectableFd); } else { if (selectableFd->beforeSelect != NULL) { selectableFd->beforeSelect(selectableFd); } bool inSet = false; if (maybeAdd(selectableFd, selectableFd->onExcept, exceptFds)) { ALOGD("Selecting fd %d for writing...", selectableFd->fd); inSet = true; } if (maybeAdd(selectableFd, selectableFd->onReadable, readFds)) { ALOGD("Selecting fd %d for reading...", selectableFd->fd); inSet = true; } if (maybeAdd(selectableFd, selectableFd->onWritable, writeFds)) { inSet = true; } if (inSet) { // If the fd is in a set, check it against max. int fd = selectableFd->fd; if (fd > selector->maxFd) { selector->maxFd = fd; } } // Move to next descriptor. i++; } } } /** * Invokes a callback if the callback is non-null and the fd is in the given * set. */ static inline void maybeInvoke(SelectableFd* selectableFd, void (*callback)(SelectableFd*), fd_set* fdSet) { if (callback != NULL && !selectableFd->remove && FD_ISSET(selectableFd->fd, fdSet)) { ALOGD("Selected fd %d.", selectableFd->fd); callback(selectableFd); } } /** * Notifies user if file descriptors are readable or writable, or if * out-of-band data is present. */ static void fireEvents(Selector* selector) { Array* selectableFds = selector->selectableFds; int size = arraySize(selectableFds); int i; for (i = 0; i < size; i++) { SelectableFd* selectableFd = arrayGet(selectableFds, i); maybeInvoke(selectableFd, selectableFd->onExcept, &selector->exceptFds); maybeInvoke(selectableFd, selectableFd->onReadable, &selector->readFds); maybeInvoke(selectableFd, selectableFd->onWritable, &selector->writeFds); } } void selectorLoop(Selector* selector) { // Make sure we're not already looping. if (selector->looping) { LOG_ALWAYS_FATAL("Already looping."); } selector->looping = true; while (true) { setInSelect(selector, true); prepareForSelect(selector); ALOGD("Entering select()."); // Select file descriptors. int result = select(selector->maxFd + 1, &selector->readFds, &selector->writeFds, &selector->exceptFds, NULL); ALOGD("Exiting select()."); setInSelect(selector, false); if (result == -1) { // Abort on everything except EINTR. if (errno == EINTR) { ALOGI("select() interrupted."); } else { LOG_ALWAYS_FATAL("select() error: %s", strerror(errno)); } } else if (result > 0) { fireEvents(selector); } } } android-audiosystem-1.8+13.10.20130807/lib/libcutils/zygote.c0000644000015700001700000001466412200324306024132 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "Zygote" #include #include #include #include #include #include #include #include #include #include #include #include #include #define ZYGOTE_SOCKET "zygote" #define ZYGOTE_RETRY_COUNT 1000 #define ZYGOTE_RETRY_MILLIS 500 static void replace_nl(char *str); /* * If sendStdio is non-zero, the current process's stdio file descriptors * will be sent and inherited by the spawned process. */ static int send_request(int fd, int sendStdio, int argc, const char **argv) { #ifndef HAVE_ANDROID_OS // not supported on simulator targets //ALOGE("zygote_* not supported on simulator targets"); return -1; #else /* HAVE_ANDROID_OS */ uint32_t pid; int i; struct iovec ivs[2]; struct msghdr msg; char argc_buffer[12]; const char *newline_string = "\n"; struct cmsghdr *cmsg; char msgbuf[CMSG_SPACE(sizeof(int) * 3)]; int *cmsg_payload; ssize_t ret; memset(&msg, 0, sizeof(msg)); memset(&ivs, 0, sizeof(ivs)); // First line is arg count snprintf(argc_buffer, sizeof(argc_buffer), "%d\n", argc); ivs[0].iov_base = argc_buffer; ivs[0].iov_len = strlen(argc_buffer); msg.msg_iov = ivs; msg.msg_iovlen = 1; if (sendStdio != 0) { // Pass the file descriptors with the first write msg.msg_control = msgbuf; msg.msg_controllen = sizeof msgbuf; cmsg = CMSG_FIRSTHDR(&msg); cmsg->cmsg_len = CMSG_LEN(3 * sizeof(int)); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; cmsg_payload = (int *)CMSG_DATA(cmsg); cmsg_payload[0] = STDIN_FILENO; cmsg_payload[1] = STDOUT_FILENO; cmsg_payload[2] = STDERR_FILENO; } do { ret = sendmsg(fd, &msg, MSG_NOSIGNAL); } while (ret < 0 && errno == EINTR); if (ret < 0) { return -1; } // Only send the fd's once msg.msg_control = NULL; msg.msg_controllen = 0; // replace any newlines with spaces and send the args for (i = 0; i < argc; i++) { char *tofree = NULL; const char *toprint; toprint = argv[i]; if (strchr(toprint, '\n') != NULL) { tofree = strdup(toprint); toprint = tofree; replace_nl(tofree); } ivs[0].iov_base = (char *)toprint; ivs[0].iov_len = strlen(toprint); ivs[1].iov_base = (char *)newline_string; ivs[1].iov_len = 1; msg.msg_iovlen = 2; do { ret = sendmsg(fd, &msg, MSG_NOSIGNAL); } while (ret < 0 && errno == EINTR); if (tofree != NULL) { free(tofree); } if (ret < 0) { return -1; } } // Read the pid, as a 4-byte network-order integer ivs[0].iov_base = &pid; ivs[0].iov_len = sizeof(pid); msg.msg_iovlen = 1; do { do { ret = recvmsg(fd, &msg, MSG_NOSIGNAL | MSG_WAITALL); } while (ret < 0 && errno == EINTR); if (ret < 0) { return -1; } ivs[0].iov_len -= ret; ivs[0].iov_base += ret; } while (ivs[0].iov_len > 0); pid = ntohl(pid); return pid; #endif /* HAVE_ANDROID_OS */ } int zygote_run_wait(int argc, const char **argv, void (*post_run_func)(int)) { int fd; int pid; int err; const char *newargv[argc + 1]; fd = socket_local_client(ZYGOTE_SOCKET, ANDROID_SOCKET_NAMESPACE_RESERVED, AF_LOCAL); if (fd < 0) { return -1; } // The command socket is passed to the peer as close-on-exec // and will close when the peer dies newargv[0] = "--peer-wait"; memcpy(newargv + 1, argv, argc * sizeof(*argv)); pid = send_request(fd, 1, argc + 1, newargv); if (pid > 0 && post_run_func != NULL) { post_run_func(pid); } // Wait for socket to close do { int dummy; err = read(fd, &dummy, sizeof(dummy)); } while ((err < 0 && errno == EINTR) || err != 0); do { err = close(fd); } while (err < 0 && errno == EINTR); return 0; } /** * Spawns a new dalvik instance via the Zygote process. The non-zygote * arguments are passed to com.android.internal.os.RuntimeInit(). The * first non-option argument should be a class name in the system class path. * * The arg list may start with zygote params such as --set-uid. * * If sendStdio is non-zero, the current process's stdio file descriptors * will be sent and inherited by the spawned process. * * The pid of the child process is returned, or -1 if an error was * encountered. * * zygote_run_oneshot waits up to ZYGOTE_RETRY_COUNT * * ZYGOTE_RETRY_MILLIS for the zygote socket to be available. */ int zygote_run_oneshot(int sendStdio, int argc, const char **argv) { int fd = -1; int err; int i; int retries; int pid; const char **newargv = argv; const int newargc = argc; for (retries = 0; (fd < 0) && (retries < ZYGOTE_RETRY_COUNT); retries++) { if (retries > 0) { struct timespec ts; memset(&ts, 0, sizeof(ts)); ts.tv_nsec = ZYGOTE_RETRY_MILLIS * 1000 * 1000; do { err = nanosleep (&ts, &ts); } while (err < 0 && errno == EINTR); } fd = socket_local_client(ZYGOTE_SOCKET, AF_LOCAL, ANDROID_SOCKET_NAMESPACE_RESERVED); } if (fd < 0) { return -1; } pid = send_request(fd, 0, newargc, newargv); do { err = close(fd); } while (err < 0 && errno == EINTR); return pid; } /** * Replaces all occurrances of newline with space. */ static void replace_nl(char *str) { for(; *str; str++) { if (*str == '\n') { *str = ' '; } } } android-audiosystem-1.8+13.10.20130807/lib/libcutils/socket_loopback_client.c0000644000015700001700000000274112200324306027302 0ustar pbuserpbgroup00000000000000/* libs/cutils/socket_loopback_client.c ** ** Copyright 2006, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include #include #include #include #include #include #ifndef HAVE_WINSOCK #include #include #include #include #endif /* Connect to port on the loopback IP interface. type is * SOCK_STREAM or SOCK_DGRAM. * return is a file descriptor or -1 on error */ int socket_loopback_client(int port, int type) { struct sockaddr_in addr; socklen_t alen; int s; memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); s = socket(AF_INET, type, 0); if(s < 0) return -1; if(connect(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { close(s); return -1; } return s; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/strdup16to8.c0000644000015700001700000001075112200324306024725 0ustar pbuserpbgroup00000000000000/* libs/cutils/strdup16to8.c ** ** Copyright 2006, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include /* for SIZE_MAX */ #include #include #include /** * Given a UTF-16 string, compute the length of the corresponding UTF-8 * string in bytes. */ extern size_t strnlen16to8(const char16_t* utf16Str, size_t len) { size_t utf8Len = 0; /* A small note on integer overflow. The result can * potentially be as big as 3*len, which will overflow * for len > SIZE_MAX/3. * * Moreover, the result of a strnlen16to8 is typically used * to allocate a destination buffer to strncpy16to8 which * requires one more byte to terminate the UTF-8 copy, and * this is generally done by careless users by incrementing * the result without checking for integer overflows, e.g.: * * dst = malloc(strnlen16to8(utf16,len)+1) * * Due to this, the following code will try to detect * overflows, and never return more than (SIZE_MAX-1) * when it detects one. A careless user will try to malloc * SIZE_MAX bytes, which will return NULL which can at least * be detected appropriately. * * As far as I know, this function is only used by strndup16(), * but better be safe than sorry. */ /* Fast path for the usual case where 3*len is < SIZE_MAX-1. */ if (len < (SIZE_MAX-1)/3) { while (len--) { unsigned int uic = *utf16Str++; if (uic > 0x07ff) utf8Len += 3; else if (uic > 0x7f || uic == 0) utf8Len += 2; else utf8Len++; } return utf8Len; } /* The slower but paranoid version */ while (len--) { unsigned int uic = *utf16Str++; size_t utf8Cur = utf8Len; if (uic > 0x07ff) utf8Len += 3; else if (uic > 0x7f || uic == 0) utf8Len += 2; else utf8Len++; if (utf8Len < utf8Cur) /* overflow detected */ return SIZE_MAX-1; } /* don't return SIZE_MAX to avoid common user bug */ if (utf8Len == SIZE_MAX) utf8Len = SIZE_MAX-1; return utf8Len; } /** * Convert a Java-Style UTF-16 string + length to a JNI-Style UTF-8 string. * * This basically means: embedded \0's in the UTF-16 string are encoded * as "0xc0 0x80" * * Make sure you allocate "utf8Str" with the result of strlen16to8() + 1, * not just "len". * * Please note, a terminated \0 is always added, so your result will always * be "strlen16to8() + 1" bytes long. */ extern char* strncpy16to8(char* utf8Str, const char16_t* utf16Str, size_t len) { char* utf8cur = utf8Str; /* Note on overflows: We assume the user did check the result of * strnlen16to8() properly or at a minimum checked the result of * its malloc(SIZE_MAX) in case of overflow. */ while (len--) { unsigned int uic = *utf16Str++; if (uic > 0x07ff) { *utf8cur++ = (uic >> 12) | 0xe0; *utf8cur++ = ((uic >> 6) & 0x3f) | 0x80; *utf8cur++ = (uic & 0x3f) | 0x80; } else if (uic > 0x7f || uic == 0) { *utf8cur++ = (uic >> 6) | 0xc0; *utf8cur++ = (uic & 0x3f) | 0x80; } else { *utf8cur++ = uic; if (uic == 0) { break; } } } *utf8cur = '\0'; return utf8Str; } /** * Convert a UTF-16 string to UTF-8. * */ char * strndup16to8 (const char16_t* s, size_t n) { char* ret; size_t len; if (s == NULL) { return NULL; } len = strnlen16to8(s, n); /* We are paranoid, and we check for SIZE_MAX-1 * too since it is an overflow value for our * strnlen16to8 implementation. */ if (len >= SIZE_MAX-1) return NULL; ret = malloc(len + 1); if (ret == NULL) return NULL; strncpy16to8 (ret, s, n); return ret; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/properties.c0000644000015700001700000002056412200324306025001 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "properties" #include #include #include #include #include #include #include #include "loghack.h" #ifdef HAVE_LIBC_SYSTEM_PROPERTIES #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ #include int property_set(const char *key, const char *value) { return __system_property_set(key, value); } int property_set_sync(const char *key, const char *value) { return __system_property_set(key, value); } int property_get(const char *key, char *value, const char *default_value) { int len; len = __system_property_get(key, value); if(len > 0) { return len; } if(default_value) { len = strlen(default_value); memcpy(value, default_value, len + 1); } return len; } int property_list(void (*propfn)(const char *key, const char *value, void *cookie), void *cookie) { char name[PROP_NAME_MAX]; char value[PROP_VALUE_MAX]; const prop_info *pi; unsigned n; for(n = 0; (pi = __system_property_find_nth(n)); n++) { __system_property_read(pi, name, value); propfn(name, value, cookie); } return 0; } #elif defined(HAVE_SYSTEM_PROPERTY_SERVER) /* * The Linux simulator provides a "system property server" that uses IPC * to set/get/list properties. The file descriptor is shared by all * threads in the process, so we use a mutex to ensure that requests * from multiple threads don't get interleaved. */ #include #include #include #include #include static pthread_once_t gInitOnce = PTHREAD_ONCE_INIT; static pthread_mutex_t gPropertyFdLock = PTHREAD_MUTEX_INITIALIZER; static int gPropFd = -1; /* * Connect to the properties server. * * Returns the socket descriptor on success. */ static int connectToServer(const char* fileName) { int sock = -1; int cc; struct sockaddr_un addr; sock = socket(AF_UNIX, SOCK_STREAM, 0); if (sock < 0) { ALOGW("UNIX domain socket create failed (errno=%d)\n", errno); return -1; } /* connect to socket; fails if file doesn't exist */ strcpy(addr.sun_path, fileName); // max 108 bytes addr.sun_family = AF_UNIX; cc = connect(sock, (struct sockaddr*) &addr, SUN_LEN(&addr)); if (cc < 0) { // ENOENT means socket file doesn't exist // ECONNREFUSED means socket exists but nobody is listening //ALOGW("AF_UNIX connect failed for '%s': %s\n", // fileName, strerror(errno)); close(sock); return -1; } return sock; } /* * Perform one-time initialization. */ static void init(void) { assert(gPropFd == -1); gPropFd = connectToServer(SYSTEM_PROPERTY_PIPE_NAME); if (gPropFd < 0) { //ALOGW("not connected to system property server\n"); } else { //ALOGV("Connected to system property server\n"); } } int property_get(const char *key, char *value, const char *default_value) { char sendBuf[1+PROPERTY_KEY_MAX]; char recvBuf[1+PROPERTY_VALUE_MAX]; int len = -1; //ALOGV("PROPERTY GET [%s]\n", key); pthread_once(&gInitOnce, init); if (gPropFd < 0) { /* this mimics the behavior of the device implementation */ if (default_value != NULL) { strcpy(value, default_value); len = strlen(value); } return len; } if (strlen(key) >= PROPERTY_KEY_MAX) return -1; memset(sendBuf, 0xdd, sizeof(sendBuf)); // placate valgrind sendBuf[0] = (char) kSystemPropertyGet; strcpy(sendBuf+1, key); pthread_mutex_lock(&gPropertyFdLock); if (write(gPropFd, sendBuf, sizeof(sendBuf)) != sizeof(sendBuf)) { pthread_mutex_unlock(&gPropertyFdLock); return -1; } if (read(gPropFd, recvBuf, sizeof(recvBuf)) != sizeof(recvBuf)) { pthread_mutex_unlock(&gPropertyFdLock); return -1; } pthread_mutex_unlock(&gPropertyFdLock); /* first byte is 0 if value not defined, 1 if found */ if (recvBuf[0] == 0) { if (default_value != NULL) { strcpy(value, default_value); len = strlen(value); } else { /* * If the value isn't defined, hand back an empty string and * a zero length, rather than a failure. This seems wrong, * since you can't tell the difference between "undefined" and * "defined but empty", but it's what the device does. */ value[0] = '\0'; len = 0; } } else if (recvBuf[0] == 1) { strcpy(value, recvBuf+1); len = strlen(value); } else { ALOGE("Got strange response to property_get request (%d)\n", recvBuf[0]); assert(0); return -1; } //ALOGV("PROP [found=%d def='%s'] (%d) [%s]: [%s]\n", // recvBuf[0], default_value, len, key, value); return len; } int property_set(const char *key, const char *value) { char sendBuf[1+PROPERTY_KEY_MAX+PROPERTY_VALUE_MAX]; char recvBuf[1]; int result = -1; //ALOGV("PROPERTY SET [%s]: [%s]\n", key, value); pthread_once(&gInitOnce, init); if (gPropFd < 0) return -1; if (strlen(key) >= PROPERTY_KEY_MAX) return -1; if (strlen(value) >= PROPERTY_VALUE_MAX) return -1; memset(sendBuf, 0xdd, sizeof(sendBuf)); // placate valgrind sendBuf[0] = (char) kSystemPropertySet; strcpy(sendBuf+1, key); strcpy(sendBuf+1+PROPERTY_KEY_MAX, value); pthread_mutex_lock(&gPropertyFdLock); if (write(gPropFd, sendBuf, sizeof(sendBuf)) != sizeof(sendBuf)) { pthread_mutex_unlock(&gPropertyFdLock); return -1; } if (read(gPropFd, recvBuf, sizeof(recvBuf)) != sizeof(recvBuf)) { pthread_mutex_unlock(&gPropertyFdLock); return -1; } pthread_mutex_unlock(&gPropertyFdLock); if (recvBuf[0] != 1) return -1; return 0; } int property_list(void (*propfn)(const char *key, const char *value, void *cookie), void *cookie) { //ALOGV("PROPERTY LIST\n"); pthread_once(&gInitOnce, init); if (gPropFd < 0) return -1; return 0; } #else /* SUPER-cheesy place-holder implementation for Win32 */ #include static mutex_t env_lock = MUTEX_INITIALIZER; int property_get(const char *key, char *value, const char *default_value) { char ename[PROPERTY_KEY_MAX + 6]; char *p; int len; len = strlen(key); if(len >= PROPERTY_KEY_MAX) return -1; memcpy(ename, "PROP_", 5); memcpy(ename + 5, key, len + 1); mutex_lock(&env_lock); p = getenv(ename); if(p == 0) p = ""; len = strlen(p); if(len >= PROPERTY_VALUE_MAX) { len = PROPERTY_VALUE_MAX - 1; } if((len == 0) && default_value) { len = strlen(default_value); memcpy(value, default_value, len + 1); } else { memcpy(value, p, len); value[len] = 0; } mutex_unlock(&env_lock); return len; } int property_set(const char *key, const char *value) { char ename[PROPERTY_KEY_MAX + 6]; char *p; int len; int r; if(strlen(value) >= PROPERTY_VALUE_MAX) return -1; len = strlen(key); if(len >= PROPERTY_KEY_MAX) return -1; memcpy(ename, "PROP_", 5); memcpy(ename + 5, key, len + 1); mutex_lock(&env_lock); #ifdef HAVE_MS_C_RUNTIME { char temp[256]; snprintf( temp, sizeof(temp), "%s=%s", ename, value); putenv(temp); r = 0; } #else r = setenv(ename, value, 1); #endif mutex_unlock(&env_lock); return r; } int property_list(void (*propfn)(const char *key, const char *value, void *cookie), void *cookie) { return 0; } #endif android-audiosystem-1.8+13.10.20130807/lib/libcutils/dlmalloc_stubs.c0000644000015700001700000000210412200324306025602 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "cutils/log.h" /* * Stubs for functions defined in bionic/libc/bionic/dlmalloc.c. These * are used in host builds, as the host libc will not contain these * functions. */ void dlmalloc_inspect_all(void(*handler)(void*, void *, size_t, void*), void* arg) { ALOGW("Called host unimplemented stub: dlmalloc_inspect_all"); } int dlmalloc_trim(size_t unused) { ALOGW("Called host unimplemented stub: dlmalloc_trim"); return 0; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/load_file.c0000644000015700001700000000231512200324306024515 0ustar pbuserpbgroup00000000000000/* libs/cutils/load_file.c ** ** Copyright 2006, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include #include #include void *load_file(const char *fn, unsigned *_sz) { char *data; int sz; int fd; data = 0; fd = open(fn, O_RDONLY); if(fd < 0) return 0; sz = lseek(fd, 0, SEEK_END); if(sz < 0) goto oops; if(lseek(fd, 0, SEEK_SET) != 0) goto oops; data = (char*) malloc(sz + 1); if(data == 0) goto oops; if(read(fd, data, sz) != sz) goto oops; close(fd); data[sz] = 0; if(_sz) *_sz = sz; return data; oops: close(fd); if(data != 0) free(data); return 0; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/atomics_arm.S0000644000015700001700000001502512200324306025057 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include #include #include #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 #if defined(__ARM_HAVE_LDREX_STREX) /* * =========================================================================== * ARMv6+ implementation * =========================================================================== */ /* r0(addr) -> r0(old) */ ENTRY(__atomic_dec) mov r1, r0 @ copy addr so we don't clobber it 1: ldrex r0, [r1] @ load current value into r0 sub r2, r0, #1 @ generate new value into r2 strex r3, r2, [r1] @ try to store new value; result in r3 cmp r3, #0 @ success? bxeq lr @ yes, return b 1b @ no, retry END(__atomic_dec) /* r0(addr) -> r0(old) */ ENTRY(__atomic_inc) mov r1, r0 1: ldrex r0, [r1] add r2, r0, #1 strex r3, r2, [r1] cmp r3, #0 bxeq lr b 1b END(__atomic_inc) /* r0(old) r1(new) r2(addr) -> r0(zero_if_succeeded) */ ENTRY(__atomic_cmpxchg) 1: mov ip, #2 @ ip=2 means "new != old" ldrex r3, [r2] @ load current value into r3 teq r0, r3 @ new == old? strexeq ip, r1, [r2] @ yes, try store, set ip to 0 or 1 teq ip, #1 @ strex failure? beq 1b @ yes, retry mov r0, ip @ return 0 on success, 2 on failure bx lr END(__atomic_cmpxchg) /* r0(new) r1(addr) -> r0(old) */ ENTRY(__atomic_swap) 1: ldrex r2, [r1] strex r3, r0, [r1] teq r3, #0 bne 1b mov r0, r2 bx lr END(__atomic_swap) #else /*not defined __ARM_HAVE_LDREX_STREX*/ /* * =========================================================================== * Pre-ARMv6 implementation * =========================================================================== */ /* int __kernel_cmpxchg(int oldval, int newval, int* ptr) */ .equ kernel_cmpxchg, 0xFFFF0FC0 .equ kernel_atomic_base, 0xFFFF0FFF /* r0(addr) -> r0(old) */ ENTRY(__atomic_dec) .save {r4, lr} stmdb sp!, {r4, lr} mov r2, r0 1: @ atomic_dec ldr r0, [r2] mov r3, #kernel_atomic_base add lr, pc, #4 sub r1, r0, #1 add pc, r3, #(kernel_cmpxchg - kernel_atomic_base) bcc 1b add r0, r1, #1 ldmia sp!, {r4, lr} bx lr END(__atomic_dec) /* r0(addr) -> r0(old) */ ENTRY(__atomic_inc) .save {r4, lr} stmdb sp!, {r4, lr} mov r2, r0 1: @ atomic_inc ldr r0, [r2] mov r3, #kernel_atomic_base add lr, pc, #4 add r1, r0, #1 add pc, r3, #(kernel_cmpxchg - kernel_atomic_base) bcc 1b sub r0, r1, #1 ldmia sp!, {r4, lr} bx lr END(__atomic_inc) /* r0(old) r1(new) r2(addr) -> r0(zero_if_succeeded) */ ENTRY(__atomic_cmpxchg) .save {r4, lr} stmdb sp!, {r4, lr} mov r4, r0 /* r4 = save oldvalue */ 1: @ atomic_cmpxchg mov r3, #kernel_atomic_base add lr, pc, #4 mov r0, r4 /* r0 = oldvalue */ add pc, r3, #(kernel_cmpxchg - kernel_atomic_base) bcs 2f /* swap was made. we're good, return. */ ldr r3, [r2] /* swap not made, see if it's because *ptr!=oldvalue */ cmp r3, r4 beq 1b 2: @ atomic_cmpxchg ldmia sp!, {r4, lr} bx lr END(__atomic_cmpxchg) /* r0(new) r1(addr) -> r0(old) */ ENTRY(__atomic_swap) swp r0, r0, [r1] bx lr END(__atomic_swap) #endif /*not defined __ARM_HAVE_LDREX_STREX*/ /* __futex_wait(*ftx, val, *timespec) */ /* __futex_wake(*ftx, counter) */ /* __futex_syscall3(*ftx, op, val) */ /* __futex_syscall4(*ftx, op, val, *timespec) */ .global __futex_wait .type __futex_wait, %function .global __futex_wake .type __futex_wake, %function .global __futex_syscall3 .type __futex_syscall3, %function .global __futex_syscall4 .type __futex_syscall4, %function #if __ARM_EABI__ ENTRY(__futex_syscall3) stmdb sp!, {r4, r7} .save {r4, r7} ldr r7, =__NR_futex swi #0 ldmia sp!, {r4, r7} bx lr END(__futex_syscall3) ENTRY(__futex_wait) stmdb sp!, {r4, r7} .save {r4, r7} mov r3, r2 mov r2, r1 mov r1, #FUTEX_WAIT ldr r7, =__NR_futex swi #0 ldmia sp!, {r4, r7} bx lr END(__futex_wait) ENTRY(__futex_wake) .save {r4, r7} stmdb sp!, {r4, r7} mov r2, r1 mov r1, #FUTEX_WAKE ldr r7, =__NR_futex swi #0 ldmia sp!, {r4, r7} bx lr END(__futex_wake) #else ENTRY(__futex_syscall3) swi #__NR_futex bx lr END(__futex_syscall3) ENTRY(__futex_wait) mov r3, r2 mov r2, r1 mov r1, #FUTEX_WAIT swi #__NR_futex bx lr END(__futex_wait) ENTRY(__futex_wake) mov r2, r1 mov r1, #FUTEX_WAKE swi #__NR_futex bx lr END(__futex_wake) #endif ENTRY(__futex_syscall4) b __futex_syscall3 END(__futex_syscall4) android-audiosystem-1.8+13.10.20130807/lib/libcutils/uevent.c0000644000015700001700000000630512200324306024110 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include #include #include #include #include /** * Like recv(), but checks that messages actually originate from the kernel. */ ssize_t uevent_kernel_multicast_recv(int socket, void *buffer, size_t length) { uid_t user = -1; return uevent_kernel_multicast_uid_recv(socket, buffer, length, &user); } /** * Like the above, but passes a uid_t in by reference. In the event that this * fails due to a bad uid check, the uid_t will be set to the uid of the * socket's peer. * * If this method rejects a netlink message from outside the kernel, it * returns -1, sets errno to EIO, and sets "user" to the UID associated with the * message. If the peer UID cannot be determined, "user" is set to -1." */ ssize_t uevent_kernel_multicast_uid_recv(int socket, void *buffer, size_t length, uid_t *user) { struct iovec iov = { buffer, length }; struct sockaddr_nl addr; char control[CMSG_SPACE(sizeof(struct ucred))]; struct msghdr hdr = { &addr, sizeof(addr), &iov, 1, control, sizeof(control), 0, }; *user = -1; ssize_t n = recvmsg(socket, &hdr, 0); if (n <= 0) { return n; } struct cmsghdr *cmsg = CMSG_FIRSTHDR(&hdr); if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { /* ignoring netlink message with no sender credentials */ goto out; } struct ucred *cred = (struct ucred *)CMSG_DATA(cmsg); *user = cred->uid; if (cred->uid != 0) { /* ignoring netlink message from non-root user */ goto out; } if (addr.nl_groups == 0 || addr.nl_pid != 0) { /* ignoring non-kernel or unicast netlink message */ goto out; } return n; out: /* clear residual potentially malicious data */ bzero(buffer, length); errno = EIO; return -1; } int uevent_open_socket(int buf_sz, bool passcred) { struct sockaddr_nl addr; int on = passcred; int s; memset(&addr, 0, sizeof(addr)); addr.nl_family = AF_NETLINK; addr.nl_pid = getpid(); addr.nl_groups = 0xffffffff; s = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); if(s < 0) return -1; setsockopt(s, SOL_SOCKET, SO_RCVBUFFORCE, &buf_sz, sizeof(buf_sz)); setsockopt(s, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); if(bind(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { close(s); return -1; } return s; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/private.h0000644000015700001700000002051212200324306024255 0ustar pbuserpbgroup00000000000000#ifndef PRIVATE_H #define PRIVATE_H /* ** This file is in the public domain, so clarified as of ** 1996-06-05 by Arthur David Olson. */ /* ** This header is for use ONLY with the time conversion code. ** There is no guarantee that it will remain unchanged, ** or that it will remain at all. ** Do NOT copy it to any system include directory. ** Thank you! */ /* ** ID */ #ifndef lint #ifndef NOID static char privatehid[] = "@(#)private.h 8.2"; #endif /* !defined NOID */ #endif /* !defined lint */ #define GRANDPARENTED "Local time zone must be set--see zic manual page" /* ** Defaults for preprocessor symbols. ** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'. */ #ifndef HAVE_ADJTIME #define HAVE_ADJTIME 1 #endif /* !defined HAVE_ADJTIME */ #ifndef HAVE_GETTEXT #define HAVE_GETTEXT 0 #endif /* !defined HAVE_GETTEXT */ #ifndef HAVE_INCOMPATIBLE_CTIME_R #define HAVE_INCOMPATIBLE_CTIME_R 0 #endif /* !defined INCOMPATIBLE_CTIME_R */ #ifndef HAVE_SETTIMEOFDAY #define HAVE_SETTIMEOFDAY 3 #endif /* !defined HAVE_SETTIMEOFDAY */ #ifndef HAVE_STRERROR #define HAVE_STRERROR 1 #endif /* !defined HAVE_STRERROR */ #ifndef HAVE_SYMLINK #define HAVE_SYMLINK 1 #endif /* !defined HAVE_SYMLINK */ #ifndef HAVE_SYS_STAT_H #define HAVE_SYS_STAT_H 1 #endif /* !defined HAVE_SYS_STAT_H */ #ifndef HAVE_SYS_WAIT_H #define HAVE_SYS_WAIT_H 1 #endif /* !defined HAVE_SYS_WAIT_H */ #ifndef HAVE_UNISTD_H #define HAVE_UNISTD_H 1 #endif /* !defined HAVE_UNISTD_H */ #ifndef HAVE_UTMPX_H #define HAVE_UTMPX_H 0 #endif /* !defined HAVE_UTMPX_H */ #ifndef LOCALE_HOME #define LOCALE_HOME "/usr/lib/locale" #endif /* !defined LOCALE_HOME */ #if HAVE_INCOMPATIBLE_CTIME_R #define asctime_r _incompatible_asctime_r #define ctime_r _incompatible_ctime_r #endif /* HAVE_INCOMPATIBLE_CTIME_R */ /* ** Nested includes */ #include "sys/types.h" /* for time_t */ #include "stdio.h" #include "errno.h" #include "string.h" #include "limits.h" /* for CHAR_BIT et al. */ #include "time.h" #include "stdlib.h" #if HAVE_GETTEXT #include "libintl.h" #endif /* HAVE_GETTEXT */ #if HAVE_SYS_WAIT_H #include /* for WIFEXITED and WEXITSTATUS */ #endif /* HAVE_SYS_WAIT_H */ #ifndef WIFEXITED #define WIFEXITED(status) (((status) & 0xff) == 0) #endif /* !defined WIFEXITED */ #ifndef WEXITSTATUS #define WEXITSTATUS(status) (((status) >> 8) & 0xff) #endif /* !defined WEXITSTATUS */ #if HAVE_UNISTD_H #include "unistd.h" /* for F_OK and R_OK */ #endif /* HAVE_UNISTD_H */ #if !HAVE_UNISTD_H #ifndef F_OK #define F_OK 0 #endif /* !defined F_OK */ #ifndef R_OK #define R_OK 4 #endif /* !defined R_OK */ #endif /* !HAVE_UNISTD_H */ /* Unlike 's isdigit, this also works if c < 0 | c > UCHAR_MAX. */ #define is_digit(c) ((unsigned)(c) - '0' <= 9) /* ** Define HAVE_STDINT_H's default value here, rather than at the ** start, since __GLIBC__'s value depends on previously-included ** files. ** (glibc 2.1 and later have stdint.h, even with pre-C99 compilers.) */ #ifndef HAVE_STDINT_H #define HAVE_STDINT_H \ (199901 <= __STDC_VERSION__ || \ 2 < (__GLIBC__ + (0 < __GLIBC_MINOR__))) #endif /* !defined HAVE_STDINT_H */ #if HAVE_STDINT_H #include "stdint.h" #endif /* !HAVE_STDINT_H */ #ifndef INT_FAST64_MAX /* Pre-C99 GCC compilers define __LONG_LONG_MAX__ instead of LLONG_MAX. */ #if defined LLONG_MAX || defined __LONG_LONG_MAX__ typedef long long int_fast64_t; #else /* ! (defined LLONG_MAX || defined __LONG_LONG_MAX__) */ #if (LONG_MAX >> 31) < 0xffffffff Please use a compiler that supports a 64-bit integer type (or wider); you may need to compile with "-DHAVE_STDINT_H". #endif /* (LONG_MAX >> 31) < 0xffffffff */ typedef long int_fast64_t; #endif /* ! (defined LLONG_MAX || defined __LONG_LONG_MAX__) */ #endif /* !defined INT_FAST64_MAX */ #ifndef INT32_MAX #define INT32_MAX 0x7fffffff #endif /* !defined INT32_MAX */ #ifndef INT32_MIN #define INT32_MIN (-1 - INT32_MAX) #endif /* !defined INT32_MIN */ /* ** Workarounds for compilers/systems. */ /* ** If your compiler lacks prototypes, "#define P(x) ()". */ #ifndef P #define P(x) x #endif /* !defined P */ /* ** SunOS 4.1.1 headers lack EXIT_SUCCESS. */ #ifndef EXIT_SUCCESS #define EXIT_SUCCESS 0 #endif /* !defined EXIT_SUCCESS */ /* ** SunOS 4.1.1 headers lack EXIT_FAILURE. */ #ifndef EXIT_FAILURE #define EXIT_FAILURE 1 #endif /* !defined EXIT_FAILURE */ /* ** SunOS 4.1.1 headers lack FILENAME_MAX. */ #ifndef FILENAME_MAX #ifndef MAXPATHLEN #ifdef unix #include "sys/param.h" #endif /* defined unix */ #endif /* !defined MAXPATHLEN */ #ifdef MAXPATHLEN #define FILENAME_MAX MAXPATHLEN #endif /* defined MAXPATHLEN */ #ifndef MAXPATHLEN #define FILENAME_MAX 1024 /* Pure guesswork */ #endif /* !defined MAXPATHLEN */ #endif /* !defined FILENAME_MAX */ /* ** SunOS 4.1.1 libraries lack remove. */ #ifndef remove extern int unlink P((const char * filename)); #define remove unlink #endif /* !defined remove */ /* ** Some ancient errno.h implementations don't declare errno. ** But some newer errno.h implementations define it as a macro. ** Fix the former without affecting the latter. */ #ifndef errno extern int errno; #endif /* !defined errno */ /* ** Some time.h implementations don't declare asctime_r. ** Others might define it as a macro. ** Fix the former without affecting the latter. */ #ifndef asctime_r extern char * asctime_r(); #endif /* ** Private function declarations. */ char * icalloc P((int nelem, int elsize)); char * icatalloc P((char * old, const char * new)); char * icpyalloc P((const char * string)); char * imalloc P((int n)); void * irealloc P((void * pointer, int size)); void icfree P((char * pointer)); void ifree P((char * pointer)); const char * scheck P((const char * string, const char * format)); /* ** Finally, some convenience items. */ #ifndef TRUE #define TRUE 1 #endif /* !defined TRUE */ #ifndef FALSE #define FALSE 0 #endif /* !defined FALSE */ #ifndef TYPE_BIT #define TYPE_BIT(type) (sizeof (type) * CHAR_BIT) #endif /* !defined TYPE_BIT */ #ifndef TYPE_SIGNED #define TYPE_SIGNED(type) (((type) -1) < 0) #endif /* !defined TYPE_SIGNED */ /* ** Since the definition of TYPE_INTEGRAL contains floating point numbers, ** it cannot be used in preprocessor directives. */ #ifndef TYPE_INTEGRAL #define TYPE_INTEGRAL(type) (((type) 0.5) != 0.5) #endif /* !defined TYPE_INTEGRAL */ #ifndef INT_STRLEN_MAXIMUM /* ** 302 / 1000 is log10(2.0) rounded up. ** Subtract one for the sign bit if the type is signed; ** add one for integer division truncation; ** add one more for a minus sign if the type is signed. */ #define INT_STRLEN_MAXIMUM(type) \ ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \ 1 + TYPE_SIGNED(type)) #endif /* !defined INT_STRLEN_MAXIMUM */ /* ** INITIALIZE(x) */ #ifndef GNUC_or_lint #ifdef lint #define GNUC_or_lint #endif /* defined lint */ #ifndef lint #ifdef __GNUC__ #define GNUC_or_lint #endif /* defined __GNUC__ */ #endif /* !defined lint */ #endif /* !defined GNUC_or_lint */ #ifndef INITIALIZE #ifdef GNUC_or_lint #define INITIALIZE(x) ((x) = 0) #endif /* defined GNUC_or_lint */ #ifndef GNUC_or_lint #define INITIALIZE(x) #endif /* !defined GNUC_or_lint */ #endif /* !defined INITIALIZE */ /* ** For the benefit of GNU folk... ** `_(MSGID)' uses the current locale's message library string for MSGID. ** The default is to use gettext if available, and use MSGID otherwise. */ #ifndef _ #if HAVE_GETTEXT #define _(msgid) gettext(msgid) #else /* !HAVE_GETTEXT */ #define _(msgid) msgid #endif /* !HAVE_GETTEXT */ #endif /* !defined _ */ #ifndef TZ_DOMAIN #define TZ_DOMAIN "tz" #endif /* !defined TZ_DOMAIN */ #if HAVE_INCOMPATIBLE_CTIME_R #undef asctime_r #undef ctime_r char *asctime_r P((struct tm const *, char *)); char *ctime_r P((time_t const *, char *)); #endif /* HAVE_INCOMPATIBLE_CTIME_R */ #ifndef YEARSPERREPEAT #define YEARSPERREPEAT 400 /* years before a Gregorian repeat */ #endif /* !defined YEARSPERREPEAT */ /* ** The Gregorian year averages 365.2425 days, which is 31556952 seconds. */ #ifndef AVGSECSPERYEAR #define AVGSECSPERYEAR 31556952L #endif /* !defined AVGSECSPERYEAR */ #ifndef SECSPERREPEAT #define SECSPERREPEAT ((int_fast64_t) YEARSPERREPEAT * (int_fast64_t) AVGSECSPERYEAR) #endif /* !defined SECSPERREPEAT */ #ifndef SECSPERREPEAT_BITS #define SECSPERREPEAT_BITS 34 /* ceil(log2(SECSPERREPEAT)) */ #endif /* !defined SECSPERREPEAT_BITS */ /* ** UNIX was a registered trademark of The Open Group in 2003. */ #endif /* !defined PRIVATE_H */ android-audiosystem-1.8+13.10.20130807/lib/libcutils/Android.mk0000644000015700001700000001053012200324306024342 0ustar pbuserpbgroup00000000000000# # Copyright (C) 2008 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # LOCAL_PATH := $(my-dir) include $(CLEAR_VARS) ifeq ($(TARGET_CPU_SMP),true) targetSmpFlag := -DANDROID_SMP=1 else targetSmpFlag := -DANDROID_SMP=0 endif hostSmpFlag := -DANDROID_SMP=0 commonSources := \ array.c \ hashmap.c \ atomic.c.arm \ native_handle.c \ buffer.c \ socket_inaddr_any_server.c \ socket_local_client.c \ socket_local_server.c \ socket_loopback_client.c \ socket_loopback_server.c \ socket_network_client.c \ sockets.c \ config_utils.c \ cpu_info.c \ load_file.c \ list.c \ open_memstream.c \ strdup16to8.c \ strdup8to16.c \ record_stream.c \ process_name.c \ properties.c \ qsort_r_compat.c \ threads.c \ sched_policy.c \ iosched_policy.c \ str_parms.c \ commonHostSources := \ ashmem-host.c # some files must not be compiled when building against Mingw # they correspond to features not used by our host development tools # which are also hard or even impossible to port to native Win32 WINDOWS_HOST_ONLY := ifeq ($(HOST_OS),windows) ifeq ($(strip $(USE_CYGWIN)),) WINDOWS_HOST_ONLY := 1 endif endif # USE_MINGW is defined when we build against Mingw on Linux ifneq ($(strip $(USE_MINGW)),) WINDOWS_HOST_ONLY := 1 endif ifeq ($(WINDOWS_HOST_ONLY),1) commonSources += \ uio.c else commonSources += \ abort_socket.c \ fs.c \ selector.c \ tztime.c \ multiuser.c \ zygote.c commonHostSources += \ tzstrftime.c endif # Static library for host # ======================================================== LOCAL_MODULE := libcutils LOCAL_SRC_FILES := $(commonSources) $(commonHostSources) dlmalloc_stubs.c LOCAL_LDLIBS := -lpthread LOCAL_STATIC_LIBRARIES := liblog LOCAL_CFLAGS += $(hostSmpFlag) include $(BUILD_HOST_STATIC_LIBRARY) # Static library for host, 64-bit # ======================================================== include $(CLEAR_VARS) LOCAL_MODULE := lib64cutils LOCAL_SRC_FILES := $(commonSources) $(commonHostSources) dlmalloc_stubs.c LOCAL_LDLIBS := -lpthread LOCAL_STATIC_LIBRARIES := lib64log LOCAL_CFLAGS += $(hostSmpFlag) -m64 include $(BUILD_HOST_STATIC_LIBRARY) # Shared and static library for target # ======================================================== # This is needed in LOCAL_C_INCLUDES to access the C library's private # header named # libcutils_c_includes := bionic/libc/private include $(CLEAR_VARS) LOCAL_MODULE := libcutils LOCAL_SRC_FILES := $(commonSources) \ android_reboot.c \ ashmem-dev.c \ debugger.c \ klog.c \ mq.c \ partition_utils.c \ qtaguid.c \ uevent.c ifeq ($(TARGET_ARCH),arm) LOCAL_SRC_FILES += arch-arm/memset32.S else # !arm ifeq ($(TARGET_ARCH_VARIANT),x86-atom) LOCAL_CFLAGS += -DHAVE_MEMSET16 -DHAVE_MEMSET32 LOCAL_SRC_FILES += arch-x86/android_memset16.S arch-x86/android_memset32.S memory.c else # !x86-atom LOCAL_SRC_FILES += memory.c endif # !x86-atom endif # !arm ifneq ($(TARGET_RECOVERY_PRE_COMMAND),) LOCAL_CFLAGS += -DRECOVERY_PRE_COMMAND='$(TARGET_RECOVERY_PRE_COMMAND)' endif ifeq ($(TARGET_RECOVERY_PRE_COMMAND_CLEAR_REASON),true) LOCAL_CFLAGS += -DRECOVERY_PRE_COMMAND_CLEAR_REASON endif LOCAL_C_INCLUDES := $(libcutils_c_includes) $(KERNEL_HEADERS) LOCAL_STATIC_LIBRARIES := liblog LOCAL_CFLAGS += $(targetSmpFlag) include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := libcutils LOCAL_WHOLE_STATIC_LIBRARIES := libcutils LOCAL_SHARED_LIBRARIES := liblog LOCAL_CFLAGS += $(targetSmpFlag) LOCAL_C_INCLUDES := $(libcutils_c_includes) include $(BUILD_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := tst_str_parms LOCAL_CFLAGS += -DTEST_STR_PARMS LOCAL_SRC_FILES := str_parms.c hashmap.c memory.c LOCAL_SHARED_LIBRARIES := liblog LOCAL_MODULE_TAGS := optional include $(BUILD_EXECUTABLE) android-audiosystem-1.8+13.10.20130807/lib/libcutils/debugger.c0000644000015700001700000000475512200324306024375 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include int dump_tombstone(pid_t tid, char* pathbuf, size_t pathlen) { int s = socket_local_client(DEBUGGER_SOCKET_NAME, ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_STREAM); if (s < 0) { return -1; } debugger_msg_t msg; msg.tid = tid; msg.action = DEBUGGER_ACTION_DUMP_TOMBSTONE; int result = 0; if (TEMP_FAILURE_RETRY(write(s, &msg, sizeof(msg))) != sizeof(msg)) { result = -1; } else { char ack; if (TEMP_FAILURE_RETRY(read(s, &ack, 1)) != 1) { result = -1; } else { if (pathbuf && pathlen) { ssize_t n = TEMP_FAILURE_RETRY(read(s, pathbuf, pathlen - 1)); if (n <= 0) { result = -1; } else { pathbuf[n] = '\0'; } } } } TEMP_FAILURE_RETRY(close(s)); return result; } int dump_backtrace_to_file(pid_t tid, int fd) { int s = socket_local_client(DEBUGGER_SOCKET_NAME, ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_STREAM); if (s < 0) { return -1; } debugger_msg_t msg; msg.tid = tid; msg.action = DEBUGGER_ACTION_DUMP_BACKTRACE; int result = 0; if (TEMP_FAILURE_RETRY(write(s, &msg, sizeof(msg))) != sizeof(msg)) { result = -1; } else { char ack; if (TEMP_FAILURE_RETRY(read(s, &ack, 1)) != 1) { result = -1; } else { char buffer[4096]; ssize_t n; while ((n = TEMP_FAILURE_RETRY(read(s, buffer, sizeof(buffer)))) > 0) { if (TEMP_FAILURE_RETRY(write(fd, buffer, n)) != n) { result = -1; break; } } } } TEMP_FAILURE_RETRY(close(s)); return result; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/tzfile.h0000644000015700001700000001166012200324306024104 0ustar pbuserpbgroup00000000000000#ifndef TZFILE_H #define TZFILE_H /* ** This file is in the public domain, so clarified as of ** 1996-06-05 by Arthur David Olson. */ /* ** This header is for use ONLY with the time conversion code. ** There is no guarantee that it will remain unchanged, ** or that it will remain at all. ** Do NOT copy it to any system include directory. ** Thank you! */ /* ** ID */ #ifndef lint #ifndef NOID static char tzfilehid[] = "@(#)tzfile.h 8.1"; #endif /* !defined NOID */ #endif /* !defined lint */ /* ** Information about time zone files. */ #ifndef TZDIR #define TZDIR "/usr/share/zoneinfo" /* "/android/usr/share/zoneinfo" */ /* Time zone object file directory */ #endif /* !defined TZDIR */ #ifndef TZDEFAULT #define TZDEFAULT "localtime" #endif /* !defined TZDEFAULT */ #ifndef TZDEFRULES #define TZDEFRULES "posixrules" #endif /* !defined TZDEFRULES */ /* ** Each file begins with. . . */ #define TZ_MAGIC "TZif" struct tzhead { char tzh_magic[4]; /* TZ_MAGIC */ char tzh_version[1]; /* '\0' or '2' as of 2005 */ char tzh_reserved[15]; /* reserved--must be zero */ char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */ char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ char tzh_leapcnt[4]; /* coded number of leap seconds */ char tzh_timecnt[4]; /* coded number of transition times */ char tzh_typecnt[4]; /* coded number of local time types */ char tzh_charcnt[4]; /* coded number of abbr. chars */ }; /* ** . . .followed by. . . ** ** tzh_timecnt (char [4])s coded transition times a la time(2) ** tzh_timecnt (unsigned char)s types of local time starting at above ** tzh_typecnt repetitions of ** one (char [4]) coded UTC offset in seconds ** one (unsigned char) used to set tm_isdst ** one (unsigned char) that's an abbreviation list index ** tzh_charcnt (char)s '\0'-terminated zone abbreviations ** tzh_leapcnt repetitions of ** one (char [4]) coded leap second transition times ** one (char [4]) total correction after above ** tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition ** time is standard time, if FALSE, ** transition time is wall clock time ** if absent, transition times are ** assumed to be wall clock time ** tzh_ttisgmtcnt (char)s indexed by type; if TRUE, transition ** time is UTC, if FALSE, ** transition time is local time ** if absent, transition times are ** assumed to be local time */ /* ** If tzh_version is '2' or greater, the above is followed by a second instance ** of tzhead and a second instance of the data in which each coded transition ** time uses 8 rather than 4 chars, ** then a POSIX-TZ-environment-variable-style string for use in handling ** instants after the last transition time stored in the file ** (with nothing between the newlines if there is no POSIX representation for ** such instants). */ /* ** In the current implementation, "tzset()" refuses to deal with files that ** exceed any of the limits below. */ #ifndef TZ_MAX_TIMES #define TZ_MAX_TIMES 1200 #endif /* !defined TZ_MAX_TIMES */ #ifndef TZ_MAX_TYPES #ifndef NOSOLAR #define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ #endif /* !defined NOSOLAR */ #ifdef NOSOLAR /* ** Must be at least 14 for Europe/Riga as of Jan 12 1995, ** as noted by Earl Chew. */ #define TZ_MAX_TYPES 20 /* Maximum number of local time types */ #endif /* !defined NOSOLAR */ #endif /* !defined TZ_MAX_TYPES */ #ifndef TZ_MAX_CHARS #define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ /* (limited by what unsigned chars can hold) */ #endif /* !defined TZ_MAX_CHARS */ #ifndef TZ_MAX_LEAPS #define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ #endif /* !defined TZ_MAX_LEAPS */ #define SECSPERMIN 60 #define MINSPERHOUR 60 #define HOURSPERDAY 24 #define DAYSPERWEEK 7 #define DAYSPERNYEAR 365 #define DAYSPERLYEAR 366 #define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) #define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY) #define MONSPERYEAR 12 #define TM_SUNDAY 0 #define TM_MONDAY 1 #define TM_TUESDAY 2 #define TM_WEDNESDAY 3 #define TM_THURSDAY 4 #define TM_FRIDAY 5 #define TM_SATURDAY 6 #define TM_JANUARY 0 #define TM_FEBRUARY 1 #define TM_MARCH 2 #define TM_APRIL 3 #define TM_MAY 4 #define TM_JUNE 5 #define TM_JULY 6 #define TM_AUGUST 7 #define TM_SEPTEMBER 8 #define TM_OCTOBER 9 #define TM_NOVEMBER 10 #define TM_DECEMBER 11 #define TM_YEAR_BASE 1900 #define EPOCH_YEAR 1970 #define EPOCH_WDAY TM_THURSDAY #define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) /* ** Since everything in isleap is modulo 400 (or a factor of 400), we know that ** isleap(y) == isleap(y % 400) ** and so ** isleap(a + b) == isleap((a + b) % 400) ** or ** isleap(a + b) == isleap(a % 400 + b % 400) ** This is true even if % means modulo rather than Fortran remainder ** (which is allowed by C89 but not C99). ** We use this to avoid addition overflow problems. */ #define isleap_sum(a, b) isleap((a) % 400 + (b) % 400) #endif /* !defined TZFILE_H */ android-audiosystem-1.8+13.10.20130807/lib/libcutils/tztime.c0000644000015700001700000014067612200324306024130 0ustar pbuserpbgroup00000000000000/* ** This file is in the public domain, so clarified as of ** 1996-06-05 by Arthur David Olson. */ #include #ifndef lint #ifndef NOID static char elsieid[] = "@(#)localtime.c 8.3"; #endif /* !defined NOID */ #endif /* !defined lint */ /* ** Leap second handling from Bradley White. ** POSIX-style TZ environment variable handling from Guy Harris. */ /*LINTLIBRARY*/ #include "private.h" #include "tzfile.h" #include "fcntl.h" #include "float.h" /* for FLT_MAX and DBL_MAX */ #ifndef TZ_ABBR_MAX_LEN #define TZ_ABBR_MAX_LEN 16 #endif /* !defined TZ_ABBR_MAX_LEN */ #ifndef TZ_ABBR_CHAR_SET #define TZ_ABBR_CHAR_SET \ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 :+-._" #endif /* !defined TZ_ABBR_CHAR_SET */ #ifndef TZ_ABBR_ERR_CHAR #define TZ_ABBR_ERR_CHAR '_' #endif /* !defined TZ_ABBR_ERR_CHAR */ #define INDEXFILE "/system/usr/share/zoneinfo/zoneinfo.idx" #define DATAFILE "/system/usr/share/zoneinfo/zoneinfo.dat" #define NAMELEN 40 #define INTLEN 4 #define READLEN (NAMELEN + 3 * INTLEN) /* ** SunOS 4.1.1 headers lack O_BINARY. */ #ifdef O_BINARY #define OPEN_MODE (O_RDONLY | O_BINARY) #endif /* defined O_BINARY */ #ifndef O_BINARY #define OPEN_MODE O_RDONLY #endif /* !defined O_BINARY */ /* Complex computations to determine the min/max of time_t depending * on TYPE_BIT / TYPE_SIGNED / TYPE_INTEGRAL. * These macros cannot be used in pre-processor directives, so we * let the C compiler do the work, which makes things a bit funky. */ static const time_t TIME_T_MAX = TYPE_INTEGRAL(time_t) ? ( TYPE_SIGNED(time_t) ? ~((time_t)1 << (TYPE_BIT(time_t)-1)) : ~(time_t)0 ) : /* if time_t is a floating point number */ ( sizeof(time_t) > sizeof(float) ? (time_t)DBL_MAX : (time_t)FLT_MAX ); static const time_t TIME_T_MIN = TYPE_INTEGRAL(time_t) ? ( TYPE_SIGNED(time_t) ? ((time_t)1 << (TYPE_BIT(time_t)-1)) : 0 ) : ( sizeof(time_t) > sizeof(float) ? (time_t)DBL_MIN : (time_t)FLT_MIN ); #ifndef WILDABBR /* ** Someone might make incorrect use of a time zone abbreviation: ** 1. They might reference tzname[0] before calling tzset (explicitly ** or implicitly). ** 2. They might reference tzname[1] before calling tzset (explicitly ** or implicitly). ** 3. They might reference tzname[1] after setting to a time zone ** in which Daylight Saving Time is never observed. ** 4. They might reference tzname[0] after setting to a time zone ** in which Standard Time is never observed. ** 5. They might reference tm.TM_ZONE after calling offtime. ** What's best to do in the above cases is open to debate; ** for now, we just set things up so that in any of the five cases ** WILDABBR is used. Another possibility: initialize tzname[0] to the ** string "tzname[0] used before set", and similarly for the other cases. ** And another: initialize tzname[0] to "ERA", with an explanation in the ** manual page of what this "time zone abbreviation" means (doing this so ** that tzname[0] has the "normal" length of three characters). */ #define WILDABBR " " #endif /* !defined WILDABBR */ static char wildabbr[] = WILDABBR; static const char gmt[] = "GMT"; /* ** The DST rules to use if TZ has no rules and we can't load TZDEFRULES. ** We default to US rules as of 1999-08-17. ** POSIX 1003.1 section 8.1.1 says that the default DST rules are ** implementation dependent; for historical reasons, US rules are a ** common default. */ #ifndef TZDEFRULESTRING #define TZDEFRULESTRING ",M4.1.0,M10.5.0" #endif /* !defined TZDEFDST */ struct ttinfo { /* time type information */ long tt_gmtoff; /* UTC offset in seconds */ int tt_isdst; /* used to set tm_isdst */ int tt_abbrind; /* abbreviation list index */ int tt_ttisstd; /* TRUE if transition is std time */ int tt_ttisgmt; /* TRUE if transition is UTC */ }; struct lsinfo { /* leap second information */ time_t ls_trans; /* transition time */ long ls_corr; /* correction to apply */ }; #define BIGGEST(a, b) (((a) > (b)) ? (a) : (b)) #ifdef TZNAME_MAX #define MY_TZNAME_MAX TZNAME_MAX #endif /* defined TZNAME_MAX */ #ifndef TZNAME_MAX #define MY_TZNAME_MAX 255 #endif /* !defined TZNAME_MAX */ struct state { int leapcnt; int timecnt; int typecnt; int charcnt; int goback; int goahead; time_t ats[TZ_MAX_TIMES]; unsigned char types[TZ_MAX_TIMES]; struct ttinfo ttis[TZ_MAX_TYPES]; char chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, sizeof gmt), (2 * (MY_TZNAME_MAX + 1)))]; struct lsinfo lsis[TZ_MAX_LEAPS]; }; struct rule { int r_type; /* type of rule--see below */ int r_day; /* day number of rule */ int r_week; /* week number of rule */ int r_mon; /* month number of rule */ long r_time; /* transition time of rule */ }; #define JULIAN_DAY 0 /* Jn - Julian day */ #define DAY_OF_YEAR 1 /* n - day of year */ #define MONTH_NTH_DAY_OF_WEEK 2 /* Mm.n.d - month, week, day of week */ /* ** Prototypes for static functions. */ static long detzcode P((const char * codep)); static time_t detzcode64 P((const char * codep)); static int differ_by_repeat P((time_t t1, time_t t0)); static const char * getzname P((const char * strp)); static const char * getqzname P((const char * strp, const int delim)); static const char * getnum P((const char * strp, int * nump, int min, int max)); static const char * getsecs P((const char * strp, long * secsp)); static const char * getoffset P((const char * strp, long * offsetp)); static const char * getrule P((const char * strp, struct rule * rulep)); static void gmtload P((struct state * sp)); static struct tm * gmtsub P((const time_t * timep, long offset, struct tm * tmp)); static struct tm * localsub P((const time_t * timep, long offset, struct tm * tmp, const struct state *sp)); static int increment_overflow P((int * number, int delta)); static int leaps_thru_end_of P((int y)); static int long_increment_overflow P((long * number, int delta)); static int long_normalize_overflow P((long * tensptr, int * unitsptr, int base)); static int normalize_overflow P((int * tensptr, int * unitsptr, int base)); static void settzname P((void)); static time_t time1 P((struct tm * tmp, struct tm * (*funcp) P((const time_t *, long, struct tm *, const struct state* sp)), long offset, const struct state * sp)); static time_t time2 P((struct tm *tmp, struct tm * (*funcp) P((const time_t *, long, struct tm*, const struct state* sp)), long offset, int * okayp, const struct state * sp)); static time_t time2sub P((struct tm *tmp, struct tm * (*funcp) P((const time_t*, long, struct tm*,const struct state *sp)), long offset, int * okayp, int do_norm_secs, const struct state *sp)); static struct tm * timesub P((const time_t * timep, long offset, const struct state * sp, struct tm * tmp)); static int tmcomp P((const struct tm * atmp, const struct tm * btmp)); static time_t transtime P((time_t janfirst, int year, const struct rule * rulep, long offset)); static int tzload P((const char * name, struct state * sp, int doextend)); static int tzload_uncached P((const char * name, struct state * sp, int doextend)); static int tzparse P((const char * name, struct state * sp, int lastditch)); #ifdef ALL_STATE static struct state * gmtptr; #endif /* defined ALL_STATE */ #ifndef ALL_STATE static struct state gmtmem; #define gmtptr (&gmtmem) #endif /* State Farm */ #define CACHE_COUNT 4 static char * g_cacheNames[CACHE_COUNT] = {0,0}; static struct state g_cacheStates[CACHE_COUNT]; static int g_lastCache = 0; static struct state g_utc; unsigned char g_utcSet = 0; #ifndef TZ_STRLEN_MAX #define TZ_STRLEN_MAX 255 #endif /* !defined TZ_STRLEN_MAX */ static char lcl_TZname[TZ_STRLEN_MAX + 1]; static int lcl_is_set; static int gmt_is_set; char * tzname[2] = { wildabbr, wildabbr }; /* ** Section 4.12.3 of X3.159-1989 requires that ** Except for the strftime function, these functions [asctime, ** ctime, gmtime, localtime] return values in one of two static ** objects: a broken-down time structure and an array of char. ** Thanks to Paul Eggert for noting this. */ static struct tm tm; #ifdef USG_COMPAT time_t timezone = 0; int daylight = 0; #endif /* defined USG_COMPAT */ #ifdef ALTZONE time_t altzone = 0; #endif /* defined ALTZONE */ static long detzcode(codep) const char * const codep; { register long result; register int i; result = (codep[0] & 0x80) ? ~0L : 0; for (i = 0; i < 4; ++i) result = (result << 8) | (codep[i] & 0xff); return result; } static time_t detzcode64(codep) const char * const codep; { register time_t result; register int i; result = (codep[0] & 0x80) ? (~(int_fast64_t) 0) : 0; for (i = 0; i < 8; ++i) result = result * 256 + (codep[i] & 0xff); return result; } static int differ_by_repeat(t1, t0) const time_t t1; const time_t t0; { if (TYPE_INTEGRAL(time_t) && TYPE_BIT(time_t) - TYPE_SIGNED(time_t) < SECSPERREPEAT_BITS) return 0; return t1 - t0 == SECSPERREPEAT; } static int toint(unsigned char *s) { return (s[0] << 24) | (s[1] << 16) | (s[2] << 8) | s[3]; } static int tzload(const char *name, struct state * const sp, const int doextend) { if (name) { int i, err; if (0 == strcmp(name, "UTC")) { if (!g_utcSet) { tzload_uncached(name, &g_utc, 1); g_utcSet = 1; } //printf("tzload: utc\n"); *sp = g_utc; return 0; } for (i=0; i= CACHE_COUNT) { g_lastCache = 0; } i = g_lastCache; if (g_cacheNames[i]) { free(g_cacheNames[i]); } err = tzload_uncached(name, &(g_cacheStates[i]), 1); if (err == 0) { g_cacheNames[i] = strdup(name); *sp = g_cacheStates[i]; return 0; } else { g_cacheNames[i] = NULL; return err; } } return tzload_uncached(name, sp, doextend); } static int tzload_uncached(name, sp, doextend) register const char * name; register struct state * const sp; register const int doextend; { register const char * p; register int i; register int fid; register int stored; register int nread; union { struct tzhead tzhead; char buf[2 * sizeof(struct tzhead) + 2 * sizeof *sp + 4 * TZ_MAX_TIMES]; } u; int toread = sizeof u.buf; if (name == NULL && (name = TZDEFAULT) == NULL) return -1; { register int doaccess; /* ** Section 4.9.1 of the C standard says that ** "FILENAME_MAX expands to an integral constant expression ** that is the size needed for an array of char large enough ** to hold the longest file name string that the implementation ** guarantees can be opened." */ char fullname[FILENAME_MAX + 1]; const char *origname = name; if (name[0] == ':') ++name; doaccess = name[0] == '/'; if (!doaccess) { if ((p = TZDIR) == NULL) return -1; if ((strlen(p) + strlen(name) + 1) >= sizeof fullname) return -1; (void) strcpy(fullname, p); (void) strcat(fullname, "/"); (void) strcat(fullname, name); /* ** Set doaccess if '.' (as in "../") shows up in name. */ if (strchr(name, '.') != NULL) doaccess = TRUE; name = fullname; } if (doaccess && access(name, R_OK) != 0) return -1; if ((fid = open(name, OPEN_MODE)) == -1) { char buf[READLEN]; char name[NAMELEN + 1]; int fidix = open(INDEXFILE, OPEN_MODE); int off = -1; if (fidix < 0) { return -1; } while (read(fidix, buf, sizeof(buf)) == sizeof(buf)) { memcpy(name, buf, NAMELEN); name[NAMELEN] = '\0'; if (strcmp(name, origname) == 0) { off = toint((unsigned char *) buf + NAMELEN); toread = toint((unsigned char *) buf + NAMELEN + INTLEN); break; } } close(fidix); if (off < 0) return -1; fid = open(DATAFILE, OPEN_MODE); if (fid < 0) { return -1; } if (lseek(fid, off, SEEK_SET) < 0) { return -1; } } } nread = read(fid, u.buf, toread); if (close(fid) < 0 || nread <= 0) return -1; for (stored = 4; stored <= 8; stored *= 2) { int ttisstdcnt; int ttisgmtcnt; ttisstdcnt = (int) detzcode(u.tzhead.tzh_ttisstdcnt); ttisgmtcnt = (int) detzcode(u.tzhead.tzh_ttisgmtcnt); sp->leapcnt = (int) detzcode(u.tzhead.tzh_leapcnt); sp->timecnt = (int) detzcode(u.tzhead.tzh_timecnt); sp->typecnt = (int) detzcode(u.tzhead.tzh_typecnt); sp->charcnt = (int) detzcode(u.tzhead.tzh_charcnt); p = u.tzhead.tzh_charcnt + sizeof u.tzhead.tzh_charcnt; if (sp->leapcnt < 0 || sp->leapcnt > TZ_MAX_LEAPS || sp->typecnt <= 0 || sp->typecnt > TZ_MAX_TYPES || sp->timecnt < 0 || sp->timecnt > TZ_MAX_TIMES || sp->charcnt < 0 || sp->charcnt > TZ_MAX_CHARS || (ttisstdcnt != sp->typecnt && ttisstdcnt != 0) || (ttisgmtcnt != sp->typecnt && ttisgmtcnt != 0)) return -1; if (nread - (p - u.buf) < sp->timecnt * stored + /* ats */ sp->timecnt + /* types */ sp->typecnt * 6 + /* ttinfos */ sp->charcnt + /* chars */ sp->leapcnt * (stored + 4) + /* lsinfos */ ttisstdcnt + /* ttisstds */ ttisgmtcnt) /* ttisgmts */ return -1; for (i = 0; i < sp->timecnt; ++i) { sp->ats[i] = (stored == 4) ? detzcode(p) : detzcode64(p); p += stored; } for (i = 0; i < sp->timecnt; ++i) { sp->types[i] = (unsigned char) *p++; if (sp->types[i] >= sp->typecnt) return -1; } for (i = 0; i < sp->typecnt; ++i) { register struct ttinfo * ttisp; ttisp = &sp->ttis[i]; ttisp->tt_gmtoff = detzcode(p); p += 4; ttisp->tt_isdst = (unsigned char) *p++; if (ttisp->tt_isdst != 0 && ttisp->tt_isdst != 1) return -1; ttisp->tt_abbrind = (unsigned char) *p++; if (ttisp->tt_abbrind < 0 || ttisp->tt_abbrind > sp->charcnt) return -1; } for (i = 0; i < sp->charcnt; ++i) sp->chars[i] = *p++; sp->chars[i] = '\0'; /* ensure '\0' at end */ for (i = 0; i < sp->leapcnt; ++i) { register struct lsinfo * lsisp; lsisp = &sp->lsis[i]; lsisp->ls_trans = (stored == 4) ? detzcode(p) : detzcode64(p); p += stored; lsisp->ls_corr = detzcode(p); p += 4; } for (i = 0; i < sp->typecnt; ++i) { register struct ttinfo * ttisp; ttisp = &sp->ttis[i]; if (ttisstdcnt == 0) ttisp->tt_ttisstd = FALSE; else { ttisp->tt_ttisstd = *p++; if (ttisp->tt_ttisstd != TRUE && ttisp->tt_ttisstd != FALSE) return -1; } } for (i = 0; i < sp->typecnt; ++i) { register struct ttinfo * ttisp; ttisp = &sp->ttis[i]; if (ttisgmtcnt == 0) ttisp->tt_ttisgmt = FALSE; else { ttisp->tt_ttisgmt = *p++; if (ttisp->tt_ttisgmt != TRUE && ttisp->tt_ttisgmt != FALSE) return -1; } } /* ** Out-of-sort ats should mean we're running on a ** signed time_t system but using a data file with ** unsigned values (or vice versa). */ for (i = 0; i < sp->timecnt - 2; ++i) if (sp->ats[i] > sp->ats[i + 1]) { ++i; if (TYPE_SIGNED(time_t)) { /* ** Ignore the end (easy). */ sp->timecnt = i; } else { /* ** Ignore the beginning (harder). */ register int j; for (j = 0; j + i < sp->timecnt; ++j) { sp->ats[j] = sp->ats[j + i]; sp->types[j] = sp->types[j + i]; } sp->timecnt = j; } break; } /* ** If this is an old file, we're done. */ if (u.tzhead.tzh_version[0] == '\0') break; nread -= p - u.buf; for (i = 0; i < nread; ++i) u.buf[i] = p[i]; /* ** If this is a narrow integer time_t system, we're done. */ if (stored >= (int) sizeof(time_t) && TYPE_INTEGRAL(time_t)) break; } if (doextend && nread > 2 && u.buf[0] == '\n' && u.buf[nread - 1] == '\n' && sp->typecnt + 2 <= TZ_MAX_TYPES) { struct state ts; register int result; u.buf[nread - 1] = '\0'; result = tzparse(&u.buf[1], &ts, FALSE); if (result == 0 && ts.typecnt == 2 && sp->charcnt + ts.charcnt <= TZ_MAX_CHARS) { for (i = 0; i < 2; ++i) ts.ttis[i].tt_abbrind += sp->charcnt; for (i = 0; i < ts.charcnt; ++i) sp->chars[sp->charcnt++] = ts.chars[i]; i = 0; while (i < ts.timecnt && ts.ats[i] <= sp->ats[sp->timecnt - 1]) ++i; while (i < ts.timecnt && sp->timecnt < TZ_MAX_TIMES) { sp->ats[sp->timecnt] = ts.ats[i]; sp->types[sp->timecnt] = sp->typecnt + ts.types[i]; ++sp->timecnt; ++i; } sp->ttis[sp->typecnt++] = ts.ttis[0]; sp->ttis[sp->typecnt++] = ts.ttis[1]; } } i = 2 * YEARSPERREPEAT; sp->goback = sp->goahead = sp->timecnt > i; sp->goback &= sp->types[i] == sp->types[0] && differ_by_repeat(sp->ats[i], sp->ats[0]); sp->goahead &= sp->types[sp->timecnt - 1] == sp->types[sp->timecnt - 1 - i] && differ_by_repeat(sp->ats[sp->timecnt - 1], sp->ats[sp->timecnt - 1 - i]); return 0; } static const int mon_lengths[2][MONSPERYEAR] = { { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } }; static const int year_lengths[2] = { DAYSPERNYEAR, DAYSPERLYEAR }; /* ** Given a pointer into a time zone string, scan until a character that is not ** a valid character in a zone name is found. Return a pointer to that ** character. */ static const char * getzname(strp) register const char * strp; { register char c; while ((c = *strp) != '\0' && !is_digit(c) && c != ',' && c != '-' && c != '+') ++strp; return strp; } /* ** Given a pointer into an extended time zone string, scan until the ending ** delimiter of the zone name is located. Return a pointer to the delimiter. ** ** As with getzname above, the legal character set is actually quite ** restricted, with other characters producing undefined results. ** We don't do any checking here; checking is done later in common-case code. */ static const char * getqzname(register const char *strp, const int delim) { register int c; while ((c = *strp) != '\0' && c != delim) ++strp; return strp; } /* ** Given a pointer into a time zone string, extract a number from that string. ** Check that the number is within a specified range; if it is not, return ** NULL. ** Otherwise, return a pointer to the first character not part of the number. */ static const char * getnum(strp, nump, min, max) register const char * strp; int * const nump; const int min; const int max; { register char c; register int num; if (strp == NULL || !is_digit(c = *strp)) return NULL; num = 0; do { num = num * 10 + (c - '0'); if (num > max) return NULL; /* illegal value */ c = *++strp; } while (is_digit(c)); if (num < min) return NULL; /* illegal value */ *nump = num; return strp; } /* ** Given a pointer into a time zone string, extract a number of seconds, ** in hh[:mm[:ss]] form, from the string. ** If any error occurs, return NULL. ** Otherwise, return a pointer to the first character not part of the number ** of seconds. */ static const char * getsecs(strp, secsp) register const char * strp; long * const secsp; { int num; /* ** `HOURSPERDAY * DAYSPERWEEK - 1' allows quasi-Posix rules like ** "M10.4.6/26", which does not conform to Posix, ** but which specifies the equivalent of ** ``02:00 on the first Sunday on or after 23 Oct''. */ strp = getnum(strp, &num, 0, HOURSPERDAY * DAYSPERWEEK - 1); if (strp == NULL) return NULL; *secsp = num * (long) SECSPERHOUR; if (*strp == ':') { ++strp; strp = getnum(strp, &num, 0, MINSPERHOUR - 1); if (strp == NULL) return NULL; *secsp += num * SECSPERMIN; if (*strp == ':') { ++strp; /* `SECSPERMIN' allows for leap seconds. */ strp = getnum(strp, &num, 0, SECSPERMIN); if (strp == NULL) return NULL; *secsp += num; } } return strp; } /* ** Given a pointer into a time zone string, extract an offset, in ** [+-]hh[:mm[:ss]] form, from the string. ** If any error occurs, return NULL. ** Otherwise, return a pointer to the first character not part of the time. */ static const char * getoffset(strp, offsetp) register const char * strp; long * const offsetp; { register int neg = 0; if (*strp == '-') { neg = 1; ++strp; } else if (*strp == '+') ++strp; strp = getsecs(strp, offsetp); if (strp == NULL) return NULL; /* illegal time */ if (neg) *offsetp = -*offsetp; return strp; } /* ** Given a pointer into a time zone string, extract a rule in the form ** date[/time]. See POSIX section 8 for the format of "date" and "time". ** If a valid rule is not found, return NULL. ** Otherwise, return a pointer to the first character not part of the rule. */ static const char * getrule(strp, rulep) const char * strp; register struct rule * const rulep; { if (*strp == 'J') { /* ** Julian day. */ rulep->r_type = JULIAN_DAY; ++strp; strp = getnum(strp, &rulep->r_day, 1, DAYSPERNYEAR); } else if (*strp == 'M') { /* ** Month, week, day. */ rulep->r_type = MONTH_NTH_DAY_OF_WEEK; ++strp; strp = getnum(strp, &rulep->r_mon, 1, MONSPERYEAR); if (strp == NULL) return NULL; if (*strp++ != '.') return NULL; strp = getnum(strp, &rulep->r_week, 1, 5); if (strp == NULL) return NULL; if (*strp++ != '.') return NULL; strp = getnum(strp, &rulep->r_day, 0, DAYSPERWEEK - 1); } else if (is_digit(*strp)) { /* ** Day of year. */ rulep->r_type = DAY_OF_YEAR; strp = getnum(strp, &rulep->r_day, 0, DAYSPERLYEAR - 1); } else return NULL; /* invalid format */ if (strp == NULL) return NULL; if (*strp == '/') { /* ** Time specified. */ ++strp; strp = getsecs(strp, &rulep->r_time); } else rulep->r_time = 2 * SECSPERHOUR; /* default = 2:00:00 */ return strp; } /* ** Given the Epoch-relative time of January 1, 00:00:00 UTC, in a year, the ** year, a rule, and the offset from UTC at the time that rule takes effect, ** calculate the Epoch-relative time that rule takes effect. */ static time_t transtime(janfirst, year, rulep, offset) const time_t janfirst; const int year; register const struct rule * const rulep; const long offset; { register int leapyear; register time_t value; register int i; int d, m1, yy0, yy1, yy2, dow; INITIALIZE(value); leapyear = isleap(year); switch (rulep->r_type) { case JULIAN_DAY: /* ** Jn - Julian day, 1 == January 1, 60 == March 1 even in leap ** years. ** In non-leap years, or if the day number is 59 or less, just ** add SECSPERDAY times the day number-1 to the time of ** January 1, midnight, to get the day. */ value = janfirst + (rulep->r_day - 1) * SECSPERDAY; if (leapyear && rulep->r_day >= 60) value += SECSPERDAY; break; case DAY_OF_YEAR: /* ** n - day of year. ** Just add SECSPERDAY times the day number to the time of ** January 1, midnight, to get the day. */ value = janfirst + rulep->r_day * SECSPERDAY; break; case MONTH_NTH_DAY_OF_WEEK: /* ** Mm.n.d - nth "dth day" of month m. */ value = janfirst; for (i = 0; i < rulep->r_mon - 1; ++i) value += mon_lengths[leapyear][i] * SECSPERDAY; /* ** Use Zeller's Congruence to get day-of-week of first day of ** month. */ m1 = (rulep->r_mon + 9) % 12 + 1; yy0 = (rulep->r_mon <= 2) ? (year - 1) : year; yy1 = yy0 / 100; yy2 = yy0 % 100; dow = ((26 * m1 - 2) / 10 + 1 + yy2 + yy2 / 4 + yy1 / 4 - 2 * yy1) % 7; if (dow < 0) dow += DAYSPERWEEK; /* ** "dow" is the day-of-week of the first day of the month. Get ** the day-of-month (zero-origin) of the first "dow" day of the ** month. */ d = rulep->r_day - dow; if (d < 0) d += DAYSPERWEEK; for (i = 1; i < rulep->r_week; ++i) { if (d + DAYSPERWEEK >= mon_lengths[leapyear][rulep->r_mon - 1]) break; d += DAYSPERWEEK; } /* ** "d" is the day-of-month (zero-origin) of the day we want. */ value += d * SECSPERDAY; break; } /* ** "value" is the Epoch-relative time of 00:00:00 UTC on the day in ** question. To get the Epoch-relative time of the specified local ** time on that day, add the transition time and the current offset ** from UTC. */ return value + rulep->r_time + offset; } /* ** Given a POSIX section 8-style TZ string, fill in the rule tables as ** appropriate. */ static int tzparse(name, sp, lastditch) const char * name; register struct state * const sp; const int lastditch; { const char * stdname; const char * dstname; size_t stdlen; size_t dstlen; long stdoffset; long dstoffset; register time_t * atp; register unsigned char * typep; register char * cp; register int load_result; INITIALIZE(dstname); stdname = name; if (lastditch) { stdlen = strlen(name); /* length of standard zone name */ name += stdlen; if (stdlen >= sizeof sp->chars) stdlen = (sizeof sp->chars) - 1; stdoffset = 0; } else { if (*name == '<') { name++; stdname = name; name = getqzname(name, '>'); if (*name != '>') return (-1); stdlen = name - stdname; name++; } else { name = getzname(name); stdlen = name - stdname; } if (*name == '\0') return -1; name = getoffset(name, &stdoffset); if (name == NULL) return -1; } load_result = tzload(TZDEFRULES, sp, FALSE); if (load_result != 0) sp->leapcnt = 0; /* so, we're off a little */ sp->timecnt = 0; if (*name != '\0') { if (*name == '<') { dstname = ++name; name = getqzname(name, '>'); if (*name != '>') return -1; dstlen = name - dstname; name++; } else { dstname = name; name = getzname(name); dstlen = name - dstname; /* length of DST zone name */ } if (*name != '\0' && *name != ',' && *name != ';') { name = getoffset(name, &dstoffset); if (name == NULL) return -1; } else dstoffset = stdoffset - SECSPERHOUR; if (*name == '\0' && load_result != 0) name = TZDEFRULESTRING; if (*name == ',' || *name == ';') { struct rule start; struct rule end; register int year; register time_t janfirst; time_t starttime; time_t endtime; ++name; if ((name = getrule(name, &start)) == NULL) return -1; if (*name++ != ',') return -1; if ((name = getrule(name, &end)) == NULL) return -1; if (*name != '\0') return -1; sp->typecnt = 2; /* standard time and DST */ /* ** Two transitions per year, from EPOCH_YEAR forward. */ sp->ttis[0].tt_gmtoff = -dstoffset; sp->ttis[0].tt_isdst = 1; sp->ttis[0].tt_abbrind = stdlen + 1; sp->ttis[1].tt_gmtoff = -stdoffset; sp->ttis[1].tt_isdst = 0; sp->ttis[1].tt_abbrind = 0; atp = sp->ats; typep = sp->types; janfirst = 0; for (year = EPOCH_YEAR; sp->timecnt + 2 <= TZ_MAX_TIMES; ++year) { time_t newfirst; starttime = transtime(janfirst, year, &start, stdoffset); endtime = transtime(janfirst, year, &end, dstoffset); if (starttime > endtime) { *atp++ = endtime; *typep++ = 1; /* DST ends */ *atp++ = starttime; *typep++ = 0; /* DST begins */ } else { *atp++ = starttime; *typep++ = 0; /* DST begins */ *atp++ = endtime; *typep++ = 1; /* DST ends */ } sp->timecnt += 2; newfirst = janfirst; newfirst += year_lengths[isleap(year)] * SECSPERDAY; if (newfirst <= janfirst) break; janfirst = newfirst; } } else { register long theirstdoffset; register long theirdstoffset; register long theiroffset; register int isdst; register int i; register int j; if (*name != '\0') return -1; /* ** Initial values of theirstdoffset and theirdstoffset. */ theirstdoffset = 0; for (i = 0; i < sp->timecnt; ++i) { j = sp->types[i]; if (!sp->ttis[j].tt_isdst) { theirstdoffset = -sp->ttis[j].tt_gmtoff; break; } } theirdstoffset = 0; for (i = 0; i < sp->timecnt; ++i) { j = sp->types[i]; if (sp->ttis[j].tt_isdst) { theirdstoffset = -sp->ttis[j].tt_gmtoff; break; } } /* ** Initially we're assumed to be in standard time. */ isdst = FALSE; theiroffset = theirstdoffset; /* ** Now juggle transition times and types ** tracking offsets as you do. */ for (i = 0; i < sp->timecnt; ++i) { j = sp->types[i]; sp->types[i] = sp->ttis[j].tt_isdst; if (sp->ttis[j].tt_ttisgmt) { /* No adjustment to transition time */ } else { /* ** If summer time is in effect, and the ** transition time was not specified as ** standard time, add the summer time ** offset to the transition time; ** otherwise, add the standard time ** offset to the transition time. */ /* ** Transitions from DST to DDST ** will effectively disappear since ** POSIX provides for only one DST ** offset. */ if (isdst && !sp->ttis[j].tt_ttisstd) { sp->ats[i] += dstoffset - theirdstoffset; } else { sp->ats[i] += stdoffset - theirstdoffset; } } theiroffset = -sp->ttis[j].tt_gmtoff; if (sp->ttis[j].tt_isdst) theirdstoffset = theiroffset; else theirstdoffset = theiroffset; } /* ** Finally, fill in ttis. ** ttisstd and ttisgmt need not be handled. */ sp->ttis[0].tt_gmtoff = -stdoffset; sp->ttis[0].tt_isdst = FALSE; sp->ttis[0].tt_abbrind = 0; sp->ttis[1].tt_gmtoff = -dstoffset; sp->ttis[1].tt_isdst = TRUE; sp->ttis[1].tt_abbrind = stdlen + 1; sp->typecnt = 2; } } else { dstlen = 0; sp->typecnt = 1; /* only standard time */ sp->timecnt = 0; sp->ttis[0].tt_gmtoff = -stdoffset; sp->ttis[0].tt_isdst = 0; sp->ttis[0].tt_abbrind = 0; } sp->charcnt = stdlen + 1; if (dstlen != 0) sp->charcnt += dstlen + 1; if ((size_t) sp->charcnt > sizeof sp->chars) return -1; cp = sp->chars; (void) strncpy(cp, stdname, stdlen); cp += stdlen; *cp++ = '\0'; if (dstlen != 0) { (void) strncpy(cp, dstname, dstlen); *(cp + dstlen) = '\0'; } return 0; } static void gmtload(sp) struct state * const sp; { if (tzload(gmt, sp, TRUE) != 0) (void) tzparse(gmt, sp, TRUE); } /* ** The easy way to behave "as if no library function calls" localtime ** is to not call it--so we drop its guts into "localsub", which can be ** freely called. (And no, the PANS doesn't require the above behavior-- ** but it *is* desirable.) ** ** The unused offset argument is for the benefit of mktime variants. */ /*ARGSUSED*/ static struct tm * localsub(timep, offset, tmp, sp) const time_t * const timep; const long offset; struct tm * const tmp; const struct state * sp; { register const struct ttinfo * ttisp; register int i; register struct tm * result; const time_t t = *timep; #ifdef ALL_STATE if (sp == NULL) return gmtsub(timep, offset, tmp); #endif /* defined ALL_STATE */ if ((sp->goback && t < sp->ats[0]) || (sp->goahead && t > sp->ats[sp->timecnt - 1])) { time_t newt = t; register time_t seconds; register time_t tcycles; register int_fast64_t icycles; if (t < sp->ats[0]) seconds = sp->ats[0] - t; else seconds = t - sp->ats[sp->timecnt - 1]; --seconds; tcycles = seconds / YEARSPERREPEAT / AVGSECSPERYEAR; ++tcycles; icycles = tcycles; if (tcycles - icycles >= 1 || icycles - tcycles >= 1) return NULL; seconds = icycles; seconds *= YEARSPERREPEAT; seconds *= AVGSECSPERYEAR; if (t < sp->ats[0]) newt += seconds; else newt -= seconds; if (newt < sp->ats[0] || newt > sp->ats[sp->timecnt - 1]) return NULL; /* "cannot happen" */ result = localsub(&newt, offset, tmp, sp); if (result == tmp) { register time_t newy; newy = tmp->tm_year; if (t < sp->ats[0]) newy -= icycles * YEARSPERREPEAT; else newy += icycles * YEARSPERREPEAT; tmp->tm_year = newy; if (tmp->tm_year != newy) return NULL; } return result; } if (sp->timecnt == 0 || t < sp->ats[0]) { i = 0; while (sp->ttis[i].tt_isdst) if (++i >= sp->typecnt) { i = 0; break; } } else { register int lo = 1; register int hi = sp->timecnt; while (lo < hi) { register int mid = (lo + hi) >> 1; if (t < sp->ats[mid]) hi = mid; else lo = mid + 1; } i = (int) sp->types[lo - 1]; } ttisp = &sp->ttis[i]; /* ** To get (wrong) behavior that's compatible with System V Release 2.0 ** you'd replace the statement below with ** t += ttisp->tt_gmtoff; ** timesub(&t, 0L, sp, tmp); */ result = timesub(&t, ttisp->tt_gmtoff, sp, tmp); tmp->tm_isdst = ttisp->tt_isdst; #ifdef HAVE_TM_GMTOFF tmp->tm_gmtoff = ttisp->tt_gmtoff; #endif tzname[tmp->tm_isdst] = &sp->chars[ttisp->tt_abbrind]; #ifdef TM_ZONE tmp->TM_ZONE = &sp->chars[ttisp->tt_abbrind]; #endif /* defined TM_ZONE */ return result; } // ============================================================================ #if 0 struct tm * localtime(timep) const time_t * const timep; { tzset(); return localsub(timep, 0L, &tm); } #endif /* ** Re-entrant version of localtime. */ // ============================================================================ void localtime_tz(const time_t * const timep, struct tm * tmp, const char* tz) { struct state st; if (tzload(tz, &st, TRUE) != 0) { // not sure what's best here, but for now, we fall back to gmt gmtload(&st); } localsub(timep, 0L, tmp, &st); } /* ** gmtsub is to gmtime as localsub is to localtime. */ static struct tm * gmtsub(timep, offset, tmp) const time_t * const timep; const long offset; struct tm * const tmp; { register struct tm * result; if (!gmt_is_set) { gmt_is_set = TRUE; #ifdef ALL_STATE gmtptr = (struct state *) malloc(sizeof *gmtptr); if (gmtptr != NULL) #endif /* defined ALL_STATE */ gmtload(gmtptr); } result = timesub(timep, offset, gmtptr, tmp); #ifdef TM_ZONE /* ** Could get fancy here and deliver something such as ** "UTC+xxxx" or "UTC-xxxx" if offset is non-zero, ** but this is no time for a treasure hunt. */ if (offset != 0) tmp->TM_ZONE = wildabbr; else { #ifdef ALL_STATE if (gmtptr == NULL) tmp->TM_ZONE = gmt; else tmp->TM_ZONE = gmtptr->chars; #endif /* defined ALL_STATE */ #ifndef ALL_STATE tmp->TM_ZONE = gmtptr->chars; #endif /* State Farm */ } #endif /* defined TM_ZONE */ return result; } // ============================================================================ #if 0 struct tm * gmtime(timep) const time_t * const timep; { return gmtsub(timep, 0L, &tm); } #endif /* * Re-entrant version of gmtime. */ // ============================================================================ #if 0 struct tm * gmtime_r(timep, tmp) const time_t * const timep; struct tm * tmp; { return gmtsub(timep, 0L, tmp); } #endif #ifdef STD_INSPIRED // ============================================================================ #if 0 struct tm * offtime(timep, offset) const time_t * const timep; const long offset; { return gmtsub(timep, offset, &tm); } #endif #endif /* defined STD_INSPIRED */ /* ** Return the number of leap years through the end of the given year ** where, to make the math easy, the answer for year zero is defined as zero. */ static int leaps_thru_end_of(y) register const int y; { return (y >= 0) ? (y / 4 - y / 100 + y / 400) : -(leaps_thru_end_of(-(y + 1)) + 1); } static struct tm * timesub(timep, offset, sp, tmp) const time_t * const timep; const long offset; register const struct state * const sp; register struct tm * const tmp; { register const struct lsinfo * lp; register time_t tdays; register int idays; /* unsigned would be so 2003 */ register long rem; int y; register const int * ip; register long corr; register int hit; register int i; corr = 0; hit = 0; #ifdef ALL_STATE i = (sp == NULL) ? 0 : sp->leapcnt; #endif /* defined ALL_STATE */ #ifndef ALL_STATE i = sp->leapcnt; #endif /* State Farm */ while (--i >= 0) { lp = &sp->lsis[i]; if (*timep >= lp->ls_trans) { if (*timep == lp->ls_trans) { hit = ((i == 0 && lp->ls_corr > 0) || lp->ls_corr > sp->lsis[i - 1].ls_corr); if (hit) while (i > 0 && sp->lsis[i].ls_trans == sp->lsis[i - 1].ls_trans + 1 && sp->lsis[i].ls_corr == sp->lsis[i - 1].ls_corr + 1) { ++hit; --i; } } corr = lp->ls_corr; break; } } y = EPOCH_YEAR; tdays = *timep / SECSPERDAY; rem = *timep - tdays * SECSPERDAY; while (tdays < 0 || tdays >= year_lengths[isleap(y)]) { int newy; register time_t tdelta; register int idelta; register int leapdays; tdelta = tdays / DAYSPERLYEAR; idelta = tdelta; if (tdelta - idelta >= 1 || idelta - tdelta >= 1) return NULL; if (idelta == 0) idelta = (tdays < 0) ? -1 : 1; newy = y; if (increment_overflow(&newy, idelta)) return NULL; leapdays = leaps_thru_end_of(newy - 1) - leaps_thru_end_of(y - 1); tdays -= ((time_t) newy - y) * DAYSPERNYEAR; tdays -= leapdays; y = newy; } { register long seconds; seconds = tdays * SECSPERDAY + 0.5; tdays = seconds / SECSPERDAY; rem += seconds - tdays * SECSPERDAY; } /* ** Given the range, we can now fearlessly cast... */ idays = tdays; rem += offset - corr; while (rem < 0) { rem += SECSPERDAY; --idays; } while (rem >= SECSPERDAY) { rem -= SECSPERDAY; ++idays; } while (idays < 0) { if (increment_overflow(&y, -1)) return NULL; idays += year_lengths[isleap(y)]; } while (idays >= year_lengths[isleap(y)]) { idays -= year_lengths[isleap(y)]; if (increment_overflow(&y, 1)) return NULL; } tmp->tm_year = y; if (increment_overflow(&tmp->tm_year, -TM_YEAR_BASE)) return NULL; tmp->tm_yday = idays; /* ** The "extra" mods below avoid overflow problems. */ tmp->tm_wday = EPOCH_WDAY + ((y - EPOCH_YEAR) % DAYSPERWEEK) * (DAYSPERNYEAR % DAYSPERWEEK) + leaps_thru_end_of(y - 1) - leaps_thru_end_of(EPOCH_YEAR - 1) + idays; tmp->tm_wday %= DAYSPERWEEK; if (tmp->tm_wday < 0) tmp->tm_wday += DAYSPERWEEK; tmp->tm_hour = (int) (rem / SECSPERHOUR); rem %= SECSPERHOUR; tmp->tm_min = (int) (rem / SECSPERMIN); /* ** A positive leap second requires a special ** representation. This uses "... ??:59:60" et seq. */ tmp->tm_sec = (int) (rem % SECSPERMIN) + hit; ip = mon_lengths[isleap(y)]; for (tmp->tm_mon = 0; idays >= ip[tmp->tm_mon]; ++(tmp->tm_mon)) idays -= ip[tmp->tm_mon]; tmp->tm_mday = (int) (idays + 1); tmp->tm_isdst = 0; #ifdef TM_GMTOFF tmp->TM_GMTOFF = offset; #endif /* defined TM_GMTOFF */ return tmp; } // ============================================================================ #if 0 char * ctime(timep) const time_t * const timep; { /* ** Section 4.12.3.2 of X3.159-1989 requires that ** The ctime function converts the calendar time pointed to by timer ** to local time in the form of a string. It is equivalent to ** asctime(localtime(timer)) */ return asctime(localtime(timep)); } #endif // ============================================================================ #if 0 char * ctime_r(timep, buf) const time_t * const timep; char * buf; { struct tm mytm; return asctime_r(localtime_r(timep, &mytm), buf); } #endif /* ** Adapted from code provided by Robert Elz, who writes: ** The "best" way to do mktime I think is based on an idea of Bob ** Kridle's (so its said...) from a long time ago. ** It does a binary search of the time_t space. Since time_t's are ** just 32 bits, its a max of 32 iterations (even at 64 bits it ** would still be very reasonable). */ #ifndef WRONG #define WRONG (-1) #endif /* !defined WRONG */ /* ** Simplified normalize logic courtesy Paul Eggert. */ static int increment_overflow(number, delta) int * number; int delta; { unsigned number0 = (unsigned)*number; unsigned number1 = (unsigned)(number0 + delta); *number = (int)number1; if (delta >= 0) { return ((int)number1 < (int)number0); } else { return ((int)number1 > (int)number0); } } static int long_increment_overflow(number, delta) long * number; int delta; { unsigned long number0 = (unsigned long)*number; unsigned long number1 = (unsigned long)(number0 + delta); *number = (long)number1; if (delta >= 0) { return ((long)number1 < (long)number0); } else { return ((long)number1 > (long)number0); } } static int normalize_overflow(tensptr, unitsptr, base) int * const tensptr; int * const unitsptr; const int base; { register int tensdelta; tensdelta = (*unitsptr >= 0) ? (*unitsptr / base) : (-1 - (-1 - *unitsptr) / base); *unitsptr -= tensdelta * base; return increment_overflow(tensptr, tensdelta); } static int long_normalize_overflow(tensptr, unitsptr, base) long * const tensptr; int * const unitsptr; const int base; { register int tensdelta; tensdelta = (*unitsptr >= 0) ? (*unitsptr / base) : (-1 - (-1 - *unitsptr) / base); *unitsptr -= tensdelta * base; return long_increment_overflow(tensptr, tensdelta); } static int tmcomp(atmp, btmp) register const struct tm * const atmp; register const struct tm * const btmp; { register int result; if ((result = (atmp->tm_year - btmp->tm_year)) == 0 && (result = (atmp->tm_mon - btmp->tm_mon)) == 0 && (result = (atmp->tm_mday - btmp->tm_mday)) == 0 && (result = (atmp->tm_hour - btmp->tm_hour)) == 0 && (result = (atmp->tm_min - btmp->tm_min)) == 0) result = atmp->tm_sec - btmp->tm_sec; return result; } static time_t time2sub(tmp, funcp, offset, okayp, do_norm_secs, sp) struct tm * const tmp; struct tm * (* const funcp) P((const time_t*, long, struct tm*,const struct state *sp)); const long offset; int * const okayp; const int do_norm_secs; const struct state * sp; { register int dir; register int i, j; register int saved_seconds; register long li; register time_t lo; register time_t hi; long y; time_t newt; time_t t; struct tm yourtm, mytm; *okayp = FALSE; yourtm = *tmp; if (do_norm_secs) { if (normalize_overflow(&yourtm.tm_min, &yourtm.tm_sec, SECSPERMIN)) return WRONG; } if (normalize_overflow(&yourtm.tm_hour, &yourtm.tm_min, MINSPERHOUR)) return WRONG; if (normalize_overflow(&yourtm.tm_mday, &yourtm.tm_hour, HOURSPERDAY)) return WRONG; y = yourtm.tm_year; if (long_normalize_overflow(&y, &yourtm.tm_mon, MONSPERYEAR)) return WRONG; /* ** Turn y into an actual year number for now. ** It is converted back to an offset from TM_YEAR_BASE later. */ if (long_increment_overflow(&y, TM_YEAR_BASE)) return WRONG; while (yourtm.tm_mday <= 0) { if (long_increment_overflow(&y, -1)) return WRONG; li = y + (1 < yourtm.tm_mon); yourtm.tm_mday += year_lengths[isleap(li)]; } while (yourtm.tm_mday > DAYSPERLYEAR) { li = y + (1 < yourtm.tm_mon); yourtm.tm_mday -= year_lengths[isleap(li)]; if (long_increment_overflow(&y, 1)) return WRONG; } for ( ; ; ) { i = mon_lengths[isleap(y)][yourtm.tm_mon]; if (yourtm.tm_mday <= i) break; yourtm.tm_mday -= i; if (++yourtm.tm_mon >= MONSPERYEAR) { yourtm.tm_mon = 0; if (long_increment_overflow(&y, 1)) return WRONG; } } if (long_increment_overflow(&y, -TM_YEAR_BASE)) return WRONG; yourtm.tm_year = y; if (yourtm.tm_year != y) return WRONG; if (yourtm.tm_sec >= 0 && yourtm.tm_sec < SECSPERMIN) saved_seconds = 0; else if (y + TM_YEAR_BASE < EPOCH_YEAR) { /* ** We can't set tm_sec to 0, because that might push the ** time below the minimum representable time. ** Set tm_sec to 59 instead. ** This assumes that the minimum representable time is ** not in the same minute that a leap second was deleted from, ** which is a safer assumption than using 58 would be. */ if (increment_overflow(&yourtm.tm_sec, 1 - SECSPERMIN)) return WRONG; saved_seconds = yourtm.tm_sec; yourtm.tm_sec = SECSPERMIN - 1; } else { saved_seconds = yourtm.tm_sec; yourtm.tm_sec = 0; } /* ** Do a binary search (this works whatever time_t's type is). */ if (!TYPE_SIGNED(time_t)) { lo = 0; hi = lo - 1; } else if (!TYPE_INTEGRAL(time_t)) { if (sizeof(time_t) > sizeof(float)) hi = (time_t) DBL_MAX; else hi = (time_t) FLT_MAX; lo = -hi; } else { lo = 1; for (i = 0; i < (int) TYPE_BIT(time_t) - 1; ++i) lo *= 2; hi = -(lo + 1); } for ( ; ; ) { t = lo / 2 + hi / 2; if (t < lo) t = lo; else if (t > hi) t = hi; if ((*funcp)(&t, offset, &mytm, sp) == NULL) { /* ** Assume that t is too extreme to be represented in ** a struct tm; arrange things so that it is less ** extreme on the next pass. */ dir = (t > 0) ? 1 : -1; } else dir = tmcomp(&mytm, &yourtm); if (dir != 0) { if (t == lo) { if (t == TIME_T_MAX) return WRONG; ++t; ++lo; } else if (t == hi) { if (t == TIME_T_MIN) return WRONG; --t; --hi; } if (lo > hi) return WRONG; if (dir > 0) hi = t; else lo = t; continue; } if (yourtm.tm_isdst < 0 || mytm.tm_isdst == yourtm.tm_isdst) break; /* ** Right time, wrong type. ** Hunt for right time, right type. ** It's okay to guess wrong since the guess ** gets checked. */ /* ** The (void *) casts are the benefit of SunOS 3.3 on Sun 2's. */ #ifdef ALL_STATE if (sp == NULL) return WRONG; #endif /* defined ALL_STATE */ for (i = sp->typecnt - 1; i >= 0; --i) { if (sp->ttis[i].tt_isdst != yourtm.tm_isdst) continue; for (j = sp->typecnt - 1; j >= 0; --j) { if (sp->ttis[j].tt_isdst == yourtm.tm_isdst) continue; newt = t + sp->ttis[j].tt_gmtoff - sp->ttis[i].tt_gmtoff; if ((*funcp)(&newt, offset, &mytm, sp) == NULL) continue; if (tmcomp(&mytm, &yourtm) != 0) continue; if (mytm.tm_isdst != yourtm.tm_isdst) continue; /* ** We have a match. */ t = newt; goto label; } } return WRONG; } label: newt = t + saved_seconds; if ((newt < t) != (saved_seconds < 0)) return WRONG; t = newt; if ((*funcp)(&t, offset, tmp, sp)) *okayp = TRUE; return t; } static time_t time2(tmp, funcp, offset, okayp, sp) struct tm * const tmp; struct tm * (* const funcp) P((const time_t*, long, struct tm*, const struct state* sp)); const long offset; int * const okayp; const struct state * sp; { time_t t; /* ** First try without normalization of seconds ** (in case tm_sec contains a value associated with a leap second). ** If that fails, try with normalization of seconds. */ t = time2sub(tmp, funcp, offset, okayp, FALSE, sp); return *okayp ? t : time2sub(tmp, funcp, offset, okayp, TRUE, sp); } static time_t time1(tmp, funcp, offset, sp) struct tm * const tmp; struct tm * (* const funcp) P((const time_t *, long, struct tm *, const struct state* sp)); const long offset; const struct state * sp; { register time_t t; register int samei, otheri; register int sameind, otherind; register int i; register int nseen; int seen[TZ_MAX_TYPES]; int types[TZ_MAX_TYPES]; int okay; if (tmp->tm_isdst > 1) tmp->tm_isdst = 1; t = time2(tmp, funcp, offset, &okay, sp); #define PCTS 1 #ifdef PCTS /* ** PCTS code courtesy Grant Sullivan. */ if (okay) return t; if (tmp->tm_isdst < 0) tmp->tm_isdst = 0; /* reset to std and try again */ #endif /* defined PCTS */ #ifndef PCTS if (okay || tmp->tm_isdst < 0) return t; #endif /* !defined PCTS */ /* ** We're supposed to assume that somebody took a time of one type ** and did some math on it that yielded a "struct tm" that's bad. ** We try to divine the type they started from and adjust to the ** type they need. */ /* ** The (void *) casts are the benefit of SunOS 3.3 on Sun 2's. */ #ifdef ALL_STATE if (sp == NULL) return WRONG; #endif /* defined ALL_STATE */ for (i = 0; i < sp->typecnt; ++i) seen[i] = FALSE; nseen = 0; for (i = sp->timecnt - 1; i >= 0; --i) if (!seen[sp->types[i]]) { seen[sp->types[i]] = TRUE; types[nseen++] = sp->types[i]; } for (sameind = 0; sameind < nseen; ++sameind) { samei = types[sameind]; if (sp->ttis[samei].tt_isdst != tmp->tm_isdst) continue; for (otherind = 0; otherind < nseen; ++otherind) { otheri = types[otherind]; if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst) continue; tmp->tm_sec += sp->ttis[otheri].tt_gmtoff - sp->ttis[samei].tt_gmtoff; tmp->tm_isdst = !tmp->tm_isdst; t = time2(tmp, funcp, offset, &okay, sp); if (okay) return t; tmp->tm_sec -= sp->ttis[otheri].tt_gmtoff - sp->ttis[samei].tt_gmtoff; tmp->tm_isdst = !tmp->tm_isdst; } } return WRONG; } // ============================================================================ time_t mktime_tz(struct tm * const tmp, char const * tz) { struct state st; if (tzload(tz, &st, TRUE) != 0) { // not sure what's best here, but for now, we fall back to gmt gmtload(&st); } return time1(tmp, localsub, 0L, &st); } android-audiosystem-1.8+13.10.20130807/lib/libcutils/socket_local_server.c0000644000015700001700000000511512200324306026630 0ustar pbuserpbgroup00000000000000/* libs/cutils/socket_local_server.c ** ** Copyright 2006, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include #include #include #include #include #include #ifdef HAVE_WINSOCK int socket_local_server(const char *name, int namespaceId, int type) { errno = ENOSYS; return -1; } #else /* !HAVE_WINSOCK */ #include #include #include #include #include #include "socket_local.h" #define LISTEN_BACKLOG 4 /** * Binds a pre-created socket(AF_LOCAL) 's' to 'name' * returns 's' on success, -1 on fail * * Does not call listen() */ int socket_local_server_bind(int s, const char *name, int namespaceId) { struct sockaddr_un addr; socklen_t alen; int n; int err; err = socket_make_sockaddr_un(name, namespaceId, &addr, &alen); if (err < 0) { return -1; } /* basically: if this is a filesystem path, unlink first */ #ifndef HAVE_LINUX_LOCAL_SOCKET_NAMESPACE if (1) { #else if (namespaceId == ANDROID_SOCKET_NAMESPACE_RESERVED || namespaceId == ANDROID_SOCKET_NAMESPACE_FILESYSTEM) { #endif /*ignore ENOENT*/ unlink(addr.sun_path); } n = 1; setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &n, sizeof(n)); if(bind(s, (struct sockaddr *) &addr, alen) < 0) { return -1; } return s; } /** Open a server-side UNIX domain datagram socket in the Linux non-filesystem * namespace * * Returns fd on success, -1 on fail */ int socket_local_server(const char *name, int namespace, int type) { int err; int s; s = socket(AF_LOCAL, type, 0); if (s < 0) return -1; err = socket_local_server_bind(s, name, namespace); if (err < 0) { close(s); return -1; } if (type == SOCK_STREAM) { int ret; ret = listen(s, LISTEN_BACKLOG); if (ret < 0) { close(s); return -1; } } return s; } #endif /* !HAVE_WINSOCK */ android-audiosystem-1.8+13.10.20130807/lib/libcutils/atomics_x86.S0000644000015700001700000000726612200324306024735 0ustar pbuserpbgroup00000000000000#include #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 /* * int __futex_wait(volatile void *ftx, int val, const struct timespec *timeout) */ .text .globl __futex_wait .type __futex_wait, @function .align 4 __futex_wait: pushl %ebx pushl %esi mov 12(%esp), %ebx /* ftx */ movl $FUTEX_WAIT, %ecx mov 16(%esp), %edx /* val */ mov 20(%esp), %esi /* timeout */ movl $__NR_futex, %eax int $0x80 popl %esi popl %ebx ret /* int __futex_wake(volatile void *ftx, int count) */ .text .globl __futex_wake .type __futex_wake, @function .align 4 __futex_wake: pushl %ebx mov 8(%esp), %ebx /* ftx */ movl $FUTEX_WAKE, %ecx mov 12(%esp), %edx /* count */ movl $__NR_futex, %eax int $0x80 popl %ebx ret /* int __atomic_cmpxchg(int old, int new, volatile int* addr) */ .text .globl __atomic_cmpxchg .type __atomic_cmpxchg, @function .align 4 __atomic_cmpxchg: mov 4(%esp), %eax /* old */ mov 8(%esp), %ecx /* new */ mov 12(%esp), %edx /* addr */ lock cmpxchg %ecx, (%edx) jnz 1f xor %eax, %eax jmp 2f 1: movl $1, %eax 2: ret /* 0 == success, 1 == failure */ /* int __atomic_swap(int new, volatile int* addr) */ .text .globl __atomic_swap .type __atomic_swap, @function .align 4 __atomic_swap: mov 4(%esp), %ecx /* new */ mov 8(%esp), %edx /* addr */ lock xchg %ecx, (%edx) mov %ecx, %eax ret /* * int __atomic_dec(volatile int* addr) * * My x86 asm is really rusty.. this is probably suboptimal */ .text .globl __atomic_dec .type __atomic_dec, @function .align 4 __atomic_dec: pushl %ebx pushl %esi movl 12(%esp), %ebx /* addr */ 1: movl (%ebx), %esi /* old = *addr */ movl %esi, %edx subl $1, %edx /* new = old - 1 */ pushl %ebx pushl %edx pushl %esi call __atomic_cmpxchg addl $12, %esp test %eax, %eax jnz 1b movl %esi, %eax /* return old */ popl %esi popl %ebx ret .text /* int __atomic_inc(volatile int* addr) */ .globl __atomic_inc .type __atomic_inc, @function .align 4 __atomic_inc: pushl %ebx pushl %esi movl 12(%esp), %ebx /* addr */ 1: movl (%ebx), %esi /* old = *addr */ movl %esi, %edx addl $1, %edx /* new = old + 1 */ pushl %ebx pushl %edx pushl %esi call __atomic_cmpxchg addl $12, %esp test %eax, %eax jnz 1b movl %esi, %eax /* return old */ popl %esi popl %ebx ret /* int __futex_syscall3(volatile void *ftx, int op, int count) */ .text .globl __futex_syscall3 .type __futex_syscall3, @function .align 4 __futex_syscall3: pushl %ebx movl 8(%esp), %ebx /* ftx */ movl 12(%esp), %ecx /* op */ movl 16(%esp), %edx /* value */ movl $__NR_futex, %eax int $0x80 popl %ebx ret /* int __futex_syscall4(volatile void *ftx, int op, int val, const struct timespec *timeout) */ .text .globl __futex_syscall4 .type __futex_syscall4, @function .align 4 __futex_syscall4: pushl %ebx pushl %esi movl 12(%esp), %ebx /* ftx */ movl 16(%esp), %ecx /* op */ movl 20(%esp), %edx /* val */ movl 24(%esp), %esi /* timeout */ movl $__NR_futex, %eax int $0x80 popl %esi popl %ebx ret android-audiosystem-1.8+13.10.20130807/lib/libcutils/socket_network_client.c0000644000015700001700000000314312200324306027176 0ustar pbuserpbgroup00000000000000/* libs/cutils/socket_network_client.c ** ** Copyright 2006, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include #include #include #include #include #include #ifndef HAVE_WINSOCK #include #include #include #include #include #endif /* Connect to port on the IP interface. type is * SOCK_STREAM or SOCK_DGRAM. * return is a file descriptor or -1 on error */ int socket_network_client(const char *host, int port, int type) { struct hostent *hp; struct sockaddr_in addr; socklen_t alen; int s; hp = gethostbyname(host); if(hp == 0) return -1; memset(&addr, 0, sizeof(addr)); addr.sin_family = hp->h_addrtype; addr.sin_port = htons(port); memcpy(&addr.sin_addr, hp->h_addr, hp->h_length); s = socket(hp->h_addrtype, type, 0); if(s < 0) return -1; if(connect(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { close(s); return -1; } return s; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/list.c0000644000015700001700000000200012200324306023541 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include void list_init(struct listnode *node) { node->next = node; node->prev = node; } void list_add_tail(struct listnode *head, struct listnode *item) { item->next = head; item->prev = head->prev; head->prev->next = item; head->prev = item; } void list_remove(struct listnode *item) { item->next->prev = item->prev; item->prev->next = item->next; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/mq.c0000644000015700001700000011531112200324306023215 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "mq" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "loghack.h" #include "buffer.h" /** Number of dead peers to remember. */ #define PEER_HISTORY (16) typedef struct sockaddr SocketAddress; typedef struct sockaddr_un UnixAddress; /** * Process/user/group ID. We don't use ucred directly because it's only * available on Linux. */ typedef struct { pid_t pid; uid_t uid; gid_t gid; } Credentials; /** Listens for bytes coming from remote peers. */ typedef void BytesListener(Credentials credentials, char* bytes, size_t size); /** Listens for the deaths of remote peers. */ typedef void DeathListener(pid_t pid); /** Types of packets. */ typedef enum { /** Request for a connection to another peer. */ CONNECTION_REQUEST, /** A connection to another peer. */ CONNECTION, /** Reports a failed connection attempt. */ CONNECTION_ERROR, /** A generic packet of bytes. */ BYTES, } PacketType; typedef enum { /** Reading a packet header. */ READING_HEADER, /** Waiting for a connection from the master. */ ACCEPTING_CONNECTION, /** Reading bytes. */ READING_BYTES, } InputState; /** A packet header. */ // TODO: Use custom headers for master->peer, peer->master, peer->peer. typedef struct { PacketType type; union { /** Packet size. Used for BYTES. */ size_t size; /** Credentials. Used for CONNECTION and CONNECTION_REQUEST. */ Credentials credentials; }; } Header; /** A packet which will be sent to a peer. */ typedef struct OutgoingPacket OutgoingPacket; struct OutgoingPacket { /** Packet header. */ Header header; union { /** Connection to peer. Used with CONNECTION. */ int socket; /** Buffer of bytes. Used with BYTES. */ Buffer* bytes; }; /** Frees all resources associated with this packet. */ void (*free)(OutgoingPacket* packet); /** Optional context. */ void* context; /** Next packet in the queue. */ OutgoingPacket* nextPacket; }; /** Represents a remote peer. */ typedef struct PeerProxy PeerProxy; /** Local peer state. You typically have one peer per process. */ typedef struct { /** This peer's PID. */ pid_t pid; /** * Map from pid to peer proxy. The peer has a peer proxy for each remote * peer it's connected to. * * Acquire mutex before use. */ Hashmap* peerProxies; /** Manages I/O. */ Selector* selector; /** Used to synchronize operations with the selector thread. */ pthread_mutex_t mutex; /** Is this peer the master? */ bool master; /** Peer proxy for the master. */ PeerProxy* masterProxy; /** Listens for packets from remote peers. */ BytesListener* onBytes; /** Listens for deaths of remote peers. */ DeathListener* onDeath; /** Keeps track of recently dead peers. Requires mutex. */ pid_t deadPeers[PEER_HISTORY]; size_t deadPeerCursor; } Peer; struct PeerProxy { /** Credentials of the remote process. */ Credentials credentials; /** Keeps track of data coming in from the remote peer. */ InputState inputState; Buffer* inputBuffer; PeerProxy* connecting; /** File descriptor for this peer. */ SelectableFd* fd; /** * Queue of packets to be written out to the remote peer. * * Requires mutex. */ // TODO: Limit queue length. OutgoingPacket* currentPacket; OutgoingPacket* lastPacket; /** Used to write outgoing header. */ Buffer outgoingHeader; /** True if this is the master's proxy. */ bool master; /** Reference back to the local peer. */ Peer* peer; /** * Used in master only. Maps this peer proxy to other peer proxies to * which the peer has been connected to. Maps pid to PeerProxy. Helps * keep track of which connections we've sent to whom. */ Hashmap* connections; }; /** Server socket path. */ static const char* MASTER_PATH = "/master.peer"; /** Credentials of the master peer. */ static const Credentials MASTER_CREDENTIALS = {0, 0, 0}; /** Creates a peer proxy and adds it to the peer proxy map. */ static PeerProxy* peerProxyCreate(Peer* peer, Credentials credentials); /** Sets the non-blocking flag on a descriptor. */ static void setNonBlocking(int fd) { int flags; if ((flags = fcntl(fd, F_GETFL, 0)) < 0) { LOG_ALWAYS_FATAL("fcntl() error: %s", strerror(errno)); } if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) { LOG_ALWAYS_FATAL("fcntl() error: %s", strerror(errno)); } } /** Closes a fd and logs a warning if the close fails. */ static void closeWithWarning(int fd) { int result = close(fd); if (result == -1) { ALOGW("close() error: %s", strerror(errno)); } } /** Hashes pid_t keys. */ static int pidHash(void* key) { pid_t* pid = (pid_t*) key; return (int) (*pid); } /** Compares pid_t keys. */ static bool pidEquals(void* keyA, void* keyB) { pid_t* a = (pid_t*) keyA; pid_t* b = (pid_t*) keyB; return *a == *b; } /** Gets the master address. Not thread safe. */ static UnixAddress* getMasterAddress() { static UnixAddress masterAddress; static bool initialized = false; if (initialized == false) { masterAddress.sun_family = AF_LOCAL; strcpy(masterAddress.sun_path, MASTER_PATH); initialized = true; } return &masterAddress; } /** Gets exclusive access to the peer for this thread. */ static void peerLock(Peer* peer) { pthread_mutex_lock(&peer->mutex); } /** Releases exclusive access to the peer. */ static void peerUnlock(Peer* peer) { pthread_mutex_unlock(&peer->mutex); } /** Frees a simple, i.e. header-only, outgoing packet. */ static void outgoingPacketFree(OutgoingPacket* packet) { ALOGD("Freeing outgoing packet."); free(packet); } /** * Prepare to read a new packet from the peer. */ static void peerProxyExpectHeader(PeerProxy* peerProxy) { peerProxy->inputState = READING_HEADER; bufferPrepareForRead(peerProxy->inputBuffer, sizeof(Header)); } /** Sets up the buffer for the outgoing header. */ static void peerProxyPrepareOutgoingHeader(PeerProxy* peerProxy) { peerProxy->outgoingHeader.data = (char*) &(peerProxy->currentPacket->header); peerProxy->outgoingHeader.size = sizeof(Header); bufferPrepareForWrite(&peerProxy->outgoingHeader); } /** Adds a packet to the end of the queue. Callers must have the mutex. */ static void peerProxyEnqueueOutgoingPacket(PeerProxy* peerProxy, OutgoingPacket* newPacket) { newPacket->nextPacket = NULL; // Just in case. if (peerProxy->currentPacket == NULL) { // The queue is empty. peerProxy->currentPacket = newPacket; peerProxy->lastPacket = newPacket; peerProxyPrepareOutgoingHeader(peerProxy); } else { peerProxy->lastPacket->nextPacket = newPacket; } } /** Takes the peer lock and enqueues the given packet. */ static void peerProxyLockAndEnqueueOutgoingPacket(PeerProxy* peerProxy, OutgoingPacket* newPacket) { Peer* peer = peerProxy->peer; peerLock(peer); peerProxyEnqueueOutgoingPacket(peerProxy, newPacket); peerUnlock(peer); } /** * Frees current packet and moves to the next one. Returns true if there is * a next packet or false if the queue is empty. */ static bool peerProxyNextPacket(PeerProxy* peerProxy) { Peer* peer = peerProxy->peer; peerLock(peer); OutgoingPacket* current = peerProxy->currentPacket; if (current == NULL) { // The queue is already empty. peerUnlock(peer); return false; } OutgoingPacket* next = current->nextPacket; peerProxy->currentPacket = next; current->nextPacket = NULL; current->free(current); if (next == NULL) { // The queue is empty. peerProxy->lastPacket = NULL; peerUnlock(peer); return false; } else { peerUnlock(peer); peerProxyPrepareOutgoingHeader(peerProxy); // TODO: Start writing next packet? It would reduce the number of // system calls, but we could also starve other peers. return true; } } /** * Checks whether a peer died recently. */ static bool peerIsDead(Peer* peer, pid_t pid) { size_t i; for (i = 0; i < PEER_HISTORY; i++) { pid_t deadPeer = peer->deadPeers[i]; if (deadPeer == 0) { return false; } if (deadPeer == pid) { return true; } } return false; } /** * Cleans up connection information. */ static bool peerProxyRemoveConnection(void* key, void* value, void* context) { PeerProxy* deadPeer = (PeerProxy*) context; PeerProxy* otherPeer = (PeerProxy*) value; hashmapRemove(otherPeer->connections, &(deadPeer->credentials.pid)); return true; } /** * Called when the peer dies. */ static void peerProxyKill(PeerProxy* peerProxy, bool errnoIsSet) { if (errnoIsSet) { ALOGI("Peer %d died. errno: %s", peerProxy->credentials.pid, strerror(errno)); } else { ALOGI("Peer %d died.", peerProxy->credentials.pid); } // If we lost the master, we're up a creek. We can't let this happen. if (peerProxy->master) { LOG_ALWAYS_FATAL("Lost connection to master."); } Peer* localPeer = peerProxy->peer; pid_t pid = peerProxy->credentials.pid; peerLock(localPeer); // Remember for awhile that the peer died. localPeer->deadPeers[localPeer->deadPeerCursor] = peerProxy->credentials.pid; localPeer->deadPeerCursor++; if (localPeer->deadPeerCursor == PEER_HISTORY) { localPeer->deadPeerCursor = 0; } // Remove from peer map. hashmapRemove(localPeer->peerProxies, &pid); // External threads can no longer get to this peer proxy, so we don't // need the lock anymore. peerUnlock(localPeer); // Remove the fd from the selector. if (peerProxy->fd != NULL) { peerProxy->fd->remove = true; } // Clear outgoing packet queue. while (peerProxyNextPacket(peerProxy)) {} bufferFree(peerProxy->inputBuffer); // This only applies to the master. if (peerProxy->connections != NULL) { // We can't leave these other maps pointing to freed memory. hashmapForEach(peerProxy->connections, &peerProxyRemoveConnection, peerProxy); hashmapFree(peerProxy->connections); } // Invoke death listener. localPeer->onDeath(pid); // Free the peer proxy itself. free(peerProxy); } static void peerProxyHandleError(PeerProxy* peerProxy, char* functionName) { if (errno == EINTR) { // Log interruptions but otherwise ignore them. ALOGW("%s() interrupted.", functionName); } else if (errno == EAGAIN) { ALOGD("EWOULDBLOCK"); // Ignore. } else { ALOGW("Error returned by %s().", functionName); peerProxyKill(peerProxy, true); } } /** * Buffers output sent to a peer. May be called multiple times until the entire * buffer is filled. Returns true when the buffer is empty. */ static bool peerProxyWriteFromBuffer(PeerProxy* peerProxy, Buffer* outgoing) { ssize_t size = bufferWrite(outgoing, peerProxy->fd->fd); if (size < 0) { peerProxyHandleError(peerProxy, "write"); return false; } else { return bufferWriteComplete(outgoing); } } /** Writes packet bytes to peer. */ static void peerProxyWriteBytes(PeerProxy* peerProxy) { Buffer* buffer = peerProxy->currentPacket->bytes; if (peerProxyWriteFromBuffer(peerProxy, buffer)) { ALOGD("Bytes written."); peerProxyNextPacket(peerProxy); } } /** Sends a socket to the peer. */ static void peerProxyWriteConnection(PeerProxy* peerProxy) { int socket = peerProxy->currentPacket->socket; // Why does sending and receiving fds have to be such a PITA? struct msghdr msg; struct iovec iov[1]; union { struct cmsghdr cm; char control[CMSG_SPACE(sizeof(int))]; } control_un; struct cmsghdr *cmptr; msg.msg_control = control_un.control; msg.msg_controllen = sizeof(control_un.control); cmptr = CMSG_FIRSTHDR(&msg); cmptr->cmsg_len = CMSG_LEN(sizeof(int)); cmptr->cmsg_level = SOL_SOCKET; cmptr->cmsg_type = SCM_RIGHTS; // Store the socket in the message. *((int *) CMSG_DATA(cmptr)) = peerProxy->currentPacket->socket; msg.msg_name = NULL; msg.msg_namelen = 0; iov[0].iov_base = ""; iov[0].iov_len = 1; msg.msg_iov = iov; msg.msg_iovlen = 1; ssize_t result = sendmsg(peerProxy->fd->fd, &msg, 0); if (result < 0) { peerProxyHandleError(peerProxy, "sendmsg"); } else { // Success. Queue up the next packet. peerProxyNextPacket(peerProxy); } } /** * Writes some outgoing data. */ static void peerProxyWrite(SelectableFd* fd) { // TODO: Try to write header and body with one system call. PeerProxy* peerProxy = (PeerProxy*) fd->data; OutgoingPacket* current = peerProxy->currentPacket; if (current == NULL) { // We have nothing left to write. return; } // Write the header. Buffer* outgoingHeader = &peerProxy->outgoingHeader; bool headerWritten = bufferWriteComplete(outgoingHeader); if (!headerWritten) { ALOGD("Writing header..."); headerWritten = peerProxyWriteFromBuffer(peerProxy, outgoingHeader); if (headerWritten) { ALOGD("Header written."); } } // Write body. if (headerWritten) { PacketType type = current->header.type; switch (type) { case CONNECTION: peerProxyWriteConnection(peerProxy); break; case BYTES: peerProxyWriteBytes(peerProxy); break; case CONNECTION_REQUEST: case CONNECTION_ERROR: // These packets consist solely of a header. peerProxyNextPacket(peerProxy); break; default: LOG_ALWAYS_FATAL("Unknown packet type: %d", type); } } } /** * Sets up a peer proxy's fd before we try to select() it. */ static void peerProxyBeforeSelect(SelectableFd* fd) { ALOGD("Before select..."); PeerProxy* peerProxy = (PeerProxy*) fd->data; peerLock(peerProxy->peer); bool hasPackets = peerProxy->currentPacket != NULL; peerUnlock(peerProxy->peer); if (hasPackets) { ALOGD("Packets found. Setting onWritable()."); fd->onWritable = &peerProxyWrite; } else { // We have nothing to write. fd->onWritable = NULL; } } /** Prepare to read bytes from the peer. */ static void peerProxyExpectBytes(PeerProxy* peerProxy, Header* header) { ALOGD("Expecting %d bytes.", header->size); peerProxy->inputState = READING_BYTES; if (bufferPrepareForRead(peerProxy->inputBuffer, header->size) == -1) { ALOGW("Couldn't allocate memory for incoming data. Size: %u", (unsigned int) header->size); // TODO: Ignore the packet and log a warning? peerProxyKill(peerProxy, false); } } /** * Gets a peer proxy for the given ID. Creates a peer proxy if necessary. * Sends a connection request to the master if desired. * * Returns NULL if an error occurs. Sets errno to EHOSTDOWN if the peer died * or ENOMEM if memory couldn't be allocated. */ static PeerProxy* peerProxyGetOrCreate(Peer* peer, pid_t pid, bool requestConnection) { if (pid == peer->pid) { errno = EINVAL; return NULL; } if (peerIsDead(peer, pid)) { errno = EHOSTDOWN; return NULL; } PeerProxy* peerProxy = hashmapGet(peer->peerProxies, &pid); if (peerProxy != NULL) { return peerProxy; } // If this is the master peer, we already know about all peers. if (peer->master) { errno = EHOSTDOWN; return NULL; } // Try to create a peer proxy. Credentials credentials; credentials.pid = pid; // Fake gid and uid until we have the real thing. The real creds are // filled in by masterProxyExpectConnection(). These fake creds will // never be exposed to the user. credentials.uid = 0; credentials.gid = 0; // Make sure we can allocate the connection request packet. OutgoingPacket* packet = NULL; if (requestConnection) { packet = calloc(1, sizeof(OutgoingPacket)); if (packet == NULL) { errno = ENOMEM; return NULL; } packet->header.type = CONNECTION_REQUEST; packet->header.credentials = credentials; packet->free = &outgoingPacketFree; } peerProxy = peerProxyCreate(peer, credentials); if (peerProxy == NULL) { free(packet); errno = ENOMEM; return NULL; } else { // Send a connection request to the master. if (requestConnection) { PeerProxy* masterProxy = peer->masterProxy; peerProxyEnqueueOutgoingPacket(masterProxy, packet); } return peerProxy; } } /** * Switches the master peer proxy into a state where it's waiting for a * connection from the master. */ static void masterProxyExpectConnection(PeerProxy* masterProxy, Header* header) { // TODO: Restructure things so we don't need this check. // Verify that this really is the master. if (!masterProxy->master) { ALOGW("Non-master process %d tried to send us a connection.", masterProxy->credentials.pid); // Kill off the evil peer. peerProxyKill(masterProxy, false); return; } masterProxy->inputState = ACCEPTING_CONNECTION; Peer* localPeer = masterProxy->peer; // Create a peer proxy so we have somewhere to stash the creds. // See if we already have a proxy set up. pid_t pid = header->credentials.pid; peerLock(localPeer); PeerProxy* peerProxy = peerProxyGetOrCreate(localPeer, pid, false); if (peerProxy == NULL) { ALOGW("Peer proxy creation failed: %s", strerror(errno)); } else { // Fill in full credentials. peerProxy->credentials = header->credentials; } peerUnlock(localPeer); // Keep track of which peer proxy we're accepting a connection for. masterProxy->connecting = peerProxy; } /** * Reads input from a peer process. */ static void peerProxyRead(SelectableFd* fd); /** Sets up fd callbacks. */ static void peerProxySetFd(PeerProxy* peerProxy, SelectableFd* fd) { peerProxy->fd = fd; fd->data = peerProxy; fd->onReadable = &peerProxyRead; fd->beforeSelect = &peerProxyBeforeSelect; // Make the socket non-blocking. setNonBlocking(fd->fd); } /** * Accepts a connection sent by the master proxy. */ static void masterProxyAcceptConnection(PeerProxy* masterProxy) { struct msghdr msg; struct iovec iov[1]; ssize_t size; char ignored; int incomingFd; // TODO: Reuse code which writes the connection. Who the heck designed // this API anyway? union { struct cmsghdr cm; char control[CMSG_SPACE(sizeof(int))]; } control_un; struct cmsghdr *cmptr; msg.msg_control = control_un.control; msg.msg_controllen = sizeof(control_un.control); msg.msg_name = NULL; msg.msg_namelen = 0; // We sent 1 byte of data so we can detect EOF. iov[0].iov_base = &ignored; iov[0].iov_len = 1; msg.msg_iov = iov; msg.msg_iovlen = 1; size = recvmsg(masterProxy->fd->fd, &msg, 0); if (size < 0) { if (errno == EINTR) { // Log interruptions but otherwise ignore them. ALOGW("recvmsg() interrupted."); return; } else if (errno == EAGAIN) { // Keep waiting for the connection. return; } else { LOG_ALWAYS_FATAL("Error reading connection from master: %s", strerror(errno)); } } else if (size == 0) { // EOF. LOG_ALWAYS_FATAL("Received EOF from master."); } // Extract fd from message. if ((cmptr = CMSG_FIRSTHDR(&msg)) != NULL && cmptr->cmsg_len == CMSG_LEN(sizeof(int))) { if (cmptr->cmsg_level != SOL_SOCKET) { LOG_ALWAYS_FATAL("Expected SOL_SOCKET."); } if (cmptr->cmsg_type != SCM_RIGHTS) { LOG_ALWAYS_FATAL("Expected SCM_RIGHTS."); } incomingFd = *((int*) CMSG_DATA(cmptr)); } else { LOG_ALWAYS_FATAL("Expected fd."); } // The peer proxy this connection is for. PeerProxy* peerProxy = masterProxy->connecting; if (peerProxy == NULL) { ALOGW("Received connection for unknown peer."); closeWithWarning(incomingFd); } else { Peer* peer = masterProxy->peer; SelectableFd* selectableFd = selectorAdd(peer->selector, incomingFd); if (selectableFd == NULL) { ALOGW("Error adding fd to selector for %d.", peerProxy->credentials.pid); closeWithWarning(incomingFd); peerProxyKill(peerProxy, false); } peerProxySetFd(peerProxy, selectableFd); } peerProxyExpectHeader(masterProxy); } /** * Frees an outgoing packet containing a connection. */ static void outgoingPacketFreeSocket(OutgoingPacket* packet) { closeWithWarning(packet->socket); outgoingPacketFree(packet); } /** * Connects two known peers. */ static void masterConnectPeers(PeerProxy* peerA, PeerProxy* peerB) { int sockets[2]; int result = socketpair(AF_LOCAL, SOCK_STREAM, 0, sockets); if (result == -1) { ALOGW("socketpair() error: %s", strerror(errno)); // TODO: Send CONNECTION_FAILED packets to peers. return; } OutgoingPacket* packetA = calloc(1, sizeof(OutgoingPacket)); OutgoingPacket* packetB = calloc(1, sizeof(OutgoingPacket)); if (packetA == NULL || packetB == NULL) { free(packetA); free(packetB); ALOGW("malloc() error. Failed to tell process %d that process %d is" " dead.", peerA->credentials.pid, peerB->credentials.pid); return; } packetA->header.type = CONNECTION; packetB->header.type = CONNECTION; packetA->header.credentials = peerB->credentials; packetB->header.credentials = peerA->credentials; packetA->socket = sockets[0]; packetB->socket = sockets[1]; packetA->free = &outgoingPacketFreeSocket; packetB->free = &outgoingPacketFreeSocket; peerLock(peerA->peer); peerProxyEnqueueOutgoingPacket(peerA, packetA); peerProxyEnqueueOutgoingPacket(peerB, packetB); peerUnlock(peerA->peer); } /** * Informs a peer that the peer they're trying to connect to couldn't be * found. */ static void masterReportConnectionError(PeerProxy* peerProxy, Credentials credentials) { OutgoingPacket* packet = calloc(1, sizeof(OutgoingPacket)); if (packet == NULL) { ALOGW("malloc() error. Failed to tell process %d that process %d is" " dead.", peerProxy->credentials.pid, credentials.pid); return; } packet->header.type = CONNECTION_ERROR; packet->header.credentials = credentials; packet->free = &outgoingPacketFree; peerProxyLockAndEnqueueOutgoingPacket(peerProxy, packet); } /** * Handles a request to be connected to another peer. */ static void masterHandleConnectionRequest(PeerProxy* peerProxy, Header* header) { Peer* master = peerProxy->peer; pid_t targetPid = header->credentials.pid; if (!hashmapContainsKey(peerProxy->connections, &targetPid)) { // We haven't connected these peers yet. PeerProxy* targetPeer = (PeerProxy*) hashmapGet(master->peerProxies, &targetPid); if (targetPeer == NULL) { // Unknown process. masterReportConnectionError(peerProxy, header->credentials); } else { masterConnectPeers(peerProxy, targetPeer); } } // This packet is complete. Get ready for the next one. peerProxyExpectHeader(peerProxy); } /** * The master told us this peer is dead. */ static void masterProxyHandleConnectionError(PeerProxy* masterProxy, Header* header) { Peer* peer = masterProxy->peer; // Look up the peer proxy. pid_t pid = header->credentials.pid; PeerProxy* peerProxy = NULL; peerLock(peer); peerProxy = hashmapGet(peer->peerProxies, &pid); peerUnlock(peer); if (peerProxy != NULL) { ALOGI("Couldn't connect to %d.", pid); peerProxyKill(peerProxy, false); } else { ALOGW("Peer proxy for %d not found. This shouldn't happen.", pid); } peerProxyExpectHeader(masterProxy); } /** * Handles a packet header. */ static void peerProxyHandleHeader(PeerProxy* peerProxy, Header* header) { switch (header->type) { case CONNECTION_REQUEST: masterHandleConnectionRequest(peerProxy, header); break; case CONNECTION: masterProxyExpectConnection(peerProxy, header); break; case CONNECTION_ERROR: masterProxyHandleConnectionError(peerProxy, header); break; case BYTES: peerProxyExpectBytes(peerProxy, header); break; default: ALOGW("Invalid packet type from %d: %d", peerProxy->credentials.pid, header->type); peerProxyKill(peerProxy, false); } } /** * Buffers input sent by peer. May be called multiple times until the entire * buffer is filled. Returns true when the buffer is full. */ static bool peerProxyBufferInput(PeerProxy* peerProxy) { Buffer* in = peerProxy->inputBuffer; ssize_t size = bufferRead(in, peerProxy->fd->fd); if (size < 0) { peerProxyHandleError(peerProxy, "read"); return false; } else if (size == 0) { // EOF. ALOGI("EOF"); peerProxyKill(peerProxy, false); return false; } else if (bufferReadComplete(in)) { // We're done! return true; } else { // Continue reading. return false; } } /** * Reads input from a peer process. */ static void peerProxyRead(SelectableFd* fd) { ALOGD("Reading..."); PeerProxy* peerProxy = (PeerProxy*) fd->data; int state = peerProxy->inputState; Buffer* in = peerProxy->inputBuffer; switch (state) { case READING_HEADER: if (peerProxyBufferInput(peerProxy)) { ALOGD("Header read."); // We've read the complete header. Header* header = (Header*) in->data; peerProxyHandleHeader(peerProxy, header); } break; case READING_BYTES: ALOGD("Reading bytes..."); if (peerProxyBufferInput(peerProxy)) { ALOGD("Bytes read."); // We have the complete packet. Notify bytes listener. peerProxy->peer->onBytes(peerProxy->credentials, in->data, in->size); // Get ready for the next packet. peerProxyExpectHeader(peerProxy); } break; case ACCEPTING_CONNECTION: masterProxyAcceptConnection(peerProxy); break; default: LOG_ALWAYS_FATAL("Unknown state: %d", state); } } static PeerProxy* peerProxyCreate(Peer* peer, Credentials credentials) { PeerProxy* peerProxy = calloc(1, sizeof(PeerProxy)); if (peerProxy == NULL) { return NULL; } peerProxy->inputBuffer = bufferCreate(sizeof(Header)); if (peerProxy->inputBuffer == NULL) { free(peerProxy); return NULL; } peerProxy->peer = peer; peerProxy->credentials = credentials; // Initial state == expecting a header. peerProxyExpectHeader(peerProxy); // Add this proxy to the map. Make sure the key points to the stable memory // inside of the peer proxy itself. pid_t* pid = &(peerProxy->credentials.pid); hashmapPut(peer->peerProxies, pid, peerProxy); return peerProxy; } /** Accepts a connection to the master peer. */ static void masterAcceptConnection(SelectableFd* listenerFd) { // Accept connection. int socket = accept(listenerFd->fd, NULL, NULL); if (socket == -1) { ALOGW("accept() error: %s", strerror(errno)); return; } ALOGD("Accepted connection as fd %d.", socket); // Get credentials. Credentials credentials; struct ucred ucredentials; socklen_t credentialsSize = sizeof(struct ucred); int result = getsockopt(socket, SOL_SOCKET, SO_PEERCRED, &ucredentials, &credentialsSize); // We might want to verify credentialsSize. if (result == -1) { ALOGW("getsockopt() error: %s", strerror(errno)); closeWithWarning(socket); return; } // Copy values into our own structure so we know we have the types right. credentials.pid = ucredentials.pid; credentials.uid = ucredentials.uid; credentials.gid = ucredentials.gid; ALOGI("Accepted connection from process %d.", credentials.pid); Peer* masterPeer = (Peer*) listenerFd->data; peerLock(masterPeer); // Make sure we don't already have a connection from that process. PeerProxy* peerProxy = hashmapGet(masterPeer->peerProxies, &credentials.pid); if (peerProxy != NULL) { peerUnlock(masterPeer); ALOGW("Alread connected to process %d.", credentials.pid); closeWithWarning(socket); return; } // Add connection to the selector. SelectableFd* socketFd = selectorAdd(masterPeer->selector, socket); if (socketFd == NULL) { peerUnlock(masterPeer); ALOGW("malloc() failed."); closeWithWarning(socket); return; } // Create a peer proxy. peerProxy = peerProxyCreate(masterPeer, credentials); peerUnlock(masterPeer); if (peerProxy == NULL) { ALOGW("malloc() failed."); socketFd->remove = true; closeWithWarning(socket); } peerProxy->connections = hashmapCreate(10, &pidHash, &pidEquals); peerProxySetFd(peerProxy, socketFd); } /** * Creates the local peer. */ static Peer* peerCreate() { Peer* peer = calloc(1, sizeof(Peer)); if (peer == NULL) { LOG_ALWAYS_FATAL("malloc() error."); } peer->peerProxies = hashmapCreate(10, &pidHash, &pidEquals); peer->selector = selectorCreate(); pthread_mutexattr_t attributes; if (pthread_mutexattr_init(&attributes) != 0) { LOG_ALWAYS_FATAL("pthread_mutexattr_init() error."); } if (pthread_mutexattr_settype(&attributes, PTHREAD_MUTEX_RECURSIVE) != 0) { LOG_ALWAYS_FATAL("pthread_mutexattr_settype() error."); } if (pthread_mutex_init(&peer->mutex, &attributes) != 0) { LOG_ALWAYS_FATAL("pthread_mutex_init() error."); } peer->pid = getpid(); return peer; } /** The local peer. */ static Peer* localPeer; /** Frees a packet of bytes. */ static void outgoingPacketFreeBytes(OutgoingPacket* packet) { ALOGD("Freeing outgoing packet."); bufferFree(packet->bytes); free(packet); } /** * Sends a packet of bytes to a remote peer. Returns 0 on success. * * Returns -1 if an error occurs. Sets errno to ENOMEM if memory couldn't be * allocated. Sets errno to EHOSTDOWN if the peer died recently. Sets errno * to EINVAL if pid is the same as the local pid. */ int peerSendBytes(pid_t pid, const char* bytes, size_t size) { Peer* peer = localPeer; assert(peer != NULL); OutgoingPacket* packet = calloc(1, sizeof(OutgoingPacket)); if (packet == NULL) { errno = ENOMEM; return -1; } Buffer* copy = bufferCreate(size); if (copy == NULL) { free(packet); errno = ENOMEM; return -1; } // Copy data. memcpy(copy->data, bytes, size); copy->size = size; packet->bytes = copy; packet->header.type = BYTES; packet->header.size = size; packet->free = outgoingPacketFreeBytes; bufferPrepareForWrite(packet->bytes); peerLock(peer); PeerProxy* peerProxy = peerProxyGetOrCreate(peer, pid, true); if (peerProxy == NULL) { // The peer is already dead or we couldn't alloc memory. Either way, // errno is set. peerUnlock(peer); packet->free(packet); return -1; } else { peerProxyEnqueueOutgoingPacket(peerProxy, packet); peerUnlock(peer); selectorWakeUp(peer->selector); return 0; } } /** Keeps track of how to free shared bytes. */ typedef struct { void (*free)(void* context); void* context; } SharedBytesFreer; /** Frees shared bytes. */ static void outgoingPacketFreeSharedBytes(OutgoingPacket* packet) { SharedBytesFreer* sharedBytesFreer = (SharedBytesFreer*) packet->context; sharedBytesFreer->free(sharedBytesFreer->context); free(sharedBytesFreer); free(packet); } /** * Sends a packet of bytes to a remote peer without copying the bytes. Calls * free() with context after the bytes have been sent. * * Returns -1 if an error occurs. Sets errno to ENOMEM if memory couldn't be * allocated. Sets errno to EHOSTDOWN if the peer died recently. Sets errno * to EINVAL if pid is the same as the local pid. */ int peerSendSharedBytes(pid_t pid, char* bytes, size_t size, void (*free)(void* context), void* context) { Peer* peer = localPeer; assert(peer != NULL); OutgoingPacket* packet = calloc(1, sizeof(OutgoingPacket)); if (packet == NULL) { errno = ENOMEM; return -1; } Buffer* wrapper = bufferWrap(bytes, size, size); if (wrapper == NULL) { free(packet); errno = ENOMEM; return -1; } SharedBytesFreer* sharedBytesFreer = malloc(sizeof(SharedBytesFreer)); if (sharedBytesFreer == NULL) { free(packet); free(wrapper); errno = ENOMEM; return -1; } sharedBytesFreer->free = free; sharedBytesFreer->context = context; packet->bytes = wrapper; packet->context = sharedBytesFreer; packet->header.type = BYTES; packet->header.size = size; packet->free = &outgoingPacketFreeSharedBytes; bufferPrepareForWrite(packet->bytes); peerLock(peer); PeerProxy* peerProxy = peerProxyGetOrCreate(peer, pid, true); if (peerProxy == NULL) { // The peer is already dead or we couldn't alloc memory. Either way, // errno is set. peerUnlock(peer); packet->free(packet); return -1; } else { peerProxyEnqueueOutgoingPacket(peerProxy, packet); peerUnlock(peer); selectorWakeUp(peer->selector); return 0; } } /** * Starts the master peer. The master peer differs from other peers in that * it is responsible for connecting the other peers. You can only have one * master peer. * * Goes into an I/O loop and does not return. */ void masterPeerInitialize(BytesListener* bytesListener, DeathListener* deathListener) { // Create and bind socket. int listenerSocket = socket(AF_LOCAL, SOCK_STREAM, 0); if (listenerSocket == -1) { LOG_ALWAYS_FATAL("socket() error: %s", strerror(errno)); } unlink(MASTER_PATH); int result = bind(listenerSocket, (SocketAddress*) getMasterAddress(), sizeof(UnixAddress)); if (result == -1) { LOG_ALWAYS_FATAL("bind() error: %s", strerror(errno)); } ALOGD("Listener socket: %d", listenerSocket); // Queue up to 16 connections. result = listen(listenerSocket, 16); if (result != 0) { LOG_ALWAYS_FATAL("listen() error: %s", strerror(errno)); } // Make socket non-blocking. setNonBlocking(listenerSocket); // Create the peer for this process. Fail if we already have one. if (localPeer != NULL) { LOG_ALWAYS_FATAL("Peer is already initialized."); } localPeer = peerCreate(); if (localPeer == NULL) { LOG_ALWAYS_FATAL("malloc() failed."); } localPeer->master = true; localPeer->onBytes = bytesListener; localPeer->onDeath = deathListener; // Make listener socket selectable. SelectableFd* listenerFd = selectorAdd(localPeer->selector, listenerSocket); if (listenerFd == NULL) { LOG_ALWAYS_FATAL("malloc() error."); } listenerFd->data = localPeer; listenerFd->onReadable = &masterAcceptConnection; } /** * Starts a local peer. * * Goes into an I/O loop and does not return. */ void peerInitialize(BytesListener* bytesListener, DeathListener* deathListener) { // Connect to master peer. int masterSocket = socket(AF_LOCAL, SOCK_STREAM, 0); if (masterSocket == -1) { LOG_ALWAYS_FATAL("socket() error: %s", strerror(errno)); } int result = connect(masterSocket, (SocketAddress*) getMasterAddress(), sizeof(UnixAddress)); if (result != 0) { LOG_ALWAYS_FATAL("connect() error: %s", strerror(errno)); } // Create the peer for this process. Fail if we already have one. if (localPeer != NULL) { LOG_ALWAYS_FATAL("Peer is already initialized."); } localPeer = peerCreate(); if (localPeer == NULL) { LOG_ALWAYS_FATAL("malloc() failed."); } localPeer->onBytes = bytesListener; localPeer->onDeath = deathListener; // Make connection selectable. SelectableFd* masterFd = selectorAdd(localPeer->selector, masterSocket); if (masterFd == NULL) { LOG_ALWAYS_FATAL("malloc() error."); } // Create a peer proxy for the master peer. PeerProxy* masterProxy = peerProxyCreate(localPeer, MASTER_CREDENTIALS); if (masterProxy == NULL) { LOG_ALWAYS_FATAL("malloc() error."); } peerProxySetFd(masterProxy, masterFd); masterProxy->master = true; localPeer->masterProxy = masterProxy; } /** Starts the master peer I/O loop. Doesn't return. */ void peerLoop() { assert(localPeer != NULL); // Start selector. selectorLoop(localPeer->selector); } android-audiosystem-1.8+13.10.20130807/lib/libcutils/fs.c0000644000015700001700000000734712200324306023221 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "cutils" #include #include #include #include #include #include #include #include #include #define ALL_PERMS (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO) #define BUF_SIZE 64 int fs_prepare_dir(const char* path, mode_t mode, uid_t uid, gid_t gid) { // Check if path needs to be created struct stat sb; if (TEMP_FAILURE_RETRY(lstat(path, &sb)) == -1) { if (errno == ENOENT) { goto create; } else { ALOGE("Failed to lstat(%s): %s", path, strerror(errno)); return -1; } } // Exists, verify status if (!S_ISDIR(sb.st_mode)) { ALOGE("Not a directory: %s", path); return -1; } if (((sb.st_mode & ALL_PERMS) == mode) && (sb.st_uid == uid) && (sb.st_gid == gid)) { return 0; } else { goto fixup; } create: if (TEMP_FAILURE_RETRY(mkdir(path, mode)) == -1) { if (errno != EEXIST) { ALOGE("Failed to mkdir(%s): %s", path, strerror(errno)); return -1; } } fixup: if (TEMP_FAILURE_RETRY(chmod(path, mode)) == -1) { ALOGE("Failed to chmod(%s, %d): %s", path, mode, strerror(errno)); return -1; } if (TEMP_FAILURE_RETRY(chown(path, uid, gid)) == -1) { ALOGE("Failed to chown(%s, %d, %d): %s", path, uid, gid, strerror(errno)); return -1; } return 0; } int fs_read_atomic_int(const char* path, int* out_value) { int fd = TEMP_FAILURE_RETRY(open(path, O_RDONLY)); if (fd == -1) { ALOGE("Failed to read %s: %s", path, strerror(errno)); return -1; } char buf[BUF_SIZE]; if (TEMP_FAILURE_RETRY(read(fd, buf, BUF_SIZE)) == -1) { ALOGE("Failed to read %s: %s", path, strerror(errno)); goto fail; } if (sscanf(buf, "%d", out_value) != 1) { ALOGE("Failed to parse %s: %s", path, strerror(errno)); goto fail; } close(fd); return 0; fail: close(fd); *out_value = -1; return -1; } int fs_write_atomic_int(const char* path, int value) { char temp[PATH_MAX]; if (snprintf(temp, PATH_MAX, "%s.XXXXXX", path) >= PATH_MAX) { ALOGE("Path too long"); return -1; } int fd = TEMP_FAILURE_RETRY(mkstemp(temp)); if (fd == -1) { ALOGE("Failed to open %s: %s", temp, strerror(errno)); return -1; } char buf[BUF_SIZE]; int len = snprintf(buf, BUF_SIZE, "%d", value) + 1; if (len > BUF_SIZE) { ALOGE("Value %d too large: %s", value, strerror(errno)); goto fail; } if (TEMP_FAILURE_RETRY(write(fd, buf, len)) < len) { ALOGE("Failed to write %s: %s", temp, strerror(errno)); goto fail; } if (close(fd) == -1) { ALOGE("Failed to close %s: %s", temp, strerror(errno)); goto fail_closed; } if (rename(temp, path) == -1) { ALOGE("Failed to rename %s to %s: %s", temp, path, strerror(errno)); goto fail_closed; } return 0; fail: close(fd); fail_closed: unlink(temp); return -1; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/socket_local.h0000644000015700001700000000270512200324306025251 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __SOCKET_LOCAL_H #define __SOCKET_LOCAL_H #define FILESYSTEM_SOCKET_PREFIX "/tmp/" #define ANDROID_RESERVED_SOCKET_PREFIX "/dev/socket/" /* * Set up a given sockaddr_un, to have it refer to the given * name in the given namespace. The namespace must be one * of ANDROID_SOCKET_NAMESPACE_ABSTRACT, * ANDROID_SOCKET_NAMESPACE_RESERVED, or * ANDROID_SOCKET_NAMESPACE_FILESYSTEM. Upon success, * the pointed at sockaddr_un is filled in and the pointed at * socklen_t is set to indicate the final length. This function * will fail if the namespace is invalid (not one of the indicated * constants) or if the name is too long. * * @return 0 on success or -1 on failure */ int socket_make_sockaddr_un(const char *name, int namespaceId, struct sockaddr_un *p_addr, socklen_t *alen); #endif android-audiosystem-1.8+13.10.20130807/lib/libcutils/build0000755000015700001700000000013012200324306023451 0ustar pbuserpbgroup00000000000000#!/bin/sh target='armel' make clean make -e ARCH=$target make -e ARCH=$target install android-audiosystem-1.8+13.10.20130807/lib/libcutils/MODULE_LICENSE_APACHE20000644000015700001700000000000012200324306025555 0ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/lib/libcutils/sched_policy.c0000644000015700001700000002121512200324306025244 0ustar pbuserpbgroup00000000000000 /* libs/cutils/sched_policy.c ** ** Copyright 2007, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #define LOG_TAG "SchedPolicy" #include #include #include #include #include #include #include #include /* Re-map SP_DEFAULT to the system default policy, and leave other values unchanged. * Call this any place a SchedPolicy is used as an input parameter. * Returns the possibly re-mapped policy. */ static inline SchedPolicy _policy(SchedPolicy p) { return p == SP_DEFAULT ? SP_SYSTEM_DEFAULT : p; } #if defined(HAVE_ANDROID_OS) && defined(HAVE_SCHED_H) && defined(HAVE_PTHREADS) #include #include #ifndef SCHED_NORMAL #define SCHED_NORMAL 0 #endif #ifndef SCHED_BATCH #define SCHED_BATCH 3 #endif #define POLICY_DEBUG 0 #define CAN_SET_SP_SYSTEM 0 // non-zero means to implement set_sched_policy(tid, SP_SYSTEM) static pthread_once_t the_once = PTHREAD_ONCE_INIT; static int __sys_supports_schedgroups = -1; // File descriptors open to /dev/cpuctl/../tasks, setup by initialize, or -1 on error. static int bg_cgroup_fd = -1; static int fg_cgroup_fd = -1; #if CAN_SET_SP_SYSTEM static int system_cgroup_fd = -1; #endif /* Add tid to the scheduling group defined by the policy */ static int add_tid_to_cgroup(int tid, SchedPolicy policy) { int fd; switch (policy) { case SP_BACKGROUND: fd = bg_cgroup_fd; break; case SP_FOREGROUND: case SP_AUDIO_APP: case SP_AUDIO_SYS: fd = fg_cgroup_fd; break; #if CAN_SET_SP_SYSTEM case SP_SYSTEM: fd = system_cgroup_fd; break; #endif default: fd = -1; break; } if (fd < 0) { SLOGE("add_tid_to_cgroup failed; policy=%d\n", policy); return -1; } // specialized itoa -- works for tid > 0 char text[22]; char *end = text + sizeof(text) - 1; char *ptr = end; *ptr = '\0'; while (tid > 0) { *--ptr = '0' + (tid % 10); tid = tid / 10; } if (write(fd, ptr, end - ptr) < 0) { /* * If the thread is in the process of exiting, * don't flag an error */ if (errno == ESRCH) return 0; SLOGW("add_tid_to_cgroup failed to write '%s' (%s); policy=%d\n", ptr, strerror(errno), policy); return -1; } return 0; } static void __initialize(void) { char* filename; if (!access("/dev/cpuctl/tasks", F_OK)) { __sys_supports_schedgroups = 1; #if CAN_SET_SP_SYSTEM filename = "/dev/cpuctl/tasks"; system_cgroup_fd = open(filename, O_WRONLY | O_CLOEXEC); if (system_cgroup_fd < 0) { SLOGV("open of %s failed: %s\n", filename, strerror(errno)); } #endif filename = "/dev/cpuctl/apps/tasks"; fg_cgroup_fd = open(filename, O_WRONLY | O_CLOEXEC); if (fg_cgroup_fd < 0) { SLOGE("open of %s failed: %s\n", filename, strerror(errno)); } filename = "/dev/cpuctl/apps/bg_non_interactive/tasks"; bg_cgroup_fd = open(filename, O_WRONLY | O_CLOEXEC); if (bg_cgroup_fd < 0) { SLOGE("open of %s failed: %s\n", filename, strerror(errno)); } } else { __sys_supports_schedgroups = 0; } } /* * Try to get the scheduler group. * * The data from /proc//cgroup looks (something) like: * 2:cpu:/bg_non_interactive * 1:cpuacct:/ * * We return the part after the "/", which will be an empty string for * the default cgroup. If the string is longer than "bufLen", the string * will be truncated. */ static int getSchedulerGroup(int tid, char* buf, size_t bufLen) { #ifdef HAVE_ANDROID_OS char pathBuf[32]; char lineBuf[256]; FILE *fp; snprintf(pathBuf, sizeof(pathBuf), "/proc/%d/cgroup", tid); if (!(fp = fopen(pathBuf, "r"))) { return -1; } while(fgets(lineBuf, sizeof(lineBuf) -1, fp)) { char *next = lineBuf; char *subsys; char *grp; size_t len; /* Junk the first field */ if (!strsep(&next, ":")) { goto out_bad_data; } if (!(subsys = strsep(&next, ":"))) { goto out_bad_data; } if (strcmp(subsys, "cpu")) { /* Not the subsys we're looking for */ continue; } if (!(grp = strsep(&next, ":"))) { goto out_bad_data; } grp++; /* Drop the leading '/' */ len = strlen(grp); grp[len-1] = '\0'; /* Drop the trailing '\n' */ if (bufLen <= len) { len = bufLen - 1; } strncpy(buf, grp, len); buf[len] = '\0'; fclose(fp); return 0; } SLOGE("Failed to find cpu subsys"); fclose(fp); return -1; out_bad_data: SLOGE("Bad cgroup data {%s}", lineBuf); fclose(fp); return -1; #else errno = ENOSYS; return -1; #endif } int get_sched_policy(int tid, SchedPolicy *policy) { #ifdef HAVE_GETTID if (tid == 0) { tid = gettid(); } #endif pthread_once(&the_once, __initialize); if (__sys_supports_schedgroups) { char grpBuf[32]; if (getSchedulerGroup(tid, grpBuf, sizeof(grpBuf)) < 0) return -1; if (grpBuf[0] == '\0') { *policy = SP_SYSTEM; } else if (!strcmp(grpBuf, "apps/bg_non_interactive")) { *policy = SP_BACKGROUND; } else if (!strcmp(grpBuf, "apps")) { *policy = SP_FOREGROUND; } else { errno = ERANGE; return -1; } } else { int rc = sched_getscheduler(tid); if (rc < 0) return -1; else if (rc == SCHED_NORMAL) *policy = SP_FOREGROUND; else if (rc == SCHED_BATCH) *policy = SP_BACKGROUND; else { errno = ERANGE; return -1; } } return 0; } int set_sched_policy(int tid, SchedPolicy policy) { #ifdef HAVE_GETTID if (tid == 0) { tid = gettid(); } #endif policy = _policy(policy); pthread_once(&the_once, __initialize); #if POLICY_DEBUG char statfile[64]; char statline[1024]; char thread_name[255]; int fd; sprintf(statfile, "/proc/%d/stat", tid); memset(thread_name, 0, sizeof(thread_name)); fd = open(statfile, O_RDONLY); if (fd >= 0) { int rc = read(fd, statline, 1023); close(fd); statline[rc] = 0; char *p = statline; char *q; for (p = statline; *p != '('; p++); p++; for (q = p; *q != ')'; q++); strncpy(thread_name, p, (q-p)); } switch (policy) { case SP_BACKGROUND: SLOGD("vvv tid %d (%s)", tid, thread_name); break; case SP_FOREGROUND: case SP_AUDIO_APP: case SP_AUDIO_SYS: SLOGD("^^^ tid %d (%s)", tid, thread_name); break; case SP_SYSTEM: SLOGD("/// tid %d (%s)", tid, thread_name); break; default: SLOGD("??? tid %d (%s)", tid, thread_name); break; } #endif if (__sys_supports_schedgroups) { if (add_tid_to_cgroup(tid, policy)) { if (errno != ESRCH && errno != ENOENT) return -errno; } } else { struct sched_param param; param.sched_priority = 0; sched_setscheduler(tid, (policy == SP_BACKGROUND) ? SCHED_BATCH : SCHED_NORMAL, ¶m); } return 0; } #else /* Stubs for non-Android targets. */ int set_sched_policy(int tid, SchedPolicy policy) { return 0; } int get_sched_policy(int tid, SchedPolicy *policy) { *policy = SP_SYSTEM_DEFAULT; return 0; } #endif const char *get_sched_policy_name(SchedPolicy policy) { policy = _policy(policy); static const char * const strings[SP_CNT] = { [SP_BACKGROUND] = "bg", [SP_FOREGROUND] = "fg", [SP_SYSTEM] = " ", [SP_AUDIO_APP] = "aa", [SP_AUDIO_SYS] = "as", }; if ((policy < SP_CNT) && (strings[policy] != NULL)) return strings[policy]; else return "error"; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/buffer.c0000644000015700001700000000555112200324306024055 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "buffer" #include #include #include #include #include "buffer.h" #include "loghack.h" Buffer* bufferCreate(size_t capacity) { Buffer* buffer = malloc(sizeof(Buffer)); if (buffer == NULL) { return NULL; } buffer->capacity = capacity; buffer->expected = 0; buffer->data = malloc(capacity); if (buffer->data == NULL) { free(buffer); return NULL; } return buffer; } void bufferFree(Buffer* buffer) { free(buffer->data); free(buffer); } Buffer* bufferWrap(char* data, size_t capacity, size_t size) { Buffer* buffer = malloc(sizeof(Buffer)); if (buffer == NULL) { return NULL; } buffer->data = data; buffer->capacity = capacity; buffer->size = size; buffer->expected = 0; return buffer; } int bufferPrepareForRead(Buffer* buffer, size_t expected) { if (expected > buffer->capacity) { // Expand buffer. char* expanded = realloc(buffer->data, expected); if (expanded == NULL) { errno = ENOMEM; return -1; } buffer->capacity = expected; buffer->data = expanded; } buffer->size = 0; buffer->expected = expected; return 0; } ssize_t bufferRead(Buffer* buffer, int fd) { assert(buffer->size < buffer->expected); ssize_t bytesRead = read(fd, buffer->data + buffer->size, buffer->expected - buffer->size); if (bytesRead > 0) { buffer->size += bytesRead; return buffer->size; } return bytesRead; } void bufferPrepareForWrite(Buffer* buffer) { buffer->remaining = buffer->size; } ssize_t bufferWrite(Buffer* buffer, int fd) { assert(buffer->remaining > 0); assert(buffer->remaining <= buffer->size); ssize_t bytesWritten = write(fd, buffer->data + buffer->size - buffer->remaining, buffer->remaining); if (bytesWritten >= 0) { buffer->remaining -= bytesWritten; ALOGD("Buffer bytes written: %d", (int) bytesWritten); ALOGD("Buffer size: %d", (int) buffer->size); ALOGD("Buffer remaining: %d", (int) buffer->remaining); return buffer->remaining; } return bytesWritten; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/multiuser.c0000644000015700001700000000173512200324306024635 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include userid_t multiuser_get_user_id(uid_t uid) { return uid / MULTIUSER_APP_PER_USER_RANGE; } appid_t multiuser_get_app_id(uid_t uid) { return uid % MULTIUSER_APP_PER_USER_RANGE; } uid_t multiuser_get_uid(userid_t userId, appid_t appId) { return userId * MULTIUSER_APP_PER_USER_RANGE + (appId % MULTIUSER_APP_PER_USER_RANGE); } android-audiosystem-1.8+13.10.20130807/lib/libcutils/abort_socket.c0000644000015700001700000001613312200324306025261 0ustar pbuserpbgroup00000000000000/* * Copyright 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include #include #include "cutils/abort_socket.h" struct asocket *asocket_init(int fd) { int abort_fd[2]; int flags; struct asocket *s; /* set primary socket to non-blocking */ flags = fcntl(fd, F_GETFL); if (flags == -1) return NULL; if (fcntl(fd, F_SETFL, flags | O_NONBLOCK)) return NULL; /* create pipe with non-blocking write, so that asocket_close() cannot block */ if (pipe(abort_fd)) return NULL; flags = fcntl(abort_fd[1], F_GETFL); if (flags == -1) return NULL; if (fcntl(abort_fd[1], F_SETFL, flags | O_NONBLOCK)) return NULL; s = malloc(sizeof(struct asocket)); if (!s) return NULL; s->fd = fd; s->abort_fd[0] = abort_fd[0]; s->abort_fd[1] = abort_fd[1]; return s; } int asocket_connect(struct asocket *s, const struct sockaddr *addr, socklen_t addrlen, int timeout) { int ret; do { ret = connect(s->fd, addr, addrlen); } while (ret && errno == EINTR); if (ret && errno == EINPROGRESS) { /* ready to poll() */ socklen_t retlen; struct pollfd pfd[2]; pfd[0].fd = s->fd; pfd[0].events = POLLOUT; pfd[0].revents = 0; pfd[1].fd = s->abort_fd[0]; pfd[1].events = POLLIN; pfd[1].revents = 0; do { ret = poll(pfd, 2, timeout); } while (ret < 0 && errno == EINTR); if (ret < 0) return -1; else if (ret == 0) { /* timeout */ errno = ETIMEDOUT; return -1; } if (pfd[1].revents) { /* abort due to asocket_abort() */ errno = ECANCELED; return -1; } if (pfd[0].revents) { if (pfd[0].revents & POLLOUT) { /* connect call complete, read return code */ retlen = sizeof(ret); if (getsockopt(s->fd, SOL_SOCKET, SO_ERROR, &ret, &retlen)) return -1; /* got connect() return code */ if (ret) { errno = ret; } } else { /* some error event on this fd */ errno = ECONNABORTED; return -1; } } } return ret; } int asocket_accept(struct asocket *s, struct sockaddr *addr, socklen_t *addrlen, int timeout) { int ret; struct pollfd pfd[2]; pfd[0].fd = s->fd; pfd[0].events = POLLIN; pfd[0].revents = 0; pfd[1].fd = s->abort_fd[0]; pfd[1].events = POLLIN; pfd[1].revents = 0; do { ret = poll(pfd, 2, timeout); } while (ret < 0 && errno == EINTR); if (ret < 0) return -1; else if (ret == 0) { /* timeout */ errno = ETIMEDOUT; return -1; } if (pfd[1].revents) { /* abort due to asocket_abort() */ errno = ECANCELED; return -1; } if (pfd[0].revents) { if (pfd[0].revents & POLLIN) { /* ready to accept() without blocking */ do { ret = accept(s->fd, addr, addrlen); } while (ret < 0 && errno == EINTR); } else { /* some error event on this fd */ errno = ECONNABORTED; return -1; } } return ret; } int asocket_read(struct asocket *s, void *buf, size_t count, int timeout) { int ret; struct pollfd pfd[2]; pfd[0].fd = s->fd; pfd[0].events = POLLIN; pfd[0].revents = 0; pfd[1].fd = s->abort_fd[0]; pfd[1].events = POLLIN; pfd[1].revents = 0; do { ret = poll(pfd, 2, timeout); } while (ret < 0 && errno == EINTR); if (ret < 0) return -1; else if (ret == 0) { /* timeout */ errno = ETIMEDOUT; return -1; } if (pfd[1].revents) { /* abort due to asocket_abort() */ errno = ECANCELED; return -1; } if (pfd[0].revents) { if (pfd[0].revents & POLLIN) { /* ready to read() without blocking */ do { ret = read(s->fd, buf, count); } while (ret < 0 && errno == EINTR); } else { /* some error event on this fd */ errno = ECONNABORTED; return -1; } } return ret; } int asocket_write(struct asocket *s, const void *buf, size_t count, int timeout) { int ret; struct pollfd pfd[2]; pfd[0].fd = s->fd; pfd[0].events = POLLOUT; pfd[0].revents = 0; pfd[1].fd = s->abort_fd[0]; pfd[1].events = POLLIN; pfd[1].revents = 0; do { ret = poll(pfd, 2, timeout); } while (ret < 0 && errno == EINTR); if (ret < 0) return -1; else if (ret == 0) { /* timeout */ errno = ETIMEDOUT; return -1; } if (pfd[1].revents) { /* abort due to asocket_abort() */ errno = ECANCELED; return -1; } if (pfd[0].revents) { if (pfd[0].revents & POLLOUT) { /* ready to write() without blocking */ do { ret = write(s->fd, buf, count); } while (ret < 0 && errno == EINTR); } else { /* some error event on this fd */ errno = ECONNABORTED; return -1; } } return ret; } void asocket_abort(struct asocket *s) { int ret; char buf = 0; /* Prevent further use of fd, without yet releasing the fd */ shutdown(s->fd, SHUT_RDWR); /* wake up calls blocked at poll() */ do { ret = write(s->abort_fd[1], &buf, 1); } while (ret < 0 && errno == EINTR); } void asocket_destroy(struct asocket *s) { struct asocket s_copy = *s; /* Clients should *not* be using these fd's after calling asocket_destroy(), but in case they do, set to -1 so they cannot use a stale fd */ s->fd = -1; s->abort_fd[0] = -1; s->abort_fd[1] = -1; /* Call asocket_abort() in case there are still threads blocked on this socket. Clients should not rely on this behavior - it is racy because we are about to close() these sockets - clients should instead make sure all threads are done with the socket before calling asocket_destory(). */ asocket_abort(&s_copy); /* enough safety checks, close and release memory */ close(s_copy.abort_fd[1]); close(s_copy.abort_fd[0]); close(s_copy.fd); free(s); } android-audiosystem-1.8+13.10.20130807/lib/libcutils/tzstrftime.c0000644000015700001700000005457312200324306025027 0ustar pbuserpbgroup00000000000000#ifndef lint #ifndef NOID static char elsieid[] = "@(#)strftime.c 8.1"; /* ** Based on the UCB version with the ID appearing below. ** This is ANSIish only when "multibyte character == plain character". */ #endif /* !defined NOID */ #endif /* !defined lint */ #include #include #include #include #include /* ** Copyright (c) 1989 The Regents of the University of California. ** All rights reserved. ** ** Redistribution and use in source and binary forms are permitted ** provided that the above copyright notice and this paragraph are ** duplicated in all such forms and that any documentation, ** advertising materials, and other materials related to such ** distribution and use acknowledge that the software was developed ** by the University of California, Berkeley. The name of the ** University may not be used to endorse or promote products derived ** from this software without specific prior written permission. ** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR ** IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ #ifndef LIBC_SCCS #ifndef lint static const char sccsid[] = "@(#)strftime.c 5.4 (Berkeley) 3/14/89"; #endif /* !defined lint */ #endif /* !defined LIBC_SCCS */ #include #define P(x) x static char * _add P((const char *, char *, const char *, int)); static char * _conv P((int, const char *, char *, const char *)); static char * _fmt P((const char *, const struct tm *, char *, const char *, int *, const struct strftime_locale *Locale)); static char * _yconv P((int, int, int, int, char *, const char *, int)); static char * getformat P((int, char *, char *, char *, char *)); extern char * tzname[]; /* from private.h */ #ifndef TYPE_BIT #define TYPE_BIT(type) (sizeof (type) * CHAR_BIT) #endif /* !defined TYPE_BIT */ #ifndef TYPE_SIGNED #define TYPE_SIGNED(type) (((type) -1) < 0) #endif /* !defined TYPE_SIGNED */ #ifndef INT_STRLEN_MAXIMUM /* * ** 302 / 1000 is log10(2.0) rounded up. * ** Subtract one for the sign bit if the type is signed; * ** add one for integer division truncation; * ** add one more for a minus sign if the type is signed. * */ #define INT_STRLEN_MAXIMUM(type) \ ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \ 1 + TYPE_SIGNED(type)) #endif /* !defined INT_STRLEN_MAXIMUM */ /* end of part from private.h */ #ifndef YEAR_2000_NAME #define YEAR_2000_NAME "CHECK_STRFTIME_FORMATS_FOR_TWO_DIGIT_YEARS" #endif /* !defined YEAR_2000_NAME */ #define IN_NONE 0 #define IN_SOME 1 #define IN_THIS 2 #define IN_ALL 3 #define FORCE_LOWER_CASE 0x100 size_t strftime_tz(s, maxsize, format, t, Locale) char * const s; const size_t maxsize; const char * const format; const struct tm * const t; const struct strftime_locale *Locale; { char * p; int warn; warn = IN_NONE; p = _fmt(((format == NULL) ? "%c" : format), t, s, s + maxsize, &warn, Locale); #if 0 if (warn != IN_NONE && getenv(YEAR_2000_NAME) != NULL) { (void) fprintf(stderr, "\n"); if (format == NULL) (void) fprintf(stderr, "NULL strftime format "); else (void) fprintf(stderr, "strftime format \"%s\" ", format); (void) fprintf(stderr, "yields only two digits of years in "); if (warn == IN_SOME) (void) fprintf(stderr, "some locales"); else if (warn == IN_THIS) (void) fprintf(stderr, "the current locale"); else (void) fprintf(stderr, "all locales"); (void) fprintf(stderr, "\n"); } #endif /* !defined NO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU */ if (p == s + maxsize) return 0; *p = '\0'; return p - s; } static char *getformat(int modifier, char *normal, char *underscore, char *dash, char *zero) { switch (modifier) { case '_': return underscore; case '-': return dash; case '0': return zero; } return normal; } static char * _fmt(format, t, pt, ptlim, warnp, Locale) const char * format; const struct tm * const t; char * pt; const char * const ptlim; int * warnp; const struct strftime_locale *Locale; { for ( ; *format; ++format) { if (*format == '%') { int modifier = 0; label: switch (*++format) { case '\0': --format; break; case 'A': pt = _add((t->tm_wday < 0 || t->tm_wday >= DAYSPERWEEK) ? "?" : Locale->weekday[t->tm_wday], pt, ptlim, modifier); continue; case 'a': pt = _add((t->tm_wday < 0 || t->tm_wday >= DAYSPERWEEK) ? "?" : Locale->wday[t->tm_wday], pt, ptlim, modifier); continue; case 'B': if (modifier == '-') { pt = _add((t->tm_mon < 0 || t->tm_mon >= MONSPERYEAR) ? "?" : Locale->standalone_month[t->tm_mon], pt, ptlim, modifier); } else { pt = _add((t->tm_mon < 0 || t->tm_mon >= MONSPERYEAR) ? "?" : Locale->month[t->tm_mon], pt, ptlim, modifier); } continue; case 'b': case 'h': pt = _add((t->tm_mon < 0 || t->tm_mon >= MONSPERYEAR) ? "?" : Locale->mon[t->tm_mon], pt, ptlim, modifier); continue; case 'C': /* ** %C used to do a... ** _fmt("%a %b %e %X %Y", t); ** ...whereas now POSIX 1003.2 calls for ** something completely different. ** (ado, 1993-05-24) */ pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 0, pt, ptlim, modifier); continue; case 'c': { int warn2 = IN_SOME; pt = _fmt(Locale->c_fmt, t, pt, ptlim, warnp, Locale); if (warn2 == IN_ALL) warn2 = IN_THIS; if (warn2 > *warnp) *warnp = warn2; } continue; case 'D': pt = _fmt("%m/%d/%y", t, pt, ptlim, warnp, Locale); continue; case 'd': pt = _conv(t->tm_mday, getformat(modifier, "%02d", "%2d", "%d", "%02d"), pt, ptlim); continue; case 'E': case 'O': /* ** C99 locale modifiers. ** The sequences ** %Ec %EC %Ex %EX %Ey %EY ** %Od %oe %OH %OI %Om %OM ** %OS %Ou %OU %OV %Ow %OW %Oy ** are supposed to provide alternate ** representations. */ goto label; case '_': case '-': case '0': case '^': case '#': modifier = *format; goto label; case 'e': pt = _conv(t->tm_mday, getformat(modifier, "%2d", "%2d", "%d", "%02d"), pt, ptlim); continue; case 'F': pt = _fmt("%Y-%m-%d", t, pt, ptlim, warnp, Locale); continue; case 'H': pt = _conv(t->tm_hour, getformat(modifier, "%02d", "%2d", "%d", "%02d"), pt, ptlim); continue; case 'I': pt = _conv((t->tm_hour % 12) ? (t->tm_hour % 12) : 12, getformat(modifier, "%02d", "%2d", "%d", "%02d"), pt, ptlim); continue; case 'j': pt = _conv(t->tm_yday + 1, getformat(modifier, "%03d", "%3d", "%d", "%03d"), pt, ptlim); continue; case 'k': /* ** This used to be... ** _conv(t->tm_hour % 12 ? ** t->tm_hour % 12 : 12, 2, ' '); ** ...and has been changed to the below to ** match SunOS 4.1.1 and Arnold Robbins' ** strftime version 3.0. That is, "%k" and ** "%l" have been swapped. ** (ado, 1993-05-24) */ pt = _conv(t->tm_hour, getformat(modifier, "%2d", "%2d", "%d", "%02d"), pt, ptlim); continue; #ifdef KITCHEN_SINK case 'K': /* ** After all this time, still unclaimed! */ pt = _add("kitchen sink", pt, ptlim, modifier); continue; #endif /* defined KITCHEN_SINK */ case 'l': /* ** This used to be... ** _conv(t->tm_hour, 2, ' '); ** ...and has been changed to the below to ** match SunOS 4.1.1 and Arnold Robbin's ** strftime version 3.0. That is, "%k" and ** "%l" have been swapped. ** (ado, 1993-05-24) */ pt = _conv((t->tm_hour % 12) ? (t->tm_hour % 12) : 12, getformat(modifier, "%2d", "%2d", "%d", "%02d"), pt, ptlim); continue; case 'M': pt = _conv(t->tm_min, getformat(modifier, "%02d", "%2d", "%d", "%02d"), pt, ptlim); continue; case 'm': pt = _conv(t->tm_mon + 1, getformat(modifier, "%02d", "%2d", "%d", "%02d"), pt, ptlim); continue; case 'n': pt = _add("\n", pt, ptlim, modifier); continue; case 'p': pt = _add((t->tm_hour >= (HOURSPERDAY / 2)) ? Locale->pm : Locale->am, pt, ptlim, modifier); continue; case 'P': pt = _add((t->tm_hour >= (HOURSPERDAY / 2)) ? Locale->pm : Locale->am, pt, ptlim, FORCE_LOWER_CASE); continue; case 'R': pt = _fmt("%H:%M", t, pt, ptlim, warnp, Locale); continue; case 'r': pt = _fmt("%I:%M:%S %p", t, pt, ptlim, warnp, Locale); continue; case 'S': pt = _conv(t->tm_sec, getformat(modifier, "%02d", "%2d", "%d", "%02d"), pt, ptlim); continue; case 's': { struct tm tm; char buf[INT_STRLEN_MAXIMUM( time_t) + 1]; time_t mkt; tm = *t; mkt = mktime(&tm); if (TYPE_SIGNED(time_t)) (void) sprintf(buf, "%ld", (long) mkt); else (void) sprintf(buf, "%lu", (unsigned long) mkt); pt = _add(buf, pt, ptlim, modifier); } continue; case 'T': pt = _fmt("%H:%M:%S", t, pt, ptlim, warnp, Locale); continue; case 't': pt = _add("\t", pt, ptlim, modifier); continue; case 'U': pt = _conv((t->tm_yday + DAYSPERWEEK - t->tm_wday) / DAYSPERWEEK, getformat(modifier, "%02d", "%2d", "%d", "%02d"), pt, ptlim); continue; case 'u': /* ** From Arnold Robbins' strftime version 3.0: ** "ISO 8601: Weekday as a decimal number ** [1 (Monday) - 7]" ** (ado, 1993-05-24) */ pt = _conv((t->tm_wday == 0) ? DAYSPERWEEK : t->tm_wday, "%d", pt, ptlim); continue; case 'V': /* ISO 8601 week number */ case 'G': /* ISO 8601 year (four digits) */ case 'g': /* ISO 8601 year (two digits) */ /* ** From Arnold Robbins' strftime version 3.0: "the week number of the ** year (the first Monday as the first day of week 1) as a decimal number ** (01-53)." ** (ado, 1993-05-24) ** ** From "http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html" by Markus Kuhn: ** "Week 01 of a year is per definition the first week which has the ** Thursday in this year, which is equivalent to the week which contains ** the fourth day of January. In other words, the first week of a new year ** is the week which has the majority of its days in the new year. Week 01 ** might also contain days from the previous year and the week before week ** 01 of a year is the last week (52 or 53) of the previous year even if ** it contains days from the new year. A week starts with Monday (day 1) ** and ends with Sunday (day 7). For example, the first week of the year ** 1997 lasts from 1996-12-30 to 1997-01-05..." ** (ado, 1996-01-02) */ { int year; int base; int yday; int wday; int w; year = t->tm_year; base = TM_YEAR_BASE; yday = t->tm_yday; wday = t->tm_wday; for ( ; ; ) { int len; int bot; int top; len = isleap_sum(year, base) ? DAYSPERLYEAR : DAYSPERNYEAR; /* ** What yday (-3 ... 3) does ** the ISO year begin on? */ bot = ((yday + 11 - wday) % DAYSPERWEEK) - 3; /* ** What yday does the NEXT ** ISO year begin on? */ top = bot - (len % DAYSPERWEEK); if (top < -3) top += DAYSPERWEEK; top += len; if (yday >= top) { ++base; w = 1; break; } if (yday >= bot) { w = 1 + ((yday - bot) / DAYSPERWEEK); break; } --base; yday += isleap_sum(year, base) ? DAYSPERLYEAR : DAYSPERNYEAR; } #ifdef XPG4_1994_04_09 if ((w == 52 && t->tm_mon == TM_JANUARY) || (w == 1 && t->tm_mon == TM_DECEMBER)) w = 53; #endif /* defined XPG4_1994_04_09 */ if (*format == 'V') pt = _conv(w, getformat(modifier, "%02d", "%2d", "%d", "%02d"), pt, ptlim); else if (*format == 'g') { *warnp = IN_ALL; pt = _yconv(year, base, 0, 1, pt, ptlim, modifier); } else pt = _yconv(year, base, 1, 1, pt, ptlim, modifier); } continue; case 'v': /* ** From Arnold Robbins' strftime version 3.0: ** "date as dd-bbb-YYYY" ** (ado, 1993-05-24) */ pt = _fmt("%e-%b-%Y", t, pt, ptlim, warnp, Locale); continue; case 'W': pt = _conv((t->tm_yday + DAYSPERWEEK - (t->tm_wday ? (t->tm_wday - 1) : (DAYSPERWEEK - 1))) / DAYSPERWEEK, getformat(modifier, "%02d", "%2d", "%d", "%02d"), pt, ptlim); continue; case 'w': pt = _conv(t->tm_wday, "%d", pt, ptlim); continue; case 'X': pt = _fmt(Locale->X_fmt, t, pt, ptlim, warnp, Locale); continue; case 'x': { int warn2 = IN_SOME; pt = _fmt(Locale->x_fmt, t, pt, ptlim, &warn2, Locale); if (warn2 == IN_ALL) warn2 = IN_THIS; if (warn2 > *warnp) *warnp = warn2; } continue; case 'y': *warnp = IN_ALL; pt = _yconv(t->tm_year, TM_YEAR_BASE, 0, 1, pt, ptlim, modifier); continue; case 'Y': pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 1, pt, ptlim, modifier); continue; case 'Z': #ifdef TM_ZONE if (t->TM_ZONE != NULL) pt = _add(t->TM_ZONE, pt, ptlim, modifier); else #endif /* defined TM_ZONE */ if (t->tm_isdst >= 0) pt = _add(tzname[t->tm_isdst != 0], pt, ptlim, modifier); /* ** C99 says that %Z must be replaced by the ** empty string if the time zone is not ** determinable. */ continue; case 'z': { int diff; char const * sign; if (t->tm_isdst < 0) continue; #ifdef TM_GMTOFF diff = t->TM_GMTOFF; #else /* !defined TM_GMTOFF */ /* ** C99 says that the UTC offset must ** be computed by looking only at ** tm_isdst. This requirement is ** incorrect, since it means the code ** must rely on magic (in this case ** altzone and timezone), and the ** magic might not have the correct ** offset. Doing things correctly is ** tricky and requires disobeying C99; ** see GNU C strftime for details. ** For now, punt and conform to the ** standard, even though it's incorrect. ** ** C99 says that %z must be replaced by the ** empty string if the time zone is not ** determinable, so output nothing if the ** appropriate variables are not available. */ if (t->tm_isdst == 0) #ifdef USG_COMPAT diff = -timezone; #else /* !defined USG_COMPAT */ continue; #endif /* !defined USG_COMPAT */ else #ifdef ALTZONE diff = -altzone; #else /* !defined ALTZONE */ continue; #endif /* !defined ALTZONE */ #endif /* !defined TM_GMTOFF */ if (diff < 0) { sign = "-"; diff = -diff; } else sign = "+"; pt = _add(sign, pt, ptlim, modifier); diff /= SECSPERMIN; diff = (diff / MINSPERHOUR) * 100 + (diff % MINSPERHOUR); pt = _conv(diff, getformat(modifier, "%04d", "%4d", "%d", "%04d"), pt, ptlim); } continue; case '+': pt = _fmt(Locale->date_fmt, t, pt, ptlim, warnp, Locale); continue; case '%': /* ** X311J/88-090 (4.12.3.5): if conversion char is ** undefined, behavior is undefined. Print out the ** character itself as printf(3) also does. */ default: break; } } if (pt == ptlim) break; *pt++ = *format; } return pt; } static char * _conv(n, format, pt, ptlim) const int n; const char * const format; char * const pt; const char * const ptlim; { char buf[INT_STRLEN_MAXIMUM(int) + 1]; (void) sprintf(buf, format, n); return _add(buf, pt, ptlim, 0); } static char * _add(str, pt, ptlim, modifier) const char * str; char * pt; const char * const ptlim; int modifier; { int c; switch (modifier) { case FORCE_LOWER_CASE: while (pt < ptlim && (*pt = tolower(*str++)) != '\0') { ++pt; } break; case '^': while (pt < ptlim && (*pt = toupper(*str++)) != '\0') { ++pt; } break; case '#': while (pt < ptlim && (c = *str++) != '\0') { if (isupper(c)) { c = tolower(c); } else if (islower(c)) { c = toupper(c); } *pt = c; ++pt; } break; default: while (pt < ptlim && (*pt = *str++) != '\0') { ++pt; } } return pt; } /* ** POSIX and the C Standard are unclear or inconsistent about ** what %C and %y do if the year is negative or exceeds 9999. ** Use the convention that %C concatenated with %y yields the ** same output as %Y, and that %Y contains at least 4 bytes, ** with more only if necessary. */ static char * _yconv(a, b, convert_top, convert_yy, pt, ptlim, modifier) const int a; const int b; const int convert_top; const int convert_yy; char * pt; const char * const ptlim; int modifier; { register int lead; register int trail; #define DIVISOR 100 trail = a % DIVISOR + b % DIVISOR; lead = a / DIVISOR + b / DIVISOR + trail / DIVISOR; trail %= DIVISOR; if (trail < 0 && lead > 0) { trail += DIVISOR; --lead; } else if (lead < 0 && trail > 0) { trail -= DIVISOR; ++lead; } if (convert_top) { if (lead == 0 && trail < 0) pt = _add("-0", pt, ptlim, modifier); else pt = _conv(lead, getformat(modifier, "%02d", "%2d", "%d", "%02d"), pt, ptlim); } if (convert_yy) pt = _conv(((trail < 0) ? -trail : trail), getformat(modifier, "%02d", "%2d", "%d", "%02d"), pt, ptlim); return pt; } #ifdef LOCALE_HOME static struct lc_time_T * _loc P((void)) { static const char locale_home[] = LOCALE_HOME; static const char lc_time[] = "LC_TIME"; static char * locale_buf; int fd; int oldsun; /* "...ain't got nothin' to do..." */ char * lbuf; char * name; char * p; const char ** ap; const char * plim; char filename[FILENAME_MAX]; struct stat st; size_t namesize; size_t bufsize; /* ** Use localebuf.mon[0] to signal whether locale is already set up. */ if (localebuf.mon[0]) return &localebuf; name = setlocale(LC_TIME, (char *) NULL); if (name == NULL || *name == '\0') goto no_locale; /* ** If the locale name is the same as our cache, use the cache. */ lbuf = locale_buf; if (lbuf != NULL && strcmp(name, lbuf) == 0) { p = lbuf; for (ap = (const char **) &localebuf; ap < (const char **) (&localebuf + 1); ++ap) *ap = p += strlen(p) + 1; return &localebuf; } /* ** Slurp the locale file into the cache. */ namesize = strlen(name) + 1; if (sizeof filename < ((sizeof locale_home) + namesize + (sizeof lc_time))) goto no_locale; oldsun = 0; (void) sprintf(filename, "%s/%s/%s", locale_home, name, lc_time); fd = open(filename, O_RDONLY); if (fd < 0) { /* ** Old Sun systems have a different naming and data convention. */ oldsun = 1; (void) sprintf(filename, "%s/%s/%s", locale_home, lc_time, name); fd = open(filename, O_RDONLY); if (fd < 0) goto no_locale; } if (fstat(fd, &st) != 0) goto bad_locale; if (st.st_size <= 0) goto bad_locale; bufsize = namesize + st.st_size; locale_buf = NULL; lbuf = (lbuf == NULL) ? malloc(bufsize) : realloc(lbuf, bufsize); if (lbuf == NULL) goto bad_locale; (void) strcpy(lbuf, name); p = lbuf + namesize; plim = p + st.st_size; if (read(fd, p, (size_t) st.st_size) != st.st_size) goto bad_lbuf; if (close(fd) != 0) goto bad_lbuf; /* ** Parse the locale file into localebuf. */ if (plim[-1] != '\n') goto bad_lbuf; for (ap = (const char **) &localebuf; ap < (const char **) (&localebuf + 1); ++ap) { if (p == plim) goto bad_lbuf; *ap = p; while (*p != '\n') ++p; *p++ = '\0'; } if (oldsun) { /* ** SunOS 4 used an obsolescent format; see localdtconv(3). ** c_fmt had the ``short format for dates and times together'' ** (SunOS 4 date, "%a %b %e %T %Z %Y" in the C locale); ** date_fmt had the ``long format for dates'' ** (SunOS 4 strftime %C, "%A, %B %e, %Y" in the C locale). ** Discard the latter in favor of the former. */ localebuf.date_fmt = localebuf.c_fmt; } /* ** Record the successful parse in the cache. */ locale_buf = lbuf; return &localebuf; bad_lbuf: free(lbuf); bad_locale: (void) close(fd); no_locale: localebuf = C_time_locale; locale_buf = NULL; return &localebuf; } #endif /* defined LOCALE_HOME */ android-audiosystem-1.8+13.10.20130807/lib/libcutils/android_reboot.c0000644000015700001700000000776512200324306025607 0ustar pbuserpbgroup00000000000000/* * Copyright 2011, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include #include #include #include #include /* Check to see if /proc/mounts contains any writeable filesystems * backed by a block device. * Return true if none found, else return false. */ static int remount_ro_done(void) { FILE *f; char mount_dev[256]; char mount_dir[256]; char mount_type[256]; char mount_opts[256]; int mount_freq; int mount_passno; int match; int found_rw_fs = 0; f = fopen("/proc/mounts", "r"); if (! f) { /* If we can't read /proc/mounts, just give up */ return 1; } do { match = fscanf(f, "%255s %255s %255s %255s %d %d\n", mount_dev, mount_dir, mount_type, mount_opts, &mount_freq, &mount_passno); mount_dev[255] = 0; mount_dir[255] = 0; mount_type[255] = 0; mount_opts[255] = 0; if ((match == 6) && !strncmp(mount_dev, "/dev/block", 10) && strstr(mount_opts, "rw")) { found_rw_fs = 1; break; } } while (match != EOF); fclose(f); return !found_rw_fs; } /* Remounting filesystems read-only is difficult when there are files * opened for writing or pending deletes on the filesystem. There is * no way to force the remount with the mount(2) syscall. The magic sysrq * 'u' command does an emergency remount read-only on all writable filesystems * that have a block device (i.e. not tmpfs filesystems) by calling * emergency_remount(), which knows how to force the remount to read-only. * Unfortunately, that is asynchronous, and just schedules the work and * returns. The best way to determine if it is done is to read /proc/mounts * repeatedly until there are no more writable filesystems mounted on * block devices. */ static void remount_ro(void) { int fd, cnt = 0; /* Trigger the remount of the filesystems as read-only, * which also marks them clean. */ fd = open("/proc/sysrq-trigger", O_WRONLY); if (fd < 0) { return; } write(fd, "u", 1); close(fd); /* Now poll /proc/mounts till it's done */ while (!remount_ro_done() && (cnt < 50)) { usleep(100000); cnt++; } return; } int android_reboot(int cmd, int flags, char *arg) { int ret = 0; int reason = -1; #ifdef RECOVERY_PRE_COMMAND if (cmd == (int) ANDROID_RB_RESTART2) { if (arg && strlen(arg) > 0) { char cmd[PATH_MAX]; sprintf(cmd, RECOVERY_PRE_COMMAND " %s", arg); system(cmd); } } #endif if (!(flags & ANDROID_RB_FLAG_NO_SYNC)) sync(); if (!(flags & ANDROID_RB_FLAG_NO_REMOUNT_RO)) remount_ro(); switch (cmd) { case ANDROID_RB_RESTART: reason = RB_AUTOBOOT; break; case ANDROID_RB_POWEROFF: ret = reboot(RB_POWER_OFF); return ret; case ANDROID_RB_RESTART2: // REBOOT_MAGIC break; default: return -1; } #ifdef RECOVERY_PRE_COMMAND_CLEAR_REASON reason = RB_AUTOBOOT; #endif if (reason != -1) ret = reboot(reason); // else // ret = __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, // LINUX_REBOOT_CMD_RESTART2, arg); return ret; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/threads.c0000644000015700001700000000457412200324306024242 0ustar pbuserpbgroup00000000000000/* libs/cutils/threads.c ** ** Copyright (C) 2007, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include #ifdef HAVE_PTHREADS void* thread_store_get( thread_store_t* store ) { const pthread_key_t k = store->tls; if (!store->has_tls) return NULL; return pthread_getspecific( store->tls ); } extern void thread_store_set( thread_store_t* store, void* value, thread_store_destruct_t destroy) { pthread_mutex_lock( &store->lock ); if (!store->has_tls) { if (pthread_key_create( &store->tls, destroy) != 0) { pthread_mutex_unlock(&store->lock); return; } store->has_tls = 1; } pthread_mutex_unlock( &store->lock ); pthread_setspecific( store->tls, value ); } #endif #ifdef HAVE_WIN32_THREADS void* thread_store_get( thread_store_t* store ) { if (!store->has_tls) return NULL; return (void*) TlsGetValue( store->tls ); } void thread_store_set( thread_store_t* store, void* value, thread_store_destruct_t destroy ) { /* XXX: can't use destructor on thread exit */ if (!store->lock_init) { store->lock_init = -1; InitializeCriticalSection( &store->lock ); store->lock_init = -2; } else while (store->lock_init != -2) { Sleep(10); /* 10ms */ } EnterCriticalSection( &store->lock ); if (!store->has_tls) { store->tls = TlsAlloc(); if (store->tls == TLS_OUT_OF_INDEXES) { LeaveCriticalSection( &store->lock ); return; } store->has_tls = 1; } LeaveCriticalSection( &store->lock ); TlsSetValue( store->tls, value ); } #endif android-audiosystem-1.8+13.10.20130807/lib/libcutils/config_utils.c0000644000015700001700000001545212200324306025272 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include #include #include cnode* config_node(const char *name, const char *value) { cnode *node; node = calloc(sizeof(cnode), 1); if(node) { node->name = name ? name : ""; node->value = value ? value : ""; } return node; } cnode* config_find(cnode *root, const char *name) { cnode *node, *match = NULL; /* we walk the whole list, as we need to return the last (newest) entry */ for(node = root->first_child; node; node = node->next) if(!strcmp(node->name, name)) match = node; return match; } static cnode* _config_create(cnode *root, const char *name) { cnode *node; node = config_node(name, NULL); if(root->last_child) root->last_child->next = node; else root->first_child = node; root->last_child = node; return node; } int config_bool(cnode *root, const char *name, int _default) { cnode *node; node = config_find(root, name); if(!node) return _default; switch(node->value[0]) { case 'y': case 'Y': case '1': return 1; default: return 0; } } const char* config_str(cnode *root, const char *name, const char *_default) { cnode *node; node = config_find(root, name); if(!node) return _default; return node->value; } void config_set(cnode *root, const char *name, const char *value) { cnode *node; node = config_find(root, name); if(node) node->value = value; else { node = _config_create(root, name); node->value = value; } } #define T_EOF 0 #define T_TEXT 1 #define T_DOT 2 #define T_OBRACE 3 #define T_CBRACE 4 typedef struct { char *data; char *text; int len; char next; } cstate; static int _lex(cstate *cs, int value) { char c; char *s; char *data; data = cs->data; if(cs->next != 0) { c = cs->next; cs->next = 0; goto got_c; } restart: for(;;) { c = *data++; got_c: if(isspace(c)) continue; switch(c) { case 0: return T_EOF; case '#': for(;;) { switch(*data) { case 0: cs->data = data; return T_EOF; case '\n': cs->data = data + 1; goto restart; default: data++; } } break; case '.': cs->data = data; return T_DOT; case '{': cs->data = data; return T_OBRACE; case '}': cs->data = data; return T_CBRACE; default: s = data - 1; if(value) { for(;;) { if(*data == 0) { cs->data = data; break; } if(*data == '\n') { cs->data = data + 1; *data-- = 0; break; } data++; } /* strip trailing whitespace */ while(data > s){ if(!isspace(*data)) break; *data-- = 0; } goto got_text; } else { for(;;) { if(isspace(*data)) { *data = 0; cs->data = data + 1; goto got_text; } switch(*data) { case 0: cs->data = data; goto got_text; case '.': case '{': case '}': cs->next = *data; *data = 0; cs->data = data + 1; goto got_text; default: data++; } } } } } got_text: cs->text = s; return T_TEXT; } #if 0 char *TOKENNAMES[] = { "EOF", "TEXT", "DOT", "OBRACE", "CBRACE" }; static int lex(cstate *cs, int value) { int tok = _lex(cs, value); printf("TOKEN(%d) %s %s\n", value, TOKENNAMES[tok], tok == T_TEXT ? cs->text : ""); return tok; } #else #define lex(cs,v) _lex(cs,v) #endif static int parse_expr(cstate *cs, cnode *node); static int parse_block(cstate *cs, cnode *node) { for(;;){ switch(lex(cs, 0)){ case T_TEXT: if(parse_expr(cs, node)) return -1; continue; case T_CBRACE: return 0; default: return -1; } } } static int parse_expr(cstate *cs, cnode *root) { cnode *node; /* last token was T_TEXT */ node = config_find(root, cs->text); if(!node || *node->value) node = _config_create(root, cs->text); for(;;) { switch(lex(cs, 1)) { case T_DOT: if(lex(cs, 0) != T_TEXT) return -1; node = _config_create(node, cs->text); continue; case T_TEXT: node->value = cs->text; return 0; case T_OBRACE: return parse_block(cs, node); default: return -1; } } } void config_load(cnode *root, char *data) { if(data != 0) { cstate cs; cs.data = data; cs.next = 0; for(;;) { switch(lex(&cs, 0)) { case T_TEXT: if(parse_expr(&cs, root)) return; break; default: return; } } } } void config_load_file(cnode *root, const char *fn) { char *data; data = load_file(fn, 0); config_load(root, data); } void config_free(cnode *root) { cnode *cur = root->first_child; while (cur) { cnode *prev = cur; config_free(cur); cur = cur->next; free(prev); } } android-audiosystem-1.8+13.10.20130807/lib/libcutils/process_name.c0000644000015700001700000000533312200324306025260 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include #include #include #include #if defined(HAVE_PRCTL) #include #endif #define PROCESS_NAME_DEVICE "/sys/qemu_trace/process_name" static const char* process_name = "unknown"; static int running_in_emulator = -1; void set_process_name(const char* new_name) { char propBuf[PROPERTY_VALUE_MAX]; if (new_name == NULL) { return; } // We never free the old name. Someone else could be using it. int len = strlen(new_name); char* copy = (char*) malloc(len + 1); strcpy(copy, new_name); process_name = (const char*) copy; #if defined(HAVE_PRCTL) if (len < 16) { prctl(PR_SET_NAME, (unsigned long) new_name, 0, 0, 0); } else { prctl(PR_SET_NAME, (unsigned long) new_name + len - 15, 0, 0, 0); } #endif // If we know we are not running in the emulator, then return. if (running_in_emulator == 0) { return; } // If the "running_in_emulator" variable has not been initialized, // then do it now. if (running_in_emulator == -1) { property_get("ro.kernel.qemu", propBuf, ""); if (propBuf[0] == '1') { running_in_emulator = 1; } else { running_in_emulator = 0; return; } } // If the emulator was started with the "-trace file" command line option // then we want to record the process name in the trace even if we are // not currently tracing instructions (so that we will know the process // name when we do start tracing instructions). We do not need to execute // this code if we are just running in the emulator without the "-trace" // command line option, but we don't know that here and this function // isn't called frequently enough to bother optimizing that case. int fd = open(PROCESS_NAME_DEVICE, O_RDWR); if (fd < 0) return; write(fd, process_name, strlen(process_name) + 1); close(fd); } const char* get_process_name(void) { return process_name; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/Makefile0000644000015700001700000000502012200324306024067 0ustar pbuserpbgroup00000000000000make_home := ../.. top_srcdir := ../.. include $(make_home)/project_make WARN = -Wall include $(make_home)/package_make include ../Makefile.defines ####################### # CUSTOMIZE MACROS HERE ####################### # name your library here PKG_LIB = cutils # at least one of following lines must be uncommented # CFILES is .c # CCFILES is .cc # CPPFILES is .cpp # CXXFILES is .cxx CFILES = array.c \ hashmap.c \ atomic.c \ native_handle.c \ buffer.c \ socket_inaddr_any_server.c \ socket_local_client.c \ socket_local_server.c \ socket_loopback_client.c \ socket_loopback_server.c \ socket_network_client.c \ sockets.c \ config_utils.c \ cpu_info.c \ load_file.c \ list.c \ open_memstream.c \ strdup16to8.c \ strdup8to16.c \ record_stream.c \ process_name.c \ properties.c \ qsort_r_compat.c \ threads.c \ sched_policy.c \ iosched_policy.c \ str_parms.c \ abort_socket.c \ selector.c \ tztime.c \ zygote.c \ ashmem-dev.c \ debugger.c \ mot_pthread.c \ android_reboot.c \ partition_utils.c \ uevent.c \ qtaguid.c \ klog.c \ fs.c \ multiuser.c \ memory.c CFLAGS += -DHAVE_MEMSET16 -DHAVE_MEMSET32 ifeq ($(ARCH), armhf) SFILES += arch-arm/memset32.S atomics_arm.S atomic-android-arm.S endif ifeq ($(ARCH), i386) SFILES += arch-x86/android_memset16.S atomics_x86.S arch-x86/android_memset32.S endif #CCFILES = #CPPFILES = #CXXFILES = # if this library depends on private static library built # by this package, uncomment next line #STATIC_LIBS = # modify compiler command-line options CFLAGS += -fPIC -DHAVE_ANDROID_OS=1 -DHAVE_UBUNTU_OS=1 -DANDROID_SMP=0 -DUSE_SSE2 -D_GNU_SOURCE=1 $(CONFIG_DEFINES) # modify linker command-line options LDFLAGS += -L ../liblog SHARED_LIBS += -llog -lpthread -lrt # build private static library private_lib = YES # build simple shared library # single header file exported, should be .../lib/include/$(PKG_LIB).h PKGCONFIG = NO # build pkgconfig shared library # change PKGCONFIG to YES and add following three macros # PKG_LIBDESC is one line description of library # PKG_REQUIRES is list of required pkgconfig libraries # PKG_HEADERS is list of header files to export #PKG_LIBDESC = #PKG_REQUIRES = #PKG_HEADERS = MAKESUBDIR = YES LIBSUBDIR = /$(install_lib_rel) HDRSUBDIR = /$(install_hdr_rel) ############################ # END OF MACROS TO CUSTOMIZE ############################ all: $(TARGET) #-include $(DEPENDS) include $(make_home)/target_lib android-audiosystem-1.8+13.10.20130807/lib/libcutils/socket_inaddr_any_server.c0000644000015700001700000000321612200324306027646 0ustar pbuserpbgroup00000000000000/* libs/cutils/socket_inaddr_any_server.c ** ** Copyright 2006, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include #include #include #include #include #include #ifndef HAVE_WINSOCK #include #include #include #include #endif #define LISTEN_BACKLOG 4 /* open listen() port on any interface */ int socket_inaddr_any_server(int port, int type) { struct sockaddr_in addr; size_t alen; int s, n; memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = htonl(INADDR_ANY); s = socket(AF_INET, type, 0); if(s < 0) return -1; n = 1; setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &n, sizeof(n)); if(bind(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { close(s); return -1; } if (type == SOCK_STREAM) { int ret; ret = listen(s, LISTEN_BACKLOG); if (ret < 0) { close(s); return -1; } } return s; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/socket_loopback_server.c0000644000015700001700000000322512200324306027330 0ustar pbuserpbgroup00000000000000/* libs/cutils/socket_loopback_server.c ** ** Copyright 2006, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include #include #include #include #include #include #define LISTEN_BACKLOG 4 #ifndef HAVE_WINSOCK #include #include #include #include #endif /* open listen() port on loopback interface */ int socket_loopback_server(int port, int type) { struct sockaddr_in addr; size_t alen; int s, n; memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); s = socket(AF_INET, type, 0); if(s < 0) return -1; n = 1; setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &n, sizeof(n)); if(bind(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { close(s); return -1; } if (type == SOCK_STREAM) { int ret; ret = listen(s, LISTEN_BACKLOG); if (ret < 0) { close(s); return -1; } } return s; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/atomic.c0000644000015700001700000000123712200324306024055 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define inline #include android-audiosystem-1.8+13.10.20130807/lib/libcutils/atomic-android-sh.c0000644000015700001700000000751512200324306026110 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #ifdef HAVE_WIN32_THREADS #include #else #include #endif /* * Note : * * (1) SuperH does not have CMPXCHG. It has only TAS for atomic * operations. It does not seem a good idea to implement CMPXCHG, * with TAS. So, we choose to implemnt these operations with * posix mutexes. Please be sure that this might cause performance * problem for Android-SH. Using LL/SC instructions supported in SH-X3, * best performnace would be realized. * * (2) Mutex initialization problem happens, which is commented for * ARM implementation, in this file above. * We follow the fact that the initializer for mutex is a simple zero * value. * * (3) These operations are NOT safe for SMP, as there is no currently * no definition for a memory barrier operation. */ #include #define SWAP_LOCK_COUNT 32U static pthread_mutex_t _swap_locks[SWAP_LOCK_COUNT]; #define SWAP_LOCK(addr) \ &_swap_locks[((unsigned)(void*)(addr) >> 3U) % SWAP_LOCK_COUNT] int32_t android_atomic_acquire_load(volatile const int32_t* addr) { return *addr; } int32_t android_atomic_release_load(volatile const int32_t* addr) { return *addr; } void android_atomic_acquire_store(int32_t value, volatile int32_t* addr) { int32_t oldValue; do { oldValue = *addr; } while (android_atomic_release_cas(oldValue, value, addr)); } void android_atomic_release_store(int32_t value, volatile int32_t* addr) { int32_t oldValue; do { oldValue = *addr; } while (android_atomic_release_cas(oldValue, value, addr)); } int32_t android_atomic_inc(volatile int32_t* addr) { int32_t oldValue; do { oldValue = *addr; } while (android_atomic_release_cas(oldValue, oldValue+1, addr)); return oldValue; } int32_t android_atomic_dec(volatile int32_t* addr) { int32_t oldValue; do { oldValue = *addr; } while (android_atomic_release_cas(oldValue, oldValue-1, addr)); return oldValue; } int32_t android_atomic_add(int32_t value, volatile int32_t* addr) { int32_t oldValue; do { oldValue = *addr; } while (android_atomic_release_cas(oldValue, oldValue+value, addr)); return oldValue; } int32_t android_atomic_and(int32_t value, volatile int32_t* addr) { int32_t oldValue; do { oldValue = *addr; } while (android_atomic_release_cas(oldValue, oldValue&value, addr)); return oldValue; } int32_t android_atomic_or(int32_t value, volatile int32_t* addr) { int32_t oldValue; do { oldValue = *addr; } while (android_atomic_release_cas(oldValue, oldValue|value, addr)); return oldValue; } int android_atomic_acquire_cmpxchg(int32_t oldvalue, int32_t newvalue, volatile int32_t* addr) { return android_atomic_release_cmpxchg(oldValue, newValue, addr); } int android_atomic_release_cmpxchg(int32_t oldvalue, int32_t newvalue, volatile int32_t* addr) { int result; pthread_mutex_t* lock = SWAP_LOCK(addr); pthread_mutex_lock(lock); if (*addr == oldvalue) { *addr = newvalue; result = 0; } else { result = 1; } pthread_mutex_unlock(lock); return result; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/klog.c0000644000015700001700000000276312200324306023542 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include #include #include #include #include static int klog_fd = -1; static int klog_level = KLOG_DEFAULT_LEVEL; void klog_set_level(int level) { klog_level = level; } void klog_init(void) { static const char *name = "/dev/__kmsg__"; if (mknod(name, S_IFCHR | 0600, (1 << 8) | 11) == 0) { klog_fd = open(name, O_WRONLY); fcntl(klog_fd, F_SETFD, FD_CLOEXEC); unlink(name); } } #define LOG_BUF_MAX 512 void klog_write(int level, const char *fmt, ...) { char buf[LOG_BUF_MAX]; va_list ap; if (level > klog_level) return; if (klog_fd < 0) return; va_start(ap, fmt); vsnprintf(buf, LOG_BUF_MAX, fmt, ap); buf[LOG_BUF_MAX - 1] = 0; va_end(ap); write(klog_fd, buf, strlen(buf)); } android-audiosystem-1.8+13.10.20130807/lib/libcutils/strdup8to16.c0000644000015700001700000001371212200324306024725 0ustar pbuserpbgroup00000000000000/* libs/cutils/strdup8to16.c ** ** Copyright 2006, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include #include #include #include /* See http://www.unicode.org/reports/tr22/ for discussion * on invalid sequences */ #define UTF16_REPLACEMENT_CHAR 0xfffd /* Clever trick from Dianne that returns 1-4 depending on leading bit sequence*/ #define UTF8_SEQ_LENGTH(ch) (((0xe5000000 >> ((ch >> 3) & 0x1e)) & 3) + 1) /* note: macro expands to multiple lines */ #define UTF8_SHIFT_AND_MASK(unicode, byte) \ (unicode)<<=6; (unicode) |= (0x3f & (byte)); #define UNICODE_UPPER_LIMIT 0x10fffd /** * out_len is an out parameter (which may not be null) containing the * length of the UTF-16 string (which may contain embedded \0's) */ extern char16_t * strdup8to16 (const char* s, size_t *out_len) { char16_t *ret; size_t len; if (s == NULL) return NULL; len = strlen8to16(s); // fail on overflow if (len && SIZE_MAX/len < sizeof(char16_t)) return NULL; // no plus-one here. UTF-16 strings are not null terminated ret = (char16_t *) malloc (sizeof(char16_t) * len); return strcpy8to16 (ret, s, out_len); } /** * Like "strlen", but for strings encoded with Java's modified UTF-8. * * The value returned is the number of UTF-16 characters required * to represent this string. */ extern size_t strlen8to16 (const char* utf8Str) { size_t len = 0; int ic; int expected = 0; while ((ic = *utf8Str++) != '\0') { /* bytes that start 0? or 11 are lead bytes and count as characters.*/ /* bytes that start 10 are extention bytes and are not counted */ if ((ic & 0xc0) == 0x80) { /* count the 0x80 extention bytes. if we have more than * expected, then start counting them because strcpy8to16 * will insert UTF16_REPLACEMENT_CHAR's */ expected--; if (expected < 0) { len++; } } else { len++; expected = UTF8_SEQ_LENGTH(ic) - 1; /* this will result in a surrogate pair */ if (expected == 3) { len++; } } } return len; } /* * Retrieve the next UTF-32 character from a UTF-8 string. * * Stops at inner \0's * * Returns UTF16_REPLACEMENT_CHAR if an invalid sequence is encountered * * Advances "*pUtf8Ptr" to the start of the next character. */ static inline uint32_t getUtf32FromUtf8(const char** pUtf8Ptr) { uint32_t ret; int seq_len; int i; /* Mask for leader byte for lengths 1, 2, 3, and 4 respectively*/ static const char leaderMask[4] = {0xff, 0x1f, 0x0f, 0x07}; /* Bytes that start with bits "10" are not leading characters. */ if (((**pUtf8Ptr) & 0xc0) == 0x80) { (*pUtf8Ptr)++; return UTF16_REPLACEMENT_CHAR; } /* note we tolerate invalid leader 11111xxx here */ seq_len = UTF8_SEQ_LENGTH(**pUtf8Ptr); ret = (**pUtf8Ptr) & leaderMask [seq_len - 1]; if (**pUtf8Ptr == '\0') return ret; (*pUtf8Ptr)++; for (i = 1; i < seq_len ; i++, (*pUtf8Ptr)++) { if ((**pUtf8Ptr) == '\0') return UTF16_REPLACEMENT_CHAR; if (((**pUtf8Ptr) & 0xc0) != 0x80) return UTF16_REPLACEMENT_CHAR; UTF8_SHIFT_AND_MASK(ret, **pUtf8Ptr); } return ret; } /** * out_len is an out parameter (which may not be null) containing the * length of the UTF-16 string (which may contain embedded \0's) */ extern char16_t * strcpy8to16 (char16_t *utf16Str, const char*utf8Str, size_t *out_len) { char16_t *dest = utf16Str; while (*utf8Str != '\0') { uint32_t ret; ret = getUtf32FromUtf8(&utf8Str); if (ret <= 0xffff) { *dest++ = (char16_t) ret; } else if (ret <= UNICODE_UPPER_LIMIT) { /* Create surrogate pairs */ /* See http://en.wikipedia.org/wiki/UTF-16/UCS-2#Method_for_code_points_in_Plane_1.2C_Plane_2 */ *dest++ = 0xd800 | ((ret - 0x10000) >> 10); *dest++ = 0xdc00 | ((ret - 0x10000) & 0x3ff); } else { *dest++ = UTF16_REPLACEMENT_CHAR; } } *out_len = dest - utf16Str; return utf16Str; } /** * length is the number of characters in the UTF-8 string. * out_len is an out parameter (which may not be null) containing the * length of the UTF-16 string (which may contain embedded \0's) */ extern char16_t * strcpylen8to16 (char16_t *utf16Str, const char*utf8Str, int length, size_t *out_len) { /* TODO: Share more of this code with the method above. Only 2 lines changed. */ char16_t *dest = utf16Str; const char *end = utf8Str + length; /* This line */ while (utf8Str < end) { /* and this line changed. */ uint32_t ret; ret = getUtf32FromUtf8(&utf8Str); if (ret <= 0xffff) { *dest++ = (char16_t) ret; } else if (ret <= UNICODE_UPPER_LIMIT) { /* Create surrogate pairs */ /* See http://en.wikipedia.org/wiki/UTF-16/UCS-2#Method_for_code_points_in_Plane_1.2C_Plane_2 */ *dest++ = 0xd800 | ((ret - 0x10000) >> 10); *dest++ = 0xdc00 | ((ret - 0x10000) & 0x3ff); } else { *dest++ = UTF16_REPLACEMENT_CHAR; } } *out_len = dest - utf16Str; return utf16Str; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/mot_pthread.c0000755000015700001700000004117512200324306025117 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define __likely(cond) __builtin_expect(!!(cond), 1) #define __unlikely(cond) __builtin_expect(!!(cond), 0) #define FUTEX_WAIT 0 #define FUTEX_WAKE 1 //see atomics_x86.S, atomics_arm.S int __futex_wait(volatile void *ftx, int val, const struct timespec *timeout); int __futex_wake(volatile void *ftx, int count); int __futex_syscall3(volatile void *ftx, int op, int val); int __futex_syscall4(volatile void *ftx, int op, int val, const struct timespec *timeout); #ifndef FUTEX_PRIVATE_FLAG #define FUTEX_PRIVATE_FLAG 128 #endif #ifndef FUTEX_WAIT_PRIVATE #define FUTEX_WAIT_PRIVATE (FUTEX_WAIT|FUTEX_PRIVATE_FLAG) #endif #ifndef FUTEX_WAKE_PRIVATE #define FUTEX_WAKE_PRIVATE (FUTEX_WAKE|FUTEX_PRIVATE_FLAG) #endif // mutex lock states // // 0: unlocked // 1: locked, no waiters // 2: locked, maybe waiters /* a mutex is implemented as a 32-bit integer holding the following fields * * bits: name description * 31-16 tid owner thread's kernel id (recursive and errorcheck only) * 15-14 type mutex type * 13-2 counter counter of recursive mutexes * 1-0 state lock state (0, 1 or 2) */ #define MUTEX_OWNER(m) (((m)->value >> 16) & 0xffff) #define MUTEX_COUNTER(m) (((m)->value >> 2) & 0xfff) #define MUTEX_TYPE_MASK 0xc000 #define MUTEX_TYPE_NORMAL 0x0000 #define MUTEX_TYPE_RECURSIVE 0x4000 #define MUTEX_TYPE_ERRORCHECK 0x8000 #define MUTEX_COUNTER_SHIFT 2 #define MUTEX_COUNTER_MASK 0x1ffc #define MUTEX_SHARED_MASK 0x2000 #define __inline__ __inline__ __attribute((always_inline)) /* * Lock a non-recursive mutex. * * As noted above, there are three states: * 0 (unlocked, no contention) * 1 (locked, no contention) * 2 (locked, contention) * * Non-recursive mutexes don't use the thread-id or counter fields, and the * "type" value is zero, so the only bits that will be set are the ones in * the lock state field. */ static __inline__ void _normal_lock(mot_pthread_mutex_t* mutex) { /* We need to preserve the shared flag during operations */ int shared = mutex->value & MUTEX_SHARED_MASK; /* * The common case is an unlocked mutex, so we begin by trying to * change the lock's state from 0 to 1. __atomic_cmpxchg() returns 0 * if it made the swap successfully. If the result is nonzero, this * lock is already held by another thread. */ if (__atomic_cmpxchg(shared|0, shared|1, &mutex->value ) != 0) { /* * We want to go to sleep until the mutex is available, which * requires promoting it to state 2. We need to swap in the new * state value and then wait until somebody wakes us up. * * __atomic_swap() returns the previous value. We swap 2 in and * see if we got zero back; if so, we have acquired the lock. If * not, another thread still holds the lock and we wait again. * * The second argument to the __futex_wait() call is compared * against the current value. If it doesn't match, __futex_wait() * returns immediately (otherwise, it sleeps for a time specified * by the third argument; 0 means sleep forever). This ensures * that the mutex is in state 2 when we go to sleep on it, which * guarantees a wake-up call. */ int wait_op = shared ? FUTEX_WAIT : FUTEX_WAIT_PRIVATE; while (__atomic_swap(shared|2, &mutex->value ) != (shared|0)) __futex_syscall4(&mutex->value, wait_op, shared|2, 0); } } /* * Release a non-recursive mutex. The caller is responsible for determining * that we are in fact the owner of this lock. */ static __inline__ void _normal_unlock(mot_pthread_mutex_t* mutex) { /* We need to preserve the shared flag during operations */ int shared = mutex->value & MUTEX_SHARED_MASK; /* * The mutex state will be 1 or (rarely) 2. We use an atomic decrement * to release the lock. __atomic_dec() returns the previous value; * if it wasn't 1 we have to do some additional work. */ if (__atomic_dec(&mutex->value) != (shared|1)) { int wake_op = shared ? FUTEX_WAKE : FUTEX_WAKE_PRIVATE; /* * Start by releasing the lock. The decrement changed it from * "contended lock" to "uncontended lock", which means we still * hold it, and anybody who tries to sneak in will push it back * to state 2. * * Once we set it to zero the lock is up for grabs. We follow * this with a __futex_wake() to ensure that one of the waiting * threads has a chance to grab it. * * This doesn't cause a race with the swap/wait pair in * _normal_lock(), because the __futex_wait() call there will * return immediately if the mutex value isn't 2. */ mutex->value = shared; /* * Wake up one waiting thread. We don't know which thread will be * woken or when it'll start executing -- futexes make no guarantees * here. There may not even be a thread waiting. * * The newly-woken thread will replace the 0 we just set above * with 2, which means that when it eventually releases the mutex * it will also call FUTEX_WAKE. This results in one extra wake * call whenever a lock is contended, but lets us avoid forgetting * anyone without requiring us to track the number of sleepers. * * It's possible for another thread to sneak in and grab the lock * between the zero assignment above and the wake call below. If * the new thread is "slow" and holds the lock for a while, we'll * wake up a sleeper, which will swap in a 2 and then go back to * sleep since the lock is still held. If the new thread is "fast", * running to completion before we call wake, the thread we * eventually wake will find an unlocked mutex and will execute. * Either way we have correct behavior and nobody is orphaned on * the wait queue. */ __futex_syscall3(&mutex->value, wake_op, 1); } } static mot_pthread_mutex_t __recursive_lock = MOT_PTHREAD_MUTEX_INITIALIZER; static void _recursive_lock(void) { _normal_lock( &__recursive_lock); } static void _recursive_unlock(void) { _normal_unlock( &__recursive_lock ); } int mot_pthread_mutex_lock(mot_pthread_mutex_t *mutex) { int mtype, tid, new_lock_type, shared, wait_op; if (__unlikely(mutex == NULL)) return EINVAL; mtype = (mutex->value & MUTEX_TYPE_MASK); shared = (mutex->value & MUTEX_SHARED_MASK); /* Handle normal case first */ if ( __likely(mtype == MUTEX_TYPE_NORMAL) ) { _normal_lock(mutex); return 0; } /* Do we already own this recursive or error-check mutex ? */ // int tid = __get_thread()->kernel_id; tid = getpid(); if ( tid == MUTEX_OWNER(mutex) ) { int oldv, counter; if (mtype == MUTEX_TYPE_ERRORCHECK) { /* trying to re-lock a mutex we already acquired */ return EDEADLK; } /* * We own the mutex, but other threads are able to change * the contents (e.g. promoting it to "contended"), so we * need to hold the global lock. */ _recursive_lock(); oldv = mutex->value; counter = (oldv + (1 << MUTEX_COUNTER_SHIFT)) & MUTEX_COUNTER_MASK; mutex->value = (oldv & ~MUTEX_COUNTER_MASK) | counter; _recursive_unlock(); return 0; } /* We don't own the mutex, so try to get it. * * First, we try to change its state from 0 to 1, if this * doesn't work, try to change it to state 2. */ new_lock_type = 1; /* compute futex wait opcode and restore shared flag in mtype */ wait_op = shared ? FUTEX_WAIT : FUTEX_WAIT_PRIVATE; mtype |= shared; for (;;) { int oldv; _recursive_lock(); oldv = mutex->value; if (oldv == mtype) { /* uncontended released lock => 1 or 2 */ mutex->value = ((tid << 16) | mtype | new_lock_type); } else if ((oldv & 3) == 1) { /* locked state 1 => state 2 */ oldv ^= 3; mutex->value = oldv; } _recursive_unlock(); if (oldv == mtype) break; /* * The lock was held, possibly contended by others. From * now on, if we manage to acquire the lock, we have to * assume that others are still contending for it so that * we'll wake them when we unlock it. */ new_lock_type = 2; __futex_syscall4(&mutex->value, wait_op, oldv, NULL); } return 0; } int mot_pthread_mutex_unlock(mot_pthread_mutex_t *mutex) { int mtype, tid, oldv, shared; if (__unlikely(mutex == NULL)) return EINVAL; mtype = (mutex->value & MUTEX_TYPE_MASK); shared = (mutex->value & MUTEX_SHARED_MASK); /* Handle common case first */ if (__likely(mtype == MUTEX_TYPE_NORMAL)) { _normal_unlock(mutex); return 0; } /* Do we already own this recursive or error-check mutex ? */ // int tid = __get_thread()->kernel_id; tid = getpid(); if ( tid != MUTEX_OWNER(mutex) ) return EPERM; /* We do, decrement counter or release the mutex if it is 0 */ _recursive_lock(); oldv = mutex->value; if (oldv & MUTEX_COUNTER_MASK) { mutex->value = oldv - (1 << MUTEX_COUNTER_SHIFT); oldv = 0; } else { mutex->value = shared | mtype; } _recursive_unlock(); /* Wake one waiting thread, if any */ if ((oldv & 3) == 2) { int wake_op = shared ? FUTEX_WAKE : FUTEX_WAKE_PRIVATE; __futex_syscall3(&mutex->value, wake_op, 1); } return 0; } int mot_pthread_mutex_trylock(mot_pthread_mutex_t *mutex) { int mtype, tid, oldv, shared; if (__unlikely(mutex == NULL)) return EINVAL; mtype = (mutex->value & MUTEX_TYPE_MASK); shared = (mutex->value & MUTEX_SHARED_MASK); /* Handle common case first */ if ( __likely(mtype == MUTEX_TYPE_NORMAL) ) { if (__atomic_cmpxchg(shared|0, shared|1, &mutex->value) == 0) return 0; return EBUSY; } /* Do we already own this recursive or error-check mutex ? */ // int tid = __get_thread()->kernel_id; tid = getpid(); if ( tid == MUTEX_OWNER(mutex) ) { int counter; if (mtype == MUTEX_TYPE_ERRORCHECK) { /* already locked by ourselves */ return EDEADLK; } _recursive_lock(); oldv = mutex->value; counter = (oldv + (1 << MUTEX_COUNTER_SHIFT)) & MUTEX_COUNTER_MASK; mutex->value = (oldv & ~MUTEX_COUNTER_MASK) | counter; _recursive_unlock(); return 0; } /* Restore sharing bit in mtype */ mtype |= shared; /* Try to lock it, just once. */ _recursive_lock(); oldv = mutex->value; if (oldv == mtype) /* uncontended released lock => state 1 */ mutex->value = ((tid << 16) | mtype | 1); _recursive_unlock(); if (oldv != mtype) return EBUSY; return 0; } /* initialize 'ts' with the difference between 'abstime' and the current time * according to 'clock'. Returns -1 if abstime already expired, or 0 otherwise. */ static int __timespec_to_absolute(struct timespec* ts, const struct timespec* abstime, clockid_t clock) { clock_gettime(clock, ts); ts->tv_sec = abstime->tv_sec - ts->tv_sec; ts->tv_nsec = abstime->tv_nsec - ts->tv_nsec; if (ts->tv_nsec < 0) { ts->tv_sec--; ts->tv_nsec += 1000000000; } if ((ts->tv_nsec < 0) || (ts->tv_sec < 0)) return -1; return 0; } /* We use one bit in condition variable values as the 'shared' flag * The rest is a counter. */ #define COND_SHARED_MASK 0x0001 #define COND_COUNTER_INCREMENT 0x0002 #define COND_COUNTER_MASK (~COND_SHARED_MASK) #define COND_IS_SHARED(c) (((c)->value & COND_SHARED_MASK) != 0) /* XXX *technically* there is a race condition that could allow * XXX a signal to be missed. If thread A is preempted in _wait() * XXX after unlocking the mutex and before waiting, and if other * XXX threads call signal or broadcast UINT_MAX/2 times (exactly), * XXX before thread A is scheduled again and calls futex_wait(), * XXX then the signal will be lost. */ /* This function is used by pthread_cond_broadcast and * pthread_cond_signal to atomically decrement the counter * then wake-up 'counter' threads. */ static int mot_pthread_cond_pulse(mot_pthread_cond_t *cond, int counter) { long flags; int wake_op; if (__unlikely(cond == NULL)) return EINVAL; flags = (cond->value & ~COND_COUNTER_MASK); for (;;) { long oldval = cond->value; long newval = ((oldval - COND_COUNTER_INCREMENT) & COND_COUNTER_MASK) | flags; if (__atomic_cmpxchg(oldval, newval, &cond->value) == 0) break; } wake_op = COND_IS_SHARED(cond) ? FUTEX_WAKE : FUTEX_WAKE_PRIVATE; __futex_syscall3(&cond->value, wake_op, counter); return 0; } int mot_pthread_cond_broadcast(mot_pthread_cond_t *cond) { return mot_pthread_cond_pulse(cond, INT_MAX); } int mot_pthread_cond_signal(mot_pthread_cond_t *cond) { return mot_pthread_cond_pulse(cond, 1); } int mot_pthread_cond_wait(mot_pthread_cond_t *cond, mot_pthread_mutex_t *mutex) { return mot_pthread_cond_timedwait(cond, mutex, NULL); } int __mot_pthread_cond_timedwait_relative(mot_pthread_cond_t *cond, mot_pthread_mutex_t * mutex, const struct timespec *reltime) { int status; int oldvalue = cond->value; int wait_op = COND_IS_SHARED(cond) ? FUTEX_WAIT : FUTEX_WAIT_PRIVATE; mot_pthread_mutex_unlock(mutex); status = __futex_syscall4(&cond->value, wait_op, oldvalue, reltime); mot_pthread_mutex_lock(mutex); if (status == (-ETIMEDOUT)) return ETIMEDOUT; return 0; } int __mot_pthread_cond_timedwait(mot_pthread_cond_t *cond, mot_pthread_mutex_t * mutex, const struct timespec *abstime, clockid_t clock) { struct timespec ts; struct timespec * tsp; if (abstime != NULL) { if (__timespec_to_absolute(&ts, abstime, clock) < 0) return ETIMEDOUT; tsp = &ts; } else { tsp = NULL; } return __mot_pthread_cond_timedwait_relative(cond, mutex, tsp); } int mot_pthread_cond_timedwait(mot_pthread_cond_t *cond, mot_pthread_mutex_t * mutex, const struct timespec *abstime) { return __mot_pthread_cond_timedwait(cond, mutex, abstime, CLOCK_REALTIME); } int mot_pthread_cond_timedwait_relative_np(mot_pthread_cond_t *cond, mot_pthread_mutex_t * mutex, const struct timespec *reltime) { return __mot_pthread_cond_timedwait_relative(cond, mutex, reltime); } android-audiosystem-1.8+13.10.20130807/lib/libcutils/atomic-android-arm.S0000644000015700001700000001673212200324306026236 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include /* * NOTE: these atomic operations are SMP safe on all architectures, * except swap(), see below. */ .text .align .global android_atomic_write .global android_atomic_inc .global android_atomic_dec .global android_atomic_add .global android_atomic_and .global android_atomic_or .global android_atomic_swap .global android_atomic_cmpxchg /* * ---------------------------------------------------------------------------- * int __kernel_cmpxchg(int oldval, int newval, int *ptr) * clobbered: r3, ip, flags * return 0 if a swap was made, non-zero otherwise. */ .equ kernel_cmpxchg, 0xFFFF0FC0 .equ kernel_atomic_base, 0xFFFF0FFF /* * ---------------------------------------------------------------------------- * android_atomic_write * input: r0=value, r1=address * output: void */ android_atomic_write: str r0, [r1] bx lr; /* * ---------------------------------------------------------------------------- * android_atomic_inc * input: r0 = address * output: r0 = old value */ android_atomic_inc: .fnstart .save {r4, lr} stmdb sp!, {r4, lr} mov r2, r0 1: @ android_atomic_inc ldr r0, [r2] mov r3, #kernel_atomic_base #ifdef __ARM_HAVE_PC_INTERWORK add lr, pc, #4 add r1, r0, #1 add pc, r3, #(kernel_cmpxchg - kernel_atomic_base) #else add r1, r0, #1 add r3, r3, #(kernel_cmpxchg - kernel_atomic_base) mov lr, pc bx r3 #endif bcc 1b sub r0, r1, #1 ldmia sp!, {r4, lr} bx lr .fnend /* * ---------------------------------------------------------------------------- * android_atomic_dec * input: r0=address * output: r0 = old value */ android_atomic_dec: .fnstart .save {r4, lr} stmdb sp!, {r4, lr} mov r2, r0 1: @ android_atomic_dec ldr r0, [r2] mov r3, #kernel_atomic_base #ifdef __ARM_HAVE_PC_INTERWORK add lr, pc, #4 sub r1, r0, #1 add pc, r3, #(kernel_cmpxchg - kernel_atomic_base) #else sub r1, r0, #1 add r3, r3, #(kernel_cmpxchg - kernel_atomic_base) mov lr, pc bx r3 #endif bcc 1b add r0, r1, #1 ldmia sp!, {r4, lr} bx lr .fnend /* * ---------------------------------------------------------------------------- * android_atomic_add * input: r0=value, r1=address * output: r0 = old value */ android_atomic_add: .fnstart .save {r4, lr} stmdb sp!, {r4, lr} mov r2, r1 mov r4, r0 1: @ android_atomic_add ldr r0, [r2] mov r3, #kernel_atomic_base #ifdef __ARM_HAVE_PC_INTERWORK add lr, pc, #4 add r1, r0, r4 add pc, r3, #(kernel_cmpxchg - kernel_atomic_base) #else add r1, r0, r4 add r3, r3, #(kernel_cmpxchg - kernel_atomic_base) mov lr, pc bx r3 #endif bcc 1b sub r0, r1, r4 ldmia sp!, {r4, lr} bx lr .fnend /* * ---------------------------------------------------------------------------- * android_atomic_and * input: r0=value, r1=address * output: r0 = old value */ android_atomic_and: .fnstart .save {r4, r5, lr} stmdb sp!, {r4, r5, lr} mov r2, r1 /* r2 = address */ mov r4, r0 /* r4 = the value */ 1: @ android_atomic_and ldr r0, [r2] /* r0 = address[0] */ mov r3, #kernel_atomic_base #ifdef __ARM_HAVE_PC_INTERWORK add lr, pc, #8 mov r5, r0 /* r5 = save address[0] */ and r1, r0, r4 /* r1 = new value */ add pc, r3, #(kernel_cmpxchg - kernel_atomic_base) /* call cmpxchg() */ #else mov r5, r0 /* r5 = save address[0] */ and r1, r0, r4 /* r1 = new value */ add r3, r3, #(kernel_cmpxchg - kernel_atomic_base) /* call cmpxchg() */ mov lr, pc bx r3 #endif bcc 1b mov r0, r5 ldmia sp!, {r4, r5, lr} bx lr .fnend /* * ---------------------------------------------------------------------------- * android_atomic_or * input: r0=value, r1=address * output: r0 = old value */ android_atomic_or: .fnstart .save {r4, r5, lr} stmdb sp!, {r4, r5, lr} mov r2, r1 /* r2 = address */ mov r4, r0 /* r4 = the value */ 1: @ android_atomic_or ldr r0, [r2] /* r0 = address[0] */ mov r3, #kernel_atomic_base #ifdef __ARM_HAVE_PC_INTERWORK add lr, pc, #8 mov r5, r0 /* r5 = save address[0] */ orr r1, r0, r4 /* r1 = new value */ add pc, r3, #(kernel_cmpxchg - kernel_atomic_base) /* call cmpxchg() */ #else mov r5, r0 /* r5 = save address[0] */ orr r1, r0, r4 /* r1 = new value */ add r3, r3, #(kernel_cmpxchg - kernel_atomic_base) /* call cmpxchg() */ mov lr, pc bx r3 #endif bcc 1b mov r0, r5 ldmia sp!, {r4, r5, lr} bx lr .fnend /* * ---------------------------------------------------------------------------- * android_atomic_swap * input: r0=value, r1=address * output: r0 = old value */ /* FIXME: this is not safe on SMP systems * a general way to do it is to use kernel_cmpxchg */ android_atomic_swap: #if defined (__ARM_HAVE_LDREX_STREX) 1: ldrex r2, [r1] strex r3, r0, [r1] teq r3, #0 bne 1b mov r0, r2 #if defined (__ARM_HAVE_DMB) dmb #else mcr p15, 0, r0, c7, c10, 5 #endif #else swp r0, r0, [r1] #endif bx lr /* * ---------------------------------------------------------------------------- * android_atomic_cmpxchg * input: r0=oldvalue, r1=newvalue, r2=address * output: r0 = 0 (xchg done) or non-zero (xchg not done) */ android_atomic_cmpxchg: .fnstart .save {r4, lr} stmdb sp!, {r4, lr} mov r4, r0 /* r4 = save oldvalue */ 1: @ android_atomic_cmpxchg mov r3, #kernel_atomic_base #ifdef __ARM_HAVE_PC_INTERWORK add lr, pc, #4 mov r0, r4 /* r0 = oldvalue */ add pc, r3, #(kernel_cmpxchg - kernel_atomic_base) #else mov r0, r4 /* r0 = oldvalue */ add r3, r3, #(kernel_cmpxchg - kernel_atomic_base) mov lr, pc bx r3 #endif bcs 2f /* swap was made. we're good, return. */ ldr r3, [r2] /* swap not made, see if it's because *ptr!=oldvalue */ cmp r3, r4 beq 1b 2: @ android_atomic_cmpxchg ldmia sp!, {r4, lr} bx lr .fnend /* * ---------------------------------------------------------------------------- * android_atomic_cmpxchg_64 * input: r0-r1=oldvalue, r2-r3=newvalue, arg4 (on stack)=address * output: r0 = 0 (xchg done) or non-zero (xchg not done) */ /* TODO: NEED IMPLEMENTATION FOR THIS ARCHITECTURE */ android-audiosystem-1.8+13.10.20130807/lib/libcutils/native_handle.c0000644000015700001700000000275712200324306025412 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "NativeHandle" #include #include #include #include #include #include #include native_handle_t* native_handle_create(int numFds, int numInts) { native_handle_t* h = malloc( sizeof(native_handle_t) + sizeof(int)*(numFds+numInts)); h->version = sizeof(native_handle_t); h->numFds = numFds; h->numInts = numInts; return h; } int native_handle_delete(native_handle_t* h) { if (h) { if (h->version != sizeof(native_handle_t)) return -EINVAL; free(h); } return 0; } int native_handle_close(const native_handle_t* h) { if (h->version != sizeof(native_handle_t)) return -EINVAL; const int numFds = h->numFds; int i; for (i=0 ; idata[i]); } return 0; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/ashmem-dev.c0000644000015700001700000000414512200324306024630 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Implementation of the user-space ashmem API for devices, which have our * ashmem-enabled kernel. See ashmem-sim.c for the "fake" tmp-based version, * used by the simulator. */ #include #include #include #include #include #include #include #include #define ASHMEM_DEVICE "/dev/ashmem" /* * ashmem_create_region - creates a new ashmem region and returns the file * descriptor, or <0 on error * * `name' is an optional label to give the region (visible in /proc/pid/maps) * `size' is the size of the region, in page-aligned bytes */ int ashmem_create_region(const char *name, size_t size) { int fd, ret; fd = open(ASHMEM_DEVICE, O_RDWR); if (fd < 0) return fd; if (name) { char buf[ASHMEM_NAME_LEN]; strlcpy(buf, name, sizeof(buf)); ret = ioctl(fd, ASHMEM_SET_NAME, buf); if (ret < 0) goto error; } ret = ioctl(fd, ASHMEM_SET_SIZE, size); if (ret < 0) goto error; return fd; error: close(fd); return ret; } int ashmem_set_prot_region(int fd, int prot) { return ioctl(fd, ASHMEM_SET_PROT_MASK, prot); } int ashmem_pin_region(int fd, size_t offset, size_t len) { struct ashmem_pin pin = { offset, len }; return ioctl(fd, ASHMEM_PIN, &pin); } int ashmem_unpin_region(int fd, size_t offset, size_t len) { struct ashmem_pin pin = { offset, len }; return ioctl(fd, ASHMEM_UNPIN, &pin); } int ashmem_get_size_region(int fd) { return ioctl(fd, ASHMEM_GET_SIZE, NULL); } android-audiosystem-1.8+13.10.20130807/lib/libcutils/arch-x86/0000755000015700001700000000000012200324404023771 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/lib/libcutils/arch-x86/sse2-memset32-atom.S0000644000015700001700000003060412200324306027370 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Contributed by: Intel Corporation */ #ifndef L # define L(label) .L##label #endif #ifndef ALIGN # define ALIGN(n) .p2align n #endif #ifndef cfi_startproc # define cfi_startproc .cfi_startproc #endif #ifndef cfi_endproc # define cfi_endproc .cfi_endproc #endif #ifndef cfi_rel_offset # define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off #endif #ifndef cfi_restore # define cfi_restore(reg) .cfi_restore reg #endif #ifndef cfi_adjust_cfa_offset # define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off #endif #ifndef ENTRY # define ENTRY(name) \ .type name, @function; \ .globl name; \ .p2align 4; \ name: \ cfi_startproc #endif #ifndef END # define END(name) \ cfi_endproc; \ .size name, .-name #endif #define CFI_PUSH(REG) \ cfi_adjust_cfa_offset (4); \ cfi_rel_offset (REG, 0) #define CFI_POP(REG) \ cfi_adjust_cfa_offset (-4); \ cfi_restore (REG) #define PUSH(REG) pushl REG; CFI_PUSH (REG) #define POP(REG) popl REG; CFI_POP (REG) #ifdef USE_AS_BZERO32 # define DEST PARMS # define LEN DEST+4 #else # define DEST PARMS # define DWDS DEST+4 # define LEN DWDS+4 #endif #ifdef USE_AS_WMEMSET32 # define SETRTNVAL movl DEST(%esp), %eax #else # define SETRTNVAL #endif #ifdef SHARED # define ENTRANCE PUSH (%ebx); # define RETURN_END POP (%ebx); ret # define RETURN RETURN_END; CFI_PUSH (%ebx) # define PARMS 8 /* Preserve EBX. */ # define JMPTBL(I, B) I - B /* Load an entry in a jump table into EBX and branch to it. TABLE is a jump table with relative offsets. */ # define BRANCH_TO_JMPTBL_ENTRY(TABLE) \ /* We first load PC into EBX. */ \ call __i686.get_pc_thunk.bx; \ /* Get the address of the jump table. */ \ add $(TABLE - .), %ebx; \ /* Get the entry and convert the relative offset to the \ absolute address. */ \ add (%ebx,%ecx,4), %ebx; \ /* We loaded the jump table and adjuested EDX. Go. */ \ jmp *%ebx .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits .globl __i686.get_pc_thunk.bx .hidden __i686.get_pc_thunk.bx ALIGN (4) .type __i686.get_pc_thunk.bx,@function __i686.get_pc_thunk.bx: movl (%esp), %ebx ret #else # define ENTRANCE # define RETURN_END ret # define RETURN RETURN_END # define PARMS 4 # define JMPTBL(I, B) I /* Branch to an entry in a jump table. TABLE is a jump table with absolute offsets. */ # define BRANCH_TO_JMPTBL_ENTRY(TABLE) \ jmp *TABLE(,%ecx,4) #endif .section .text.sse2,"ax",@progbits ALIGN (4) ENTRY (sse2_memset32_atom) ENTRANCE movl LEN(%esp), %ecx #ifdef USE_AS_ANDROID shr $2, %ecx #endif #ifdef USE_AS_BZERO32 xor %eax, %eax #else mov DWDS(%esp), %eax mov %eax, %edx #endif movl DEST(%esp), %edx cmp $16, %ecx jae L(16dbwordsormore) L(write_less16dbwords): lea (%edx, %ecx, 4), %edx BRANCH_TO_JMPTBL_ENTRY (L(table_less16dbwords)) .pushsection .rodata.sse2,"a",@progbits ALIGN (2) L(table_less16dbwords): .int JMPTBL (L(write_0dbwords), L(table_less16dbwords)) .int JMPTBL (L(write_1dbwords), L(table_less16dbwords)) .int JMPTBL (L(write_2dbwords), L(table_less16dbwords)) .int JMPTBL (L(write_3dbwords), L(table_less16dbwords)) .int JMPTBL (L(write_4dbwords), L(table_less16dbwords)) .int JMPTBL (L(write_5dbwords), L(table_less16dbwords)) .int JMPTBL (L(write_6dbwords), L(table_less16dbwords)) .int JMPTBL (L(write_7dbwords), L(table_less16dbwords)) .int JMPTBL (L(write_8dbwords), L(table_less16dbwords)) .int JMPTBL (L(write_9dbwords), L(table_less16dbwords)) .int JMPTBL (L(write_10dbwords), L(table_less16dbwords)) .int JMPTBL (L(write_11dbwords), L(table_less16dbwords)) .int JMPTBL (L(write_12dbwords), L(table_less16dbwords)) .int JMPTBL (L(write_13dbwords), L(table_less16dbwords)) .int JMPTBL (L(write_14dbwords), L(table_less16dbwords)) .int JMPTBL (L(write_15dbwords), L(table_less16dbwords)) .popsection ALIGN (4) L(write_15dbwords): movl %eax, -60(%edx) L(write_14dbwords): movl %eax, -56(%edx) L(write_13dbwords): movl %eax, -52(%edx) L(write_12dbwords): movl %eax, -48(%edx) L(write_11dbwords): movl %eax, -44(%edx) L(write_10dbwords): movl %eax, -40(%edx) L(write_9dbwords): movl %eax, -36(%edx) L(write_8dbwords): movl %eax, -32(%edx) L(write_7dbwords): movl %eax, -28(%edx) L(write_6dbwords): movl %eax, -24(%edx) L(write_5dbwords): movl %eax, -20(%edx) L(write_4dbwords): movl %eax, -16(%edx) L(write_3dbwords): movl %eax, -12(%edx) L(write_2dbwords): movl %eax, -8(%edx) L(write_1dbwords): movl %eax, -4(%edx) L(write_0dbwords): SETRTNVAL RETURN ALIGN (4) L(16dbwordsormore): test $3, %edx jz L(aligned4bytes) mov %eax, (%edx) mov %eax, -4(%edx, %ecx, 4) sub $1, %ecx rol $24, %eax add $1, %edx test $3, %edx jz L(aligned4bytes) ror $8, %eax add $1, %edx test $3, %edx jz L(aligned4bytes) ror $8, %eax add $1, %edx L(aligned4bytes): shl $2, %ecx #ifdef USE_AS_BZERO32 pxor %xmm0, %xmm0 #else movd %eax, %xmm0 pshufd $0, %xmm0, %xmm0 #endif testl $0xf, %edx jz L(aligned_16) /* ECX > 32 and EDX is not 16 byte aligned. */ L(not_aligned_16): movdqu %xmm0, (%edx) movl %edx, %eax and $-16, %edx add $16, %edx sub %edx, %eax add %eax, %ecx movd %xmm0, %eax ALIGN (4) L(aligned_16): cmp $128, %ecx jae L(128bytesormore) L(aligned_16_less128bytes): add %ecx, %edx shr $2, %ecx BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes)) ALIGN (4) L(128bytesormore): #ifdef SHARED_CACHE_SIZE PUSH (%ebx) mov $SHARED_CACHE_SIZE, %ebx #else # ifdef SHARED call __i686.get_pc_thunk.bx add $_GLOBAL_OFFSET_TABLE_, %ebx mov __x86_shared_cache_size@GOTOFF(%ebx), %ebx # else PUSH (%ebx) mov __x86_shared_cache_size, %ebx # endif #endif cmp %ebx, %ecx jae L(128bytesormore_nt_start) #ifdef DATA_CACHE_SIZE POP (%ebx) # define RESTORE_EBX_STATE CFI_PUSH (%ebx) cmp $DATA_CACHE_SIZE, %ecx #else # ifdef SHARED # define RESTORE_EBX_STATE call __i686.get_pc_thunk.bx add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_data_cache_size@GOTOFF(%ebx), %ecx # else POP (%ebx) # define RESTORE_EBX_STATE CFI_PUSH (%ebx) cmp __x86_data_cache_size, %ecx # endif #endif jae L(128bytes_L2_normal) subl $128, %ecx L(128bytesormore_normal): sub $128, %ecx movdqa %xmm0, (%edx) movdqa %xmm0, 0x10(%edx) movdqa %xmm0, 0x20(%edx) movdqa %xmm0, 0x30(%edx) movdqa %xmm0, 0x40(%edx) movdqa %xmm0, 0x50(%edx) movdqa %xmm0, 0x60(%edx) movdqa %xmm0, 0x70(%edx) lea 128(%edx), %edx jb L(128bytesless_normal) sub $128, %ecx movdqa %xmm0, (%edx) movdqa %xmm0, 0x10(%edx) movdqa %xmm0, 0x20(%edx) movdqa %xmm0, 0x30(%edx) movdqa %xmm0, 0x40(%edx) movdqa %xmm0, 0x50(%edx) movdqa %xmm0, 0x60(%edx) movdqa %xmm0, 0x70(%edx) lea 128(%edx), %edx jae L(128bytesormore_normal) L(128bytesless_normal): lea 128(%ecx), %ecx add %ecx, %edx shr $2, %ecx BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes)) ALIGN (4) L(128bytes_L2_normal): prefetcht0 0x380(%edx) prefetcht0 0x3c0(%edx) sub $128, %ecx movdqa %xmm0, (%edx) movaps %xmm0, 0x10(%edx) movaps %xmm0, 0x20(%edx) movaps %xmm0, 0x30(%edx) movaps %xmm0, 0x40(%edx) movaps %xmm0, 0x50(%edx) movaps %xmm0, 0x60(%edx) movaps %xmm0, 0x70(%edx) add $128, %edx cmp $128, %ecx jae L(128bytes_L2_normal) L(128bytesless_L2_normal): add %ecx, %edx shr $2, %ecx BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes)) RESTORE_EBX_STATE L(128bytesormore_nt_start): sub %ebx, %ecx mov %ebx, %eax and $0x7f, %eax add %eax, %ecx movd %xmm0, %eax ALIGN (4) L(128bytesormore_shared_cache_loop): prefetcht0 0x3c0(%edx) prefetcht0 0x380(%edx) sub $0x80, %ebx movdqa %xmm0, (%edx) movdqa %xmm0, 0x10(%edx) movdqa %xmm0, 0x20(%edx) movdqa %xmm0, 0x30(%edx) movdqa %xmm0, 0x40(%edx) movdqa %xmm0, 0x50(%edx) movdqa %xmm0, 0x60(%edx) movdqa %xmm0, 0x70(%edx) add $0x80, %edx cmp $0x80, %ebx jae L(128bytesormore_shared_cache_loop) cmp $0x80, %ecx jb L(shared_cache_loop_end) ALIGN (4) L(128bytesormore_nt): sub $0x80, %ecx movntdq %xmm0, (%edx) movntdq %xmm0, 0x10(%edx) movntdq %xmm0, 0x20(%edx) movntdq %xmm0, 0x30(%edx) movntdq %xmm0, 0x40(%edx) movntdq %xmm0, 0x50(%edx) movntdq %xmm0, 0x60(%edx) movntdq %xmm0, 0x70(%edx) add $0x80, %edx cmp $0x80, %ecx jae L(128bytesormore_nt) sfence L(shared_cache_loop_end): #if defined DATA_CACHE_SIZE || !defined SHARED POP (%ebx) #endif add %ecx, %edx shr $2, %ecx BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes)) .pushsection .rodata.sse2,"a",@progbits ALIGN (2) L(table_16_128bytes): .int JMPTBL (L(aligned_16_0bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_4bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_8bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_12bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_16bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_20bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_24bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_28bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_32bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_36bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_40bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_44bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_48bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_52bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_56bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_60bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_64bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_68bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_72bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_76bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_80bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_84bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_88bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_92bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_96bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_100bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_104bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_108bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_112bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_116bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_120bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_124bytes), L(table_16_128bytes)) .popsection ALIGN (4) L(aligned_16_112bytes): movdqa %xmm0, -112(%edx) L(aligned_16_96bytes): movdqa %xmm0, -96(%edx) L(aligned_16_80bytes): movdqa %xmm0, -80(%edx) L(aligned_16_64bytes): movdqa %xmm0, -64(%edx) L(aligned_16_48bytes): movdqa %xmm0, -48(%edx) L(aligned_16_32bytes): movdqa %xmm0, -32(%edx) L(aligned_16_16bytes): movdqa %xmm0, -16(%edx) L(aligned_16_0bytes): SETRTNVAL RETURN ALIGN (4) L(aligned_16_116bytes): movdqa %xmm0, -116(%edx) L(aligned_16_100bytes): movdqa %xmm0, -100(%edx) L(aligned_16_84bytes): movdqa %xmm0, -84(%edx) L(aligned_16_68bytes): movdqa %xmm0, -68(%edx) L(aligned_16_52bytes): movdqa %xmm0, -52(%edx) L(aligned_16_36bytes): movdqa %xmm0, -36(%edx) L(aligned_16_20bytes): movdqa %xmm0, -20(%edx) L(aligned_16_4bytes): movl %eax, -4(%edx) SETRTNVAL RETURN ALIGN (4) L(aligned_16_120bytes): movdqa %xmm0, -120(%edx) L(aligned_16_104bytes): movdqa %xmm0, -104(%edx) L(aligned_16_88bytes): movdqa %xmm0, -88(%edx) L(aligned_16_72bytes): movdqa %xmm0, -72(%edx) L(aligned_16_56bytes): movdqa %xmm0, -56(%edx) L(aligned_16_40bytes): movdqa %xmm0, -40(%edx) L(aligned_16_24bytes): movdqa %xmm0, -24(%edx) L(aligned_16_8bytes): movq %xmm0, -8(%edx) SETRTNVAL RETURN ALIGN (4) L(aligned_16_124bytes): movdqa %xmm0, -124(%edx) L(aligned_16_108bytes): movdqa %xmm0, -108(%edx) L(aligned_16_92bytes): movdqa %xmm0, -92(%edx) L(aligned_16_76bytes): movdqa %xmm0, -76(%edx) L(aligned_16_60bytes): movdqa %xmm0, -60(%edx) L(aligned_16_44bytes): movdqa %xmm0, -44(%edx) L(aligned_16_28bytes): movdqa %xmm0, -28(%edx) L(aligned_16_12bytes): movq %xmm0, -12(%edx) movl %eax, -4(%edx) SETRTNVAL RETURN END (sse2_memset32_atom) android-audiosystem-1.8+13.10.20130807/lib/libcutils/arch-x86/sse2-memset16-atom.S0000644000015700001700000004361612200324306027401 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Contributed by: Intel Corporation */ #ifndef L # define L(label) .L##label #endif #ifndef ALIGN # define ALIGN(n) .p2align n #endif #ifndef cfi_startproc # define cfi_startproc .cfi_startproc #endif #ifndef cfi_endproc # define cfi_endproc .cfi_endproc #endif #ifndef cfi_rel_offset # define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off #endif #ifndef cfi_restore # define cfi_restore(reg) .cfi_restore reg #endif #ifndef cfi_adjust_cfa_offset # define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off #endif #ifndef ENTRY # define ENTRY(name) \ .type name, @function; \ .globl name; \ .p2align 4; \ name: \ cfi_startproc #endif #ifndef END # define END(name) \ cfi_endproc; \ .size name, .-name #endif #define CFI_PUSH(REG) \ cfi_adjust_cfa_offset (4); \ cfi_rel_offset (REG, 0) #define CFI_POP(REG) \ cfi_adjust_cfa_offset (-4); \ cfi_restore (REG) #define PUSH(REG) pushl REG; CFI_PUSH (REG) #define POP(REG) popl REG; CFI_POP (REG) #ifdef USE_AS_BZERO16 # define DEST PARMS # define LEN DEST+4 #else # define DEST PARMS # define CHR DEST+4 # define LEN CHR+4 #endif #if 1 # define SETRTNVAL #else # define SETRTNVAL movl DEST(%esp), %eax #endif #ifdef SHARED # define ENTRANCE PUSH (%ebx); # define RETURN_END POP (%ebx); ret # define RETURN RETURN_END; CFI_PUSH (%ebx) # define PARMS 8 /* Preserve EBX. */ # define JMPTBL(I, B) I - B /* Load an entry in a jump table into EBX and branch to it. TABLE is a jump table with relative offsets. */ # define BRANCH_TO_JMPTBL_ENTRY(TABLE) \ /* We first load PC into EBX. */ \ call __i686.get_pc_thunk.bx; \ /* Get the address of the jump table. */ \ add $(TABLE - .), %ebx; \ /* Get the entry and convert the relative offset to the \ absolute address. */ \ add (%ebx,%ecx,4), %ebx; \ /* We loaded the jump table and adjuested EDX. Go. */ \ jmp *%ebx .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits .globl __i686.get_pc_thunk.bx .hidden __i686.get_pc_thunk.bx ALIGN (4) .type __i686.get_pc_thunk.bx,@function __i686.get_pc_thunk.bx: movl (%esp), %ebx ret #else # define ENTRANCE # define RETURN_END ret # define RETURN RETURN_END # define PARMS 4 # define JMPTBL(I, B) I /* Branch to an entry in a jump table. TABLE is a jump table with absolute offsets. */ # define BRANCH_TO_JMPTBL_ENTRY(TABLE) \ jmp *TABLE(,%ecx,4) #endif .section .text.sse2,"ax",@progbits ALIGN (4) ENTRY (sse2_memset16_atom) ENTRANCE movl LEN(%esp), %ecx #ifdef USE_AS_ANDROID shr $1, %ecx #endif #ifdef USE_AS_BZERO16 xor %eax, %eax #else movzwl CHR(%esp), %eax mov %eax, %edx shl $16, %eax or %edx, %eax #endif movl DEST(%esp), %edx cmp $32, %ecx jae L(32wordsormore) L(write_less32words): lea (%edx, %ecx, 2), %edx BRANCH_TO_JMPTBL_ENTRY (L(table_less32words)) .pushsection .rodata.sse2,"a",@progbits ALIGN (2) L(table_less32words): .int JMPTBL (L(write_0words), L(table_less32words)) .int JMPTBL (L(write_1words), L(table_less32words)) .int JMPTBL (L(write_2words), L(table_less32words)) .int JMPTBL (L(write_3words), L(table_less32words)) .int JMPTBL (L(write_4words), L(table_less32words)) .int JMPTBL (L(write_5words), L(table_less32words)) .int JMPTBL (L(write_6words), L(table_less32words)) .int JMPTBL (L(write_7words), L(table_less32words)) .int JMPTBL (L(write_8words), L(table_less32words)) .int JMPTBL (L(write_9words), L(table_less32words)) .int JMPTBL (L(write_10words), L(table_less32words)) .int JMPTBL (L(write_11words), L(table_less32words)) .int JMPTBL (L(write_12words), L(table_less32words)) .int JMPTBL (L(write_13words), L(table_less32words)) .int JMPTBL (L(write_14words), L(table_less32words)) .int JMPTBL (L(write_15words), L(table_less32words)) .int JMPTBL (L(write_16words), L(table_less32words)) .int JMPTBL (L(write_17words), L(table_less32words)) .int JMPTBL (L(write_18words), L(table_less32words)) .int JMPTBL (L(write_19words), L(table_less32words)) .int JMPTBL (L(write_20words), L(table_less32words)) .int JMPTBL (L(write_21words), L(table_less32words)) .int JMPTBL (L(write_22words), L(table_less32words)) .int JMPTBL (L(write_23words), L(table_less32words)) .int JMPTBL (L(write_24words), L(table_less32words)) .int JMPTBL (L(write_25words), L(table_less32words)) .int JMPTBL (L(write_26words), L(table_less32words)) .int JMPTBL (L(write_27words), L(table_less32words)) .int JMPTBL (L(write_28words), L(table_less32words)) .int JMPTBL (L(write_29words), L(table_less32words)) .int JMPTBL (L(write_30words), L(table_less32words)) .int JMPTBL (L(write_31words), L(table_less32words)) .popsection ALIGN (4) L(write_28words): movl %eax, -56(%edx) movl %eax, -52(%edx) L(write_24words): movl %eax, -48(%edx) movl %eax, -44(%edx) L(write_20words): movl %eax, -40(%edx) movl %eax, -36(%edx) L(write_16words): movl %eax, -32(%edx) movl %eax, -28(%edx) L(write_12words): movl %eax, -24(%edx) movl %eax, -20(%edx) L(write_8words): movl %eax, -16(%edx) movl %eax, -12(%edx) L(write_4words): movl %eax, -8(%edx) movl %eax, -4(%edx) L(write_0words): SETRTNVAL RETURN ALIGN (4) L(write_29words): movl %eax, -58(%edx) movl %eax, -54(%edx) L(write_25words): movl %eax, -50(%edx) movl %eax, -46(%edx) L(write_21words): movl %eax, -42(%edx) movl %eax, -38(%edx) L(write_17words): movl %eax, -34(%edx) movl %eax, -30(%edx) L(write_13words): movl %eax, -26(%edx) movl %eax, -22(%edx) L(write_9words): movl %eax, -18(%edx) movl %eax, -14(%edx) L(write_5words): movl %eax, -10(%edx) movl %eax, -6(%edx) L(write_1words): mov %ax, -2(%edx) SETRTNVAL RETURN ALIGN (4) L(write_30words): movl %eax, -60(%edx) movl %eax, -56(%edx) L(write_26words): movl %eax, -52(%edx) movl %eax, -48(%edx) L(write_22words): movl %eax, -44(%edx) movl %eax, -40(%edx) L(write_18words): movl %eax, -36(%edx) movl %eax, -32(%edx) L(write_14words): movl %eax, -28(%edx) movl %eax, -24(%edx) L(write_10words): movl %eax, -20(%edx) movl %eax, -16(%edx) L(write_6words): movl %eax, -12(%edx) movl %eax, -8(%edx) L(write_2words): movl %eax, -4(%edx) SETRTNVAL RETURN ALIGN (4) L(write_31words): movl %eax, -62(%edx) movl %eax, -58(%edx) L(write_27words): movl %eax, -54(%edx) movl %eax, -50(%edx) L(write_23words): movl %eax, -46(%edx) movl %eax, -42(%edx) L(write_19words): movl %eax, -38(%edx) movl %eax, -34(%edx) L(write_15words): movl %eax, -30(%edx) movl %eax, -26(%edx) L(write_11words): movl %eax, -22(%edx) movl %eax, -18(%edx) L(write_7words): movl %eax, -14(%edx) movl %eax, -10(%edx) L(write_3words): movl %eax, -6(%edx) movw %ax, -2(%edx) SETRTNVAL RETURN ALIGN (4) L(32wordsormore): shl $1, %ecx test $0x01, %edx jz L(aligned2bytes) mov %eax, (%edx) mov %eax, -4(%edx, %ecx) sub $2, %ecx add $1, %edx rol $8, %eax L(aligned2bytes): #ifdef USE_AS_BZERO16 pxor %xmm0, %xmm0 #else movd %eax, %xmm0 pshufd $0, %xmm0, %xmm0 #endif testl $0xf, %edx jz L(aligned_16) /* ECX > 32 and EDX is not 16 byte aligned. */ L(not_aligned_16): movdqu %xmm0, (%edx) movl %edx, %eax and $-16, %edx add $16, %edx sub %edx, %eax add %eax, %ecx movd %xmm0, %eax ALIGN (4) L(aligned_16): cmp $128, %ecx jae L(128bytesormore) L(aligned_16_less128bytes): add %ecx, %edx shr $1, %ecx BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes)) ALIGN (4) L(128bytesormore): #ifdef SHARED_CACHE_SIZE PUSH (%ebx) mov $SHARED_CACHE_SIZE, %ebx #else # ifdef SHARED call __i686.get_pc_thunk.bx add $_GLOBAL_OFFSET_TABLE_, %ebx mov __x86_shared_cache_size@GOTOFF(%ebx), %ebx # else PUSH (%ebx) mov __x86_shared_cache_size, %ebx # endif #endif cmp %ebx, %ecx jae L(128bytesormore_nt_start) #ifdef DATA_CACHE_SIZE POP (%ebx) # define RESTORE_EBX_STATE CFI_PUSH (%ebx) cmp $DATA_CACHE_SIZE, %ecx #else # ifdef SHARED # define RESTORE_EBX_STATE call __i686.get_pc_thunk.bx add $_GLOBAL_OFFSET_TABLE_, %ebx cmp __x86_data_cache_size@GOTOFF(%ebx), %ecx # else POP (%ebx) # define RESTORE_EBX_STATE CFI_PUSH (%ebx) cmp __x86_data_cache_size, %ecx # endif #endif jae L(128bytes_L2_normal) subl $128, %ecx L(128bytesormore_normal): sub $128, %ecx movdqa %xmm0, (%edx) movdqa %xmm0, 0x10(%edx) movdqa %xmm0, 0x20(%edx) movdqa %xmm0, 0x30(%edx) movdqa %xmm0, 0x40(%edx) movdqa %xmm0, 0x50(%edx) movdqa %xmm0, 0x60(%edx) movdqa %xmm0, 0x70(%edx) lea 128(%edx), %edx jb L(128bytesless_normal) sub $128, %ecx movdqa %xmm0, (%edx) movdqa %xmm0, 0x10(%edx) movdqa %xmm0, 0x20(%edx) movdqa %xmm0, 0x30(%edx) movdqa %xmm0, 0x40(%edx) movdqa %xmm0, 0x50(%edx) movdqa %xmm0, 0x60(%edx) movdqa %xmm0, 0x70(%edx) lea 128(%edx), %edx jae L(128bytesormore_normal) L(128bytesless_normal): lea 128(%ecx), %ecx add %ecx, %edx shr $1, %ecx BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes)) ALIGN (4) L(128bytes_L2_normal): prefetcht0 0x380(%edx) prefetcht0 0x3c0(%edx) sub $128, %ecx movdqa %xmm0, (%edx) movaps %xmm0, 0x10(%edx) movaps %xmm0, 0x20(%edx) movaps %xmm0, 0x30(%edx) movaps %xmm0, 0x40(%edx) movaps %xmm0, 0x50(%edx) movaps %xmm0, 0x60(%edx) movaps %xmm0, 0x70(%edx) add $128, %edx cmp $128, %ecx jae L(128bytes_L2_normal) L(128bytesless_L2_normal): add %ecx, %edx shr $1, %ecx BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes)) RESTORE_EBX_STATE L(128bytesormore_nt_start): sub %ebx, %ecx mov %ebx, %eax and $0x7f, %eax add %eax, %ecx movd %xmm0, %eax ALIGN (4) L(128bytesormore_shared_cache_loop): prefetcht0 0x3c0(%edx) prefetcht0 0x380(%edx) sub $0x80, %ebx movdqa %xmm0, (%edx) movdqa %xmm0, 0x10(%edx) movdqa %xmm0, 0x20(%edx) movdqa %xmm0, 0x30(%edx) movdqa %xmm0, 0x40(%edx) movdqa %xmm0, 0x50(%edx) movdqa %xmm0, 0x60(%edx) movdqa %xmm0, 0x70(%edx) add $0x80, %edx cmp $0x80, %ebx jae L(128bytesormore_shared_cache_loop) cmp $0x80, %ecx jb L(shared_cache_loop_end) ALIGN (4) L(128bytesormore_nt): sub $0x80, %ecx movntdq %xmm0, (%edx) movntdq %xmm0, 0x10(%edx) movntdq %xmm0, 0x20(%edx) movntdq %xmm0, 0x30(%edx) movntdq %xmm0, 0x40(%edx) movntdq %xmm0, 0x50(%edx) movntdq %xmm0, 0x60(%edx) movntdq %xmm0, 0x70(%edx) add $0x80, %edx cmp $0x80, %ecx jae L(128bytesormore_nt) sfence L(shared_cache_loop_end): #if defined DATA_CACHE_SIZE || !defined SHARED POP (%ebx) #endif add %ecx, %edx shr $1, %ecx BRANCH_TO_JMPTBL_ENTRY (L(table_16_128bytes)) .pushsection .rodata.sse2,"a",@progbits ALIGN (2) L(table_16_128bytes): .int JMPTBL (L(aligned_16_0bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_2bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_4bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_6bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_8bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_10bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_12bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_14bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_16bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_18bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_20bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_22bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_24bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_26bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_28bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_30bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_32bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_34bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_36bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_38bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_40bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_42bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_44bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_46bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_48bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_50bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_52bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_54bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_56bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_58bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_60bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_62bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_64bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_66bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_68bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_70bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_72bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_74bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_76bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_78bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_80bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_82bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_84bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_86bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_88bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_90bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_92bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_94bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_96bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_98bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_100bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_102bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_104bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_106bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_108bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_110bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_112bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_114bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_116bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_118bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_120bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_122bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_124bytes), L(table_16_128bytes)) .int JMPTBL (L(aligned_16_126bytes), L(table_16_128bytes)) .popsection ALIGN (4) L(aligned_16_112bytes): movdqa %xmm0, -112(%edx) L(aligned_16_96bytes): movdqa %xmm0, -96(%edx) L(aligned_16_80bytes): movdqa %xmm0, -80(%edx) L(aligned_16_64bytes): movdqa %xmm0, -64(%edx) L(aligned_16_48bytes): movdqa %xmm0, -48(%edx) L(aligned_16_32bytes): movdqa %xmm0, -32(%edx) L(aligned_16_16bytes): movdqa %xmm0, -16(%edx) L(aligned_16_0bytes): SETRTNVAL RETURN ALIGN (4) L(aligned_16_114bytes): movdqa %xmm0, -114(%edx) L(aligned_16_98bytes): movdqa %xmm0, -98(%edx) L(aligned_16_82bytes): movdqa %xmm0, -82(%edx) L(aligned_16_66bytes): movdqa %xmm0, -66(%edx) L(aligned_16_50bytes): movdqa %xmm0, -50(%edx) L(aligned_16_34bytes): movdqa %xmm0, -34(%edx) L(aligned_16_18bytes): movdqa %xmm0, -18(%edx) L(aligned_16_2bytes): movw %ax, -2(%edx) SETRTNVAL RETURN ALIGN (4) L(aligned_16_116bytes): movdqa %xmm0, -116(%edx) L(aligned_16_100bytes): movdqa %xmm0, -100(%edx) L(aligned_16_84bytes): movdqa %xmm0, -84(%edx) L(aligned_16_68bytes): movdqa %xmm0, -68(%edx) L(aligned_16_52bytes): movdqa %xmm0, -52(%edx) L(aligned_16_36bytes): movdqa %xmm0, -36(%edx) L(aligned_16_20bytes): movdqa %xmm0, -20(%edx) L(aligned_16_4bytes): movl %eax, -4(%edx) SETRTNVAL RETURN ALIGN (4) L(aligned_16_118bytes): movdqa %xmm0, -118(%edx) L(aligned_16_102bytes): movdqa %xmm0, -102(%edx) L(aligned_16_86bytes): movdqa %xmm0, -86(%edx) L(aligned_16_70bytes): movdqa %xmm0, -70(%edx) L(aligned_16_54bytes): movdqa %xmm0, -54(%edx) L(aligned_16_38bytes): movdqa %xmm0, -38(%edx) L(aligned_16_22bytes): movdqa %xmm0, -22(%edx) L(aligned_16_6bytes): movl %eax, -6(%edx) movw %ax, -2(%edx) SETRTNVAL RETURN ALIGN (4) L(aligned_16_120bytes): movdqa %xmm0, -120(%edx) L(aligned_16_104bytes): movdqa %xmm0, -104(%edx) L(aligned_16_88bytes): movdqa %xmm0, -88(%edx) L(aligned_16_72bytes): movdqa %xmm0, -72(%edx) L(aligned_16_56bytes): movdqa %xmm0, -56(%edx) L(aligned_16_40bytes): movdqa %xmm0, -40(%edx) L(aligned_16_24bytes): movdqa %xmm0, -24(%edx) L(aligned_16_8bytes): movq %xmm0, -8(%edx) SETRTNVAL RETURN ALIGN (4) L(aligned_16_122bytes): movdqa %xmm0, -122(%edx) L(aligned_16_106bytes): movdqa %xmm0, -106(%edx) L(aligned_16_90bytes): movdqa %xmm0, -90(%edx) L(aligned_16_74bytes): movdqa %xmm0, -74(%edx) L(aligned_16_58bytes): movdqa %xmm0, -58(%edx) L(aligned_16_42bytes): movdqa %xmm0, -42(%edx) L(aligned_16_26bytes): movdqa %xmm0, -26(%edx) L(aligned_16_10bytes): movq %xmm0, -10(%edx) movw %ax, -2(%edx) SETRTNVAL RETURN ALIGN (4) L(aligned_16_124bytes): movdqa %xmm0, -124(%edx) L(aligned_16_108bytes): movdqa %xmm0, -108(%edx) L(aligned_16_92bytes): movdqa %xmm0, -92(%edx) L(aligned_16_76bytes): movdqa %xmm0, -76(%edx) L(aligned_16_60bytes): movdqa %xmm0, -60(%edx) L(aligned_16_44bytes): movdqa %xmm0, -44(%edx) L(aligned_16_28bytes): movdqa %xmm0, -28(%edx) L(aligned_16_12bytes): movq %xmm0, -12(%edx) movl %eax, -4(%edx) SETRTNVAL RETURN ALIGN (4) L(aligned_16_126bytes): movdqa %xmm0, -126(%edx) L(aligned_16_110bytes): movdqa %xmm0, -110(%edx) L(aligned_16_94bytes): movdqa %xmm0, -94(%edx) L(aligned_16_78bytes): movdqa %xmm0, -78(%edx) L(aligned_16_62bytes): movdqa %xmm0, -62(%edx) L(aligned_16_46bytes): movdqa %xmm0, -46(%edx) L(aligned_16_30bytes): movdqa %xmm0, -30(%edx) L(aligned_16_14bytes): movq %xmm0, -14(%edx) movl %eax, -6(%edx) movw %ax, -2(%edx) SETRTNVAL RETURN END (sse2_memset16_atom) android-audiosystem-1.8+13.10.20130807/lib/libcutils/arch-x86/cache_wrapper.S0000644000015700001700000000170412200324306026723 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Contributed by: Intel Corporation */ /* Values are optimized for Atom */ #define SHARED_CACHE_SIZE (512*1024) /* Atom L2 Cache */ #define DATA_CACHE_SIZE (24*1024) /* Atom L1 Data Cache */ #define SHARED_CACHE_SIZE_HALF (SHARED_CACHE_SIZE / 2) #define DATA_CACHE_SIZE_HALF (DATA_CACHE_SIZE / 2) android-audiosystem-1.8+13.10.20130807/lib/libcutils/arch-x86/android_memset16.S0000644000015700001700000000155012200324306027260 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Contributed by: Intel Corporation */ #if defined(USE_SSE2) # include "cache_wrapper.S" # undef __i686 # define USE_AS_ANDROID # define sse2_memset16_atom android_memset16 # include "sse2-memset16-atom.S" #else # include "memset16.S" #endif android-audiosystem-1.8+13.10.20130807/lib/libcutils/arch-x86/android_memset32.S0000644000015700001700000000155112200324306027257 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * Contributed by: Intel Corporation */ #if defined(USE_SSE2) # include "cache_wrapper.S" # undef __i686 # define USE_AS_ANDROID # define sse2_memset32_atom android_memset32 # include "sse2-memset32-atom.S" #else # include "memset32.S" #endif android-audiosystem-1.8+13.10.20130807/lib/libcutils/buffer.h0000644000015700001700000000533112200324306024056 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Byte buffer utilities. */ #ifndef __BUFFER_H #define __BUFFER_H #ifdef __cplusplus extern "C" { #endif #include /** * Byte buffer of known size. Keeps track of how much data has been read * into or written out of the buffer. */ typedef struct { /** Buffered data. */ char* data; union { /** For reading. # of bytes we expect. */ size_t expected; /** For writing. # of bytes to write. */ size_t remaining; }; /** Actual # of bytes in the buffer. */ size_t size; /** Amount of memory allocated for this buffer. */ size_t capacity; } Buffer; /** * Returns true if all data has been read into the buffer. */ #define bufferReadComplete(buffer) (buffer->expected == buffer->size) /** * Returns true if the buffer has been completely written. */ #define bufferWriteComplete(buffer) (buffer->remaining == 0) /** * Creates a new buffer with the given initial capacity. */ Buffer* bufferCreate(size_t initialCapacity); /** * Wraps an existing byte array. */ Buffer* bufferWrap(char* data, size_t capacity, size_t size); /** * Frees and its data. */ void bufferFree(Buffer* buffer); /** * Prepares buffer to read 'expected' number of bytes. Expands capacity if * necessary. Returns 0 if successful or -1 if an error occurs allocating * memory. */ int bufferPrepareForRead(Buffer* buffer, size_t expected); /** * Reads some data into a buffer. Returns -1 in case of an error and sets * errno (see read()). Returns 0 for EOF. Updates buffer->size and returns * the new size after a succesful read. * * Precondition: buffer->size < buffer->expected */ ssize_t bufferRead(Buffer* buffer, int fd); /** * Prepares a buffer to be written out. */ void bufferPrepareForWrite(Buffer* buffer); /** * Writes data from buffer to the given fd. Returns -1 and sets errno in case * of an error. Updates buffer->remaining and returns the number of remaining * bytes to be written after a successful write. * * Precondition: buffer->remaining > 0 */ ssize_t bufferWrite(Buffer* buffer, int fd); #ifdef __cplusplus } #endif #endif /* __BUFFER_H */ android-audiosystem-1.8+13.10.20130807/lib/libcutils/partition_utils.c0000644000015700001700000000272612200324306026036 0ustar pbuserpbgroup00000000000000/* * Copyright 2011, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include #include /* for BLKGETSIZE */ #include static int only_one_char(char *buf, int len, char c) { int i, ret; ret = 1; for (i=0; i #include #ifdef HAVE_ANDROID_OS /* For the socket trust (credentials) check */ #include #endif bool socket_peer_is_trusted(int fd) { #ifdef HAVE_ANDROID_OS struct ucred cr; socklen_t len = sizeof(cr); int n = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cr, &len); if (n != 0) { ALOGE("could not get socket credentials: %s\n", strerror(errno)); return false; } if ((cr.uid != AID_ROOT) && (cr.uid != AID_SHELL)) { ALOGE("untrusted userid on other end of socket: userid %d\n", cr.uid); return false; } #endif return true; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/qtaguid.c0000644000015700001700000001140412200324306024234 0ustar pbuserpbgroup00000000000000/* libcutils/qtaguid.c ** ** Copyright 2011, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ // #define LOG_NDEBUG 0 #define LOG_TAG "qtaguid" #include #include #include #include #include #include #include #include static const char* CTRL_PROCPATH = "/proc/net/xt_qtaguid/ctrl"; static const int CTRL_MAX_INPUT_LEN = 128; static const char *GLOBAL_PACIFIER_PARAM = "/sys/module/xt_qtaguid/parameters/passive"; static const char *TAG_PACIFIER_PARAM = "/sys/module/xt_qtaguid/parameters/tag_tracking_passive"; /* * One per proccess. * Once the device is open, this process will have its socket tags tracked. * And on exit or untimely death, all socket tags will be removed. * A process can only open /dev/xt_qtaguid once. * It should not close it unless it is really done with all the socket tags. * Failure to open it will be visible when socket tagging will be attempted. */ static int resTrackFd = -1; pthread_once_t resTrackInitDone = PTHREAD_ONCE_INIT; /* Only call once per process. */ void qtaguid_resTrack(void) { resTrackFd = TEMP_FAILURE_RETRY(open("/dev/xt_qtaguid", O_RDONLY)); if (resTrackFd >=0) { TEMP_FAILURE_RETRY(fcntl(resTrackFd, F_SETFD, FD_CLOEXEC)); } } /* * Returns: * 0 on success. * -errno on failure. */ static int write_ctrl(const char *cmd) { int fd, res, savedErrno; ALOGV("write_ctrl(%s)", cmd); fd = TEMP_FAILURE_RETRY(open(CTRL_PROCPATH, O_WRONLY)); if (fd < 0) { return -errno; } res = TEMP_FAILURE_RETRY(write(fd, cmd, strlen(cmd))); if (res < 0) { savedErrno = errno; } else { savedErrno = 0; } if (res < 0) { ALOGI("Failed write_ctrl(%s) res=%d errno=%d", cmd, res, savedErrno); } close(fd); return -savedErrno; } static int write_param(const char *param_path, const char *value) { int param_fd; int res; param_fd = TEMP_FAILURE_RETRY(open(param_path, O_WRONLY)); if (param_fd < 0) { return -errno; } res = TEMP_FAILURE_RETRY(write(param_fd, value, strlen(value))); if (res < 0) { return -errno; } close(param_fd); return 0; } int qtaguid_tagSocket(int sockfd, int tag, uid_t uid) { char lineBuf[CTRL_MAX_INPUT_LEN]; int res; uint64_t kTag = ((uint64_t)tag << 32); pthread_once(&resTrackInitDone, qtaguid_resTrack); snprintf(lineBuf, sizeof(lineBuf), "t %d %llu %d", sockfd, kTag, uid); ALOGV("Tagging socket %d with tag %llx{%u,0} for uid %d", sockfd, kTag, tag, uid); res = write_ctrl(lineBuf); if (res < 0) { ALOGI("Tagging socket %d with tag %llx(%d) for uid %d failed errno=%d", sockfd, kTag, tag, uid, res); } return res; } int qtaguid_untagSocket(int sockfd) { char lineBuf[CTRL_MAX_INPUT_LEN]; int res; ALOGV("Untagging socket %d", sockfd); snprintf(lineBuf, sizeof(lineBuf), "u %d", sockfd); res = write_ctrl(lineBuf); if (res < 0) { ALOGI("Untagging socket %d failed errno=%d", sockfd, res); } return res; } int qtaguid_setCounterSet(int counterSetNum, uid_t uid) { char lineBuf[CTRL_MAX_INPUT_LEN]; int res; ALOGV("Setting counters to set %d for uid %d", counterSetNum, uid); snprintf(lineBuf, sizeof(lineBuf), "s %d %d", counterSetNum, uid); res = write_ctrl(lineBuf); return res; } int qtaguid_deleteTagData(int tag, uid_t uid) { char lineBuf[CTRL_MAX_INPUT_LEN]; int fd, cnt = 0, res = 0; uint64_t kTag = (uint64_t)tag << 32; ALOGV("Deleting tag data with tag %llx{%d,0} for uid %d", kTag, tag, uid); pthread_once(&resTrackInitDone, qtaguid_resTrack); snprintf(lineBuf, sizeof(lineBuf), "d %llu %d", kTag, uid); res = write_ctrl(lineBuf); if (res < 0) { ALOGI("Deleteing tag data with tag %llx/%d for uid %d failed with cnt=%d errno=%d", kTag, tag, uid, cnt, errno); } return res; } int qtaguid_setPacifier(int on) { int param_fd; int res; const char *value; value = on ? "Y" : "N"; if (write_param(GLOBAL_PACIFIER_PARAM, value) < 0) { return -errno; } if (write_param(TAG_PACIFIER_PARAM, value) < 0) { return -errno; } return 0; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/loghack.h0000644000015700001700000000233412200324306024215 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * This is a temporary hack to enable logging from cutils. */ #ifndef _CUTILS_LOGHACK_H #define _CUTILS_LOGHACK_H #ifdef HAVE_ANDROID_OS #include #else #include #define ALOG(level, ...) \ ((void)printf("cutils:" level "/" LOG_TAG ": " __VA_ARGS__)) #define ALOGV(...) ALOG("V", __VA_ARGS__) #define ALOGD(...) ALOG("D", __VA_ARGS__) #define ALOGI(...) ALOG("I", __VA_ARGS__) #define ALOGW(...) ALOG("W", __VA_ARGS__) #define ALOGE(...) ALOG("E", __VA_ARGS__) #define LOG_ALWAYS_FATAL(...) do { ALOGE(__VA_ARGS__); exit(1); } while (0) #endif #endif // _CUTILS_LOGHACK_H android-audiosystem-1.8+13.10.20130807/lib/libcutils/qsort_r_compat.c0000644000015700001700000000463712200324306025644 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #if HAVE_BSD_QSORT_R /* * BSD qsort_r parameter order is as we have defined here. */ void qsort_r_compat(void* base, size_t nel, size_t width, void* thunk, int (*compar)(void*, const void* , const void*)) { qsort_r(base, nel, width, thunk, compar); } #elif HAVE_GNU_QSORT_R /* * GNU qsort_r parameter order places the thunk parameter last. */ struct compar_data { void* thunk; int (*compar)(void*, const void* , const void*); }; static int compar_wrapper(const void* a, const void* b, void* data) { struct compar_data* compar_data = (struct compar_data*)data; return compar_data->compar(compar_data->thunk, a, b); } void qsort_r_compat(void* base, size_t nel, size_t width, void* thunk, int (*compar)(void*, const void* , const void*)) { struct compar_data compar_data; compar_data.thunk = thunk; compar_data.compar = compar; qsort_r(base, nel, width, compar_wrapper, &compar_data); } #else /* * Emulate qsort_r using thread local storage to access the thunk data. */ #include static thread_store_t compar_data_key = THREAD_STORE_INITIALIZER; struct compar_data { void* thunk; int (*compar)(void*, const void* , const void*); }; static int compar_wrapper(const void* a, const void* b) { struct compar_data* compar_data = (struct compar_data*)thread_store_get(&compar_data_key); return compar_data->compar(compar_data->thunk, a, b); } void qsort_r_compat(void* base, size_t nel, size_t width, void* thunk, int (*compar)(void*, const void* , const void*)) { struct compar_data compar_data; compar_data.thunk = thunk; compar_data.compar = compar; thread_store_set(&compar_data_key, &compar_data, NULL); qsort(base, nel, width, compar_wrapper); } #endif android-audiosystem-1.8+13.10.20130807/lib/libcutils/arch-arm/0000755000015700001700000000000012200324404024123 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/lib/libcutils/arch-arm/memset32.S0000644000015700001700000000505512200324306025714 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * memset32.S * */ .text .align .global android_memset32 .type android_memset32, %function .global android_memset16 .type android_memset16, %function /* * Optimized memset32 and memset16 for ARM. * * void android_memset16(uint16_t* dst, uint16_t value, size_t size); * void android_memset32(uint32_t* dst, uint32_t value, size_t size); * */ android_memset16: .fnstart cmp r2, #1 bxle lr /* expand the data to 32 bits */ mov r1, r1, lsl #16 orr r1, r1, r1, lsr #16 /* align to 32 bits */ tst r0, #2 strneh r1, [r0], #2 subne r2, r2, #2 .fnend android_memset32: .fnstart .save {lr} str lr, [sp, #-4]! /* align the destination to a cache-line */ mov r12, r1 mov lr, r1 rsb r3, r0, #0 ands r3, r3, #0x1C beq .Laligned32 cmp r3, r2 andhi r3, r2, #0x1C sub r2, r2, r3 /* conditionally writes 0 to 7 words (length in r3) */ movs r3, r3, lsl #28 stmcsia r0!, {r1, lr} stmcsia r0!, {r1, lr} stmmiia r0!, {r1, lr} movs r3, r3, lsl #2 strcs r1, [r0], #4 .Laligned32: mov r3, r1 1: subs r2, r2, #32 stmhsia r0!, {r1,r3,r12,lr} stmhsia r0!, {r1,r3,r12,lr} bhs 1b add r2, r2, #32 /* conditionally stores 0 to 30 bytes */ movs r2, r2, lsl #28 stmcsia r0!, {r1,r3,r12,lr} stmmiia r0!, {r1,lr} movs r2, r2, lsl #2 strcs r1, [r0], #4 strmih lr, [r0], #2 ldr lr, [sp], #4 bx lr .fnend android-audiosystem-1.8+13.10.20130807/lib/libcutils/hashmap.c0000644000015700001700000002127412200324306024225 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include #include #include #include typedef struct Entry Entry; struct Entry { void* key; int hash; void* value; Entry* next; }; struct Hashmap { Entry** buckets; size_t bucketCount; int (*hash)(void* key); bool (*equals)(void* keyA, void* keyB); mutex_t lock; size_t size; }; Hashmap* hashmapCreate(size_t initialCapacity, int (*hash)(void* key), bool (*equals)(void* keyA, void* keyB)) { assert(hash != NULL); assert(equals != NULL); Hashmap* map = malloc(sizeof(Hashmap)); if (map == NULL) { return NULL; } // 0.75 load factor. size_t minimumBucketCount = initialCapacity * 4 / 3; map->bucketCount = 1; while (map->bucketCount <= minimumBucketCount) { // Bucket count must be power of 2. map->bucketCount <<= 1; } map->buckets = calloc(map->bucketCount, sizeof(Entry*)); if (map->buckets == NULL) { free(map); return NULL; } map->size = 0; map->hash = hash; map->equals = equals; mutex_init(&map->lock); return map; } /** * Hashes the given key. */ static inline int hashKey(Hashmap* map, void* key) { int h = map->hash(key); // We apply this secondary hashing discovered by Doug Lea to defend // against bad hashes. h += ~(h << 9); h ^= (((unsigned int) h) >> 14); h += (h << 4); h ^= (((unsigned int) h) >> 10); return h; } size_t hashmapSize(Hashmap* map) { return map->size; } static inline size_t calculateIndex(size_t bucketCount, int hash) { return ((size_t) hash) & (bucketCount - 1); } static void expandIfNecessary(Hashmap* map) { // If the load factor exceeds 0.75... if (map->size > (map->bucketCount * 3 / 4)) { // Start off with a 0.33 load factor. size_t newBucketCount = map->bucketCount << 1; Entry** newBuckets = calloc(newBucketCount, sizeof(Entry*)); if (newBuckets == NULL) { // Abort expansion. return; } // Move over existing entries. size_t i; for (i = 0; i < map->bucketCount; i++) { Entry* entry = map->buckets[i]; while (entry != NULL) { Entry* next = entry->next; size_t index = calculateIndex(newBucketCount, entry->hash); entry->next = newBuckets[index]; newBuckets[index] = entry; entry = next; } } // Copy over internals. free(map->buckets); map->buckets = newBuckets; map->bucketCount = newBucketCount; } } void hashmapLock(Hashmap* map) { mutex_lock(&map->lock); } void hashmapUnlock(Hashmap* map) { mutex_unlock(&map->lock); } void hashmapFree(Hashmap* map) { size_t i; for (i = 0; i < map->bucketCount; i++) { Entry* entry = map->buckets[i]; while (entry != NULL) { Entry* next = entry->next; free(entry); entry = next; } } free(map->buckets); mutex_destroy(&map->lock); free(map); } int hashmapHash(void* key, size_t keySize) { int h = keySize; char* data = (char*) key; size_t i; for (i = 0; i < keySize; i++) { h = h * 31 + *data; data++; } return h; } static Entry* createEntry(void* key, int hash, void* value) { Entry* entry = malloc(sizeof(Entry)); if (entry == NULL) { return NULL; } entry->key = key; entry->hash = hash; entry->value = value; entry->next = NULL; return entry; } static inline bool equalKeys(void* keyA, int hashA, void* keyB, int hashB, bool (*equals)(void*, void*)) { if (keyA == keyB) { return true; } if (hashA != hashB) { return false; } return equals(keyA, keyB); } void* hashmapPut(Hashmap* map, void* key, void* value) { int hash = hashKey(map, key); size_t index = calculateIndex(map->bucketCount, hash); Entry** p = &(map->buckets[index]); while (true) { Entry* current = *p; // Add a new entry. if (current == NULL) { *p = createEntry(key, hash, value); if (*p == NULL) { errno = ENOMEM; return NULL; } map->size++; expandIfNecessary(map); return NULL; } // Replace existing entry. if (equalKeys(current->key, current->hash, key, hash, map->equals)) { void* oldValue = current->value; current->value = value; return oldValue; } // Move to next entry. p = ¤t->next; } } void* hashmapGet(Hashmap* map, void* key) { int hash = hashKey(map, key); size_t index = calculateIndex(map->bucketCount, hash); Entry* entry = map->buckets[index]; while (entry != NULL) { if (equalKeys(entry->key, entry->hash, key, hash, map->equals)) { return entry->value; } entry = entry->next; } return NULL; } bool hashmapContainsKey(Hashmap* map, void* key) { int hash = hashKey(map, key); size_t index = calculateIndex(map->bucketCount, hash); Entry* entry = map->buckets[index]; while (entry != NULL) { if (equalKeys(entry->key, entry->hash, key, hash, map->equals)) { return true; } entry = entry->next; } return false; } void* hashmapMemoize(Hashmap* map, void* key, void* (*initialValue)(void* key, void* context), void* context) { int hash = hashKey(map, key); size_t index = calculateIndex(map->bucketCount, hash); Entry** p = &(map->buckets[index]); while (true) { Entry* current = *p; // Add a new entry. if (current == NULL) { *p = createEntry(key, hash, NULL); if (*p == NULL) { errno = ENOMEM; return NULL; } void* value = initialValue(key, context); (*p)->value = value; map->size++; expandIfNecessary(map); return value; } // Return existing value. if (equalKeys(current->key, current->hash, key, hash, map->equals)) { return current->value; } // Move to next entry. p = ¤t->next; } } void* hashmapRemove(Hashmap* map, void* key) { int hash = hashKey(map, key); size_t index = calculateIndex(map->bucketCount, hash); // Pointer to the current entry. Entry** p = &(map->buckets[index]); Entry* current; while ((current = *p) != NULL) { if (equalKeys(current->key, current->hash, key, hash, map->equals)) { void* value = current->value; *p = current->next; free(current); map->size--; return value; } p = ¤t->next; } return NULL; } void hashmapForEach(Hashmap* map, bool (*callback)(void* key, void* value, void* context), void* context) { size_t i; for (i = 0; i < map->bucketCount; i++) { Entry* entry = map->buckets[i]; while (entry != NULL) { Entry *next = entry->next; if (!callback(entry->key, entry->value, context)) { return; } entry = next; } } } size_t hashmapCurrentCapacity(Hashmap* map) { size_t bucketCount = map->bucketCount; return bucketCount * 3 / 4; } size_t hashmapCountCollisions(Hashmap* map) { size_t collisions = 0; size_t i; for (i = 0; i < map->bucketCount; i++) { Entry* entry = map->buckets[i]; while (entry != NULL) { if (entry->next != NULL) { collisions++; } entry = entry->next; } } return collisions; } int hashmapIntHash(void* key) { // Return the key value itself. return *((int*) key); } bool hashmapIntEquals(void* keyA, void* keyB) { int a = *((int*) keyA); int b = *((int*) keyB); return a == b; } android-audiosystem-1.8+13.10.20130807/lib/libcutils/socket_local_client.c0000644000015700001700000001053012200324306026575 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include #include #ifdef HAVE_WINSOCK int socket_local_client(const char *name, int namespaceId, int type) { errno = ENOSYS; return -1; } #else /* !HAVE_WINSOCK */ #include #include #include #include #include "socket_local.h" #define LISTEN_BACKLOG 4 /* Documented in header file. */ int socket_make_sockaddr_un(const char *name, int namespaceId, struct sockaddr_un *p_addr, socklen_t *alen) { memset (p_addr, 0, sizeof (*p_addr)); size_t namelen; switch (namespaceId) { case ANDROID_SOCKET_NAMESPACE_ABSTRACT: #ifdef HAVE_LINUX_LOCAL_SOCKET_NAMESPACE namelen = strlen(name); // Test with length +1 for the *initial* '\0'. if ((namelen + 1) > sizeof(p_addr->sun_path)) { goto error; } /* * Note: The path in this case is *not* supposed to be * '\0'-terminated. ("man 7 unix" for the gory details.) */ p_addr->sun_path[0] = 0; memcpy(p_addr->sun_path + 1, name, namelen); #else /*HAVE_LINUX_LOCAL_SOCKET_NAMESPACE*/ /* this OS doesn't have the Linux abstract namespace */ namelen = strlen(name) + strlen(FILESYSTEM_SOCKET_PREFIX); /* unix_path_max appears to be missing on linux */ if (namelen > sizeof(*p_addr) - offsetof(struct sockaddr_un, sun_path) - 1) { goto error; } strcpy(p_addr->sun_path, FILESYSTEM_SOCKET_PREFIX); strcat(p_addr->sun_path, name); #endif /*HAVE_LINUX_LOCAL_SOCKET_NAMESPACE*/ break; case ANDROID_SOCKET_NAMESPACE_RESERVED: namelen = strlen(name) + strlen(ANDROID_RESERVED_SOCKET_PREFIX); /* unix_path_max appears to be missing on linux */ if (namelen > sizeof(*p_addr) - offsetof(struct sockaddr_un, sun_path) - 1) { goto error; } strcpy(p_addr->sun_path, ANDROID_RESERVED_SOCKET_PREFIX); strcat(p_addr->sun_path, name); break; case ANDROID_SOCKET_NAMESPACE_FILESYSTEM: namelen = strlen(name); /* unix_path_max appears to be missing on linux */ if (namelen > sizeof(*p_addr) - offsetof(struct sockaddr_un, sun_path) - 1) { goto error; } strcpy(p_addr->sun_path, name); break; default: // invalid namespace id return -1; } p_addr->sun_family = AF_LOCAL; *alen = namelen + offsetof(struct sockaddr_un, sun_path) + 1; return 0; error: return -1; } /** * connect to peer named "name" on fd * returns same fd or -1 on error. * fd is not closed on error. that's your job. * * Used by AndroidSocketImpl */ int socket_local_client_connect(int fd, const char *name, int namespaceId, int type) { struct sockaddr_un addr; socklen_t alen; size_t namelen; int err; err = socket_make_sockaddr_un(name, namespaceId, &addr, &alen); if (err < 0) { goto error; } if(connect(fd, (struct sockaddr *) &addr, alen) < 0) { goto error; } return fd; error: return -1; } /** * connect to peer named "name" * returns fd or -1 on error */ int socket_local_client(const char *name, int namespaceId, int type) { int s; s = socket(AF_LOCAL, type, 0); if(s < 0) return -1; if ( 0 > socket_local_client_connect(s, name, namespaceId, type)) { close(s); return -1; } return s; } #endif /* !HAVE_WINSOCK */ android-audiosystem-1.8+13.10.20130807/lib/libcutils/cpu_info.c0000644000015700001700000000477512200324306024415 0ustar pbuserpbgroup00000000000000/* libs/cutils/cpu_info.c ** ** Copyright 2007, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include #include #include #include // we cache the serial number here. // this is also used as a fgets() line buffer when we are reading /proc/cpuinfo static char serial_number[100] = { 0 }; extern const char* get_cpu_serial_number(void) { if (serial_number[0] == 0) { FILE* file; char* chp, *end; char* whitespace; int length; // read serial number from /proc/cpuinfo file = fopen("proc/cpuinfo", "r"); if (! file) return NULL; while ((chp = fgets(serial_number, sizeof(serial_number), file)) != NULL) { // look for something like "Serial : 999206122a03591c" if (strncmp(chp, "Serial", 6) != 0) continue; chp = strchr(chp, ':'); if (!chp) continue; // skip colon and whitespace while ( *(++chp) == ' ') {} // truncate trailing whitespace end = chp; while (*end && *end != ' ' && *end != '\t' && *end != '\n' && *end != '\r') ++end; *end = 0; whitespace = strchr(chp, ' '); if (whitespace) *whitespace = 0; whitespace = strchr(chp, '\t'); if (whitespace) *whitespace = 0; whitespace = strchr(chp, '\r'); if (whitespace) *whitespace = 0; whitespace = strchr(chp, '\n'); if (whitespace) *whitespace = 0; // shift serial number to beginning of the buffer memmove(serial_number, chp, strlen(chp) + 1); break; } fclose(file); } return (serial_number[0] ? serial_number : NULL); } android-audiosystem-1.8+13.10.20130807/lib/libcutils/NOTICE0000644000015700001700000002470712200324306023350 0ustar pbuserpbgroup00000000000000 Copyright (c) 2005-2008, The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS android-audiosystem-1.8+13.10.20130807/lib/libcutils/memory.c0000644000015700001700000000501512200324306024107 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #if !HAVE_MEMSET16 void android_memset16(uint16_t* dst, uint16_t value, size_t size) { size >>= 1; while (size--) { *dst++ = value; } } #endif #if !HAVE_MEMSET32 void android_memset32(uint32_t* dst, uint32_t value, size_t size) { size >>= 2; while (size--) { *dst++ = value; } } #endif #if !HAVE_STRLCPY /* * Copyright (c) 1998 Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include #include /* Implementation of strlcpy() for platforms that don't already have it. */ /* * Copy src to string dst of size siz. At most siz-1 characters * will be copied. Always NUL terminates (unless siz == 0). * Returns strlen(src); if retval >= siz, truncation occurred. */ size_t strlcpy(char *dst, const char *src, size_t siz) { char *d = dst; const char *s = src; size_t n = siz; /* Copy as many bytes as will fit */ if (n != 0) { while (--n != 0) { if ((*d++ = *s++) == '\0') break; } } /* Not enough room in dst, add NUL and traverse rest of src */ if (n == 0) { if (siz != 0) *d = '\0'; /* NUL-terminate dst */ while (*s++) ; } return(s - src - 1); /* count does not include NUL */ } #endif android-audiosystem-1.8+13.10.20130807/lib/libcutils/array.c0000644000015700001700000001040212200324306023711 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include #define INITIAL_CAPACITY (4) #define MAX_CAPACITY ((int)(UINT_MAX/sizeof(void*))) struct Array { void** contents; int size; int capacity; }; Array* arrayCreate() { return calloc(1, sizeof(struct Array)); } void arrayFree(Array* array) { assert(array != NULL); // Free internal array. free(array->contents); // Free the Array itself. free(array); } /** Returns 0 if successful, < 0 otherwise.. */ static int ensureCapacity(Array* array, int capacity) { int oldCapacity = array->capacity; if (capacity > oldCapacity) { int newCapacity = (oldCapacity == 0) ? INITIAL_CAPACITY : oldCapacity; // Ensure we're not doing something nasty if (capacity > MAX_CAPACITY) return -1; // Keep doubling capacity until we surpass necessary capacity. while (newCapacity < capacity) { int newCap = newCapacity*2; // Handle integer overflows if (newCap < newCapacity || newCap > MAX_CAPACITY) { newCap = MAX_CAPACITY; } newCapacity = newCap; } // Should not happen, but better be safe than sorry if (newCapacity < 0 || newCapacity > MAX_CAPACITY) return -1; void** newContents; if (array->contents == NULL) { // Allocate new array. newContents = malloc(newCapacity * sizeof(void*)); if (newContents == NULL) { return -1; } } else { // Expand existing array. newContents = realloc(array->contents, sizeof(void*) * newCapacity); if (newContents == NULL) { return -1; } } array->capacity = newCapacity; array->contents = newContents; } return 0; } int arrayAdd(Array* array, void* pointer) { assert(array != NULL); int size = array->size; int result = ensureCapacity(array, size + 1); if (result < 0) { return result; } array->contents[size] = pointer; array->size++; return 0; } static inline void checkBounds(Array* array, int index) { assert(array != NULL); assert(index < array->size); assert(index >= 0); } void* arrayGet(Array* array, int index) { checkBounds(array, index); return array->contents[index]; } void* arrayRemove(Array* array, int index) { checkBounds(array, index); void* pointer = array->contents[index]; int newSize = array->size - 1; // Shift entries left. if (index != newSize) { memmove(array->contents + index, array->contents + index + 1, (sizeof(void*)) * (newSize - index)); } array->size = newSize; return pointer; } void* arraySet(Array* array, int index, void* pointer) { checkBounds(array, index); void* old = array->contents[index]; array->contents[index] = pointer; return old; } int arraySetSize(Array* array, int newSize) { assert(array != NULL); assert(newSize >= 0); int oldSize = array->size; if (newSize > oldSize) { // Expand. int result = ensureCapacity(array, newSize); if (result < 0) { return result; } // Zero out new entries. memset(array->contents + sizeof(void*) * oldSize, 0, sizeof(void*) * (newSize - oldSize)); } array->size = newSize; return 0; } int arraySize(Array* array) { assert(array != NULL); return array->size; } const void** arrayUnwrap(Array* array) { return (const void**)array->contents; } android-audiosystem-1.8+13.10.20130807/lib/wpcmplugin/0000755000015700001700000000000012200324404022624 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/lib/wpcmplugin/pcm_android.c0000644000015700001700000003615012200324306025255 0ustar pbuserpbgroup00000000000000/* * ALSA <-> Audioflinger PCM I/O plugin * * Copyright (c) 2010 by Motorola Corporation * Copyright (C) 2011-2012 Canonical, Ltd. * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include "waudio.h" #include static int loglevel = 0; #define LOG(level, ...) \ {if (loglevel >= level) printf( __VA_ARGS__); } #define LOGD(...) LOG(2, __VA_ARGS__) #define LOGI(...) LOG(1, __VA_ARGS__) typedef struct snd_pcm_android { snd_pcm_ioplug_t io; int fd[2]; void *data; audio_format_t format; int rate; int channels; int period; unsigned int frame_size; ssize_t hw_ptr; int delay; int muted; } snd_pcm_android_t; static int g_muted = 0; static void mute_handler (int signum) { switch (signum) { case SIGUSR1: g_muted = 1; break; case SIGUSR2: g_muted = 0; break; } } static void signals_setup (void) { struct sigaction action; memset (&action, 0, sizeof (action)); action.sa_handler = mute_handler; sigaction (SIGUSR1, &action, NULL); sigaction (SIGUSR2, &action, NULL); } static int android_poll_revents(snd_pcm_ioplug_t *io ATTRIBUTE_UNUSED, struct pollfd *pfds, unsigned int nfds, unsigned short *revents) { snd_pcm_android_t *android = io->private_data; LOGD("android_poll_revents enter\n"); assert(pfds && nfds == 1 && revents); LOGD("android_poll_revents usleep start\n"); usleep(android->period * 500000 / android->rate); LOGD("android_poll_revents usleep %dms end\n", android->period * 500000 / android->rate); *revents = pfds[0].revents; LOGD("android_poll_revents return\n"); return 0; } /* Callback from AudioTrack to consume the remaining of the buffer */ void android_process_cb(int event, void *cookie, void *info) { snd_pcm_uframes_t xfer = 0; const snd_pcm_channel_area_t *areas; int nframes; LOGD("android_process_cb start\n"); snd_pcm_ioplug_t *io = (snd_pcm_ioplug_t *) cookie; snd_pcm_android_t *android = io->private_data; snd_pcm_channel_area_t dst_areas[android->channels]; /* only handle EVENT_MORE_DATA Event */ if (event != EVENT_MORE_DATA) return; /* check whether need to mute audio track */ if (android->muted != g_muted) { if (android->data == NULL) return; AudioTrack_mute((TrackHandle) android->data, g_muted); android->muted = g_muted; } buffer_struct *buffer = (buffer_struct *) info; /* calculate frame count needed */ nframes = buffer->size / android->frame_size; /* init dst areas from buffer */ unsigned int channel; unsigned int channels = android->channels; snd_pcm_channel_area_t* bareas = dst_areas; for (channel = 0; channel < channels; ++channel, ++bareas) { bareas->addr = buffer->raw; bareas->first = channel * snd_pcm_format_physical_width(io->format); bareas->step = android->frame_size * 8; } if (io->state != SND_PCM_STATE_RUNNING) { LOGD("not running, silence it \n"); snd_pcm_areas_silence(dst_areas, 0, android->channels, nframes, io->format); return; } /* get src areas from io mmap */ areas = snd_pcm_ioplug_mmap_areas(io); /* read data */ while (xfer < nframes) { snd_pcm_uframes_t frames = nframes - xfer; snd_pcm_uframes_t offset = android->hw_ptr; snd_pcm_uframes_t cont = io->buffer_size - offset; if (cont < frames) frames = cont; if (io->stream == SND_PCM_STREAM_PLAYBACK) snd_pcm_areas_copy(dst_areas, xfer, areas, offset, android->channels, frames, io->format); android->hw_ptr += frames; android->hw_ptr %= io->buffer_size; xfer += frames; } LOGD("android_process_cb write %d bytes\n", buffer->size); } static snd_pcm_sframes_t android_read(snd_pcm_ioplug_t *io, const snd_pcm_channel_area_t *areas, snd_pcm_uframes_t offset, snd_pcm_uframes_t size) { snd_pcm_android_t *android = io->private_data; char *buf; ssize_t result; LOGD("android_read enter\n"); /* we handle only an interleaved buffer */ buf = (char *) areas->addr + (areas->first + areas->step * offset) / 8; size *= android->frame_size; result = AudioRecord_read((RecordHandle) android->data, buf, size); write(android->fd[0], buf, 1); // for polling if (result <= 0) { LOGD("android_read result <=0\n"); return result; } android->hw_ptr += result / android->frame_size; android->hw_ptr %= io->buffer_size; LOGD("android_read leave - sframes :%d\n", result / android->frame_size); return result / android->frame_size; } static snd_pcm_sframes_t android_pointer(snd_pcm_ioplug_t *io) { snd_pcm_android_t *android = io->private_data; LOGD("android_pointer %d\n", android->hw_ptr); return android->hw_ptr; } static int android_delay(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delayp) { snd_pcm_android_t *android = io->private_data; if (android->data == NULL) return -EBADFD; *delayp = android->delay + io->buffer_size; LOGD("android_delay %d\n", android->delay); return 0; } static int android_start(snd_pcm_ioplug_t *io) { snd_pcm_android_t *android = io->private_data; LOGI("android start\n"); if (android->data == NULL) return -EBADFD; if (io->stream == SND_PCM_STREAM_PLAYBACK) AudioTrack_start((TrackHandle) android->data); else { AudioRecord_start((RecordHandle) android->data); /* Fake Android's hw ptr so Alsa can start polling * Ideally this would be given by Android, but for that we'd * need to use a callback while reading from the record * handle, similar with what we have for track handle. */ android->hw_ptr = 500; } LOGI("android start return no err\n"); return 0; } static int android_stop(snd_pcm_ioplug_t *io) { snd_pcm_android_t *android = io->private_data; LOGI("android stop\n"); if (android->data == NULL) return -EBADFD; if (io->stream == SND_PCM_STREAM_PLAYBACK) AudioTrack_stop((TrackHandle) android->data); else AudioRecord_stop((TrackHandle) android->data); LOGI("android stop return no err\n"); return 0; } static int android_prepare(snd_pcm_ioplug_t *io) { snd_pcm_android_t *android = io->private_data; status_type status; audio_channel_mask_t channel; LOGI("android_prepare\n"); android->hw_ptr = 0; android->muted = 0; if (android->data) { if (io->stream == SND_PCM_STREAM_PLAYBACK) DestoryAudioTrack((TrackHandle) android->data); else DestoryAudioRecord((RecordHandle) android->data); android->data = NULL; } if (io->stream == SND_PCM_STREAM_PLAYBACK) { LOGI("android_prepare: creating audio track (playback)\n"); android->data = CreateAudioTrack(); } else { LOGI("android_prepare: creating audio record\n"); android->data = CreateAudioRecord(); } if (android->data == NULL) { SNDERR("cannot allocate audio track/record"); return -ENOMEM; } if (io->stream == SND_PCM_STREAM_PLAYBACK) { if (android->channels == 2) channel = AUDIO_CHANNEL_OUT_STEREO; else if (android->channels == 1) channel = AUDIO_CHANNEL_OUT_MONO; else return -EIO; LOGI("android_prepare: track set (music track), rate: %d, format: %x, channel: %x\n", android->rate, android->format, channel); status = AudioTrack_set_asyn( (TrackHandle) android->data, AUDIO_STREAM_MUSIC, (uint32) android->rate, android->format, channel, android_process_cb, io); android->delay = AudioTrack_latency( (TrackHandle) android->data) * android->rate / 1000; } else { if (android->channels == 2) channel = AUDIO_CHANNEL_IN_STEREO; else if (android->channels == 1) channel = AUDIO_CHANNEL_IN_MONO; else return -EIO; LOGI("android_prepare: record set, rate: %d, format: %x, channel: %x\n", android->rate, android->format, channel); status = AudioRecord_set((RecordHandle) android->data, AUDIO_SOURCE_DEFAULT, (uint32) android->rate, android->format, channel); } /* walkaround for pulseaudio alsasink */ char buf[1]; write(android->fd[0], buf, 1); if (status != OK) { LOGI("android_prepare: failed preparing android track/record, status: %d\n", status); return -EIO; } LOGI("android_prepare return no err\n"); return 0; } /* Check whether hw params are valid */ static int android_hw_params(snd_pcm_ioplug_t *io, snd_pcm_hw_params_t *params ATTRIBUTE_UNUSED) { snd_pcm_android_t *android = io->private_data; int err = 0; assert(android); LOGI("android_hw_params\n"); android->frame_size = (snd_pcm_format_physical_width(io->format) * io->channels) / 8; /* config audio format */ LOGD("io format is %d\n", io->format); switch (io->format) { case SND_PCM_FORMAT_U8: android->format = AUDIO_FORMAT_PCM_8_BIT; break; case SND_PCM_FORMAT_S16_LE: android->format = AUDIO_FORMAT_PCM_16_BIT; break; case SND_PCM_FORMAT_S16_BE: android->format = AUDIO_FORMAT_PCM_16_BIT; break; default: SNDERR("android: Unsupported format %s\n", snd_pcm_format_name(io->format)); err = -EINVAL; goto finish; } /* config rate and channel */ LOGD("io rate is %d, channel is %d\n", io->rate, io->channels); if (io->rate > 48000 || io->channels > 2) { err = -EINVAL; goto finish; } android->rate = io->rate; android->channels = io->channels; /* config period size */ LOGD("io period is %d\n", (int) io->period_size); android->period = io->period_size; finish: LOGI("android_hw_params return err=%d\n", err); return err; } static int android_pause(snd_pcm_ioplug_t *io, int enable) { snd_pcm_android_t *android = io->private_data; int err = 0; LOGI("android_pause, enable=%d\n", enable); if (enable) { if (io->stream == SND_PCM_STREAM_PLAYBACK) AudioTrack_pause((TrackHandle) android->data); /* else AudioRecord_pause((RecordHandle) android->data); */ } else { if (io->stream == SND_PCM_STREAM_PLAYBACK) AudioTrack_start((TrackHandle) android->data); /* else AudioRecord_start((RecordHandle) android->data); */ } LOGI("android_pause, return err=%d\n", err); return err; } #define ARRAY_SIZE(ary) (sizeof(ary)/sizeof(ary[0])) static int android_hw_constraint(snd_pcm_android_t *android) { snd_pcm_ioplug_t *io = &android->io; static const snd_pcm_access_t access_list[] = { SND_PCM_ACCESS_RW_INTERLEAVED }; static const unsigned int formats[] = { SND_PCM_FORMAT_U8, SND_PCM_FORMAT_S16_LE, SND_PCM_FORMAT_S16_BE, }; int err; LOGI("android_hw_constraint\n"); err = snd_pcm_ioplug_set_param_list(io, SND_PCM_IOPLUG_HW_ACCESS, ARRAY_SIZE(access_list), access_list); if (err < 0) return err; err = snd_pcm_ioplug_set_param_list(io, SND_PCM_IOPLUG_HW_FORMAT, ARRAY_SIZE(formats), formats); if (err < 0) return err; err = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_CHANNELS, 1, 2); if (err < 0) return err; err = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_RATE, 8000, 48000); if (err < 0) return err; err = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_BUFFER_BYTES, 1, 1 * 1024 * 1024); if (err < 0) return err; err = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_PERIOD_BYTES, 128, 0.5 * 1024 * 1024); if (err < 0) return err; err = snd_pcm_ioplug_set_param_minmax(io, SND_PCM_IOPLUG_HW_PERIODS, 2, 1024); if (err < 0) return err; LOGI("android_hw_constraint return no err\n"); return 0; } static int android_close(snd_pcm_ioplug_t *io) { snd_pcm_android_t *android = io->private_data; LOGI("android_close\n"); if (android->data) { if (io->stream == SND_PCM_STREAM_PLAYBACK) DestoryAudioTrack((TrackHandle)android->data); else DestoryAudioRecord((RecordHandle)android->data); } if (android->fd[0] >= 0) close(android->fd[0]); if (android->fd[1] >= 0) close(android->fd[1]); android->fd[0] = -1; android->fd[1] = -1; android->format = 0; android->rate = 0; android->channels = 0; android->period = 0; android->frame_size = 0; android->data = NULL; android->hw_ptr = 0; android->delay = 0; free(android); LOGI("android_close return no err\n"); return 0; } static const snd_pcm_ioplug_callback_t android_playback_callback = { .start = android_start, .stop = android_stop, .pointer = android_pointer, .close = android_close, .hw_params = android_hw_params, .prepare = android_prepare, .pause = android_pause, .poll_revents = android_poll_revents, .delay = android_delay, }; static const snd_pcm_ioplug_callback_t android_capture_callback = { .start = android_start, .stop = android_stop, .transfer = android_read, .pointer = android_pointer, .close = android_close, .hw_params = android_hw_params, .prepare = android_prepare, .pause = android_pause, }; static int make_nonblock(int fd) { int fl; if ((fl = fcntl(fd, F_GETFL)) < 0) return fl; if (fl & O_NONBLOCK) return 0; return fcntl(fd, F_SETFL, fl | O_NONBLOCK); } SND_PCM_PLUGIN_DEFINE_FUNC(android) { snd_config_iterator_t i, next; int err; snd_pcm_android_t *android; char *env = NULL; snd_config_for_each(i, next, conf) { snd_config_t *n = snd_config_iterator_entry(i); const char *id; if (snd_config_get_id(n, &id) < 0) continue; if (strcmp(id, "comment") == 0 || strcmp(id, "type") == 0 || strcmp(id, "hint") == 0 || strcmp(id, "device") == 0) continue; SNDERR("Unknown field %s", id); return -EINVAL; } if ((env = getenv("ALSA_ANDROID_DBG"))) { loglevel = atoi (env); if (loglevel < 0 || loglevel > 3) loglevel = 0; } android = calloc(1, sizeof(*android)); if (!android) { SNDERR("cannot allocate"); return -ENOMEM; } android->fd[0] = -1; android->fd[1] = -1; android->format = 0; android->rate = 0; android->channels = 0; android->period = 0; android->frame_size = 0; android->data = NULL; android->hw_ptr = 0; android->delay = 0; android->muted = 0; /* init pair fd, and set it as nonblock mode */ socketpair(AF_LOCAL, SOCK_STREAM, 0, android->fd); make_nonblock(android->fd[0]); /* make_nonblock(android->fd[1]); */ android->io.version = SND_PCM_IOPLUG_VERSION; android->io.name = "ALSA <-> android PCM I/O Plugin"; android->io.poll_fd = android->fd[1]; android->io.poll_events = stream == SND_PCM_STREAM_PLAYBACK ? POLLOUT : POLLIN; android->io.mmap_rw = stream == SND_PCM_STREAM_PLAYBACK ? 1 : 0; android->io.callback = stream == SND_PCM_STREAM_PLAYBACK ? &android_playback_callback : &android_capture_callback; android->io.private_data = android; if (mode & SND_PCM_NONBLOCK) LOGI("mode is SND_PCM_NONBLOCK\n"); err = snd_pcm_ioplug_create(&android->io, name, stream, mode); if (err < 0) goto error; if ((err = android_hw_constraint(android)) < 0) { snd_pcm_ioplug_delete(&android->io); return err; } *pcmp = android->io.pcm; /* setup mute signal handler */ signals_setup(); return 0; error: free(android); return err; } SND_PCM_PLUGIN_SYMBOL(android); android-audiosystem-1.8+13.10.20130807/lib/wpcmplugin/build0000755000015700001700000000013012200324306023644 0ustar pbuserpbgroup00000000000000#!/bin/sh target='armel' make clean make -e ARCH=$target make -e ARCH=$target install android-audiosystem-1.8+13.10.20130807/lib/wpcmplugin/Makefile0000644000015700001700000000267112200324306024273 0ustar pbuserpbgroup00000000000000make_home := ../../ top_srcdir := ../../ oss_pkg_config_args = "alsa" include $(make_home)/project_make include $(make_home)/package_make ####################### # CUSTOMIZE MACROS HERE ####################### # name your library here PKG_LIB = asound_module_pcm_android # at least one of following lines must be uncommented # CFILES is .c # CCFILES is .cc # CPPFILES is .cpp # CXXFILES is .cxx CFILES = pcm_android.c #CCFILES = #CPPFILES = #CXXFILES = # if this library depends on private static library built # by this package, uncomment next line #STATIC_LIBS = # modify compiler command-line options CFLAGS = -fPIC -DPIC # modify linker command-line options LDFLAGS += $(PKGLDFLAGS) -L ../waudio/ SHARED_LIBS += -lwaudio -lasound # build private static library private_lib = NO # build simple shared library # single header file exported, should be .../lib/include/$(PKG_LIB).h PKGCONFIG = NO # build pkgconfig shared library # change PKGCONFIG to YES and add following three macros # PKG_LIBDESC is one line description of library # PKG_REQUIRES is list of required pkgconfig libraries # PKG_HEADERS is list of header files to export #PKG_LIBDESC = #PKG_REQUIRES = #PKG_HEADERS = MAKESUBDIR = YES LIBSUBDIR = /usr/lib/$(DEB_HOST_MULTIARCH)/alsa-lib HDRSUBDIR = /usr/include/alsa ############################ # END OF MACROS TO CUSTOMIZE ############################ all: $(TARGET) #-include $(DEPENDS) include $(make_home)/target_lib android-audiosystem-1.8+13.10.20130807/lib/Makefile.defines0000644000015700001700000000013412200324306023512 0ustar pbuserpbgroup00000000000000ifeq ($(ARCH), i386) include ../Config.defines.x86 else include ../Config.defines.arm endif android-audiosystem-1.8+13.10.20130807/lib/libmedia/0000755000015700001700000000000012200324404022205 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/lib/libmedia/AudioTrack.cpp0000644000015700001700000016010212200324306024740 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2007, The Android Open Source Project ** ** Copyright (c) 2012, The Linux Foundation. All rights reserved. ** Not a Contribution, Apache license notifications and license are retained ** for attribution purposes only. ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "AudioTrack" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace android { // --------------------------------------------------------------------------- // static status_t AudioTrack::getMinFrameCount( int* frameCount, audio_stream_type_t streamType, uint32_t sampleRate) { if (frameCount == NULL) return BAD_VALUE; // default to 0 in case of error *frameCount = 0; // FIXME merge with similar code in createTrack_l(), except we're missing // some information here that is available in createTrack_l(): // audio_io_handle_t output // audio_format_t format // audio_channel_mask_t channelMask // audio_output_flags_t flags int afSampleRate; if (AudioSystem::getOutputSamplingRate(&afSampleRate, streamType) != NO_ERROR) { return NO_INIT; } int afFrameCount; if (AudioSystem::getOutputFrameCount(&afFrameCount, streamType) != NO_ERROR) { return NO_INIT; } uint32_t afLatency; if (AudioSystem::getOutputLatency(&afLatency, streamType) != NO_ERROR) { return NO_INIT; } // Ensure that buffer depth covers at least audio hardware latency uint32_t minBufCount = afLatency / ((1000 * afFrameCount) / afSampleRate); if (minBufCount < 2) minBufCount = 2; *frameCount = (sampleRate == 0) ? afFrameCount * minBufCount : afFrameCount * minBufCount * sampleRate / afSampleRate; ALOGV("getMinFrameCount=%d: afFrameCount=%d, minBufCount=%d, afSampleRate=%d, afLatency=%d", *frameCount, afFrameCount, minBufCount, afSampleRate, afLatency); return NO_ERROR; } // --------------------------------------------------------------------------- AudioTrack::AudioTrack() : mStatus(NO_INIT), mIsTimed(false), mPreviousPriority(ANDROID_PRIORITY_NORMAL), mPreviousSchedulingGroup(SP_DEFAULT) #ifdef QCOM_HARDWARE ,mAudioFlinger(NULL), mObserver(NULL) #endif { } AudioTrack::AudioTrack( audio_stream_type_t streamType, uint32_t sampleRate, audio_format_t format, audio_channel_mask_t channelMask, int frameCount, audio_output_flags_t flags, callback_t cbf, void* user, int notificationFrames, int sessionId) : mStatus(NO_INIT), mIsTimed(false), mPreviousPriority(ANDROID_PRIORITY_NORMAL), mPreviousSchedulingGroup(SP_DEFAULT) #ifdef QCOM_HARDWARE ,mAudioFlinger(NULL), mObserver(NULL) #endif { mStatus = set(streamType, sampleRate, format, channelMask, frameCount, flags, cbf, user, notificationFrames, 0 /*sharedBuffer*/, false /*threadCanCallJava*/, sessionId); } // DEPRECATED AudioTrack::AudioTrack( int streamType, uint32_t sampleRate, int format, int channelMask, int frameCount, uint32_t flags, callback_t cbf, void* user, int notificationFrames, int sessionId) : mStatus(NO_INIT), mIsTimed(false), mPreviousPriority(ANDROID_PRIORITY_NORMAL), mPreviousSchedulingGroup(SP_DEFAULT) #ifdef QCOM_HARDWARE ,mAudioFlinger(NULL), mObserver(NULL) #endif { mStatus = set((audio_stream_type_t)streamType, sampleRate, (audio_format_t)format, (audio_channel_mask_t) channelMask, frameCount, (audio_output_flags_t)flags, cbf, user, notificationFrames, 0 /*sharedBuffer*/, false /*threadCanCallJava*/, sessionId); } AudioTrack::AudioTrack( audio_stream_type_t streamType, uint32_t sampleRate, audio_format_t format, audio_channel_mask_t channelMask, const sp& sharedBuffer, audio_output_flags_t flags, callback_t cbf, void* user, int notificationFrames, int sessionId) : mStatus(NO_INIT), mIsTimed(false), mPreviousPriority(ANDROID_PRIORITY_NORMAL), mPreviousSchedulingGroup(SP_DEFAULT) #ifdef QCOM_HARDWARE ,mAudioFlinger(NULL), mObserver(NULL) #endif { mStatus = set(streamType, sampleRate, format, channelMask, 0 /*frameCount*/, flags, cbf, user, notificationFrames, sharedBuffer, false /*threadCanCallJava*/, sessionId); } AudioTrack::~AudioTrack() { ALOGV_IF(mSharedBuffer != 0, "Destructor sharedBuffer: %p", mSharedBuffer->pointer()); if (mStatus == NO_ERROR) { // Make sure that callback function exits in the case where // it is looping on buffer full condition in obtainBuffer(). // Otherwise the callback thread will never exit. stop(); if (mAudioTrackThread != 0) { mAudioTrackThread->requestExit(); // see comment in AudioTrack.h mAudioTrackThread->requestExitAndWait(); mAudioTrackThread.clear(); } #ifdef QCOM_HARDWARE if (mAudioTrack != 0) { mAudioTrack.clear(); AudioSystem::releaseAudioSessionId(mSessionId); } if (mDirectTrack != 0) { mDirectTrack.clear(); } #else mAudioTrack.clear(); #endif IPCThreadState::self()->flushCommands(); #ifndef QCOM_HARDWARE AudioSystem::releaseAudioSessionId(mSessionId); #endif } } status_t AudioTrack::set( audio_stream_type_t streamType, uint32_t sampleRate, audio_format_t format, audio_channel_mask_t channelMask, int frameCount, audio_output_flags_t flags, callback_t cbf, void* user, int notificationFrames, const sp& sharedBuffer, bool threadCanCallJava, int sessionId) { ALOGV_IF(sharedBuffer != 0, "sharedBuffer: %p, size: %d", sharedBuffer->pointer(), sharedBuffer->size()); ALOGV("set() streamType %d frameCount %d flags %04x", streamType, frameCount, flags); AutoMutex lock(mLock); if (mAudioTrack != 0) { ALOGE("Track already in use"); return INVALID_OPERATION; } // handle default values first. if (streamType == AUDIO_STREAM_DEFAULT) { streamType = AUDIO_STREAM_MUSIC; } if (sampleRate == 0) { int afSampleRate; if (AudioSystem::getOutputSamplingRate(&afSampleRate, streamType) != NO_ERROR) { return NO_INIT; } sampleRate = afSampleRate; } // these below should probably come from the audioFlinger too... if (format == AUDIO_FORMAT_DEFAULT) { format = AUDIO_FORMAT_PCM_16_BIT; } if (channelMask == 0) { channelMask = AUDIO_CHANNEL_OUT_STEREO; } // validate parameters if (!audio_is_valid_format(format)) { ALOGE("Invalid format"); return BAD_VALUE; } // AudioFlinger does not currently support 8-bit data in shared memory if (format == AUDIO_FORMAT_PCM_8_BIT && sharedBuffer != 0) { ALOGE("8-bit data in shared memory is not supported"); return BAD_VALUE; } // force direct flag if format is not linear PCM if (!audio_is_linear_pcm(format)) { flags = (audio_output_flags_t) // FIXME why can't we allow direct AND fast? ((flags | AUDIO_OUTPUT_FLAG_DIRECT) & ~AUDIO_OUTPUT_FLAG_FAST); } // only allow deep buffering for music stream type if (streamType != AUDIO_STREAM_MUSIC) { flags = (audio_output_flags_t)(flags &~AUDIO_OUTPUT_FLAG_DEEP_BUFFER); } #ifdef QCOM_ENHANCED_AUDIO if ((streamType == AUDIO_STREAM_VOICE_CALL) && (channelMask == AUDIO_CHANNEL_OUT_MONO) && ((sampleRate == 8000 || sampleRate == 16000))) { ALOGD("Turn on Direct Output for VOIP RX"); flags = (audio_output_flags_t)(flags | AUDIO_OUTPUT_FLAG_VOIP_RX|AUDIO_OUTPUT_FLAG_DIRECT); } #endif if (!audio_is_output_channel(channelMask)) { ALOGE("Invalid channel mask %#x", channelMask); return BAD_VALUE; } uint32_t channelCount = popcount(channelMask); ALOGV("AudioTrack getOutput streamType %d, sampleRate %d, format %d, channelMask %d, flags %x", streamType, sampleRate, format, channelMask, flags); audio_io_handle_t output = AudioSystem::getOutput( streamType, sampleRate, format, channelMask, flags); if (output == 0) { ALOGE("Could not get audio output for stream type %d", streamType); return BAD_VALUE; } mVolume[LEFT] = 1.0f; mVolume[RIGHT] = 1.0f; mSendLevel = 0.0f; mFrameCount = frameCount; mNotificationFramesReq = notificationFrames; mSessionId = sessionId; mAuxEffectId = 0; mFlags = flags; mCbf = cbf; #ifdef QCOM_HARDWARE if (flags & AUDIO_OUTPUT_FLAG_LPA || flags & AUDIO_OUTPUT_FLAG_TUNNEL) { ALOGV("Creating Direct Track"); const sp& audioFlinger = AudioSystem::get_audio_flinger(); if (audioFlinger == 0) { ALOGE("Could not get audioflinger"); return NO_INIT; } mAudioFlinger = audioFlinger; status_t status = NO_ERROR; mAudioDirectOutput = output; mDirectTrack = audioFlinger->createDirectTrack( getpid(), sampleRate, channelMask, mAudioDirectOutput, &mSessionId, this, streamType, &status); if(status != NO_ERROR) { ALOGE("createDirectTrack returned with status %d", status); return status; } mAudioTrack = NULL; mSharedBuffer = NULL; } else { #endif if (cbf != NULL) { mAudioTrackThread = new AudioTrackThread(*this, threadCanCallJava); mAudioTrackThread->run("AudioTrack", ANDROID_PRIORITY_AUDIO, 0 /*stack*/); } // create the IAudioTrack status_t status = createTrack_l(streamType, sampleRate, format, channelMask, frameCount, flags, sharedBuffer, output); if (status != NO_ERROR) { if (mAudioTrackThread != 0) { mAudioTrackThread->requestExit(); mAudioTrackThread.clear(); } return status; } #ifdef QCOM_HARDWARE AudioSystem::acquireAudioSessionId(mSessionId); mAudioDirectOutput = -1; mDirectTrack = NULL; mSharedBuffer = sharedBuffer; } mUserData = user; #endif mStatus = NO_ERROR; mStreamType = streamType; mFormat = format; mChannelMask = channelMask; mChannelCount = channelCount; mMuted = false; mActive = false; mLoopCount = 0; mMarkerPosition = 0; mMarkerReached = false; mNewPosition = 0; mUpdatePeriod = 0; mFlushed = false; #ifndef QCOM_HARDWARE mSharedBuffer = sharedBuffer; mUserData = user; AudioSystem::acquireAudioSessionId(mSessionId); #endif mRestoreStatus = NO_ERROR; return NO_ERROR; } status_t AudioTrack::initCheck() const { return mStatus; } // ------------------------------------------------------------------------- uint32_t AudioTrack::latency() const { #ifdef QCOM_HARDWARE if(mAudioDirectOutput != -1) { return mAudioFlinger->latency(mAudioDirectOutput); } #endif return mLatency; } audio_stream_type_t AudioTrack::streamType() const { return mStreamType; } audio_format_t AudioTrack::format() const { return mFormat; } int AudioTrack::channelCount() const { return mChannelCount; } uint32_t AudioTrack::frameCount() const { #ifdef QCOM_HARDWARE if(mAudioDirectOutput != -1) { return mAudioFlinger->frameCount(mAudioDirectOutput); } #endif return mCblk->frameCount; } size_t AudioTrack::frameSize() const { if (audio_is_linear_pcm(mFormat)) { return channelCount()*audio_bytes_per_sample(mFormat); } else { return sizeof(uint8_t); } } sp& AudioTrack::sharedBuffer() { return mSharedBuffer; } // ------------------------------------------------------------------------- void AudioTrack::start() { #ifdef QCOM_HARDWARE if (mDirectTrack != NULL) { if(mActive == 0) { mActive = 1; mDirectTrack->start(); } return; } #endif sp t = mAudioTrackThread; ALOGV("start %p", this); AutoMutex lock(mLock); // acquire a strong reference on the IMemory and IAudioTrack so that they cannot be destroyed // while we are accessing the cblk sp audioTrack = mAudioTrack; sp iMem = mCblkMemory; audio_track_cblk_t* cblk = mCblk; if (!mActive) { mFlushed = false; mActive = true; mNewPosition = cblk->server + mUpdatePeriod; cblk->lock.lock(); cblk->bufferTimeoutMs = MAX_STARTUP_TIMEOUT_MS; cblk->waitTimeMs = 0; android_atomic_and(~CBLK_DISABLED_ON, &cblk->flags); if (t != 0) { t->resume(); } else { mPreviousPriority = getpriority(PRIO_PROCESS, 0); get_sched_policy(0, &mPreviousSchedulingGroup); androidSetThreadPriority(0, ANDROID_PRIORITY_AUDIO); } ALOGV("start %p before lock cblk %p", this, mCblk); status_t status = NO_ERROR; if (!(cblk->flags & CBLK_INVALID_MSK)) { cblk->lock.unlock(); ALOGV("mAudioTrack->start()"); status = mAudioTrack->start(); cblk->lock.lock(); if (status == DEAD_OBJECT) { android_atomic_or(CBLK_INVALID_ON, &cblk->flags); } } if (cblk->flags & CBLK_INVALID_MSK) { status = restoreTrack_l(cblk, true); } cblk->lock.unlock(); if (status != NO_ERROR) { ALOGV("start() failed"); mActive = false; if (t != 0) { t->pause(); } else { setpriority(PRIO_PROCESS, 0, mPreviousPriority); set_sched_policy(0, mPreviousSchedulingGroup); } } } } void AudioTrack::stop() { sp t = mAudioTrackThread; ALOGV("stop %p", this); AutoMutex lock(mLock); if (mActive) { #ifdef QCOM_HARDWARE if(mDirectTrack != NULL) { mActive = false; mDirectTrack->stop(); } else if (mAudioTrack != NULL) { #endif mActive = false; mCblk->cv.signal(); mAudioTrack->stop(); // Cancel loops (If we are in the middle of a loop, playback // would not stop until loopCount reaches 0). setLoop_l(0, 0, 0); // the playback head position will reset to 0, so if a marker is set, we need // to activate it again mMarkerReached = false; // Force flush if a shared buffer is used otherwise audioflinger // will not stop before end of buffer is reached. if (mSharedBuffer != 0) { flush_l(); } if (t != 0) { t->pause(); } else { setpriority(PRIO_PROCESS, 0, mPreviousPriority); set_sched_policy(0, mPreviousSchedulingGroup); } #ifdef QCOM_HARDWARE } #endif } } bool AudioTrack::stopped() const { AutoMutex lock(mLock); return stopped_l(); } void AudioTrack::flush() { AutoMutex lock(mLock); #ifdef QCOM_HARDWARE if(mDirectTrack != NULL) { mDirectTrack->flush(); } else #endif flush_l(); } // must be called with mLock held void AudioTrack::flush_l() { ALOGV("flush"); // clear playback marker and periodic update counter mMarkerPosition = 0; mMarkerReached = false; mUpdatePeriod = 0; if (!mActive) { mFlushed = true; mAudioTrack->flush(); // Release AudioTrack callback thread in case it was waiting for new buffers // in AudioTrack::obtainBuffer() mCblk->cv.signal(); } } void AudioTrack::pause() { ALOGV("pause"); AutoMutex lock(mLock); if (mActive) { mActive = false; #ifdef QCOM_HARDWARE if(mDirectTrack != NULL) { ALOGV("mDirectTrack pause"); mDirectTrack->pause(); } else { #endif mCblk->cv.signal(); mAudioTrack->pause(); #ifdef QCOM_HARDWARE } #endif } } void AudioTrack::mute(bool e) { #ifdef QCOM_HARDWARE if(mDirectTrack != NULL) { mDirectTrack->mute(e); } else #endif mAudioTrack->mute(e); mMuted = e; } bool AudioTrack::muted() const { return mMuted; } status_t AudioTrack::setVolume(float left, float right) { if (left < 0.0f || left > 1.0f || right < 0.0f || right > 1.0f) { return BAD_VALUE; } AutoMutex lock(mLock); mVolume[LEFT] = left; mVolume[RIGHT] = right; #ifdef QCOM_HARDWARE if(mDirectTrack != NULL) { ALOGV("mDirectTrack->setVolume(left = %f , right = %f)", left,right); mDirectTrack->setVolume(left, right); } else #endif mCblk->setVolumeLR((uint32_t(uint16_t(right * 0x1000)) << 16) | uint16_t(left * 0x1000)); return NO_ERROR; } void AudioTrack::getVolume(float* left, float* right) const { if (left != NULL) { *left = mVolume[LEFT]; } if (right != NULL) { *right = mVolume[RIGHT]; } } status_t AudioTrack::setAuxEffectSendLevel(float level) { #ifdef QCOM_HARDWARE if (mDirectTrack != NULL) { return NO_ERROR; } #endif ALOGV("setAuxEffectSendLevel(%f)", level); if (level < 0.0f || level > 1.0f) { return BAD_VALUE; } AutoMutex lock(mLock); mSendLevel = level; mCblk->setSendLevel(level); return NO_ERROR; } void AudioTrack::getAuxEffectSendLevel(float* level) const { if (level != NULL) { *level = mSendLevel; } } status_t AudioTrack::setSampleRate(int rate) { int afSamplingRate; if (mIsTimed) { return INVALID_OPERATION; } if (AudioSystem::getOutputSamplingRate(&afSamplingRate, mStreamType) != NO_ERROR) { return NO_INIT; } // Resampler implementation limits input sampling rate to 2 x output sampling rate. if (rate <= 0 || rate > afSamplingRate*2 ) return BAD_VALUE; AutoMutex lock(mLock); mCblk->sampleRate = rate; return NO_ERROR; } uint32_t AudioTrack::getSampleRate() const { if (mIsTimed) { return INVALID_OPERATION; } AutoMutex lock(mLock); #ifdef QCOM_HARDWARE if(mAudioDirectOutput != -1) { return mAudioFlinger->sampleRate(mAudioDirectOutput); } #endif return mCblk->sampleRate; } status_t AudioTrack::setLoop(uint32_t loopStart, uint32_t loopEnd, int loopCount) { AutoMutex lock(mLock); return setLoop_l(loopStart, loopEnd, loopCount); } // must be called with mLock held status_t AudioTrack::setLoop_l(uint32_t loopStart, uint32_t loopEnd, int loopCount) { audio_track_cblk_t* cblk = mCblk; MotMutex::Autolock _l(cblk->lock); if (loopCount == 0) { cblk->loopStart = UINT_MAX; cblk->loopEnd = UINT_MAX; cblk->loopCount = 0; mLoopCount = 0; return NO_ERROR; } if (mIsTimed) { return INVALID_OPERATION; } if (loopStart >= loopEnd || loopEnd - loopStart > cblk->frameCount || cblk->server > loopStart) { ALOGE("setLoop invalid value: loopStart %d, loopEnd %d, loopCount %d, framecount %d, user %d", loopStart, loopEnd, loopCount, cblk->frameCount, cblk->user); return BAD_VALUE; } if ((mSharedBuffer != 0) && (loopEnd > cblk->frameCount)) { ALOGE("setLoop invalid value: loop markers beyond data: loopStart %d, loopEnd %d, framecount %d", loopStart, loopEnd, cblk->frameCount); return BAD_VALUE; } cblk->loopStart = loopStart; cblk->loopEnd = loopEnd; cblk->loopCount = loopCount; mLoopCount = loopCount; return NO_ERROR; } status_t AudioTrack::setMarkerPosition(uint32_t marker) { if (mCbf == NULL) return INVALID_OPERATION; mMarkerPosition = marker; mMarkerReached = false; return NO_ERROR; } status_t AudioTrack::getMarkerPosition(uint32_t *marker) const { if (marker == NULL) return BAD_VALUE; *marker = mMarkerPosition; return NO_ERROR; } status_t AudioTrack::setPositionUpdatePeriod(uint32_t updatePeriod) { if (mCbf == NULL) return INVALID_OPERATION; uint32_t curPosition; getPosition(&curPosition); mNewPosition = curPosition + updatePeriod; mUpdatePeriod = updatePeriod; return NO_ERROR; } status_t AudioTrack::getPositionUpdatePeriod(uint32_t *updatePeriod) const { if (updatePeriod == NULL) return BAD_VALUE; *updatePeriod = mUpdatePeriod; return NO_ERROR; } status_t AudioTrack::setPosition(uint32_t position) { if (mIsTimed) return INVALID_OPERATION; AutoMutex lock(mLock); if (!stopped_l()) return INVALID_OPERATION; MotMutex::Autolock _l(mCblk->lock); if (position > mCblk->user) return BAD_VALUE; mCblk->server = position; android_atomic_or(CBLK_FORCEREADY_ON, &mCblk->flags); return NO_ERROR; } status_t AudioTrack::getPosition(uint32_t *position) { if (position == NULL) return BAD_VALUE; AutoMutex lock(mLock); *position = mFlushed ? 0 : mCblk->server; return NO_ERROR; } status_t AudioTrack::reload() { AutoMutex lock(mLock); if (!stopped_l()) return INVALID_OPERATION; flush_l(); mCblk->stepUser(mCblk->frameCount); return NO_ERROR; } audio_io_handle_t AudioTrack::getOutput() { AutoMutex lock(mLock); return getOutput_l(); } // must be called with mLock held audio_io_handle_t AudioTrack::getOutput_l() { return AudioSystem::getOutput(mStreamType, mCblk->sampleRate, mFormat, mChannelMask, mFlags); } int AudioTrack::getSessionId() const { return mSessionId; } extern "C" int _ZNK7android10AudioTrack12getSessionIdEv(); extern "C" int _ZN7android10AudioTrack12getSessionIdEv() { return _ZNK7android10AudioTrack12getSessionIdEv(); } status_t AudioTrack::attachAuxEffect(int effectId) { ALOGV("attachAuxEffect(%d)", effectId); status_t status = mAudioTrack->attachAuxEffect(effectId); if (status == NO_ERROR) { mAuxEffectId = effectId; } return status; } // ------------------------------------------------------------------------- // must be called with mLock held status_t AudioTrack::createTrack_l( audio_stream_type_t streamType, uint32_t sampleRate, audio_format_t format, audio_channel_mask_t channelMask, int frameCount, audio_output_flags_t flags, const sp& sharedBuffer, audio_io_handle_t output) { status_t status; const sp& audioFlinger = AudioSystem::get_audio_flinger(); if (audioFlinger == 0) { ALOGE("Could not get audioflinger"); return NO_INIT; } uint32_t afLatency; if (AudioSystem::getLatency(output, streamType, &afLatency) != NO_ERROR) { return NO_INIT; } // Client decides whether the track is TIMED (see below), but can only express a preference // for FAST. Server will perform additional tests. if ((flags & AUDIO_OUTPUT_FLAG_FAST) && !( // either of these use cases: // use case 1: shared buffer (sharedBuffer != 0) || // use case 2: callback handler (mCbf != NULL))) { ALOGW("AUDIO_OUTPUT_FLAG_FAST denied by client"); // once denied, do not request again if IAudioTrack is re-created flags = (audio_output_flags_t) (flags & ~AUDIO_OUTPUT_FLAG_FAST); mFlags = flags; } ALOGV("createTrack_l() output %d afLatency %d", output, afLatency); mNotificationFramesAct = mNotificationFramesReq; if (!audio_is_linear_pcm(format)) { if (sharedBuffer != 0) { // Same comment as below about ignoring frameCount parameter for set() frameCount = sharedBuffer->size(); } else if (frameCount == 0) { int afFrameCount; if (AudioSystem::getFrameCount(output, streamType, &afFrameCount) != NO_ERROR) { return NO_INIT; } frameCount = afFrameCount; } } else if (sharedBuffer != 0) { // Ensure that buffer alignment matches channelCount int channelCount = popcount(channelMask); // 8-bit data in shared memory is not currently supported by AudioFlinger size_t alignment = /* format == AUDIO_FORMAT_PCM_8_BIT ? 1 : */ 2; if (channelCount > 1) { // More than 2 channels does not require stronger alignment than stereo alignment <<= 1; } if (((uint32_t)sharedBuffer->pointer() & (alignment - 1)) != 0) { ALOGE("Invalid buffer alignment: address %p, channelCount %d", sharedBuffer->pointer(), channelCount); return BAD_VALUE; } // When initializing a shared buffer AudioTrack via constructors, // there's no frameCount parameter. // But when initializing a shared buffer AudioTrack via set(), // there _is_ a frameCount parameter. We silently ignore it. frameCount = sharedBuffer->size()/channelCount/sizeof(int16_t); } else if (!(flags & AUDIO_OUTPUT_FLAG_FAST)) { // FIXME move these calculations and associated checks to server int afSampleRate; if (AudioSystem::getSamplingRate(output, streamType, &afSampleRate) != NO_ERROR) { return NO_INIT; } int afFrameCount; if (AudioSystem::getFrameCount(output, streamType, &afFrameCount) != NO_ERROR) { return NO_INIT; } // Ensure that buffer depth covers at least audio hardware latency uint32_t minBufCount = afLatency / ((1000 * afFrameCount)/afSampleRate); if (minBufCount < 2) minBufCount = 2; int minFrameCount = (afFrameCount*sampleRate*minBufCount)/afSampleRate; ALOGV("minFrameCount: %d, afFrameCount=%d, minBufCount=%d, sampleRate=%d, afSampleRate=%d" ", afLatency=%d", minFrameCount, afFrameCount, minBufCount, sampleRate, afSampleRate, afLatency); if (frameCount == 0) { frameCount = minFrameCount; } if (mNotificationFramesAct == 0) { mNotificationFramesAct = frameCount/2; } // Make sure that application is notified with sufficient margin // before underrun if (mNotificationFramesAct > (uint32_t)frameCount/2) { mNotificationFramesAct = frameCount/2; } if (frameCount < minFrameCount) { // not ALOGW because it happens all the time when playing key clicks over A2DP ALOGV("Minimum buffer size corrected from %d to %d", frameCount, minFrameCount); frameCount = minFrameCount; } } else { // For fast tracks, the frame count calculations and checks are done by server } IAudioFlinger::track_flags_t trackFlags = IAudioFlinger::TRACK_DEFAULT; if (mIsTimed) { trackFlags |= IAudioFlinger::TRACK_TIMED; } pid_t tid = -1; if (flags & AUDIO_OUTPUT_FLAG_FAST) { trackFlags |= IAudioFlinger::TRACK_FAST; // if (mAudioTrackThread != 0) { // tid = mAudioTrackThread->getTid(); // } } sp track = audioFlinger->createTrack(getpid(), streamType, sampleRate, format, channelMask, frameCount, trackFlags, sharedBuffer, output, tid, &mSessionId, &status); if (track == 0) { ALOGE("AudioFlinger could not create track, status: %d", status); return status; } sp cblk = track->getCblk(); if (cblk == 0) { ALOGE("Could not get control block"); return NO_INIT; } mAudioTrack = track; mCblkMemory = cblk; mCblk = static_cast(cblk->pointer()); // old has the previous value of mCblk->flags before the "or" operation int32_t old = android_atomic_or(CBLK_DIRECTION_OUT, &mCblk->flags); if (flags & AUDIO_OUTPUT_FLAG_FAST) { if (old & CBLK_FAST) { ALOGV("AUDIO_OUTPUT_FLAG_FAST successful; frameCount %u", mCblk->frameCount); } else { ALOGV("AUDIO_OUTPUT_FLAG_FAST denied by server; frameCount %u", mCblk->frameCount); // once denied, do not request again if IAudioTrack is re-created flags = (audio_output_flags_t) (flags & ~AUDIO_OUTPUT_FLAG_FAST); mFlags = flags; } if (sharedBuffer == 0) { mNotificationFramesAct = mCblk->frameCount/2; } } if (sharedBuffer == 0) { mCblk->buffers = (char*)mCblk + sizeof(audio_track_cblk_t); } else { mCblk->buffers = sharedBuffer->pointer(); // Force buffer full condition as data is already present in shared memory mCblk->stepUser(mCblk->frameCount); } mCblk->setVolumeLR((uint32_t(uint16_t(mVolume[RIGHT] * 0x1000)) << 16) | uint16_t(mVolume[LEFT] * 0x1000)); mCblk->setSendLevel(mSendLevel); mAudioTrack->attachAuxEffect(mAuxEffectId); mCblk->bufferTimeoutMs = MAX_STARTUP_TIMEOUT_MS; mCblk->waitTimeMs = 0; mRemainingFrames = mNotificationFramesAct; // FIXME don't believe this lie mLatency = afLatency + (1000*mCblk->frameCount) / sampleRate; // If IAudioTrack is re-created, don't let the requested frameCount // decrease. This can confuse clients that cache frameCount(). if (mCblk->frameCount > mFrameCount) { mFrameCount = mCblk->frameCount; } return NO_ERROR; } status_t AudioTrack::obtainBuffer(Buffer* audioBuffer, int32_t waitCount) { AutoMutex lock(mLock); bool active; status_t result = NO_ERROR; audio_track_cblk_t* cblk = mCblk; uint32_t framesReq = audioBuffer->frameCount; uint32_t waitTimeMs = (waitCount < 0) ? cblk->bufferTimeoutMs : WAIT_PERIOD_MS; audioBuffer->frameCount = 0; audioBuffer->size = 0; uint32_t framesAvail = cblk->framesAvailable(); cblk->lock.lock(); if (cblk->flags & CBLK_INVALID_MSK) { goto create_new_track; } cblk->lock.unlock(); if (framesAvail == 0) { cblk->lock.lock(); goto start_loop_here; while (framesAvail == 0) { active = mActive; if (CC_UNLIKELY(!active)) { ALOGV("Not active and NO_MORE_BUFFERS"); cblk->lock.unlock(); return NO_MORE_BUFFERS; } if (CC_UNLIKELY(!waitCount)) { cblk->lock.unlock(); return WOULD_BLOCK; } if (!(cblk->flags & CBLK_INVALID_MSK)) { mLock.unlock(); result = cblk->cv.waitRelative(cblk->lock, milliseconds(waitTimeMs)); cblk->lock.unlock(); mLock.lock(); if (!mActive) { return status_t(STOPPED); } cblk->lock.lock(); } if (cblk->flags & CBLK_INVALID_MSK) { goto create_new_track; } if (CC_UNLIKELY(result != NO_ERROR)) { cblk->waitTimeMs += waitTimeMs; if (cblk->waitTimeMs >= cblk->bufferTimeoutMs) { // timing out when a loop has been set and we have already written upto loop end // is a normal condition: no need to wake AudioFlinger up. if (cblk->user < cblk->loopEnd) { ALOGW( "obtainBuffer timed out (is the CPU pegged?) %p name=%#x" "user=%08x, server=%08x", this, cblk->mName, cblk->user, cblk->server); //unlock cblk mutex before calling mAudioTrack->start() (see issue #1617140) cblk->lock.unlock(); result = mAudioTrack->start(); cblk->lock.lock(); if (result == DEAD_OBJECT) { android_atomic_or(CBLK_INVALID_ON, &cblk->flags); create_new_track: result = restoreTrack_l(cblk, false); } if (result != NO_ERROR) { ALOGW("obtainBuffer create Track error %d", result); cblk->lock.unlock(); return result; } } cblk->waitTimeMs = 0; } if (--waitCount == 0) { cblk->lock.unlock(); return TIMED_OUT; } } // read the server count again start_loop_here: framesAvail = cblk->framesAvailable_l(); } cblk->lock.unlock(); } cblk->waitTimeMs = 0; if (framesReq > framesAvail) { framesReq = framesAvail; } uint32_t u = cblk->user; uint32_t bufferEnd = cblk->userBase + cblk->frameCount; if (framesReq > bufferEnd - u) { framesReq = bufferEnd - u; } audioBuffer->flags = mMuted ? Buffer::MUTE : 0; audioBuffer->channelCount = mChannelCount; audioBuffer->frameCount = framesReq; audioBuffer->size = framesReq * cblk->frameSize; if (audio_is_linear_pcm(mFormat)) { audioBuffer->format = AUDIO_FORMAT_PCM_16_BIT; } else { audioBuffer->format = mFormat; } audioBuffer->raw = (int8_t *)cblk->buffer(u); active = mActive; return active ? status_t(NO_ERROR) : status_t(STOPPED); } void AudioTrack::releaseBuffer(Buffer* audioBuffer) { AutoMutex lock(mLock); mCblk->stepUser(audioBuffer->frameCount); if (audioBuffer->frameCount > 0) { // restart track if it was disabled by audioflinger due to previous underrun if (mActive && (mCblk->flags & CBLK_DISABLED_MSK)) { android_atomic_and(~CBLK_DISABLED_ON, &mCblk->flags); ALOGW("releaseBuffer() track %p name=%#x disabled, restarting", this, mCblk->mName); mAudioTrack->start(); } } } // ------------------------------------------------------------------------- ssize_t AudioTrack::write(const void* buffer, size_t userSize) { #ifdef QCOM_HARDWARE if (mDirectTrack != NULL) { mDirectTrack->write(buffer,userSize); return userSize; } #endif if (mSharedBuffer != 0) return INVALID_OPERATION; if (mIsTimed) return INVALID_OPERATION; if (ssize_t(userSize) < 0) { // Sanity-check: user is most-likely passing an error code, and it would // make the return value ambiguous (actualSize vs error). ALOGE("AudioTrack::write(buffer=%p, size=%u (%d)", buffer, userSize, userSize); return BAD_VALUE; } ALOGV("write %p: %d bytes, mActive=%d", this, userSize, mActive); if (userSize == 0) { return 0; } // acquire a strong reference on the IMemory and IAudioTrack so that they cannot be destroyed // while we are accessing the cblk mLock.lock(); sp audioTrack = mAudioTrack; sp iMem = mCblkMemory; mLock.unlock(); ssize_t written = 0; const int8_t *src = (const int8_t *)buffer; Buffer audioBuffer; size_t frameSz = frameSize(); do { audioBuffer.frameCount = userSize/frameSz; status_t err = obtainBuffer(&audioBuffer, -1); if (err < 0) { // out of buffers, return #bytes written if (err == status_t(NO_MORE_BUFFERS)) break; return ssize_t(err); } size_t toWrite; if (mFormat == AUDIO_FORMAT_PCM_8_BIT && !(mFlags & AUDIO_OUTPUT_FLAG_DIRECT)) { // Divide capacity by 2 to take expansion into account toWrite = audioBuffer.size>>1; memcpy_to_i16_from_u8(audioBuffer.i16, (const uint8_t *) src, toWrite); } else { toWrite = audioBuffer.size; memcpy(audioBuffer.i8, src, toWrite); src += toWrite; } userSize -= toWrite; written += toWrite; releaseBuffer(&audioBuffer); } while (userSize >= frameSz); return written; } // ------------------------------------------------------------------------- TimedAudioTrack::TimedAudioTrack() { mIsTimed = true; } status_t TimedAudioTrack::allocateTimedBuffer(size_t size, sp* buffer) { status_t result = UNKNOWN_ERROR; // If the track is not invalid already, try to allocate a buffer. alloc // fails indicating that the server is dead, flag the track as invalid so // we can attempt to restore in just a bit. if (!(mCblk->flags & CBLK_INVALID_MSK)) { result = mAudioTrack->allocateTimedBuffer(size, buffer); if (result == DEAD_OBJECT) { android_atomic_or(CBLK_INVALID_ON, &mCblk->flags); } } // If the track is invalid at this point, attempt to restore it. and try the // allocation one more time. if (mCblk->flags & CBLK_INVALID_MSK) { mCblk->lock.lock(); result = restoreTrack_l(mCblk, false); mCblk->lock.unlock(); if (result == OK) result = mAudioTrack->allocateTimedBuffer(size, buffer); } return result; } status_t TimedAudioTrack::queueTimedBuffer(const sp& buffer, int64_t pts) { status_t status = mAudioTrack->queueTimedBuffer(buffer, pts); { AutoMutex lock(mLock); // restart track if it was disabled by audioflinger due to previous underrun if (buffer->size() != 0 && status == NO_ERROR && mActive && (mCblk->flags & CBLK_DISABLED_MSK)) { android_atomic_and(~CBLK_DISABLED_ON, &mCblk->flags); ALOGW("queueTimedBuffer() track %p disabled, restarting", this); mAudioTrack->start(); } } return status; } status_t TimedAudioTrack::setMediaTimeTransform(const LinearTransform& xform, TargetTimeline target) { return mAudioTrack->setMediaTimeTransform(xform, target); } // ------------------------------------------------------------------------- bool AudioTrack::processAudioBuffer(const sp& thread) { Buffer audioBuffer; uint32_t frames; size_t writtenSize; mLock.lock(); // acquire a strong reference on the IMemory and IAudioTrack so that they cannot be destroyed // while we are accessing the cblk sp audioTrack = mAudioTrack; sp iMem = mCblkMemory; audio_track_cblk_t* cblk = mCblk; bool active = mActive; mLock.unlock(); // Manage underrun callback if (active && (cblk->framesAvailable() == cblk->frameCount)) { ALOGV("Underrun user: %x, server: %x, flags %04x", cblk->user, cblk->server, cblk->flags); if (!(android_atomic_or(CBLK_UNDERRUN_ON, &cblk->flags) & CBLK_UNDERRUN_MSK)) { mCbf(EVENT_UNDERRUN, mUserData, 0); if (cblk->server == cblk->frameCount) { mCbf(EVENT_BUFFER_END, mUserData, 0); } if (mSharedBuffer != 0) return false; } } // Manage loop end callback while (mLoopCount > cblk->loopCount) { int loopCount = -1; mLoopCount--; if (mLoopCount >= 0) loopCount = mLoopCount; mCbf(EVENT_LOOP_END, mUserData, (void *)&loopCount); } // Manage marker callback if (!mMarkerReached && (mMarkerPosition > 0)) { if (cblk->server >= mMarkerPosition) { mCbf(EVENT_MARKER, mUserData, (void *)&mMarkerPosition); mMarkerReached = true; } } // Manage new position callback if (mUpdatePeriod > 0) { while (cblk->server >= mNewPosition) { mCbf(EVENT_NEW_POS, mUserData, (void *)&mNewPosition); mNewPosition += mUpdatePeriod; } } // If Shared buffer is used, no data is requested from client. if (mSharedBuffer != 0) { frames = 0; } else { frames = mRemainingFrames; } // See description of waitCount parameter at declaration of obtainBuffer(). // The logic below prevents us from being stuck below at obtainBuffer() // not being able to handle timed events (position, markers, loops). int32_t waitCount = -1; if (mUpdatePeriod || (!mMarkerReached && mMarkerPosition) || mLoopCount) { waitCount = 1; } do { audioBuffer.frameCount = frames; status_t err = obtainBuffer(&audioBuffer, waitCount); if (err < NO_ERROR) { if (err != TIMED_OUT) { ALOGE_IF(err != status_t(NO_MORE_BUFFERS), "Error obtaining an audio buffer, giving up."); return false; } break; } if (err == status_t(STOPPED)) return false; // Divide buffer size by 2 to take into account the expansion // due to 8 to 16 bit conversion: the callback must fill only half // of the destination buffer if (mFormat == AUDIO_FORMAT_PCM_8_BIT && !(mFlags & AUDIO_OUTPUT_FLAG_DIRECT)) { audioBuffer.size >>= 1; } size_t reqSize = audioBuffer.size; mCbf(EVENT_MORE_DATA, mUserData, &audioBuffer); writtenSize = audioBuffer.size; // Sanity check on returned size if (ssize_t(writtenSize) <= 0) { // The callback is done filling buffers // Keep this thread going to handle timed events and // still try to get more data in intervals of WAIT_PERIOD_MS // but don't just loop and block the CPU, so wait usleep(WAIT_PERIOD_MS*1000); break; } if (writtenSize > reqSize) writtenSize = reqSize; if (mFormat == AUDIO_FORMAT_PCM_8_BIT && !(mFlags & AUDIO_OUTPUT_FLAG_DIRECT)) { // 8 to 16 bit conversion, note that source and destination are the same address memcpy_to_i16_from_u8(audioBuffer.i16, (const uint8_t *) audioBuffer.i8, writtenSize); writtenSize <<= 1; } audioBuffer.size = writtenSize; // NOTE: mCblk->frameSize is not equal to AudioTrack::frameSize() for // 8 bit PCM data: in this case, mCblk->frameSize is based on a sample size of // 16 bit. audioBuffer.frameCount = writtenSize/mCblk->frameSize; frames -= audioBuffer.frameCount; releaseBuffer(&audioBuffer); } while (frames); if (frames == 0) { mRemainingFrames = mNotificationFramesAct; } else { mRemainingFrames = frames; } return true; } // must be called with mLock and cblk.lock held. Callers must also hold strong references on // the IAudioTrack and IMemory in case they are recreated here. // If the IAudioTrack is successfully restored, the cblk pointer is updated status_t AudioTrack::restoreTrack_l(audio_track_cblk_t*& cblk, bool fromStart) { status_t result; if (!(android_atomic_or(CBLK_RESTORING_ON, &cblk->flags) & CBLK_RESTORING_MSK)) { ALOGW("dead IAudioTrack, creating a new one from %s TID %d", fromStart ? "start()" : "obtainBuffer()", -1); // signal old cblk condition so that other threads waiting for available buffers stop // waiting now cblk->cv.broadcast(); cblk->lock.unlock(); // refresh the audio configuration cache in this process to make sure we get new // output parameters in getOutput_l() and createTrack_l() AudioSystem::clearAudioConfigCache(); // if the new IAudioTrack is created, createTrack_l() will modify the // following member variables: mAudioTrack, mCblkMemory and mCblk. // It will also delete the strong references on previous IAudioTrack and IMemory result = createTrack_l(mStreamType, cblk->sampleRate, mFormat, mChannelMask, mFrameCount, mFlags, mSharedBuffer, getOutput_l()); if (result == NO_ERROR) { uint32_t user = cblk->user; uint32_t server = cblk->server; // restore write index and set other indexes to reflect empty buffer status mCblk->user = user; mCblk->server = user; mCblk->userBase = user; mCblk->serverBase = user; // restore loop: this is not guaranteed to succeed if new frame count is not // compatible with loop length setLoop_l(cblk->loopStart, cblk->loopEnd, cblk->loopCount); if (!fromStart) { mCblk->bufferTimeoutMs = MAX_RUN_TIMEOUT_MS; // Make sure that a client relying on callback events indicating underrun or // the actual amount of audio frames played (e.g SoundPool) receives them. if (mSharedBuffer == 0) { uint32_t frames = 0; if (user > server) { frames = ((user - server) > mCblk->frameCount) ? mCblk->frameCount : (user - server); memset(mCblk->buffers, 0, frames * mCblk->frameSize); } // restart playback even if buffer is not completely filled. android_atomic_or(CBLK_FORCEREADY_ON, &mCblk->flags); // stepUser() clears CBLK_UNDERRUN_ON flag enabling underrun callbacks to // the client mCblk->stepUser(frames); } } if (mSharedBuffer != 0) { mCblk->stepUser(mCblk->frameCount); } if (mActive) { result = mAudioTrack->start(); ALOGW_IF(result != NO_ERROR, "restoreTrack_l() start() failed status %d", result); } if (fromStart && result == NO_ERROR) { mNewPosition = mCblk->server + mUpdatePeriod; } } if (result != NO_ERROR) { android_atomic_and(~CBLK_RESTORING_ON, &cblk->flags); ALOGW_IF(result != NO_ERROR, "restoreTrack_l() failed status %d", result); } mRestoreStatus = result; // signal old cblk condition for other threads waiting for restore completion android_atomic_or(CBLK_RESTORED_ON, &cblk->flags); cblk->cv.broadcast(); } else { if (!(cblk->flags & CBLK_RESTORED_MSK)) { ALOGW("dead IAudioTrack, waiting for a new one TID %d", -1); mLock.unlock(); result = cblk->cv.waitRelative(cblk->lock, milliseconds(RESTORE_TIMEOUT_MS)); if (result == NO_ERROR) { result = mRestoreStatus; } cblk->lock.unlock(); mLock.lock(); } else { ALOGW("dead IAudioTrack, already restored TID %d", -1); result = mRestoreStatus; cblk->lock.unlock(); } } ALOGV("restoreTrack_l() status %d mActive %d cblk %p, old cblk %p flags %08x old flags %08x", result, mActive, mCblk, cblk, mCblk->flags, cblk->flags); if (result == NO_ERROR) { // from now on we switch to the newly created cblk cblk = mCblk; } cblk->lock.lock(); ALOGW_IF(result != NO_ERROR, "restoreTrack_l() error %d TID %d", result, -1); return result; } status_t AudioTrack::dump(int fd, const Vector& args) const { const size_t SIZE = 256; char buffer[SIZE]; String8 result; result.append(" AudioTrack::dump\n"); snprintf(buffer, 255, " stream type(%d), left - right volume(%f, %f)\n", mStreamType, mVolume[0], mVolume[1]); result.append(buffer); snprintf(buffer, 255, " format(%d), channel count(%d), frame count(%d)\n", mFormat, mChannelCount, mCblk->frameCount); result.append(buffer); snprintf(buffer, 255, " sample rate(%d), status(%d), muted(%d)\n", (mCblk == 0) ? 0 : mCblk->sampleRate, mStatus, mMuted); result.append(buffer); snprintf(buffer, 255, " active(%d), latency (%d)\n", mActive, mLatency); result.append(buffer); ::write(fd, result.string(), result.size()); return NO_ERROR; } #ifdef QCOM_HARDWARE void AudioTrack::notify(int msg) { if (msg == EVENT_UNDERRUN) { ALOGV("Posting event underrun to Audio Sink."); mCbf(EVENT_UNDERRUN, mUserData, 0); } } status_t AudioTrack::getTimeStamp(uint64_t *tstamp) { if (mDirectTrack != NULL) { *tstamp = mDirectTrack->getTimeStamp(); ALOGV("Timestamp %lld ", *tstamp); } return NO_ERROR; } #endif // ========================================================================= AudioTrack::AudioTrackThread::AudioTrackThread(AudioTrack& receiver, bool bCanCallJava) : Thread(bCanCallJava), mReceiver(receiver), mPaused(true) { } AudioTrack::AudioTrackThread::~AudioTrackThread() { } bool AudioTrack::AudioTrackThread::threadLoop() { { AutoMutex _l(mMyLock); if (mPaused) { mMyCond.wait(mMyLock); // caller will check for exitPending() return true; } } if (!mReceiver.processAudioBuffer(this)) { pause(); } return true; } void AudioTrack::AudioTrackThread::requestExit() { // must be in this order to avoid a race condition Thread::requestExit(); resume(); } void AudioTrack::AudioTrackThread::pause() { AutoMutex _l(mMyLock); mPaused = true; } void AudioTrack::AudioTrackThread::resume() { AutoMutex _l(mMyLock); if (mPaused) { mPaused = false; mMyCond.signal(); } } // ========================================================================= audio_track_cblk_t::audio_track_cblk_t() : lock(MotMutex::SHARED), cv(Condition::SHARED), user(0), server(0), userBase(0), serverBase(0), buffers(NULL), frameCount(0), loopStart(UINT_MAX), loopEnd(UINT_MAX), loopCount(0), mVolumeLR(0x10001000), mSendLevel(0), flags(0) { } uint32_t audio_track_cblk_t::stepUser(uint32_t frameCount) { //ALOGV("stepuser %08x %08x %d", user, server, frameCount); uint32_t u = user; u += frameCount; // Ensure that user is never ahead of server for AudioRecord if (flags & CBLK_DIRECTION_MSK) { // If stepServer() has been called once, switch to normal obtainBuffer() timeout period if (bufferTimeoutMs == MAX_STARTUP_TIMEOUT_MS-1) { bufferTimeoutMs = MAX_RUN_TIMEOUT_MS; } } else if (u > server) { ALOGW("stepUser occurred after track reset"); u = server; } uint32_t fc = this->frameCount; if (u >= fc) { // common case, user didn't just wrap if (u - fc >= userBase ) { userBase += fc; } } else if (u >= userBase + fc) { // user just wrapped userBase += fc; } user = u; // Clear flow control error condition as new data has been written/read to/from buffer. if (flags & CBLK_UNDERRUN_MSK) { android_atomic_and(~CBLK_UNDERRUN_MSK, &flags); } return u; } bool audio_track_cblk_t::stepServer(uint32_t frameCount) { // ALOGV("stepserver %08x %08x %d", user, server, frameCount); if (!tryLock()) { ALOGW("stepServer() could not lock cblk"); return false; } uint32_t s = server; bool flushed = (s == user); s += frameCount; if (flags & CBLK_DIRECTION_MSK) { // Mark that we have read the first buffer so that next time stepUser() is called // we switch to normal obtainBuffer() timeout period if (bufferTimeoutMs == MAX_STARTUP_TIMEOUT_MS) { bufferTimeoutMs = MAX_STARTUP_TIMEOUT_MS - 1; } // It is possible that we receive a flush() // while the mixer is processing a block: in this case, // stepServer() is called After the flush() has reset u & s and // we have s > u if (flushed) { ALOGW("stepServer occurred after track reset"); s = user; } } if (s >= loopEnd) { ALOGW_IF(s > loopEnd, "stepServer: s %u > loopEnd %u", s, loopEnd); s = loopStart; if (--loopCount == 0) { loopEnd = UINT_MAX; loopStart = UINT_MAX; } } uint32_t fc = this->frameCount; if (s >= fc) { // common case, server didn't just wrap if (s - fc >= serverBase ) { serverBase += fc; } } else if (s >= serverBase + fc) { // server just wrapped serverBase += fc; } server = s; if (!(flags & CBLK_INVALID_MSK)) { cv.signal(); } lock.unlock(); return true; } void* audio_track_cblk_t::buffer(uint32_t offset) const { return (int8_t *)buffers + (offset - userBase) * frameSize; } uint32_t audio_track_cblk_t::framesAvailable() { MotMutex::Autolock _l(lock); return framesAvailable_l(); } uint32_t audio_track_cblk_t::framesAvailable_l() { uint32_t u = user; uint32_t s = server; if (flags & CBLK_DIRECTION_MSK) { uint32_t limit = (s < loopStart) ? s : loopStart; return limit + frameCount - u; } else { return frameCount + u - s; } } uint32_t audio_track_cblk_t::framesReady() { uint32_t u = user; uint32_t s = server; if (flags & CBLK_DIRECTION_MSK) { if (u < loopEnd) { return u - s; } else { // do not block on mutex shared with client on AudioFlinger side if (!tryLock()) { ALOGW("framesReady() could not lock cblk"); return 0; } uint32_t frames = UINT_MAX; if (loopCount >= 0) { frames = (loopEnd - loopStart)*loopCount + u - s; } lock.unlock(); return frames; } } else { return s - u; } } bool audio_track_cblk_t::tryLock() { // the code below simulates lock-with-timeout // we MUST do this to protect the AudioFlinger server // as this lock is shared with the client. status_t err; err = lock.tryLock(); if (err == -EBUSY) { // just wait a bit usleep(1000); err = lock.tryLock(); } if (err != NO_ERROR) { // probably, the client just died. return false; } return true; } // ------------------------------------------------------------------------- }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IMediaRecorder.cpp0000644000015700001700000003637512200324306025546 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2008, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "IMediaRecorder" #include #include #include #include #include #include #include #include namespace android { enum { RELEASE = IBinder::FIRST_CALL_TRANSACTION, INIT, CLOSE, QUERY_SURFACE_MEDIASOURCE, RESET, STOP, START, PREPARE, GET_MAX_AMPLITUDE, SET_VIDEO_SOURCE, SET_AUDIO_SOURCE, SET_OUTPUT_FORMAT, SET_VIDEO_ENCODER, SET_AUDIO_ENCODER, SET_OUTPUT_FILE_PATH, SET_OUTPUT_FILE_FD, SET_VIDEO_SIZE, SET_VIDEO_FRAMERATE, SET_PARAMETERS, SET_PREVIEW_SURFACE, SET_CAMERA, SET_LISTENER }; class BpMediaRecorder: public BpInterface { public: BpMediaRecorder(const sp& impl) : BpInterface(impl) { } status_t setCamera(const sp& camera, const sp& proxy) { ALOGV("setCamera(%p,%p)", camera.get(), proxy.get()); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); data.writeStrongBinder(camera->asBinder()); data.writeStrongBinder(proxy->asBinder()); remote()->transact(SET_CAMERA, data, &reply); return reply.readInt32(); } sp querySurfaceMediaSource() { ALOGV("Query SurfaceMediaSource"); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); remote()->transact(QUERY_SURFACE_MEDIASOURCE, data, &reply); int returnedNull = reply.readInt32(); if (returnedNull) { return NULL; } return interface_cast(reply.readStrongBinder()); } status_t setPreviewSurface(const sp& surface) { ALOGV("setPreviewSurface(%p)", surface.get()); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); Surface::writeToParcel(surface, &data); remote()->transact(SET_PREVIEW_SURFACE, data, &reply); return reply.readInt32(); } status_t init() { ALOGV("init"); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); remote()->transact(INIT, data, &reply); return reply.readInt32(); } status_t setVideoSource(int vs) { ALOGV("setVideoSource(%d)", vs); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); data.writeInt32(vs); remote()->transact(SET_VIDEO_SOURCE, data, &reply); return reply.readInt32(); } status_t setAudioSource(int as) { ALOGV("setAudioSource(%d)", as); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); data.writeInt32(as); remote()->transact(SET_AUDIO_SOURCE, data, &reply); return reply.readInt32(); } status_t setOutputFormat(int of) { ALOGV("setOutputFormat(%d)", of); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); data.writeInt32(of); remote()->transact(SET_OUTPUT_FORMAT, data, &reply); return reply.readInt32(); } status_t setVideoEncoder(int ve) { ALOGV("setVideoEncoder(%d)", ve); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); data.writeInt32(ve); remote()->transact(SET_VIDEO_ENCODER, data, &reply); return reply.readInt32(); } status_t setAudioEncoder(int ae) { ALOGV("setAudioEncoder(%d)", ae); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); data.writeInt32(ae); remote()->transact(SET_AUDIO_ENCODER, data, &reply); return reply.readInt32(); } status_t setOutputFile(const char* path) { ALOGV("setOutputFile(%s)", path); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); data.writeCString(path); remote()->transact(SET_OUTPUT_FILE_PATH, data, &reply); return reply.readInt32(); } status_t setOutputFile(int fd, int64_t offset, int64_t length) { ALOGV("setOutputFile(%d, %lld, %lld)", fd, offset, length); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); data.writeFileDescriptor(fd); data.writeInt64(offset); data.writeInt64(length); remote()->transact(SET_OUTPUT_FILE_FD, data, &reply); return reply.readInt32(); } status_t setVideoSize(int width, int height) { ALOGV("setVideoSize(%dx%d)", width, height); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); data.writeInt32(width); data.writeInt32(height); remote()->transact(SET_VIDEO_SIZE, data, &reply); return reply.readInt32(); } status_t setVideoFrameRate(int frames_per_second) { ALOGV("setVideoFrameRate(%d)", frames_per_second); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); data.writeInt32(frames_per_second); remote()->transact(SET_VIDEO_FRAMERATE, data, &reply); return reply.readInt32(); } status_t setParameters(const String8& params) { ALOGV("setParameter(%s)", params.string()); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); data.writeString8(params); remote()->transact(SET_PARAMETERS, data, &reply); return reply.readInt32(); } status_t setListener(const sp& listener) { ALOGV("setListener(%p)", listener.get()); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); data.writeStrongBinder(listener->asBinder()); remote()->transact(SET_LISTENER, data, &reply); return reply.readInt32(); } status_t prepare() { ALOGV("prepare"); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); remote()->transact(PREPARE, data, &reply); return reply.readInt32(); } status_t getMaxAmplitude(int* max) { ALOGV("getMaxAmplitude"); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); remote()->transact(GET_MAX_AMPLITUDE, data, &reply); *max = reply.readInt32(); return reply.readInt32(); } status_t start() { ALOGV("start"); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); remote()->transact(START, data, &reply); return reply.readInt32(); } status_t stop() { ALOGV("stop"); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); remote()->transact(STOP, data, &reply); return reply.readInt32(); } status_t reset() { ALOGV("reset"); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); remote()->transact(RESET, data, &reply); return reply.readInt32(); } status_t close() { ALOGV("close"); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); remote()->transact(CLOSE, data, &reply); return reply.readInt32(); } status_t release() { ALOGV("release"); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); remote()->transact(RELEASE, data, &reply); return reply.readInt32(); } }; IMPLEMENT_META_INTERFACE(MediaRecorder, "android.media.IMediaRecorder"); // ---------------------------------------------------------------------- status_t BnMediaRecorder::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case RELEASE: { ALOGV("RELEASE"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(release()); return NO_ERROR; } break; case INIT: { ALOGV("INIT"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(init()); return NO_ERROR; } break; case CLOSE: { ALOGV("CLOSE"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(close()); return NO_ERROR; } break; case RESET: { ALOGV("RESET"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(reset()); return NO_ERROR; } break; case STOP: { ALOGV("STOP"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(stop()); return NO_ERROR; } break; case START: { ALOGV("START"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(start()); return NO_ERROR; } break; case PREPARE: { ALOGV("PREPARE"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(prepare()); return NO_ERROR; } break; case GET_MAX_AMPLITUDE: { ALOGV("GET_MAX_AMPLITUDE"); CHECK_INTERFACE(IMediaRecorder, data, reply); int max = 0; status_t ret = getMaxAmplitude(&max); reply->writeInt32(max); reply->writeInt32(ret); return NO_ERROR; } break; case SET_VIDEO_SOURCE: { ALOGV("SET_VIDEO_SOURCE"); CHECK_INTERFACE(IMediaRecorder, data, reply); int vs = data.readInt32(); reply->writeInt32(setVideoSource(vs)); return NO_ERROR; } break; case SET_AUDIO_SOURCE: { ALOGV("SET_AUDIO_SOURCE"); CHECK_INTERFACE(IMediaRecorder, data, reply); int as = data.readInt32(); reply->writeInt32(setAudioSource(as)); return NO_ERROR; } break; case SET_OUTPUT_FORMAT: { ALOGV("SET_OUTPUT_FORMAT"); CHECK_INTERFACE(IMediaRecorder, data, reply); int of = data.readInt32(); reply->writeInt32(setOutputFormat(of)); return NO_ERROR; } break; case SET_VIDEO_ENCODER: { ALOGV("SET_VIDEO_ENCODER"); CHECK_INTERFACE(IMediaRecorder, data, reply); int ve = data.readInt32(); reply->writeInt32(setVideoEncoder(ve)); return NO_ERROR; } break; case SET_AUDIO_ENCODER: { ALOGV("SET_AUDIO_ENCODER"); CHECK_INTERFACE(IMediaRecorder, data, reply); int ae = data.readInt32(); reply->writeInt32(setAudioEncoder(ae)); return NO_ERROR; } break; case SET_OUTPUT_FILE_PATH: { ALOGV("SET_OUTPUT_FILE_PATH"); CHECK_INTERFACE(IMediaRecorder, data, reply); const char* path = data.readCString(); reply->writeInt32(setOutputFile(path)); return NO_ERROR; } break; case SET_OUTPUT_FILE_FD: { ALOGV("SET_OUTPUT_FILE_FD"); CHECK_INTERFACE(IMediaRecorder, data, reply); int fd = dup(data.readFileDescriptor()); int64_t offset = data.readInt64(); int64_t length = data.readInt64(); reply->writeInt32(setOutputFile(fd, offset, length)); ::close(fd); return NO_ERROR; } break; case SET_VIDEO_SIZE: { ALOGV("SET_VIDEO_SIZE"); CHECK_INTERFACE(IMediaRecorder, data, reply); int width = data.readInt32(); int height = data.readInt32(); reply->writeInt32(setVideoSize(width, height)); return NO_ERROR; } break; case SET_VIDEO_FRAMERATE: { ALOGV("SET_VIDEO_FRAMERATE"); CHECK_INTERFACE(IMediaRecorder, data, reply); int frames_per_second = data.readInt32(); reply->writeInt32(setVideoFrameRate(frames_per_second)); return NO_ERROR; } break; case SET_PARAMETERS: { ALOGV("SET_PARAMETER"); CHECK_INTERFACE(IMediaRecorder, data, reply); reply->writeInt32(setParameters(data.readString8())); return NO_ERROR; } break; case SET_LISTENER: { ALOGV("SET_LISTENER"); CHECK_INTERFACE(IMediaRecorder, data, reply); sp listener = interface_cast(data.readStrongBinder()); reply->writeInt32(setListener(listener)); return NO_ERROR; } break; case SET_PREVIEW_SURFACE: { ALOGV("SET_PREVIEW_SURFACE"); CHECK_INTERFACE(IMediaRecorder, data, reply); sp surface = Surface::readFromParcel(data); reply->writeInt32(setPreviewSurface(surface)); return NO_ERROR; } break; case SET_CAMERA: { ALOGV("SET_CAMERA"); CHECK_INTERFACE(IMediaRecorder, data, reply); sp camera = interface_cast(data.readStrongBinder()); sp proxy = interface_cast(data.readStrongBinder()); reply->writeInt32(setCamera(camera, proxy)); return NO_ERROR; } break; case QUERY_SURFACE_MEDIASOURCE: { ALOGV("QUERY_SURFACE_MEDIASOURCE"); CHECK_INTERFACE(IMediaRecorder, data, reply); // call the mediaserver side to create // a surfacemediasource sp surfaceMediaSource = querySurfaceMediaSource(); // The mediaserver might have failed to create a source int returnedNull= (surfaceMediaSource == NULL) ? 1 : 0 ; reply->writeInt32(returnedNull); if (!returnedNull) { reply->writeStrongBinder(surfaceMediaSource->asBinder()); } return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } } // ---------------------------------------------------------------------------- }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IAudioRecord.cpp0000644000015700001700000000617312200324306025232 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2007, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #define LOG_TAG "IAudioRecord" //#define LOG_NDEBUG 0 #include #include #include #include #include namespace android { enum { GET_CBLK = IBinder::FIRST_CALL_TRANSACTION, START, STOP }; class BpAudioRecord : public BpInterface { public: BpAudioRecord(const sp& impl) : BpInterface(impl) { } virtual status_t start(int /*AudioSystem::sync_event_t*/ event, int triggerSession) { Parcel data, reply; data.writeInterfaceToken(IAudioRecord::getInterfaceDescriptor()); data.writeInt32(event); data.writeInt32(triggerSession); status_t status = remote()->transact(START, data, &reply); if (status == NO_ERROR) { status = reply.readInt32(); } else { ALOGW("start() error: %s", strerror(-status)); } return status; } virtual void stop() { Parcel data, reply; data.writeInterfaceToken(IAudioRecord::getInterfaceDescriptor()); remote()->transact(STOP, data, &reply); } virtual sp getCblk() const { Parcel data, reply; sp cblk; data.writeInterfaceToken(IAudioRecord::getInterfaceDescriptor()); status_t status = remote()->transact(GET_CBLK, data, &reply); if (status == NO_ERROR) { cblk = interface_cast(reply.readStrongBinder()); } return cblk; } }; IMPLEMENT_META_INTERFACE(AudioRecord, "android.media.IAudioRecord"); // ---------------------------------------------------------------------- status_t BnAudioRecord::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case GET_CBLK: { CHECK_INTERFACE(IAudioRecord, data, reply); reply->writeStrongBinder(getCblk()->asBinder()); return NO_ERROR; } break; case START: { CHECK_INTERFACE(IAudioRecord, data, reply); int /*AudioSystem::sync_event_t*/ event = data.readInt32(); int triggerSession = data.readInt32(); reply->writeInt32(start(event, triggerSession)); return NO_ERROR; } break; case STOP: { CHECK_INTERFACE(IAudioRecord, data, reply); stop(); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IMediaPlayer.cpp0000644000015700001700000004344212200324306025226 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2008, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include #include #include #include #include #include #include #include namespace android { enum { DISCONNECT = IBinder::FIRST_CALL_TRANSACTION, SET_DATA_SOURCE_URL, SET_DATA_SOURCE_FD, SET_DATA_SOURCE_STREAM, PREPARE_ASYNC, START, STOP, IS_PLAYING, PAUSE, SEEK_TO, GET_CURRENT_POSITION, GET_DURATION, RESET, SET_AUDIO_STREAM_TYPE, SET_LOOPING, SET_VOLUME, INVOKE, SET_METADATA_FILTER, GET_METADATA, SET_AUX_EFFECT_SEND_LEVEL, ATTACH_AUX_EFFECT, SET_VIDEO_SURFACETEXTURE, SET_PARAMETER, GET_PARAMETER, SET_RETRANSMIT_ENDPOINT, GET_RETRANSMIT_ENDPOINT, SET_NEXT_PLAYER, }; class BpMediaPlayer: public BpInterface { public: BpMediaPlayer(const sp& impl) : BpInterface(impl) { } // disconnect from media player service void disconnect() { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); remote()->transact(DISCONNECT, data, &reply); } status_t setDataSource(const char* url, const KeyedVector* headers) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); data.writeCString(url); if (headers == NULL) { data.writeInt32(0); } else { // serialize the headers data.writeInt32(headers->size()); for (size_t i = 0; i < headers->size(); ++i) { data.writeString8(headers->keyAt(i)); data.writeString8(headers->valueAt(i)); } } remote()->transact(SET_DATA_SOURCE_URL, data, &reply); return reply.readInt32(); } status_t setDataSource(int fd, int64_t offset, int64_t length) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); data.writeFileDescriptor(fd); data.writeInt64(offset); data.writeInt64(length); remote()->transact(SET_DATA_SOURCE_FD, data, &reply); return reply.readInt32(); } status_t setDataSource(const sp &source) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); data.writeStrongBinder(source->asBinder()); remote()->transact(SET_DATA_SOURCE_STREAM, data, &reply); return reply.readInt32(); } // pass the buffered ISurfaceTexture to the media player service status_t setVideoSurfaceTexture(const sp& surfaceTexture) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); sp b(surfaceTexture->asBinder()); data.writeStrongBinder(b); remote()->transact(SET_VIDEO_SURFACETEXTURE, data, &reply); return reply.readInt32(); } status_t prepareAsync() { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); remote()->transact(PREPARE_ASYNC, data, &reply); return reply.readInt32(); } status_t start() { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); remote()->transact(START, data, &reply); return reply.readInt32(); } status_t stop() { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); remote()->transact(STOP, data, &reply); return reply.readInt32(); } status_t isPlaying(bool* state) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); remote()->transact(IS_PLAYING, data, &reply); *state = reply.readInt32(); return reply.readInt32(); } status_t pause() { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); remote()->transact(PAUSE, data, &reply); return reply.readInt32(); } status_t seekTo(int msec) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); data.writeInt32(msec); remote()->transact(SEEK_TO, data, &reply); return reply.readInt32(); } status_t getCurrentPosition(int* msec) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); remote()->transact(GET_CURRENT_POSITION, data, &reply); *msec = reply.readInt32(); return reply.readInt32(); } status_t getDuration(int* msec) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); remote()->transact(GET_DURATION, data, &reply); *msec = reply.readInt32(); return reply.readInt32(); } status_t reset() { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); remote()->transact(RESET, data, &reply); return reply.readInt32(); } status_t setAudioStreamType(audio_stream_type_t stream) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); data.writeInt32((int32_t) stream); remote()->transact(SET_AUDIO_STREAM_TYPE, data, &reply); return reply.readInt32(); } status_t setLooping(int loop) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); data.writeInt32(loop); remote()->transact(SET_LOOPING, data, &reply); return reply.readInt32(); } status_t setVolume(float leftVolume, float rightVolume) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); data.writeFloat(leftVolume); data.writeFloat(rightVolume); remote()->transact(SET_VOLUME, data, &reply); return reply.readInt32(); } status_t invoke(const Parcel& request, Parcel *reply) { // Avoid doing any extra copy. The interface descriptor should // have been set by MediaPlayer.java. return remote()->transact(INVOKE, request, reply); } status_t setMetadataFilter(const Parcel& request) { Parcel reply; // Avoid doing any extra copy of the request. The interface // descriptor should have been set by MediaPlayer.java. remote()->transact(SET_METADATA_FILTER, request, &reply); return reply.readInt32(); } status_t getMetadata(bool update_only, bool apply_filter, Parcel *reply) { Parcel request; request.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); // TODO: Burning 2 ints for 2 boolean. Should probably use flags in an int here. request.writeInt32(update_only); request.writeInt32(apply_filter); remote()->transact(GET_METADATA, request, reply); return reply->readInt32(); } status_t setAuxEffectSendLevel(float level) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); data.writeFloat(level); remote()->transact(SET_AUX_EFFECT_SEND_LEVEL, data, &reply); return reply.readInt32(); } status_t attachAuxEffect(int effectId) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); data.writeInt32(effectId); remote()->transact(ATTACH_AUX_EFFECT, data, &reply); return reply.readInt32(); } status_t setParameter(int key, const Parcel& request) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); data.writeInt32(key); if (request.dataSize() > 0) { data.appendFrom(const_cast(&request), 0, request.dataSize()); } remote()->transact(SET_PARAMETER, data, &reply); return reply.readInt32(); } status_t getParameter(int key, Parcel *reply) { Parcel data; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); data.writeInt32(key); return remote()->transact(GET_PARAMETER, data, reply); } status_t setRetransmitEndpoint(const struct sockaddr_in* endpoint) { Parcel data, reply; status_t err; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); if (NULL != endpoint) { data.writeInt32(sizeof(*endpoint)); data.write(endpoint, sizeof(*endpoint)); } else { data.writeInt32(0); } err = remote()->transact(SET_RETRANSMIT_ENDPOINT, data, &reply); if (OK != err) { return err; } return reply.readInt32(); } status_t setNextPlayer(const sp& player) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); sp b(player->asBinder()); data.writeStrongBinder(b); remote()->transact(SET_NEXT_PLAYER, data, &reply); return reply.readInt32(); } status_t getRetransmitEndpoint(struct sockaddr_in* endpoint) { Parcel data, reply; status_t err; data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor()); err = remote()->transact(GET_RETRANSMIT_ENDPOINT, data, &reply); if ((OK != err) || (OK != (err = reply.readInt32()))) { return err; } data.read(endpoint, sizeof(*endpoint)); return err; } }; IMPLEMENT_META_INTERFACE(MediaPlayer, "android.media.IMediaPlayer"); // ---------------------------------------------------------------------- status_t BnMediaPlayer::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case DISCONNECT: { CHECK_INTERFACE(IMediaPlayer, data, reply); disconnect(); return NO_ERROR; } break; case SET_DATA_SOURCE_URL: { CHECK_INTERFACE(IMediaPlayer, data, reply); const char* url = data.readCString(); KeyedVector headers; int32_t numHeaders = data.readInt32(); for (int i = 0; i < numHeaders; ++i) { String8 key = data.readString8(); String8 value = data.readString8(); headers.add(key, value); } reply->writeInt32(setDataSource(url, numHeaders > 0 ? &headers : NULL)); return NO_ERROR; } break; case SET_DATA_SOURCE_FD: { CHECK_INTERFACE(IMediaPlayer, data, reply); int fd = data.readFileDescriptor(); int64_t offset = data.readInt64(); int64_t length = data.readInt64(); reply->writeInt32(setDataSource(fd, offset, length)); return NO_ERROR; } case SET_DATA_SOURCE_STREAM: { CHECK_INTERFACE(IMediaPlayer, data, reply); sp source = interface_cast(data.readStrongBinder()); reply->writeInt32(setDataSource(source)); return NO_ERROR; } case SET_VIDEO_SURFACETEXTURE: { CHECK_INTERFACE(IMediaPlayer, data, reply); sp surfaceTexture = interface_cast(data.readStrongBinder()); reply->writeInt32(setVideoSurfaceTexture(surfaceTexture)); return NO_ERROR; } break; case PREPARE_ASYNC: { CHECK_INTERFACE(IMediaPlayer, data, reply); reply->writeInt32(prepareAsync()); return NO_ERROR; } break; case START: { CHECK_INTERFACE(IMediaPlayer, data, reply); reply->writeInt32(start()); return NO_ERROR; } break; case STOP: { CHECK_INTERFACE(IMediaPlayer, data, reply); reply->writeInt32(stop()); return NO_ERROR; } break; case IS_PLAYING: { CHECK_INTERFACE(IMediaPlayer, data, reply); bool state; status_t ret = isPlaying(&state); reply->writeInt32(state); reply->writeInt32(ret); return NO_ERROR; } break; case PAUSE: { CHECK_INTERFACE(IMediaPlayer, data, reply); reply->writeInt32(pause()); return NO_ERROR; } break; case SEEK_TO: { CHECK_INTERFACE(IMediaPlayer, data, reply); reply->writeInt32(seekTo(data.readInt32())); return NO_ERROR; } break; case GET_CURRENT_POSITION: { CHECK_INTERFACE(IMediaPlayer, data, reply); int msec; status_t ret = getCurrentPosition(&msec); reply->writeInt32(msec); reply->writeInt32(ret); return NO_ERROR; } break; case GET_DURATION: { CHECK_INTERFACE(IMediaPlayer, data, reply); int msec; status_t ret = getDuration(&msec); reply->writeInt32(msec); reply->writeInt32(ret); return NO_ERROR; } break; case RESET: { CHECK_INTERFACE(IMediaPlayer, data, reply); reply->writeInt32(reset()); return NO_ERROR; } break; case SET_AUDIO_STREAM_TYPE: { CHECK_INTERFACE(IMediaPlayer, data, reply); reply->writeInt32(setAudioStreamType((audio_stream_type_t) data.readInt32())); return NO_ERROR; } break; case SET_LOOPING: { CHECK_INTERFACE(IMediaPlayer, data, reply); reply->writeInt32(setLooping(data.readInt32())); return NO_ERROR; } break; case SET_VOLUME: { CHECK_INTERFACE(IMediaPlayer, data, reply); float leftVolume = data.readFloat(); float rightVolume = data.readFloat(); reply->writeInt32(setVolume(leftVolume, rightVolume)); return NO_ERROR; } break; case INVOKE: { CHECK_INTERFACE(IMediaPlayer, data, reply); status_t result = invoke(data, reply); return result; } break; case SET_METADATA_FILTER: { CHECK_INTERFACE(IMediaPlayer, data, reply); reply->writeInt32(setMetadataFilter(data)); return NO_ERROR; } break; case GET_METADATA: { CHECK_INTERFACE(IMediaPlayer, data, reply); bool update_only = static_cast(data.readInt32()); bool apply_filter = static_cast(data.readInt32()); const status_t retcode = getMetadata(update_only, apply_filter, reply); reply->setDataPosition(0); reply->writeInt32(retcode); reply->setDataPosition(0); return NO_ERROR; } break; case SET_AUX_EFFECT_SEND_LEVEL: { CHECK_INTERFACE(IMediaPlayer, data, reply); reply->writeInt32(setAuxEffectSendLevel(data.readFloat())); return NO_ERROR; } break; case ATTACH_AUX_EFFECT: { CHECK_INTERFACE(IMediaPlayer, data, reply); reply->writeInt32(attachAuxEffect(data.readInt32())); return NO_ERROR; } break; case SET_PARAMETER: { CHECK_INTERFACE(IMediaPlayer, data, reply); int key = data.readInt32(); Parcel request; if (data.dataAvail() > 0) { request.appendFrom( const_cast(&data), data.dataPosition(), data.dataAvail()); } request.setDataPosition(0); reply->writeInt32(setParameter(key, request)); return NO_ERROR; } break; case GET_PARAMETER: { CHECK_INTERFACE(IMediaPlayer, data, reply); return getParameter(data.readInt32(), reply); } break; case SET_RETRANSMIT_ENDPOINT: { CHECK_INTERFACE(IMediaPlayer, data, reply); struct sockaddr_in endpoint; int amt = data.readInt32(); if (amt == sizeof(endpoint)) { data.read(&endpoint, sizeof(struct sockaddr_in)); reply->writeInt32(setRetransmitEndpoint(&endpoint)); } else { reply->writeInt32(setRetransmitEndpoint(NULL)); } return NO_ERROR; } break; case GET_RETRANSMIT_ENDPOINT: { CHECK_INTERFACE(IMediaPlayer, data, reply); struct sockaddr_in endpoint; status_t res = getRetransmitEndpoint(&endpoint); reply->writeInt32(res); reply->write(&endpoint, sizeof(endpoint)); return NO_ERROR; } break; case SET_NEXT_PLAYER: { CHECK_INTERFACE(IMediaPlayer, data, reply); reply->writeInt32(setNextPlayer(interface_cast(data.readStrongBinder()))); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } } // ---------------------------------------------------------------------------- }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IMediaDeathNotifier.cpp0000644000015700001700000000664612200324306026524 0ustar pbuserpbgroup00000000000000/* ** Copyright 2010, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "IMediaDeathNotifier" #include #include #include #include namespace android { // client singleton for binder interface to services Mutex IMediaDeathNotifier::sServiceLock; sp IMediaDeathNotifier::sMediaPlayerService; sp IMediaDeathNotifier::sDeathNotifier; SortedVector< wp > IMediaDeathNotifier::sObitRecipients; // establish binder interface to MediaPlayerService /*static*/const sp& IMediaDeathNotifier::getMediaPlayerService() { ALOGV("getMediaPlayerService"); Mutex::Autolock _l(sServiceLock); if (sMediaPlayerService == 0) { sp sm = defaultServiceManager(); sp binder; do { binder = sm->getService(String16("media.player")); if (binder != 0) { break; } ALOGW("Media player service not published, waiting..."); usleep(500000); // 0.5 s } while (true); if (sDeathNotifier == NULL) { sDeathNotifier = new DeathNotifier(); } binder->linkToDeath(sDeathNotifier); sMediaPlayerService = interface_cast(binder); } ALOGE_IF(sMediaPlayerService == 0, "no media player service!?"); return sMediaPlayerService; } /*static*/ void IMediaDeathNotifier::addObitRecipient(const wp& recipient) { ALOGV("addObitRecipient"); Mutex::Autolock _l(sServiceLock); sObitRecipients.add(recipient); } /*static*/ void IMediaDeathNotifier::removeObitRecipient(const wp& recipient) { ALOGV("removeObitRecipient"); Mutex::Autolock _l(sServiceLock); sObitRecipients.remove(recipient); } void IMediaDeathNotifier::DeathNotifier::binderDied(const wp& who) { ALOGW("media server died"); // Need to do this with the lock held SortedVector< wp > list; { Mutex::Autolock _l(sServiceLock); sMediaPlayerService.clear(); list = sObitRecipients; } // Notify application when media server dies. // Don't hold the static lock during callback in case app // makes a call that needs the lock. size_t count = list.size(); for (size_t iter = 0; iter < count; ++iter) { sp notifier = list[iter].promote(); if (notifier != 0) { notifier->died(); } } } IMediaDeathNotifier::DeathNotifier::~DeathNotifier() { ALOGV("DeathNotifier::~DeathNotifier"); Mutex::Autolock _l(sServiceLock); sObitRecipients.clear(); if (sMediaPlayerService != 0) { sMediaPlayerService->asBinder()->unlinkToDeath(this); } } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IDirectTrackClient.cpp0000644000015700001700000000377712200324306026377 0ustar pbuserpbgroup00000000000000/* ** Copyright (c) 2012, The Linux Foundation. All rights reserved. ** Not a Contribution, Apache license notifications and license are retained ** for attribution purposes only. ** ** Copyright 2007, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include #include #include #include namespace android { enum { NOTIFY = IBinder::FIRST_CALL_TRANSACTION, }; class BpDirectTrackClient: public BpInterface { public: BpDirectTrackClient(const sp& impl) : BpInterface(impl) { } virtual void notify(int msg) { Parcel data, reply; data.writeInterfaceToken(IDirectTrackClient::getInterfaceDescriptor()); data.writeInt32(msg); remote()->transact(NOTIFY, data, &reply, IBinder::FLAG_ONEWAY); } }; IMPLEMENT_META_INTERFACE(DirectTrackClient, "android.media.IDirectTrackClient"); // ---------------------------------------------------------------------- status_t BnDirectTrackClient::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case NOTIFY: { CHECK_INTERFACE(IDirectTrackClient, data, reply); int msg = data.readInt32(); notify(msg); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IEffectClient.cpp0000644000015700001700000001064412200324306025363 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2010, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "IEffectClient" #include #include #include #include namespace android { enum { CONTROL_STATUS_CHANGED = IBinder::FIRST_CALL_TRANSACTION, ENABLE_STATUS_CHANGED, COMMAND_EXECUTED }; class BpEffectClient: public BpInterface { public: BpEffectClient(const sp& impl) : BpInterface(impl) { } void controlStatusChanged(bool controlGranted) { ALOGV("controlStatusChanged"); Parcel data, reply; data.writeInterfaceToken(IEffectClient::getInterfaceDescriptor()); data.writeInt32((uint32_t)controlGranted); remote()->transact(CONTROL_STATUS_CHANGED, data, &reply, IBinder::FLAG_ONEWAY); } void enableStatusChanged(bool enabled) { ALOGV("enableStatusChanged"); Parcel data, reply; data.writeInterfaceToken(IEffectClient::getInterfaceDescriptor()); data.writeInt32((uint32_t)enabled); remote()->transact(ENABLE_STATUS_CHANGED, data, &reply, IBinder::FLAG_ONEWAY); } void commandExecuted(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, uint32_t replySize, void *pReplyData) { ALOGV("commandExecuted"); Parcel data, reply; data.writeInterfaceToken(IEffectClient::getInterfaceDescriptor()); data.writeInt32(cmdCode); int size = cmdSize; if (pCmdData == NULL) { size = 0; } data.writeInt32(size); if (size) { data.write(pCmdData, size); } size = replySize; if (pReplyData == NULL) { size = 0; } data.writeInt32(size); if (size) { data.write(pReplyData, size); } remote()->transact(COMMAND_EXECUTED, data, &reply, IBinder::FLAG_ONEWAY); } }; IMPLEMENT_META_INTERFACE(EffectClient, "android.media.IEffectClient"); // ---------------------------------------------------------------------- status_t BnEffectClient::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case CONTROL_STATUS_CHANGED: { ALOGV("CONTROL_STATUS_CHANGED"); CHECK_INTERFACE(IEffectClient, data, reply); bool hasControl = (bool)data.readInt32(); controlStatusChanged(hasControl); return NO_ERROR; } break; case ENABLE_STATUS_CHANGED: { ALOGV("ENABLE_STATUS_CHANGED"); CHECK_INTERFACE(IEffectClient, data, reply); bool enabled = (bool)data.readInt32(); enableStatusChanged(enabled); return NO_ERROR; } break; case COMMAND_EXECUTED: { ALOGV("COMMAND_EXECUTED"); CHECK_INTERFACE(IEffectClient, data, reply); uint32_t cmdCode = data.readInt32(); uint32_t cmdSize = data.readInt32(); char *cmd = NULL; if (cmdSize) { cmd = (char *)malloc(cmdSize); data.read(cmd, cmdSize); } uint32_t replySize = data.readInt32(); char *resp = NULL; if (replySize) { resp = (char *)malloc(replySize); data.read(resp, replySize); } commandExecuted(cmdCode, cmdSize, cmd, replySize, resp); if (cmd) { free(cmd); } if (resp) { free(resp); } return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } } // ---------------------------------------------------------------------------- }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/Android.mk0000644000015700001700000000413612200324306024123 0ustar pbuserpbgroup00000000000000LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ AudioParameter.cpp LOCAL_MODULE:= libmedia_helper LOCAL_MODULE_TAGS := optional include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) ifeq ($(BOARD_USES_QCOM_HARDWARE),true) LOCAL_SRC_FILES:= AudioParameter.cpp LOCAL_MODULE:= libaudioparameter LOCAL_MODULE_TAGS := optional LOCAL_SHARED_LIBRARIES := libutils include $(BUILD_SHARED_LIBRARY) include $(CLEAR_VARS) endif LOCAL_SRC_FILES:= \ AudioTrack.cpp \ IAudioFlinger.cpp \ IAudioFlingerClient.cpp \ IAudioTrack.cpp \ IAudioRecord.cpp \ ICrypto.cpp \ IHDCP.cpp \ AudioRecord.cpp \ AudioSystem.cpp \ mediaplayer.cpp \ IMediaPlayerService.cpp \ IMediaPlayerClient.cpp \ IMediaRecorderClient.cpp \ IMediaPlayer.cpp \ IMediaRecorder.cpp \ IRemoteDisplay.cpp \ IRemoteDisplayClient.cpp \ IStreamSource.cpp \ Metadata.cpp \ mediarecorder.cpp \ IMediaMetadataRetriever.cpp \ mediametadataretriever.cpp \ ToneGenerator.cpp \ JetPlayer.cpp \ IOMX.cpp \ IAudioPolicyService.cpp \ MediaScanner.cpp \ MediaScannerClient.cpp \ autodetect.cpp \ IMediaDeathNotifier.cpp \ MediaProfiles.cpp \ IEffect.cpp \ IEffectClient.cpp \ AudioEffect.cpp \ Visualizer.cpp \ MemoryLeakTrackUtil.cpp \ SoundPool.cpp \ SoundPoolThread.cpp ifeq ($(BOARD_USES_QCOM_HARDWARE),true) LOCAL_SRC_FILES += \ IDirectTrack.cpp \ IDirectTrackClient.cpp ifeq ($(TARGET_QCOM_AUDIO_VARIANT),caf) LOCAL_CFLAGS += -DQCOM_ENHANCED_AUDIO endif endif LOCAL_SHARED_LIBRARIES := \ libui libcutils libutils libbinder libsonivox libicuuc libexpat \ libcamera_client libstagefright_foundation \ libgui libdl libaudioutils libmedia_native LOCAL_WHOLE_STATIC_LIBRARY := libmedia_helper LOCAL_MODULE:= libmedia LOCAL_C_INCLUDES := \ $(call include-path-for, graphics corecg) \ $(TOP)/frameworks/native/include/media/openmax \ external/icu4c/common \ $(call include-path-for, audio-effects) \ $(call include-path-for, audio-utils) include $(BUILD_SHARED_LIBRARY) android-audiosystem-1.8+13.10.20130807/lib/libmedia/MediaScannerClient.cpp0000644000015700001700000001562412200324306026412 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include "autodetect.h" #include "unicode/ucnv.h" #include "unicode/ustring.h" namespace android { MediaScannerClient::MediaScannerClient() : mNames(NULL), mValues(NULL), mLocaleEncoding(kEncodingNone) { } MediaScannerClient::~MediaScannerClient() { delete mNames; delete mValues; } void MediaScannerClient::setLocale(const char* locale) { if (!locale) return; if (!strncmp(locale, "ja", 2)) mLocaleEncoding = kEncodingShiftJIS; else if (!strncmp(locale, "ko", 2)) mLocaleEncoding = kEncodingEUCKR; else if (!strncmp(locale, "zh", 2)) { if (!strcmp(locale, "zh_CN")) { // simplified chinese for mainland China mLocaleEncoding = kEncodingGBK; } else { // assume traditional for non-mainland Chinese locales (Taiwan, Hong Kong, Singapore) mLocaleEncoding = kEncodingBig5; } } } void MediaScannerClient::beginFile() { mNames = new StringArray; mValues = new StringArray; } status_t MediaScannerClient::addStringTag(const char* name, const char* value) { if (mLocaleEncoding != kEncodingNone) { // don't bother caching strings that are all ASCII. // call handleStringTag directly instead. // check to see if value (which should be utf8) has any non-ASCII characters bool nonAscii = false; const char* chp = value; char ch; while ((ch = *chp++)) { if (ch & 0x80) { nonAscii = true; break; } } if (nonAscii) { // save the strings for later so they can be used for native encoding detection mNames->push_back(name); mValues->push_back(value); return OK; } // else fall through } // autodetection is not necessary, so no need to cache the values // pass directly to the client instead return handleStringTag(name, value); } static uint32_t possibleEncodings(const char* s) { uint32_t result = kEncodingAll; // if s contains a native encoding, then it was mistakenly encoded in utf8 as if it were latin-1 // so we need to reverse the latin-1 -> utf8 conversion to get the native chars back uint8_t ch1, ch2; uint8_t* chp = (uint8_t *)s; while ((ch1 = *chp++)) { if (ch1 & 0x80) { ch2 = *chp++; ch1 = ((ch1 << 6) & 0xC0) | (ch2 & 0x3F); // ch1 is now the first byte of the potential native char ch2 = *chp++; if (ch2 & 0x80) ch2 = ((ch2 << 6) & 0xC0) | (*chp++ & 0x3F); // ch2 is now the second byte of the potential native char int ch = (int)ch1 << 8 | (int)ch2; result &= findPossibleEncodings(ch); } // else ASCII character, which could be anything } return result; } void MediaScannerClient::convertValues(uint32_t encoding) { const char* enc = NULL; switch (encoding) { case kEncodingShiftJIS: enc = "shift-jis"; break; case kEncodingGBK: enc = "gbk"; break; case kEncodingBig5: enc = "Big5"; break; case kEncodingEUCKR: enc = "EUC-KR"; break; } if (enc) { UErrorCode status = U_ZERO_ERROR; UConverter *conv = ucnv_open(enc, &status); if (U_FAILURE(status)) { ALOGE("could not create UConverter for %s", enc); return; } UConverter *utf8Conv = ucnv_open("UTF-8", &status); if (U_FAILURE(status)) { ALOGE("could not create UConverter for UTF-8"); ucnv_close(conv); return; } // for each value string, convert from native encoding to UTF-8 for (int i = 0; i < mNames->size(); i++) { // first we need to untangle the utf8 and convert it back to the original bytes // since we are reducing the length of the string, we can do this in place uint8_t* src = (uint8_t *)mValues->getEntry(i); int len = strlen((char *)src); uint8_t* dest = src; uint8_t uch; while ((uch = *src++)) { if (uch & 0x80) *dest++ = ((uch << 6) & 0xC0) | (*src++ & 0x3F); else *dest++ = uch; } *dest = 0; // now convert from native encoding to UTF-8 const char* source = mValues->getEntry(i); int targetLength = len * 3 + 1; char* buffer = new char[targetLength]; // don't normally check for NULL, but in this case targetLength may be large if (!buffer) break; char* target = buffer; ucnv_convertEx(utf8Conv, conv, &target, target + targetLength, &source, (const char *)dest, NULL, NULL, NULL, NULL, TRUE, TRUE, &status); if (U_FAILURE(status)) { ALOGE("ucnv_convertEx failed: %d", status); mValues->setEntry(i, "???"); } else { // zero terminate *target = 0; mValues->setEntry(i, buffer); } delete[] buffer; } ucnv_close(conv); ucnv_close(utf8Conv); } } void MediaScannerClient::endFile() { if (mLocaleEncoding != kEncodingNone) { int size = mNames->size(); uint32_t encoding = kEncodingAll; // compute a bit mask containing all possible encodings for (int i = 0; i < mNames->size(); i++) encoding &= possibleEncodings(mValues->getEntry(i)); // if the locale encoding matches, then assume we have a native encoding. if (encoding & mLocaleEncoding) convertValues(mLocaleEncoding); // finally, push all name/value pairs to the client for (int i = 0; i < mNames->size(); i++) { status_t status = handleStringTag(mNames->getEntry(i), mValues->getEntry(i)); if (status) { break; } } } // else addStringTag() has done all the work so we have nothing to do delete mNames; delete mValues; mNames = NULL; mValues = NULL; } } // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/MemoryLeakTrackUtil.cpp0000644000015700001700000001127412200324306026607 0ustar pbuserpbgroup00000000000000/* * Copyright 2011, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include /* * The code here originally resided in MediaPlayerService.cpp and was * shamelessly copied over to support memory leak tracking from * multiple places. */ namespace android { #if defined(__arm__) extern "C" void get_malloc_leak_info(uint8_t** info, size_t* overallSize, size_t* infoSize, size_t* totalMemory, size_t* backtraceSize); extern "C" void free_malloc_leak_info(uint8_t* info); // Use the String-class below instead of String8 to allocate all memory // beforehand and not reenter the heap while we are examining it... struct MyString8 { static const size_t MAX_SIZE = 256 * 1024; MyString8() : mPtr((char *)malloc(MAX_SIZE)) { *mPtr = '\0'; } ~MyString8() { free(mPtr); } void append(const char *s) { strcat(mPtr, s); } const char *string() const { return mPtr; } size_t size() const { return strlen(mPtr); } private: char *mPtr; MyString8(const MyString8 &); MyString8 &operator=(const MyString8 &); }; void dumpMemoryAddresses(int fd) { const size_t SIZE = 256; char buffer[SIZE]; MyString8 result; typedef struct { size_t size; size_t dups; intptr_t * backtrace; } AllocEntry; uint8_t *info = NULL; size_t overallSize = 0; size_t infoSize = 0; size_t totalMemory = 0; size_t backtraceSize = 0; get_malloc_leak_info(&info, &overallSize, &infoSize, &totalMemory, &backtraceSize); if (info) { uint8_t *ptr = info; size_t count = overallSize / infoSize; snprintf(buffer, SIZE, " Allocation count %i\n", count); result.append(buffer); snprintf(buffer, SIZE, " Total memory %i\n", totalMemory); result.append(buffer); AllocEntry * entries = new AllocEntry[count]; for (size_t i = 0; i < count; i++) { // Each entry should be size_t, size_t, intptr_t[backtraceSize] AllocEntry *e = &entries[i]; e->size = *reinterpret_cast(ptr); ptr += sizeof(size_t); e->dups = *reinterpret_cast(ptr); ptr += sizeof(size_t); e->backtrace = reinterpret_cast(ptr); ptr += sizeof(intptr_t) * backtraceSize; } // Now we need to sort the entries. They come sorted by size but // not by stack trace which causes problems using diff. bool moved; do { moved = false; for (size_t i = 0; i < (count - 1); i++) { AllocEntry *e1 = &entries[i]; AllocEntry *e2 = &entries[i+1]; bool swap = e1->size < e2->size; if (e1->size == e2->size) { for(size_t j = 0; j < backtraceSize; j++) { if (e1->backtrace[j] == e2->backtrace[j]) { continue; } swap = e1->backtrace[j] < e2->backtrace[j]; break; } } if (swap) { AllocEntry t = entries[i]; entries[i] = entries[i+1]; entries[i+1] = t; moved = true; } } } while (moved); for (size_t i = 0; i < count; i++) { AllocEntry *e = &entries[i]; snprintf(buffer, SIZE, "size %8i, dup %4i, ", e->size, e->dups); result.append(buffer); for (size_t ct = 0; (ct < backtraceSize) && e->backtrace[ct]; ct++) { if (ct) { result.append(", "); } snprintf(buffer, SIZE, "0x%08x", e->backtrace[ct]); result.append(buffer); } result.append("\n"); } delete[] entries; free_malloc_leak_info(info); } write(fd, result.string(), result.size()); } #else // Does nothing void dumpMemoryAddresses(int fd) {} #endif } // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IAudioFlingerClient.cpp0000644000015700001700000000755512200324306026546 0ustar pbuserpbgroup00000000000000/* * Copyright (c) 2012, The Linux Foundation. All rights reserved. * Not a Contribution, Apache license notifications and license are retained * for attribution purposes only. * * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "IAudioFlingerClient" #include #include #include #include #include #include namespace android { enum { IO_CONFIG_CHANGED = IBinder::FIRST_CALL_TRANSACTION }; class BpAudioFlingerClient : public BpInterface { public: BpAudioFlingerClient(const sp& impl) : BpInterface(impl) { } void ioConfigChanged(int event, audio_io_handle_t ioHandle, const void *param2) { Parcel data, reply; data.writeInterfaceToken(IAudioFlingerClient::getInterfaceDescriptor()); data.writeInt32(event); data.writeInt32((int32_t) ioHandle); if (event == AudioSystem::STREAM_CONFIG_CHANGED) { uint32_t stream = *(const uint32_t *)param2; ALOGV("ioConfigChanged stream %d", stream); data.writeInt32(stream); } else if (event != AudioSystem::OUTPUT_CLOSED && #ifdef QCOM_HARDWARE event != AudioSystem::EFFECT_CONFIG_CHANGED && #endif event != AudioSystem::INPUT_CLOSED) { const AudioSystem::OutputDescriptor *desc = (const AudioSystem::OutputDescriptor *)param2; data.writeInt32(desc->samplingRate); data.writeInt32(desc->format); data.writeInt32(desc->channels); data.writeInt32(desc->frameCount); data.writeInt32(desc->latency); } remote()->transact(IO_CONFIG_CHANGED, data, &reply, IBinder::FLAG_ONEWAY); } }; IMPLEMENT_META_INTERFACE(AudioFlingerClient, "android.media.IAudioFlingerClient"); // ---------------------------------------------------------------------- status_t BnAudioFlingerClient::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case IO_CONFIG_CHANGED: { CHECK_INTERFACE(IAudioFlingerClient, data, reply); int event = data.readInt32(); audio_io_handle_t ioHandle = (audio_io_handle_t) data.readInt32(); const void *param2 = NULL; AudioSystem::OutputDescriptor desc; uint32_t stream; if (event == AudioSystem::STREAM_CONFIG_CHANGED) { stream = data.readInt32(); param2 = &stream; ALOGV("STREAM_CONFIG_CHANGED stream %d", stream); } else if (event != AudioSystem::OUTPUT_CLOSED && event != AudioSystem::INPUT_CLOSED) { desc.samplingRate = data.readInt32(); desc.format = data.readInt32(); desc.channels = data.readInt32(); desc.frameCount = data.readInt32(); desc.latency = data.readInt32(); param2 = &desc; } ioConfigChanged(event, ioHandle, param2); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } } // ---------------------------------------------------------------------------- }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IMediaPlayerClient.cpp0000644000015700001700000000451212200324306026360 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2008, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include #include #include #include namespace android { enum { NOTIFY = IBinder::FIRST_CALL_TRANSACTION, }; class BpMediaPlayerClient: public BpInterface { public: BpMediaPlayerClient(const sp& impl) : BpInterface(impl) { } virtual void notify(int msg, int ext1, int ext2, const Parcel *obj) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayerClient::getInterfaceDescriptor()); data.writeInt32(msg); data.writeInt32(ext1); data.writeInt32(ext2); if (obj && obj->dataSize() > 0) { data.appendFrom(const_cast(obj), 0, obj->dataSize()); } remote()->transact(NOTIFY, data, &reply, IBinder::FLAG_ONEWAY); } }; IMPLEMENT_META_INTERFACE(MediaPlayerClient, "android.media.IMediaPlayerClient"); // ---------------------------------------------------------------------- status_t BnMediaPlayerClient::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case NOTIFY: { CHECK_INTERFACE(IMediaPlayerClient, data, reply); int msg = data.readInt32(); int ext1 = data.readInt32(); int ext2 = data.readInt32(); Parcel obj; if (data.dataAvail() > 0) { obj.appendFrom(const_cast(&data), data.dataPosition(), data.dataAvail()); } notify(msg, ext1, ext2, &obj); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IMediaMetadataRetriever.cpp0000644000015700001700000002115312200324306027375 0ustar pbuserpbgroup00000000000000/* ** ** Copyright (C) 2008 The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include #include #include #include #include // The binder is supposed to propagate the scheduler group across // the binder interface so that remote calls are executed with // the same priority as local calls. This is currently not working // so this change puts in a temporary hack to fix the issue with // metadata retrieval which can be a huge CPU hit if done on a // foreground thread. #ifndef DISABLE_GROUP_SCHEDULE_HACK #undef LOG_TAG #define LOG_TAG "IMediaMetadataRetriever" #include #include namespace android { static void sendSchedPolicy(Parcel& data) { SchedPolicy policy; get_sched_policy(gettid(), &policy); data.writeInt32(policy); } static void setSchedPolicy(const Parcel& data) { SchedPolicy policy = (SchedPolicy) data.readInt32(); set_sched_policy(gettid(), policy); } static void restoreSchedPolicy() { set_sched_policy(gettid(), SP_FOREGROUND); } }; // end namespace android #endif namespace android { enum { DISCONNECT = IBinder::FIRST_CALL_TRANSACTION, SET_DATA_SOURCE_URL, SET_DATA_SOURCE_FD, GET_FRAME_AT_TIME, EXTRACT_ALBUM_ART, EXTRACT_METADATA, }; class BpMediaMetadataRetriever: public BpInterface { public: BpMediaMetadataRetriever(const sp& impl) : BpInterface(impl) { } // disconnect from media metadata retriever service void disconnect() { Parcel data, reply; data.writeInterfaceToken(IMediaMetadataRetriever::getInterfaceDescriptor()); remote()->transact(DISCONNECT, data, &reply); } status_t setDataSource( const char *srcUrl, const KeyedVector *headers) { Parcel data, reply; data.writeInterfaceToken(IMediaMetadataRetriever::getInterfaceDescriptor()); data.writeCString(srcUrl); if (headers == NULL) { data.writeInt32(0); } else { // serialize the headers data.writeInt32(headers->size()); for (size_t i = 0; i < headers->size(); ++i) { data.writeString8(headers->keyAt(i)); data.writeString8(headers->valueAt(i)); } } remote()->transact(SET_DATA_SOURCE_URL, data, &reply); return reply.readInt32(); } status_t setDataSource(int fd, int64_t offset, int64_t length) { Parcel data, reply; data.writeInterfaceToken(IMediaMetadataRetriever::getInterfaceDescriptor()); data.writeFileDescriptor(fd); data.writeInt64(offset); data.writeInt64(length); remote()->transact(SET_DATA_SOURCE_FD, data, &reply); return reply.readInt32(); } sp getFrameAtTime(int64_t timeUs, int option) { ALOGV("getTimeAtTime: time(%lld us) and option(%d)", timeUs, option); Parcel data, reply; data.writeInterfaceToken(IMediaMetadataRetriever::getInterfaceDescriptor()); data.writeInt64(timeUs); data.writeInt32(option); #ifndef DISABLE_GROUP_SCHEDULE_HACK sendSchedPolicy(data); #endif remote()->transact(GET_FRAME_AT_TIME, data, &reply); status_t ret = reply.readInt32(); if (ret != NO_ERROR) { return NULL; } return interface_cast(reply.readStrongBinder()); } sp extractAlbumArt() { Parcel data, reply; data.writeInterfaceToken(IMediaMetadataRetriever::getInterfaceDescriptor()); #ifndef DISABLE_GROUP_SCHEDULE_HACK sendSchedPolicy(data); #endif remote()->transact(EXTRACT_ALBUM_ART, data, &reply); status_t ret = reply.readInt32(); if (ret != NO_ERROR) { return NULL; } return interface_cast(reply.readStrongBinder()); } const char* extractMetadata(int keyCode) { Parcel data, reply; data.writeInterfaceToken(IMediaMetadataRetriever::getInterfaceDescriptor()); #ifndef DISABLE_GROUP_SCHEDULE_HACK sendSchedPolicy(data); #endif data.writeInt32(keyCode); remote()->transact(EXTRACT_METADATA, data, &reply); status_t ret = reply.readInt32(); if (ret != NO_ERROR) { return NULL; } return reply.readCString(); } }; IMPLEMENT_META_INTERFACE(MediaMetadataRetriever, "android.media.IMediaMetadataRetriever"); // ---------------------------------------------------------------------- status_t BnMediaMetadataRetriever::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case DISCONNECT: { CHECK_INTERFACE(IMediaMetadataRetriever, data, reply); disconnect(); return NO_ERROR; } break; case SET_DATA_SOURCE_URL: { CHECK_INTERFACE(IMediaMetadataRetriever, data, reply); const char* srcUrl = data.readCString(); KeyedVector headers; int32_t numHeaders = data.readInt32(); for (int i = 0; i < numHeaders; ++i) { String8 key = data.readString8(); String8 value = data.readString8(); headers.add(key, value); } reply->writeInt32( setDataSource(srcUrl, numHeaders > 0 ? &headers : NULL)); return NO_ERROR; } break; case SET_DATA_SOURCE_FD: { CHECK_INTERFACE(IMediaMetadataRetriever, data, reply); int fd = dup(data.readFileDescriptor()); int64_t offset = data.readInt64(); int64_t length = data.readInt64(); reply->writeInt32(setDataSource(fd, offset, length)); return NO_ERROR; } break; case GET_FRAME_AT_TIME: { CHECK_INTERFACE(IMediaMetadataRetriever, data, reply); int64_t timeUs = data.readInt64(); int option = data.readInt32(); ALOGV("getTimeAtTime: time(%lld us) and option(%d)", timeUs, option); #ifndef DISABLE_GROUP_SCHEDULE_HACK setSchedPolicy(data); #endif sp bitmap = getFrameAtTime(timeUs, option); if (bitmap != 0) { // Don't send NULL across the binder interface reply->writeInt32(NO_ERROR); reply->writeStrongBinder(bitmap->asBinder()); } else { reply->writeInt32(UNKNOWN_ERROR); } #ifndef DISABLE_GROUP_SCHEDULE_HACK restoreSchedPolicy(); #endif return NO_ERROR; } break; case EXTRACT_ALBUM_ART: { CHECK_INTERFACE(IMediaMetadataRetriever, data, reply); #ifndef DISABLE_GROUP_SCHEDULE_HACK setSchedPolicy(data); #endif sp albumArt = extractAlbumArt(); if (albumArt != 0) { // Don't send NULL across the binder interface reply->writeInt32(NO_ERROR); reply->writeStrongBinder(albumArt->asBinder()); } else { reply->writeInt32(UNKNOWN_ERROR); } #ifndef DISABLE_GROUP_SCHEDULE_HACK restoreSchedPolicy(); #endif return NO_ERROR; } break; case EXTRACT_METADATA: { CHECK_INTERFACE(IMediaMetadataRetriever, data, reply); #ifndef DISABLE_GROUP_SCHEDULE_HACK setSchedPolicy(data); #endif int keyCode = data.readInt32(); const char* value = extractMetadata(keyCode); if (value != NULL) { // Don't send NULL across the binder interface reply->writeInt32(NO_ERROR); reply->writeCString(value); } else { reply->writeInt32(UNKNOWN_ERROR); } #ifndef DISABLE_GROUP_SCHEDULE_HACK restoreSchedPolicy(); #endif return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } } // ---------------------------------------------------------------------------- }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/AudioRecord.cpp0000644000015700001700000006403712200324306025124 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2008, The Android Open Source Project ** Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "AudioRecord" #include #include #include #include #include #include #include #include #include #include namespace android { // --------------------------------------------------------------------------- // static status_t AudioRecord::getMinFrameCount( int* frameCount, uint32_t sampleRate, audio_format_t format, audio_channel_mask_t channelMask) { if (frameCount == NULL) return BAD_VALUE; // default to 0 in case of error *frameCount = 0; size_t size = 0; if (AudioSystem::getInputBufferSize(sampleRate, format, channelMask, &size) != NO_ERROR) { ALOGE("AudioSystem could not query the input buffer size."); return NO_INIT; } if (size == 0) { ALOGE("Unsupported configuration: sampleRate %d, format %d, channelMask %#x", sampleRate, format, channelMask); return BAD_VALUE; } // We double the size of input buffer for ping pong use of record buffer. size <<= 1; if (audio_is_linear_pcm(format)) { int channelCount = popcount(channelMask); size /= channelCount * audio_bytes_per_sample(format); } *frameCount = size; return NO_ERROR; } // --------------------------------------------------------------------------- AudioRecord::AudioRecord() : mStatus(NO_INIT), mSessionId(0), mPreviousPriority(ANDROID_PRIORITY_NORMAL), mPreviousSchedulingGroup(SP_DEFAULT) { } AudioRecord::AudioRecord( audio_source_t inputSource, uint32_t sampleRate, audio_format_t format, audio_channel_mask_t channelMask, int frameCount, callback_t cbf, void* user, int notificationFrames, int sessionId) : mStatus(NO_INIT), mSessionId(0), mPreviousPriority(ANDROID_PRIORITY_NORMAL), mPreviousSchedulingGroup(SP_DEFAULT) { mStatus = set(inputSource, sampleRate, format, channelMask, frameCount, cbf, user, notificationFrames, sessionId); } AudioRecord::~AudioRecord() { if (mStatus == NO_ERROR) { // Make sure that callback function exits in the case where // it is looping on buffer empty condition in obtainBuffer(). // Otherwise the callback thread will never exit. stop(); if (mAudioRecordThread != 0) { mAudioRecordThread->requestExit(); // see comment in AudioRecord.h mAudioRecordThread->requestExitAndWait(); mAudioRecordThread.clear(); } mAudioRecord.clear(); IPCThreadState::self()->flushCommands(); AudioSystem::releaseAudioSessionId(mSessionId); } } status_t AudioRecord::set( audio_source_t inputSource, uint32_t sampleRate, audio_format_t format, audio_channel_mask_t channelMask, int frameCount, callback_t cbf, void* user, int notificationFrames, bool threadCanCallJava, int sessionId) { ALOGV("set(): sampleRate %d, channelMask %#x, frameCount %d",sampleRate, channelMask, frameCount); AutoMutex lock(mLock); if (mAudioRecord != 0) { return INVALID_OPERATION; } if (inputSource == AUDIO_SOURCE_DEFAULT) { inputSource = AUDIO_SOURCE_MIC; } if (sampleRate == 0) { sampleRate = DEFAULT_SAMPLE_RATE; } // these below should probably come from the audioFlinger too... if (format == AUDIO_FORMAT_DEFAULT) { format = AUDIO_FORMAT_PCM_16_BIT; } // validate parameters if (!audio_is_valid_format(format)) { ALOGE("Invalid format"); return BAD_VALUE; } if (!audio_is_input_channel(channelMask)) { return BAD_VALUE; } #ifdef QCOM_HARDWARE int channelCount = popcount((channelMask) & (AUDIO_CHANNEL_IN_STEREO | AUDIO_CHANNEL_IN_MONO | AUDIO_CHANNEL_IN_5POINT1)); #else int channelCount = popcount(channelMask); #endif if (sessionId == 0 ) { mSessionId = AudioSystem::newAudioSessionId(); } else { mSessionId = sessionId; } ALOGV("set(): mSessionId %d", mSessionId); audio_io_handle_t input = AudioSystem::getInput(inputSource, sampleRate, format, channelMask, mSessionId); if (input == 0) { ALOGE("Could not get audio input for record source %d", inputSource); return BAD_VALUE; } // validate framecount int minFrameCount = 0; status_t status = getMinFrameCount(&minFrameCount, sampleRate, format, channelMask); if (status != NO_ERROR) { return status; } ALOGV("AudioRecord::set() minFrameCount = %d", minFrameCount); if (frameCount == 0) { frameCount = minFrameCount; } else if (frameCount < minFrameCount) { return BAD_VALUE; } if (notificationFrames == 0) { notificationFrames = frameCount/2; } // create the IAudioRecord status = openRecord_l(sampleRate, format, channelMask, frameCount, input); if (status != NO_ERROR) { return status; } if (cbf != NULL) { mAudioRecordThread = new AudioRecordThread(*this, threadCanCallJava); mAudioRecordThread->run("AudioRecord", ANDROID_PRIORITY_AUDIO); } mStatus = NO_ERROR; mFormat = format; // Update buffer size in case it has been limited by AudioFlinger during track creation mFrameCount = mCblk->frameCount; mChannelCount = (uint8_t)channelCount; mChannelMask = channelMask; mActive = false; mCbf = cbf; mNotificationFrames = notificationFrames; mRemainingFrames = notificationFrames; mUserData = user; // TODO: add audio hardware input latency here mLatency = (1000*mFrameCount) / sampleRate; mMarkerPosition = 0; mMarkerReached = false; mNewPosition = 0; mUpdatePeriod = 0; mInputSource = inputSource; mInput = input; AudioSystem::acquireAudioSessionId(mSessionId); return NO_ERROR; } status_t AudioRecord::initCheck() const { return mStatus; } // ------------------------------------------------------------------------- uint32_t AudioRecord::latency() const { return mLatency; } audio_format_t AudioRecord::format() const { return mFormat; } int AudioRecord::channelCount() const { return mChannelCount; } uint32_t AudioRecord::frameCount() const { return mFrameCount; } size_t AudioRecord::frameSize() const { if (audio_is_linear_pcm(mFormat)) { return channelCount()*audio_bytes_per_sample(mFormat); } else { return sizeof(uint8_t); } } audio_source_t AudioRecord::inputSource() const { return mInputSource; } // ------------------------------------------------------------------------- status_t AudioRecord::start(AudioSystem::sync_event_t event, int triggerSession) { status_t ret = NO_ERROR; sp t = mAudioRecordThread; ALOGV("start, sync event %d trigger session %d", event, triggerSession); AutoMutex lock(mLock); // acquire a strong reference on the IAudioRecord and IMemory so that they cannot be destroyed // while we are accessing the cblk sp audioRecord = mAudioRecord; sp iMem = mCblkMemory; audio_track_cblk_t* cblk = mCblk; if (!mActive) { mActive = true; cblk->lock.lock(); if (!(cblk->flags & CBLK_INVALID_MSK)) { cblk->lock.unlock(); ALOGV("mAudioRecord->start()"); ret = mAudioRecord->start(event, triggerSession); cblk->lock.lock(); if (ret == DEAD_OBJECT) { android_atomic_or(CBLK_INVALID_ON, &cblk->flags); } } if (cblk->flags & CBLK_INVALID_MSK) { ret = restoreRecord_l(cblk); } cblk->lock.unlock(); if (ret == NO_ERROR) { mNewPosition = cblk->user + mUpdatePeriod; cblk->bufferTimeoutMs = (event == AudioSystem::SYNC_EVENT_NONE) ? MAX_RUN_TIMEOUT_MS : AudioSystem::kSyncRecordStartTimeOutMs; cblk->waitTimeMs = 0; if (t != 0) { t->resume(); } else { mPreviousPriority = getpriority(PRIO_PROCESS, 0); get_sched_policy(0, &mPreviousSchedulingGroup); androidSetThreadPriority(0, ANDROID_PRIORITY_AUDIO); } } else { mActive = false; } } return ret; } void AudioRecord::stop() { sp t = mAudioRecordThread; ALOGV("stop"); AutoMutex lock(mLock); if (mActive) { mActive = false; mCblk->cv.signal(); mAudioRecord->stop(); // the record head position will reset to 0, so if a marker is set, we need // to activate it again mMarkerReached = false; if (t != 0) { t->pause(); } else { setpriority(PRIO_PROCESS, 0, mPreviousPriority); set_sched_policy(0, mPreviousSchedulingGroup); } } } bool AudioRecord::stopped() const { AutoMutex lock(mLock); return !mActive; } uint32_t AudioRecord::getSampleRate() const { return mCblk->sampleRate; } status_t AudioRecord::setMarkerPosition(uint32_t marker) { if (mCbf == NULL) return INVALID_OPERATION; AutoMutex lock(mLock); mMarkerPosition = marker; mMarkerReached = false; return NO_ERROR; } status_t AudioRecord::getMarkerPosition(uint32_t *marker) const { if (marker == NULL) return BAD_VALUE; AutoMutex lock(mLock); *marker = mMarkerPosition; return NO_ERROR; } status_t AudioRecord::setPositionUpdatePeriod(uint32_t updatePeriod) { if (mCbf == NULL) return INVALID_OPERATION; uint32_t curPosition; getPosition(&curPosition); AutoMutex lock(mLock); mNewPosition = curPosition + updatePeriod; mUpdatePeriod = updatePeriod; return NO_ERROR; } status_t AudioRecord::getPositionUpdatePeriod(uint32_t *updatePeriod) const { if (updatePeriod == NULL) return BAD_VALUE; AutoMutex lock(mLock); *updatePeriod = mUpdatePeriod; return NO_ERROR; } status_t AudioRecord::getPosition(uint32_t *position) const { if (position == NULL) return BAD_VALUE; AutoMutex lock(mLock); *position = mCblk->user; return NO_ERROR; } unsigned int AudioRecord::getInputFramesLost() const { // no need to check mActive, because if inactive this will return 0, which is what we want return AudioSystem::getInputFramesLost(mInput); } // ------------------------------------------------------------------------- // must be called with mLock held status_t AudioRecord::openRecord_l( uint32_t sampleRate, audio_format_t format, audio_channel_mask_t channelMask, int frameCount, audio_io_handle_t input) { status_t status; const sp& audioFlinger = AudioSystem::get_audio_flinger(); if (audioFlinger == 0) { return NO_INIT; } pid_t tid = -1; // FIXME see similar logic at AudioTrack int originalSessionId = mSessionId; sp record = audioFlinger->openRecord(getpid(), input, sampleRate, format, channelMask, frameCount, IAudioFlinger::TRACK_DEFAULT, tid, &mSessionId, &status); ALOGE_IF(originalSessionId != 0 && mSessionId != originalSessionId, "session ID changed from %d to %d", originalSessionId, mSessionId); if (record == 0) { ALOGE("AudioFlinger could not create record track, status: %d", status); return status; } sp cblk = record->getCblk(); if (cblk == 0) { ALOGE("Could not get control block"); return NO_INIT; } mAudioRecord.clear(); mAudioRecord = record; mCblkMemory.clear(); mCblkMemory = cblk; mCblk = static_cast(cblk->pointer()); mCblk->buffers = (char*)mCblk + sizeof(audio_track_cblk_t); android_atomic_and(~CBLK_DIRECTION_MSK, &mCblk->flags); mCblk->bufferTimeoutMs = MAX_RUN_TIMEOUT_MS; mCblk->waitTimeMs = 0; return NO_ERROR; } status_t AudioRecord::obtainBuffer(Buffer* audioBuffer, int32_t waitCount) { AutoMutex lock(mLock); bool active; status_t result = NO_ERROR; audio_track_cblk_t* cblk = mCblk; uint32_t framesReq = audioBuffer->frameCount; uint32_t waitTimeMs = (waitCount < 0) ? cblk->bufferTimeoutMs : WAIT_PERIOD_MS; audioBuffer->frameCount = 0; audioBuffer->size = 0; uint32_t framesReady = cblk->framesReady(); if (framesReady == 0) { cblk->lock.lock(); goto start_loop_here; while (framesReady == 0) { active = mActive; if (CC_UNLIKELY(!active)) { cblk->lock.unlock(); return NO_MORE_BUFFERS; } if (CC_UNLIKELY(!waitCount)) { cblk->lock.unlock(); return WOULD_BLOCK; } if (!(cblk->flags & CBLK_INVALID_MSK)) { mLock.unlock(); result = cblk->cv.waitRelative(cblk->lock, milliseconds(waitTimeMs)); cblk->lock.unlock(); mLock.lock(); if (!mActive) { return status_t(STOPPED); } cblk->lock.lock(); } if (cblk->flags & CBLK_INVALID_MSK) { goto create_new_record; } if (CC_UNLIKELY(result != NO_ERROR)) { cblk->waitTimeMs += waitTimeMs; if (cblk->waitTimeMs >= cblk->bufferTimeoutMs) { ALOGW( "obtainBuffer timed out (is the CPU pegged?) " "user=%08x, server=%08x", cblk->user, cblk->server); cblk->lock.unlock(); // callback thread or sync event hasn't changed result = mAudioRecord->start(AudioSystem::SYNC_EVENT_SAME, 0); cblk->lock.lock(); if (result == DEAD_OBJECT) { android_atomic_or(CBLK_INVALID_ON, &cblk->flags); create_new_record: result = AudioRecord::restoreRecord_l(cblk); } if (result != NO_ERROR) { ALOGW("obtainBuffer create Track error %d", result); cblk->lock.unlock(); return result; } cblk->waitTimeMs = 0; } if (--waitCount == 0) { cblk->lock.unlock(); return TIMED_OUT; } } // read the server count again start_loop_here: framesReady = cblk->framesReady(); } cblk->lock.unlock(); } cblk->waitTimeMs = 0; // reset time out to running value after obtaining a buffer cblk->bufferTimeoutMs = MAX_RUN_TIMEOUT_MS; if (framesReq > framesReady) { framesReq = framesReady; } uint32_t u = cblk->user; uint32_t bufferEnd = cblk->userBase + cblk->frameCount; if (framesReq > bufferEnd - u) { framesReq = bufferEnd - u; } audioBuffer->flags = 0; audioBuffer->channelCount= mChannelCount; audioBuffer->format = mFormat; audioBuffer->frameCount = framesReq; audioBuffer->size = framesReq*cblk->frameSize; audioBuffer->raw = (int8_t*)cblk->buffer(u); active = mActive; return active ? status_t(NO_ERROR) : status_t(STOPPED); } void AudioRecord::releaseBuffer(Buffer* audioBuffer) { AutoMutex lock(mLock); mCblk->stepUser(audioBuffer->frameCount); } audio_io_handle_t AudioRecord::getInput() const { AutoMutex lock(mLock); return mInput; } // must be called with mLock held audio_io_handle_t AudioRecord::getInput_l() { mInput = AudioSystem::getInput(mInputSource, mCblk->sampleRate, mFormat, mChannelMask, mSessionId); return mInput; } int AudioRecord::getSessionId() const { // no lock needed because session ID doesn't change after first set() return mSessionId; } // ------------------------------------------------------------------------- ssize_t AudioRecord::read(void* buffer, size_t userSize) { ssize_t read = 0; Buffer audioBuffer; int8_t *dst = static_cast(buffer); if (ssize_t(userSize) < 0) { // sanity-check. user is most-likely passing an error code. ALOGE("AudioRecord::read(buffer=%p, size=%u (%d)", buffer, userSize, userSize); return BAD_VALUE; } mLock.lock(); // acquire a strong reference on the IAudioRecord and IMemory so that they cannot be destroyed // while we are accessing the cblk sp audioRecord = mAudioRecord; sp iMem = mCblkMemory; mLock.unlock(); do { audioBuffer.frameCount = userSize/frameSize(); // By using a wait count corresponding to twice the timeout period in // obtainBuffer() we give a chance to recover once for a read timeout // (if media_server crashed for instance) before returning a length of // 0 bytes read to the client status_t err = obtainBuffer(&audioBuffer, ((2 * MAX_RUN_TIMEOUT_MS) / WAIT_PERIOD_MS)); if (err < 0) { // out of buffers, return #bytes written if (err == status_t(NO_MORE_BUFFERS)) break; if (err == status_t(TIMED_OUT)) err = 0; return ssize_t(err); } size_t bytesRead = audioBuffer.size; memcpy(dst, audioBuffer.i8, bytesRead); dst += bytesRead; userSize -= bytesRead; read += bytesRead; releaseBuffer(&audioBuffer); } while (userSize); return read; } // ------------------------------------------------------------------------- bool AudioRecord::processAudioBuffer(const sp& thread) { Buffer audioBuffer; uint32_t frames = mRemainingFrames; size_t readSize; mLock.lock(); // acquire a strong reference on the IAudioRecord and IMemory so that they cannot be destroyed // while we are accessing the cblk sp audioRecord = mAudioRecord; sp iMem = mCblkMemory; audio_track_cblk_t* cblk = mCblk; bool active = mActive; uint32_t markerPosition = mMarkerPosition; uint32_t newPosition = mNewPosition; uint32_t user = cblk->user; // determine whether a marker callback will be needed, while locked bool needMarker = !mMarkerReached && (mMarkerPosition > 0) && (user >= mMarkerPosition); if (needMarker) { mMarkerReached = true; } // determine the number of new position callback(s) that will be needed, while locked uint32_t updatePeriod = mUpdatePeriod; uint32_t needNewPos = updatePeriod > 0 && user >= newPosition ? ((user - newPosition) / updatePeriod) + 1 : 0; mNewPosition = newPosition + updatePeriod * needNewPos; mLock.unlock(); // perform marker callback, while unlocked if (needMarker) { mCbf(EVENT_MARKER, mUserData, &markerPosition); } // perform new position callback(s), while unlocked for (; needNewPos > 0; --needNewPos) { uint32_t temp = newPosition; mCbf(EVENT_NEW_POS, mUserData, &temp); newPosition += updatePeriod; } do { audioBuffer.frameCount = frames; // Calling obtainBuffer() with a wait count of 1 // limits wait time to WAIT_PERIOD_MS. This prevents from being // stuck here not being able to handle timed events (position, markers). status_t err = obtainBuffer(&audioBuffer, 1); if (err < NO_ERROR) { if (err != TIMED_OUT) { ALOGE_IF(err != status_t(NO_MORE_BUFFERS), "Error obtaining an audio buffer, giving up."); return false; } break; } if (err == status_t(STOPPED)) return false; size_t reqSize = audioBuffer.size; mCbf(EVENT_MORE_DATA, mUserData, &audioBuffer); readSize = audioBuffer.size; // Sanity check on returned size if (ssize_t(readSize) <= 0) { // The callback is done filling buffers // Keep this thread going to handle timed events and // still try to get more data in intervals of WAIT_PERIOD_MS // but don't just loop and block the CPU, so wait usleep(WAIT_PERIOD_MS*1000); break; } if (readSize > reqSize) readSize = reqSize; audioBuffer.size = readSize; audioBuffer.frameCount = readSize/frameSize(); frames -= audioBuffer.frameCount; releaseBuffer(&audioBuffer); } while (frames); // Manage overrun callback if (active && (cblk->framesAvailable() == 0)) { // The value of active is stale, but we are almost sure to be active here because // otherwise we would have exited when obtainBuffer returned STOPPED earlier. ALOGV("Overrun user: %x, server: %x, flags %04x", cblk->user, cblk->server, cblk->flags); if (!(android_atomic_or(CBLK_UNDERRUN_ON, &cblk->flags) & CBLK_UNDERRUN_MSK)) { mCbf(EVENT_OVERRUN, mUserData, NULL); } } if (frames == 0) { mRemainingFrames = mNotificationFrames; } else { mRemainingFrames = frames; } return true; } // must be called with mLock and cblk.lock held. Callers must also hold strong references on // the IAudioRecord and IMemory in case they are recreated here. // If the IAudioRecord is successfully restored, the cblk pointer is updated status_t AudioRecord::restoreRecord_l(audio_track_cblk_t*& cblk) { status_t result; if (!(android_atomic_or(CBLK_RESTORING_ON, &cblk->flags) & CBLK_RESTORING_MSK)) { ALOGW("dead IAudioRecord, creating a new one"); // signal old cblk condition so that other threads waiting for available buffers stop // waiting now cblk->cv.broadcast(); cblk->lock.unlock(); // if the new IAudioRecord is created, openRecord_l() will modify the // following member variables: mAudioRecord, mCblkMemory and mCblk. // It will also delete the strong references on previous IAudioRecord and IMemory result = openRecord_l(cblk->sampleRate, mFormat, mChannelMask, mFrameCount, getInput_l()); if (result == NO_ERROR) { // callback thread or sync event hasn't changed result = mAudioRecord->start(AudioSystem::SYNC_EVENT_SAME, 0); } if (result != NO_ERROR) { mActive = false; } // signal old cblk condition for other threads waiting for restore completion android_atomic_or(CBLK_RESTORED_ON, &cblk->flags); cblk->cv.broadcast(); } else { if (!(cblk->flags & CBLK_RESTORED_MSK)) { ALOGW("dead IAudioRecord, waiting for a new one to be created"); mLock.unlock(); result = cblk->cv.waitRelative(cblk->lock, milliseconds(RESTORE_TIMEOUT_MS)); cblk->lock.unlock(); mLock.lock(); } else { ALOGW("dead IAudioRecord, already restored"); result = NO_ERROR; cblk->lock.unlock(); } if (result != NO_ERROR || !mActive) { result = status_t(STOPPED); } } ALOGV("restoreRecord_l() status %d mActive %d cblk %p, old cblk %p flags %08x old flags %08x", result, mActive, mCblk, cblk, mCblk->flags, cblk->flags); if (result == NO_ERROR) { // from now on we switch to the newly created cblk cblk = mCblk; } cblk->lock.lock(); ALOGW_IF(result != NO_ERROR, "restoreRecord_l() error %d", result); return result; } // ========================================================================= AudioRecord::AudioRecordThread::AudioRecordThread(AudioRecord& receiver, bool bCanCallJava) : Thread(bCanCallJava), mReceiver(receiver), mPaused(true) { } AudioRecord::AudioRecordThread::~AudioRecordThread() { } bool AudioRecord::AudioRecordThread::threadLoop() { { AutoMutex _l(mMyLock); if (mPaused) { mMyCond.wait(mMyLock); // caller will check for exitPending() return true; } } if (!mReceiver.processAudioBuffer(this)) { pause(); } return true; } void AudioRecord::AudioRecordThread::requestExit() { // must be in this order to avoid a race condition Thread::requestExit(); resume(); } void AudioRecord::AudioRecordThread::pause() { AutoMutex _l(mMyLock); mPaused = true; } void AudioRecord::AudioRecordThread::resume() { AutoMutex _l(mMyLock); if (mPaused) { mPaused = false; mMyCond.signal(); } } // ------------------------------------------------------------------------- }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IHDCP.cpp0000644000015700001700000001335412200324306023547 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "IHDCP" #include #include #include #include #include namespace android { enum { OBSERVER_NOTIFY = IBinder::FIRST_CALL_TRANSACTION, HDCP_SET_OBSERVER, HDCP_INIT_ASYNC, HDCP_SHUTDOWN_ASYNC, HDCP_ENCRYPT, }; struct BpHDCPObserver : public BpInterface { BpHDCPObserver(const sp &impl) : BpInterface(impl) { } virtual void notify( int msg, int ext1, int ext2, const Parcel *obj) { Parcel data, reply; data.writeInterfaceToken(IHDCPObserver::getInterfaceDescriptor()); data.writeInt32(msg); data.writeInt32(ext1); data.writeInt32(ext2); if (obj && obj->dataSize() > 0) { data.appendFrom(const_cast(obj), 0, obj->dataSize()); } remote()->transact(OBSERVER_NOTIFY, data, &reply, IBinder::FLAG_ONEWAY); } }; IMPLEMENT_META_INTERFACE(HDCPObserver, "android.hardware.IHDCPObserver"); struct BpHDCP : public BpInterface { BpHDCP(const sp &impl) : BpInterface(impl) { } virtual status_t setObserver(const sp &observer) { Parcel data, reply; data.writeInterfaceToken(IHDCP::getInterfaceDescriptor()); data.writeStrongBinder(observer->asBinder()); remote()->transact(HDCP_SET_OBSERVER, data, &reply); return reply.readInt32(); } virtual status_t initAsync(const char *host, unsigned port) { Parcel data, reply; data.writeInterfaceToken(IHDCP::getInterfaceDescriptor()); data.writeCString(host); data.writeInt32(port); remote()->transact(HDCP_INIT_ASYNC, data, &reply); return reply.readInt32(); } virtual status_t shutdownAsync() { Parcel data, reply; data.writeInterfaceToken(IHDCP::getInterfaceDescriptor()); remote()->transact(HDCP_SHUTDOWN_ASYNC, data, &reply); return reply.readInt32(); } virtual status_t encrypt( const void *inData, size_t size, uint32_t streamCTR, uint64_t *outInputCTR, void *outData) { Parcel data, reply; data.writeInterfaceToken(IHDCP::getInterfaceDescriptor()); data.writeInt32(size); data.write(inData, size); data.writeInt32(streamCTR); remote()->transact(HDCP_ENCRYPT, data, &reply); status_t err = reply.readInt32(); if (err != OK) { *outInputCTR = 0; return err; } *outInputCTR = reply.readInt64(); reply.read(outData, size); return err; } }; IMPLEMENT_META_INTERFACE(HDCP, "android.hardware.IHDCP"); status_t BnHDCPObserver::onTransact( uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) { switch (code) { case OBSERVER_NOTIFY: { CHECK_INTERFACE(IHDCPObserver, data, reply); int msg = data.readInt32(); int ext1 = data.readInt32(); int ext2 = data.readInt32(); Parcel obj; if (data.dataAvail() > 0) { obj.appendFrom( const_cast(&data), data.dataPosition(), data.dataAvail()); } notify(msg, ext1, ext2, &obj); return OK; } default: return BBinder::onTransact(code, data, reply, flags); } } status_t BnHDCP::onTransact( uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) { switch (code) { case HDCP_SET_OBSERVER: { CHECK_INTERFACE(IHDCP, data, reply); sp observer = interface_cast(data.readStrongBinder()); reply->writeInt32(setObserver(observer)); return OK; } case HDCP_INIT_ASYNC: { CHECK_INTERFACE(IHDCP, data, reply); const char *host = data.readCString(); unsigned port = data.readInt32(); reply->writeInt32(initAsync(host, port)); return OK; } case HDCP_SHUTDOWN_ASYNC: { CHECK_INTERFACE(IHDCP, data, reply); reply->writeInt32(shutdownAsync()); return OK; } case HDCP_ENCRYPT: { size_t size = data.readInt32(); void *inData = malloc(2 * size); void *outData = (uint8_t *)inData + size; data.read(inData, size); uint32_t streamCTR = data.readInt32(); uint64_t inputCTR; status_t err = encrypt(inData, size, streamCTR, &inputCTR, outData); reply->writeInt32(err); if (err == OK) { reply->writeInt64(inputCTR); reply->write(outData, size); } free(inData); inData = outData = NULL; return OK; } default: return BBinder::onTransact(code, data, reply, flags); } } } // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IMediaRecorderClient.cpp0000644000015700001700000000402212200324306026665 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2010, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include #include #include #include namespace android { enum { NOTIFY = IBinder::FIRST_CALL_TRANSACTION, }; class BpMediaRecorderClient: public BpInterface { public: BpMediaRecorderClient(const sp& impl) : BpInterface(impl) { } virtual void notify(int msg, int ext1, int ext2) { Parcel data, reply; data.writeInterfaceToken(IMediaRecorderClient::getInterfaceDescriptor()); data.writeInt32(msg); data.writeInt32(ext1); data.writeInt32(ext2); remote()->transact(NOTIFY, data, &reply, IBinder::FLAG_ONEWAY); } }; IMPLEMENT_META_INTERFACE(MediaRecorderClient, "android.media.IMediaRecorderClient"); // ---------------------------------------------------------------------- status_t BnMediaRecorderClient::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case NOTIFY: { CHECK_INTERFACE(IMediaRecorderClient, data, reply); int msg = data.readInt32(); int ext1 = data.readInt32(); int ext2 = data.readInt32(); notify(msg, ext1, ext2); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IOMX.cpp0000644000015700001700000005501312200324306023472 0ustar pbuserpbgroup00000000000000/* * Copyright (c) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "IOMX" #include #include #include #include #include namespace android { enum { CONNECT = IBinder::FIRST_CALL_TRANSACTION, LIVES_LOCALLY, LIST_NODES, ALLOCATE_NODE, FREE_NODE, SEND_COMMAND, GET_PARAMETER, SET_PARAMETER, GET_CONFIG, SET_CONFIG, GET_STATE, ENABLE_GRAPHIC_BUFFERS, USE_BUFFER, USE_GRAPHIC_BUFFER, STORE_META_DATA_IN_BUFFERS, ALLOC_BUFFER, ALLOC_BUFFER_WITH_BACKUP, FREE_BUFFER, FILL_BUFFER, EMPTY_BUFFER, GET_EXTENSION_INDEX, OBSERVER_ON_MSG, GET_GRAPHIC_BUFFER_USAGE, }; class BpOMX : public BpInterface { public: BpOMX(const sp &impl) : BpInterface(impl) { } virtual bool livesLocally(node_id node, pid_t pid) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeIntPtr((intptr_t)node); data.writeInt32(pid); remote()->transact(LIVES_LOCALLY, data, &reply); return reply.readInt32() != 0; } virtual status_t listNodes(List *list) { list->clear(); Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); remote()->transact(LIST_NODES, data, &reply); int32_t n = reply.readInt32(); for (int32_t i = 0; i < n; ++i) { list->push_back(ComponentInfo()); ComponentInfo &info = *--list->end(); info.mName = reply.readString8(); int32_t numRoles = reply.readInt32(); for (int32_t j = 0; j < numRoles; ++j) { info.mRoles.push_back(reply.readString8()); } } return OK; } virtual status_t allocateNode( const char *name, const sp &observer, node_id *node) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeCString(name); data.writeStrongBinder(observer->asBinder()); remote()->transact(ALLOCATE_NODE, data, &reply); status_t err = reply.readInt32(); if (err == OK) { *node = (void*)reply.readIntPtr(); } else { *node = 0; } return err; } virtual status_t freeNode(node_id node) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeIntPtr((intptr_t)node); remote()->transact(FREE_NODE, data, &reply); return reply.readInt32(); } virtual status_t sendCommand( node_id node, OMX_COMMANDTYPE cmd, OMX_S32 param) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeIntPtr((intptr_t)node); data.writeInt32(cmd); data.writeInt32(param); remote()->transact(SEND_COMMAND, data, &reply); return reply.readInt32(); } virtual status_t getParameter( node_id node, OMX_INDEXTYPE index, void *params, size_t size) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeIntPtr((intptr_t)node); data.writeInt32(index); data.writeInt32(size); data.write(params, size); remote()->transact(GET_PARAMETER, data, &reply); status_t err = reply.readInt32(); if (err != OK) { return err; } reply.read(params, size); return OK; } virtual status_t setParameter( node_id node, OMX_INDEXTYPE index, const void *params, size_t size) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeIntPtr((intptr_t)node); data.writeInt32(index); data.writeInt32(size); data.write(params, size); remote()->transact(SET_PARAMETER, data, &reply); return reply.readInt32(); } virtual status_t getConfig( node_id node, OMX_INDEXTYPE index, void *params, size_t size) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeIntPtr((intptr_t)node); data.writeInt32(index); data.writeInt32(size); data.write(params, size); remote()->transact(GET_CONFIG, data, &reply); status_t err = reply.readInt32(); if (err != OK) { return err; } reply.read(params, size); return OK; } virtual status_t setConfig( node_id node, OMX_INDEXTYPE index, const void *params, size_t size) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeIntPtr((intptr_t)node); data.writeInt32(index); data.writeInt32(size); data.write(params, size); remote()->transact(SET_CONFIG, data, &reply); return reply.readInt32(); } virtual status_t getState( node_id node, OMX_STATETYPE* state) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeIntPtr((intptr_t)node); remote()->transact(GET_STATE, data, &reply); *state = static_cast(reply.readInt32()); return reply.readInt32(); } virtual status_t enableGraphicBuffers( node_id node, OMX_U32 port_index, OMX_BOOL enable) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeIntPtr((intptr_t)node); data.writeInt32(port_index); data.writeInt32((uint32_t)enable); remote()->transact(ENABLE_GRAPHIC_BUFFERS, data, &reply); status_t err = reply.readInt32(); return err; } virtual status_t getGraphicBufferUsage( node_id node, OMX_U32 port_index, OMX_U32* usage) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeIntPtr((intptr_t)node); data.writeInt32(port_index); remote()->transact(GET_GRAPHIC_BUFFER_USAGE, data, &reply); status_t err = reply.readInt32(); *usage = reply.readInt32(); return err; } virtual status_t useBuffer( node_id node, OMX_U32 port_index, const sp ¶ms, buffer_id *buffer) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeIntPtr((intptr_t)node); data.writeInt32(port_index); data.writeStrongBinder(params->asBinder()); remote()->transact(USE_BUFFER, data, &reply); status_t err = reply.readInt32(); if (err != OK) { *buffer = 0; return err; } *buffer = (void*)reply.readIntPtr(); return err; } virtual status_t useGraphicBuffer( node_id node, OMX_U32 port_index, const sp &graphicBuffer, buffer_id *buffer) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeIntPtr((intptr_t)node); data.writeInt32(port_index); data.write(*graphicBuffer); remote()->transact(USE_GRAPHIC_BUFFER, data, &reply); status_t err = reply.readInt32(); if (err != OK) { *buffer = 0; return err; } *buffer = (void*)reply.readIntPtr(); return err; } virtual status_t storeMetaDataInBuffers( node_id node, OMX_U32 port_index, OMX_BOOL enable) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeIntPtr((intptr_t)node); data.writeInt32(port_index); data.writeInt32((uint32_t)enable); remote()->transact(STORE_META_DATA_IN_BUFFERS, data, &reply); status_t err = reply.readInt32(); return err; } virtual status_t allocateBuffer( node_id node, OMX_U32 port_index, size_t size, buffer_id *buffer, void **buffer_data) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeIntPtr((intptr_t)node); data.writeInt32(port_index); data.writeInt32(size); remote()->transact(ALLOC_BUFFER, data, &reply); status_t err = reply.readInt32(); if (err != OK) { *buffer = 0; return err; } *buffer = (void *)reply.readIntPtr(); *buffer_data = (void *)reply.readIntPtr(); return err; } virtual status_t allocateBufferWithBackup( node_id node, OMX_U32 port_index, const sp ¶ms, buffer_id *buffer) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeIntPtr((intptr_t)node); data.writeInt32(port_index); data.writeStrongBinder(params->asBinder()); remote()->transact(ALLOC_BUFFER_WITH_BACKUP, data, &reply); status_t err = reply.readInt32(); if (err != OK) { *buffer = 0; return err; } *buffer = (void*)reply.readIntPtr(); return err; } virtual status_t freeBuffer( node_id node, OMX_U32 port_index, buffer_id buffer) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeIntPtr((intptr_t)node); data.writeInt32(port_index); data.writeIntPtr((intptr_t)buffer); remote()->transact(FREE_BUFFER, data, &reply); return reply.readInt32(); } virtual status_t fillBuffer(node_id node, buffer_id buffer) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeIntPtr((intptr_t)node); data.writeIntPtr((intptr_t)buffer); remote()->transact(FILL_BUFFER, data, &reply); return reply.readInt32(); } virtual status_t emptyBuffer( node_id node, buffer_id buffer, OMX_U32 range_offset, OMX_U32 range_length, OMX_U32 flags, OMX_TICKS timestamp) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeIntPtr((intptr_t)node); data.writeIntPtr((intptr_t)buffer); data.writeInt32(range_offset); data.writeInt32(range_length); data.writeInt32(flags); data.writeInt64(timestamp); remote()->transact(EMPTY_BUFFER, data, &reply); return reply.readInt32(); } virtual status_t getExtensionIndex( node_id node, const char *parameter_name, OMX_INDEXTYPE *index) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeIntPtr((intptr_t)node); data.writeCString(parameter_name); remote()->transact(GET_EXTENSION_INDEX, data, &reply); status_t err = reply.readInt32(); if (err == OK) { *index = static_cast(reply.readInt32()); } else { *index = OMX_IndexComponentStartUnused; } return err; } }; IMPLEMENT_META_INTERFACE(OMX, "android.hardware.IOMX"); //////////////////////////////////////////////////////////////////////////////// #define CHECK_INTERFACE(interface, data, reply) \ do { if (!data.enforceInterface(interface::getInterfaceDescriptor())) { \ ALOGW("Call incorrectly routed to " #interface); \ return PERMISSION_DENIED; \ } } while (0) status_t BnOMX::onTransact( uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) { switch (code) { case LIVES_LOCALLY: { CHECK_INTERFACE(IOMX, data, reply); node_id node = (void *)data.readIntPtr(); pid_t pid = (pid_t)data.readInt32(); reply->writeInt32(livesLocally(node, pid)); return OK; } case LIST_NODES: { CHECK_INTERFACE(IOMX, data, reply); List list; listNodes(&list); reply->writeInt32(list.size()); for (List::iterator it = list.begin(); it != list.end(); ++it) { ComponentInfo &cur = *it; reply->writeString8(cur.mName); reply->writeInt32(cur.mRoles.size()); for (List::iterator role_it = cur.mRoles.begin(); role_it != cur.mRoles.end(); ++role_it) { reply->writeString8(*role_it); } } return NO_ERROR; } case ALLOCATE_NODE: { CHECK_INTERFACE(IOMX, data, reply); const char *name = data.readCString(); sp observer = interface_cast(data.readStrongBinder()); node_id node; status_t err = allocateNode(name, observer, &node); reply->writeInt32(err); if (err == OK) { reply->writeIntPtr((intptr_t)node); } return NO_ERROR; } case FREE_NODE: { CHECK_INTERFACE(IOMX, data, reply); node_id node = (void*)data.readIntPtr(); reply->writeInt32(freeNode(node)); return NO_ERROR; } case SEND_COMMAND: { CHECK_INTERFACE(IOMX, data, reply); node_id node = (void*)data.readIntPtr(); OMX_COMMANDTYPE cmd = static_cast(data.readInt32()); OMX_S32 param = data.readInt32(); reply->writeInt32(sendCommand(node, cmd, param)); return NO_ERROR; } case GET_PARAMETER: case SET_PARAMETER: case GET_CONFIG: case SET_CONFIG: { CHECK_INTERFACE(IOMX, data, reply); node_id node = (void*)data.readIntPtr(); OMX_INDEXTYPE index = static_cast(data.readInt32()); size_t size = data.readInt32(); void *params = malloc(size); data.read(params, size); status_t err; switch (code) { case GET_PARAMETER: err = getParameter(node, index, params, size); break; case SET_PARAMETER: err = setParameter(node, index, params, size); break; case GET_CONFIG: err = getConfig(node, index, params, size); break; case SET_CONFIG: err = setConfig(node, index, params, size); break; default: TRESPASS(); } reply->writeInt32(err); if ((code == GET_PARAMETER || code == GET_CONFIG) && err == OK) { reply->write(params, size); } free(params); params = NULL; return NO_ERROR; } case GET_STATE: { CHECK_INTERFACE(IOMX, data, reply); node_id node = (void*)data.readIntPtr(); OMX_STATETYPE state = OMX_StateInvalid; status_t err = getState(node, &state); reply->writeInt32(state); reply->writeInt32(err); return NO_ERROR; } case ENABLE_GRAPHIC_BUFFERS: { CHECK_INTERFACE(IOMX, data, reply); node_id node = (void*)data.readIntPtr(); OMX_U32 port_index = data.readInt32(); OMX_BOOL enable = (OMX_BOOL)data.readInt32(); status_t err = enableGraphicBuffers(node, port_index, enable); reply->writeInt32(err); return NO_ERROR; } case GET_GRAPHIC_BUFFER_USAGE: { CHECK_INTERFACE(IOMX, data, reply); node_id node = (void*)data.readIntPtr(); OMX_U32 port_index = data.readInt32(); OMX_U32 usage = 0; status_t err = getGraphicBufferUsage(node, port_index, &usage); reply->writeInt32(err); reply->writeInt32(usage); return NO_ERROR; } case USE_BUFFER: { CHECK_INTERFACE(IOMX, data, reply); node_id node = (void*)data.readIntPtr(); OMX_U32 port_index = data.readInt32(); sp params = interface_cast(data.readStrongBinder()); buffer_id buffer; status_t err = useBuffer(node, port_index, params, &buffer); reply->writeInt32(err); if (err == OK) { reply->writeIntPtr((intptr_t)buffer); } return NO_ERROR; } case USE_GRAPHIC_BUFFER: { CHECK_INTERFACE(IOMX, data, reply); node_id node = (void*)data.readIntPtr(); OMX_U32 port_index = data.readInt32(); sp graphicBuffer = new GraphicBuffer(); data.read(*graphicBuffer); buffer_id buffer; status_t err = useGraphicBuffer( node, port_index, graphicBuffer, &buffer); reply->writeInt32(err); if (err == OK) { reply->writeIntPtr((intptr_t)buffer); } return NO_ERROR; } case STORE_META_DATA_IN_BUFFERS: { CHECK_INTERFACE(IOMX, data, reply); node_id node = (void*)data.readIntPtr(); OMX_U32 port_index = data.readInt32(); OMX_BOOL enable = (OMX_BOOL)data.readInt32(); status_t err = storeMetaDataInBuffers(node, port_index, enable); reply->writeInt32(err); return NO_ERROR; } case ALLOC_BUFFER: { CHECK_INTERFACE(IOMX, data, reply); node_id node = (void*)data.readIntPtr(); OMX_U32 port_index = data.readInt32(); size_t size = data.readInt32(); buffer_id buffer; void *buffer_data; status_t err = allocateBuffer( node, port_index, size, &buffer, &buffer_data); reply->writeInt32(err); if (err == OK) { reply->writeIntPtr((intptr_t)buffer); reply->writeIntPtr((intptr_t)buffer_data); } return NO_ERROR; } case ALLOC_BUFFER_WITH_BACKUP: { CHECK_INTERFACE(IOMX, data, reply); node_id node = (void*)data.readIntPtr(); OMX_U32 port_index = data.readInt32(); sp params = interface_cast(data.readStrongBinder()); buffer_id buffer; status_t err = allocateBufferWithBackup( node, port_index, params, &buffer); reply->writeInt32(err); if (err == OK) { reply->writeIntPtr((intptr_t)buffer); } return NO_ERROR; } case FREE_BUFFER: { CHECK_INTERFACE(IOMX, data, reply); node_id node = (void*)data.readIntPtr(); OMX_U32 port_index = data.readInt32(); buffer_id buffer = (void*)data.readIntPtr(); reply->writeInt32(freeBuffer(node, port_index, buffer)); return NO_ERROR; } case FILL_BUFFER: { CHECK_INTERFACE(IOMX, data, reply); node_id node = (void*)data.readIntPtr(); buffer_id buffer = (void*)data.readIntPtr(); reply->writeInt32(fillBuffer(node, buffer)); return NO_ERROR; } case EMPTY_BUFFER: { CHECK_INTERFACE(IOMX, data, reply); node_id node = (void*)data.readIntPtr(); buffer_id buffer = (void*)data.readIntPtr(); OMX_U32 range_offset = data.readInt32(); OMX_U32 range_length = data.readInt32(); OMX_U32 flags = data.readInt32(); OMX_TICKS timestamp = data.readInt64(); reply->writeInt32( emptyBuffer( node, buffer, range_offset, range_length, flags, timestamp)); return NO_ERROR; } case GET_EXTENSION_INDEX: { CHECK_INTERFACE(IOMX, data, reply); node_id node = (void*)data.readIntPtr(); const char *parameter_name = data.readCString(); OMX_INDEXTYPE index; status_t err = getExtensionIndex(node, parameter_name, &index); reply->writeInt32(err); if (err == OK) { reply->writeInt32(index); } return OK; } default: return BBinder::onTransact(code, data, reply, flags); } } //////////////////////////////////////////////////////////////////////////////// class BpOMXObserver : public BpInterface { public: BpOMXObserver(const sp &impl) : BpInterface(impl) { } virtual void onMessage(const omx_message &msg) { Parcel data, reply; data.writeInterfaceToken(IOMXObserver::getInterfaceDescriptor()); data.write(&msg, sizeof(msg)); remote()->transact(OBSERVER_ON_MSG, data, &reply, IBinder::FLAG_ONEWAY); } }; IMPLEMENT_META_INTERFACE(OMXObserver, "android.hardware.IOMXObserver"); status_t BnOMXObserver::onTransact( uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) { switch (code) { case OBSERVER_ON_MSG: { CHECK_INTERFACE(IOMXObserver, data, reply); omx_message msg; data.read(&msg, sizeof(msg)); // XXX Could use readInplace maybe? onMessage(msg); return NO_ERROR; } default: return BBinder::onTransact(code, data, reply, flags); } } } // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/build0000755000015700001700000000013012200324306023225 0ustar pbuserpbgroup00000000000000#!/bin/sh target='armel' make clean make -e ARCH=$target make -e ARCH=$target install android-audiosystem-1.8+13.10.20130807/lib/libmedia/MODULE_LICENSE_APACHE20000644000015700001700000000000012200324306025331 0ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/lib/libmedia/SoundPoolThread.h0000644000015700001700000000341212200324306025431 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef SOUNDPOOLTHREAD_H_ #define SOUNDPOOLTHREAD_H_ #include #include #include #include namespace android { class SoundPoolMsg { public: enum MessageType { INVALID, KILL, LOAD_SAMPLE }; SoundPoolMsg() : mMessageType(INVALID), mData(0) {} SoundPoolMsg(MessageType MessageType, int data) : mMessageType(MessageType), mData(data) {} uint16_t mMessageType; uint16_t mData; }; /* * This class handles background requests from the SoundPool */ class SoundPoolThread { public: SoundPoolThread(SoundPool* SoundPool); ~SoundPoolThread(); void loadSample(int sampleID); void quit(); void write(SoundPoolMsg msg); private: static const size_t maxMessages = 5; static int beginThread(void* arg); int run(); void doLoadSample(int sampleID); const SoundPoolMsg read(); Mutex mLock; Condition mCondition; Vector mMsgQueue; SoundPool* mSoundPool; bool mRunning; }; } // end namespace android #endif /*SOUNDPOOLTHREAD_H_*/ android-audiosystem-1.8+13.10.20130807/lib/libmedia/MediaScanner.cpp0000644000015700001700000001617712200324306025257 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "MediaScanner" #include #include #include #include #include namespace android { MediaScanner::MediaScanner() : mLocale(NULL), mSkipList(NULL), mSkipIndex(NULL) { loadSkipList(); } MediaScanner::~MediaScanner() { setLocale(NULL); free(mSkipList); free(mSkipIndex); } void MediaScanner::setLocale(const char *locale) { if (mLocale) { free(mLocale); mLocale = NULL; } if (locale) { mLocale = strdup(locale); } } const char *MediaScanner::locale() const { return mLocale; } void MediaScanner::loadSkipList() { mSkipList = (char *)malloc(PROPERTY_VALUE_MAX * sizeof(char)); if (mSkipList) { property_get("testing.mediascanner.skiplist", mSkipList, ""); } if (!mSkipList || (strlen(mSkipList) == 0)) { free(mSkipList); mSkipList = NULL; return; } mSkipIndex = (int *)malloc(PROPERTY_VALUE_MAX * sizeof(int)); if (mSkipIndex) { // dup it because strtok will modify the string char *skipList = strdup(mSkipList); if (skipList) { char * path = strtok(skipList, ","); int i = 0; while (path) { mSkipIndex[i++] = strlen(path); path = strtok(NULL, ","); } mSkipIndex[i] = -1; free(skipList); } } } MediaScanResult MediaScanner::processDirectory( const char *path, MediaScannerClient &client) { int pathLength = strlen(path); if (pathLength >= PATH_MAX) { return MEDIA_SCAN_RESULT_SKIPPED; } char* pathBuffer = (char *)malloc(PATH_MAX + 1); if (!pathBuffer) { return MEDIA_SCAN_RESULT_ERROR; } int pathRemaining = PATH_MAX - pathLength; strcpy(pathBuffer, path); if (pathLength > 0 && pathBuffer[pathLength - 1] != '/') { pathBuffer[pathLength] = '/'; pathBuffer[pathLength + 1] = 0; --pathRemaining; } client.setLocale(locale()); MediaScanResult result = doProcessDirectory(pathBuffer, pathRemaining, client, false); free(pathBuffer); return result; } bool MediaScanner::shouldSkipDirectory(char *path) { if (path && mSkipList && mSkipIndex) { int len = strlen(path); int idx = 0; // track the start position of next path in the comma // separated list obtained from getprop int startPos = 0; while (mSkipIndex[idx] != -1) { // no point to match path name if strlen mismatch if ((len == mSkipIndex[idx]) // pick out the path segment from comma separated list // to compare against current path parameter && (strncmp(path, &mSkipList[startPos], len) == 0)) { return true; } startPos += mSkipIndex[idx] + 1; // extra char for the delimiter idx++; } } return false; } MediaScanResult MediaScanner::doProcessDirectory( char *path, int pathRemaining, MediaScannerClient &client, bool noMedia) { // place to copy file or directory name char* fileSpot = path + strlen(path); struct dirent* entry; if (shouldSkipDirectory(path)) { ALOGD("Skipping: %s", path); return MEDIA_SCAN_RESULT_OK; } // Treat all files as non-media in directories that contain a ".nomedia" file if (pathRemaining >= 8 /* strlen(".nomedia") */ ) { strcpy(fileSpot, ".nomedia"); if (access(path, F_OK) == 0) { ALOGV("found .nomedia, setting noMedia flag"); noMedia = true; } // restore path fileSpot[0] = 0; } DIR* dir = opendir(path); if (!dir) { ALOGW("Error opening directory '%s', skipping: %s.", path, strerror(errno)); return MEDIA_SCAN_RESULT_SKIPPED; } MediaScanResult result = MEDIA_SCAN_RESULT_OK; while ((entry = readdir(dir))) { if (doProcessDirectoryEntry(path, pathRemaining, client, noMedia, entry, fileSpot) == MEDIA_SCAN_RESULT_ERROR) { result = MEDIA_SCAN_RESULT_ERROR; break; } } closedir(dir); return result; } MediaScanResult MediaScanner::doProcessDirectoryEntry( char *path, int pathRemaining, MediaScannerClient &client, bool noMedia, struct dirent* entry, char* fileSpot) { struct stat statbuf; const char* name = entry->d_name; // ignore "." and ".." if (name[0] == '.' && (name[1] == 0 || (name[1] == '.' && name[2] == 0))) { return MEDIA_SCAN_RESULT_SKIPPED; } int nameLength = strlen(name); if (nameLength + 1 > pathRemaining) { // path too long! return MEDIA_SCAN_RESULT_SKIPPED; } strcpy(fileSpot, name); int type = entry->d_type; if (type == DT_UNKNOWN) { // If the type is unknown, stat() the file instead. // This is sometimes necessary when accessing NFS mounted filesystems, but // could be needed in other cases well. if (stat(path, &statbuf) == 0) { if (S_ISREG(statbuf.st_mode)) { type = DT_REG; } else if (S_ISDIR(statbuf.st_mode)) { type = DT_DIR; } } else { ALOGD("stat() failed for %s: %s", path, strerror(errno) ); } } if (type == DT_DIR) { bool childNoMedia = noMedia; // set noMedia flag on directories with a name that starts with '.' // for example, the Mac ".Trashes" directory if (name[0] == '.') childNoMedia = true; // report the directory to the client if (stat(path, &statbuf) == 0) { status_t status = client.scanFile(path, statbuf.st_mtime, 0, true /*isDirectory*/, childNoMedia); if (status) { return MEDIA_SCAN_RESULT_ERROR; } } // and now process its contents strcat(fileSpot, "/"); MediaScanResult result = doProcessDirectory(path, pathRemaining - nameLength - 1, client, childNoMedia); if (result == MEDIA_SCAN_RESULT_ERROR) { return MEDIA_SCAN_RESULT_ERROR; } } else if (type == DT_REG) { stat(path, &statbuf); status_t status = client.scanFile(path, statbuf.st_mtime, statbuf.st_size, false /*isDirectory*/, noMedia); if (status) { return MEDIA_SCAN_RESULT_ERROR; } } return MEDIA_SCAN_RESULT_OK; } } // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IRemoteDisplay.cpp0000644000015700001700000000330712200324306025607 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include namespace android { enum { DISPOSE = IBinder::FIRST_CALL_TRANSACTION, }; class BpRemoteDisplay: public BpInterface { public: BpRemoteDisplay(const sp& impl) : BpInterface(impl) { } status_t dispose() { Parcel data, reply; data.writeInterfaceToken(IRemoteDisplay::getInterfaceDescriptor()); remote()->transact(DISPOSE, data, &reply); return reply.readInt32(); } }; IMPLEMENT_META_INTERFACE(RemoteDisplay, "android.media.IRemoteDisplay"); // ---------------------------------------------------------------------- status_t BnRemoteDisplay::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case DISPOSE: { CHECK_INTERFACE(IRemoteDisplay, data, reply); reply->writeInt32(dispose()); return NO_ERROR; } default: return BBinder::onTransact(code, data, reply, flags); } } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/autodetect.cpp0000644000015700001700000005242312200324306025061 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "autodetect.h" struct CharRange { uint16_t first; uint16_t last; }; #define ARRAY_SIZE(x) (sizeof(x) / sizeof(*x)) // generated from http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP932.TXT static const CharRange kShiftJISRanges[] = { { 0x8140, 0x817E }, { 0x8180, 0x81AC }, { 0x81B8, 0x81BF }, { 0x81C8, 0x81CE }, { 0x81DA, 0x81E8 }, { 0x81F0, 0x81F7 }, { 0x81FC, 0x81FC }, { 0x824F, 0x8258 }, { 0x8260, 0x8279 }, { 0x8281, 0x829A }, { 0x829F, 0x82F1 }, { 0x8340, 0x837E }, { 0x8380, 0x8396 }, { 0x839F, 0x83B6 }, { 0x83BF, 0x83D6 }, { 0x8440, 0x8460 }, { 0x8470, 0x847E }, { 0x8480, 0x8491 }, { 0x849F, 0x84BE }, { 0x8740, 0x875D }, { 0x875F, 0x8775 }, { 0x877E, 0x877E }, { 0x8780, 0x879C }, { 0x889F, 0x88FC }, { 0x8940, 0x897E }, { 0x8980, 0x89FC }, { 0x8A40, 0x8A7E }, { 0x8A80, 0x8AFC }, { 0x8B40, 0x8B7E }, { 0x8B80, 0x8BFC }, { 0x8C40, 0x8C7E }, { 0x8C80, 0x8CFC }, { 0x8D40, 0x8D7E }, { 0x8D80, 0x8DFC }, { 0x8E40, 0x8E7E }, { 0x8E80, 0x8EFC }, { 0x8F40, 0x8F7E }, { 0x8F80, 0x8FFC }, { 0x9040, 0x907E }, { 0x9080, 0x90FC }, { 0x9140, 0x917E }, { 0x9180, 0x91FC }, { 0x9240, 0x927E }, { 0x9280, 0x92FC }, { 0x9340, 0x937E }, { 0x9380, 0x93FC }, { 0x9440, 0x947E }, { 0x9480, 0x94FC }, { 0x9540, 0x957E }, { 0x9580, 0x95FC }, { 0x9640, 0x967E }, { 0x9680, 0x96FC }, { 0x9740, 0x977E }, { 0x9780, 0x97FC }, { 0x9840, 0x9872 }, { 0x989F, 0x98FC }, { 0x9940, 0x997E }, { 0x9980, 0x99FC }, { 0x9A40, 0x9A7E }, { 0x9A80, 0x9AFC }, { 0x9B40, 0x9B7E }, { 0x9B80, 0x9BFC }, { 0x9C40, 0x9C7E }, { 0x9C80, 0x9CFC }, { 0x9D40, 0x9D7E }, { 0x9D80, 0x9DFC }, { 0x9E40, 0x9E7E }, { 0x9E80, 0x9EFC }, { 0x9F40, 0x9F7E }, { 0x9F80, 0x9FFC }, { 0xE040, 0xE07E }, { 0xE080, 0xE0FC }, { 0xE140, 0xE17E }, { 0xE180, 0xE1FC }, { 0xE240, 0xE27E }, { 0xE280, 0xE2FC }, { 0xE340, 0xE37E }, { 0xE380, 0xE3FC }, { 0xE440, 0xE47E }, { 0xE480, 0xE4FC }, { 0xE540, 0xE57E }, { 0xE580, 0xE5FC }, { 0xE640, 0xE67E }, { 0xE680, 0xE6FC }, { 0xE740, 0xE77E }, { 0xE780, 0xE7FC }, { 0xE840, 0xE87E }, { 0xE880, 0xE8FC }, { 0xE940, 0xE97E }, { 0xE980, 0xE9FC }, { 0xEA40, 0xEA7E }, { 0xEA80, 0xEAA4 }, { 0xED40, 0xED7E }, { 0xED80, 0xEDFC }, { 0xEE40, 0xEE7E }, { 0xEE80, 0xEEEC }, { 0xEEEF, 0xEEFC }, { 0xFA40, 0xFA7E }, { 0xFA80, 0xFAFC }, { 0xFB40, 0xFB7E }, { 0xFB80, 0xFBFC }, { 0xFC40, 0xFC4B }, }; // generated from http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP936.TXT static const CharRange kGBKRanges[] = { { 0x8140, 0x817E }, { 0x8180, 0x81FE }, { 0x8240, 0x827E }, { 0x8280, 0x82FE }, { 0x8340, 0x837E }, { 0x8380, 0x83FE }, { 0x8440, 0x847E }, { 0x8480, 0x84FE }, { 0x8540, 0x857E }, { 0x8580, 0x85FE }, { 0x8640, 0x867E }, { 0x8680, 0x86FE }, { 0x8740, 0x877E }, { 0x8780, 0x87FE }, { 0x8840, 0x887E }, { 0x8880, 0x88FE }, { 0x8940, 0x897E }, { 0x8980, 0x89FE }, { 0x8A40, 0x8A7E }, { 0x8A80, 0x8AFE }, { 0x8B40, 0x8B7E }, { 0x8B80, 0x8BFE }, { 0x8C40, 0x8C7E }, { 0x8C80, 0x8CFE }, { 0x8D40, 0x8D7E }, { 0x8D80, 0x8DFE }, { 0x8E40, 0x8E7E }, { 0x8E80, 0x8EFE }, { 0x8F40, 0x8F7E }, { 0x8F80, 0x8FFE }, { 0x9040, 0x907E }, { 0x9080, 0x90FE }, { 0x9140, 0x917E }, { 0x9180, 0x91FE }, { 0x9240, 0x927E }, { 0x9280, 0x92FE }, { 0x9340, 0x937E }, { 0x9380, 0x93FE }, { 0x9440, 0x947E }, { 0x9480, 0x94FE }, { 0x9540, 0x957E }, { 0x9580, 0x95FE }, { 0x9640, 0x967E }, { 0x9680, 0x96FE }, { 0x9740, 0x977E }, { 0x9780, 0x97FE }, { 0x9840, 0x987E }, { 0x9880, 0x98FE }, { 0x9940, 0x997E }, { 0x9980, 0x99FE }, { 0x9A40, 0x9A7E }, { 0x9A80, 0x9AFE }, { 0x9B40, 0x9B7E }, { 0x9B80, 0x9BFE }, { 0x9C40, 0x9C7E }, { 0x9C80, 0x9CFE }, { 0x9D40, 0x9D7E }, { 0x9D80, 0x9DFE }, { 0x9E40, 0x9E7E }, { 0x9E80, 0x9EFE }, { 0x9F40, 0x9F7E }, { 0x9F80, 0x9FFE }, { 0xA040, 0xA07E }, { 0xA080, 0xA0FE }, { 0xA1A1, 0xA1FE }, { 0xA2A1, 0xA2AA }, { 0xA2B1, 0xA2E2 }, { 0xA2E5, 0xA2EE }, { 0xA2F1, 0xA2FC }, { 0xA3A1, 0xA3FE }, { 0xA4A1, 0xA4F3 }, { 0xA5A1, 0xA5F6 }, { 0xA6A1, 0xA6B8 }, { 0xA6C1, 0xA6D8 }, { 0xA6E0, 0xA6EB }, { 0xA6EE, 0xA6F2 }, { 0xA6F4, 0xA6F5 }, { 0xA7A1, 0xA7C1 }, { 0xA7D1, 0xA7F1 }, { 0xA840, 0xA87E }, { 0xA880, 0xA895 }, { 0xA8A1, 0xA8BB }, { 0xA8BD, 0xA8BE }, { 0xA8C0, 0xA8C0 }, { 0xA8C5, 0xA8E9 }, { 0xA940, 0xA957 }, { 0xA959, 0xA95A }, { 0xA95C, 0xA95C }, { 0xA960, 0xA97E }, { 0xA980, 0xA988 }, { 0xA996, 0xA996 }, { 0xA9A4, 0xA9EF }, { 0xAA40, 0xAA7E }, { 0xAA80, 0xAAA0 }, { 0xAB40, 0xAB7E }, { 0xAB80, 0xABA0 }, { 0xAC40, 0xAC7E }, { 0xAC80, 0xACA0 }, { 0xAD40, 0xAD7E }, { 0xAD80, 0xADA0 }, { 0xAE40, 0xAE7E }, { 0xAE80, 0xAEA0 }, { 0xAF40, 0xAF7E }, { 0xAF80, 0xAFA0 }, { 0xB040, 0xB07E }, { 0xB080, 0xB0FE }, { 0xB140, 0xB17E }, { 0xB180, 0xB1FE }, { 0xB240, 0xB27E }, { 0xB280, 0xB2FE }, { 0xB340, 0xB37E }, { 0xB380, 0xB3FE }, { 0xB440, 0xB47E }, { 0xB480, 0xB4FE }, { 0xB540, 0xB57E }, { 0xB580, 0xB5FE }, { 0xB640, 0xB67E }, { 0xB680, 0xB6FE }, { 0xB740, 0xB77E }, { 0xB780, 0xB7FE }, { 0xB840, 0xB87E }, { 0xB880, 0xB8FE }, { 0xB940, 0xB97E }, { 0xB980, 0xB9FE }, { 0xBA40, 0xBA7E }, { 0xBA80, 0xBAFE }, { 0xBB40, 0xBB7E }, { 0xBB80, 0xBBFE }, { 0xBC40, 0xBC7E }, { 0xBC80, 0xBCFE }, { 0xBD40, 0xBD7E }, { 0xBD80, 0xBDFE }, { 0xBE40, 0xBE7E }, { 0xBE80, 0xBEFE }, { 0xBF40, 0xBF7E }, { 0xBF80, 0xBFFE }, { 0xC040, 0xC07E }, { 0xC080, 0xC0FE }, { 0xC140, 0xC17E }, { 0xC180, 0xC1FE }, { 0xC240, 0xC27E }, { 0xC280, 0xC2FE }, { 0xC340, 0xC37E }, { 0xC380, 0xC3FE }, { 0xC440, 0xC47E }, { 0xC480, 0xC4FE }, { 0xC540, 0xC57E }, { 0xC580, 0xC5FE }, { 0xC640, 0xC67E }, { 0xC680, 0xC6FE }, { 0xC740, 0xC77E }, { 0xC780, 0xC7FE }, { 0xC840, 0xC87E }, { 0xC880, 0xC8FE }, { 0xC940, 0xC97E }, { 0xC980, 0xC9FE }, { 0xCA40, 0xCA7E }, { 0xCA80, 0xCAFE }, { 0xCB40, 0xCB7E }, { 0xCB80, 0xCBFE }, { 0xCC40, 0xCC7E }, { 0xCC80, 0xCCFE }, { 0xCD40, 0xCD7E }, { 0xCD80, 0xCDFE }, { 0xCE40, 0xCE7E }, { 0xCE80, 0xCEFE }, { 0xCF40, 0xCF7E }, { 0xCF80, 0xCFFE }, { 0xD040, 0xD07E }, { 0xD080, 0xD0FE }, { 0xD140, 0xD17E }, { 0xD180, 0xD1FE }, { 0xD240, 0xD27E }, { 0xD280, 0xD2FE }, { 0xD340, 0xD37E }, { 0xD380, 0xD3FE }, { 0xD440, 0xD47E }, { 0xD480, 0xD4FE }, { 0xD540, 0xD57E }, { 0xD580, 0xD5FE }, { 0xD640, 0xD67E }, { 0xD680, 0xD6FE }, { 0xD740, 0xD77E }, { 0xD780, 0xD7F9 }, { 0xD840, 0xD87E }, { 0xD880, 0xD8FE }, { 0xD940, 0xD97E }, { 0xD980, 0xD9FE }, { 0xDA40, 0xDA7E }, { 0xDA80, 0xDAFE }, { 0xDB40, 0xDB7E }, { 0xDB80, 0xDBFE }, { 0xDC40, 0xDC7E }, { 0xDC80, 0xDCFE }, { 0xDD40, 0xDD7E }, { 0xDD80, 0xDDFE }, { 0xDE40, 0xDE7E }, { 0xDE80, 0xDEFE }, { 0xDF40, 0xDF7E }, { 0xDF80, 0xDFFE }, { 0xE040, 0xE07E }, { 0xE080, 0xE0FE }, { 0xE140, 0xE17E }, { 0xE180, 0xE1FE }, { 0xE240, 0xE27E }, { 0xE280, 0xE2FE }, { 0xE340, 0xE37E }, { 0xE380, 0xE3FE }, { 0xE440, 0xE47E }, { 0xE480, 0xE4FE }, { 0xE540, 0xE57E }, { 0xE580, 0xE5FE }, { 0xE640, 0xE67E }, { 0xE680, 0xE6FE }, { 0xE740, 0xE77E }, { 0xE780, 0xE7FE }, { 0xE840, 0xE87E }, { 0xE880, 0xE8FE }, { 0xE940, 0xE97E }, { 0xE980, 0xE9FE }, { 0xEA40, 0xEA7E }, { 0xEA80, 0xEAFE }, { 0xEB40, 0xEB7E }, { 0xEB80, 0xEBFE }, { 0xEC40, 0xEC7E }, { 0xEC80, 0xECFE }, { 0xED40, 0xED7E }, { 0xED80, 0xEDFE }, { 0xEE40, 0xEE7E }, { 0xEE80, 0xEEFE }, { 0xEF40, 0xEF7E }, { 0xEF80, 0xEFFE }, { 0xF040, 0xF07E }, { 0xF080, 0xF0FE }, { 0xF140, 0xF17E }, { 0xF180, 0xF1FE }, { 0xF240, 0xF27E }, { 0xF280, 0xF2FE }, { 0xF340, 0xF37E }, { 0xF380, 0xF3FE }, { 0xF440, 0xF47E }, { 0xF480, 0xF4FE }, { 0xF540, 0xF57E }, { 0xF580, 0xF5FE }, { 0xF640, 0xF67E }, { 0xF680, 0xF6FE }, { 0xF740, 0xF77E }, { 0xF780, 0xF7FE }, { 0xF840, 0xF87E }, { 0xF880, 0xF8A0 }, { 0xF940, 0xF97E }, { 0xF980, 0xF9A0 }, { 0xFA40, 0xFA7E }, { 0xFA80, 0xFAA0 }, { 0xFB40, 0xFB7E }, { 0xFB80, 0xFBA0 }, { 0xFC40, 0xFC7E }, { 0xFC80, 0xFCA0 }, { 0xFD40, 0xFD7E }, { 0xFD80, 0xFDA0 }, { 0xFE40, 0xFE4F }, }; // generated from http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP949.TXT static const CharRange kEUCKRRanges[] = { { 0x8141, 0x815A }, { 0x8161, 0x817A }, { 0x8181, 0x81FE }, { 0x8241, 0x825A }, { 0x8261, 0x827A }, { 0x8281, 0x82FE }, { 0x8341, 0x835A }, { 0x8361, 0x837A }, { 0x8381, 0x83FE }, { 0x8441, 0x845A }, { 0x8461, 0x847A }, { 0x8481, 0x84FE }, { 0x8541, 0x855A }, { 0x8561, 0x857A }, { 0x8581, 0x85FE }, { 0x8641, 0x865A }, { 0x8661, 0x867A }, { 0x8681, 0x86FE }, { 0x8741, 0x875A }, { 0x8761, 0x877A }, { 0x8781, 0x87FE }, { 0x8841, 0x885A }, { 0x8861, 0x887A }, { 0x8881, 0x88FE }, { 0x8941, 0x895A }, { 0x8961, 0x897A }, { 0x8981, 0x89FE }, { 0x8A41, 0x8A5A }, { 0x8A61, 0x8A7A }, { 0x8A81, 0x8AFE }, { 0x8B41, 0x8B5A }, { 0x8B61, 0x8B7A }, { 0x8B81, 0x8BFE }, { 0x8C41, 0x8C5A }, { 0x8C61, 0x8C7A }, { 0x8C81, 0x8CFE }, { 0x8D41, 0x8D5A }, { 0x8D61, 0x8D7A }, { 0x8D81, 0x8DFE }, { 0x8E41, 0x8E5A }, { 0x8E61, 0x8E7A }, { 0x8E81, 0x8EFE }, { 0x8F41, 0x8F5A }, { 0x8F61, 0x8F7A }, { 0x8F81, 0x8FFE }, { 0x9041, 0x905A }, { 0x9061, 0x907A }, { 0x9081, 0x90FE }, { 0x9141, 0x915A }, { 0x9161, 0x917A }, { 0x9181, 0x91FE }, { 0x9241, 0x925A }, { 0x9261, 0x927A }, { 0x9281, 0x92FE }, { 0x9341, 0x935A }, { 0x9361, 0x937A }, { 0x9381, 0x93FE }, { 0x9441, 0x945A }, { 0x9461, 0x947A }, { 0x9481, 0x94FE }, { 0x9541, 0x955A }, { 0x9561, 0x957A }, { 0x9581, 0x95FE }, { 0x9641, 0x965A }, { 0x9661, 0x967A }, { 0x9681, 0x96FE }, { 0x9741, 0x975A }, { 0x9761, 0x977A }, { 0x9781, 0x97FE }, { 0x9841, 0x985A }, { 0x9861, 0x987A }, { 0x9881, 0x98FE }, { 0x9941, 0x995A }, { 0x9961, 0x997A }, { 0x9981, 0x99FE }, { 0x9A41, 0x9A5A }, { 0x9A61, 0x9A7A }, { 0x9A81, 0x9AFE }, { 0x9B41, 0x9B5A }, { 0x9B61, 0x9B7A }, { 0x9B81, 0x9BFE }, { 0x9C41, 0x9C5A }, { 0x9C61, 0x9C7A }, { 0x9C81, 0x9CFE }, { 0x9D41, 0x9D5A }, { 0x9D61, 0x9D7A }, { 0x9D81, 0x9DFE }, { 0x9E41, 0x9E5A }, { 0x9E61, 0x9E7A }, { 0x9E81, 0x9EFE }, { 0x9F41, 0x9F5A }, { 0x9F61, 0x9F7A }, { 0x9F81, 0x9FFE }, { 0xA041, 0xA05A }, { 0xA061, 0xA07A }, { 0xA081, 0xA0FE }, { 0xA141, 0xA15A }, { 0xA161, 0xA17A }, { 0xA181, 0xA1FE }, { 0xA241, 0xA25A }, { 0xA261, 0xA27A }, { 0xA281, 0xA2E7 }, { 0xA341, 0xA35A }, { 0xA361, 0xA37A }, { 0xA381, 0xA3FE }, { 0xA441, 0xA45A }, { 0xA461, 0xA47A }, { 0xA481, 0xA4FE }, { 0xA541, 0xA55A }, { 0xA561, 0xA57A }, { 0xA581, 0xA5AA }, { 0xA5B0, 0xA5B9 }, { 0xA5C1, 0xA5D8 }, { 0xA5E1, 0xA5F8 }, { 0xA641, 0xA65A }, { 0xA661, 0xA67A }, { 0xA681, 0xA6E4 }, { 0xA741, 0xA75A }, { 0xA761, 0xA77A }, { 0xA781, 0xA7EF }, { 0xA841, 0xA85A }, { 0xA861, 0xA87A }, { 0xA881, 0xA8A4 }, { 0xA8A6, 0xA8A6 }, { 0xA8A8, 0xA8AF }, { 0xA8B1, 0xA8FE }, { 0xA941, 0xA95A }, { 0xA961, 0xA97A }, { 0xA981, 0xA9FE }, { 0xAA41, 0xAA5A }, { 0xAA61, 0xAA7A }, { 0xAA81, 0xAAF3 }, { 0xAB41, 0xAB5A }, { 0xAB61, 0xAB7A }, { 0xAB81, 0xABF6 }, { 0xAC41, 0xAC5A }, { 0xAC61, 0xAC7A }, { 0xAC81, 0xACC1 }, { 0xACD1, 0xACF1 }, { 0xAD41, 0xAD5A }, { 0xAD61, 0xAD7A }, { 0xAD81, 0xADA0 }, { 0xAE41, 0xAE5A }, { 0xAE61, 0xAE7A }, { 0xAE81, 0xAEA0 }, { 0xAF41, 0xAF5A }, { 0xAF61, 0xAF7A }, { 0xAF81, 0xAFA0 }, { 0xB041, 0xB05A }, { 0xB061, 0xB07A }, { 0xB081, 0xB0FE }, { 0xB141, 0xB15A }, { 0xB161, 0xB17A }, { 0xB181, 0xB1FE }, { 0xB241, 0xB25A }, { 0xB261, 0xB27A }, { 0xB281, 0xB2FE }, { 0xB341, 0xB35A }, { 0xB361, 0xB37A }, { 0xB381, 0xB3FE }, { 0xB441, 0xB45A }, { 0xB461, 0xB47A }, { 0xB481, 0xB4FE }, { 0xB541, 0xB55A }, { 0xB561, 0xB57A }, { 0xB581, 0xB5FE }, { 0xB641, 0xB65A }, { 0xB661, 0xB67A }, { 0xB681, 0xB6FE }, { 0xB741, 0xB75A }, { 0xB761, 0xB77A }, { 0xB781, 0xB7FE }, { 0xB841, 0xB85A }, { 0xB861, 0xB87A }, { 0xB881, 0xB8FE }, { 0xB941, 0xB95A }, { 0xB961, 0xB97A }, { 0xB981, 0xB9FE }, { 0xBA41, 0xBA5A }, { 0xBA61, 0xBA7A }, { 0xBA81, 0xBAFE }, { 0xBB41, 0xBB5A }, { 0xBB61, 0xBB7A }, { 0xBB81, 0xBBFE }, { 0xBC41, 0xBC5A }, { 0xBC61, 0xBC7A }, { 0xBC81, 0xBCFE }, { 0xBD41, 0xBD5A }, { 0xBD61, 0xBD7A }, { 0xBD81, 0xBDFE }, { 0xBE41, 0xBE5A }, { 0xBE61, 0xBE7A }, { 0xBE81, 0xBEFE }, { 0xBF41, 0xBF5A }, { 0xBF61, 0xBF7A }, { 0xBF81, 0xBFFE }, { 0xC041, 0xC05A }, { 0xC061, 0xC07A }, { 0xC081, 0xC0FE }, { 0xC141, 0xC15A }, { 0xC161, 0xC17A }, { 0xC181, 0xC1FE }, { 0xC241, 0xC25A }, { 0xC261, 0xC27A }, { 0xC281, 0xC2FE }, { 0xC341, 0xC35A }, { 0xC361, 0xC37A }, { 0xC381, 0xC3FE }, { 0xC441, 0xC45A }, { 0xC461, 0xC47A }, { 0xC481, 0xC4FE }, { 0xC541, 0xC55A }, { 0xC561, 0xC57A }, { 0xC581, 0xC5FE }, { 0xC641, 0xC652 }, { 0xC6A1, 0xC6FE }, { 0xC7A1, 0xC7FE }, { 0xC8A1, 0xC8FE }, { 0xCAA1, 0xCAFE }, { 0xCBA1, 0xCBFE }, { 0xCCA1, 0xCCFE }, { 0xCDA1, 0xCDFE }, { 0xCEA1, 0xCEFE }, { 0xCFA1, 0xCFFE }, { 0xD0A1, 0xD0FE }, { 0xD1A1, 0xD1FE }, { 0xD2A1, 0xD2FE }, { 0xD3A1, 0xD3FE }, { 0xD4A1, 0xD4FE }, { 0xD5A1, 0xD5FE }, { 0xD6A1, 0xD6FE }, { 0xD7A1, 0xD7FE }, { 0xD8A1, 0xD8FE }, { 0xD9A1, 0xD9FE }, { 0xDAA1, 0xDAFE }, { 0xDBA1, 0xDBFE }, { 0xDCA1, 0xDCFE }, { 0xDDA1, 0xDDFE }, { 0xDEA1, 0xDEFE }, { 0xDFA1, 0xDFFE }, { 0xE0A1, 0xE0FE }, { 0xE1A1, 0xE1FE }, { 0xE2A1, 0xE2FE }, { 0xE3A1, 0xE3FE }, { 0xE4A1, 0xE4FE }, { 0xE5A1, 0xE5FE }, { 0xE6A1, 0xE6FE }, { 0xE7A1, 0xE7FE }, { 0xE8A1, 0xE8FE }, { 0xE9A1, 0xE9FE }, { 0xEAA1, 0xEAFE }, { 0xEBA1, 0xEBFE }, { 0xECA1, 0xECFE }, { 0xEDA1, 0xEDFE }, { 0xEEA1, 0xEEFE }, { 0xEFA1, 0xEFFE }, { 0xF0A1, 0xF0FE }, { 0xF1A1, 0xF1FE }, { 0xF2A1, 0xF2FE }, { 0xF3A1, 0xF3FE }, { 0xF4A1, 0xF4FE }, { 0xF5A1, 0xF5FE }, { 0xF6A1, 0xF6FE }, { 0xF7A1, 0xF7FE }, { 0xF8A1, 0xF8FE }, { 0xF9A1, 0xF9FE }, { 0xFAA1, 0xFAFE }, { 0xFBA1, 0xFBFE }, { 0xFCA1, 0xFCFE }, { 0xFDA1, 0xFDFE }, }; // generated from http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP950.TXT static const CharRange kBig5Ranges[] = { { 0xA140, 0xA17E }, { 0xA1A1, 0xA1FE }, { 0xA240, 0xA27E }, { 0xA2A1, 0xA2FE }, { 0xA340, 0xA37E }, { 0xA3A1, 0xA3BF }, { 0xA3E1, 0xA3E1 }, { 0xA440, 0xA47E }, { 0xA4A1, 0xA4FE }, { 0xA540, 0xA57E }, { 0xA5A1, 0xA5FE }, { 0xA640, 0xA67E }, { 0xA6A1, 0xA6FE }, { 0xA740, 0xA77E }, { 0xA7A1, 0xA7FE }, { 0xA840, 0xA87E }, { 0xA8A1, 0xA8FE }, { 0xA940, 0xA97E }, { 0xA9A1, 0xA9FE }, { 0xAA40, 0xAA7E }, { 0xAAA1, 0xAAFE }, { 0xAB40, 0xAB7E }, { 0xABA1, 0xABFE }, { 0xAC40, 0xAC7E }, { 0xACA1, 0xACFE }, { 0xAD40, 0xAD7E }, { 0xADA1, 0xADFE }, { 0xAE40, 0xAE7E }, { 0xAEA1, 0xAEFE }, { 0xAF40, 0xAF7E }, { 0xAFA1, 0xAFFE }, { 0xB040, 0xB07E }, { 0xB0A1, 0xB0FE }, { 0xB140, 0xB17E }, { 0xB1A1, 0xB1FE }, { 0xB240, 0xB27E }, { 0xB2A1, 0xB2FE }, { 0xB340, 0xB37E }, { 0xB3A1, 0xB3FE }, { 0xB440, 0xB47E }, { 0xB4A1, 0xB4FE }, { 0xB540, 0xB57E }, { 0xB5A1, 0xB5FE }, { 0xB640, 0xB67E }, { 0xB6A1, 0xB6FE }, { 0xB740, 0xB77E }, { 0xB7A1, 0xB7FE }, { 0xB840, 0xB87E }, { 0xB8A1, 0xB8FE }, { 0xB940, 0xB97E }, { 0xB9A1, 0xB9FE }, { 0xBA40, 0xBA7E }, { 0xBAA1, 0xBAFE }, { 0xBB40, 0xBB7E }, { 0xBBA1, 0xBBFE }, { 0xBC40, 0xBC7E }, { 0xBCA1, 0xBCFE }, { 0xBD40, 0xBD7E }, { 0xBDA1, 0xBDFE }, { 0xBE40, 0xBE7E }, { 0xBEA1, 0xBEFE }, { 0xBF40, 0xBF7E }, { 0xBFA1, 0xBFFE }, { 0xC040, 0xC07E }, { 0xC0A1, 0xC0FE }, { 0xC140, 0xC17E }, { 0xC1A1, 0xC1FE }, { 0xC240, 0xC27E }, { 0xC2A1, 0xC2FE }, { 0xC340, 0xC37E }, { 0xC3A1, 0xC3FE }, { 0xC440, 0xC47E }, { 0xC4A1, 0xC4FE }, { 0xC540, 0xC57E }, { 0xC5A1, 0xC5FE }, { 0xC640, 0xC67E }, { 0xC940, 0xC97E }, { 0xC9A1, 0xC9FE }, { 0xCA40, 0xCA7E }, { 0xCAA1, 0xCAFE }, { 0xCB40, 0xCB7E }, { 0xCBA1, 0xCBFE }, { 0xCC40, 0xCC7E }, { 0xCCA1, 0xCCFE }, { 0xCD40, 0xCD7E }, { 0xCDA1, 0xCDFE }, { 0xCE40, 0xCE7E }, { 0xCEA1, 0xCEFE }, { 0xCF40, 0xCF7E }, { 0xCFA1, 0xCFFE }, { 0xD040, 0xD07E }, { 0xD0A1, 0xD0FE }, { 0xD140, 0xD17E }, { 0xD1A1, 0xD1FE }, { 0xD240, 0xD27E }, { 0xD2A1, 0xD2FE }, { 0xD340, 0xD37E }, { 0xD3A1, 0xD3FE }, { 0xD440, 0xD47E }, { 0xD4A1, 0xD4FE }, { 0xD540, 0xD57E }, { 0xD5A1, 0xD5FE }, { 0xD640, 0xD67E }, { 0xD6A1, 0xD6FE }, { 0xD740, 0xD77E }, { 0xD7A1, 0xD7FE }, { 0xD840, 0xD87E }, { 0xD8A1, 0xD8FE }, { 0xD940, 0xD97E }, { 0xD9A1, 0xD9FE }, { 0xDA40, 0xDA7E }, { 0xDAA1, 0xDAFE }, { 0xDB40, 0xDB7E }, { 0xDBA1, 0xDBFE }, { 0xDC40, 0xDC7E }, { 0xDCA1, 0xDCFE }, { 0xDD40, 0xDD7E }, { 0xDDA1, 0xDDFE }, { 0xDE40, 0xDE7E }, { 0xDEA1, 0xDEFE }, { 0xDF40, 0xDF7E }, { 0xDFA1, 0xDFFE }, { 0xE040, 0xE07E }, { 0xE0A1, 0xE0FE }, { 0xE140, 0xE17E }, { 0xE1A1, 0xE1FE }, { 0xE240, 0xE27E }, { 0xE2A1, 0xE2FE }, { 0xE340, 0xE37E }, { 0xE3A1, 0xE3FE }, { 0xE440, 0xE47E }, { 0xE4A1, 0xE4FE }, { 0xE540, 0xE57E }, { 0xE5A1, 0xE5FE }, { 0xE640, 0xE67E }, { 0xE6A1, 0xE6FE }, { 0xE740, 0xE77E }, { 0xE7A1, 0xE7FE }, { 0xE840, 0xE87E }, { 0xE8A1, 0xE8FE }, { 0xE940, 0xE97E }, { 0xE9A1, 0xE9FE }, { 0xEA40, 0xEA7E }, { 0xEAA1, 0xEAFE }, { 0xEB40, 0xEB7E }, { 0xEBA1, 0xEBFE }, { 0xEC40, 0xEC7E }, { 0xECA1, 0xECFE }, { 0xED40, 0xED7E }, { 0xEDA1, 0xEDFE }, { 0xEE40, 0xEE7E }, { 0xEEA1, 0xEEFE }, { 0xEF40, 0xEF7E }, { 0xEFA1, 0xEFFE }, { 0xF040, 0xF07E }, { 0xF0A1, 0xF0FE }, { 0xF140, 0xF17E }, { 0xF1A1, 0xF1FE }, { 0xF240, 0xF27E }, { 0xF2A1, 0xF2FE }, { 0xF340, 0xF37E }, { 0xF3A1, 0xF3FE }, { 0xF440, 0xF47E }, { 0xF4A1, 0xF4FE }, { 0xF540, 0xF57E }, { 0xF5A1, 0xF5FE }, { 0xF640, 0xF67E }, { 0xF6A1, 0xF6FE }, { 0xF740, 0xF77E }, { 0xF7A1, 0xF7FE }, { 0xF840, 0xF87E }, { 0xF8A1, 0xF8FE }, { 0xF940, 0xF97E }, { 0xF9A1, 0xF9FE }, }; static bool charMatchesEncoding(int ch, const CharRange* encodingRanges, int rangeCount) { // Use binary search to see if the character is contained in the encoding int low = 0; int high = rangeCount; while (low < high) { int i = (low + high) / 2; const CharRange* range = &encodingRanges[i]; if (ch >= range->first && ch <= range->last) return true; if (ch > range->last) low = i + 1; else high = i; } return false; } extern uint32_t findPossibleEncodings(int ch) { // ASCII matches everything if (ch < 256) return kEncodingAll; int result = kEncodingNone; if (charMatchesEncoding(ch, kShiftJISRanges, ARRAY_SIZE(kShiftJISRanges))) result |= kEncodingShiftJIS; if (charMatchesEncoding(ch, kGBKRanges, ARRAY_SIZE(kGBKRanges))) result |= kEncodingGBK; if (charMatchesEncoding(ch, kBig5Ranges, ARRAY_SIZE(kBig5Ranges))) result |= kEncodingBig5; if (charMatchesEncoding(ch, kEUCKRRanges, ARRAY_SIZE(kEUCKRRanges))) result |= kEncodingEUCKR; return result; } android-audiosystem-1.8+13.10.20130807/lib/libmedia/Makefile0000644000015700001700000000336212200324306023652 0ustar pbuserpbgroup00000000000000make_home := ../../ top_srcdir := ../../ include $(make_home)/project_make WARN = -Wall include $(make_home)/package_make include ../Makefile.defines ####################### # CUSTOMIZE MACROS HERE ####################### # name your library here PKG_LIB = media # at least one of following lines must be uncommented # CFILES is .c # CCFILES is .cc # CPPFILES is .cpp # CXXFILES is .cxx CPPFILES = AudioTrack.cpp \ IAudioFlinger.cpp \ IAudioFlingerClient.cpp \ IAudioTrack.cpp \ IAudioRecord.cpp \ AudioRecord.cpp \ AudioSystem.cpp \ IAudioPolicyService.cpp \ IEffect.cpp \ IEffectClient.cpp #CCFILES = #CPPFILES = #CXXFILES = FORCE_CXX_LINK = TRUE # if this library depends on private static library built # by this package, uncomment next line #STATIC_LIBS = # modify compiler command-line options CFLAGS = -fPIC -DHAVE_ANDROID_OS=1 $(CONFIG_DEFINES) # modify linker command-line options LDFLAGS += -L ../libcutils/ -L ../utils/ -L ../binder SHARED_LIBS += -lcutils -lutils -lbinder -lpthread # build private static library private_lib = YES # build simple shared library # single header file exported, should be .../lib/include/$(PKG_LIB).h PKGCONFIG = NO # build pkgconfig shared library # change PKGCONFIG to YES and add following three macros # PKG_LIBDESC is one line description of library # PKG_REQUIRES is list of required pkgconfig libraries # PKG_HEADERS is list of header files to export #PKG_LIBDESC = #PKG_REQUIRES = #PKG_HEADERS = MAKESUBDIR = YES LIBSUBDIR = /$(install_lib_rel) HDRSUBDIR = /$(install_hdr_rel) ############################ # END OF MACROS TO CUSTOMIZE ############################ all: $(TARGET) #-include $(DEPENDS) include $(make_home)/target_lib android-audiosystem-1.8+13.10.20130807/lib/libmedia/IRemoteDisplayClient.cpp0000644000015700001700000000652612200324306026754 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include namespace android { enum { ON_DISPLAY_CONNECTED = IBinder::FIRST_CALL_TRANSACTION, ON_DISPLAY_DISCONNECTED, ON_DISPLAY_ERROR, }; class BpRemoteDisplayClient: public BpInterface { public: BpRemoteDisplayClient(const sp& impl) : BpInterface(impl) { } void onDisplayConnected(const sp& surfaceTexture, uint32_t width, uint32_t height, uint32_t flags) { Parcel data, reply; data.writeInterfaceToken(IRemoteDisplayClient::getInterfaceDescriptor()); data.writeStrongBinder(surfaceTexture->asBinder()); data.writeInt32(width); data.writeInt32(height); data.writeInt32(flags); remote()->transact(ON_DISPLAY_CONNECTED, data, &reply, IBinder::FLAG_ONEWAY); } void onDisplayDisconnected() { Parcel data, reply; data.writeInterfaceToken(IRemoteDisplayClient::getInterfaceDescriptor()); remote()->transact(ON_DISPLAY_DISCONNECTED, data, &reply, IBinder::FLAG_ONEWAY); } void onDisplayError(int32_t error) { Parcel data, reply; data.writeInterfaceToken(IRemoteDisplayClient::getInterfaceDescriptor()); data.writeInt32(error); remote()->transact(ON_DISPLAY_ERROR, data, &reply, IBinder::FLAG_ONEWAY); } }; IMPLEMENT_META_INTERFACE(RemoteDisplayClient, "android.media.IRemoteDisplayClient"); // ---------------------------------------------------------------------- status_t BnRemoteDisplayClient::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case ON_DISPLAY_CONNECTED: { CHECK_INTERFACE(IRemoteDisplayClient, data, reply); sp surfaceTexture( interface_cast(data.readStrongBinder())); uint32_t width = data.readInt32(); uint32_t height = data.readInt32(); uint32_t flags = data.readInt32(); onDisplayConnected(surfaceTexture, width, height, flags); return NO_ERROR; } case ON_DISPLAY_DISCONNECTED: { CHECK_INTERFACE(IRemoteDisplayClient, data, reply); onDisplayDisconnected(); return NO_ERROR; } case ON_DISPLAY_ERROR: { CHECK_INTERFACE(IRemoteDisplayClient, data, reply); int32_t error = data.readInt32(); onDisplayError(error); return NO_ERROR; } default: return BBinder::onTransact(code, data, reply, flags); } } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IAudioFlinger.cpp0000644000015700001700000012617312200324306025405 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2007, The Android Open Source Project ** Copyright (c) 2012, The Linux Foundation. All rights reserved. ** Not a Contribution, Apache license notifications and license are retained ** for attribution purposes only. ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #define LOG_TAG "IAudioFlinger" //#define LOG_NDEBUG 0 #include #include #include #include #include namespace android { enum { CREATE_TRACK = IBinder::FIRST_CALL_TRANSACTION, OPEN_RECORD, SAMPLE_RATE, CHANNEL_COUNT, // obsolete FORMAT, FRAME_COUNT, LATENCY, SET_MASTER_VOLUME, SET_MASTER_MUTE, MASTER_VOLUME, MASTER_MUTE, SET_STREAM_VOLUME, SET_STREAM_MUTE, STREAM_VOLUME, STREAM_MUTE, SET_MODE, SET_MIC_MUTE, GET_MIC_MUTE, SET_PARAMETERS, GET_PARAMETERS, REGISTER_CLIENT, GET_INPUTBUFFERSIZE, OPEN_OUTPUT, OPEN_DUPLICATE_OUTPUT, CLOSE_OUTPUT, SUSPEND_OUTPUT, RESTORE_OUTPUT, OPEN_INPUT, CLOSE_INPUT, SET_STREAM_OUTPUT, SET_VOICE_VOLUME, GET_RENDER_POSITION, GET_INPUT_FRAMES_LOST, NEW_AUDIO_SESSION_ID, ACQUIRE_AUDIO_SESSION_ID, RELEASE_AUDIO_SESSION_ID, QUERY_NUM_EFFECTS, QUERY_EFFECT, GET_EFFECT_DESCRIPTOR, CREATE_EFFECT, MOVE_EFFECTS, LOAD_HW_MODULE, GET_PRIMARY_OUTPUT_SAMPLING_RATE, GET_PRIMARY_OUTPUT_FRAME_COUNT, #ifdef QCOM_HARDWARE CREATE_DIRECT_TRACK #endif }; class BpAudioFlinger : public BpInterface { public: BpAudioFlinger(const sp& impl) : BpInterface(impl) { } virtual sp createTrack( pid_t pid, audio_stream_type_t streamType, uint32_t sampleRate, audio_format_t format, audio_channel_mask_t channelMask, int frameCount, track_flags_t flags, const sp& sharedBuffer, audio_io_handle_t output, pid_t tid, int *sessionId, status_t *status) { Parcel data, reply; sp track; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32(pid); data.writeInt32((int32_t) streamType); data.writeInt32(sampleRate); data.writeInt32(format); data.writeInt32(channelMask); data.writeInt32(frameCount); data.writeInt32((int32_t) flags); data.writeStrongBinder(sharedBuffer->asBinder()); data.writeInt32((int32_t) output); data.writeInt32((int32_t) tid); int lSessionId = 0; if (sessionId != NULL) { lSessionId = *sessionId; } data.writeInt32(lSessionId); status_t lStatus = remote()->transact(CREATE_TRACK, data, &reply); if (lStatus != NO_ERROR) { ALOGE("createTrack error: %s", strerror(-lStatus)); } else { lSessionId = reply.readInt32(); if (sessionId != NULL) { *sessionId = lSessionId; } lStatus = reply.readInt32(); track = interface_cast(reply.readStrongBinder()); } if (status) { *status = lStatus; } return track; } #ifdef QCOM_HARDWARE virtual sp createDirectTrack( pid_t pid, uint32_t sampleRate, audio_channel_mask_t channelMask, audio_io_handle_t output, int *sessionId, IDirectTrackClient* client, audio_stream_type_t streamType, status_t *status) { Parcel data, reply; sp track; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32(pid); data.writeInt32(sampleRate); data.writeInt32(channelMask); data.writeInt32((int32_t)output); int lSessionId = 0; if (sessionId != NULL) { lSessionId = *sessionId; } data.writeInt32(lSessionId); data.write(client, sizeof(IDirectTrackClient)); data.writeInt32((int32_t) streamType); status_t lStatus = remote()->transact(CREATE_DIRECT_TRACK, data, &reply); if (lStatus != NO_ERROR) { ALOGE("createDirectTrack error: %s", strerror(-lStatus)); } else { lSessionId = reply.readInt32(); if (sessionId != NULL) { *sessionId = lSessionId; } lStatus = reply.readInt32(); track = interface_cast(reply.readStrongBinder()); } if (status) { *status = lStatus; } return track; } #endif virtual sp openRecord( pid_t pid, audio_io_handle_t input, uint32_t sampleRate, audio_format_t format, audio_channel_mask_t channelMask, int frameCount, track_flags_t flags, pid_t tid, int *sessionId, status_t *status) { Parcel data, reply; sp record; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32(pid); data.writeInt32((int32_t) input); data.writeInt32(sampleRate); data.writeInt32(format); data.writeInt32(channelMask); data.writeInt32(frameCount); data.writeInt32(flags); data.writeInt32((int32_t) tid); int lSessionId = 0; if (sessionId != NULL) { lSessionId = *sessionId; } data.writeInt32(lSessionId); status_t lStatus = remote()->transact(OPEN_RECORD, data, &reply); if (lStatus != NO_ERROR) { ALOGE("openRecord error: %s", strerror(-lStatus)); } else { lSessionId = reply.readInt32(); if (sessionId != NULL) { *sessionId = lSessionId; } lStatus = reply.readInt32(); record = interface_cast(reply.readStrongBinder()); } if (status) { *status = lStatus; } return record; } virtual uint32_t sampleRate(audio_io_handle_t output) const { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32((int32_t) output); remote()->transact(SAMPLE_RATE, data, &reply); return reply.readInt32(); } #if 0 virtual int channelCount(audio_io_handle_t output) const { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32((int32_t) output); remote()->transact(CHANNEL_COUNT, data, &reply); return reply.readInt32(); } #endif virtual audio_format_t format(audio_io_handle_t output) const { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32((int32_t) output); remote()->transact(FORMAT, data, &reply); return (audio_format_t) reply.readInt32(); } virtual size_t frameCount(audio_io_handle_t output) const { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32((int32_t) output); remote()->transact(FRAME_COUNT, data, &reply); return reply.readInt32(); } virtual uint32_t latency(audio_io_handle_t output) const { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32((int32_t) output); remote()->transact(LATENCY, data, &reply); return reply.readInt32(); } virtual status_t setMasterVolume(float value) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeFloat(value); remote()->transact(SET_MASTER_VOLUME, data, &reply); return reply.readInt32(); } virtual status_t setMasterMute(bool muted) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32(muted); remote()->transact(SET_MASTER_MUTE, data, &reply); return reply.readInt32(); } virtual float masterVolume() const { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); remote()->transact(MASTER_VOLUME, data, &reply); return reply.readFloat(); } virtual bool masterMute() const { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); remote()->transact(MASTER_MUTE, data, &reply); return reply.readInt32(); } virtual status_t setStreamVolume(audio_stream_type_t stream, float value, audio_io_handle_t output) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32((int32_t) stream); data.writeFloat(value); data.writeInt32((int32_t) output); remote()->transact(SET_STREAM_VOLUME, data, &reply); return reply.readInt32(); } virtual status_t setStreamMute(audio_stream_type_t stream, bool muted) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32((int32_t) stream); data.writeInt32(muted); remote()->transact(SET_STREAM_MUTE, data, &reply); return reply.readInt32(); } virtual float streamVolume(audio_stream_type_t stream, audio_io_handle_t output) const { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32((int32_t) stream); data.writeInt32((int32_t) output); remote()->transact(STREAM_VOLUME, data, &reply); return reply.readFloat(); } virtual bool streamMute(audio_stream_type_t stream) const { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32((int32_t) stream); remote()->transact(STREAM_MUTE, data, &reply); return reply.readInt32(); } virtual status_t setMode(audio_mode_t mode) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32(mode); remote()->transact(SET_MODE, data, &reply); return reply.readInt32(); } virtual status_t setMicMute(bool state) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32(state); remote()->transact(SET_MIC_MUTE, data, &reply); return reply.readInt32(); } virtual bool getMicMute() const { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); remote()->transact(GET_MIC_MUTE, data, &reply); return reply.readInt32(); } virtual status_t setParameters(audio_io_handle_t ioHandle, const String8& keyValuePairs) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32((int32_t) ioHandle); data.writeString8(keyValuePairs); remote()->transact(SET_PARAMETERS, data, &reply); return reply.readInt32(); } virtual String8 getParameters(audio_io_handle_t ioHandle, const String8& keys) const { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32((int32_t) ioHandle); data.writeString8(keys); remote()->transact(GET_PARAMETERS, data, &reply); return reply.readString8(); } virtual void registerClient(const sp& client) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeStrongBinder(client->asBinder()); remote()->transact(REGISTER_CLIENT, data, &reply); } virtual size_t getInputBufferSize(uint32_t sampleRate, audio_format_t format, audio_channel_mask_t channelMask) const { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32(sampleRate); data.writeInt32(format); data.writeInt32(channelMask); remote()->transact(GET_INPUTBUFFERSIZE, data, &reply); return reply.readInt32(); } virtual audio_io_handle_t openOutput(audio_module_handle_t module, audio_devices_t *pDevices, uint32_t *pSamplingRate, audio_format_t *pFormat, audio_channel_mask_t *pChannelMask, uint32_t *pLatencyMs, audio_output_flags_t flags) { Parcel data, reply; audio_devices_t devices = pDevices ? *pDevices : (audio_devices_t)0; uint32_t samplingRate = pSamplingRate ? *pSamplingRate : 0; audio_format_t format = pFormat ? *pFormat : AUDIO_FORMAT_DEFAULT; audio_channel_mask_t channelMask = pChannelMask ? *pChannelMask : (audio_channel_mask_t)0; uint32_t latency = pLatencyMs ? *pLatencyMs : 0; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32(module); data.writeInt32(devices); data.writeInt32(samplingRate); data.writeInt32(format); data.writeInt32(channelMask); data.writeInt32(latency); data.writeInt32((int32_t) flags); remote()->transact(OPEN_OUTPUT, data, &reply); audio_io_handle_t output = (audio_io_handle_t) reply.readInt32(); ALOGV("openOutput() returned output, %d", output); devices = (audio_devices_t)reply.readInt32(); if (pDevices) *pDevices = devices; samplingRate = reply.readInt32(); if (pSamplingRate) *pSamplingRate = samplingRate; format = (audio_format_t) reply.readInt32(); if (pFormat) *pFormat = format; channelMask = (audio_channel_mask_t)reply.readInt32(); if (pChannelMask) *pChannelMask = channelMask; latency = reply.readInt32(); if (pLatencyMs) *pLatencyMs = latency; return output; } virtual audio_io_handle_t openDuplicateOutput(audio_io_handle_t output1, audio_io_handle_t output2) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32((int32_t) output1); data.writeInt32((int32_t) output2); remote()->transact(OPEN_DUPLICATE_OUTPUT, data, &reply); return (audio_io_handle_t) reply.readInt32(); } virtual status_t closeOutput(audio_io_handle_t output) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32((int32_t) output); remote()->transact(CLOSE_OUTPUT, data, &reply); return reply.readInt32(); } virtual status_t suspendOutput(audio_io_handle_t output) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32((int32_t) output); remote()->transact(SUSPEND_OUTPUT, data, &reply); return reply.readInt32(); } virtual status_t restoreOutput(audio_io_handle_t output) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32((int32_t) output); remote()->transact(RESTORE_OUTPUT, data, &reply); return reply.readInt32(); } virtual audio_io_handle_t openInput(audio_module_handle_t module, audio_devices_t *pDevices, uint32_t *pSamplingRate, audio_format_t *pFormat, audio_channel_mask_t *pChannelMask) { Parcel data, reply; audio_devices_t devices = pDevices ? *pDevices : (audio_devices_t)0; uint32_t samplingRate = pSamplingRate ? *pSamplingRate : 0; audio_format_t format = pFormat ? *pFormat : AUDIO_FORMAT_DEFAULT; audio_channel_mask_t channelMask = pChannelMask ? *pChannelMask : (audio_channel_mask_t)0; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32(module); data.writeInt32(devices); data.writeInt32(samplingRate); data.writeInt32(format); data.writeInt32(channelMask); remote()->transact(OPEN_INPUT, data, &reply); audio_io_handle_t input = (audio_io_handle_t) reply.readInt32(); devices = (audio_devices_t)reply.readInt32(); if (pDevices) *pDevices = devices; samplingRate = reply.readInt32(); if (pSamplingRate) *pSamplingRate = samplingRate; format = (audio_format_t) reply.readInt32(); if (pFormat) *pFormat = format; channelMask = (audio_channel_mask_t)reply.readInt32(); if (pChannelMask) *pChannelMask = channelMask; return input; } virtual status_t closeInput(int input) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32(input); remote()->transact(CLOSE_INPUT, data, &reply); return reply.readInt32(); } virtual status_t setStreamOutput(audio_stream_type_t stream, audio_io_handle_t output) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32((int32_t) stream); data.writeInt32((int32_t) output); remote()->transact(SET_STREAM_OUTPUT, data, &reply); return reply.readInt32(); } virtual status_t setVoiceVolume(float volume) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeFloat(volume); remote()->transact(SET_VOICE_VOLUME, data, &reply); return reply.readInt32(); } virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, audio_io_handle_t output) const { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32((int32_t) output); remote()->transact(GET_RENDER_POSITION, data, &reply); status_t status = reply.readInt32(); if (status == NO_ERROR) { uint32_t tmp = reply.readInt32(); if (halFrames) { *halFrames = tmp; } tmp = reply.readInt32(); if (dspFrames) { *dspFrames = tmp; } } return status; } virtual unsigned int getInputFramesLost(audio_io_handle_t ioHandle) const { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32((int32_t) ioHandle); remote()->transact(GET_INPUT_FRAMES_LOST, data, &reply); return reply.readInt32(); } virtual int newAudioSessionId() { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); status_t status = remote()->transact(NEW_AUDIO_SESSION_ID, data, &reply); int id = 0; if (status == NO_ERROR) { id = reply.readInt32(); } return id; } virtual void acquireAudioSessionId(int audioSession) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32(audioSession); remote()->transact(ACQUIRE_AUDIO_SESSION_ID, data, &reply); } virtual void releaseAudioSessionId(int audioSession) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32(audioSession); remote()->transact(RELEASE_AUDIO_SESSION_ID, data, &reply); } virtual status_t queryNumberEffects(uint32_t *numEffects) const { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); status_t status = remote()->transact(QUERY_NUM_EFFECTS, data, &reply); if (status != NO_ERROR) { return status; } status = reply.readInt32(); if (status != NO_ERROR) { return status; } if (numEffects != NULL) { *numEffects = (uint32_t)reply.readInt32(); } return NO_ERROR; } virtual status_t queryEffect(uint32_t index, effect_descriptor_t *pDescriptor) const { if (pDescriptor == NULL) { return BAD_VALUE; } Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32(index); status_t status = remote()->transact(QUERY_EFFECT, data, &reply); if (status != NO_ERROR) { return status; } status = reply.readInt32(); if (status != NO_ERROR) { return status; } reply.read(pDescriptor, sizeof(effect_descriptor_t)); return NO_ERROR; } virtual status_t getEffectDescriptor(const effect_uuid_t *pUuid, effect_descriptor_t *pDescriptor) const { if (pUuid == NULL || pDescriptor == NULL) { return BAD_VALUE; } Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.write(pUuid, sizeof(effect_uuid_t)); status_t status = remote()->transact(GET_EFFECT_DESCRIPTOR, data, &reply); if (status != NO_ERROR) { return status; } status = reply.readInt32(); if (status != NO_ERROR) { return status; } reply.read(pDescriptor, sizeof(effect_descriptor_t)); return NO_ERROR; } virtual sp createEffect(pid_t pid, effect_descriptor_t *pDesc, const sp& client, int32_t priority, audio_io_handle_t output, int sessionId, status_t *status, int *id, int *enabled) { Parcel data, reply; sp effect; if (pDesc == NULL) { return effect; if (status) { *status = BAD_VALUE; } } data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32(pid); data.write(pDesc, sizeof(effect_descriptor_t)); data.writeStrongBinder(client->asBinder()); data.writeInt32(priority); data.writeInt32((int32_t) output); data.writeInt32(sessionId); status_t lStatus = remote()->transact(CREATE_EFFECT, data, &reply); if (lStatus != NO_ERROR) { ALOGE("createEffect error: %s", strerror(-lStatus)); } else { lStatus = reply.readInt32(); int tmp = reply.readInt32(); if (id) { *id = tmp; } tmp = reply.readInt32(); if (enabled != NULL) { *enabled = tmp; } effect = interface_cast(reply.readStrongBinder()); reply.read(pDesc, sizeof(effect_descriptor_t)); } if (status) { *status = lStatus; } return effect; } virtual status_t moveEffects(int session, audio_io_handle_t srcOutput, audio_io_handle_t dstOutput) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32(session); data.writeInt32((int32_t) srcOutput); data.writeInt32((int32_t) dstOutput); remote()->transact(MOVE_EFFECTS, data, &reply); return reply.readInt32(); } virtual audio_module_handle_t loadHwModule(const char *name) { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeCString(name); remote()->transact(LOAD_HW_MODULE, data, &reply); return (audio_module_handle_t) reply.readInt32(); } virtual int32_t getPrimaryOutputSamplingRate() { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); remote()->transact(GET_PRIMARY_OUTPUT_SAMPLING_RATE, data, &reply); return reply.readInt32(); } virtual int32_t getPrimaryOutputFrameCount() { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); remote()->transact(GET_PRIMARY_OUTPUT_FRAME_COUNT, data, &reply); return reply.readInt32(); } }; IMPLEMENT_META_INTERFACE(AudioFlinger, "android.media.IAudioFlinger"); // ---------------------------------------------------------------------- status_t BnAudioFlinger::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case CREATE_TRACK: { CHECK_INTERFACE(IAudioFlinger, data, reply); pid_t pid = data.readInt32(); int streamType = data.readInt32(); uint32_t sampleRate = data.readInt32(); audio_format_t format = (audio_format_t) data.readInt32(); audio_channel_mask_t channelMask = data.readInt32(); size_t bufferCount = data.readInt32(); track_flags_t flags = (track_flags_t) data.readInt32(); sp buffer = interface_cast(data.readStrongBinder()); audio_io_handle_t output = (audio_io_handle_t) data.readInt32(); pid_t tid = (pid_t) data.readInt32(); int sessionId = data.readInt32(); status_t status; sp track = createTrack(pid, (audio_stream_type_t) streamType, sampleRate, format, channelMask, bufferCount, flags, buffer, output, tid, &sessionId, &status); reply->writeInt32(sessionId); reply->writeInt32(status); reply->writeStrongBinder(track->asBinder()); return NO_ERROR; } break; #ifdef QCOM_HARDWARE case CREATE_DIRECT_TRACK: { CHECK_INTERFACE(IAudioFlinger, data, reply); pid_t pid = data.readInt32(); uint32_t sampleRate = data.readInt32(); audio_channel_mask_t channelMask = data.readInt32(); audio_io_handle_t output = (audio_io_handle_t) data.readInt32(); int sessionId = data.readInt32(); IDirectTrackClient* client; data.read(client,sizeof(IDirectTrackClient)); int streamType = data.readInt32(); status_t status; sp track = createDirectTrack(pid, sampleRate, channelMask, output, &sessionId, client,(audio_stream_type_t) streamType, &status); reply->writeInt32(sessionId); reply->writeInt32(status); reply->writeStrongBinder(track->asBinder()); return NO_ERROR; } break; #endif case OPEN_RECORD: { CHECK_INTERFACE(IAudioFlinger, data, reply); pid_t pid = data.readInt32(); audio_io_handle_t input = (audio_io_handle_t) data.readInt32(); uint32_t sampleRate = data.readInt32(); audio_format_t format = (audio_format_t) data.readInt32(); audio_channel_mask_t channelMask = data.readInt32(); size_t bufferCount = data.readInt32(); track_flags_t flags = (track_flags_t) data.readInt32(); pid_t tid = (pid_t) data.readInt32(); int sessionId = data.readInt32(); status_t status; sp record = openRecord(pid, input, sampleRate, format, channelMask, bufferCount, flags, tid, &sessionId, &status); reply->writeInt32(sessionId); reply->writeInt32(status); reply->writeStrongBinder(record->asBinder()); return NO_ERROR; } break; case SAMPLE_RATE: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeInt32( sampleRate((audio_io_handle_t) data.readInt32()) ); return NO_ERROR; } break; #if 0 case CHANNEL_COUNT: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeInt32( channelCount((audio_io_handle_t) data.readInt32()) ); return NO_ERROR; } break; #endif case FORMAT: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeInt32( format((audio_io_handle_t) data.readInt32()) ); return NO_ERROR; } break; case FRAME_COUNT: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeInt32( frameCount((audio_io_handle_t) data.readInt32()) ); return NO_ERROR; } break; case LATENCY: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeInt32( latency((audio_io_handle_t) data.readInt32()) ); return NO_ERROR; } break; case SET_MASTER_VOLUME: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeInt32( setMasterVolume(data.readFloat()) ); return NO_ERROR; } break; case SET_MASTER_MUTE: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeInt32( setMasterMute(data.readInt32()) ); return NO_ERROR; } break; case MASTER_VOLUME: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeFloat( masterVolume() ); return NO_ERROR; } break; case MASTER_MUTE: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeInt32( masterMute() ); return NO_ERROR; } break; case SET_STREAM_VOLUME: { CHECK_INTERFACE(IAudioFlinger, data, reply); int stream = data.readInt32(); float volume = data.readFloat(); audio_io_handle_t output = (audio_io_handle_t) data.readInt32(); reply->writeInt32( setStreamVolume((audio_stream_type_t) stream, volume, output) ); return NO_ERROR; } break; case SET_STREAM_MUTE: { CHECK_INTERFACE(IAudioFlinger, data, reply); int stream = data.readInt32(); reply->writeInt32( setStreamMute((audio_stream_type_t) stream, data.readInt32()) ); return NO_ERROR; } break; case STREAM_VOLUME: { CHECK_INTERFACE(IAudioFlinger, data, reply); int stream = data.readInt32(); int output = data.readInt32(); reply->writeFloat( streamVolume((audio_stream_type_t) stream, output) ); return NO_ERROR; } break; case STREAM_MUTE: { CHECK_INTERFACE(IAudioFlinger, data, reply); int stream = data.readInt32(); reply->writeInt32( streamMute((audio_stream_type_t) stream) ); return NO_ERROR; } break; case SET_MODE: { CHECK_INTERFACE(IAudioFlinger, data, reply); audio_mode_t mode = (audio_mode_t) data.readInt32(); reply->writeInt32( setMode(mode) ); return NO_ERROR; } break; case SET_MIC_MUTE: { CHECK_INTERFACE(IAudioFlinger, data, reply); int state = data.readInt32(); reply->writeInt32( setMicMute(state) ); return NO_ERROR; } break; case GET_MIC_MUTE: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeInt32( getMicMute() ); return NO_ERROR; } break; case SET_PARAMETERS: { CHECK_INTERFACE(IAudioFlinger, data, reply); audio_io_handle_t ioHandle = (audio_io_handle_t) data.readInt32(); String8 keyValuePairs(data.readString8()); reply->writeInt32(setParameters(ioHandle, keyValuePairs)); return NO_ERROR; } break; case GET_PARAMETERS: { CHECK_INTERFACE(IAudioFlinger, data, reply); audio_io_handle_t ioHandle = (audio_io_handle_t) data.readInt32(); String8 keys(data.readString8()); reply->writeString8(getParameters(ioHandle, keys)); return NO_ERROR; } break; case REGISTER_CLIENT: { CHECK_INTERFACE(IAudioFlinger, data, reply); sp client = interface_cast(data.readStrongBinder()); registerClient(client); return NO_ERROR; } break; case GET_INPUTBUFFERSIZE: { CHECK_INTERFACE(IAudioFlinger, data, reply); uint32_t sampleRate = data.readInt32(); audio_format_t format = (audio_format_t) data.readInt32(); audio_channel_mask_t channelMask = data.readInt32(); reply->writeInt32( getInputBufferSize(sampleRate, format, channelMask) ); return NO_ERROR; } break; case OPEN_OUTPUT: { CHECK_INTERFACE(IAudioFlinger, data, reply); audio_module_handle_t module = (audio_module_handle_t)data.readInt32(); audio_devices_t devices = (audio_devices_t)data.readInt32(); uint32_t samplingRate = data.readInt32(); audio_format_t format = (audio_format_t) data.readInt32(); audio_channel_mask_t channelMask = (audio_channel_mask_t)data.readInt32(); uint32_t latency = data.readInt32(); audio_output_flags_t flags = (audio_output_flags_t) data.readInt32(); audio_io_handle_t output = openOutput(module, &devices, &samplingRate, &format, &channelMask, &latency, flags); ALOGV("OPEN_OUTPUT output, %p", output); reply->writeInt32((int32_t) output); reply->writeInt32(devices); reply->writeInt32(samplingRate); reply->writeInt32(format); reply->writeInt32(channelMask); reply->writeInt32(latency); return NO_ERROR; } break; case OPEN_DUPLICATE_OUTPUT: { CHECK_INTERFACE(IAudioFlinger, data, reply); audio_io_handle_t output1 = (audio_io_handle_t) data.readInt32(); audio_io_handle_t output2 = (audio_io_handle_t) data.readInt32(); reply->writeInt32((int32_t) openDuplicateOutput(output1, output2)); return NO_ERROR; } break; case CLOSE_OUTPUT: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeInt32(closeOutput((audio_io_handle_t) data.readInt32())); return NO_ERROR; } break; case SUSPEND_OUTPUT: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeInt32(suspendOutput((audio_io_handle_t) data.readInt32())); return NO_ERROR; } break; case RESTORE_OUTPUT: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeInt32(restoreOutput((audio_io_handle_t) data.readInt32())); return NO_ERROR; } break; case OPEN_INPUT: { CHECK_INTERFACE(IAudioFlinger, data, reply); audio_module_handle_t module = (audio_module_handle_t)data.readInt32(); audio_devices_t devices = (audio_devices_t)data.readInt32(); uint32_t samplingRate = data.readInt32(); audio_format_t format = (audio_format_t) data.readInt32(); audio_channel_mask_t channelMask = (audio_channel_mask_t)data.readInt32(); audio_io_handle_t input = openInput(module, &devices, &samplingRate, &format, &channelMask); reply->writeInt32((int32_t) input); reply->writeInt32(devices); reply->writeInt32(samplingRate); reply->writeInt32(format); reply->writeInt32(channelMask); return NO_ERROR; } break; case CLOSE_INPUT: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeInt32(closeInput((audio_io_handle_t) data.readInt32())); return NO_ERROR; } break; case SET_STREAM_OUTPUT: { CHECK_INTERFACE(IAudioFlinger, data, reply); uint32_t stream = data.readInt32(); audio_io_handle_t output = (audio_io_handle_t) data.readInt32(); reply->writeInt32(setStreamOutput((audio_stream_type_t) stream, output)); return NO_ERROR; } break; case SET_VOICE_VOLUME: { CHECK_INTERFACE(IAudioFlinger, data, reply); float volume = data.readFloat(); reply->writeInt32( setVoiceVolume(volume) ); return NO_ERROR; } break; case GET_RENDER_POSITION: { CHECK_INTERFACE(IAudioFlinger, data, reply); audio_io_handle_t output = (audio_io_handle_t) data.readInt32(); uint32_t halFrames; uint32_t dspFrames; status_t status = getRenderPosition(&halFrames, &dspFrames, output); reply->writeInt32(status); if (status == NO_ERROR) { reply->writeInt32(halFrames); reply->writeInt32(dspFrames); } return NO_ERROR; } case GET_INPUT_FRAMES_LOST: { CHECK_INTERFACE(IAudioFlinger, data, reply); audio_io_handle_t ioHandle = (audio_io_handle_t) data.readInt32(); reply->writeInt32(getInputFramesLost(ioHandle)); return NO_ERROR; } break; case NEW_AUDIO_SESSION_ID: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeInt32(newAudioSessionId()); return NO_ERROR; } break; case ACQUIRE_AUDIO_SESSION_ID: { CHECK_INTERFACE(IAudioFlinger, data, reply); int audioSession = data.readInt32(); acquireAudioSessionId(audioSession); return NO_ERROR; } break; case RELEASE_AUDIO_SESSION_ID: { CHECK_INTERFACE(IAudioFlinger, data, reply); int audioSession = data.readInt32(); releaseAudioSessionId(audioSession); return NO_ERROR; } break; case QUERY_NUM_EFFECTS: { CHECK_INTERFACE(IAudioFlinger, data, reply); uint32_t numEffects; status_t status = queryNumberEffects(&numEffects); reply->writeInt32(status); if (status == NO_ERROR) { reply->writeInt32((int32_t)numEffects); } return NO_ERROR; } case QUERY_EFFECT: { CHECK_INTERFACE(IAudioFlinger, data, reply); effect_descriptor_t desc; status_t status = queryEffect(data.readInt32(), &desc); reply->writeInt32(status); if (status == NO_ERROR) { reply->write(&desc, sizeof(effect_descriptor_t)); } return NO_ERROR; } case GET_EFFECT_DESCRIPTOR: { CHECK_INTERFACE(IAudioFlinger, data, reply); effect_uuid_t uuid; data.read(&uuid, sizeof(effect_uuid_t)); effect_descriptor_t desc; status_t status = getEffectDescriptor(&uuid, &desc); reply->writeInt32(status); if (status == NO_ERROR) { reply->write(&desc, sizeof(effect_descriptor_t)); } return NO_ERROR; } case CREATE_EFFECT: { CHECK_INTERFACE(IAudioFlinger, data, reply); pid_t pid = data.readInt32(); effect_descriptor_t desc; data.read(&desc, sizeof(effect_descriptor_t)); sp client = interface_cast(data.readStrongBinder()); int32_t priority = data.readInt32(); audio_io_handle_t output = (audio_io_handle_t) data.readInt32(); int sessionId = data.readInt32(); status_t status; int id; int enabled; sp effect = createEffect(pid, &desc, client, priority, output, sessionId, &status, &id, &enabled); reply->writeInt32(status); reply->writeInt32(id); reply->writeInt32(enabled); reply->writeStrongBinder(effect->asBinder()); reply->write(&desc, sizeof(effect_descriptor_t)); return NO_ERROR; } break; case MOVE_EFFECTS: { CHECK_INTERFACE(IAudioFlinger, data, reply); int session = data.readInt32(); audio_io_handle_t srcOutput = (audio_io_handle_t) data.readInt32(); audio_io_handle_t dstOutput = (audio_io_handle_t) data.readInt32(); reply->writeInt32(moveEffects(session, srcOutput, dstOutput)); return NO_ERROR; } break; case LOAD_HW_MODULE: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeInt32(loadHwModule(data.readCString())); return NO_ERROR; } break; case GET_PRIMARY_OUTPUT_SAMPLING_RATE: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeInt32(getPrimaryOutputSamplingRate()); return NO_ERROR; } break; case GET_PRIMARY_OUTPUT_FRAME_COUNT: { CHECK_INTERFACE(IAudioFlinger, data, reply); reply->writeInt32(getPrimaryOutputFrameCount()); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } } // ---------------------------------------------------------------------------- }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/autodetect.h0000644000015700001700000000230212200324306024515 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef AUTODETECT_H #define AUTODETECT_H #include // flags used for native encoding detection enum { kEncodingNone = 0, kEncodingShiftJIS = (1 << 0), kEncodingGBK = (1 << 1), kEncodingBig5 = (1 << 2), kEncodingEUCKR = (1 << 3), kEncodingAll = (kEncodingShiftJIS | kEncodingGBK | kEncodingBig5 | kEncodingEUCKR), }; // returns a bitfield containing the possible native encodings for the given character extern uint32_t findPossibleEncodings(int ch); #endif // AUTODETECT_H android-audiosystem-1.8+13.10.20130807/lib/libmedia/ToneGenerator.cpp0000644000015700001700000022371112200324306025474 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "ToneGenerator" #include #include #include #include #include #include #include #include "media/ToneGenerator.h" namespace android { // Descriptors for all available tones (See ToneGenerator::ToneDescriptor class declaration for details) const ToneGenerator::ToneDescriptor ToneGenerator::sToneDescriptors[] = { { segments: {{ duration: ToneGenerator::TONEGEN_INF, waveFreq: { 1336, 941, 0 }, 0, 0}, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_DTMF_0 { segments: { { duration: ToneGenerator::TONEGEN_INF, waveFreq: { 1209, 697, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_DTMF_1 { segments: { { duration: ToneGenerator::TONEGEN_INF, waveFreq: { 1336, 697, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_DTMF_2 { segments: { { duration: ToneGenerator::TONEGEN_INF, waveFreq: { 1477, 697, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_DTMF_3 { segments: { { duration: ToneGenerator::TONEGEN_INF, waveFreq: { 1209, 770, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_DTMF_4 { segments: { { duration: ToneGenerator::TONEGEN_INF, waveFreq: { 1336, 770, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_DTMF_5 { segments: { { duration: ToneGenerator::TONEGEN_INF, waveFreq: { 1477, 770, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_DTMF_6 { segments: { { duration: ToneGenerator::TONEGEN_INF, waveFreq: { 1209, 852, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_DTMF_7 { segments: { { duration: ToneGenerator::TONEGEN_INF, waveFreq: { 1336, 852, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_DTMF_8 { segments: { { duration: ToneGenerator::TONEGEN_INF, waveFreq: { 1477, 852, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_DTMF_9 { segments: { { duration: ToneGenerator::TONEGEN_INF, waveFreq: { 1209, 941, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_DTMF_S { segments: { { duration: ToneGenerator::TONEGEN_INF, waveFreq: { 1477, 941, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_DTMF_P { segments: { { duration: ToneGenerator::TONEGEN_INF, waveFreq: { 1633, 697, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_DTMF_A { segments: { { duration: ToneGenerator::TONEGEN_INF, waveFreq: { 1633, 770, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_DTMF_B { segments: { { duration: ToneGenerator::TONEGEN_INF, waveFreq: { 1633, 852, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_DTMF_C { segments: { { duration: ToneGenerator::TONEGEN_INF, waveFreq: { 1633, 941, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_DTMF_D { segments: { { duration: ToneGenerator::TONEGEN_INF, waveFreq: { 425, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_SUP_DIAL { segments: { { duration: 500 , waveFreq: { 425, 0 }, 0, 0}, { duration: 500, waveFreq: { 0 }, 0, 0}, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_SUP_BUSY { segments: { { duration: 200, waveFreq: { 425, 0 }, 0, 0 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_SUP_CONGESTION { segments: { { duration: 200, waveFreq: { 425, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: 0, repeatSegment: 0 }, // TONE_SUP_RADIO_ACK { segments: { { duration: 200, waveFreq: { 425, 0 }, 0, 0}, { duration: 200, waveFreq: { 0 }, 0, 0}, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: 2, repeatSegment: 0 }, // TONE_SUP_RADIO_NOTAVAIL { segments: { { duration: 330, waveFreq: { 950, 1400, 1800, 0 }, 0, 0}, { duration: 1000, waveFreq: { 0 }, 0, 0}, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_SUP_ERROR { segments: { { duration: 200, waveFreq: { 425, 0 }, 0, 0 }, { duration: 600, waveFreq: { 0 }, 0, 0 }, { duration: 200, waveFreq: { 425, 0 }, 0, 0 }, { duration: 3000, waveFreq: { 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_SUP_CALL_WAITING { segments: { { duration: 1000, waveFreq: { 425, 0 }, 0, 0 }, { duration: 4000, waveFreq: { 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_SUP_RINGTONE { segments: { { duration: 40, waveFreq: { 400, 1200, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: 0, repeatSegment: 0 }, // TONE_PROP_BEEP { segments: { { duration: 100, waveFreq: { 1200, 0 }, 0, 0 }, { duration: 100, waveFreq: { 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: 1, repeatSegment: 0 }, // TONE_PROP_ACK { segments: { { duration: 400, waveFreq: { 300, 400, 500, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: 0, repeatSegment: 0 }, // TONE_PROP_NACK { segments: { { duration: 200, waveFreq: { 400, 1200, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: 0, repeatSegment: 0 }, // TONE_PROP_PROMPT { segments: { { duration: 40, waveFreq: { 400, 1200, 0 }, 0, 0 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 40, waveFreq: { 400, 1200, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: 0, repeatSegment: 0 }, // TONE_PROP_BEEP2 { segments: { { duration: 250, waveFreq: { 440, 0 }, 0, 0 }, { duration: 250, waveFreq: { 620, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_SUP_INTERCEPT { segments: { { duration: 250, waveFreq: { 440, 0 }, 0, 0 }, { duration: 250, waveFreq: { 620, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: 7, repeatSegment: 0 }, // TONE_SUP_INTERCEPT_ABBREV { segments: { { duration: 250, waveFreq: { 480, 620, 0 }, 0, 0 }, { duration: 250, waveFreq: { 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: 7, repeatSegment: 0 }, // TONE_SUP_CONGESTION_ABBREV { segments: { { duration: 100, waveFreq: { 350, 440, 0 }, 0, 0 }, { duration: 100, waveFreq: { 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: 2, repeatSegment: 0 }, // TONE_SUP_CONFIRM { segments: { { duration: 100, waveFreq: { 480, 0 }, 0, 0 }, { duration: 100, waveFreq: { 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: 3, repeatSegment: 0 }, // TONE_SUP_PIP { segments: {{ duration: ToneGenerator::TONEGEN_INF, waveFreq: { 425, 0 }, 0, 0}, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_DIAL_TONE_LITE { segments: { { duration: 2000, waveFreq: { 440, 480, 0 }, 0, 0 }, { duration: 4000, waveFreq: { 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_NETWORK_USA_RINGBACK { segments: { { duration: 250, waveFreq: { 440, 0 }, 0, 0 }, { duration: 250, waveFreq: { 620, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_INTERCEPT { segments: { { duration: 250, waveFreq: { 440, 0 }, 0, 0 }, { duration: 250, waveFreq: { 620, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_ABBR_INTERCEPT { segments: { { duration: 250, waveFreq: { 480, 620, 0 }, 0, 0 }, { duration: 250, waveFreq: { 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_REORDER { segments: { { duration: 250, waveFreq: { 480, 620, 0 }, 0, 0 }, { duration: 250, waveFreq: { 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: 7, repeatSegment: 0 }, // TONE_CDMA_ABBR_REORDER { segments: { { duration: 500, waveFreq: { 480, 620, 0 }, 0, 0 }, { duration: 500, waveFreq: { 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_NETWORK_BUSY { segments: { { duration: 100, waveFreq: { 350, 440, 0 }, 0, 0 }, { duration: 100, waveFreq: { 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: 2, repeatSegment: 0 }, // TONE_CDMA_CONFIRM { segments: { { duration: 500, waveFreq: { 660, 1000, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_ANSWER { segments: { { duration: 300, waveFreq: { 440, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_NETWORK_CALLWAITING { segments: { { duration: 100, waveFreq: { 480, 0 }, 0, 0 }, { duration: 100, waveFreq: { 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: 3, repeatSegment: 0 }, // TONE_CDMA_PIP { segments: { { duration: 32, waveFreq: { 2091, 0}, 0, 0 }, { duration: 64, waveFreq: { 2556, 0}, 19, 0}, { duration: 32, waveFreq: { 2091, 0}, 0, 0}, { duration: 48, waveFreq: { 2556, 0}, 0, 0}, { duration: 4000, waveFreq: { 0 }, 0, 0}, { duration: 0, waveFreq: { 0 }, 0, 0}}, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_CALL_SIGNAL_ISDN_NORMAL { segments: { { duration: 32, waveFreq: { 2091, 0}, 0, 0 }, { duration: 64, waveFreq: { 2556, 0}, 7, 0 }, { duration: 32, waveFreq: { 2091, 0}, 0, 0 }, { duration: 400, waveFreq: { 0 }, 0, 0 }, { duration: 32, waveFreq: { 2091, 0}, 0, 0 }, { duration: 64, waveFreq: { 2556, 0}, 7, 4 }, { duration: 32, waveFreq: { 2091, 0}, 0, 0 }, { duration: 4000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 } }, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_CALL_SIGNAL_ISDN_INTERGROUP { segments: { { duration: 32, waveFreq: { 2091, 0}, 0, 0 }, { duration: 64, waveFreq: { 2556, 0}, 3, 0 }, { duration: 16, waveFreq: { 2091, 0}, 0, 0 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 32, waveFreq: { 2091, 0}, 0, 0 }, { duration: 64, waveFreq: { 2556, 0}, 3, 4 }, { duration: 16, waveFreq: { 2091, 0}, 0, 0 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 } }, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_CALL_SIGNAL_ISDN_SP_PRI { segments: { { duration: 0, waveFreq: { 0 }, 0, 0} }, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_CALL_SIGNAL_ISDN_PAT3 { segments: { { duration: 32, waveFreq: { 2091, 0 }, 0, 0 }, { duration: 64, waveFreq: { 2556, 0 }, 4, 0 }, { duration: 20, waveFreq: { 2091, 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 } , 0, 0 } }, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_CALL_SIGNAL_ISDN_PING_RING { segments: { { duration: 0, waveFreq: { 0 }, 0, 0} }, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_CALL_SIGNAL_ISDN_PAT5 { segments: { { duration: 0, waveFreq: { 0 }, 0, 0} }, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_CALL_SIGNAL_ISDN_PAT6 { segments: { { duration: 0, waveFreq: { 0 }, 0, 0} }, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_CALL_SIGNAL_ISDN_PAT7 { segments: { { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 39, 0 }, { duration: 4000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 } }, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_HIGH_L { segments: { { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 39, 0 }, { duration: 4000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 } }, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_MED_L { segments: { { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 39, 0 }, { duration: 4000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 } }, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_LOW_L { segments: { { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 15, 0 }, { duration: 400, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 } }, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_HIGH_SS { segments: { { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 15, 0 }, { duration: 400, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_MED_SS { segments: { { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 15, 0 }, { duration: 400, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_LOW_SS { segments: { { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 7, 0 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 7, 3 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 15, 6 }, { duration: 4000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_HIGH_SSL { segments: { { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 7, 0 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 7, 3 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 15, 6 }, { duration: 4000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_MED_SSL { segments: { { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 7, 0 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 7, 3 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 15, 6 }, { duration: 4000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_LOW_SSL { segments: { { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 19, 0 }, { duration: 1000, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 19, 3 }, { duration: 3000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_HIGH_SS_2 { segments: { { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 19, 0 }, { duration: 1000, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 19, 3 }, { duration: 3000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_MED_SS_2 { segments: { { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 19, 0 }, { duration: 1000, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 19, 3 }, { duration: 3000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_LOW_SS_2 { segments: { { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 9, 0 }, { duration: 500, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 19, 3 }, { duration: 500, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 9, 6 }, { duration: 3000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_HIGH_SLS { segments: { { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 9, 0 }, { duration: 500, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 19, 3 }, { duration: 500, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 9, 6 }, { duration: 3000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_MED_SLS { segments: { { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 9, 0 }, { duration: 500, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 19, 3 }, { duration: 500, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 9, 6 }, { duration: 3000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_LOW_SLS { segments: { { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 9, 0 }, { duration: 500, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 9, 3 }, { duration: 500, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 9, 6 }, { duration: 500, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 9, 9 }, { duration: 2500, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_HIGH_S_X4 { segments: { { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 9, 0 }, { duration: 500, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 9, 3 }, { duration: 500, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 9, 6 }, { duration: 500, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 9, 9 }, { duration: 2500, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_MED_S_X4 { segments: { { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 9, 0 }, { duration: 500, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 9, 3 }, { duration: 500, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 9, 6 }, { duration: 500, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 9, 9 }, { duration: 2500, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_LOW_S_X4 { segments: { { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 19, 0 }, { duration: 2000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_HIGH_PBX_L { segments: { { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 19, 0 }, { duration: 2000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_MED_PBX_L { segments: { { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 19, 0 }, { duration: 2000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_LOW_PBX_L { segments: { { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 7, 0 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 7, 3 }, { duration: 2000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_HIGH_PBX_SS { segments: { { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 7, 0 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 7, 3 }, { duration: 2000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_MED_PBX_SS { segments: { { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 7, 0 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 7, 3 }, { duration: 2000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_LOW_PBX_SS { segments: { { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 7, 0 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 7, 3 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 15, 6 }, { duration: 1000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_HIGH_PBX_SSL { segments: { { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 7, 0 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 7, 3 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 15, 6 }, { duration: 1000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_MED_PBX_SSL { segments: { { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 7, 0 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 7, 3 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 15, 6 }, { duration: 1000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_LOW_PBX_SSL { segments: { { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 7, 0 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 15, 3 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 7, 6 }, { duration: 1000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_HIGH_PBX_SLS { segments: { { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 7, 0 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 15, 3 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 7, 6 }, { duration: 1000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_MED_PBX_SLS { segments: { { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 7, 0 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 15, 3 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 7, 6 }, { duration: 1000, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_LOW_PBX_SLS { segments: { { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 7, 0 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 7, 3 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 7, 6 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 3700, 0 }, 0, 0 }, { duration: 25, waveFreq: { 4000, 0 }, 7, 9 }, { duration: 800, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_HIGH_PBX_S_X4 { segments: { { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 7, 0 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 7, 3 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 7, 6 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 2600, 0 }, 0, 0 }, { duration: 25, waveFreq: { 2900, 0 }, 7, 9 }, { duration: 800, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_MED_PBX_S_X4 { segments: { { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 7, 0 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 7, 3 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 7, 6 }, { duration: 200, waveFreq: { 0 }, 0, 0 }, { duration: 25, waveFreq: { 1300, 0 }, 0, 0 }, { duration: 25, waveFreq: { 1450, 0 }, 7, 9 }, { duration: 800, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_LOW_PBX_S_X4 { segments: { { duration: 62, waveFreq: { 1109, 0 }, 0, 0 }, { duration: 62, waveFreq: { 784, 0 }, 0, 0 }, { duration: 62, waveFreq: { 740, 0 }, 0, 0 }, { duration: 62, waveFreq: { 622, 0 }, 0, 0 }, { duration: 62, waveFreq: { 1109, 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 } }, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_ALERT_NETWORK_LITE { segments: { { duration: 62, waveFreq: { 1245, 0 }, 0, 0 }, { duration: 62, waveFreq: { 659, 0 }, 2, 0 }, { duration: 62, waveFreq: { 1245, 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 } }, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_ALERT_AUTOREDIAL_LITE { segments: { { duration: 400, waveFreq: { 1150, 770, 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 } }, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_ONE_MIN_BEEP { segments: { { duration: 120, waveFreq: { 941, 1477, 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 } }, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_KEYPAD_VOLUME_KEY_LITE { segments: { { duration: 375, waveFreq: { 587, 0 }, 0, 0 }, { duration: 125, waveFreq: { 1175, 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 } }, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_PRESSHOLDKEY_LITE { segments: { { duration: 62, waveFreq: { 587, 0 }, 0, 0 }, { duration: 62, waveFreq: { 784, 0 }, 0, 0 }, { duration: 62, waveFreq: { 831, 0 }, 0, 0 }, { duration: 62, waveFreq: { 784, 0 }, 0, 0 }, { duration: 62, waveFreq: { 1109, 0 }, 0, 0 }, { duration: 62, waveFreq: { 784, 0 }, 0, 0 }, { duration: 62, waveFreq: { 831, 0 }, 0, 0 }, { duration: 62, waveFreq: { 784, 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 } }, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_ALERT_INCALL_LITE { segments: { { duration: 125, waveFreq: { 941, 0 }, 0, 0 }, { duration: 10, waveFreq: { 0 }, 2, 0 }, { duration: 4990, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 } }, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_CDMA_EMERGENCY_RINGBACK { segments: { { duration: 125, waveFreq: { 1319, 0 }, 0, 0 }, { duration: 125, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 } }, repeatCnt: 2, repeatSegment: 0 }, // TONE_CDMA_ALERT_CALL_GUARD { segments: { { duration: 125, waveFreq: { 1047, 0 }, 0, 0 }, { duration: 125, waveFreq: { 370, 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 } }, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_SOFT_ERROR_LITE { segments: { { duration: 125, waveFreq: { 1480, 0 }, 0, 0 }, { duration: 125, waveFreq: { 1397, 0 }, 0, 0 }, { duration: 125, waveFreq: { 784, 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 } }, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_CALLDROP_LITE { segments: { { duration: 500, waveFreq: { 425, 0 }, 0, 0 }, { duration: 500, waveFreq: { 0 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_NETWORK_BUSY_ONE_SHOT { segments: { { duration: 400, waveFreq: { 1150, 770 }, 0, 0 }, { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_ABBR_ALERT { segments: { { duration: 0, waveFreq: { 0 }, 0, 0 }}, repeatCnt: 0, repeatSegment: 0 }, // TONE_CDMA_SIGNAL_OFF { segments: { { duration: ToneGenerator::TONEGEN_INF, waveFreq: { 350, 440, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_ANSI_DIAL { segments: { { duration: 500, waveFreq: { 480, 620, 0 }, 0, 0 }, { duration: 500, waveFreq: { 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_ANSI_BUSY { segments: { { duration: 250, waveFreq: { 480, 620, 0 }, 0, 0 }, { duration: 250, waveFreq: { 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_ANSI_CONGESTION { segments: { { duration: 300, waveFreq: { 440, 0 }, 0, 0 }, { duration: 9700, waveFreq: { 0 }, 0, 0 }, { duration: 100, waveFreq: { 440, 0 }, 0, 0 }, { duration: 100, waveFreq: { 0 }, 0, 0 }, { duration: 100, waveFreq: { 440, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 1 }, // TONE_ANSI_CALL_WAITING { segments: { { duration: 2000, waveFreq: { 440, 480, 0 }, 0, 0 }, { duration: 4000, waveFreq: { 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_ANSI_RINGTONE { segments: { { duration: ToneGenerator::TONEGEN_INF, waveFreq: { 400, 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_JAPAN_DIAL { segments: { { duration: 500, waveFreq: { 400, 0 }, 0, 0 }, { duration: 500, waveFreq: { 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_JAPAN_BUSY { segments: { { duration: 1000, waveFreq: { 400, 0 }, 0, 0 }, { duration: 2000, waveFreq: { 0 }, 0, 0 }, { duration: 0 , waveFreq: { 0 }, 0, 0}}, repeatCnt: ToneGenerator::TONEGEN_INF, repeatSegment: 0 }, // TONE_JAPAN_RADIO_ACK }; // Used by ToneGenerator::getToneForRegion() to convert user specified supervisory tone type // to actual tone for current region. const unsigned char /*tone_type*/ ToneGenerator::sToneMappingTable[NUM_REGIONS-1][NUM_SUP_TONES] = { { // ANSI TONE_ANSI_DIAL, // TONE_SUP_DIAL TONE_ANSI_BUSY, // TONE_SUP_BUSY TONE_ANSI_CONGESTION, // TONE_SUP_CONGESTION TONE_SUP_RADIO_ACK, // TONE_SUP_RADIO_ACK TONE_SUP_RADIO_NOTAVAIL, // TONE_SUP_RADIO_NOTAVAIL TONE_SUP_ERROR, // TONE_SUP_ERROR TONE_ANSI_CALL_WAITING, // TONE_SUP_CALL_WAITING TONE_ANSI_RINGTONE // TONE_SUP_RINGTONE }, { // JAPAN TONE_JAPAN_DIAL, // TONE_SUP_DIAL TONE_JAPAN_BUSY, // TONE_SUP_BUSY TONE_SUP_CONGESTION, // TONE_SUP_CONGESTION TONE_JAPAN_RADIO_ACK, // TONE_SUP_RADIO_ACK TONE_SUP_RADIO_NOTAVAIL, // TONE_SUP_RADIO_NOTAVAIL TONE_SUP_ERROR, // TONE_SUP_ERROR TONE_SUP_CALL_WAITING, // TONE_SUP_CALL_WAITING TONE_SUP_RINGTONE // TONE_SUP_RINGTONE } }; //////////////////////////////////////////////////////////////////////////////// // ToneGenerator class Implementation //////////////////////////////////////////////////////////////////////////////// //---------------------------------- public methods ---------------------------- //////////////////////////////////////////////////////////////////////////////// // // Method: ToneGenerator::ToneGenerator() // // Description: Constructor. Initializes the tone sequencer, intantiates required sine wave // generators, instantiates output audio track. // // Input: // streamType: Type of stream used for tone playback // volume: volume applied to tone (0.0 to 1.0) // // Output: // none // //////////////////////////////////////////////////////////////////////////////// ToneGenerator::ToneGenerator(audio_stream_type_t streamType, float volume, bool threadCanCallJava) : mpAudioTrack(NULL), mpToneDesc(NULL), mpNewToneDesc(NULL) { ALOGV("ToneGenerator constructor: streamType=%d, volume=%f", streamType, volume); mState = TONE_IDLE; if (AudioSystem::getOutputSamplingRate(&mSamplingRate, streamType) != NO_ERROR) { ALOGE("Unable to marshal AudioFlinger"); return; } mThreadCanCallJava = threadCanCallJava; mStreamType = streamType; mVolume = volume; // Generate tone by chunks of 20 ms to keep cadencing precision mProcessSize = (mSamplingRate * 20) / 1000; char value[PROPERTY_VALUE_MAX]; property_get("gsm.operator.iso-country", value, ""); if (strcmp(value,"us") == 0 || strcmp(value,"ca") == 0) { mRegion = ANSI; } else if (strcmp(value,"jp") == 0) { mRegion = JAPAN; } else { mRegion = CEPT; } if (initAudioTrack()) { ALOGV("ToneGenerator INIT OK, time: %d", (unsigned int)(systemTime()/1000000)); } else { ALOGV("!!!ToneGenerator INIT FAILED!!!"); } } //////////////////////////////////////////////////////////////////////////////// // // Method: ToneGenerator::~ToneGenerator() // // Description: Destructor. Stop sound playback and delete audio track if // needed and delete sine wave generators. // // Input: // none // // Output: // none // //////////////////////////////////////////////////////////////////////////////// ToneGenerator::~ToneGenerator() { ALOGV("ToneGenerator destructor"); if (mpAudioTrack != NULL) { stopTone(); ALOGV("Delete Track: %p", mpAudioTrack); delete mpAudioTrack; } } //////////////////////////////////////////////////////////////////////////////// // // Method: ToneGenerator::startTone() // // Description: Starts tone playback. // // Input: // toneType: Type of tone generated (values in enum tone_type) // durationMs: The tone duration in milliseconds. If the tone is limited in time by definition, // the actual duration will be the minimum of durationMs and the defined tone duration. // Ommiting or setting durationMs to -1 does not limit tone duration. // // Output: // none // //////////////////////////////////////////////////////////////////////////////// bool ToneGenerator::startTone(tone_type toneType, int durationMs) { bool lResult = false; status_t lStatus; if ((toneType < 0) || (toneType >= NUM_TONES)) return lResult; if (mState == TONE_IDLE) { ALOGV("startTone: try to re-init AudioTrack"); if (!initAudioTrack()) { return lResult; } } ALOGV("startTone"); mLock.lock(); // Get descriptor for requested tone toneType = getToneForRegion(toneType); mpNewToneDesc = &sToneDescriptors[toneType]; mDurationMs = durationMs; if (mState == TONE_STOPPED) { ALOGV("Start waiting for previous tone to stop"); lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3)); if (lStatus != NO_ERROR) { ALOGE("--- start wait for stop timed out, status %d", lStatus); mState = TONE_IDLE; mLock.unlock(); return lResult; } } if (mState == TONE_INIT) { if (prepareWave()) { ALOGV("Immediate start, time %d", (unsigned int)(systemTime()/1000000)); lResult = true; mState = TONE_STARTING; mLock.unlock(); mpAudioTrack->start(); mLock.lock(); if (mState == TONE_STARTING) { ALOGV("Wait for start callback"); lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3)); if (lStatus != NO_ERROR) { ALOGE("--- Immediate start timed out, status %d", lStatus); mState = TONE_IDLE; lResult = false; } } } else { mState = TONE_IDLE; } } else { ALOGV("Delayed start"); mState = TONE_RESTARTING; lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3)); if (lStatus == NO_ERROR) { if (mState != TONE_IDLE) { lResult = true; } ALOGV("cond received"); } else { ALOGE("--- Delayed start timed out, status %d", lStatus); mState = TONE_IDLE; } } mLock.unlock(); ALOGV_IF(lResult, "Tone started, time %d", (unsigned int)(systemTime()/1000000)); ALOGW_IF(!lResult, "Tone start failed!!!, time %d", (unsigned int)(systemTime()/1000000)); return lResult; } //////////////////////////////////////////////////////////////////////////////// // // Method: ToneGenerator::stopTone() // // Description: Stops tone playback. // // Input: // none // // Output: // none // //////////////////////////////////////////////////////////////////////////////// void ToneGenerator::stopTone() { ALOGV("stopTone"); mLock.lock(); if (mState == TONE_PLAYING || mState == TONE_STARTING || mState == TONE_RESTARTING) { mState = TONE_STOPPING; ALOGV("waiting cond"); status_t lStatus = mWaitCbkCond.waitRelative(mLock, seconds(3)); if (lStatus == NO_ERROR) { ALOGV("track stop complete, time %d", (unsigned int)(systemTime()/1000000)); } else { ALOGE("--- Stop timed out"); mState = TONE_IDLE; mpAudioTrack->stop(); } } clearWaveGens(); mLock.unlock(); } //---------------------------------- private methods --------------------------- //////////////////////////////////////////////////////////////////////////////// // // Method: ToneGenerator::initAudioTrack() // // Description: Allocates and configures AudioTrack used for PCM output. // // Input: // none // // Output: // none // //////////////////////////////////////////////////////////////////////////////// bool ToneGenerator::initAudioTrack() { if (mpAudioTrack) { delete mpAudioTrack; mpAudioTrack = NULL; } // Open audio track in mono, PCM 16bit, default sampling rate, default buffer size mpAudioTrack = new AudioTrack(); ALOGV("Create Track: %p", mpAudioTrack); mpAudioTrack->set(mStreamType, 0, // sampleRate AUDIO_FORMAT_PCM_16_BIT, AUDIO_CHANNEL_OUT_MONO, 0, // frameCount AUDIO_OUTPUT_FLAG_FAST, audioCallback, this, // user 0, // notificationFrames 0, // sharedBuffer mThreadCanCallJava); if (mpAudioTrack->initCheck() != NO_ERROR) { ALOGE("AudioTrack->initCheck failed"); goto initAudioTrack_exit; } mpAudioTrack->setVolume(mVolume, mVolume); mState = TONE_INIT; return true; initAudioTrack_exit: // Cleanup if (mpAudioTrack != NULL) { ALOGV("Delete Track I: %p", mpAudioTrack); delete mpAudioTrack; mpAudioTrack = NULL; } return false; } //////////////////////////////////////////////////////////////////////////////// // // Method: ToneGenerator::audioCallback() // // Description: AudioTrack callback implementation. Generates a block of // PCM samples // and manages tone generator sequencer: tones pulses, tone duration... // // Input: // user reference (pointer to our ToneGenerator) // info audio buffer descriptor // // Output: // returned value: always true. // //////////////////////////////////////////////////////////////////////////////// void ToneGenerator::audioCallback(int event, void* user, void *info) { if (event != AudioTrack::EVENT_MORE_DATA) return; AudioTrack::Buffer *buffer = static_cast(info); ToneGenerator *lpToneGen = static_cast(user); short *lpOut = buffer->i16; unsigned int lNumSmp = buffer->size/sizeof(short); const ToneDescriptor *lpToneDesc = lpToneGen->mpToneDesc; if (buffer->size == 0) return; // Clear output buffer: WaveGenerator accumulates into lpOut buffer memset(lpOut, 0, buffer->size); while (lNumSmp) { unsigned int lReqSmp = lNumSmp < lpToneGen->mProcessSize*2 ? lNumSmp : lpToneGen->mProcessSize; unsigned int lGenSmp; unsigned int lWaveCmd = WaveGenerator::WAVEGEN_CONT; bool lSignal = false; lpToneGen->mLock.lock(); // Update pcm frame count and end time (current time at the end of this process) lpToneGen->mTotalSmp += lReqSmp; // Update tone gen state machine and select wave gen command switch (lpToneGen->mState) { case TONE_PLAYING: lWaveCmd = WaveGenerator::WAVEGEN_CONT; break; case TONE_STARTING: ALOGV("Starting Cbk"); lWaveCmd = WaveGenerator::WAVEGEN_START; break; case TONE_STOPPING: case TONE_RESTARTING: ALOGV("Stop/restart Cbk"); lWaveCmd = WaveGenerator::WAVEGEN_STOP; lpToneGen->mNextSegSmp = TONEGEN_INF; // forced to skip state machine management below break; case TONE_STOPPED: ALOGV("Stopped Cbk"); goto audioCallback_EndLoop; default: ALOGV("Extra Cbk"); goto audioCallback_EndLoop; } // Exit if tone sequence is over if (lpToneDesc->segments[lpToneGen->mCurSegment].duration == 0 || lpToneGen->mTotalSmp > lpToneGen->mMaxSmp) { if (lpToneGen->mState == TONE_PLAYING) { lpToneGen->mState = TONE_STOPPING; } if (lpToneDesc->segments[lpToneGen->mCurSegment].duration == 0) { goto audioCallback_EndLoop; } // fade out before stopping if maximum duration reached lWaveCmd = WaveGenerator::WAVEGEN_STOP; lpToneGen->mNextSegSmp = TONEGEN_INF; // forced to skip state machine management below } if (lpToneGen->mTotalSmp > lpToneGen->mNextSegSmp) { // Time to go to next sequence segment ALOGV("End Segment, time: %d", (unsigned int)(systemTime()/1000000)); lGenSmp = lReqSmp; // If segment, ON -> OFF transition : ramp volume down if (lpToneDesc->segments[lpToneGen->mCurSegment].waveFreq[0] != 0) { lWaveCmd = WaveGenerator::WAVEGEN_STOP; unsigned int lFreqIdx = 0; unsigned short lFrequency = lpToneDesc->segments[lpToneGen->mCurSegment].waveFreq[lFreqIdx]; while (lFrequency != 0) { WaveGenerator *lpWaveGen = lpToneGen->mWaveGens.valueFor(lFrequency); lpWaveGen->getSamples(lpOut, lGenSmp, lWaveCmd); lFrequency = lpToneDesc->segments[lpToneGen->mCurSegment].waveFreq[++lFreqIdx]; } ALOGV("ON->OFF, lGenSmp: %d, lReqSmp: %d", lGenSmp, lReqSmp); } // check if we need to loop and loop for the reqd times if (lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt) { if (lpToneGen->mLoopCounter < lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt) { ALOGV ("in if loop loopCnt(%d) loopctr(%d), CurSeg(%d)", lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt, lpToneGen->mLoopCounter, lpToneGen->mCurSegment); lpToneGen->mCurSegment = lpToneDesc->segments[lpToneGen->mCurSegment].loopIndx; ++lpToneGen->mLoopCounter; } else { // completed loop. go to next segment lpToneGen->mLoopCounter = 0; lpToneGen->mCurSegment++; ALOGV ("in else loop loopCnt(%d) loopctr(%d), CurSeg(%d)", lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt, lpToneGen->mLoopCounter, lpToneGen->mCurSegment); } } else { lpToneGen->mCurSegment++; ALOGV ("Goto next seg loopCnt(%d) loopctr(%d), CurSeg(%d)", lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt, lpToneGen->mLoopCounter, lpToneGen->mCurSegment); } // Handle loop if last segment reached if (lpToneDesc->segments[lpToneGen->mCurSegment].duration == 0) { ALOGV("Last Seg: %d", lpToneGen->mCurSegment); // Pre increment loop count and restart if total count not reached. Stop sequence otherwise if (++lpToneGen->mCurCount <= lpToneDesc->repeatCnt) { ALOGV("Repeating Count: %d", lpToneGen->mCurCount); lpToneGen->mCurSegment = lpToneDesc->repeatSegment; if (lpToneDesc->segments[lpToneDesc->repeatSegment].waveFreq[0] != 0) { lWaveCmd = WaveGenerator::WAVEGEN_START; } ALOGV("New segment %d, Next Time: %d", lpToneGen->mCurSegment, (lpToneGen->mNextSegSmp*1000)/lpToneGen->mSamplingRate); } else { lGenSmp = 0; ALOGV("End repeat, time: %d", (unsigned int)(systemTime()/1000000)); } } else { ALOGV("New segment %d, Next Time: %d", lpToneGen->mCurSegment, (lpToneGen->mNextSegSmp*1000)/lpToneGen->mSamplingRate); if (lpToneDesc->segments[lpToneGen->mCurSegment].waveFreq[0] != 0) { // If next segment is not silent, OFF -> ON transition : reset wave generator lWaveCmd = WaveGenerator::WAVEGEN_START; ALOGV("OFF->ON, lGenSmp: %d, lReqSmp: %d", lGenSmp, lReqSmp); } else { lGenSmp = 0; } } // Update next segment transition position. No harm to do it also for last segment as lpToneGen->mNextSegSmp won't be used any more lpToneGen->mNextSegSmp += (lpToneDesc->segments[lpToneGen->mCurSegment].duration * lpToneGen->mSamplingRate) / 1000; } else { // Inside a segment keep tone ON or OFF if (lpToneDesc->segments[lpToneGen->mCurSegment].waveFreq[0] == 0) { lGenSmp = 0; // If odd segment, tone is currently OFF } else { lGenSmp = lReqSmp; // If event segment, tone is currently ON } } if (lGenSmp) { // If samples must be generated, call all active wave generators and acumulate waves in lpOut unsigned int lFreqIdx = 0; unsigned short lFrequency = lpToneDesc->segments[lpToneGen->mCurSegment].waveFreq[lFreqIdx]; while (lFrequency != 0) { WaveGenerator *lpWaveGen = lpToneGen->mWaveGens.valueFor(lFrequency); lpWaveGen->getSamples(lpOut, lGenSmp, lWaveCmd); lFrequency = lpToneDesc->segments[lpToneGen->mCurSegment].waveFreq[++lFreqIdx]; } } lNumSmp -= lReqSmp; lpOut += lReqSmp; audioCallback_EndLoop: switch (lpToneGen->mState) { case TONE_RESTARTING: ALOGV("Cbk restarting track"); if (lpToneGen->prepareWave()) { lpToneGen->mState = TONE_STARTING; // must reload lpToneDesc as prepareWave() may change mpToneDesc lpToneDesc = lpToneGen->mpToneDesc; } else { ALOGW("Cbk restarting prepareWave() failed"); lpToneGen->mState = TONE_IDLE; lpToneGen->mpAudioTrack->stop(); // Force loop exit lNumSmp = 0; } lSignal = true; break; case TONE_STOPPING: ALOGV("Cbk Stopping"); lpToneGen->mState = TONE_STOPPED; // Force loop exit lNumSmp = 0; break; case TONE_STOPPED: lpToneGen->mState = TONE_INIT; ALOGV("Cbk Stopped track"); lpToneGen->mpAudioTrack->stop(); // Force loop exit lNumSmp = 0; buffer->size = 0; lSignal = true; break; case TONE_STARTING: ALOGV("Cbk starting track"); lpToneGen->mState = TONE_PLAYING; lSignal = true; break; case TONE_PLAYING: break; default: // Force loop exit lNumSmp = 0; buffer->size = 0; break; } if (lSignal) lpToneGen->mWaitCbkCond.signal(); lpToneGen->mLock.unlock(); } } //////////////////////////////////////////////////////////////////////////////// // // Method: ToneGenerator::prepareWave() // // Description: Prepare wave generators and reset tone sequencer state machine. // mpNewToneDesc must have been initialized before calling this function. // Input: // none // // Output: // returned value: true if wave generators have been created, false otherwise // //////////////////////////////////////////////////////////////////////////////// bool ToneGenerator::prepareWave() { unsigned int segmentIdx = 0; if (mpNewToneDesc == NULL) { return false; } // Remove existing wave generators if any clearWaveGens(); mpToneDesc = mpNewToneDesc; if (mDurationMs == -1) { mMaxSmp = TONEGEN_INF; } else { if (mDurationMs > (int)(TONEGEN_INF / mSamplingRate)) { mMaxSmp = (mDurationMs / 1000) * mSamplingRate; } else { mMaxSmp = (mDurationMs * mSamplingRate) / 1000; } ALOGV("prepareWave, duration limited to %d ms", mDurationMs); } while (mpToneDesc->segments[segmentIdx].duration) { // Get total number of sine waves: needed to adapt sine wave gain. unsigned int lNumWaves = numWaves(segmentIdx); unsigned int freqIdx = 0; unsigned int frequency = mpToneDesc->segments[segmentIdx].waveFreq[freqIdx]; while (frequency) { // Instantiate a wave generator if ot already done for this frequency if (mWaveGens.indexOfKey(frequency) == NAME_NOT_FOUND) { ToneGenerator::WaveGenerator *lpWaveGen = new ToneGenerator::WaveGenerator((unsigned short)mSamplingRate, frequency, TONEGEN_GAIN/lNumWaves); mWaveGens.add(frequency, lpWaveGen); } frequency = mpNewToneDesc->segments[segmentIdx].waveFreq[++freqIdx]; } segmentIdx++; } // Initialize tone sequencer mTotalSmp = 0; mCurSegment = 0; mCurCount = 0; mLoopCounter = 0; if (mpToneDesc->segments[0].duration == TONEGEN_INF) { mNextSegSmp = TONEGEN_INF; } else{ mNextSegSmp = (mpToneDesc->segments[0].duration * mSamplingRate) / 1000; } return true; } //////////////////////////////////////////////////////////////////////////////// // // Method: ToneGenerator::numWaves() // // Description: Count number of sine waves needed to generate a tone segment (e.g 2 for DTMF). // // Input: // segmentIdx tone segment index // // Output: // returned value: nummber of sine waves // //////////////////////////////////////////////////////////////////////////////// unsigned int ToneGenerator::numWaves(unsigned int segmentIdx) { unsigned int lCnt = 0; if (mpToneDesc->segments[segmentIdx].duration) { while (mpToneDesc->segments[segmentIdx].waveFreq[lCnt]) { lCnt++; } lCnt++; } return lCnt; } //////////////////////////////////////////////////////////////////////////////// // // Method: ToneGenerator::clearWaveGens() // // Description: Removes all wave generators. // // Input: // none // // Output: // none // //////////////////////////////////////////////////////////////////////////////// void ToneGenerator::clearWaveGens() { ALOGV("Clearing mWaveGens:"); for (size_t lIdx = 0; lIdx < mWaveGens.size(); lIdx++) { delete mWaveGens.valueAt(lIdx); } mWaveGens.clear(); } //////////////////////////////////////////////////////////////////////////////// // // Method: ToneGenerator::getToneForRegion() // // Description: Get correct ringtone type according to current region. // The corrected ring tone type is the tone descriptor index in sToneDescriptors[]. // // Input: // none // // Output: // none // //////////////////////////////////////////////////////////////////////////////// ToneGenerator::tone_type ToneGenerator::getToneForRegion(tone_type toneType) { tone_type regionTone; if (mRegion == CEPT || toneType < FIRST_SUP_TONE || toneType > LAST_SUP_TONE) { regionTone = toneType; } else { regionTone = (tone_type) sToneMappingTable[mRegion][toneType - FIRST_SUP_TONE]; } ALOGV("getToneForRegion, tone %d, region %d, regionTone %d", toneType, mRegion, regionTone); return regionTone; } //////////////////////////////////////////////////////////////////////////////// // WaveGenerator::WaveGenerator class Implementation //////////////////////////////////////////////////////////////////////////////// //---------------------------------- public methods ---------------------------- //////////////////////////////////////////////////////////////////////////////// // // Method: WaveGenerator::WaveGenerator() // // Description: Constructor. // // Input: // samplingRate: Output sampling rate in Hz // frequency: Frequency of the sine wave to generate in Hz // volume: volume (0.0 to 1.0) // // Output: // none // //////////////////////////////////////////////////////////////////////////////// ToneGenerator::WaveGenerator::WaveGenerator(unsigned short samplingRate, unsigned short frequency, float volume) { double d0; double F_div_Fs; // frequency / samplingRate F_div_Fs = frequency / (double)samplingRate; d0 = - (float)GEN_AMP * sin(2 * M_PI * F_div_Fs); mS2_0 = (short)d0; mS1 = 0; mS2 = mS2_0; mAmplitude_Q15 = (short)(32767. * 32767. * volume / GEN_AMP); // take some margin for amplitude fluctuation if (mAmplitude_Q15 > 32500) mAmplitude_Q15 = 32500; d0 = 32768.0 * cos(2 * M_PI * F_div_Fs); // Q14*2*cos() if (d0 > 32767) d0 = 32767; mA1_Q14 = (short) d0; ALOGV("WaveGenerator init, mA1_Q14: %d, mS2_0: %d, mAmplitude_Q15: %d", mA1_Q14, mS2_0, mAmplitude_Q15); } //////////////////////////////////////////////////////////////////////////////// // // Method: WaveGenerator::~WaveGenerator() // // Description: Destructor. // // Input: // none // // Output: // none // //////////////////////////////////////////////////////////////////////////////// ToneGenerator::WaveGenerator::~WaveGenerator() { } //////////////////////////////////////////////////////////////////////////////// // // Method: WaveGenerator::getSamples() // // Description: Generates count samples of a sine wave and accumulates // result in outBuffer. // // Input: // outBuffer: Output buffer where to accumulate samples. // count: number of samples to produce. // command: special action requested (see enum gen_command). // // Output: // none // //////////////////////////////////////////////////////////////////////////////// void ToneGenerator::WaveGenerator::getSamples(short *outBuffer, unsigned int count, unsigned int command) { long lS1, lS2; long lA1, lAmplitude; long Sample; // current sample // init local if (command == WAVEGEN_START) { lS1 = (long)0; lS2 = (long)mS2_0; } else { lS1 = (long)mS1; lS2 = (long)mS2; } lA1 = (long)mA1_Q14; lAmplitude = (long)mAmplitude_Q15; if (command == WAVEGEN_STOP) { lAmplitude <<= 16; if (count == 0) { return; } long dec = lAmplitude/count; // loop generation while (count--) { Sample = ((lA1 * lS1) >> S_Q14) - lS2; // shift delay lS2 = lS1; lS1 = Sample; Sample = ((lAmplitude>>16) * Sample) >> S_Q15; *(outBuffer++) += (short)Sample; // put result in buffer lAmplitude -= dec; } } else { // loop generation while (count--) { Sample = ((lA1 * lS1) >> S_Q14) - lS2; // shift delay lS2 = lS1; lS1 = Sample; Sample = (lAmplitude * Sample) >> S_Q15; *(outBuffer++) += (short)Sample; // put result in buffer } } // save status mS1 = (short)lS1; mS2 = (short)lS2; } } // end namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/mediarecorder.cpp0000644000015700001700000004744512200324306025535 0ustar pbuserpbgroup00000000000000/* ** ** Copyright (c) 2008 The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "MediaRecorder" #include #include #include #include #include #include #include // for MEDIA_ERROR_SERVER_DIED #include namespace android { status_t MediaRecorder::setCamera(const sp& camera, const sp& proxy) { ALOGV("setCamera(%p,%p)", camera.get(), proxy.get()); if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } if (!(mCurrentState & MEDIA_RECORDER_IDLE)) { ALOGE("setCamera called in an invalid state(%d)", mCurrentState); return INVALID_OPERATION; } status_t ret = mMediaRecorder->setCamera(camera, proxy); if (OK != ret) { ALOGV("setCamera failed: %d", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } return ret; } status_t MediaRecorder::setPreviewSurface(const sp& surface) { ALOGV("setPreviewSurface(%p)", surface.get()); if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } if (!(mCurrentState & MEDIA_RECORDER_DATASOURCE_CONFIGURED)) { ALOGE("setPreviewSurface called in an invalid state(%d)", mCurrentState); return INVALID_OPERATION; } if (!mIsVideoSourceSet) { ALOGE("try to set preview surface without setting the video source first"); return INVALID_OPERATION; } status_t ret = mMediaRecorder->setPreviewSurface(surface); if (OK != ret) { ALOGV("setPreviewSurface failed: %d", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } return ret; } status_t MediaRecorder::init() { ALOGV("init"); if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } if (!(mCurrentState & MEDIA_RECORDER_IDLE)) { ALOGE("init called in an invalid state(%d)", mCurrentState); return INVALID_OPERATION; } status_t ret = mMediaRecorder->init(); if (OK != ret) { ALOGV("init failed: %d", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } ret = mMediaRecorder->setListener(this); if (OK != ret) { ALOGV("setListener failed: %d", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } mCurrentState = MEDIA_RECORDER_INITIALIZED; return ret; } status_t MediaRecorder::setVideoSource(int vs) { ALOGV("setVideoSource(%d)", vs); if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } if (mIsVideoSourceSet) { ALOGE("video source has already been set"); return INVALID_OPERATION; } if (mCurrentState & MEDIA_RECORDER_IDLE) { ALOGV("Call init() since the media recorder is not initialized yet"); status_t ret = init(); if (OK != ret) { return ret; } } if (!(mCurrentState & MEDIA_RECORDER_INITIALIZED)) { ALOGE("setVideoSource called in an invalid state(%d)", mCurrentState); return INVALID_OPERATION; } // following call is made over the Binder Interface status_t ret = mMediaRecorder->setVideoSource(vs); if (OK != ret) { ALOGV("setVideoSource failed: %d", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } mIsVideoSourceSet = true; return ret; } status_t MediaRecorder::setAudioSource(int as) { ALOGV("setAudioSource(%d)", as); if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } if (mCurrentState & MEDIA_RECORDER_IDLE) { ALOGV("Call init() since the media recorder is not initialized yet"); status_t ret = init(); if (OK != ret) { return ret; } } if (mIsAudioSourceSet) { ALOGE("audio source has already been set"); return INVALID_OPERATION; } if (!(mCurrentState & MEDIA_RECORDER_INITIALIZED)) { ALOGE("setAudioSource called in an invalid state(%d)", mCurrentState); return INVALID_OPERATION; } status_t ret = mMediaRecorder->setAudioSource(as); if (OK != ret) { ALOGV("setAudioSource failed: %d", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } mIsAudioSourceSet = true; return ret; } status_t MediaRecorder::setOutputFormat(int of) { ALOGV("setOutputFormat(%d)", of); if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } if (!(mCurrentState & MEDIA_RECORDER_INITIALIZED)) { ALOGE("setOutputFormat called in an invalid state: %d", mCurrentState); return INVALID_OPERATION; } if (mIsVideoSourceSet && of >= OUTPUT_FORMAT_AUDIO_ONLY_START && of != OUTPUT_FORMAT_RTP_AVP && of != OUTPUT_FORMAT_MPEG2TS) { //first non-video output format ALOGE("output format (%d) is meant for audio recording only and incompatible with video recording", of); return INVALID_OPERATION; } status_t ret = mMediaRecorder->setOutputFormat(of); if (OK != ret) { ALOGE("setOutputFormat failed: %d", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } mCurrentState = MEDIA_RECORDER_DATASOURCE_CONFIGURED; return ret; } status_t MediaRecorder::setVideoEncoder(int ve) { ALOGV("setVideoEncoder(%d)", ve); if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } if (!mIsVideoSourceSet) { ALOGE("try to set the video encoder without setting the video source first"); return INVALID_OPERATION; } if (mIsVideoEncoderSet) { ALOGE("video encoder has already been set"); return INVALID_OPERATION; } if (!(mCurrentState & MEDIA_RECORDER_DATASOURCE_CONFIGURED)) { ALOGE("setVideoEncoder called in an invalid state(%d)", mCurrentState); return INVALID_OPERATION; } status_t ret = mMediaRecorder->setVideoEncoder(ve); if (OK != ret) { ALOGV("setVideoEncoder failed: %d", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } mIsVideoEncoderSet = true; return ret; } status_t MediaRecorder::setAudioEncoder(int ae) { ALOGV("setAudioEncoder(%d)", ae); if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } if (!mIsAudioSourceSet) { ALOGE("try to set the audio encoder without setting the audio source first"); return INVALID_OPERATION; } if (mIsAudioEncoderSet) { ALOGE("audio encoder has already been set"); return INVALID_OPERATION; } if (!(mCurrentState & MEDIA_RECORDER_DATASOURCE_CONFIGURED)) { ALOGE("setAudioEncoder called in an invalid state(%d)", mCurrentState); return INVALID_OPERATION; } status_t ret = mMediaRecorder->setAudioEncoder(ae); if (OK != ret) { ALOGV("setAudioEncoder failed: %d", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } mIsAudioEncoderSet = true; return ret; } status_t MediaRecorder::setOutputFile(const char* path) { ALOGV("setOutputFile(%s)", path); if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } if (mIsOutputFileSet) { ALOGE("output file has already been set"); return INVALID_OPERATION; } if (!(mCurrentState & MEDIA_RECORDER_DATASOURCE_CONFIGURED)) { ALOGE("setOutputFile called in an invalid state(%d)", mCurrentState); return INVALID_OPERATION; } status_t ret = mMediaRecorder->setOutputFile(path); if (OK != ret) { ALOGV("setOutputFile failed: %d", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } mIsOutputFileSet = true; return ret; } status_t MediaRecorder::setOutputFile(int fd, int64_t offset, int64_t length) { ALOGV("setOutputFile(%d, %lld, %lld)", fd, offset, length); if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } if (mIsOutputFileSet) { ALOGE("output file has already been set"); return INVALID_OPERATION; } if (!(mCurrentState & MEDIA_RECORDER_DATASOURCE_CONFIGURED)) { ALOGE("setOutputFile called in an invalid state(%d)", mCurrentState); return INVALID_OPERATION; } // It appears that if an invalid file descriptor is passed through // binder calls, the server-side of the inter-process function call // is skipped. As a result, the check at the server-side to catch // the invalid file descritpor never gets invoked. This is to workaround // this issue by checking the file descriptor first before passing // it through binder call. if (fd < 0) { ALOGE("Invalid file descriptor: %d", fd); return BAD_VALUE; } status_t ret = mMediaRecorder->setOutputFile(fd, offset, length); if (OK != ret) { ALOGV("setOutputFile failed: %d", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } mIsOutputFileSet = true; return ret; } status_t MediaRecorder::setVideoSize(int width, int height) { ALOGV("setVideoSize(%d, %d)", width, height); if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } if (!(mCurrentState & MEDIA_RECORDER_DATASOURCE_CONFIGURED)) { ALOGE("setVideoSize called in an invalid state: %d", mCurrentState); return INVALID_OPERATION; } if (!mIsVideoSourceSet) { ALOGE("Cannot set video size without setting video source first"); return INVALID_OPERATION; } status_t ret = mMediaRecorder->setVideoSize(width, height); if (OK != ret) { ALOGE("setVideoSize failed: %d", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } return ret; } // Query a SurfaceMediaSurface through the Mediaserver, over the // binder interface. This is used by the Filter Framework (MeidaEncoder) // to get an object to hook up to ANativeWindow. sp MediaRecorder:: querySurfaceMediaSourceFromMediaServer() { Mutex::Autolock _l(mLock); mSurfaceMediaSource = mMediaRecorder->querySurfaceMediaSource(); if (mSurfaceMediaSource == NULL) { ALOGE("SurfaceMediaSource could not be initialized!"); } return mSurfaceMediaSource; } status_t MediaRecorder::setVideoFrameRate(int frames_per_second) { ALOGV("setVideoFrameRate(%d)", frames_per_second); if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } if (!(mCurrentState & MEDIA_RECORDER_DATASOURCE_CONFIGURED)) { ALOGE("setVideoFrameRate called in an invalid state: %d", mCurrentState); return INVALID_OPERATION; } if (!mIsVideoSourceSet) { ALOGE("Cannot set video frame rate without setting video source first"); return INVALID_OPERATION; } status_t ret = mMediaRecorder->setVideoFrameRate(frames_per_second); if (OK != ret) { ALOGE("setVideoFrameRate failed: %d", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } return ret; } status_t MediaRecorder::setParameters(const String8& params) { ALOGV("setParameters(%s)", params.string()); if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } bool isInvalidState = (mCurrentState & (MEDIA_RECORDER_PREPARED | MEDIA_RECORDER_RECORDING | MEDIA_RECORDER_ERROR)); if (isInvalidState) { ALOGE("setParameters is called in an invalid state: %d", mCurrentState); return INVALID_OPERATION; } status_t ret = mMediaRecorder->setParameters(params); if (OK != ret) { ALOGE("setParameters(%s) failed: %d", params.string(), ret); // Do not change our current state to MEDIA_RECORDER_ERROR, failures // of the only currently supported parameters, "max-duration" and // "max-filesize" are _not_ fatal. } return ret; } status_t MediaRecorder::prepare() { ALOGV("prepare"); if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } if (!(mCurrentState & MEDIA_RECORDER_DATASOURCE_CONFIGURED)) { ALOGE("prepare called in an invalid state: %d", mCurrentState); return INVALID_OPERATION; } if (mIsAudioSourceSet != mIsAudioEncoderSet) { if (mIsAudioSourceSet) { ALOGE("audio source is set, but audio encoder is not set"); } else { // must not happen, since setAudioEncoder checks this already ALOGE("audio encoder is set, but audio source is not set"); } return INVALID_OPERATION; } if (mIsVideoSourceSet != mIsVideoEncoderSet) { if (mIsVideoSourceSet) { ALOGE("video source is set, but video encoder is not set"); } else { // must not happen, since setVideoEncoder checks this already ALOGE("video encoder is set, but video source is not set"); } return INVALID_OPERATION; } status_t ret = mMediaRecorder->prepare(); if (OK != ret) { ALOGE("prepare failed: %d", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } mCurrentState = MEDIA_RECORDER_PREPARED; return ret; } status_t MediaRecorder::getMaxAmplitude(int* max) { ALOGV("getMaxAmplitude"); if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } if (mCurrentState & MEDIA_RECORDER_ERROR) { ALOGE("getMaxAmplitude called in an invalid state: %d", mCurrentState); return INVALID_OPERATION; } status_t ret = mMediaRecorder->getMaxAmplitude(max); if (OK != ret) { ALOGE("getMaxAmplitude failed: %d", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } return ret; } status_t MediaRecorder::start() { ALOGV("start"); if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } if (!(mCurrentState & MEDIA_RECORDER_PREPARED)) { ALOGE("start called in an invalid state: %d", mCurrentState); return INVALID_OPERATION; } status_t ret = mMediaRecorder->start(); if (OK != ret) { ALOGE("start failed: %d", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } mCurrentState = MEDIA_RECORDER_RECORDING; return ret; } status_t MediaRecorder::stop() { ALOGV("stop"); if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } if (!(mCurrentState & MEDIA_RECORDER_RECORDING)) { ALOGE("stop called in an invalid state: %d", mCurrentState); return INVALID_OPERATION; } status_t ret = mMediaRecorder->stop(); if (OK != ret) { ALOGE("stop failed: %d", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } // FIXME: // stop and reset are semantically different. // We treat them the same for now, and will change this in the future. doCleanUp(); mCurrentState = MEDIA_RECORDER_IDLE; return ret; } // Reset should be OK in any state status_t MediaRecorder::reset() { ALOGV("reset"); if (mMediaRecorder == NULL) { ALOGE("media recorder is not initialized yet"); return INVALID_OPERATION; } doCleanUp(); status_t ret = UNKNOWN_ERROR; switch (mCurrentState) { case MEDIA_RECORDER_IDLE: ret = OK; break; case MEDIA_RECORDER_RECORDING: case MEDIA_RECORDER_DATASOURCE_CONFIGURED: case MEDIA_RECORDER_PREPARED: case MEDIA_RECORDER_ERROR: { ret = doReset(); if (OK != ret) { return ret; // No need to continue } } // Intentional fall through case MEDIA_RECORDER_INITIALIZED: ret = close(); break; default: { ALOGE("Unexpected non-existing state: %d", mCurrentState); break; } } return ret; } status_t MediaRecorder::close() { ALOGV("close"); if (!(mCurrentState & MEDIA_RECORDER_INITIALIZED)) { ALOGE("close called in an invalid state: %d", mCurrentState); return INVALID_OPERATION; } status_t ret = mMediaRecorder->close(); if (OK != ret) { ALOGE("close failed: %d", ret); mCurrentState = MEDIA_RECORDER_ERROR; return UNKNOWN_ERROR; } else { mCurrentState = MEDIA_RECORDER_IDLE; } return ret; } status_t MediaRecorder::doReset() { ALOGV("doReset"); status_t ret = mMediaRecorder->reset(); if (OK != ret) { ALOGE("doReset failed: %d", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } else { mCurrentState = MEDIA_RECORDER_INITIALIZED; } return ret; } void MediaRecorder::doCleanUp() { ALOGV("doCleanUp"); mIsAudioSourceSet = false; mIsVideoSourceSet = false; mIsAudioEncoderSet = false; mIsVideoEncoderSet = false; mIsOutputFileSet = false; } // Release should be OK in any state status_t MediaRecorder::release() { ALOGV("release"); if (mMediaRecorder != NULL) { return mMediaRecorder->release(); } return INVALID_OPERATION; } MediaRecorder::MediaRecorder() : mSurfaceMediaSource(NULL) { ALOGV("constructor"); const sp& service(getMediaPlayerService()); if (service != NULL) { mMediaRecorder = service->createMediaRecorder(getpid()); } if (mMediaRecorder != NULL) { mCurrentState = MEDIA_RECORDER_IDLE; } doCleanUp(); } status_t MediaRecorder::initCheck() { return mMediaRecorder != 0 ? NO_ERROR : NO_INIT; } MediaRecorder::~MediaRecorder() { ALOGV("destructor"); if (mMediaRecorder != NULL) { mMediaRecorder.clear(); } if (mSurfaceMediaSource != NULL) { mSurfaceMediaSource.clear(); } } status_t MediaRecorder::setListener(const sp& listener) { ALOGV("setListener"); Mutex::Autolock _l(mLock); mListener = listener; return NO_ERROR; } void MediaRecorder::notify(int msg, int ext1, int ext2) { ALOGV("message received msg=%d, ext1=%d, ext2=%d", msg, ext1, ext2); sp listener; mLock.lock(); listener = mListener; mLock.unlock(); if (listener != NULL) { Mutex::Autolock _l(mNotifyLock); ALOGV("callback application"); listener->notify(msg, ext1, ext2); ALOGV("back from callback"); } } void MediaRecorder::died() { ALOGV("died"); notify(MEDIA_RECORDER_EVENT_ERROR, MEDIA_ERROR_SERVER_DIED, 0); } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IAudioPolicyService.cpp0000644000015700001700000006316612200324306026601 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2009, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #define LOG_TAG "IAudioPolicyService" #include #include #include #include #include #include namespace android { enum { SET_DEVICE_CONNECTION_STATE = IBinder::FIRST_CALL_TRANSACTION, GET_DEVICE_CONNECTION_STATE, SET_PHONE_STATE, SET_RINGER_MODE, // reserved, no longer used SET_FORCE_USE, GET_FORCE_USE, GET_OUTPUT, START_OUTPUT, STOP_OUTPUT, RELEASE_OUTPUT, GET_INPUT, START_INPUT, STOP_INPUT, RELEASE_INPUT, INIT_STREAM_VOLUME, SET_STREAM_VOLUME, GET_STREAM_VOLUME, GET_STRATEGY_FOR_STREAM, GET_OUTPUT_FOR_EFFECT, REGISTER_EFFECT, UNREGISTER_EFFECT, IS_STREAM_ACTIVE, IS_SOURCE_ACTIVE, GET_DEVICES_FOR_STREAM, QUERY_DEFAULT_PRE_PROCESSING, SET_EFFECT_ENABLED }; class BpAudioPolicyService : public BpInterface { public: BpAudioPolicyService(const sp& impl) : BpInterface(impl) { } virtual status_t setDeviceConnectionState( audio_devices_t device, audio_policy_dev_state_t state, const char *device_address) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(static_cast (device)); data.writeInt32(static_cast (state)); data.writeCString(device_address); remote()->transact(SET_DEVICE_CONNECTION_STATE, data, &reply); return static_cast (reply.readInt32()); } virtual audio_policy_dev_state_t getDeviceConnectionState( audio_devices_t device, const char *device_address) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(static_cast (device)); data.writeCString(device_address); remote()->transact(GET_DEVICE_CONNECTION_STATE, data, &reply); return static_cast (reply.readInt32()); } virtual status_t setPhoneState(audio_mode_t state) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(state); remote()->transact(SET_PHONE_STATE, data, &reply); return static_cast (reply.readInt32()); } virtual status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(static_cast (usage)); data.writeInt32(static_cast (config)); remote()->transact(SET_FORCE_USE, data, &reply); return static_cast (reply.readInt32()); } virtual audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(static_cast (usage)); remote()->transact(GET_FORCE_USE, data, &reply); return static_cast (reply.readInt32()); } virtual audio_io_handle_t getOutput( audio_stream_type_t stream, uint32_t samplingRate, audio_format_t format, audio_channel_mask_t channelMask, audio_output_flags_t flags) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(static_cast (stream)); data.writeInt32(samplingRate); data.writeInt32(static_cast (format)); data.writeInt32(channelMask); data.writeInt32(static_cast (flags)); remote()->transact(GET_OUTPUT, data, &reply); return static_cast (reply.readInt32()); } virtual status_t startOutput(audio_io_handle_t output, audio_stream_type_t stream, int session) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(output); data.writeInt32((int32_t) stream); data.writeInt32(session); remote()->transact(START_OUTPUT, data, &reply); return static_cast (reply.readInt32()); } virtual status_t stopOutput(audio_io_handle_t output, audio_stream_type_t stream, int session) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(output); data.writeInt32((int32_t) stream); data.writeInt32(session); remote()->transact(STOP_OUTPUT, data, &reply); return static_cast (reply.readInt32()); } virtual void releaseOutput(audio_io_handle_t output) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(output); remote()->transact(RELEASE_OUTPUT, data, &reply); } virtual audio_io_handle_t getInput( audio_source_t inputSource, uint32_t samplingRate, audio_format_t format, audio_channel_mask_t channelMask, int audioSession) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32((int32_t) inputSource); data.writeInt32(samplingRate); data.writeInt32(static_cast (format)); data.writeInt32(channelMask); data.writeInt32(audioSession); remote()->transact(GET_INPUT, data, &reply); return static_cast (reply.readInt32()); } virtual status_t startInput(audio_io_handle_t input) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(input); remote()->transact(START_INPUT, data, &reply); return static_cast (reply.readInt32()); } virtual status_t stopInput(audio_io_handle_t input) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(input); remote()->transact(STOP_INPUT, data, &reply); return static_cast (reply.readInt32()); } virtual void releaseInput(audio_io_handle_t input) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(input); remote()->transact(RELEASE_INPUT, data, &reply); } virtual status_t initStreamVolume(audio_stream_type_t stream, int indexMin, int indexMax) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(static_cast (stream)); data.writeInt32(indexMin); data.writeInt32(indexMax); remote()->transact(INIT_STREAM_VOLUME, data, &reply); return static_cast (reply.readInt32()); } virtual status_t setStreamVolumeIndex(audio_stream_type_t stream, int index, audio_devices_t device) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(static_cast (stream)); data.writeInt32(index); data.writeInt32(static_cast (device)); remote()->transact(SET_STREAM_VOLUME, data, &reply); return static_cast (reply.readInt32()); } virtual status_t getStreamVolumeIndex(audio_stream_type_t stream, int *index, audio_devices_t device) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(static_cast (stream)); data.writeInt32(static_cast (device)); remote()->transact(GET_STREAM_VOLUME, data, &reply); int lIndex = reply.readInt32(); if (index) *index = lIndex; return static_cast (reply.readInt32()); } virtual uint32_t getStrategyForStream(audio_stream_type_t stream) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(static_cast (stream)); remote()->transact(GET_STRATEGY_FOR_STREAM, data, &reply); return reply.readInt32(); } virtual audio_devices_t getDevicesForStream(audio_stream_type_t stream) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(static_cast (stream)); remote()->transact(GET_DEVICES_FOR_STREAM, data, &reply); return (audio_devices_t) reply.readInt32(); } virtual audio_io_handle_t getOutputForEffect(const effect_descriptor_t *desc) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.write(desc, sizeof(effect_descriptor_t)); remote()->transact(GET_OUTPUT_FOR_EFFECT, data, &reply); return static_cast (reply.readInt32()); } virtual status_t registerEffect(const effect_descriptor_t *desc, audio_io_handle_t io, uint32_t strategy, int session, int id) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.write(desc, sizeof(effect_descriptor_t)); data.writeInt32(io); data.writeInt32(strategy); data.writeInt32(session); data.writeInt32(id); remote()->transact(REGISTER_EFFECT, data, &reply); return static_cast (reply.readInt32()); } virtual status_t unregisterEffect(int id) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(id); remote()->transact(UNREGISTER_EFFECT, data, &reply); return static_cast (reply.readInt32()); } virtual status_t setEffectEnabled(int id, bool enabled) { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(id); data.writeInt32(enabled); remote()->transact(SET_EFFECT_ENABLED, data, &reply); return static_cast (reply.readInt32()); } virtual bool isStreamActive(audio_stream_type_t stream, uint32_t inPastMs) const { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32((int32_t) stream); data.writeInt32(inPastMs); remote()->transact(IS_STREAM_ACTIVE, data, &reply); return reply.readInt32(); } virtual bool isSourceActive(audio_source_t source) const { Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32((int32_t) source); remote()->transact(IS_SOURCE_ACTIVE, data, &reply); return reply.readInt32(); } virtual status_t queryDefaultPreProcessing(int audioSession, effect_descriptor_t *descriptors, uint32_t *count) { if (descriptors == NULL || count == NULL) { return BAD_VALUE; } Parcel data, reply; data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); data.writeInt32(audioSession); data.writeInt32(*count); status_t status = remote()->transact(QUERY_DEFAULT_PRE_PROCESSING, data, &reply); if (status != NO_ERROR) { return status; } status = static_cast (reply.readInt32()); uint32_t retCount = reply.readInt32(); if (retCount != 0) { uint32_t numDesc = (retCount < *count) ? retCount : *count; reply.read(descriptors, sizeof(effect_descriptor_t) * numDesc); } *count = retCount; return status; } }; IMPLEMENT_META_INTERFACE(AudioPolicyService, "android.media.IAudioPolicyService"); // ---------------------------------------------------------------------- status_t BnAudioPolicyService::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case SET_DEVICE_CONNECTION_STATE: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_devices_t device = static_cast (data.readInt32()); audio_policy_dev_state_t state = static_cast (data.readInt32()); const char *device_address = data.readCString(); reply->writeInt32(static_cast (setDeviceConnectionState(device, state, device_address))); return NO_ERROR; } break; case GET_DEVICE_CONNECTION_STATE: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_devices_t device = static_cast (data.readInt32()); const char *device_address = data.readCString(); reply->writeInt32(static_cast (getDeviceConnectionState(device, device_address))); return NO_ERROR; } break; case SET_PHONE_STATE: { CHECK_INTERFACE(IAudioPolicyService, data, reply); reply->writeInt32(static_cast (setPhoneState((audio_mode_t) data.readInt32()))); return NO_ERROR; } break; case SET_FORCE_USE: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_policy_force_use_t usage = static_cast (data.readInt32()); audio_policy_forced_cfg_t config = static_cast (data.readInt32()); reply->writeInt32(static_cast (setForceUse(usage, config))); return NO_ERROR; } break; case GET_FORCE_USE: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_policy_force_use_t usage = static_cast (data.readInt32()); reply->writeInt32(static_cast (getForceUse(usage))); return NO_ERROR; } break; case GET_OUTPUT: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_stream_type_t stream = static_cast (data.readInt32()); uint32_t samplingRate = data.readInt32(); audio_format_t format = (audio_format_t) data.readInt32(); audio_channel_mask_t channelMask = data.readInt32(); audio_output_flags_t flags = static_cast (data.readInt32()); audio_io_handle_t output = getOutput(stream, samplingRate, format, channelMask, flags); reply->writeInt32(static_cast (output)); return NO_ERROR; } break; case START_OUTPUT: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_io_handle_t output = static_cast (data.readInt32()); uint32_t stream = data.readInt32(); int session = data.readInt32(); reply->writeInt32(static_cast (startOutput(output, (audio_stream_type_t)stream, session))); return NO_ERROR; } break; case STOP_OUTPUT: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_io_handle_t output = static_cast (data.readInt32()); uint32_t stream = data.readInt32(); int session = data.readInt32(); reply->writeInt32(static_cast (stopOutput(output, (audio_stream_type_t)stream, session))); return NO_ERROR; } break; case RELEASE_OUTPUT: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_io_handle_t output = static_cast (data.readInt32()); releaseOutput(output); return NO_ERROR; } break; case GET_INPUT: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_source_t inputSource = (audio_source_t) data.readInt32(); uint32_t samplingRate = data.readInt32(); audio_format_t format = (audio_format_t) data.readInt32(); audio_channel_mask_t channelMask = data.readInt32(); int audioSession = data.readInt32(); audio_io_handle_t input = getInput(inputSource, samplingRate, format, channelMask, audioSession); reply->writeInt32(static_cast (input)); return NO_ERROR; } break; case START_INPUT: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_io_handle_t input = static_cast (data.readInt32()); reply->writeInt32(static_cast (startInput(input))); return NO_ERROR; } break; case STOP_INPUT: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_io_handle_t input = static_cast (data.readInt32()); reply->writeInt32(static_cast (stopInput(input))); return NO_ERROR; } break; case RELEASE_INPUT: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_io_handle_t input = static_cast (data.readInt32()); releaseInput(input); return NO_ERROR; } break; case INIT_STREAM_VOLUME: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_stream_type_t stream = static_cast (data.readInt32()); int indexMin = data.readInt32(); int indexMax = data.readInt32(); reply->writeInt32(static_cast (initStreamVolume(stream, indexMin,indexMax))); return NO_ERROR; } break; case SET_STREAM_VOLUME: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_stream_type_t stream = static_cast (data.readInt32()); int index = data.readInt32(); audio_devices_t device = static_cast (data.readInt32()); reply->writeInt32(static_cast (setStreamVolumeIndex(stream, index, device))); return NO_ERROR; } break; case GET_STREAM_VOLUME: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_stream_type_t stream = static_cast (data.readInt32()); audio_devices_t device = static_cast (data.readInt32()); int index; status_t status = getStreamVolumeIndex(stream, &index, device); reply->writeInt32(index); reply->writeInt32(static_cast (status)); return NO_ERROR; } break; case GET_STRATEGY_FOR_STREAM: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_stream_type_t stream = static_cast (data.readInt32()); reply->writeInt32(getStrategyForStream(stream)); return NO_ERROR; } break; case GET_DEVICES_FOR_STREAM: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_stream_type_t stream = static_cast (data.readInt32()); reply->writeInt32(static_cast (getDevicesForStream(stream))); return NO_ERROR; } break; case GET_OUTPUT_FOR_EFFECT: { CHECK_INTERFACE(IAudioPolicyService, data, reply); effect_descriptor_t desc; data.read(&desc, sizeof(effect_descriptor_t)); audio_io_handle_t output = getOutputForEffect(&desc); reply->writeInt32(static_cast (output)); return NO_ERROR; } break; case REGISTER_EFFECT: { CHECK_INTERFACE(IAudioPolicyService, data, reply); effect_descriptor_t desc; data.read(&desc, sizeof(effect_descriptor_t)); audio_io_handle_t io = data.readInt32(); uint32_t strategy = data.readInt32(); int session = data.readInt32(); int id = data.readInt32(); reply->writeInt32(static_cast (registerEffect(&desc, io, strategy, session, id))); return NO_ERROR; } break; case UNREGISTER_EFFECT: { CHECK_INTERFACE(IAudioPolicyService, data, reply); int id = data.readInt32(); reply->writeInt32(static_cast (unregisterEffect(id))); return NO_ERROR; } break; case SET_EFFECT_ENABLED: { CHECK_INTERFACE(IAudioPolicyService, data, reply); int id = data.readInt32(); bool enabled = static_cast (data.readInt32()); reply->writeInt32(static_cast (setEffectEnabled(id, enabled))); return NO_ERROR; } break; case IS_STREAM_ACTIVE: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_stream_type_t stream = (audio_stream_type_t) data.readInt32(); uint32_t inPastMs = (uint32_t)data.readInt32(); reply->writeInt32( isStreamActive((audio_stream_type_t) stream, inPastMs) ); return NO_ERROR; } break; case IS_SOURCE_ACTIVE: { CHECK_INTERFACE(IAudioPolicyService, data, reply); audio_source_t source = (audio_source_t) data.readInt32(); reply->writeInt32( isSourceActive(source)); return NO_ERROR; } case QUERY_DEFAULT_PRE_PROCESSING: { CHECK_INTERFACE(IAudioPolicyService, data, reply); int audioSession = data.readInt32(); uint32_t count = data.readInt32(); uint32_t retCount = count; effect_descriptor_t *descriptors = (effect_descriptor_t *)new char[count * sizeof(effect_descriptor_t)]; status_t status = queryDefaultPreProcessing(audioSession, descriptors, &retCount); reply->writeInt32(status); if (status != NO_ERROR && status != NO_MEMORY) { retCount = 0; } reply->writeInt32(retCount); if (retCount) { if (retCount < count) { count = retCount; } reply->write(descriptors, sizeof(effect_descriptor_t) * count); } delete[] descriptors; return status; } default: return BBinder::onTransact(code, data, reply, flags); } } // ---------------------------------------------------------------------------- }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IMediaPlayerService.cpp0000644000015700001700000002357112200324306026550 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2008, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #include #include #include #include #include #include #include #include #include #include #include #include #include // for status_t #include namespace android { enum { CREATE = IBinder::FIRST_CALL_TRANSACTION, DECODE_URL, DECODE_FD, CREATE_MEDIA_RECORDER, CREATE_METADATA_RETRIEVER, GET_OMX, MAKE_CRYPTO, MAKE_HDCP, ADD_BATTERY_DATA, PULL_BATTERY_DATA, LISTEN_FOR_REMOTE_DISPLAY, }; class BpMediaPlayerService: public BpInterface { public: BpMediaPlayerService(const sp& impl) : BpInterface(impl) { } virtual sp createMetadataRetriever(pid_t pid) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); data.writeInt32(pid); remote()->transact(CREATE_METADATA_RETRIEVER, data, &reply); return interface_cast(reply.readStrongBinder()); } virtual sp create( pid_t pid, const sp& client, int audioSessionId) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); data.writeInt32(pid); data.writeStrongBinder(client->asBinder()); data.writeInt32(audioSessionId); remote()->transact(CREATE, data, &reply); return interface_cast(reply.readStrongBinder()); } virtual sp createMediaRecorder(pid_t pid) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); data.writeInt32(pid); remote()->transact(CREATE_MEDIA_RECORDER, data, &reply); return interface_cast(reply.readStrongBinder()); } virtual sp decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); data.writeCString(url); remote()->transact(DECODE_URL, data, &reply); *pSampleRate = uint32_t(reply.readInt32()); *pNumChannels = reply.readInt32(); *pFormat = (audio_format_t) reply.readInt32(); return interface_cast(reply.readStrongBinder()); } virtual sp decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); data.writeFileDescriptor(fd); data.writeInt64(offset); data.writeInt64(length); remote()->transact(DECODE_FD, data, &reply); *pSampleRate = uint32_t(reply.readInt32()); *pNumChannels = reply.readInt32(); *pFormat = (audio_format_t) reply.readInt32(); return interface_cast(reply.readStrongBinder()); } virtual sp getOMX() { Parcel data, reply; data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); remote()->transact(GET_OMX, data, &reply); return interface_cast(reply.readStrongBinder()); } virtual sp makeCrypto() { Parcel data, reply; data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); remote()->transact(MAKE_CRYPTO, data, &reply); return interface_cast(reply.readStrongBinder()); } virtual sp makeHDCP() { Parcel data, reply; data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); remote()->transact(MAKE_HDCP, data, &reply); return interface_cast(reply.readStrongBinder()); } virtual void addBatteryData(uint32_t params) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); data.writeInt32(params); remote()->transact(ADD_BATTERY_DATA, data, &reply); } virtual status_t pullBatteryData(Parcel* reply) { Parcel data; data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); return remote()->transact(PULL_BATTERY_DATA, data, reply); } virtual sp listenForRemoteDisplay(const sp& client, const String8& iface) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); data.writeStrongBinder(client->asBinder()); data.writeString8(iface); remote()->transact(LISTEN_FOR_REMOTE_DISPLAY, data, &reply); return interface_cast(reply.readStrongBinder()); } }; IMPLEMENT_META_INTERFACE(MediaPlayerService, "android.media.IMediaPlayerService"); // ---------------------------------------------------------------------- status_t BnMediaPlayerService::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case CREATE: { CHECK_INTERFACE(IMediaPlayerService, data, reply); pid_t pid = data.readInt32(); sp client = interface_cast(data.readStrongBinder()); int audioSessionId = data.readInt32(); sp player = create(pid, client, audioSessionId); reply->writeStrongBinder(player->asBinder()); return NO_ERROR; } break; case DECODE_URL: { CHECK_INTERFACE(IMediaPlayerService, data, reply); const char* url = data.readCString(); uint32_t sampleRate; int numChannels; audio_format_t format; sp player = decode(url, &sampleRate, &numChannels, &format); reply->writeInt32(sampleRate); reply->writeInt32(numChannels); reply->writeInt32((int32_t) format); reply->writeStrongBinder(player->asBinder()); return NO_ERROR; } break; case DECODE_FD: { CHECK_INTERFACE(IMediaPlayerService, data, reply); int fd = dup(data.readFileDescriptor()); int64_t offset = data.readInt64(); int64_t length = data.readInt64(); uint32_t sampleRate; int numChannels; audio_format_t format; sp player = decode(fd, offset, length, &sampleRate, &numChannels, &format); reply->writeInt32(sampleRate); reply->writeInt32(numChannels); reply->writeInt32((int32_t) format); reply->writeStrongBinder(player->asBinder()); return NO_ERROR; } break; case CREATE_MEDIA_RECORDER: { CHECK_INTERFACE(IMediaPlayerService, data, reply); pid_t pid = data.readInt32(); sp recorder = createMediaRecorder(pid); reply->writeStrongBinder(recorder->asBinder()); return NO_ERROR; } break; case CREATE_METADATA_RETRIEVER: { CHECK_INTERFACE(IMediaPlayerService, data, reply); pid_t pid = data.readInt32(); sp retriever = createMetadataRetriever(pid); reply->writeStrongBinder(retriever->asBinder()); return NO_ERROR; } break; case GET_OMX: { CHECK_INTERFACE(IMediaPlayerService, data, reply); sp omx = getOMX(); reply->writeStrongBinder(omx->asBinder()); return NO_ERROR; } break; case MAKE_CRYPTO: { CHECK_INTERFACE(IMediaPlayerService, data, reply); sp crypto = makeCrypto(); reply->writeStrongBinder(crypto->asBinder()); return NO_ERROR; } break; case MAKE_HDCP: { CHECK_INTERFACE(IMediaPlayerService, data, reply); sp hdcp = makeHDCP(); reply->writeStrongBinder(hdcp->asBinder()); return NO_ERROR; } break; case ADD_BATTERY_DATA: { CHECK_INTERFACE(IMediaPlayerService, data, reply); uint32_t params = data.readInt32(); addBatteryData(params); return NO_ERROR; } break; case PULL_BATTERY_DATA: { CHECK_INTERFACE(IMediaPlayerService, data, reply); pullBatteryData(reply); return NO_ERROR; } break; case LISTEN_FOR_REMOTE_DISPLAY: { CHECK_INTERFACE(IMediaPlayerService, data, reply); sp client( interface_cast(data.readStrongBinder())); String8 iface(data.readString8()); sp display(listenForRemoteDisplay(client, iface)); reply->writeStrongBinder(display->asBinder()); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } } // ---------------------------------------------------------------------------- }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/mediaplayer.cpp0000644000015700001700000005514012200324306025213 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2006, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "MediaPlayer" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace android { MediaPlayer::MediaPlayer() { ALOGV("constructor"); mListener = NULL; mCookie = NULL; mDuration = -1; mStreamType = AUDIO_STREAM_MUSIC; mCurrentPosition = -1; mSeekPosition = -1; mCurrentState = MEDIA_PLAYER_IDLE; mPrepareSync = false; mPrepareStatus = NO_ERROR; mLoop = false; mLeftVolume = mRightVolume = 1.0; mVideoWidth = mVideoHeight = 0; mLockThreadId = 0; mAudioSessionId = AudioSystem::newAudioSessionId(); AudioSystem::acquireAudioSessionId(mAudioSessionId); mSendLevel = 0; mRetransmitEndpointValid = false; } MediaPlayer::~MediaPlayer() { ALOGV("destructor"); AudioSystem::releaseAudioSessionId(mAudioSessionId); disconnect(); IPCThreadState::self()->flushCommands(); } void MediaPlayer::disconnect() { ALOGV("disconnect"); sp p; { Mutex::Autolock _l(mLock); p = mPlayer; mPlayer.clear(); } if (p != 0) { p->disconnect(); } } // always call with lock held void MediaPlayer::clear_l() { mDuration = -1; mCurrentPosition = -1; mSeekPosition = -1; mVideoWidth = mVideoHeight = 0; mRetransmitEndpointValid = false; } status_t MediaPlayer::setListener(const sp& listener) { ALOGV("setListener"); Mutex::Autolock _l(mLock); mListener = listener; return NO_ERROR; } status_t MediaPlayer::attachNewPlayer(const sp& player) { status_t err = UNKNOWN_ERROR; sp p; { // scope for the lock Mutex::Autolock _l(mLock); if ( !( (mCurrentState & MEDIA_PLAYER_IDLE) || (mCurrentState == MEDIA_PLAYER_STATE_ERROR ) ) ) { ALOGE("attachNewPlayer called in state %d", mCurrentState); return INVALID_OPERATION; } clear_l(); p = mPlayer; mPlayer = player; if (player != 0) { mCurrentState = MEDIA_PLAYER_INITIALIZED; err = NO_ERROR; } else { ALOGE("Unable to to create media player"); } } if (p != 0) { p->disconnect(); } return err; } status_t MediaPlayer::setDataSource( const char *url, const KeyedVector *headers) { ALOGV("setDataSource(%s)", url); status_t err = BAD_VALUE; if (url != NULL) { const sp& service(getMediaPlayerService()); if (service != 0) { sp player(service->create(getpid(), this, mAudioSessionId)); if ((NO_ERROR != doSetRetransmitEndpoint(player)) || (NO_ERROR != player->setDataSource(url, headers))) { player.clear(); } err = attachNewPlayer(player); } } return err; } status_t MediaPlayer::setDataSource(int fd, int64_t offset, int64_t length) { ALOGV("setDataSource(%d, %lld, %lld)", fd, offset, length); status_t err = UNKNOWN_ERROR; const sp& service(getMediaPlayerService()); if (service != 0) { sp player(service->create(getpid(), this, mAudioSessionId)); if ((NO_ERROR != doSetRetransmitEndpoint(player)) || (NO_ERROR != player->setDataSource(fd, offset, length))) { player.clear(); } err = attachNewPlayer(player); } return err; } status_t MediaPlayer::setDataSource(const sp &source) { ALOGV("setDataSource"); status_t err = UNKNOWN_ERROR; const sp& service(getMediaPlayerService()); if (service != 0) { sp player(service->create(getpid(), this, mAudioSessionId)); if ((NO_ERROR != doSetRetransmitEndpoint(player)) || (NO_ERROR != player->setDataSource(source))) { player.clear(); } err = attachNewPlayer(player); } return err; } status_t MediaPlayer::invoke(const Parcel& request, Parcel *reply) { Mutex::Autolock _l(mLock); const bool hasBeenInitialized = (mCurrentState != MEDIA_PLAYER_STATE_ERROR) && ((mCurrentState & MEDIA_PLAYER_IDLE) != MEDIA_PLAYER_IDLE); if ((mPlayer != NULL) && hasBeenInitialized) { ALOGV("invoke %d", request.dataSize()); return mPlayer->invoke(request, reply); } ALOGE("invoke failed: wrong state %X", mCurrentState); return INVALID_OPERATION; } status_t MediaPlayer::setMetadataFilter(const Parcel& filter) { ALOGD("setMetadataFilter"); Mutex::Autolock lock(mLock); if (mPlayer == NULL) { return NO_INIT; } return mPlayer->setMetadataFilter(filter); } status_t MediaPlayer::getMetadata(bool update_only, bool apply_filter, Parcel *metadata) { ALOGD("getMetadata"); Mutex::Autolock lock(mLock); if (mPlayer == NULL) { return NO_INIT; } return mPlayer->getMetadata(update_only, apply_filter, metadata); } status_t MediaPlayer::setVideoSurfaceTexture( const sp& surfaceTexture) { ALOGV("setVideoSurfaceTexture"); Mutex::Autolock _l(mLock); if (mPlayer == 0) return NO_INIT; return mPlayer->setVideoSurfaceTexture(surfaceTexture); } // must call with lock held status_t MediaPlayer::prepareAsync_l() { if ( (mPlayer != 0) && ( mCurrentState & ( MEDIA_PLAYER_INITIALIZED | MEDIA_PLAYER_STOPPED) ) ) { mPlayer->setAudioStreamType(mStreamType); mCurrentState = MEDIA_PLAYER_PREPARING; return mPlayer->prepareAsync(); } ALOGE("prepareAsync called in state %d", mCurrentState); return INVALID_OPERATION; } // TODO: In case of error, prepareAsync provides the caller with 2 error codes, // one defined in the Android framework and one provided by the implementation // that generated the error. The sync version of prepare returns only 1 error // code. status_t MediaPlayer::prepare() { ALOGV("prepare"); Mutex::Autolock _l(mLock); mLockThreadId = getThreadId(); if (mPrepareSync) { mLockThreadId = 0; return -EALREADY; } mPrepareSync = true; status_t ret = prepareAsync_l(); if (ret != NO_ERROR) { mLockThreadId = 0; return ret; } if (mPrepareSync) { mSignal.wait(mLock); // wait for prepare done mPrepareSync = false; } ALOGV("prepare complete - status=%d", mPrepareStatus); mLockThreadId = 0; return mPrepareStatus; } status_t MediaPlayer::prepareAsync() { ALOGV("prepareAsync"); Mutex::Autolock _l(mLock); return prepareAsync_l(); } status_t MediaPlayer::start() { ALOGV("start"); Mutex::Autolock _l(mLock); if (mCurrentState & MEDIA_PLAYER_STARTED) return NO_ERROR; if ( (mPlayer != 0) && ( mCurrentState & ( MEDIA_PLAYER_PREPARED | MEDIA_PLAYER_PLAYBACK_COMPLETE | MEDIA_PLAYER_PAUSED ) ) ) { mPlayer->setLooping(mLoop); mPlayer->setVolume(mLeftVolume, mRightVolume); mPlayer->setAuxEffectSendLevel(mSendLevel); mCurrentState = MEDIA_PLAYER_STARTED; status_t ret = mPlayer->start(); if (ret != NO_ERROR) { mCurrentState = MEDIA_PLAYER_STATE_ERROR; } else { if (mCurrentState == MEDIA_PLAYER_PLAYBACK_COMPLETE) { ALOGV("playback completed immediately following start()"); } } return ret; } ALOGE("start called in state %d", mCurrentState); return INVALID_OPERATION; } status_t MediaPlayer::stop() { ALOGV("stop"); Mutex::Autolock _l(mLock); if (mCurrentState & MEDIA_PLAYER_STOPPED) return NO_ERROR; if ( (mPlayer != 0) && ( mCurrentState & ( MEDIA_PLAYER_STARTED | MEDIA_PLAYER_PREPARED | MEDIA_PLAYER_PAUSED | MEDIA_PLAYER_PLAYBACK_COMPLETE ) ) ) { status_t ret = mPlayer->stop(); if (ret != NO_ERROR) { mCurrentState = MEDIA_PLAYER_STATE_ERROR; } else { mCurrentState = MEDIA_PLAYER_STOPPED; } return ret; } ALOGE("stop called in state %d", mCurrentState); return INVALID_OPERATION; } status_t MediaPlayer::pause() { ALOGV("pause"); Mutex::Autolock _l(mLock); if (mCurrentState & (MEDIA_PLAYER_PAUSED|MEDIA_PLAYER_PLAYBACK_COMPLETE)) return NO_ERROR; if ((mPlayer != 0) && (mCurrentState & MEDIA_PLAYER_STARTED)) { status_t ret = mPlayer->pause(); if (ret != NO_ERROR) { mCurrentState = MEDIA_PLAYER_STATE_ERROR; } else { mCurrentState = MEDIA_PLAYER_PAUSED; } return ret; } ALOGE("pause called in state %d", mCurrentState); return INVALID_OPERATION; } bool MediaPlayer::isPlaying() { Mutex::Autolock _l(mLock); if (mPlayer != 0) { bool temp = false; mPlayer->isPlaying(&temp); ALOGV("isPlaying: %d", temp); if ((mCurrentState & MEDIA_PLAYER_STARTED) && ! temp) { ALOGE("internal/external state mismatch corrected"); mCurrentState = MEDIA_PLAYER_PAUSED; } return temp; } ALOGV("isPlaying: no active player"); return false; } status_t MediaPlayer::getVideoWidth(int *w) { ALOGV("getVideoWidth"); Mutex::Autolock _l(mLock); if (mPlayer == 0) return INVALID_OPERATION; *w = mVideoWidth; return NO_ERROR; } status_t MediaPlayer::getVideoHeight(int *h) { ALOGV("getVideoHeight"); Mutex::Autolock _l(mLock); if (mPlayer == 0) return INVALID_OPERATION; *h = mVideoHeight; return NO_ERROR; } status_t MediaPlayer::getCurrentPosition(int *msec) { ALOGV("getCurrentPosition"); Mutex::Autolock _l(mLock); if (mPlayer != 0) { if (mCurrentPosition >= 0) { ALOGV("Using cached seek position: %d", mCurrentPosition); *msec = mCurrentPosition; return NO_ERROR; } return mPlayer->getCurrentPosition(msec); } return INVALID_OPERATION; } status_t MediaPlayer::getDuration_l(int *msec) { ALOGV("getDuration"); bool isValidState = (mCurrentState & (MEDIA_PLAYER_PREPARED | MEDIA_PLAYER_STARTED | MEDIA_PLAYER_PAUSED | MEDIA_PLAYER_STOPPED | MEDIA_PLAYER_PLAYBACK_COMPLETE)); if (mPlayer != 0 && isValidState) { status_t ret = NO_ERROR; if (mDuration <= 0) ret = mPlayer->getDuration(&mDuration); if (msec) *msec = mDuration; return ret; } ALOGE("Attempt to call getDuration without a valid mediaplayer"); return INVALID_OPERATION; } status_t MediaPlayer::getDuration(int *msec) { Mutex::Autolock _l(mLock); return getDuration_l(msec); } status_t MediaPlayer::seekTo_l(int msec) { ALOGV("seekTo %d", msec); if ((mPlayer != 0) && ( mCurrentState & ( MEDIA_PLAYER_STARTED | MEDIA_PLAYER_PREPARED | MEDIA_PLAYER_PAUSED | MEDIA_PLAYER_PLAYBACK_COMPLETE) ) ) { if ( msec < 0 ) { ALOGW("Attempt to seek to invalid position: %d", msec); msec = 0; } else if ((mDuration > 0) && (msec > mDuration)) { ALOGW("Attempt to seek to past end of file: request = %d, EOF = %d", msec, mDuration); msec = mDuration; } // cache duration mCurrentPosition = msec; if (mSeekPosition < 0) { getDuration_l(NULL); mSeekPosition = msec; return mPlayer->seekTo(msec); } else { ALOGV("Seek in progress - queue up seekTo[%d]", msec); return NO_ERROR; } } ALOGE("Attempt to perform seekTo in wrong state: mPlayer=%p, mCurrentState=%u", mPlayer.get(), mCurrentState); return INVALID_OPERATION; } status_t MediaPlayer::seekTo(int msec) { mLockThreadId = getThreadId(); Mutex::Autolock _l(mLock); status_t result = seekTo_l(msec); mLockThreadId = 0; return result; } status_t MediaPlayer::reset_l() { mLoop = false; if (mCurrentState == MEDIA_PLAYER_IDLE) return NO_ERROR; mPrepareSync = false; if (mPlayer != 0) { status_t ret = mPlayer->reset(); if (ret != NO_ERROR) { ALOGE("reset() failed with return code (%d)", ret); mCurrentState = MEDIA_PLAYER_STATE_ERROR; } else { mCurrentState = MEDIA_PLAYER_IDLE; } // setDataSource has to be called again to create a // new mediaplayer. mPlayer = 0; return ret; } clear_l(); return NO_ERROR; } status_t MediaPlayer::doSetRetransmitEndpoint(const sp& player) { Mutex::Autolock _l(mLock); if (player == NULL) { return UNKNOWN_ERROR; } if (mRetransmitEndpointValid) { return player->setRetransmitEndpoint(&mRetransmitEndpoint); } return OK; } status_t MediaPlayer::reset() { ALOGV("reset"); Mutex::Autolock _l(mLock); return reset_l(); } status_t MediaPlayer::setAudioStreamType(audio_stream_type_t type) { ALOGV("MediaPlayer::setAudioStreamType"); Mutex::Autolock _l(mLock); if (mStreamType == type) return NO_ERROR; if (mCurrentState & ( MEDIA_PLAYER_PREPARED | MEDIA_PLAYER_STARTED | MEDIA_PLAYER_PAUSED | MEDIA_PLAYER_PLAYBACK_COMPLETE ) ) { // Can't change the stream type after prepare ALOGE("setAudioStream called in state %d", mCurrentState); return INVALID_OPERATION; } // cache mStreamType = type; return OK; } status_t MediaPlayer::setLooping(int loop) { ALOGV("MediaPlayer::setLooping"); Mutex::Autolock _l(mLock); mLoop = (loop != 0); if (mPlayer != 0) { return mPlayer->setLooping(loop); } return OK; } bool MediaPlayer::isLooping() { ALOGV("isLooping"); Mutex::Autolock _l(mLock); if (mPlayer != 0) { return mLoop; } ALOGV("isLooping: no active player"); return false; } status_t MediaPlayer::setVolume(float leftVolume, float rightVolume) { ALOGV("MediaPlayer::setVolume(%f, %f)", leftVolume, rightVolume); Mutex::Autolock _l(mLock); mLeftVolume = leftVolume; mRightVolume = rightVolume; if (mPlayer != 0) { return mPlayer->setVolume(leftVolume, rightVolume); } return OK; } status_t MediaPlayer::setAudioSessionId(int sessionId) { ALOGV("MediaPlayer::setAudioSessionId(%d)", sessionId); Mutex::Autolock _l(mLock); if (!(mCurrentState & MEDIA_PLAYER_IDLE)) { ALOGE("setAudioSessionId called in state %d", mCurrentState); return INVALID_OPERATION; } if (sessionId < 0) { return BAD_VALUE; } if (sessionId != mAudioSessionId) { AudioSystem::releaseAudioSessionId(mAudioSessionId); AudioSystem::acquireAudioSessionId(sessionId); mAudioSessionId = sessionId; } return NO_ERROR; } int MediaPlayer::getAudioSessionId() { Mutex::Autolock _l(mLock); return mAudioSessionId; } status_t MediaPlayer::setAuxEffectSendLevel(float level) { ALOGV("MediaPlayer::setAuxEffectSendLevel(%f)", level); Mutex::Autolock _l(mLock); mSendLevel = level; if (mPlayer != 0) { return mPlayer->setAuxEffectSendLevel(level); } return OK; } status_t MediaPlayer::attachAuxEffect(int effectId) { ALOGV("MediaPlayer::attachAuxEffect(%d)", effectId); Mutex::Autolock _l(mLock); if (mPlayer == 0 || (mCurrentState & MEDIA_PLAYER_IDLE) || (mCurrentState == MEDIA_PLAYER_STATE_ERROR )) { ALOGE("attachAuxEffect called in state %d", mCurrentState); return INVALID_OPERATION; } return mPlayer->attachAuxEffect(effectId); } status_t MediaPlayer::setParameter(int key, const Parcel& request) { ALOGV("MediaPlayer::setParameter(%d)", key); Mutex::Autolock _l(mLock); if (mPlayer != NULL) { return mPlayer->setParameter(key, request); } ALOGV("setParameter: no active player"); return INVALID_OPERATION; } status_t MediaPlayer::getParameter(int key, Parcel *reply) { ALOGV("MediaPlayer::getParameter(%d)", key); Mutex::Autolock _l(mLock); if (mPlayer != NULL) { return mPlayer->getParameter(key, reply); } ALOGV("getParameter: no active player"); return INVALID_OPERATION; } status_t MediaPlayer::setRetransmitEndpoint(const char* addrString, uint16_t port) { ALOGV("MediaPlayer::setRetransmitEndpoint(%s:%hu)", addrString ? addrString : "(null)", port); Mutex::Autolock _l(mLock); if ((mPlayer != NULL) || (mCurrentState != MEDIA_PLAYER_IDLE)) return INVALID_OPERATION; if (NULL == addrString) { mRetransmitEndpointValid = false; return OK; } struct in_addr saddr; if(!inet_aton(addrString, &saddr)) { return BAD_VALUE; } memset(&mRetransmitEndpoint, 0, sizeof(&mRetransmitEndpoint)); mRetransmitEndpoint.sin_family = AF_INET; mRetransmitEndpoint.sin_addr = saddr; mRetransmitEndpoint.sin_port = htons(port); mRetransmitEndpointValid = true; return OK; } void MediaPlayer::notify(int msg, int ext1, int ext2, const Parcel *obj) { ALOGV("message received msg=%d, ext1=%d, ext2=%d", msg, ext1, ext2); bool send = true; bool locked = false; // TODO: In the future, we might be on the same thread if the app is // running in the same process as the media server. In that case, // this will deadlock. // // The threadId hack below works around this for the care of prepare // and seekTo within the same process. // FIXME: Remember, this is a hack, it's not even a hack that is applied // consistently for all use-cases, this needs to be revisited. if (mLockThreadId != getThreadId()) { mLock.lock(); locked = true; } // Allows calls from JNI in idle state to notify errors if (!(msg == MEDIA_ERROR && mCurrentState == MEDIA_PLAYER_IDLE) && mPlayer == 0) { ALOGV("notify(%d, %d, %d) callback on disconnected mediaplayer", msg, ext1, ext2); if (locked) mLock.unlock(); // release the lock when done. return; } switch (msg) { case MEDIA_NOP: // interface test message break; case MEDIA_PREPARED: ALOGV("prepared"); mCurrentState = MEDIA_PLAYER_PREPARED; if (mPrepareSync) { ALOGV("signal application thread"); mPrepareSync = false; mPrepareStatus = NO_ERROR; mSignal.signal(); } break; case MEDIA_PLAYBACK_COMPLETE: ALOGV("playback complete"); if (mCurrentState == MEDIA_PLAYER_IDLE) { ALOGE("playback complete in idle state"); } if (!mLoop) { mCurrentState = MEDIA_PLAYER_PLAYBACK_COMPLETE; } break; case MEDIA_ERROR: // Always log errors. // ext1: Media framework error code. // ext2: Implementation dependant error code. ALOGE("error (%d, %d)", ext1, ext2); mCurrentState = MEDIA_PLAYER_STATE_ERROR; if (mPrepareSync) { ALOGV("signal application thread"); mPrepareSync = false; mPrepareStatus = ext1; mSignal.signal(); send = false; } break; case MEDIA_INFO: // ext1: Media framework error code. // ext2: Implementation dependant error code. if (ext1 != MEDIA_INFO_VIDEO_TRACK_LAGGING) { ALOGW("info/warning (%d, %d)", ext1, ext2); } break; case MEDIA_SEEK_COMPLETE: ALOGV("Received seek complete"); if (mSeekPosition != mCurrentPosition) { ALOGV("Executing queued seekTo(%d)", mSeekPosition); mSeekPosition = -1; seekTo_l(mCurrentPosition); } else { ALOGV("All seeks complete - return to regularly scheduled program"); mCurrentPosition = mSeekPosition = -1; } break; case MEDIA_BUFFERING_UPDATE: ALOGV("buffering %d", ext1); break; case MEDIA_SET_VIDEO_SIZE: ALOGV("New video size %d x %d", ext1, ext2); mVideoWidth = ext1; mVideoHeight = ext2; break; case MEDIA_TIMED_TEXT: ALOGV("Received timed text message"); break; default: ALOGV("unrecognized message: (%d, %d, %d)", msg, ext1, ext2); break; } sp listener = mListener; if (locked) mLock.unlock(); // this prevents re-entrant calls into client code if ((listener != 0) && send) { Mutex::Autolock _l(mNotifyLock); ALOGV("callback application"); listener->notify(msg, ext1, ext2, obj); ALOGV("back from callback"); } } /*static*/ sp MediaPlayer::decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) { ALOGV("decode(%s)", url); sp p; const sp& service = getMediaPlayerService(); if (service != 0) { p = service->decode(url, pSampleRate, pNumChannels, pFormat); } else { ALOGE("Unable to locate media service"); } return p; } void MediaPlayer::died() { ALOGV("died"); notify(MEDIA_ERROR, MEDIA_ERROR_SERVER_DIED, 0); } /*static*/ sp MediaPlayer::decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) { ALOGV("decode(%d, %lld, %lld)", fd, offset, length); sp p; const sp& service = getMediaPlayerService(); if (service != 0) { p = service->decode(fd, offset, length, pSampleRate, pNumChannels, pFormat); } else { ALOGE("Unable to locate media service"); } return p; } status_t MediaPlayer::setNextMediaPlayer(const sp& next) { if (mPlayer == NULL) { return NO_INIT; } return mPlayer->setNextPlayer(next == NULL ? NULL : next->mPlayer); } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/Visualizer.cpp0000644000015700001700000002253112200324306025052 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2010, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "Visualizer" #include #include #include #include #include #include #include namespace android { // --------------------------------------------------------------------------- Visualizer::Visualizer (int32_t priority, effect_callback_t cbf, void* user, int sessionId) : AudioEffect(SL_IID_VISUALIZATION, NULL, priority, cbf, user, sessionId), mCaptureRate(CAPTURE_RATE_DEF), mCaptureSize(CAPTURE_SIZE_DEF), mSampleRate(44100000), mScalingMode(VISUALIZER_SCALING_MODE_NORMALIZED), mCaptureCallBack(NULL), mCaptureCbkUser(NULL) { initCaptureSize(); } Visualizer::~Visualizer() { } status_t Visualizer::setEnabled(bool enabled) { Mutex::Autolock _l(mCaptureLock); sp t = mCaptureThread; if (t != 0) { if (enabled) { if (t->exitPending()) { if (t->requestExitAndWait() == WOULD_BLOCK) { ALOGE("Visualizer::enable() called from thread"); return INVALID_OPERATION; } } } t->mLock.lock(); } status_t status = AudioEffect::setEnabled(enabled); if (status == NO_ERROR) { if (t != 0) { if (enabled) { t->run("Visualizer"); } else { t->requestExit(); } } } if (t != 0) { t->mLock.unlock(); } return status; } status_t Visualizer::setCaptureCallBack(capture_cbk_t cbk, void* user, uint32_t flags, uint32_t rate) { if (rate > CAPTURE_RATE_MAX) { return BAD_VALUE; } Mutex::Autolock _l(mCaptureLock); if (mEnabled) { return INVALID_OPERATION; } sp t = mCaptureThread; if (t != 0) { t->mLock.lock(); } mCaptureThread.clear(); mCaptureCallBack = cbk; mCaptureCbkUser = user; mCaptureFlags = flags; mCaptureRate = rate; if (t != 0) { t->mLock.unlock(); } if (cbk != NULL) { mCaptureThread = new CaptureThread(*this, rate, ((flags & CAPTURE_CALL_JAVA) != 0)); } ALOGV("setCaptureCallBack() rate: %d thread %p flags 0x%08x", rate, mCaptureThread.get(), mCaptureFlags); return NO_ERROR; } status_t Visualizer::setCaptureSize(uint32_t size) { if (size > VISUALIZER_CAPTURE_SIZE_MAX || size < VISUALIZER_CAPTURE_SIZE_MIN || popcount(size) != 1) { return BAD_VALUE; } Mutex::Autolock _l(mCaptureLock); if (mEnabled) { return INVALID_OPERATION; } uint32_t buf32[sizeof(effect_param_t) / sizeof(uint32_t) + 2]; effect_param_t *p = (effect_param_t *)buf32; p->psize = sizeof(uint32_t); p->vsize = sizeof(uint32_t); *(int32_t *)p->data = VISUALIZER_PARAM_CAPTURE_SIZE; *((int32_t *)p->data + 1)= size; status_t status = setParameter(p); ALOGV("setCaptureSize size %d status %d p->status %d", size, status, p->status); if (status == NO_ERROR) { status = p->status; if (status == NO_ERROR) { mCaptureSize = size; } } return status; } status_t Visualizer::setScalingMode(uint32_t mode) { if ((mode != VISUALIZER_SCALING_MODE_NORMALIZED) && (mode != VISUALIZER_SCALING_MODE_AS_PLAYED)) { return BAD_VALUE; } Mutex::Autolock _l(mCaptureLock); uint32_t buf32[sizeof(effect_param_t) / sizeof(uint32_t) + 2]; effect_param_t *p = (effect_param_t *)buf32; p->psize = sizeof(uint32_t); p->vsize = sizeof(uint32_t); *(int32_t *)p->data = VISUALIZER_PARAM_SCALING_MODE; *((int32_t *)p->data + 1)= mode; status_t status = setParameter(p); ALOGV("setScalingMode mode %d status %d p->status %d", mode, status, p->status); if (status == NO_ERROR) { status = p->status; if (status == NO_ERROR) { mScalingMode = mode; } } return status; } status_t Visualizer::getWaveForm(uint8_t *waveform) { if (waveform == NULL) { return BAD_VALUE; } if (mCaptureSize == 0) { return NO_INIT; } status_t status = NO_ERROR; if (mEnabled) { uint32_t replySize = mCaptureSize; status = command(VISUALIZER_CMD_CAPTURE, 0, NULL, &replySize, waveform); ALOGV("getWaveForm() command returned %d", status); if ((status == NO_ERROR) && (replySize == 0)) { status = NOT_ENOUGH_DATA; } } else { ALOGV("getWaveForm() disabled"); memset(waveform, 0x80, mCaptureSize); } return status; } status_t Visualizer::getFft(uint8_t *fft) { if (fft == NULL) { return BAD_VALUE; } if (mCaptureSize == 0) { return NO_INIT; } status_t status = NO_ERROR; if (mEnabled) { uint8_t buf[mCaptureSize]; status = getWaveForm(buf); if (status == NO_ERROR) { status = doFft(fft, buf); } } else { memset(fft, 0, mCaptureSize); } return status; } status_t Visualizer::doFft(uint8_t *fft, uint8_t *waveform) { int32_t workspace[mCaptureSize >> 1]; int32_t nonzero = 0; for (uint32_t i = 0; i < mCaptureSize; i += 2) { workspace[i >> 1] = ((waveform[i] ^ 0x80) << 24) | ((waveform[i + 1] ^ 0x80) << 8); nonzero |= workspace[i >> 1]; } if (nonzero) { fixed_fft_real(mCaptureSize >> 1, workspace); } for (uint32_t i = 0; i < mCaptureSize; i += 2) { short tmp = workspace[i >> 1] >> 21; while (tmp > 127 || tmp < -128) tmp >>= 1; fft[i] = tmp; tmp = workspace[i >> 1]; tmp >>= 5; while (tmp > 127 || tmp < -128) tmp >>= 1; fft[i + 1] = tmp; } return NO_ERROR; } void Visualizer::periodicCapture() { Mutex::Autolock _l(mCaptureLock); ALOGV("periodicCapture() %p mCaptureCallBack %p mCaptureFlags 0x%08x", this, mCaptureCallBack, mCaptureFlags); if (mCaptureCallBack != NULL && (mCaptureFlags & (CAPTURE_WAVEFORM|CAPTURE_FFT)) && mCaptureSize != 0) { uint8_t waveform[mCaptureSize]; status_t status = getWaveForm(waveform); if (status != NO_ERROR) { return; } uint8_t fft[mCaptureSize]; if (mCaptureFlags & CAPTURE_FFT) { status = doFft(fft, waveform); } if (status != NO_ERROR) { return; } uint8_t *wavePtr = NULL; uint8_t *fftPtr = NULL; uint32_t waveSize = 0; uint32_t fftSize = 0; if (mCaptureFlags & CAPTURE_WAVEFORM) { wavePtr = waveform; waveSize = mCaptureSize; } if (mCaptureFlags & CAPTURE_FFT) { fftPtr = fft; fftSize = mCaptureSize; } mCaptureCallBack(mCaptureCbkUser, waveSize, wavePtr, fftSize, fftPtr, mSampleRate); } } uint32_t Visualizer::initCaptureSize() { uint32_t buf32[sizeof(effect_param_t) / sizeof(uint32_t) + 2]; effect_param_t *p = (effect_param_t *)buf32; p->psize = sizeof(uint32_t); p->vsize = sizeof(uint32_t); *(int32_t *)p->data = VISUALIZER_PARAM_CAPTURE_SIZE; status_t status = getParameter(p); if (status == NO_ERROR) { status = p->status; } uint32_t size = 0; if (status == NO_ERROR) { size = *((int32_t *)p->data + 1); } mCaptureSize = size; ALOGV("initCaptureSize size %d status %d", mCaptureSize, status); return size; } void Visualizer::controlStatusChanged(bool controlGranted) { if (controlGranted) { // this Visualizer instance regained control of the effect, reset the scaling mode // and capture size as has been cached through it. ALOGV("controlStatusChanged(true) causes effect parameter reset:"); ALOGV(" scaling mode reset to %d", mScalingMode); setScalingMode(mScalingMode); ALOGV(" capture size reset to %d", mCaptureSize); setCaptureSize(mCaptureSize); } AudioEffect::controlStatusChanged(controlGranted); } //------------------------------------------------------------------------- Visualizer::CaptureThread::CaptureThread(Visualizer& receiver, uint32_t captureRate, bool bCanCallJava) : Thread(bCanCallJava), mReceiver(receiver) { mSleepTimeUs = 1000000000 / captureRate; ALOGV("CaptureThread cstor %p captureRate %d mSleepTimeUs %d", this, captureRate, mSleepTimeUs); } bool Visualizer::CaptureThread::threadLoop() { ALOGV("CaptureThread %p enter", this); while (!exitPending()) { usleep(mSleepTimeUs); mReceiver.periodicCapture(); } ALOGV("CaptureThread %p exiting", this); return false; } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/SoundPool.cpp0000644000015700001700000005736112200324306024650 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "SoundPool" #include //#define USE_SHARED_MEM_BUFFER // XXX needed for timing latency #include #include #include #include #include #include "SoundPoolThread.h" namespace android { int kDefaultBufferCount = 4; uint32_t kMaxSampleRate = 48000; uint32_t kDefaultSampleRate = 44100; uint32_t kDefaultFrameCount = 1200; SoundPool::SoundPool(int maxChannels, audio_stream_type_t streamType, int srcQuality) { ALOGV("SoundPool constructor: maxChannels=%d, streamType=%d, srcQuality=%d", maxChannels, streamType, srcQuality); // check limits mMaxChannels = maxChannels; if (mMaxChannels < 1) { mMaxChannels = 1; } else if (mMaxChannels > 32) { mMaxChannels = 32; } ALOGW_IF(maxChannels != mMaxChannels, "App requested %d channels", maxChannels); mQuit = false; mDecodeThread = 0; mStreamType = streamType; mSrcQuality = srcQuality; mAllocated = 0; mNextSampleID = 0; mNextChannelID = 0; mCallback = 0; mUserData = 0; mChannelPool = new SoundChannel[mMaxChannels]; for (int i = 0; i < mMaxChannels; ++i) { mChannelPool[i].init(this); mChannels.push_back(&mChannelPool[i]); } // start decode thread startThreads(); } SoundPool::~SoundPool() { ALOGV("SoundPool destructor"); mDecodeThread->quit(); quit(); Mutex::Autolock lock(&mLock); mChannels.clear(); if (mChannelPool) delete [] mChannelPool; // clean up samples ALOGV("clear samples"); mSamples.clear(); if (mDecodeThread) delete mDecodeThread; } void SoundPool::addToRestartList(SoundChannel* channel) { Mutex::Autolock lock(&mRestartLock); if (!mQuit) { mRestart.push_back(channel); mCondition.signal(); } } void SoundPool::addToStopList(SoundChannel* channel) { Mutex::Autolock lock(&mRestartLock); if (!mQuit) { mStop.push_back(channel); mCondition.signal(); } } int SoundPool::beginThread(void* arg) { SoundPool* p = (SoundPool*)arg; return p->run(); } int SoundPool::run() { mRestartLock.lock(); while (!mQuit) { mCondition.wait(mRestartLock); ALOGV("awake"); if (mQuit) break; while (!mStop.empty()) { SoundChannel* channel; ALOGV("Getting channel from stop list"); List::iterator iter = mStop.begin(); channel = *iter; mStop.erase(iter); mRestartLock.unlock(); if (channel != 0) { Mutex::Autolock lock(&mLock); channel->stop(); } mRestartLock.lock(); if (mQuit) break; } while (!mRestart.empty()) { SoundChannel* channel; ALOGV("Getting channel from list"); List::iterator iter = mRestart.begin(); channel = *iter; mRestart.erase(iter); mRestartLock.unlock(); if (channel != 0) { Mutex::Autolock lock(&mLock); channel->nextEvent(); } mRestartLock.lock(); if (mQuit) break; } } mStop.clear(); mRestart.clear(); mCondition.signal(); mRestartLock.unlock(); ALOGV("goodbye"); return 0; } void SoundPool::quit() { mRestartLock.lock(); mQuit = true; mCondition.signal(); mCondition.wait(mRestartLock); ALOGV("return from quit"); mRestartLock.unlock(); } bool SoundPool::startThreads() { createThreadEtc(beginThread, this, "SoundPool"); if (mDecodeThread == NULL) mDecodeThread = new SoundPoolThread(this); return mDecodeThread != NULL; } SoundChannel* SoundPool::findChannel(int channelID) { for (int i = 0; i < mMaxChannels; ++i) { if (mChannelPool[i].channelID() == channelID) { return &mChannelPool[i]; } } return NULL; } SoundChannel* SoundPool::findNextChannel(int channelID) { for (int i = 0; i < mMaxChannels; ++i) { if (mChannelPool[i].nextChannelID() == channelID) { return &mChannelPool[i]; } } return NULL; } int SoundPool::load(const char* path, int priority) { ALOGV("load: path=%s, priority=%d", path, priority); Mutex::Autolock lock(&mLock); sp sample = new Sample(++mNextSampleID, path); mSamples.add(sample->sampleID(), sample); doLoad(sample); return sample->sampleID(); } int SoundPool::load(int fd, int64_t offset, int64_t length, int priority) { ALOGV("load: fd=%d, offset=%lld, length=%lld, priority=%d", fd, offset, length, priority); Mutex::Autolock lock(&mLock); sp sample = new Sample(++mNextSampleID, fd, offset, length); mSamples.add(sample->sampleID(), sample); doLoad(sample); return sample->sampleID(); } void SoundPool::doLoad(sp& sample) { ALOGV("doLoad: loading sample sampleID=%d", sample->sampleID()); sample->startLoad(); mDecodeThread->loadSample(sample->sampleID()); } bool SoundPool::unload(int sampleID) { ALOGV("unload: sampleID=%d", sampleID); Mutex::Autolock lock(&mLock); return mSamples.removeItem(sampleID); } int SoundPool::play(int sampleID, float leftVolume, float rightVolume, int priority, int loop, float rate) { ALOGV("play sampleID=%d, leftVolume=%f, rightVolume=%f, priority=%d, loop=%d, rate=%f", sampleID, leftVolume, rightVolume, priority, loop, rate); sp sample; SoundChannel* channel; int channelID; Mutex::Autolock lock(&mLock); if (mQuit) { return 0; } // is sample ready? sample = findSample(sampleID); if ((sample == 0) || (sample->state() != Sample::READY)) { ALOGW(" sample %d not READY", sampleID); return 0; } dump(); // allocate a channel channel = allocateChannel_l(priority); // no channel allocated - return 0 if (!channel) { ALOGV("No channel allocated"); return 0; } channelID = ++mNextChannelID; ALOGV("play channel %p state = %d", channel, channel->state()); channel->play(sample, channelID, leftVolume, rightVolume, priority, loop, rate); return channelID; } SoundChannel* SoundPool::allocateChannel_l(int priority) { List::iterator iter; SoundChannel* channel = NULL; // allocate a channel if (!mChannels.empty()) { iter = mChannels.begin(); if (priority >= (*iter)->priority()) { channel = *iter; mChannels.erase(iter); ALOGV("Allocated active channel"); } } // update priority and put it back in the list if (channel) { channel->setPriority(priority); for (iter = mChannels.begin(); iter != mChannels.end(); ++iter) { if (priority < (*iter)->priority()) { break; } } mChannels.insert(iter, channel); } return channel; } // move a channel from its current position to the front of the list void SoundPool::moveToFront_l(SoundChannel* channel) { for (List::iterator iter = mChannels.begin(); iter != mChannels.end(); ++iter) { if (*iter == channel) { mChannels.erase(iter); mChannels.push_front(channel); break; } } } void SoundPool::pause(int channelID) { ALOGV("pause(%d)", channelID); Mutex::Autolock lock(&mLock); SoundChannel* channel = findChannel(channelID); if (channel) { channel->pause(); } } void SoundPool::autoPause() { ALOGV("autoPause()"); Mutex::Autolock lock(&mLock); for (int i = 0; i < mMaxChannels; ++i) { SoundChannel* channel = &mChannelPool[i]; channel->autoPause(); } } void SoundPool::resume(int channelID) { ALOGV("resume(%d)", channelID); Mutex::Autolock lock(&mLock); SoundChannel* channel = findChannel(channelID); if (channel) { channel->resume(); } } void SoundPool::autoResume() { ALOGV("autoResume()"); Mutex::Autolock lock(&mLock); for (int i = 0; i < mMaxChannels; ++i) { SoundChannel* channel = &mChannelPool[i]; channel->autoResume(); } } void SoundPool::stop(int channelID) { ALOGV("stop(%d)", channelID); Mutex::Autolock lock(&mLock); SoundChannel* channel = findChannel(channelID); if (channel) { channel->stop(); } else { channel = findNextChannel(channelID); if (channel) channel->clearNextEvent(); } } void SoundPool::setVolume(int channelID, float leftVolume, float rightVolume) { Mutex::Autolock lock(&mLock); SoundChannel* channel = findChannel(channelID); if (channel) { channel->setVolume(leftVolume, rightVolume); } } void SoundPool::setPriority(int channelID, int priority) { ALOGV("setPriority(%d, %d)", channelID, priority); Mutex::Autolock lock(&mLock); SoundChannel* channel = findChannel(channelID); if (channel) { channel->setPriority(priority); } } void SoundPool::setLoop(int channelID, int loop) { ALOGV("setLoop(%d, %d)", channelID, loop); Mutex::Autolock lock(&mLock); SoundChannel* channel = findChannel(channelID); if (channel) { channel->setLoop(loop); } } void SoundPool::setRate(int channelID, float rate) { ALOGV("setRate(%d, %f)", channelID, rate); Mutex::Autolock lock(&mLock); SoundChannel* channel = findChannel(channelID); if (channel) { channel->setRate(rate); } } // call with lock held void SoundPool::done_l(SoundChannel* channel) { ALOGV("done_l(%d)", channel->channelID()); // if "stolen", play next event if (channel->nextChannelID() != 0) { ALOGV("add to restart list"); addToRestartList(channel); } // return to idle state else { ALOGV("move to front"); moveToFront_l(channel); } } void SoundPool::setCallback(SoundPoolCallback* callback, void* user) { Mutex::Autolock lock(&mCallbackLock); mCallback = callback; mUserData = user; } void SoundPool::notify(SoundPoolEvent event) { Mutex::Autolock lock(&mCallbackLock); if (mCallback != NULL) { mCallback(event, this, mUserData); } } void SoundPool::dump() { for (int i = 0; i < mMaxChannels; ++i) { mChannelPool[i].dump(); } } Sample::Sample(int sampleID, const char* url) { init(); mSampleID = sampleID; mUrl = strdup(url); ALOGV("create sampleID=%d, url=%s", mSampleID, mUrl); } Sample::Sample(int sampleID, int fd, int64_t offset, int64_t length) { init(); mSampleID = sampleID; mFd = dup(fd); mOffset = offset; mLength = length; ALOGV("create sampleID=%d, fd=%d, offset=%lld, length=%lld", mSampleID, mFd, mLength, mOffset); } void Sample::init() { mData = 0; mSize = 0; mRefCount = 0; mSampleID = 0; mState = UNLOADED; mFd = -1; mOffset = 0; mLength = 0; mUrl = 0; } Sample::~Sample() { ALOGV("Sample::destructor sampleID=%d, fd=%d", mSampleID, mFd); if (mFd > 0) { ALOGV("close(%d)", mFd); ::close(mFd); } mData.clear(); delete mUrl; } status_t Sample::doLoad() { uint32_t sampleRate; int numChannels; audio_format_t format; sp p; ALOGV("Start decode"); if (mUrl) { p = MediaPlayer::decode(mUrl, &sampleRate, &numChannels, &format); } else { p = MediaPlayer::decode(mFd, mOffset, mLength, &sampleRate, &numChannels, &format); ALOGV("close(%d)", mFd); ::close(mFd); mFd = -1; } if (p == 0) { ALOGE("Unable to load sample: %s", mUrl); return -1; } ALOGV("pointer = %p, size = %u, sampleRate = %u, numChannels = %d", p->pointer(), p->size(), sampleRate, numChannels); if (sampleRate > kMaxSampleRate) { ALOGE("Sample rate (%u) out of range", sampleRate); return - 1; } if ((numChannels < 1) || (numChannels > 2)) { ALOGE("Sample channel count (%d) out of range", numChannels); return - 1; } //_dumpBuffer(p->pointer(), p->size()); uint8_t* q = static_cast(p->pointer()) + p->size() - 10; //_dumpBuffer(q, 10, 10, false); mData = p; mSize = p->size(); mSampleRate = sampleRate; mNumChannels = numChannels; mFormat = format; mState = READY; return 0; } void SoundChannel::init(SoundPool* soundPool) { mSoundPool = soundPool; } // call with sound pool lock held void SoundChannel::play(const sp& sample, int nextChannelID, float leftVolume, float rightVolume, int priority, int loop, float rate) { AudioTrack* oldTrack; AudioTrack* newTrack; status_t status; { // scope for the lock Mutex::Autolock lock(&mLock); ALOGV("SoundChannel::play %p: sampleID=%d, channelID=%d, leftVolume=%f, rightVolume=%f," " priority=%d, loop=%d, rate=%f", this, sample->sampleID(), nextChannelID, leftVolume, rightVolume, priority, loop, rate); // if not idle, this voice is being stolen if (mState != IDLE) { ALOGV("channel %d stolen - event queued for channel %d", channelID(), nextChannelID); mNextEvent.set(sample, nextChannelID, leftVolume, rightVolume, priority, loop, rate); stop_l(); return; } // initialize track int afFrameCount; int afSampleRate; audio_stream_type_t streamType = mSoundPool->streamType(); if (AudioSystem::getOutputFrameCount(&afFrameCount, streamType) != NO_ERROR) { afFrameCount = kDefaultFrameCount; } if (AudioSystem::getOutputSamplingRate(&afSampleRate, streamType) != NO_ERROR) { afSampleRate = kDefaultSampleRate; } int numChannels = sample->numChannels(); uint32_t sampleRate = uint32_t(float(sample->sampleRate()) * rate + 0.5); uint32_t totalFrames = (kDefaultBufferCount * afFrameCount * sampleRate) / afSampleRate; uint32_t bufferFrames = (totalFrames + (kDefaultBufferCount - 1)) / kDefaultBufferCount; uint32_t frameCount = 0; if (loop) { frameCount = sample->size()/numChannels/ ((sample->format() == AUDIO_FORMAT_PCM_16_BIT) ? sizeof(int16_t) : sizeof(uint8_t)); } #ifndef USE_SHARED_MEM_BUFFER // Ensure minimum audio buffer size in case of short looped sample if(frameCount < totalFrames) { frameCount = totalFrames; } #endif // mToggle toggles each time a track is started on a given channel. // The toggle is concatenated with the SoundChannel address and passed to AudioTrack // as callback user data. This enables the detection of callbacks received from the old // audio track while the new one is being started and avoids processing them with // wrong audio audio buffer size (mAudioBufferSize) unsigned long toggle = mToggle ^ 1; void *userData = (void *)((unsigned long)this | toggle); uint32_t channels = (numChannels == 2) ? AUDIO_CHANNEL_OUT_STEREO : AUDIO_CHANNEL_OUT_MONO; // do not create a new audio track if current track is compatible with sample parameters #ifdef USE_SHARED_MEM_BUFFER newTrack = new AudioTrack(streamType, sampleRate, sample->format(), channels, sample->getIMemory(), AUDIO_OUTPUT_FLAG_NONE, callback, userData); #else newTrack = new AudioTrack(streamType, sampleRate, sample->format(), channels, frameCount, AUDIO_OUTPUT_FLAG_FAST, callback, userData, bufferFrames); #endif oldTrack = mAudioTrack; status = newTrack->initCheck(); if (status != NO_ERROR) { ALOGE("Error creating AudioTrack"); goto exit; } ALOGV("setVolume %p", newTrack); newTrack->setVolume(leftVolume, rightVolume); newTrack->setLoop(0, frameCount, loop); // From now on, AudioTrack callbacks received with previous toggle value will be ignored. mToggle = toggle; mAudioTrack = newTrack; mPos = 0; mSample = sample; mChannelID = nextChannelID; mPriority = priority; mLoop = loop; mLeftVolume = leftVolume; mRightVolume = rightVolume; mNumChannels = numChannels; mRate = rate; clearNextEvent(); mState = PLAYING; mAudioTrack->start(); mAudioBufferSize = newTrack->frameCount()*newTrack->frameSize(); } exit: ALOGV("delete oldTrack %p", oldTrack); delete oldTrack; if (status != NO_ERROR) { delete newTrack; mAudioTrack = NULL; } } void SoundChannel::nextEvent() { sp sample; int nextChannelID; float leftVolume; float rightVolume; int priority; int loop; float rate; // check for valid event { Mutex::Autolock lock(&mLock); nextChannelID = mNextEvent.channelID(); if (nextChannelID == 0) { ALOGV("stolen channel has no event"); return; } sample = mNextEvent.sample(); leftVolume = mNextEvent.leftVolume(); rightVolume = mNextEvent.rightVolume(); priority = mNextEvent.priority(); loop = mNextEvent.loop(); rate = mNextEvent.rate(); } ALOGV("Starting stolen channel %d -> %d", channelID(), nextChannelID); play(sample, nextChannelID, leftVolume, rightVolume, priority, loop, rate); } void SoundChannel::callback(int event, void* user, void *info) { SoundChannel* channel = static_cast((void *)((unsigned long)user & ~1)); channel->process(event, info, (unsigned long)user & 1); } void SoundChannel::process(int event, void *info, unsigned long toggle) { //ALOGV("process(%d)", mChannelID); Mutex::Autolock lock(&mLock); AudioTrack::Buffer* b = NULL; if (event == AudioTrack::EVENT_MORE_DATA) { b = static_cast(info); } if (mToggle != toggle) { ALOGV("process wrong toggle %p channel %d", this, mChannelID); if (b != NULL) { b->size = 0; } return; } sp sample = mSample; // ALOGV("SoundChannel::process event %d", event); if (event == AudioTrack::EVENT_MORE_DATA) { // check for stop state if (b->size == 0) return; if (mState == IDLE) { b->size = 0; return; } if (sample != 0) { // fill buffer uint8_t* q = (uint8_t*) b->i8; size_t count = 0; if (mPos < (int)sample->size()) { uint8_t* p = sample->data() + mPos; count = sample->size() - mPos; if (count > b->size) { count = b->size; } memcpy(q, p, count); // ALOGV("fill: q=%p, p=%p, mPos=%u, b->size=%u, count=%d", q, p, mPos, b->size, count); } else if (mPos < mAudioBufferSize) { count = mAudioBufferSize - mPos; if (count > b->size) { count = b->size; } memset(q, 0, count); // ALOGV("fill extra: q=%p, mPos=%u, b->size=%u, count=%d", q, mPos, b->size, count); } mPos += count; b->size = count; //ALOGV("buffer=%p, [0]=%d", b->i16, b->i16[0]); } } else if (event == AudioTrack::EVENT_UNDERRUN) { ALOGV("process %p channel %d EVENT_UNDERRUN", this, mChannelID); mSoundPool->addToStopList(this); } else if (event == AudioTrack::EVENT_LOOP_END) { ALOGV("End loop %p channel %d count %d", this, mChannelID, *(int *)info); } } // call with lock held bool SoundChannel::doStop_l() { if (mState != IDLE) { setVolume_l(0, 0); ALOGV("stop"); mAudioTrack->stop(); mSample.clear(); mState = IDLE; mPriority = IDLE_PRIORITY; return true; } return false; } // call with lock held and sound pool lock held void SoundChannel::stop_l() { if (doStop_l()) { mSoundPool->done_l(this); } } // call with sound pool lock held void SoundChannel::stop() { bool stopped; { Mutex::Autolock lock(&mLock); stopped = doStop_l(); } if (stopped) { mSoundPool->done_l(this); } } //FIXME: Pause is a little broken right now void SoundChannel::pause() { Mutex::Autolock lock(&mLock); if (mState == PLAYING) { ALOGV("pause track"); mState = PAUSED; mAudioTrack->pause(); } } void SoundChannel::autoPause() { Mutex::Autolock lock(&mLock); if (mState == PLAYING) { ALOGV("pause track"); mState = PAUSED; mAutoPaused = true; mAudioTrack->pause(); } } void SoundChannel::resume() { Mutex::Autolock lock(&mLock); if (mState == PAUSED) { ALOGV("resume track"); mState = PLAYING; mAutoPaused = false; mAudioTrack->start(); } } void SoundChannel::autoResume() { Mutex::Autolock lock(&mLock); if (mAutoPaused && (mState == PAUSED)) { ALOGV("resume track"); mState = PLAYING; mAutoPaused = false; mAudioTrack->start(); } } void SoundChannel::setRate(float rate) { Mutex::Autolock lock(&mLock); if (mAudioTrack != NULL && mSample != 0) { uint32_t sampleRate = uint32_t(float(mSample->sampleRate()) * rate + 0.5); mAudioTrack->setSampleRate(sampleRate); mRate = rate; } } // call with lock held void SoundChannel::setVolume_l(float leftVolume, float rightVolume) { mLeftVolume = leftVolume; mRightVolume = rightVolume; if (mAudioTrack != NULL) mAudioTrack->setVolume(leftVolume, rightVolume); } void SoundChannel::setVolume(float leftVolume, float rightVolume) { Mutex::Autolock lock(&mLock); setVolume_l(leftVolume, rightVolume); } void SoundChannel::setLoop(int loop) { Mutex::Autolock lock(&mLock); if (mAudioTrack != NULL && mSample != 0) { uint32_t loopEnd = mSample->size()/mNumChannels/ ((mSample->format() == AUDIO_FORMAT_PCM_16_BIT) ? sizeof(int16_t) : sizeof(uint8_t)); mAudioTrack->setLoop(0, loopEnd, loop); mLoop = loop; } } SoundChannel::~SoundChannel() { ALOGV("SoundChannel destructor %p", this); { Mutex::Autolock lock(&mLock); clearNextEvent(); doStop_l(); } // do not call AudioTrack destructor with mLock held as it will wait for the AudioTrack // callback thread to exit which may need to execute process() and acquire the mLock. delete mAudioTrack; } void SoundChannel::dump() { ALOGV("mState = %d mChannelID=%d, mNumChannels=%d, mPos = %d, mPriority=%d, mLoop=%d", mState, mChannelID, mNumChannels, mPos, mPriority, mLoop); } void SoundEvent::set(const sp& sample, int channelID, float leftVolume, float rightVolume, int priority, int loop, float rate) { mSample = sample; mChannelID = channelID; mLeftVolume = leftVolume; mRightVolume = rightVolume; mPriority = priority; mLoop = loop; mRate =rate; } } // end namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/Metadata.cpp0000644000015700001700000001037012200324306024433 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "Metadata" #include #include #include #include #include #include // This file contains code to serialize Metadata triples (key, type, // value) into a parcel. The Parcel is destinated to be decoded by the // Metadata.java class. namespace { // All these constants below must be kept in sync with Metadata.java. enum MetadataId { FIRST_SYSTEM_ID = 1, LAST_SYSTEM_ID = 31, FIRST_CUSTOM_ID = 8192 }; // Types enum Types { STRING_VAL = 1, INTEGER_VAL, BOOLEAN_VAL, LONG_VAL, DOUBLE_VAL, DATE_VAL, BYTE_ARRAY_VAL, }; const size_t kRecordHeaderSize = 3 * sizeof(int32_t); const int32_t kMetaMarker = 0x4d455441; // 'M' 'E' 'T' 'A' } // anonymous namespace namespace android { namespace media { Metadata::Metadata(Parcel *p) :mData(p), mBegin(p->dataPosition()) { } Metadata::~Metadata() { } void Metadata::resetParcel() { mData->setDataPosition(mBegin); } // Update the 4 bytes int at the beginning of the parcel which holds // the number of bytes written so far. void Metadata::updateLength() { const size_t end = mData->dataPosition(); mData->setDataPosition(mBegin); mData->writeInt32(end - mBegin); mData->setDataPosition(end); } // Write the header. The java layer will look for the marker. bool Metadata::appendHeader() { bool ok = true; // Placeholder for the length of the metadata ok = ok && mData->writeInt32(-1) == OK; ok = ok && mData->writeInt32(kMetaMarker) == OK; return ok; } bool Metadata::appendBool(int key, bool val) { if (!checkKey(key)) { return false; } const size_t begin = mData->dataPosition(); bool ok = true; // 4 int32s: size, key, type, value. ok = ok && mData->writeInt32(4 * sizeof(int32_t)) == OK; ok = ok && mData->writeInt32(key) == OK; ok = ok && mData->writeInt32(BOOLEAN_VAL) == OK; ok = ok && mData->writeInt32(val ? 1 : 0) == OK; if (!ok) { mData->setDataPosition(begin); } return ok; } bool Metadata::appendInt32(int key, int32_t val) { if (!checkKey(key)) { return false; } const size_t begin = mData->dataPosition(); bool ok = true; // 4 int32s: size, key, type, value. ok = ok && mData->writeInt32(4 * sizeof(int32_t)) == OK; ok = ok && mData->writeInt32(key) == OK; ok = ok && mData->writeInt32(INTEGER_VAL) == OK; ok = ok && mData->writeInt32(val) == OK; if (!ok) { mData->setDataPosition(begin); } return ok; } // Check the key (i.e metadata id) is valid if it is a system one. // Loop over all the exiting ones in the Parcel to check for duplicate // (not allowed). bool Metadata::checkKey(int key) { if (key < FIRST_SYSTEM_ID || (LAST_SYSTEM_ID < key && key < FIRST_CUSTOM_ID)) { ALOGE("Bad key %d", key); return false; } size_t curr = mData->dataPosition(); // Loop over the keys to check if it has been used already. mData->setDataPosition(mBegin); bool error = false; size_t left = curr - mBegin; while (left > 0) { size_t pos = mData->dataPosition(); size_t size = mData->readInt32(); if (size < kRecordHeaderSize || size > left) { error = true; break; } if (mData->readInt32() == key) { ALOGE("Key exists already %d", key); error = true; break; } mData->setDataPosition(pos + size); left -= size; } mData->setDataPosition(curr); return !error; } } // namespace android::media } // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/JetPlayer.cpp0000644000015700001700000003470212200324306024617 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "JetPlayer-C" #include #include #include namespace android { static const int MIX_NUM_BUFFERS = 4; static const S_EAS_LIB_CONFIG* pLibConfig = NULL; //------------------------------------------------------------------------------------------------- JetPlayer::JetPlayer(void *javaJetPlayer, int maxTracks, int trackBufferSize) : mEventCallback(NULL), mJavaJetPlayerRef(javaJetPlayer), mTid(-1), mRender(false), mPaused(false), mMaxTracks(maxTracks), mEasData(NULL), mEasJetFileLoc(NULL), mAudioTrack(NULL), mTrackBufferSize(trackBufferSize) { ALOGV("JetPlayer constructor"); mPreviousJetStatus.currentUserID = -1; mPreviousJetStatus.segmentRepeatCount = -1; mPreviousJetStatus.numQueuedSegments = -1; mPreviousJetStatus.paused = true; } //------------------------------------------------------------------------------------------------- JetPlayer::~JetPlayer() { ALOGV("~JetPlayer"); release(); } //------------------------------------------------------------------------------------------------- int JetPlayer::init() { //Mutex::Autolock lock(&mMutex); EAS_RESULT result; // retrieve the EAS library settings if (pLibConfig == NULL) pLibConfig = EAS_Config(); if (pLibConfig == NULL) { ALOGE("JetPlayer::init(): EAS library configuration could not be retrieved, aborting."); return EAS_FAILURE; } // init the EAS library result = EAS_Init(&mEasData); if (result != EAS_SUCCESS) { ALOGE("JetPlayer::init(): Error initializing Sonivox EAS library, aborting."); mState = EAS_STATE_ERROR; return result; } // init the JET library with the default app event controller range result = JET_Init(mEasData, NULL, sizeof(S_JET_CONFIG)); if (result != EAS_SUCCESS) { ALOGE("JetPlayer::init(): Error initializing JET library, aborting."); mState = EAS_STATE_ERROR; return result; } // create the output AudioTrack mAudioTrack = new AudioTrack(); mAudioTrack->set(AUDIO_STREAM_MUSIC, //TODO parameterize this pLibConfig->sampleRate, AUDIO_FORMAT_PCM_16_BIT, audio_channel_out_mask_from_count(pLibConfig->numChannels), mTrackBufferSize, AUDIO_OUTPUT_FLAG_NONE); // create render and playback thread { Mutex::Autolock l(mMutex); ALOGV("JetPlayer::init(): trying to start render thread"); mThread = new JetPlayerThread(this); mThread->run("jetRenderThread", ANDROID_PRIORITY_AUDIO); mCondition.wait(mMutex); } if (mTid > 0) { // render thread started, we're ready ALOGV("JetPlayer::init(): render thread(%d) successfully started.", mTid); mState = EAS_STATE_READY; } else { ALOGE("JetPlayer::init(): failed to start render thread."); mState = EAS_STATE_ERROR; return EAS_FAILURE; } return EAS_SUCCESS; } void JetPlayer::setEventCallback(jetevent_callback eventCallback) { Mutex::Autolock l(mMutex); mEventCallback = eventCallback; } //------------------------------------------------------------------------------------------------- int JetPlayer::release() { ALOGV("JetPlayer::release()"); Mutex::Autolock lock(mMutex); mPaused = true; mRender = false; if (mEasData) { JET_Pause(mEasData); JET_CloseFile(mEasData); JET_Shutdown(mEasData); EAS_Shutdown(mEasData); } if (mEasJetFileLoc) { free(mEasJetFileLoc); mEasJetFileLoc = NULL; } if (mAudioTrack) { mAudioTrack->stop(); mAudioTrack->flush(); delete mAudioTrack; mAudioTrack = NULL; } if (mAudioBuffer) { delete mAudioBuffer; mAudioBuffer = NULL; } mEasData = NULL; return EAS_SUCCESS; } //------------------------------------------------------------------------------------------------- int JetPlayer::render() { EAS_RESULT result = EAS_FAILURE; EAS_I32 count; int temp; bool audioStarted = false; ALOGV("JetPlayer::render(): entering"); // allocate render buffer mAudioBuffer = new EAS_PCM[pLibConfig->mixBufferSize * pLibConfig->numChannels * MIX_NUM_BUFFERS]; // signal main thread that we started { Mutex::Autolock l(mMutex); mTid = gettid(); ALOGV("JetPlayer::render(): render thread(%d) signal", mTid); mCondition.signal(); } while (1) { mMutex.lock(); // [[[[[[[[ LOCK --------------------------------------- if (mEasData == NULL) { mMutex.unlock(); ALOGV("JetPlayer::render(): NULL EAS data, exiting render."); goto threadExit; } // nothing to render, wait for client thread to wake us up while (!mRender) { ALOGV("JetPlayer::render(): signal wait"); if (audioStarted) { mAudioTrack->pause(); // we have to restart the playback once we start rendering again audioStarted = false; } mCondition.wait(mMutex); ALOGV("JetPlayer::render(): signal rx'd"); } // render midi data into the input buffer int num_output = 0; EAS_PCM* p = mAudioBuffer; for (int i = 0; i < MIX_NUM_BUFFERS; i++) { result = EAS_Render(mEasData, p, pLibConfig->mixBufferSize, &count); if (result != EAS_SUCCESS) { ALOGE("JetPlayer::render(): EAS_Render returned error %ld", result); } p += count * pLibConfig->numChannels; num_output += count * pLibConfig->numChannels * sizeof(EAS_PCM); // send events that were generated (if any) to the event callback fireEventsFromJetQueue(); } // update playback state //ALOGV("JetPlayer::render(): updating state"); JET_Status(mEasData, &mJetStatus); fireUpdateOnStatusChange(); mPaused = mJetStatus.paused; mMutex.unlock(); // UNLOCK ]]]]]]]] ----------------------------------- // check audio output track if (mAudioTrack == NULL) { ALOGE("JetPlayer::render(): output AudioTrack was not created"); goto threadExit; } // Write data to the audio hardware //ALOGV("JetPlayer::render(): writing to audio output"); if ((temp = mAudioTrack->write(mAudioBuffer, num_output)) < 0) { ALOGE("JetPlayer::render(): Error in writing:%d",temp); return temp; } // start audio output if necessary if (!audioStarted) { ALOGV("JetPlayer::render(): starting audio playback"); mAudioTrack->start(); audioStarted = true; } }//while (1) threadExit: if (mAudioTrack != NULL) { mAudioTrack->stop(); mAudioTrack->flush(); } delete [] mAudioBuffer; mAudioBuffer = NULL; mMutex.lock(); mTid = -1; mCondition.signal(); mMutex.unlock(); return result; } //------------------------------------------------------------------------------------------------- // fire up an update if any of the status fields has changed // precondition: mMutex locked void JetPlayer::fireUpdateOnStatusChange() { if ( (mJetStatus.currentUserID != mPreviousJetStatus.currentUserID) ||(mJetStatus.segmentRepeatCount != mPreviousJetStatus.segmentRepeatCount) ) { if (mEventCallback) { mEventCallback( JetPlayer::JET_USERID_UPDATE, mJetStatus.currentUserID, mJetStatus.segmentRepeatCount, mJavaJetPlayerRef); } mPreviousJetStatus.currentUserID = mJetStatus.currentUserID; mPreviousJetStatus.segmentRepeatCount = mJetStatus.segmentRepeatCount; } if (mJetStatus.numQueuedSegments != mPreviousJetStatus.numQueuedSegments) { if (mEventCallback) { mEventCallback( JetPlayer::JET_NUMQUEUEDSEGMENT_UPDATE, mJetStatus.numQueuedSegments, -1, mJavaJetPlayerRef); } mPreviousJetStatus.numQueuedSegments = mJetStatus.numQueuedSegments; } if (mJetStatus.paused != mPreviousJetStatus.paused) { if (mEventCallback) { mEventCallback(JetPlayer::JET_PAUSE_UPDATE, mJetStatus.paused, -1, mJavaJetPlayerRef); } mPreviousJetStatus.paused = mJetStatus.paused; } } //------------------------------------------------------------------------------------------------- // fire up all the JET events in the JET engine queue (until the queue is empty) // precondition: mMutex locked void JetPlayer::fireEventsFromJetQueue() { if (!mEventCallback) { // no callback, just empty the event queue while (JET_GetEvent(mEasData, NULL, NULL)) { } return; } EAS_U32 rawEvent; while (JET_GetEvent(mEasData, &rawEvent, NULL)) { mEventCallback( JetPlayer::JET_EVENT, rawEvent, -1, mJavaJetPlayerRef); } } //------------------------------------------------------------------------------------------------- int JetPlayer::loadFromFile(const char* path) { ALOGV("JetPlayer::loadFromFile(): path=%s", path); Mutex::Autolock lock(mMutex); mEasJetFileLoc = (EAS_FILE_LOCATOR) malloc(sizeof(EAS_FILE)); strncpy(mJetFilePath, path, sizeof(mJetFilePath)); mJetFilePath[sizeof(mJetFilePath) - 1] = '\0'; mEasJetFileLoc->path = mJetFilePath; mEasJetFileLoc->fd = 0; mEasJetFileLoc->length = 0; mEasJetFileLoc->offset = 0; EAS_RESULT result = JET_OpenFile(mEasData, mEasJetFileLoc); if (result != EAS_SUCCESS) mState = EAS_STATE_ERROR; else mState = EAS_STATE_OPEN; return( result ); } //------------------------------------------------------------------------------------------------- int JetPlayer::loadFromFD(const int fd, const long long offset, const long long length) { ALOGV("JetPlayer::loadFromFD(): fd=%d offset=%lld length=%lld", fd, offset, length); Mutex::Autolock lock(mMutex); mEasJetFileLoc = (EAS_FILE_LOCATOR) malloc(sizeof(EAS_FILE)); mEasJetFileLoc->fd = fd; mEasJetFileLoc->offset = offset; mEasJetFileLoc->length = length; mEasJetFileLoc->path = NULL; EAS_RESULT result = JET_OpenFile(mEasData, mEasJetFileLoc); if (result != EAS_SUCCESS) mState = EAS_STATE_ERROR; else mState = EAS_STATE_OPEN; return( result ); } //------------------------------------------------------------------------------------------------- int JetPlayer::closeFile() { Mutex::Autolock lock(mMutex); return JET_CloseFile(mEasData); } //------------------------------------------------------------------------------------------------- int JetPlayer::play() { ALOGV("JetPlayer::play(): entering"); Mutex::Autolock lock(mMutex); EAS_RESULT result = JET_Play(mEasData); mPaused = false; mRender = true; JET_Status(mEasData, &mJetStatus); this->dumpJetStatus(&mJetStatus); fireUpdateOnStatusChange(); // wake up render thread ALOGV("JetPlayer::play(): wakeup render thread"); mCondition.signal(); return result; } //------------------------------------------------------------------------------------------------- int JetPlayer::pause() { Mutex::Autolock lock(mMutex); mPaused = true; EAS_RESULT result = JET_Pause(mEasData); mRender = false; JET_Status(mEasData, &mJetStatus); this->dumpJetStatus(&mJetStatus); fireUpdateOnStatusChange(); return result; } //------------------------------------------------------------------------------------------------- int JetPlayer::queueSegment(int segmentNum, int libNum, int repeatCount, int transpose, EAS_U32 muteFlags, EAS_U8 userID) { ALOGV("JetPlayer::queueSegment segmentNum=%d, libNum=%d, repeatCount=%d, transpose=%d", segmentNum, libNum, repeatCount, transpose); Mutex::Autolock lock(mMutex); return JET_QueueSegment(mEasData, segmentNum, libNum, repeatCount, transpose, muteFlags, userID); } //------------------------------------------------------------------------------------------------- int JetPlayer::setMuteFlags(EAS_U32 muteFlags, bool sync) { Mutex::Autolock lock(mMutex); return JET_SetMuteFlags(mEasData, muteFlags, sync); } //------------------------------------------------------------------------------------------------- int JetPlayer::setMuteFlag(int trackNum, bool muteFlag, bool sync) { Mutex::Autolock lock(mMutex); return JET_SetMuteFlag(mEasData, trackNum, muteFlag, sync); } //------------------------------------------------------------------------------------------------- int JetPlayer::triggerClip(int clipId) { ALOGV("JetPlayer::triggerClip clipId=%d", clipId); Mutex::Autolock lock(mMutex); return JET_TriggerClip(mEasData, clipId); } //------------------------------------------------------------------------------------------------- int JetPlayer::clearQueue() { ALOGV("JetPlayer::clearQueue"); Mutex::Autolock lock(mMutex); return JET_Clear_Queue(mEasData); } //------------------------------------------------------------------------------------------------- void JetPlayer::dump() { ALOGE("JetPlayer dump: JET file=%s", mEasJetFileLoc->path); } void JetPlayer::dumpJetStatus(S_JET_STATUS* pJetStatus) { if (pJetStatus!=NULL) ALOGV(">> current JET player status: userID=%d segmentRepeatCount=%d numQueuedSegments=%d paused=%d", pJetStatus->currentUserID, pJetStatus->segmentRepeatCount, pJetStatus->numQueuedSegments, pJetStatus->paused); else ALOGE(">> JET player status is NULL"); } } // end namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/AudioEffect.cpp0000644000015700001700000003250212200324306025072 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2010, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "AudioEffect" #include #include #include #include #include #include #include namespace android { // --------------------------------------------------------------------------- AudioEffect::AudioEffect() : mStatus(NO_INIT) { } AudioEffect::AudioEffect(const effect_uuid_t *type, const effect_uuid_t *uuid, int32_t priority, effect_callback_t cbf, void* user, int sessionId, audio_io_handle_t io ) : mStatus(NO_INIT) { mStatus = set(type, uuid, priority, cbf, user, sessionId, io); } AudioEffect::AudioEffect(const char *typeStr, const char *uuidStr, int32_t priority, effect_callback_t cbf, void* user, int sessionId, audio_io_handle_t io ) : mStatus(NO_INIT) { effect_uuid_t type; effect_uuid_t *pType = NULL; effect_uuid_t uuid; effect_uuid_t *pUuid = NULL; ALOGV("Constructor string\n - type: %s\n - uuid: %s", typeStr, uuidStr); if (typeStr != NULL) { if (stringToGuid(typeStr, &type) == NO_ERROR) { pType = &type; } } if (uuidStr != NULL) { if (stringToGuid(uuidStr, &uuid) == NO_ERROR) { pUuid = &uuid; } } mStatus = set(pType, pUuid, priority, cbf, user, sessionId, io); } status_t AudioEffect::set(const effect_uuid_t *type, const effect_uuid_t *uuid, int32_t priority, effect_callback_t cbf, void* user, int sessionId, audio_io_handle_t io) { sp iEffect; sp cblk; int enabled; ALOGV("set %p mUserData: %p uuid: %p timeLow %08x", this, user, type, type ? type->timeLow : 0); if (mIEffect != 0) { ALOGW("Effect already in use"); return INVALID_OPERATION; } const sp& audioFlinger = AudioSystem::get_audio_flinger(); if (audioFlinger == 0) { ALOGE("set(): Could not get audioflinger"); return NO_INIT; } if (type == NULL && uuid == NULL) { ALOGW("Must specify at least type or uuid"); return BAD_VALUE; } mPriority = priority; mCbf = cbf; mUserData = user; mSessionId = sessionId; memset(&mDescriptor, 0, sizeof(effect_descriptor_t)); mDescriptor.type = *(type != NULL ? type : EFFECT_UUID_NULL); mDescriptor.uuid = *(uuid != NULL ? uuid : EFFECT_UUID_NULL); mIEffectClient = new EffectClient(this); iEffect = audioFlinger->createEffect(getpid(), &mDescriptor, mIEffectClient, priority, io, mSessionId, &mStatus, &mId, &enabled); if (iEffect == 0 || (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS)) { ALOGE("set(): AudioFlinger could not create effect, status: %d", mStatus); return mStatus; } mEnabled = (volatile int32_t)enabled; mIEffect = iEffect; cblk = iEffect->getCblk(); if (cblk == 0) { mStatus = NO_INIT; ALOGE("Could not get control block"); return mStatus; } mIEffect = iEffect; mCblkMemory = cblk; mCblk = static_cast(cblk->pointer()); int bufOffset = ((sizeof(effect_param_cblk_t) - 1) / sizeof(int) + 1) * sizeof(int); mCblk->buffer = (uint8_t *)mCblk + bufOffset; iEffect->asBinder()->linkToDeath(mIEffectClient); ALOGV("set() %p OK effect: %s id: %d status %d enabled %d", this, mDescriptor.name, mId, mStatus, mEnabled); return mStatus; } AudioEffect::~AudioEffect() { ALOGV("Destructor %p", this); if (mStatus == NO_ERROR || mStatus == ALREADY_EXISTS) { if (mIEffect != NULL) { mIEffect->disconnect(); mIEffect->asBinder()->unlinkToDeath(mIEffectClient); } IPCThreadState::self()->flushCommands(); } mIEffect.clear(); mIEffectClient.clear(); mCblkMemory.clear(); } status_t AudioEffect::initCheck() const { return mStatus; } // ------------------------------------------------------------------------- effect_descriptor_t AudioEffect::descriptor() const { return mDescriptor; } bool AudioEffect::getEnabled() const { return (mEnabled != 0); } status_t AudioEffect::setEnabled(bool enabled) { if (mStatus != NO_ERROR) { return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus; } status_t status = NO_ERROR; AutoMutex lock(mLock); if (enabled != mEnabled) { if (enabled) { ALOGV("enable %p", this); status = mIEffect->enable(); } else { ALOGV("disable %p", this); status = mIEffect->disable(); } if (status == NO_ERROR) { mEnabled = enabled; } } return status; } status_t AudioEffect::command(uint32_t cmdCode, uint32_t cmdSize, void *cmdData, uint32_t *replySize, void *replyData) { if (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS) { ALOGV("command() bad status %d", mStatus); return mStatus; } if (cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) { if (mEnabled == (cmdCode == EFFECT_CMD_ENABLE)) { return NO_ERROR; } if (replySize == NULL || *replySize != sizeof(status_t) || replyData == NULL) { return BAD_VALUE; } mLock.lock(); } status_t status = mIEffect->command(cmdCode, cmdSize, cmdData, replySize, replyData); if (cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) { if (status == NO_ERROR) { status = *(status_t *)replyData; } if (status == NO_ERROR) { mEnabled = (cmdCode == EFFECT_CMD_ENABLE); } mLock.unlock(); } return status; } status_t AudioEffect::setParameter(effect_param_t *param) { if (mStatus != NO_ERROR) { return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus; } if (param == NULL || param->psize == 0 || param->vsize == 0) { return BAD_VALUE; } uint32_t size = sizeof(int); uint32_t psize = ((param->psize - 1) / sizeof(int) + 1) * sizeof(int) + param->vsize; ALOGV("setParameter: param: %d, param2: %d", *(int *)param->data, (param->psize == 8) ? *((int *)param->data + 1): -1); return mIEffect->command(EFFECT_CMD_SET_PARAM, sizeof (effect_param_t) + psize, param, &size, ¶m->status); } status_t AudioEffect::setParameterDeferred(effect_param_t *param) { if (mStatus != NO_ERROR) { return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus; } if (param == NULL || param->psize == 0 || param->vsize == 0) { return BAD_VALUE; } Mutex::Autolock _l(mCblk->lock); int psize = ((param->psize - 1) / sizeof(int) + 1) * sizeof(int) + param->vsize; int size = ((sizeof(effect_param_t) + psize - 1) / sizeof(int) + 1) * sizeof(int); if (mCblk->clientIndex + size > EFFECT_PARAM_BUFFER_SIZE) { return NO_MEMORY; } int *p = (int *)(mCblk->buffer + mCblk->clientIndex); *p++ = size; memcpy(p, param, sizeof(effect_param_t) + psize); mCblk->clientIndex += size; return NO_ERROR; } status_t AudioEffect::setParameterCommit() { if (mStatus != NO_ERROR) { return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus; } Mutex::Autolock _l(mCblk->lock); if (mCblk->clientIndex == 0) { return INVALID_OPERATION; } uint32_t size = 0; return mIEffect->command(EFFECT_CMD_SET_PARAM_COMMIT, 0, NULL, &size, NULL); } status_t AudioEffect::getParameter(effect_param_t *param) { if (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS) { return mStatus; } if (param == NULL || param->psize == 0 || param->vsize == 0) { return BAD_VALUE; } ALOGV("getParameter: param: %d, param2: %d", *(int *)param->data, (param->psize == 8) ? *((int *)param->data + 1): -1); uint32_t psize = sizeof(effect_param_t) + ((param->psize - 1) / sizeof(int) + 1) * sizeof(int) + param->vsize; return mIEffect->command(EFFECT_CMD_GET_PARAM, sizeof(effect_param_t) + param->psize, param, &psize, param); } // ------------------------------------------------------------------------- void AudioEffect::binderDied() { ALOGW("IEffect died"); mStatus = DEAD_OBJECT; if (mCbf != NULL) { status_t status = DEAD_OBJECT; mCbf(EVENT_ERROR, mUserData, &status); } mIEffect.clear(); } // ------------------------------------------------------------------------- void AudioEffect::controlStatusChanged(bool controlGranted) { ALOGV("controlStatusChanged %p control %d callback %p mUserData %p", this, controlGranted, mCbf, mUserData); if (controlGranted) { if (mStatus == ALREADY_EXISTS) { mStatus = NO_ERROR; } } else { if (mStatus == NO_ERROR) { mStatus = ALREADY_EXISTS; } } if (mCbf != NULL) { mCbf(EVENT_CONTROL_STATUS_CHANGED, mUserData, &controlGranted); } } void AudioEffect::enableStatusChanged(bool enabled) { ALOGV("enableStatusChanged %p enabled %d mCbf %p", this, enabled, mCbf); if (mStatus == ALREADY_EXISTS) { mEnabled = enabled; if (mCbf != NULL) { mCbf(EVENT_ENABLE_STATUS_CHANGED, mUserData, &enabled); } } } void AudioEffect::commandExecuted(uint32_t cmdCode, uint32_t cmdSize, void *cmdData, uint32_t replySize, void *replyData) { if (cmdData == NULL || replyData == NULL) { return; } if (mCbf != NULL && cmdCode == EFFECT_CMD_SET_PARAM) { effect_param_t *cmd = (effect_param_t *)cmdData; cmd->status = *(int32_t *)replyData; mCbf(EVENT_PARAMETER_CHANGED, mUserData, cmd); } } // ------------------------------------------------------------------------- status_t AudioEffect::queryNumberEffects(uint32_t *numEffects) { const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; return af->queryNumberEffects(numEffects); } status_t AudioEffect::queryEffect(uint32_t index, effect_descriptor_t *descriptor) { const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; return af->queryEffect(index, descriptor); } status_t AudioEffect::getEffectDescriptor(const effect_uuid_t *uuid, effect_descriptor_t *descriptor) /*const*/ { const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; return af->getEffectDescriptor(uuid, descriptor); } status_t AudioEffect::queryDefaultPreProcessing(int audioSession, effect_descriptor_t *descriptors, uint32_t *count) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return PERMISSION_DENIED; return aps->queryDefaultPreProcessing(audioSession, descriptors, count); } // ------------------------------------------------------------------------- status_t AudioEffect::stringToGuid(const char *str, effect_uuid_t *guid) { if (str == NULL || guid == NULL) { return BAD_VALUE; } int tmp[10]; if (sscanf(str, "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x", tmp, tmp+1, tmp+2, tmp+3, tmp+4, tmp+5, tmp+6, tmp+7, tmp+8, tmp+9) < 10) { return BAD_VALUE; } guid->timeLow = (uint32_t)tmp[0]; guid->timeMid = (uint16_t)tmp[1]; guid->timeHiAndVersion = (uint16_t)tmp[2]; guid->clockSeq = (uint16_t)tmp[3]; guid->node[0] = (uint8_t)tmp[4]; guid->node[1] = (uint8_t)tmp[5]; guid->node[2] = (uint8_t)tmp[6]; guid->node[3] = (uint8_t)tmp[7]; guid->node[4] = (uint8_t)tmp[8]; guid->node[5] = (uint8_t)tmp[9]; return NO_ERROR; } status_t AudioEffect::guidToString(const effect_uuid_t *guid, char *str, size_t maxLen) { if (guid == NULL || str == NULL) { return BAD_VALUE; } snprintf(str, maxLen, "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x", guid->timeLow, guid->timeMid, guid->timeHiAndVersion, guid->clockSeq, guid->node[0], guid->node[1], guid->node[2], guid->node[3], guid->node[4], guid->node[5]); return NO_ERROR; } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/MediaProfiles.cpp0000644000015700001700000012614012200324306025441 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2010, The Android Open Source Project ** Copyright (c) 2010 - 2012, The Linux Foundation. All rights reserved. ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "MediaProfiles" #include #include #include #include #include #include #include #include namespace android { Mutex MediaProfiles::sLock; bool MediaProfiles::sIsInitialized = false; MediaProfiles *MediaProfiles::sInstance = NULL; const MediaProfiles::NameToTagMap MediaProfiles::sVideoEncoderNameMap[] = { {"h263", VIDEO_ENCODER_H263}, {"h264", VIDEO_ENCODER_H264}, {"m4v", VIDEO_ENCODER_MPEG_4_SP} }; const MediaProfiles::NameToTagMap MediaProfiles::sAudioEncoderNameMap[] = { {"amrnb", AUDIO_ENCODER_AMR_NB}, {"amrwb", AUDIO_ENCODER_AMR_WB}, {"aac", AUDIO_ENCODER_AAC}, {"heaac", AUDIO_ENCODER_HE_AAC}, {"aaceld", AUDIO_ENCODER_AAC_ELD}, #ifdef QCOM_HARDWARE {"lpcm", AUDIO_ENCODER_LPCM}, #endif }; const MediaProfiles::NameToTagMap MediaProfiles::sFileFormatMap[] = { {"3gp", OUTPUT_FORMAT_THREE_GPP}, {"mp4", OUTPUT_FORMAT_MPEG_4} }; const MediaProfiles::NameToTagMap MediaProfiles::sVideoDecoderNameMap[] = { {"wmv", VIDEO_DECODER_WMV} }; const MediaProfiles::NameToTagMap MediaProfiles::sAudioDecoderNameMap[] = { {"wma", AUDIO_DECODER_WMA} }; const MediaProfiles::NameToTagMap MediaProfiles::sCamcorderQualityNameMap[] = { {"low", CAMCORDER_QUALITY_LOW}, {"high", CAMCORDER_QUALITY_HIGH}, {"qcif", CAMCORDER_QUALITY_QCIF}, {"cif", CAMCORDER_QUALITY_CIF}, {"480p", CAMCORDER_QUALITY_480P}, {"720p", CAMCORDER_QUALITY_720P}, {"1080p", CAMCORDER_QUALITY_1080P}, {"qvga", CAMCORDER_QUALITY_QVGA}, {"fwvga", CAMCORDER_QUALITY_FWVGA}, {"wvga", CAMCORDER_QUALITY_WVGA}, {"vga", CAMCORDER_QUALITY_VGA}, {"wqvga", CAMCORDER_QUALITY_WQVGA}, {"timelapselow", CAMCORDER_QUALITY_TIME_LAPSE_LOW}, {"timelapsehigh", CAMCORDER_QUALITY_TIME_LAPSE_HIGH}, {"timelapseqcif", CAMCORDER_QUALITY_TIME_LAPSE_QCIF}, {"timelapsecif", CAMCORDER_QUALITY_TIME_LAPSE_CIF}, {"timelapse480p", CAMCORDER_QUALITY_TIME_LAPSE_480P}, {"timelapse720p", CAMCORDER_QUALITY_TIME_LAPSE_720P}, {"timelapse1080p", CAMCORDER_QUALITY_TIME_LAPSE_1080P}, {"timelapseqvga", CAMCORDER_QUALITY_TIME_LAPSE_QVGA}, }; /*static*/ void MediaProfiles::logVideoCodec(const MediaProfiles::VideoCodec& codec) { ALOGV("video codec:"); ALOGV("codec = %d", codec.mCodec); ALOGV("bit rate: %d", codec.mBitRate); ALOGV("frame width: %d", codec.mFrameWidth); ALOGV("frame height: %d", codec.mFrameHeight); ALOGV("frame rate: %d", codec.mFrameRate); } /*static*/ void MediaProfiles::logAudioCodec(const MediaProfiles::AudioCodec& codec) { ALOGV("audio codec:"); ALOGV("codec = %d", codec.mCodec); ALOGV("bit rate: %d", codec.mBitRate); ALOGV("sample rate: %d", codec.mSampleRate); ALOGV("number of channels: %d", codec.mChannels); } /*static*/ void MediaProfiles::logVideoEncoderCap(const MediaProfiles::VideoEncoderCap& cap) { ALOGV("video encoder cap:"); ALOGV("codec = %d", cap.mCodec); ALOGV("bit rate: min = %d and max = %d", cap.mMinBitRate, cap.mMaxBitRate); ALOGV("frame width: min = %d and max = %d", cap.mMinFrameWidth, cap.mMaxFrameWidth); ALOGV("frame height: min = %d and max = %d", cap.mMinFrameHeight, cap.mMaxFrameHeight); ALOGV("frame rate: min = %d and max = %d", cap.mMinFrameRate, cap.mMaxFrameRate); } /*static*/ void MediaProfiles::logAudioEncoderCap(const MediaProfiles::AudioEncoderCap& cap) { ALOGV("audio encoder cap:"); ALOGV("codec = %d", cap.mCodec); ALOGV("bit rate: min = %d and max = %d", cap.mMinBitRate, cap.mMaxBitRate); ALOGV("sample rate: min = %d and max = %d", cap.mMinSampleRate, cap.mMaxSampleRate); ALOGV("number of channels: min = %d and max = %d", cap.mMinChannels, cap.mMaxChannels); } /*static*/ void MediaProfiles::logVideoDecoderCap(const MediaProfiles::VideoDecoderCap& cap) { ALOGV("video decoder cap:"); ALOGV("codec = %d", cap.mCodec); } /*static*/ void MediaProfiles::logAudioDecoderCap(const MediaProfiles::AudioDecoderCap& cap) { ALOGV("audio codec cap:"); ALOGV("codec = %d", cap.mCodec); } /*static*/ void MediaProfiles::logVideoEditorCap(const MediaProfiles::VideoEditorCap& cap) { ALOGV("videoeditor cap:"); ALOGV("mMaxInputFrameWidth = %d", cap.mMaxInputFrameWidth); ALOGV("mMaxInputFrameHeight = %d", cap.mMaxInputFrameHeight); ALOGV("mMaxOutputFrameWidth = %d", cap.mMaxOutputFrameWidth); ALOGV("mMaxOutputFrameHeight = %d", cap.mMaxOutputFrameHeight); } /*static*/ int MediaProfiles::findTagForName(const MediaProfiles::NameToTagMap *map, size_t nMappings, const char *name) { int tag = -1; for (size_t i = 0; i < nMappings; ++i) { if (!strcmp(map[i].name, name)) { tag = map[i].tag; break; } } return tag; } /*static*/ MediaProfiles::VideoCodec* MediaProfiles::createVideoCodec(const char **atts, MediaProfiles *profiles) { CHECK(!strcmp("codec", atts[0]) && !strcmp("bitRate", atts[2]) && !strcmp("width", atts[4]) && !strcmp("height", atts[6]) && !strcmp("frameRate", atts[8])); const size_t nMappings = sizeof(sVideoEncoderNameMap)/sizeof(sVideoEncoderNameMap[0]); const int codec = findTagForName(sVideoEncoderNameMap, nMappings, atts[1]); CHECK(codec != -1); MediaProfiles::VideoCodec *videoCodec = new MediaProfiles::VideoCodec(static_cast(codec), atoi(atts[3]), atoi(atts[5]), atoi(atts[7]), atoi(atts[9])); logVideoCodec(*videoCodec); size_t nCamcorderProfiles; CHECK((nCamcorderProfiles = profiles->mCamcorderProfiles.size()) >= 1); profiles->mCamcorderProfiles[nCamcorderProfiles - 1]->mVideoCodec = videoCodec; return videoCodec; } /*static*/ MediaProfiles::AudioCodec* MediaProfiles::createAudioCodec(const char **atts, MediaProfiles *profiles) { CHECK(!strcmp("codec", atts[0]) && !strcmp("bitRate", atts[2]) && !strcmp("sampleRate", atts[4]) && !strcmp("channels", atts[6])); const size_t nMappings = sizeof(sAudioEncoderNameMap)/sizeof(sAudioEncoderNameMap[0]); const int codec = findTagForName(sAudioEncoderNameMap, nMappings, atts[1]); CHECK(codec != -1); MediaProfiles::AudioCodec *audioCodec = new MediaProfiles::AudioCodec(static_cast(codec), atoi(atts[3]), atoi(atts[5]), atoi(atts[7])); logAudioCodec(*audioCodec); size_t nCamcorderProfiles; CHECK((nCamcorderProfiles = profiles->mCamcorderProfiles.size()) >= 1); profiles->mCamcorderProfiles[nCamcorderProfiles - 1]->mAudioCodec = audioCodec; return audioCodec; } /*static*/ MediaProfiles::AudioDecoderCap* MediaProfiles::createAudioDecoderCap(const char **atts) { CHECK(!strcmp("name", atts[0]) && !strcmp("enabled", atts[2])); const size_t nMappings = sizeof(sAudioDecoderNameMap)/sizeof(sAudioDecoderNameMap[0]); const int codec = findTagForName(sAudioDecoderNameMap, nMappings, atts[1]); CHECK(codec != -1); MediaProfiles::AudioDecoderCap *cap = new MediaProfiles::AudioDecoderCap(static_cast(codec)); logAudioDecoderCap(*cap); return cap; } /*static*/ MediaProfiles::VideoDecoderCap* MediaProfiles::createVideoDecoderCap(const char **atts) { CHECK(!strcmp("name", atts[0]) && !strcmp("enabled", atts[2])); const size_t nMappings = sizeof(sVideoDecoderNameMap)/sizeof(sVideoDecoderNameMap[0]); const int codec = findTagForName(sVideoDecoderNameMap, nMappings, atts[1]); CHECK(codec != -1); MediaProfiles::VideoDecoderCap *cap = new MediaProfiles::VideoDecoderCap(static_cast(codec)); logVideoDecoderCap(*cap); return cap; } /*static*/ MediaProfiles::VideoEncoderCap* MediaProfiles::createVideoEncoderCap(const char **atts) { CHECK(!strcmp("name", atts[0]) && !strcmp("enabled", atts[2]) && !strcmp("minBitRate", atts[4]) && !strcmp("maxBitRate", atts[6]) && !strcmp("minFrameWidth", atts[8]) && !strcmp("maxFrameWidth", atts[10]) && !strcmp("minFrameHeight", atts[12]) && !strcmp("maxFrameHeight", atts[14]) && !strcmp("minFrameRate", atts[16]) && !strcmp("maxFrameRate", atts[18])); const size_t nMappings = sizeof(sVideoEncoderNameMap)/sizeof(sVideoEncoderNameMap[0]); const int codec = findTagForName(sVideoEncoderNameMap, nMappings, atts[1]); CHECK(codec != -1); MediaProfiles::VideoEncoderCap *cap = new MediaProfiles::VideoEncoderCap(static_cast(codec), atoi(atts[5]), atoi(atts[7]), atoi(atts[9]), atoi(atts[11]), atoi(atts[13]), atoi(atts[15]), atoi(atts[17]), atoi(atts[19])); logVideoEncoderCap(*cap); return cap; } /*static*/ MediaProfiles::AudioEncoderCap* MediaProfiles::createAudioEncoderCap(const char **atts) { CHECK(!strcmp("name", atts[0]) && !strcmp("enabled", atts[2]) && !strcmp("minBitRate", atts[4]) && !strcmp("maxBitRate", atts[6]) && !strcmp("minSampleRate", atts[8]) && !strcmp("maxSampleRate", atts[10]) && !strcmp("minChannels", atts[12]) && !strcmp("maxChannels", atts[14])); const size_t nMappings = sizeof(sAudioEncoderNameMap)/sizeof(sAudioEncoderNameMap[0]); const int codec = findTagForName(sAudioEncoderNameMap, nMappings, atts[1]); CHECK(codec != -1); MediaProfiles::AudioEncoderCap *cap = new MediaProfiles::AudioEncoderCap(static_cast(codec), atoi(atts[5]), atoi(atts[7]), atoi(atts[9]), atoi(atts[11]), atoi(atts[13]), atoi(atts[15])); logAudioEncoderCap(*cap); return cap; } /*static*/ output_format MediaProfiles::createEncoderOutputFileFormat(const char **atts) { CHECK(!strcmp("name", atts[0])); const size_t nMappings =sizeof(sFileFormatMap)/sizeof(sFileFormatMap[0]); const int format = findTagForName(sFileFormatMap, nMappings, atts[1]); CHECK(format != -1); return static_cast(format); } static bool isCameraIdFound(int cameraId, const Vector& cameraIds) { for (int i = 0, n = cameraIds.size(); i < n; ++i) { if (cameraId == cameraIds[i]) { return true; } } return false; } /*static*/ MediaProfiles::CamcorderProfile* MediaProfiles::createCamcorderProfile(int cameraId, const char **atts, Vector& cameraIds) { CHECK(!strcmp("quality", atts[0]) && !strcmp("fileFormat", atts[2]) && !strcmp("duration", atts[4])); const size_t nProfileMappings = sizeof(sCamcorderQualityNameMap)/sizeof(sCamcorderQualityNameMap[0]); const int quality = findTagForName(sCamcorderQualityNameMap, nProfileMappings, atts[1]); CHECK(quality != -1); const size_t nFormatMappings = sizeof(sFileFormatMap)/sizeof(sFileFormatMap[0]); const int fileFormat = findTagForName(sFileFormatMap, nFormatMappings, atts[3]); CHECK(fileFormat != -1); MediaProfiles::CamcorderProfile *profile = new MediaProfiles::CamcorderProfile; profile->mCameraId = cameraId; if (!isCameraIdFound(cameraId, cameraIds)) { cameraIds.add(cameraId); } profile->mFileFormat = static_cast(fileFormat); profile->mQuality = static_cast(quality); profile->mDuration = atoi(atts[5]); return profile; } MediaProfiles::ImageEncodingQualityLevels* MediaProfiles::findImageEncodingQualityLevels(int cameraId) const { int n = mImageEncodingQualityLevels.size(); for (int i = 0; i < n; i++) { ImageEncodingQualityLevels *levels = mImageEncodingQualityLevels[i]; if (levels->mCameraId == cameraId) { return levels; } } return NULL; } void MediaProfiles::addImageEncodingQualityLevel(int cameraId, const char** atts) { CHECK(!strcmp("quality", atts[0])); int quality = atoi(atts[1]); ALOGV("%s: cameraId=%d, quality=%d", __func__, cameraId, quality); ImageEncodingQualityLevels *levels = findImageEncodingQualityLevels(cameraId); if (levels == NULL) { levels = new ImageEncodingQualityLevels(); levels->mCameraId = cameraId; mImageEncodingQualityLevels.add(levels); } levels->mLevels.add(quality); } /*static*/ int MediaProfiles::getCameraId(const char** atts) { if (!atts[0]) return 0; // default cameraId = 0 CHECK(!strcmp("cameraId", atts[0])); return atoi(atts[1]); } void MediaProfiles::addStartTimeOffset(int cameraId, const char** atts) { int offsetTimeMs = 1000; if (atts[2]) { CHECK(!strcmp("startOffsetMs", atts[2])); offsetTimeMs = atoi(atts[3]); } ALOGV("%s: cameraId=%d, offset=%d ms", __func__, cameraId, offsetTimeMs); mStartTimeOffsets.replaceValueFor(cameraId, offsetTimeMs); } /*static*/ MediaProfiles::ExportVideoProfile* MediaProfiles::createExportVideoProfile(const char **atts) { CHECK(!strcmp("name", atts[0]) && !strcmp("profile", atts[2]) && !strcmp("level", atts[4])); const size_t nMappings = sizeof(sVideoEncoderNameMap)/sizeof(sVideoEncoderNameMap[0]); const int codec = findTagForName(sVideoEncoderNameMap, nMappings, atts[1]); CHECK(codec != -1); MediaProfiles::ExportVideoProfile *profile = new MediaProfiles::ExportVideoProfile( codec, atoi(atts[3]), atoi(atts[5])); return profile; } /*static*/ MediaProfiles::VideoEditorCap* MediaProfiles::createVideoEditorCap(const char **atts, MediaProfiles *profiles) { CHECK(!strcmp("maxInputFrameWidth", atts[0]) && !strcmp("maxInputFrameHeight", atts[2]) && !strcmp("maxOutputFrameWidth", atts[4]) && !strcmp("maxOutputFrameHeight", atts[6]) && !strcmp("maxPrefetchYUVFrames", atts[8])); MediaProfiles::VideoEditorCap *pVideoEditorCap = new MediaProfiles::VideoEditorCap(atoi(atts[1]), atoi(atts[3]), atoi(atts[5]), atoi(atts[7]), atoi(atts[9])); logVideoEditorCap(*pVideoEditorCap); profiles->mVideoEditorCap = pVideoEditorCap; return pVideoEditorCap; } /*static*/ void MediaProfiles::startElementHandler(void *userData, const char *name, const char **atts) { MediaProfiles *profiles = (MediaProfiles *) userData; if (strcmp("Video", name) == 0) { createVideoCodec(atts, profiles); } else if (strcmp("Audio", name) == 0) { createAudioCodec(atts, profiles); } else if (strcmp("VideoEncoderCap", name) == 0 && strcmp("true", atts[3]) == 0) { profiles->mVideoEncoders.add(createVideoEncoderCap(atts)); } else if (strcmp("AudioEncoderCap", name) == 0 && strcmp("true", atts[3]) == 0) { profiles->mAudioEncoders.add(createAudioEncoderCap(atts)); } else if (strcmp("VideoDecoderCap", name) == 0 && strcmp("true", atts[3]) == 0) { profiles->mVideoDecoders.add(createVideoDecoderCap(atts)); } else if (strcmp("AudioDecoderCap", name) == 0 && strcmp("true", atts[3]) == 0) { profiles->mAudioDecoders.add(createAudioDecoderCap(atts)); } else if (strcmp("EncoderOutputFileFormat", name) == 0) { profiles->mEncoderOutputFileFormats.add(createEncoderOutputFileFormat(atts)); } else if (strcmp("CamcorderProfiles", name) == 0) { profiles->mCurrentCameraId = getCameraId(atts); profiles->addStartTimeOffset(profiles->mCurrentCameraId, atts); } else if (strcmp("EncoderProfile", name) == 0) { profiles->mCamcorderProfiles.add( createCamcorderProfile(profiles->mCurrentCameraId, atts, profiles->mCameraIds)); } else if (strcmp("ImageEncoding", name) == 0) { profiles->addImageEncodingQualityLevel(profiles->mCurrentCameraId, atts); } else if (strcmp("VideoEditorCap", name) == 0) { createVideoEditorCap(atts, profiles); } else if (strcmp("ExportVideoProfile", name) == 0) { profiles->mVideoEditorExportProfiles.add(createExportVideoProfile(atts)); } } static bool isCamcorderProfile(camcorder_quality quality) { return quality >= CAMCORDER_QUALITY_LIST_START && quality <= CAMCORDER_QUALITY_LIST_END; } static bool isTimelapseProfile(camcorder_quality quality) { return quality >= CAMCORDER_QUALITY_TIME_LAPSE_LIST_START && quality <= CAMCORDER_QUALITY_TIME_LAPSE_LIST_END; } void MediaProfiles::initRequiredProfileRefs(const Vector& cameraIds) { ALOGV("Number of camera ids: %d", cameraIds.size()); CHECK(cameraIds.size() > 0); mRequiredProfileRefs = new RequiredProfiles[cameraIds.size()]; for (size_t i = 0, n = cameraIds.size(); i < n; ++i) { mRequiredProfileRefs[i].mCameraId = cameraIds[i]; for (size_t j = 0; j < kNumRequiredProfiles; ++j) { mRequiredProfileRefs[i].mRefs[j].mHasRefProfile = false; mRequiredProfileRefs[i].mRefs[j].mRefProfileIndex = -1; if ((j & 1) == 0) { // low resolution mRequiredProfileRefs[i].mRefs[j].mResolutionProduct = 0x7FFFFFFF; } else { // high resolution mRequiredProfileRefs[i].mRefs[j].mResolutionProduct = 0; } } } } int MediaProfiles::getRequiredProfileRefIndex(int cameraId) { for (size_t i = 0, n = mCameraIds.size(); i < n; ++i) { if (mCameraIds[i] == cameraId) { return i; } } return -1; } void MediaProfiles::checkAndAddRequiredProfilesIfNecessary() { if (sIsInitialized) { return; } initRequiredProfileRefs(mCameraIds); for (size_t i = 0, n = mCamcorderProfiles.size(); i < n; ++i) { int product = mCamcorderProfiles[i]->mVideoCodec->mFrameWidth * mCamcorderProfiles[i]->mVideoCodec->mFrameHeight; camcorder_quality quality = mCamcorderProfiles[i]->mQuality; int cameraId = mCamcorderProfiles[i]->mCameraId; int index = -1; int refIndex = getRequiredProfileRefIndex(cameraId); CHECK(refIndex != -1); RequiredProfileRefInfo *info; camcorder_quality refQuality; VideoCodec *codec = NULL; // Check high and low from either camcorder profile or timelapse profile // but not both. Default, check camcorder profile size_t j = 0; size_t o = 2; if (isTimelapseProfile(quality)) { // Check timelapse profile instead. j = 2; o = kNumRequiredProfiles; } else { // Must be camcorder profile. CHECK(isCamcorderProfile(quality)); } for (; j < o; ++j) { info = &(mRequiredProfileRefs[refIndex].mRefs[j]); if ((j % 2 == 0 && product > info->mResolutionProduct) || // low (j % 2 != 0 && product < info->mResolutionProduct)) { // high continue; } switch (j) { case 0: refQuality = CAMCORDER_QUALITY_LOW; break; case 1: refQuality = CAMCORDER_QUALITY_HIGH; break; case 2: refQuality = CAMCORDER_QUALITY_TIME_LAPSE_LOW; break; case 3: refQuality = CAMCORDER_QUALITY_TIME_LAPSE_HIGH; break; default: CHECK(!"Should never reach here"); } if (!info->mHasRefProfile) { index = getCamcorderProfileIndex(cameraId, refQuality); } if (index == -1) { // New high or low quality profile is found. // Update its reference. info->mHasRefProfile = true; info->mRefProfileIndex = i; info->mResolutionProduct = product; } } } for (size_t cameraId = 0; cameraId < mCameraIds.size(); ++cameraId) { for (size_t j = 0; j < kNumRequiredProfiles; ++j) { int refIndex = getRequiredProfileRefIndex(cameraId); CHECK(refIndex != -1); RequiredProfileRefInfo *info = &mRequiredProfileRefs[refIndex].mRefs[j]; if (info->mHasRefProfile) { CamcorderProfile *profile = new CamcorderProfile( *mCamcorderProfiles[info->mRefProfileIndex]); // Overwrite the quality switch (j % kNumRequiredProfiles) { case 0: profile->mQuality = CAMCORDER_QUALITY_LOW; break; case 1: profile->mQuality = CAMCORDER_QUALITY_HIGH; break; case 2: profile->mQuality = CAMCORDER_QUALITY_TIME_LAPSE_LOW; break; case 3: profile->mQuality = CAMCORDER_QUALITY_TIME_LAPSE_HIGH; break; default: CHECK(!"Should never come here"); } int index = getCamcorderProfileIndex(cameraId, profile->mQuality); if (index != -1) { ALOGV("Profile quality %d for camera %d already exists", profile->mQuality, cameraId); CHECK(index == refIndex); continue; } // Insert the new profile ALOGV("Add a profile: quality %d=>%d for camera %d", mCamcorderProfiles[info->mRefProfileIndex]->mQuality, profile->mQuality, cameraId); mCamcorderProfiles.add(profile); } } } } /*static*/ MediaProfiles* MediaProfiles::getInstance() { ALOGV("getInstance"); Mutex::Autolock lock(sLock); if (!sIsInitialized) { char value[PROPERTY_VALUE_MAX]; if (property_get("media.settings.xml", value, NULL) <= 0) { const char *defaultXmlFile = "/etc/media_profiles.xml"; FILE *fp = fopen(defaultXmlFile, "r"); if (fp == NULL) { ALOGW("could not find media config xml file"); sInstance = createDefaultInstance(); } else { fclose(fp); // close the file first. sInstance = createInstanceFromXmlFile(defaultXmlFile); } } else { sInstance = createInstanceFromXmlFile(value); } CHECK(sInstance != NULL); sInstance->checkAndAddRequiredProfilesIfNecessary(); sIsInitialized = true; } return sInstance; } /*static*/ MediaProfiles::VideoEncoderCap* MediaProfiles::createDefaultH263VideoEncoderCap() { return new MediaProfiles::VideoEncoderCap( VIDEO_ENCODER_H263, 192000, 420000, 176, 352, 144, 288, 1, 20); } /*static*/ MediaProfiles::VideoEncoderCap* MediaProfiles::createDefaultM4vVideoEncoderCap() { return new MediaProfiles::VideoEncoderCap( VIDEO_ENCODER_MPEG_4_SP, 192000, 420000, 176, 352, 144, 288, 1, 20); } /*static*/ void MediaProfiles::createDefaultVideoEncoders(MediaProfiles *profiles) { profiles->mVideoEncoders.add(createDefaultH263VideoEncoderCap()); profiles->mVideoEncoders.add(createDefaultM4vVideoEncoderCap()); } /*static*/ MediaProfiles::CamcorderProfile* MediaProfiles::createDefaultCamcorderTimeLapseQcifProfile(camcorder_quality quality) { MediaProfiles::VideoCodec *videoCodec = new MediaProfiles::VideoCodec(VIDEO_ENCODER_H263, 1000000, 176, 144, 20); AudioCodec *audioCodec = new AudioCodec(AUDIO_ENCODER_AMR_NB, 12200, 8000, 1); CamcorderProfile *profile = new MediaProfiles::CamcorderProfile; profile->mCameraId = 0; profile->mFileFormat = OUTPUT_FORMAT_THREE_GPP; profile->mQuality = quality; profile->mDuration = 60; profile->mVideoCodec = videoCodec; profile->mAudioCodec = audioCodec; return profile; } /*static*/ MediaProfiles::CamcorderProfile* MediaProfiles::createDefaultCamcorderTimeLapse480pProfile(camcorder_quality quality) { MediaProfiles::VideoCodec *videoCodec = new MediaProfiles::VideoCodec(VIDEO_ENCODER_H263, 20000000, 720, 480, 20); AudioCodec *audioCodec = new AudioCodec(AUDIO_ENCODER_AMR_NB, 12200, 8000, 1); CamcorderProfile *profile = new MediaProfiles::CamcorderProfile; profile->mCameraId = 0; profile->mFileFormat = OUTPUT_FORMAT_THREE_GPP; profile->mQuality = quality; profile->mDuration = 60; profile->mVideoCodec = videoCodec; profile->mAudioCodec = audioCodec; return profile; } /*static*/ void MediaProfiles::createDefaultCamcorderTimeLapseLowProfiles( MediaProfiles::CamcorderProfile **lowTimeLapseProfile, MediaProfiles::CamcorderProfile **lowSpecificTimeLapseProfile) { *lowTimeLapseProfile = createDefaultCamcorderTimeLapseQcifProfile(CAMCORDER_QUALITY_TIME_LAPSE_LOW); *lowSpecificTimeLapseProfile = createDefaultCamcorderTimeLapseQcifProfile(CAMCORDER_QUALITY_TIME_LAPSE_QCIF); } /*static*/ void MediaProfiles::createDefaultCamcorderTimeLapseHighProfiles( MediaProfiles::CamcorderProfile **highTimeLapseProfile, MediaProfiles::CamcorderProfile **highSpecificTimeLapseProfile) { *highTimeLapseProfile = createDefaultCamcorderTimeLapse480pProfile(CAMCORDER_QUALITY_TIME_LAPSE_HIGH); *highSpecificTimeLapseProfile = createDefaultCamcorderTimeLapse480pProfile(CAMCORDER_QUALITY_TIME_LAPSE_480P); } /*static*/ MediaProfiles::CamcorderProfile* MediaProfiles::createDefaultCamcorderQcifProfile(camcorder_quality quality) { MediaProfiles::VideoCodec *videoCodec = new MediaProfiles::VideoCodec(VIDEO_ENCODER_H263, 192000, 176, 144, 20); MediaProfiles::AudioCodec *audioCodec = new MediaProfiles::AudioCodec(AUDIO_ENCODER_AMR_NB, 12200, 8000, 1); MediaProfiles::CamcorderProfile *profile = new MediaProfiles::CamcorderProfile; profile->mCameraId = 0; profile->mFileFormat = OUTPUT_FORMAT_THREE_GPP; profile->mQuality = quality; profile->mDuration = 30; profile->mVideoCodec = videoCodec; profile->mAudioCodec = audioCodec; return profile; } /*static*/ MediaProfiles::CamcorderProfile* MediaProfiles::createDefaultCamcorderCifProfile(camcorder_quality quality) { MediaProfiles::VideoCodec *videoCodec = new MediaProfiles::VideoCodec(VIDEO_ENCODER_H263, 360000, 352, 288, 20); AudioCodec *audioCodec = new AudioCodec(AUDIO_ENCODER_AMR_NB, 12200, 8000, 1); CamcorderProfile *profile = new MediaProfiles::CamcorderProfile; profile->mCameraId = 0; profile->mFileFormat = OUTPUT_FORMAT_THREE_GPP; profile->mQuality = quality; profile->mDuration = 60; profile->mVideoCodec = videoCodec; profile->mAudioCodec = audioCodec; return profile; } /*static*/ void MediaProfiles::createDefaultCamcorderLowProfiles( MediaProfiles::CamcorderProfile **lowProfile, MediaProfiles::CamcorderProfile **lowSpecificProfile) { *lowProfile = createDefaultCamcorderQcifProfile(CAMCORDER_QUALITY_LOW); *lowSpecificProfile = createDefaultCamcorderQcifProfile(CAMCORDER_QUALITY_QCIF); } /*static*/ void MediaProfiles::createDefaultCamcorderHighProfiles( MediaProfiles::CamcorderProfile **highProfile, MediaProfiles::CamcorderProfile **highSpecificProfile) { *highProfile = createDefaultCamcorderCifProfile(CAMCORDER_QUALITY_HIGH); *highSpecificProfile = createDefaultCamcorderCifProfile(CAMCORDER_QUALITY_CIF); } /*static*/ void MediaProfiles::createDefaultCamcorderProfiles(MediaProfiles *profiles) { // low camcorder profiles. MediaProfiles::CamcorderProfile *lowProfile, *lowSpecificProfile; createDefaultCamcorderLowProfiles(&lowProfile, &lowSpecificProfile); profiles->mCamcorderProfiles.add(lowProfile); profiles->mCamcorderProfiles.add(lowSpecificProfile); // high camcorder profiles. MediaProfiles::CamcorderProfile* highProfile, *highSpecificProfile; createDefaultCamcorderHighProfiles(&highProfile, &highSpecificProfile); profiles->mCamcorderProfiles.add(highProfile); profiles->mCamcorderProfiles.add(highSpecificProfile); // low camcorder time lapse profiles. MediaProfiles::CamcorderProfile *lowTimeLapseProfile, *lowSpecificTimeLapseProfile; createDefaultCamcorderTimeLapseLowProfiles(&lowTimeLapseProfile, &lowSpecificTimeLapseProfile); profiles->mCamcorderProfiles.add(lowTimeLapseProfile); profiles->mCamcorderProfiles.add(lowSpecificTimeLapseProfile); // high camcorder time lapse profiles. MediaProfiles::CamcorderProfile *highTimeLapseProfile, *highSpecificTimeLapseProfile; createDefaultCamcorderTimeLapseHighProfiles(&highTimeLapseProfile, &highSpecificTimeLapseProfile); profiles->mCamcorderProfiles.add(highTimeLapseProfile); profiles->mCamcorderProfiles.add(highSpecificTimeLapseProfile); // For emulator and other legacy devices which does not have a // media_profiles.xml file, We assume that the default camera id // is 0 and that is the only camera available. profiles->mCameraIds.push(0); } /*static*/ void MediaProfiles::createDefaultAudioEncoders(MediaProfiles *profiles) { profiles->mAudioEncoders.add(createDefaultAmrNBEncoderCap()); #ifdef QCOM_HARDWARE profiles->mAudioEncoders.add(createDefaultAacEncoderCap()); profiles->mAudioEncoders.add(createDefaultLpcmEncoderCap()); #endif } /*static*/ void MediaProfiles::createDefaultVideoDecoders(MediaProfiles *profiles) { MediaProfiles::VideoDecoderCap *cap = new MediaProfiles::VideoDecoderCap(VIDEO_DECODER_WMV); profiles->mVideoDecoders.add(cap); } /*static*/ void MediaProfiles::createDefaultAudioDecoders(MediaProfiles *profiles) { MediaProfiles::AudioDecoderCap *cap = new MediaProfiles::AudioDecoderCap(AUDIO_DECODER_WMA); profiles->mAudioDecoders.add(cap); } /*static*/ void MediaProfiles::createDefaultEncoderOutputFileFormats(MediaProfiles *profiles) { profiles->mEncoderOutputFileFormats.add(OUTPUT_FORMAT_THREE_GPP); profiles->mEncoderOutputFileFormats.add(OUTPUT_FORMAT_MPEG_4); } /*static*/ MediaProfiles::AudioEncoderCap* MediaProfiles::createDefaultAmrNBEncoderCap() { return new MediaProfiles::AudioEncoderCap( AUDIO_ENCODER_AMR_NB, 5525, 12200, 8000, 8000, 1, 1); } #ifdef QCOM_HARDWARE /*static*/ MediaProfiles::AudioEncoderCap* MediaProfiles::createDefaultAacEncoderCap() { return new MediaProfiles::AudioEncoderCap( AUDIO_ENCODER_AAC, 64000, 156000, 8000, 48000, 1, 2); } /*static*/ MediaProfiles::AudioEncoderCap* MediaProfiles::createDefaultLpcmEncoderCap() { return new MediaProfiles::AudioEncoderCap( AUDIO_ENCODER_LPCM, 768000, 4608000, 48000, 48000, 1, 6); } #endif /*static*/ void MediaProfiles::createDefaultImageEncodingQualityLevels(MediaProfiles *profiles) { ImageEncodingQualityLevels *levels = new ImageEncodingQualityLevels(); levels->mCameraId = 0; levels->mLevels.add(70); levels->mLevels.add(80); levels->mLevels.add(90); profiles->mImageEncodingQualityLevels.add(levels); } /*static*/ void MediaProfiles::createDefaultVideoEditorCap(MediaProfiles *profiles) { profiles->mVideoEditorCap = new MediaProfiles::VideoEditorCap( VIDEOEDITOR_DEFAULT_MAX_INPUT_FRAME_WIDTH, VIDEOEDITOR_DEFUALT_MAX_INPUT_FRAME_HEIGHT, VIDEOEDITOR_DEFAULT_MAX_OUTPUT_FRAME_WIDTH, VIDEOEDITOR_DEFUALT_MAX_OUTPUT_FRAME_HEIGHT, VIDEOEDITOR_DEFAULT_MAX_PREFETCH_YUV_FRAMES); } /*static*/ void MediaProfiles::createDefaultExportVideoProfiles(MediaProfiles *profiles) { // Create default video export profiles profiles->mVideoEditorExportProfiles.add( new ExportVideoProfile(VIDEO_ENCODER_H263, OMX_VIDEO_H263ProfileBaseline, OMX_VIDEO_H263Level10)); profiles->mVideoEditorExportProfiles.add( new ExportVideoProfile(VIDEO_ENCODER_MPEG_4_SP, OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level1)); profiles->mVideoEditorExportProfiles.add( new ExportVideoProfile(VIDEO_ENCODER_H264, OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel13)); } /*static*/ MediaProfiles* MediaProfiles::createDefaultInstance() { MediaProfiles *profiles = new MediaProfiles; createDefaultCamcorderProfiles(profiles); createDefaultVideoEncoders(profiles); createDefaultAudioEncoders(profiles); createDefaultVideoDecoders(profiles); createDefaultAudioDecoders(profiles); createDefaultEncoderOutputFileFormats(profiles); createDefaultImageEncodingQualityLevels(profiles); createDefaultVideoEditorCap(profiles); createDefaultExportVideoProfiles(profiles); return profiles; } /*static*/ MediaProfiles* MediaProfiles::createInstanceFromXmlFile(const char *xml) { FILE *fp = NULL; CHECK((fp = fopen(xml, "r"))); XML_Parser parser = ::XML_ParserCreate(NULL); CHECK(parser != NULL); MediaProfiles *profiles = new MediaProfiles(); ::XML_SetUserData(parser, profiles); ::XML_SetElementHandler(parser, startElementHandler, NULL); /* FIXME: expat is not compiled with -DXML_DTD. We don't have DTD parsing support. if (!::XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS)) { ALOGE("failed to enable DTD support in the xml file"); return UNKNOWN_ERROR; } */ const int BUFF_SIZE = 512; for (;;) { void *buff = ::XML_GetBuffer(parser, BUFF_SIZE); if (buff == NULL) { ALOGE("failed to in call to XML_GetBuffer()"); delete profiles; profiles = NULL; goto exit; } int bytes_read = ::fread(buff, 1, BUFF_SIZE, fp); if (bytes_read < 0) { ALOGE("failed in call to read"); delete profiles; profiles = NULL; goto exit; } CHECK(::XML_ParseBuffer(parser, bytes_read, bytes_read == 0)); if (bytes_read == 0) break; // done parsing the xml file } exit: ::XML_ParserFree(parser); ::fclose(fp); return profiles; } Vector MediaProfiles::getOutputFileFormats() const { return mEncoderOutputFileFormats; // copy out } Vector MediaProfiles::getVideoEncoders() const { Vector encoders; for (size_t i = 0; i < mVideoEncoders.size(); ++i) { encoders.add(mVideoEncoders[i]->mCodec); } return encoders; // copy out } int MediaProfiles::getVideoEncoderParamByName(const char *name, video_encoder codec) const { ALOGV("getVideoEncoderParamByName: %s for codec %d", name, codec); int index = -1; for (size_t i = 0, n = mVideoEncoders.size(); i < n; ++i) { if (mVideoEncoders[i]->mCodec == codec) { index = i; break; } } if (index == -1) { ALOGE("The given video encoder %d is not found", codec); return -1; } if (!strcmp("enc.vid.width.min", name)) return mVideoEncoders[index]->mMinFrameWidth; if (!strcmp("enc.vid.width.max", name)) return mVideoEncoders[index]->mMaxFrameWidth; if (!strcmp("enc.vid.height.min", name)) return mVideoEncoders[index]->mMinFrameHeight; if (!strcmp("enc.vid.height.max", name)) return mVideoEncoders[index]->mMaxFrameHeight; if (!strcmp("enc.vid.bps.min", name)) return mVideoEncoders[index]->mMinBitRate; if (!strcmp("enc.vid.bps.max", name)) return mVideoEncoders[index]->mMaxBitRate; if (!strcmp("enc.vid.fps.min", name)) return mVideoEncoders[index]->mMinFrameRate; if (!strcmp("enc.vid.fps.max", name)) return mVideoEncoders[index]->mMaxFrameRate; ALOGE("The given video encoder param name %s is not found", name); return -1; } int MediaProfiles::getVideoEditorExportParamByName( const char *name, int codec) const { ALOGV("getVideoEditorExportParamByName: name %s codec %d", name, codec); ExportVideoProfile *exportProfile = NULL; int index = -1; for (size_t i =0; i < mVideoEditorExportProfiles.size(); i++) { exportProfile = mVideoEditorExportProfiles[i]; if (exportProfile->mCodec == codec) { index = i; break; } } if (index == -1) { ALOGE("The given video decoder %d is not found", codec); return -1; } if (!strcmp("videoeditor.export.profile", name)) return exportProfile->mProfile; if (!strcmp("videoeditor.export.level", name)) return exportProfile->mLevel; ALOGE("The given video editor export param name %s is not found", name); return -1; } int MediaProfiles::getVideoEditorCapParamByName(const char *name) const { ALOGV("getVideoEditorCapParamByName: %s", name); if (mVideoEditorCap == NULL) { ALOGE("The mVideoEditorCap is not created, then create default cap."); createDefaultVideoEditorCap(sInstance); } if (!strcmp("videoeditor.input.width.max", name)) return mVideoEditorCap->mMaxInputFrameWidth; if (!strcmp("videoeditor.input.height.max", name)) return mVideoEditorCap->mMaxInputFrameHeight; if (!strcmp("videoeditor.output.width.max", name)) return mVideoEditorCap->mMaxOutputFrameWidth; if (!strcmp("videoeditor.output.height.max", name)) return mVideoEditorCap->mMaxOutputFrameHeight; if (!strcmp("maxPrefetchYUVFrames", name)) return mVideoEditorCap->mMaxPrefetchYUVFrames; ALOGE("The given video editor param name %s is not found", name); return -1; } Vector MediaProfiles::getAudioEncoders() const { Vector encoders; for (size_t i = 0; i < mAudioEncoders.size(); ++i) { encoders.add(mAudioEncoders[i]->mCodec); } return encoders; // copy out } int MediaProfiles::getAudioEncoderParamByName(const char *name, audio_encoder codec) const { ALOGV("getAudioEncoderParamByName: %s for codec %d", name, codec); int index = -1; for (size_t i = 0, n = mAudioEncoders.size(); i < n; ++i) { if (mAudioEncoders[i]->mCodec == codec) { index = i; break; } } if (index == -1) { ALOGE("The given audio encoder %d is not found", codec); return -1; } if (!strcmp("enc.aud.ch.min", name)) return mAudioEncoders[index]->mMinChannels; if (!strcmp("enc.aud.ch.max", name)) return mAudioEncoders[index]->mMaxChannels; if (!strcmp("enc.aud.bps.min", name)) return mAudioEncoders[index]->mMinBitRate; if (!strcmp("enc.aud.bps.max", name)) return mAudioEncoders[index]->mMaxBitRate; if (!strcmp("enc.aud.hz.min", name)) return mAudioEncoders[index]->mMinSampleRate; if (!strcmp("enc.aud.hz.max", name)) return mAudioEncoders[index]->mMaxSampleRate; ALOGE("The given audio encoder param name %s is not found", name); return -1; } Vector MediaProfiles::getVideoDecoders() const { Vector decoders; for (size_t i = 0; i < mVideoDecoders.size(); ++i) { decoders.add(mVideoDecoders[i]->mCodec); } return decoders; // copy out } Vector MediaProfiles::getAudioDecoders() const { Vector decoders; for (size_t i = 0; i < mAudioDecoders.size(); ++i) { decoders.add(mAudioDecoders[i]->mCodec); } return decoders; // copy out } int MediaProfiles::getCamcorderProfileIndex(int cameraId, camcorder_quality quality) const { int index = -1; for (size_t i = 0, n = mCamcorderProfiles.size(); i < n; ++i) { if (mCamcorderProfiles[i]->mCameraId == cameraId && mCamcorderProfiles[i]->mQuality == quality) { index = i; break; } } return index; } int MediaProfiles::getCamcorderProfileParamByName(const char *name, int cameraId, camcorder_quality quality) const { ALOGV("getCamcorderProfileParamByName: %s for camera %d, quality %d", name, cameraId, quality); int index = getCamcorderProfileIndex(cameraId, quality); if (index == -1) { ALOGE("The given camcorder profile camera %d quality %d is not found", cameraId, quality); return -1; } if (!strcmp("duration", name)) return mCamcorderProfiles[index]->mDuration; if (!strcmp("file.format", name)) return mCamcorderProfiles[index]->mFileFormat; if (!strcmp("vid.codec", name)) return mCamcorderProfiles[index]->mVideoCodec->mCodec; if (!strcmp("vid.width", name)) return mCamcorderProfiles[index]->mVideoCodec->mFrameWidth; if (!strcmp("vid.height", name)) return mCamcorderProfiles[index]->mVideoCodec->mFrameHeight; if (!strcmp("vid.bps", name)) return mCamcorderProfiles[index]->mVideoCodec->mBitRate; if (!strcmp("vid.fps", name)) return mCamcorderProfiles[index]->mVideoCodec->mFrameRate; if (!strcmp("aud.codec", name)) return mCamcorderProfiles[index]->mAudioCodec->mCodec; if (!strcmp("aud.bps", name)) return mCamcorderProfiles[index]->mAudioCodec->mBitRate; if (!strcmp("aud.ch", name)) return mCamcorderProfiles[index]->mAudioCodec->mChannels; if (!strcmp("aud.hz", name)) return mCamcorderProfiles[index]->mAudioCodec->mSampleRate; ALOGE("The given camcorder profile param id %d name %s is not found", cameraId, name); return -1; } bool MediaProfiles::hasCamcorderProfile(int cameraId, camcorder_quality quality) const { return (getCamcorderProfileIndex(cameraId, quality) != -1); } Vector MediaProfiles::getImageEncodingQualityLevels(int cameraId) const { Vector result; ImageEncodingQualityLevels *levels = findImageEncodingQualityLevels(cameraId); if (levels != NULL) { result = levels->mLevels; // copy out } return result; } int MediaProfiles::getStartTimeOffsetMs(int cameraId) const { int offsetTimeMs = -1; ssize_t index = mStartTimeOffsets.indexOfKey(cameraId); if (index >= 0) { offsetTimeMs = mStartTimeOffsets.valueFor(cameraId); } ALOGV("offsetTime=%d ms and cameraId=%d", offsetTimeMs, cameraId); return offsetTimeMs; } MediaProfiles::~MediaProfiles() { CHECK("destructor should never be called" == 0); #if 0 for (size_t i = 0; i < mAudioEncoders.size(); ++i) { delete mAudioEncoders[i]; } mAudioEncoders.clear(); for (size_t i = 0; i < mVideoEncoders.size(); ++i) { delete mVideoEncoders[i]; } mVideoEncoders.clear(); for (size_t i = 0; i < mVideoDecoders.size(); ++i) { delete mVideoDecoders[i]; } mVideoDecoders.clear(); for (size_t i = 0; i < mAudioDecoders.size(); ++i) { delete mAudioDecoders[i]; } mAudioDecoders.clear(); for (size_t i = 0; i < mCamcorderProfiles.size(); ++i) { delete mCamcorderProfiles[i]; } mCamcorderProfiles.clear(); #endif } } // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IDirectTrack.cpp0000644000015700001700000001177412200324306025234 0ustar pbuserpbgroup00000000000000/* ** Copyright (c) 2012, The Linux Foundation. All rights reserved. ** Not a Contribution, Apache license notifications and license are retained ** for attribution purposes only. ** ** Copyright 2007, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #define LOG_TAG "IDirectTrack" //#define LOG_NDEBUG 0 #include #include #include #include #include namespace android { enum { START = IBinder::FIRST_CALL_TRANSACTION, STOP, FLUSH, MUTE, PAUSE, SET_VOLUME, WRITE, GET_TIMESTAMP }; class BpDirectTrack : public BpInterface { public: BpDirectTrack(const sp& impl) : BpInterface(impl) { } virtual status_t start() { Parcel data, reply; data.writeInterfaceToken(IDirectTrack::getInterfaceDescriptor()); status_t status = remote()->transact(START, data, &reply); if (status == NO_ERROR) { status = reply.readInt32(); } else { ALOGW("start() error: %s", strerror(-status)); } return status; } virtual void stop() { Parcel data, reply; data.writeInterfaceToken(IDirectTrack::getInterfaceDescriptor()); remote()->transact(STOP, data, &reply); } virtual void flush() { Parcel data, reply; data.writeInterfaceToken(IDirectTrack::getInterfaceDescriptor()); remote()->transact(FLUSH, data, &reply); } virtual void mute(bool e) { Parcel data, reply; data.writeInterfaceToken(IDirectTrack::getInterfaceDescriptor()); data.writeInt32(e); remote()->transact(MUTE, data, &reply); } virtual void pause() { Parcel data, reply; data.writeInterfaceToken(IDirectTrack::getInterfaceDescriptor()); remote()->transact(PAUSE, data, &reply); } virtual void setVolume(float left, float right) { Parcel data, reply; data.writeInterfaceToken(IDirectTrack::getInterfaceDescriptor()); remote()->transact(SET_VOLUME, data, &reply); } virtual ssize_t write(const void* buffer, size_t bytes) { Parcel data, reply; data.writeInterfaceToken(IDirectTrack::getInterfaceDescriptor()); ssize_t bytesWritten = remote()->transact(WRITE, data, &reply); return bytesWritten; } virtual int64_t getTimeStamp() { Parcel data, reply; data.writeInterfaceToken(IDirectTrack::getInterfaceDescriptor()); int64_t tstamp = remote()->transact(GET_TIMESTAMP, data, &reply); return tstamp; } }; IMPLEMENT_META_INTERFACE(DirectTrack, "android.media.IDirectTrack"); // ---------------------------------------------------------------------- status_t BnDirectTrack::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch(code) { case START: { CHECK_INTERFACE(IDirectTrack, data, reply); reply->writeInt32(start()); return NO_ERROR; } break; case STOP: { CHECK_INTERFACE(IDirectTrack, data, reply); stop(); return NO_ERROR; } break; case FLUSH: { CHECK_INTERFACE(IDirectTrack, data, reply); flush(); return NO_ERROR; } break; case MUTE: { CHECK_INTERFACE(IDirectTrack, data, reply); mute( data.readInt32() ); return NO_ERROR; } break; case PAUSE: { CHECK_INTERFACE(IDirectTrack, data, reply); pause(); return NO_ERROR; } case SET_VOLUME: { CHECK_INTERFACE(IDirectTrack, data, reply); float left = 1.0; float right = 1.0; setVolume(left, right); return NO_ERROR; } case WRITE: { CHECK_INTERFACE(IDirectTrack, data, reply); const void *buffer = (void *)data.readInt32(); size_t bytes = data.readInt32(); ssize_t bytesWritten = write(buffer, bytes); reply->writeInt32(bytesWritten); return NO_ERROR; } case GET_TIMESTAMP: { CHECK_INTERFACE(IDirectTrack, data, reply); int64_t time = getTimeStamp(); reply->writeInt32(time); return NO_ERROR; } default: return BBinder::onTransact(code, data, reply, flags); } } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IStreamSource.cpp0000644000015700001700000001420312200324306025437 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "IStreamSource" #include #include #include #include #include namespace android { // static const char *const IStreamListener::kKeyResumeAtPTS = "resume-at-PTS"; // static const char *const IStreamListener::kKeyDiscontinuityMask = "discontinuity-mask"; enum { // IStreamSource SET_LISTENER = IBinder::FIRST_CALL_TRANSACTION, SET_BUFFERS, ON_BUFFER_AVAILABLE, FLAGS, // IStreamListener QUEUE_BUFFER, ISSUE_COMMAND, }; struct BpStreamSource : public BpInterface { BpStreamSource(const sp &impl) : BpInterface(impl) { } virtual void setListener(const sp &listener) { Parcel data, reply; data.writeInterfaceToken(IStreamSource::getInterfaceDescriptor()); data.writeStrongBinder(listener->asBinder()); remote()->transact(SET_LISTENER, data, &reply); } virtual void setBuffers(const Vector > &buffers) { Parcel data, reply; data.writeInterfaceToken(IStreamSource::getInterfaceDescriptor()); data.writeInt32(static_cast(buffers.size())); for (size_t i = 0; i < buffers.size(); ++i) { data.writeStrongBinder(buffers.itemAt(i)->asBinder()); } remote()->transact(SET_BUFFERS, data, &reply); } virtual void onBufferAvailable(size_t index) { Parcel data, reply; data.writeInterfaceToken(IStreamSource::getInterfaceDescriptor()); data.writeInt32(static_cast(index)); remote()->transact( ON_BUFFER_AVAILABLE, data, &reply, IBinder::FLAG_ONEWAY); } virtual uint32_t flags() const { Parcel data, reply; data.writeInterfaceToken(IStreamSource::getInterfaceDescriptor()); remote()->transact(FLAGS, data, &reply); return reply.readInt32(); } }; IMPLEMENT_META_INTERFACE(StreamSource, "android.hardware.IStreamSource"); status_t BnStreamSource::onTransact( uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) { switch (code) { case SET_LISTENER: { CHECK_INTERFACE(IStreamSource, data, reply); setListener( interface_cast(data.readStrongBinder())); break; } case SET_BUFFERS: { CHECK_INTERFACE(IStreamSource, data, reply); size_t n = static_cast(data.readInt32()); Vector > buffers; for (size_t i = 0; i < n; ++i) { sp mem = interface_cast(data.readStrongBinder()); buffers.push(mem); } setBuffers(buffers); break; } case ON_BUFFER_AVAILABLE: { CHECK_INTERFACE(IStreamSource, data, reply); onBufferAvailable(static_cast(data.readInt32())); break; } case FLAGS: { CHECK_INTERFACE(IStreamSource, data, reply); reply->writeInt32(this->flags()); break; } default: return BBinder::onTransact(code, data, reply, flags); } return OK; } //////////////////////////////////////////////////////////////////////////////// struct BpStreamListener : public BpInterface { BpStreamListener(const sp &impl) : BpInterface(impl) { } virtual void queueBuffer(size_t index, size_t size) { Parcel data, reply; data.writeInterfaceToken(IStreamListener::getInterfaceDescriptor()); data.writeInt32(static_cast(index)); data.writeInt32(static_cast(size)); remote()->transact(QUEUE_BUFFER, data, &reply, IBinder::FLAG_ONEWAY); } virtual void issueCommand( Command cmd, bool synchronous, const sp &msg) { Parcel data, reply; data.writeInterfaceToken(IStreamListener::getInterfaceDescriptor()); data.writeInt32(static_cast(cmd)); data.writeInt32(static_cast(synchronous)); if (msg != NULL) { data.writeInt32(1); msg->writeToParcel(&data); } else { data.writeInt32(0); } remote()->transact(ISSUE_COMMAND, data, &reply, IBinder::FLAG_ONEWAY); } }; IMPLEMENT_META_INTERFACE(StreamListener, "android.hardware.IStreamListener"); status_t BnStreamListener::onTransact( uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) { switch (code) { case QUEUE_BUFFER: { CHECK_INTERFACE(IStreamListener, data, reply); size_t index = static_cast(data.readInt32()); size_t size = static_cast(data.readInt32()); queueBuffer(index, size); break; } case ISSUE_COMMAND: { CHECK_INTERFACE(IStreamListener, data, reply); Command cmd = static_cast(data.readInt32()); bool synchronous = static_cast(data.readInt32()); sp msg; if (data.readInt32()) { msg = AMessage::FromParcel(data); } issueCommand(cmd, synchronous, msg); break; } default: return BBinder::onTransact(code, data, reply, flags); } return OK; } } // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/AudioParameter.cpp0000644000015700001700000001247312200324306025623 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006-2011 The Android Open Source Project * Copyright (c) 2012, The Linux Foundation. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "AudioParameter" //#define LOG_NDEBUG 0 #include #include #include namespace android { // static const char * const AudioParameter::keyRouting = AUDIO_PARAMETER_STREAM_ROUTING; const char * const AudioParameter::keySamplingRate = AUDIO_PARAMETER_STREAM_SAMPLING_RATE; const char * const AudioParameter::keyFormat = AUDIO_PARAMETER_STREAM_FORMAT; const char * const AudioParameter::keyChannels = AUDIO_PARAMETER_STREAM_CHANNELS; const char * const AudioParameter::keyFrameCount = AUDIO_PARAMETER_STREAM_FRAME_COUNT; const char * const AudioParameter::keyInputSource = AUDIO_PARAMETER_STREAM_INPUT_SOURCE; const char * const AudioParameter::keyScreenState = AUDIO_PARAMETER_KEY_SCREEN_STATE; #ifdef QCOM_HARDWARE const char * const AudioParameter::keyHandleFm = AUDIO_PARAMETER_KEY_HANDLE_FM; const char * const AudioParameter::keyVoipCheck = AUDIO_PARAMETER_KEY_VOIP_CHECK; const char * const AudioParameter::keyFluenceType = AUDIO_PARAMETER_KEY_FLUENCE_TYPE; const char * const AudioParameter::keySSR = AUDIO_PARAMETER_KEY_SSR; const char * const AudioParameter::keyHandleA2dpDevice = AUDIO_PARAMETER_KEY_HANDLE_A2DP_DEVICE; #endif AudioParameter::AudioParameter(const String8& keyValuePairs) { char *str = new char[keyValuePairs.length()+1]; mKeyValuePairs = keyValuePairs; strcpy(str, keyValuePairs.string()); char *pair = strtok(str, ";"); while (pair != NULL) { if (strlen(pair) != 0) { size_t eqIdx = strcspn(pair, "="); String8 key = String8(pair, eqIdx); String8 value; if (eqIdx == strlen(pair)) { value = String8(""); } else { value = String8(pair + eqIdx + 1); } if (mParameters.indexOfKey(key) < 0) { mParameters.add(key, value); } else { mParameters.replaceValueFor(key, value); } } else { ALOGV("AudioParameter() cstor empty key value pair"); } pair = strtok(NULL, ";"); } delete[] str; } AudioParameter::~AudioParameter() { mParameters.clear(); } String8 AudioParameter::toString() { String8 str = String8(""); size_t size = mParameters.size(); for (size_t i = 0; i < size; i++) { str += mParameters.keyAt(i); str += "="; str += mParameters.valueAt(i); if (i < (size - 1)) str += ";"; } return str; } status_t AudioParameter::add(const String8& key, const String8& value) { if (mParameters.indexOfKey(key) < 0) { mParameters.add(key, value); return NO_ERROR; } else { mParameters.replaceValueFor(key, value); return ALREADY_EXISTS; } } status_t AudioParameter::addInt(const String8& key, const int value) { char str[12]; if (snprintf(str, 12, "%d", value) > 0) { String8 str8 = String8(str); return add(key, str8); } else { return BAD_VALUE; } } status_t AudioParameter::addFloat(const String8& key, const float value) { char str[23]; if (snprintf(str, 23, "%.10f", value) > 0) { String8 str8 = String8(str); return add(key, str8); } else { return BAD_VALUE; } } status_t AudioParameter::remove(const String8& key) { if (mParameters.indexOfKey(key) >= 0) { mParameters.removeItem(key); return NO_ERROR; } else { return BAD_VALUE; } } status_t AudioParameter::get(const String8& key, String8& value) { if (mParameters.indexOfKey(key) >= 0) { value = mParameters.valueFor(key); return NO_ERROR; } else { return BAD_VALUE; } } status_t AudioParameter::getInt(const String8& key, int& value) { String8 str8; status_t result = get(key, str8); value = 0; if (result == NO_ERROR) { int val; if (sscanf(str8.string(), "%d", &val) == 1) { value = val; } else { result = INVALID_OPERATION; } } return result; } status_t AudioParameter::getFloat(const String8& key, float& value) { String8 str8; status_t result = get(key, str8); value = 0; if (result == NO_ERROR) { float val; if (sscanf(str8.string(), "%f", &val) == 1) { value = val; } else { result = INVALID_OPERATION; } } return result; } status_t AudioParameter::getAt(size_t index, String8& key, String8& value) { if (mParameters.size() > index) { key = mParameters.keyAt(index); value = mParameters.valueAt(index); return NO_ERROR; } else { return BAD_VALUE; } } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IEffect.cpp0000644000015700001700000001277712200324306024235 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2010, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "IEffect" #include #include #include #include #include namespace android { enum { ENABLE = IBinder::FIRST_CALL_TRANSACTION, DISABLE, COMMAND, DISCONNECT, GET_CBLK }; class BpEffect: public BpInterface { public: BpEffect(const sp& impl) : BpInterface(impl) { } status_t enable() { ALOGV("enable"); Parcel data, reply; data.writeInterfaceToken(IEffect::getInterfaceDescriptor()); remote()->transact(ENABLE, data, &reply); return reply.readInt32(); } status_t disable() { ALOGV("disable"); Parcel data, reply; data.writeInterfaceToken(IEffect::getInterfaceDescriptor()); remote()->transact(DISABLE, data, &reply); return reply.readInt32(); } status_t command(uint32_t cmdCode, uint32_t cmdSize, void *pCmdData, uint32_t *pReplySize, void *pReplyData) { ALOGV("command"); Parcel data, reply; data.writeInterfaceToken(IEffect::getInterfaceDescriptor()); data.writeInt32(cmdCode); int size = cmdSize; if (pCmdData == NULL) { size = 0; } data.writeInt32(size); if (size) { data.write(pCmdData, size); } if (pReplySize == NULL) { size = 0; } else { size = *pReplySize; } data.writeInt32(size); status_t status = remote()->transact(COMMAND, data, &reply); if (status != NO_ERROR) { if (pReplySize != NULL) *pReplySize = 0; return status; } status = reply.readInt32(); size = reply.readInt32(); if (size != 0 && pReplyData != NULL && pReplySize != NULL) { reply.read(pReplyData, size); *pReplySize = size; } return status; } void disconnect() { ALOGV("disconnect"); Parcel data, reply; data.writeInterfaceToken(IEffect::getInterfaceDescriptor()); remote()->transact(DISCONNECT, data, &reply); return; } virtual sp getCblk() const { Parcel data, reply; sp cblk; data.writeInterfaceToken(IEffect::getInterfaceDescriptor()); status_t status = remote()->transact(GET_CBLK, data, &reply); if (status == NO_ERROR) { cblk = interface_cast(reply.readStrongBinder()); } return cblk; } }; IMPLEMENT_META_INTERFACE(Effect, "android.media.IEffect"); // ---------------------------------------------------------------------- status_t BnEffect::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case ENABLE: { ALOGV("ENABLE"); CHECK_INTERFACE(IEffect, data, reply); reply->writeInt32(enable()); return NO_ERROR; } break; case DISABLE: { ALOGV("DISABLE"); CHECK_INTERFACE(IEffect, data, reply); reply->writeInt32(disable()); return NO_ERROR; } break; case COMMAND: { ALOGV("COMMAND"); CHECK_INTERFACE(IEffect, data, reply); uint32_t cmdCode = data.readInt32(); uint32_t cmdSize = data.readInt32(); char *cmd = NULL; if (cmdSize) { cmd = (char *)malloc(cmdSize); data.read(cmd, cmdSize); } uint32_t replySize = data.readInt32(); uint32_t replySz = replySize; char *resp = NULL; if (replySize) { resp = (char *)malloc(replySize); } status_t status = command(cmdCode, cmdSize, cmd, &replySz, resp); reply->writeInt32(status); if (replySz < replySize) { replySize = replySz; } reply->writeInt32(replySize); if (replySize) { reply->write(resp, replySize); } if (cmd) { free(cmd); } if (resp) { free(resp); } return NO_ERROR; } break; case DISCONNECT: { ALOGV("DISCONNECT"); CHECK_INTERFACE(IEffect, data, reply); disconnect(); return NO_ERROR; } break; case GET_CBLK: { CHECK_INTERFACE(IEffect, data, reply); reply->writeStrongBinder(getCblk()->asBinder()); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } } // ---------------------------------------------------------------------------- }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/ICrypto.cpp0000644000015700001700000002007512200324306024307 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "ICrypto" #include #include #include #include #include #include namespace android { enum { INIT_CHECK = IBinder::FIRST_CALL_TRANSACTION, IS_CRYPTO_SUPPORTED, CREATE_PLUGIN, DESTROY_PLUGIN, REQUIRES_SECURE_COMPONENT, DECRYPT, }; struct BpCrypto : public BpInterface { BpCrypto(const sp &impl) : BpInterface(impl) { } virtual status_t initCheck() const { Parcel data, reply; data.writeInterfaceToken(ICrypto::getInterfaceDescriptor()); remote()->transact(INIT_CHECK, data, &reply); return reply.readInt32(); } virtual bool isCryptoSchemeSupported(const uint8_t uuid[16]) const { Parcel data, reply; data.writeInterfaceToken(ICrypto::getInterfaceDescriptor()); data.write(uuid, 16); remote()->transact(IS_CRYPTO_SUPPORTED, data, &reply); return reply.readInt32() != 0; } virtual status_t createPlugin( const uint8_t uuid[16], const void *opaqueData, size_t opaqueSize) { Parcel data, reply; data.writeInterfaceToken(ICrypto::getInterfaceDescriptor()); data.write(uuid, 16); data.writeInt32(opaqueSize); if (opaqueSize > 0) { data.write(opaqueData, opaqueSize); } remote()->transact(CREATE_PLUGIN, data, &reply); return reply.readInt32(); } virtual status_t destroyPlugin() { Parcel data, reply; data.writeInterfaceToken(ICrypto::getInterfaceDescriptor()); remote()->transact(DESTROY_PLUGIN, data, &reply); return reply.readInt32(); } virtual bool requiresSecureDecoderComponent( const char *mime) const { Parcel data, reply; data.writeInterfaceToken(ICrypto::getInterfaceDescriptor()); data.writeCString(mime); remote()->transact(REQUIRES_SECURE_COMPONENT, data, &reply); return reply.readInt32() != 0; } virtual ssize_t decrypt( bool secure, const uint8_t key[16], const uint8_t iv[16], CryptoPlugin::Mode mode, const void *srcPtr, const CryptoPlugin::SubSample *subSamples, size_t numSubSamples, void *dstPtr, AString *errorDetailMsg) { Parcel data, reply; data.writeInterfaceToken(ICrypto::getInterfaceDescriptor()); data.writeInt32(secure); data.writeInt32(mode); static const uint8_t kDummy[16] = { 0 }; if (key == NULL) { key = kDummy; } if (iv == NULL) { iv = kDummy; } data.write(key, 16); data.write(iv, 16); size_t totalSize = 0; for (size_t i = 0; i < numSubSamples; ++i) { totalSize += subSamples[i].mNumBytesOfEncryptedData; totalSize += subSamples[i].mNumBytesOfClearData; } data.writeInt32(totalSize); data.write(srcPtr, totalSize); data.writeInt32(numSubSamples); data.write(subSamples, sizeof(CryptoPlugin::SubSample) * numSubSamples); if (secure) { data.writeIntPtr((intptr_t)dstPtr); } remote()->transact(DECRYPT, data, &reply); ssize_t result = reply.readInt32(); if (result >= ERROR_DRM_VENDOR_MIN && result <= ERROR_DRM_VENDOR_MAX) { errorDetailMsg->setTo(reply.readCString()); } if (!secure && result >= 0) { reply.read(dstPtr, result); } return result; } private: DISALLOW_EVIL_CONSTRUCTORS(BpCrypto); }; IMPLEMENT_META_INTERFACE(Crypto, "android.hardware.ICrypto"); //////////////////////////////////////////////////////////////////////////////// status_t BnCrypto::onTransact( uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) { switch (code) { case INIT_CHECK: { CHECK_INTERFACE(ICrypto, data, reply); reply->writeInt32(initCheck()); return OK; } case IS_CRYPTO_SUPPORTED: { CHECK_INTERFACE(ICrypto, data, reply); uint8_t uuid[16]; data.read(uuid, sizeof(uuid)); reply->writeInt32(isCryptoSchemeSupported(uuid)); return OK; } case CREATE_PLUGIN: { CHECK_INTERFACE(ICrypto, data, reply); uint8_t uuid[16]; data.read(uuid, sizeof(uuid)); size_t opaqueSize = data.readInt32(); void *opaqueData = NULL; if (opaqueSize > 0) { opaqueData = malloc(opaqueSize); data.read(opaqueData, opaqueSize); } reply->writeInt32(createPlugin(uuid, opaqueData, opaqueSize)); if (opaqueData != NULL) { free(opaqueData); opaqueData = NULL; } return OK; } case DESTROY_PLUGIN: { CHECK_INTERFACE(ICrypto, data, reply); reply->writeInt32(destroyPlugin()); return OK; } case REQUIRES_SECURE_COMPONENT: { CHECK_INTERFACE(ICrypto, data, reply); const char *mime = data.readCString(); reply->writeInt32(requiresSecureDecoderComponent(mime)); return OK; } case DECRYPT: { CHECK_INTERFACE(ICrypto, data, reply); bool secure = data.readInt32() != 0; CryptoPlugin::Mode mode = (CryptoPlugin::Mode)data.readInt32(); uint8_t key[16]; data.read(key, sizeof(key)); uint8_t iv[16]; data.read(iv, sizeof(iv)); size_t totalSize = data.readInt32(); void *srcData = malloc(totalSize); data.read(srcData, totalSize); int32_t numSubSamples = data.readInt32(); CryptoPlugin::SubSample *subSamples = new CryptoPlugin::SubSample[numSubSamples]; data.read( subSamples, sizeof(CryptoPlugin::SubSample) * numSubSamples); void *dstPtr; if (secure) { dstPtr = (void *)data.readIntPtr(); } else { dstPtr = malloc(totalSize); } AString errorDetailMsg; ssize_t result = decrypt( secure, key, iv, mode, srcData, subSamples, numSubSamples, dstPtr, &errorDetailMsg); reply->writeInt32(result); if (result >= ERROR_DRM_VENDOR_MIN && result <= ERROR_DRM_VENDOR_MAX) { reply->writeCString(errorDetailMsg.c_str()); } if (!secure) { if (result >= 0) { CHECK_LE(result, static_cast(totalSize)); reply->write(dstPtr, result); } free(dstPtr); dstPtr = NULL; } delete[] subSamples; subSamples = NULL; free(srcData); srcData = NULL; return OK; } default: return BBinder::onTransact(code, data, reply, flags); } } } // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/IAudioTrack.cpp0000644000015700001700000001713612200324306025061 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2007, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ #define LOG_TAG "IAudioTrack" //#define LOG_NDEBUG 0 #include #include #include #include #include namespace android { enum { GET_CBLK = IBinder::FIRST_CALL_TRANSACTION, START, STOP, FLUSH, MUTE, PAUSE, ATTACH_AUX_EFFECT, ALLOCATE_TIMED_BUFFER, QUEUE_TIMED_BUFFER, SET_MEDIA_TIME_TRANSFORM, }; class BpAudioTrack : public BpInterface { public: BpAudioTrack(const sp& impl) : BpInterface(impl) { } virtual sp getCblk() const { Parcel data, reply; sp cblk; data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor()); status_t status = remote()->transact(GET_CBLK, data, &reply); if (status == NO_ERROR) { cblk = interface_cast(reply.readStrongBinder()); } return cblk; } virtual status_t start() { Parcel data, reply; data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor()); status_t status = remote()->transact(START, data, &reply); if (status == NO_ERROR) { status = reply.readInt32(); } else { ALOGW("start() error: %s", strerror(-status)); } return status; } virtual void stop() { Parcel data, reply; data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor()); remote()->transact(STOP, data, &reply); } virtual void flush() { Parcel data, reply; data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor()); remote()->transact(FLUSH, data, &reply); } virtual void mute(bool e) { Parcel data, reply; data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor()); data.writeInt32(e); remote()->transact(MUTE, data, &reply); } virtual void pause() { Parcel data, reply; data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor()); remote()->transact(PAUSE, data, &reply); } virtual status_t attachAuxEffect(int effectId) { Parcel data, reply; data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor()); data.writeInt32(effectId); status_t status = remote()->transact(ATTACH_AUX_EFFECT, data, &reply); if (status == NO_ERROR) { status = reply.readInt32(); } else { ALOGW("attachAuxEffect() error: %s", strerror(-status)); } return status; } virtual status_t allocateTimedBuffer(size_t size, sp* buffer) { Parcel data, reply; data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor()); data.writeInt32(size); status_t status = remote()->transact(ALLOCATE_TIMED_BUFFER, data, &reply); if (status == NO_ERROR) { status = reply.readInt32(); if (status == NO_ERROR) { *buffer = interface_cast(reply.readStrongBinder()); } } return status; } virtual status_t queueTimedBuffer(const sp& buffer, int64_t pts) { Parcel data, reply; data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor()); data.writeStrongBinder(buffer->asBinder()); data.writeInt64(pts); status_t status = remote()->transact(QUEUE_TIMED_BUFFER, data, &reply); if (status == NO_ERROR) { status = reply.readInt32(); } return status; } virtual status_t setMediaTimeTransform(const LinearTransform& xform, int target) { Parcel data, reply; data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor()); data.writeInt64(xform.a_zero); data.writeInt64(xform.b_zero); data.writeInt32(xform.a_to_b_numer); data.writeInt32(xform.a_to_b_denom); data.writeInt32(target); status_t status = remote()->transact(SET_MEDIA_TIME_TRANSFORM, data, &reply); if (status == NO_ERROR) { status = reply.readInt32(); } return status; } }; IMPLEMENT_META_INTERFACE(AudioTrack, "android.media.IAudioTrack"); // ---------------------------------------------------------------------- status_t BnAudioTrack::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case GET_CBLK: { CHECK_INTERFACE(IAudioTrack, data, reply); reply->writeStrongBinder(getCblk()->asBinder()); return NO_ERROR; } break; case START: { CHECK_INTERFACE(IAudioTrack, data, reply); reply->writeInt32(start()); return NO_ERROR; } break; case STOP: { CHECK_INTERFACE(IAudioTrack, data, reply); stop(); return NO_ERROR; } break; case FLUSH: { CHECK_INTERFACE(IAudioTrack, data, reply); flush(); return NO_ERROR; } break; case MUTE: { CHECK_INTERFACE(IAudioTrack, data, reply); mute( data.readInt32() ); return NO_ERROR; } break; case PAUSE: { CHECK_INTERFACE(IAudioTrack, data, reply); pause(); return NO_ERROR; } case ATTACH_AUX_EFFECT: { CHECK_INTERFACE(IAudioTrack, data, reply); reply->writeInt32(attachAuxEffect(data.readInt32())); return NO_ERROR; } break; case ALLOCATE_TIMED_BUFFER: { CHECK_INTERFACE(IAudioTrack, data, reply); sp buffer; status_t status = allocateTimedBuffer(data.readInt32(), &buffer); reply->writeInt32(status); if (status == NO_ERROR) { reply->writeStrongBinder(buffer->asBinder()); } return NO_ERROR; } break; case QUEUE_TIMED_BUFFER: { CHECK_INTERFACE(IAudioTrack, data, reply); sp buffer = interface_cast( data.readStrongBinder()); uint64_t pts = data.readInt64(); reply->writeInt32(queueTimedBuffer(buffer, pts)); return NO_ERROR; } break; case SET_MEDIA_TIME_TRANSFORM: { CHECK_INTERFACE(IAudioTrack, data, reply); LinearTransform xform; xform.a_zero = data.readInt64(); xform.b_zero = data.readInt64(); xform.a_to_b_numer = data.readInt32(); xform.a_to_b_denom = data.readInt32(); int target = data.readInt32(); reply->writeInt32(setMediaTimeTransform(xform, target)); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/mediametadataretriever.cpp0000644000015700001700000001205612200324306027426 0ustar pbuserpbgroup00000000000000/* ** ** Copyright 2008, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "MediaMetadataRetriever" #include #include #include #include #include #include namespace android { // client singleton for binder interface to service Mutex MediaMetadataRetriever::sServiceLock; sp MediaMetadataRetriever::sService; sp MediaMetadataRetriever::sDeathNotifier; const sp& MediaMetadataRetriever::getService() { Mutex::Autolock lock(sServiceLock); if (sService == 0) { sp sm = defaultServiceManager(); sp binder; do { binder = sm->getService(String16("media.player")); if (binder != 0) { break; } ALOGW("MediaPlayerService not published, waiting..."); usleep(500000); // 0.5 s } while (true); if (sDeathNotifier == NULL) { sDeathNotifier = new DeathNotifier(); } binder->linkToDeath(sDeathNotifier); sService = interface_cast(binder); } ALOGE_IF(sService == 0, "no MediaPlayerService!?"); return sService; } MediaMetadataRetriever::MediaMetadataRetriever() { ALOGV("constructor"); const sp& service(getService()); if (service == 0) { ALOGE("failed to obtain MediaMetadataRetrieverService"); return; } sp retriever(service->createMetadataRetriever(getpid())); if (retriever == 0) { ALOGE("failed to create IMediaMetadataRetriever object from server"); } mRetriever = retriever; } MediaMetadataRetriever::~MediaMetadataRetriever() { ALOGV("destructor"); disconnect(); IPCThreadState::self()->flushCommands(); } void MediaMetadataRetriever::disconnect() { ALOGV("disconnect"); sp retriever; { Mutex::Autolock _l(mLock); retriever = mRetriever; mRetriever.clear(); } if (retriever != 0) { retriever->disconnect(); } } status_t MediaMetadataRetriever::setDataSource( const char *srcUrl, const KeyedVector *headers) { ALOGV("setDataSource"); Mutex::Autolock _l(mLock); if (mRetriever == 0) { ALOGE("retriever is not initialized"); return INVALID_OPERATION; } if (srcUrl == NULL) { ALOGE("data source is a null pointer"); return UNKNOWN_ERROR; } ALOGV("data source (%s)", srcUrl); return mRetriever->setDataSource(srcUrl, headers); } status_t MediaMetadataRetriever::setDataSource(int fd, int64_t offset, int64_t length) { ALOGV("setDataSource(%d, %lld, %lld)", fd, offset, length); Mutex::Autolock _l(mLock); if (mRetriever == 0) { ALOGE("retriever is not initialized"); return INVALID_OPERATION; } if (fd < 0 || offset < 0 || length < 0) { ALOGE("Invalid negative argument"); return UNKNOWN_ERROR; } return mRetriever->setDataSource(fd, offset, length); } sp MediaMetadataRetriever::getFrameAtTime(int64_t timeUs, int option) { ALOGV("getFrameAtTime: time(%lld us) option(%d)", timeUs, option); Mutex::Autolock _l(mLock); if (mRetriever == 0) { ALOGE("retriever is not initialized"); return NULL; } return mRetriever->getFrameAtTime(timeUs, option); } const char* MediaMetadataRetriever::extractMetadata(int keyCode) { ALOGV("extractMetadata(%d)", keyCode); Mutex::Autolock _l(mLock); if (mRetriever == 0) { ALOGE("retriever is not initialized"); return NULL; } return mRetriever->extractMetadata(keyCode); } sp MediaMetadataRetriever::extractAlbumArt() { ALOGV("extractAlbumArt"); Mutex::Autolock _l(mLock); if (mRetriever == 0) { ALOGE("retriever is not initialized"); return NULL; } return mRetriever->extractAlbumArt(); } void MediaMetadataRetriever::DeathNotifier::binderDied(const wp& who) { Mutex::Autolock lock(MediaMetadataRetriever::sServiceLock); MediaMetadataRetriever::sService.clear(); ALOGW("MediaMetadataRetriever server died!"); } MediaMetadataRetriever::DeathNotifier::~DeathNotifier() { Mutex::Autolock lock(sServiceLock); if (sService != 0) { sService->asBinder()->unlinkToDeath(this); } } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/NOTICE0000644000015700001700000002470712200324306023124 0ustar pbuserpbgroup00000000000000 Copyright (c) 2005-2008, The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS android-audiosystem-1.8+13.10.20130807/lib/libmedia/SoundPoolThread.cpp0000644000015700001700000000574012200324306025772 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "SoundPoolThread" #include "utils/Log.h" #include "SoundPoolThread.h" namespace android { void SoundPoolThread::write(SoundPoolMsg msg) { Mutex::Autolock lock(&mLock); while (mMsgQueue.size() >= maxMessages) { mCondition.wait(mLock); } // if thread is quitting, don't add to queue if (mRunning) { mMsgQueue.push(msg); mCondition.signal(); } } const SoundPoolMsg SoundPoolThread::read() { Mutex::Autolock lock(&mLock); while (mMsgQueue.size() == 0) { mCondition.wait(mLock); } SoundPoolMsg msg = mMsgQueue[0]; mMsgQueue.removeAt(0); mCondition.signal(); return msg; } void SoundPoolThread::quit() { Mutex::Autolock lock(&mLock); if (mRunning) { mRunning = false; mMsgQueue.clear(); mMsgQueue.push(SoundPoolMsg(SoundPoolMsg::KILL, 0)); mCondition.signal(); mCondition.wait(mLock); } ALOGV("return from quit"); } SoundPoolThread::SoundPoolThread(SoundPool* soundPool) : mSoundPool(soundPool) { mMsgQueue.setCapacity(maxMessages); if (createThreadEtc(beginThread, this, "SoundPoolThread")) { mRunning = true; } } SoundPoolThread::~SoundPoolThread() { quit(); } int SoundPoolThread::beginThread(void* arg) { ALOGV("beginThread"); SoundPoolThread* soundPoolThread = (SoundPoolThread*)arg; return soundPoolThread->run(); } int SoundPoolThread::run() { ALOGV("run"); for (;;) { SoundPoolMsg msg = read(); ALOGV("Got message m=%d, mData=%d", msg.mMessageType, msg.mData); switch (msg.mMessageType) { case SoundPoolMsg::KILL: ALOGV("goodbye"); return NO_ERROR; case SoundPoolMsg::LOAD_SAMPLE: doLoadSample(msg.mData); break; default: ALOGW("run: Unrecognized message %d\n", msg.mMessageType); break; } } } void SoundPoolThread::loadSample(int sampleID) { write(SoundPoolMsg(SoundPoolMsg::LOAD_SAMPLE, sampleID)); } void SoundPoolThread::doLoadSample(int sampleID) { sp sample = mSoundPool->findSample(sampleID); status_t status = -1; if (sample != 0) { status = sample->doLoad(); } mSoundPool->notify(SoundPoolEvent(SoundPoolEvent::SAMPLE_LOADED, sampleID, status)); } } // end namespace android android-audiosystem-1.8+13.10.20130807/lib/libmedia/AudioSystem.cpp0000644000015700001700000006413612200324306025172 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2006-2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "AudioSystem" //#define LOG_NDEBUG 0 #include #include #include #include #include #include // ---------------------------------------------------------------------------- namespace android { // client singleton for AudioFlinger binder interface Mutex AudioSystem::gLock; sp AudioSystem::gAudioFlinger; sp AudioSystem::gAudioFlingerClient; audio_error_callback AudioSystem::gAudioErrorCallback = NULL; // Cached values DefaultKeyedVector AudioSystem::gOutputs(0); // Cached values for recording queries, all protected by gLock uint32_t AudioSystem::gPrevInSamplingRate = 16000; audio_format_t AudioSystem::gPrevInFormat = AUDIO_FORMAT_PCM_16_BIT; audio_channel_mask_t AudioSystem::gPrevInChannelMask = AUDIO_CHANNEL_IN_MONO; size_t AudioSystem::gInBuffSize = 0; // establish binder interface to AudioFlinger service const sp& AudioSystem::get_audio_flinger() { Mutex::Autolock _l(gLock); if (gAudioFlinger == 0) { sp sm = defaultServiceManager(); sp binder; do { binder = sm->getService(String16("media.audio_flinger")); if (binder != 0) break; ALOGW("AudioFlinger not published, waiting..."); usleep(500000); // 0.5 s } while (true); if (gAudioFlingerClient == NULL) { gAudioFlingerClient = new AudioFlingerClient(); } else { if (gAudioErrorCallback) { gAudioErrorCallback(NO_ERROR); } } binder->linkToDeath(gAudioFlingerClient); gAudioFlinger = interface_cast(binder); gAudioFlinger->registerClient(gAudioFlingerClient); } ALOGE_IF(gAudioFlinger==0, "no AudioFlinger!?"); return gAudioFlinger; } status_t AudioSystem::muteMicrophone(bool state) { const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; return af->setMicMute(state); } status_t AudioSystem::isMicrophoneMuted(bool* state) { const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; *state = af->getMicMute(); return NO_ERROR; } status_t AudioSystem::setMasterVolume(float value) { const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; af->setMasterVolume(value); return NO_ERROR; } status_t AudioSystem::setMasterMute(bool mute) { const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; af->setMasterMute(mute); return NO_ERROR; } status_t AudioSystem::getMasterVolume(float* volume) { const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; *volume = af->masterVolume(); return NO_ERROR; } status_t AudioSystem::getMasterMute(bool* mute) { const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; *mute = af->masterMute(); return NO_ERROR; } status_t AudioSystem::setStreamVolume(audio_stream_type_t stream, float value, audio_io_handle_t output) { if (uint32_t(stream) >= AUDIO_STREAM_CNT) return BAD_VALUE; const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; af->setStreamVolume(stream, value, output); return NO_ERROR; } status_t AudioSystem::setStreamMute(audio_stream_type_t stream, bool mute) { if (uint32_t(stream) >= AUDIO_STREAM_CNT) return BAD_VALUE; const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; af->setStreamMute(stream, mute); return NO_ERROR; } status_t AudioSystem::getStreamVolume(audio_stream_type_t stream, float* volume, audio_io_handle_t output) { if (uint32_t(stream) >= AUDIO_STREAM_CNT) return BAD_VALUE; const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; *volume = af->streamVolume(stream, output); return NO_ERROR; } status_t AudioSystem::getStreamMute(audio_stream_type_t stream, bool* mute) { if (uint32_t(stream) >= AUDIO_STREAM_CNT) return BAD_VALUE; const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; *mute = af->streamMute(stream); return NO_ERROR; } status_t AudioSystem::setMode(audio_mode_t mode) { if (uint32_t(mode) >= AUDIO_MODE_CNT) return BAD_VALUE; const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; return af->setMode(mode); } status_t AudioSystem::setParameters(audio_io_handle_t ioHandle, const String8& keyValuePairs) { const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; return af->setParameters(ioHandle, keyValuePairs); } String8 AudioSystem::getParameters(audio_io_handle_t ioHandle, const String8& keys) { const sp& af = AudioSystem::get_audio_flinger(); String8 result = String8(""); if (af == 0) return result; result = af->getParameters(ioHandle, keys); return result; } // convert volume steps to natural log scale // change this value to change volume scaling static const float dBPerStep = 0.5f; // shouldn't need to touch these static const float dBConvert = -dBPerStep * 2.302585093f / 20.0f; static const float dBConvertInverse = 1.0f / dBConvert; float AudioSystem::linearToLog(int volume) { // float v = volume ? exp(float(100 - volume) * dBConvert) : 0; // ALOGD("linearToLog(%d)=%f", volume, v); // return v; return volume ? exp(float(100 - volume) * dBConvert) : 0; } int AudioSystem::logToLinear(float volume) { // int v = volume ? 100 - int(dBConvertInverse * log(volume) + 0.5) : 0; // ALOGD("logTolinear(%d)=%f", v, volume); // return v; return volume ? 100 - int(dBConvertInverse * log(volume) + 0.5) : 0; } // DEPRECATED status_t AudioSystem::getOutputSamplingRate(int* samplingRate, int streamType) { return getOutputSamplingRate(samplingRate, (audio_stream_type_t)streamType); } status_t AudioSystem::getOutputSamplingRate(int* samplingRate, audio_stream_type_t streamType) { audio_io_handle_t output; if (streamType == AUDIO_STREAM_DEFAULT) { streamType = AUDIO_STREAM_MUSIC; } output = getOutput(streamType); if (output == 0) { return PERMISSION_DENIED; } return getSamplingRate(output, streamType, samplingRate); } status_t AudioSystem::getSamplingRate(audio_io_handle_t output, audio_stream_type_t streamType, int* samplingRate) { OutputDescriptor *outputDesc; gLock.lock(); outputDesc = AudioSystem::gOutputs.valueFor(output); if (outputDesc == NULL) { ALOGV("getOutputSamplingRate() no output descriptor for output %d in gOutputs", output); gLock.unlock(); const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; *samplingRate = af->sampleRate(output); } else { ALOGV("getOutputSamplingRate() reading from output desc"); *samplingRate = outputDesc->samplingRate; gLock.unlock(); } ALOGV("getSamplingRate() streamType %d, output %d, sampling rate %d", streamType, output, *samplingRate); return NO_ERROR; } // DEPRECATED status_t AudioSystem::getOutputFrameCount(int* frameCount, int streamType) { return getOutputFrameCount(frameCount, (audio_stream_type_t)streamType); } status_t AudioSystem::getOutputFrameCount(int* frameCount, audio_stream_type_t streamType) { audio_io_handle_t output; if (streamType == AUDIO_STREAM_DEFAULT) { streamType = AUDIO_STREAM_MUSIC; } output = getOutput(streamType); if (output == 0) { return PERMISSION_DENIED; } return getFrameCount(output, streamType, frameCount); } status_t AudioSystem::getFrameCount(audio_io_handle_t output, audio_stream_type_t streamType, int* frameCount) { OutputDescriptor *outputDesc; gLock.lock(); outputDesc = AudioSystem::gOutputs.valueFor(output); if (outputDesc == NULL) { gLock.unlock(); const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; *frameCount = af->frameCount(output); } else { *frameCount = outputDesc->frameCount; gLock.unlock(); } ALOGV("getFrameCount() streamType %d, output %d, frameCount %d", streamType, output, *frameCount); return NO_ERROR; } status_t AudioSystem::getOutputLatency(uint32_t* latency, audio_stream_type_t streamType) { audio_io_handle_t output; if (streamType == AUDIO_STREAM_DEFAULT) { streamType = AUDIO_STREAM_MUSIC; } output = getOutput(streamType); if (output == 0) { return PERMISSION_DENIED; } return getLatency(output, streamType, latency); } status_t AudioSystem::getLatency(audio_io_handle_t output, audio_stream_type_t streamType, uint32_t* latency) { OutputDescriptor *outputDesc; gLock.lock(); outputDesc = AudioSystem::gOutputs.valueFor(output); if (outputDesc == NULL) { gLock.unlock(); const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; *latency = af->latency(output); } else { *latency = outputDesc->latency; gLock.unlock(); } ALOGV("getLatency() streamType %d, output %d, latency %d", streamType, output, *latency); return NO_ERROR; } status_t AudioSystem::getInputBufferSize(uint32_t sampleRate, audio_format_t format, audio_channel_mask_t channelMask, size_t* buffSize) { gLock.lock(); // Do we have a stale gInBufferSize or are we requesting the input buffer size for new values size_t inBuffSize = gInBuffSize; if ((inBuffSize == 0) || (sampleRate != gPrevInSamplingRate) || (format != gPrevInFormat) || (channelMask != gPrevInChannelMask)) { gLock.unlock(); const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) { return PERMISSION_DENIED; } inBuffSize = af->getInputBufferSize(sampleRate, format, channelMask); gLock.lock(); // save the request params gPrevInSamplingRate = sampleRate; gPrevInFormat = format; gPrevInChannelMask = channelMask; gInBuffSize = inBuffSize; } gLock.unlock(); *buffSize = inBuffSize; return NO_ERROR; } status_t AudioSystem::setVoiceVolume(float value) { const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; return af->setVoiceVolume(value); } status_t AudioSystem::getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, audio_stream_type_t stream) { const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return PERMISSION_DENIED; if (stream == AUDIO_STREAM_DEFAULT) { stream = AUDIO_STREAM_MUSIC; } return af->getRenderPosition(halFrames, dspFrames, getOutput(stream)); } unsigned int AudioSystem::getInputFramesLost(audio_io_handle_t ioHandle) { const sp& af = AudioSystem::get_audio_flinger(); unsigned int result = 0; if (af == 0) return result; if (ioHandle == 0) return result; result = af->getInputFramesLost(ioHandle); return result; } int AudioSystem::newAudioSessionId() { const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return 0; return af->newAudioSessionId(); } void AudioSystem::acquireAudioSessionId(int audioSession) { const sp& af = AudioSystem::get_audio_flinger(); if (af != 0) { af->acquireAudioSessionId(audioSession); } } void AudioSystem::releaseAudioSessionId(int audioSession) { const sp& af = AudioSystem::get_audio_flinger(); if (af != 0) { af->releaseAudioSessionId(audioSession); } } // --------------------------------------------------------------------------- void AudioSystem::AudioFlingerClient::binderDied(const wp& who) { Mutex::Autolock _l(AudioSystem::gLock); AudioSystem::gAudioFlinger.clear(); // clear output handles and stream to output map caches AudioSystem::gOutputs.clear(); if (gAudioErrorCallback) { gAudioErrorCallback(DEAD_OBJECT); } ALOGW("AudioFlinger server died!"); } void AudioSystem::AudioFlingerClient::ioConfigChanged(int event, audio_io_handle_t ioHandle, const void *param2) { ALOGV("ioConfigChanged() event %d", event); const OutputDescriptor *desc; audio_stream_type_t stream; if (ioHandle == 0) return; Mutex::Autolock _l(AudioSystem::gLock); switch (event) { case STREAM_CONFIG_CHANGED: break; case OUTPUT_OPENED: { if (gOutputs.indexOfKey(ioHandle) >= 0) { ALOGV("ioConfigChanged() opening already existing output! %d", ioHandle); break; } if (param2 == NULL) break; desc = (const OutputDescriptor *)param2; OutputDescriptor *outputDesc = new OutputDescriptor(*desc); gOutputs.add(ioHandle, outputDesc); ALOGV("ioConfigChanged() new output samplingRate %d, format %d channels %#x frameCount %d latency %d", outputDesc->samplingRate, outputDesc->format, outputDesc->channels, outputDesc->frameCount, outputDesc->latency); } break; case OUTPUT_CLOSED: { if (gOutputs.indexOfKey(ioHandle) < 0) { ALOGW("ioConfigChanged() closing unknow output! %d", ioHandle); break; } ALOGV("ioConfigChanged() output %d closed", ioHandle); gOutputs.removeItem(ioHandle); } break; case OUTPUT_CONFIG_CHANGED: { int index = gOutputs.indexOfKey(ioHandle); if (index < 0) { ALOGW("ioConfigChanged() modifying unknow output! %d", ioHandle); break; } if (param2 == NULL) break; desc = (const OutputDescriptor *)param2; ALOGV("ioConfigChanged() new config for output %d samplingRate %d, format %d channels %#x frameCount %d latency %d", ioHandle, desc->samplingRate, desc->format, desc->channels, desc->frameCount, desc->latency); OutputDescriptor *outputDesc = gOutputs.valueAt(index); delete outputDesc; outputDesc = new OutputDescriptor(*desc); gOutputs.replaceValueFor(ioHandle, outputDesc); } break; case INPUT_OPENED: case INPUT_CLOSED: case INPUT_CONFIG_CHANGED: break; } } void AudioSystem::setErrorCallback(audio_error_callback cb) { Mutex::Autolock _l(gLock); gAudioErrorCallback = cb; } bool AudioSystem::routedToA2dpOutput(audio_stream_type_t streamType) { switch (streamType) { case AUDIO_STREAM_MUSIC: case AUDIO_STREAM_VOICE_CALL: case AUDIO_STREAM_BLUETOOTH_SCO: case AUDIO_STREAM_SYSTEM: return true; default: return false; } } // client singleton for AudioPolicyService binder interface sp AudioSystem::gAudioPolicyService; sp AudioSystem::gAudioPolicyServiceClient; // establish binder interface to AudioFlinger service const sp& AudioSystem::get_audio_policy_service() { gLock.lock(); if (gAudioPolicyService == 0) { sp sm = defaultServiceManager(); sp binder; do { binder = sm->getService(String16("media.audio_policy")); if (binder != 0) break; ALOGW("AudioPolicyService not published, waiting..."); usleep(500000); // 0.5 s } while (true); if (gAudioPolicyServiceClient == NULL) { gAudioPolicyServiceClient = new AudioPolicyServiceClient(); } binder->linkToDeath(gAudioPolicyServiceClient); gAudioPolicyService = interface_cast(binder); gLock.unlock(); } else { gLock.unlock(); } return gAudioPolicyService; } status_t AudioSystem::setDeviceConnectionState(audio_devices_t device, audio_policy_dev_state_t state, const char *device_address) { const sp& aps = AudioSystem::get_audio_policy_service(); const char *address = ""; if (aps == 0) return PERMISSION_DENIED; if (device_address != NULL) { address = device_address; } return aps->setDeviceConnectionState(device, state, address); } audio_policy_dev_state_t AudioSystem::getDeviceConnectionState(audio_devices_t device, const char *device_address) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE; return aps->getDeviceConnectionState(device, device_address); } extern "C" audio_policy_dev_state_t _ZN7android11AudioSystem24getDeviceConnectionStateE15audio_devices_tPKc(audio_devices_t device, const char *device_address) { return AudioSystem::getDeviceConnectionState(device, device_address); } status_t AudioSystem::setPhoneState(audio_mode_t state) { if (uint32_t(state) >= AUDIO_MODE_CNT) return BAD_VALUE; const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return PERMISSION_DENIED; return aps->setPhoneState(state); } status_t AudioSystem::setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return PERMISSION_DENIED; return aps->setForceUse(usage, config); } audio_policy_forced_cfg_t AudioSystem::getForceUse(audio_policy_force_use_t usage) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return AUDIO_POLICY_FORCE_NONE; return aps->getForceUse(usage); } audio_io_handle_t AudioSystem::getOutput(audio_stream_type_t stream, uint32_t samplingRate, audio_format_t format, audio_channel_mask_t channelMask, audio_output_flags_t flags) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return 0; return aps->getOutput(stream, samplingRate, format, channelMask, flags); } extern "C" audio_io_handle_t _ZN7android11AudioSystem9getOutputE19audio_stream_type_tjjj27audio_policy_output_flags_t(audio_stream_type_t stream, uint32_t samplingRate, uint32_t format, uint32_t channels, audio_output_flags_t flags) { return AudioSystem::getOutput(stream,samplingRate,(audio_format_t) format, channels, flags); } status_t AudioSystem::startOutput(audio_io_handle_t output, audio_stream_type_t stream, int session) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return PERMISSION_DENIED; return aps->startOutput(output, stream, session); } status_t AudioSystem::stopOutput(audio_io_handle_t output, audio_stream_type_t stream, int session) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return PERMISSION_DENIED; return aps->stopOutput(output, stream, session); } void AudioSystem::releaseOutput(audio_io_handle_t output) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return; aps->releaseOutput(output); } audio_io_handle_t AudioSystem::getInput(audio_source_t inputSource, uint32_t samplingRate, audio_format_t format, audio_channel_mask_t channelMask, int sessionId) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return 0; return aps->getInput(inputSource, samplingRate, format, channelMask, sessionId); } status_t AudioSystem::startInput(audio_io_handle_t input) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return PERMISSION_DENIED; return aps->startInput(input); } status_t AudioSystem::stopInput(audio_io_handle_t input) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return PERMISSION_DENIED; return aps->stopInput(input); } void AudioSystem::releaseInput(audio_io_handle_t input) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return; aps->releaseInput(input); } status_t AudioSystem::initStreamVolume(audio_stream_type_t stream, int indexMin, int indexMax) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return PERMISSION_DENIED; return aps->initStreamVolume(stream, indexMin, indexMax); } status_t AudioSystem::setStreamVolumeIndex(audio_stream_type_t stream, int index, audio_devices_t device) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return PERMISSION_DENIED; return aps->setStreamVolumeIndex(stream, index, device); } status_t AudioSystem::getStreamVolumeIndex(audio_stream_type_t stream, int *index, audio_devices_t device) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return PERMISSION_DENIED; return aps->getStreamVolumeIndex(stream, index, device); } uint32_t AudioSystem::getStrategyForStream(audio_stream_type_t stream) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return 0; return aps->getStrategyForStream(stream); } audio_devices_t AudioSystem::getDevicesForStream(audio_stream_type_t stream) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return (audio_devices_t)0; return aps->getDevicesForStream(stream); } audio_io_handle_t AudioSystem::getOutputForEffect(const effect_descriptor_t *desc) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return PERMISSION_DENIED; return aps->getOutputForEffect(desc); } status_t AudioSystem::registerEffect(const effect_descriptor_t *desc, audio_io_handle_t io, uint32_t strategy, int session, int id) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return PERMISSION_DENIED; return aps->registerEffect(desc, io, strategy, session, id); } status_t AudioSystem::unregisterEffect(int id) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return PERMISSION_DENIED; return aps->unregisterEffect(id); } status_t AudioSystem::setEffectEnabled(int id, bool enabled) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return PERMISSION_DENIED; return aps->setEffectEnabled(id, enabled); } status_t AudioSystem::isStreamActive(audio_stream_type_t stream, bool* state, uint32_t inPastMs) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return PERMISSION_DENIED; if (state == NULL) return BAD_VALUE; *state = aps->isStreamActive(stream, inPastMs); return NO_ERROR; } status_t AudioSystem::isSourceActive(audio_source_t stream, bool* state) { const sp& aps = AudioSystem::get_audio_policy_service(); if (aps == 0) return PERMISSION_DENIED; if (state == NULL) return BAD_VALUE; *state = aps->isSourceActive(stream); return NO_ERROR; } int32_t AudioSystem::getPrimaryOutputSamplingRate() { const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return 0; return af->getPrimaryOutputSamplingRate(); } int32_t AudioSystem::getPrimaryOutputFrameCount() { const sp& af = AudioSystem::get_audio_flinger(); if (af == 0) return 0; return af->getPrimaryOutputFrameCount(); } void AudioSystem::clearAudioConfigCache() { Mutex::Autolock _l(gLock); ALOGV("clearAudioConfigCache()"); gOutputs.clear(); } // --------------------------------------------------------------------------- void AudioSystem::AudioPolicyServiceClient::binderDied(const wp& who) { Mutex::Autolock _l(AudioSystem::gLock); AudioSystem::gAudioPolicyService.clear(); ALOGW("AudioPolicyService server died!"); } }; // namespace android android-audiosystem-1.8+13.10.20130807/lib/waudio/0000755000015700001700000000000012200324404021727 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/lib/waudio/build0000755000015700001700000000013012200324306022747 0ustar pbuserpbgroup00000000000000#!/bin/sh target='armel' make clean make -e ARCH=$target make -e ARCH=$target install android-audiosystem-1.8+13.10.20130807/lib/waudio/android_audio_wrapper.cpp0000644000015700001700000003150512200324306027001 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 Motorola * Copyright (C) 2011-2012 Canonical, Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_NDEBUG 0 #define LOG_TAG "AndroidAudioWrapper" #include #include #include #include #include "media/AudioTrack.h" #include "media/AudioRecord.h" #include "media/AudioSystem.h" using namespace android; extern "C" { TrackHandle CreateAudioTrack() { ALOGV("Enter CreateAudioTrack"); AudioTrack* lpTrack = new AudioTrack(); if (lpTrack == NULL) { ALOGV("Error creating uninitialized AudioTrack"); return NULL; } ALOGV("create AudioTrack successfully"); return (TrackHandle)lpTrack; } status_type AudioTrack_set(TrackHandle handle, audio_stream_type_t streamtype, uint32 samplerate, audio_format_t format, audio_channel_mask_t channel) { status_type result = INVALID_PARAM; status_t andrresult; ALOGV("Enter AudioTrack_set and streamtype is %d, samplerate is %d, audioformat is %d, audiochannels is %d.", (int) streamtype, (int) samplerate, (int) format, (int) channel); if (handle != NULL) { andrresult = static_cast(handle)->set(streamtype, samplerate, format, channel); result = (status_type) andrresult; ALOGV("Call AudioTrack set and result is %d", andrresult); } else { ALOGV("Handle is invalid and does not call AudioTrack set"); } return result; } status_type AudioTrack_set_asyn(TrackHandle handle, audio_stream_type_t streamtype, uint32 samplerate, audio_format_t format, audio_channel_mask_t channel, callback_t cbf, void* user) { status_type result = INVALID_PARAM; status_t andrresult; ALOGV("Enter AudioTrack_set and streamtype is %d, samplerate is %d, audioformat is %d, audiochannels is %d.", (int) streamtype, (int) samplerate, (int) format, (int) channel); if (handle != NULL) { andrresult = static_cast(handle)->set(streamtype, samplerate, format, channel, 0, static_cast(0), cbf, user); result = (status_type) andrresult; ALOGV("Call AudioTrack set and result is %d", andrresult); } else { ALOGV("Handle is invalid and does not call AudioTrack set asyn"); } return result; } void AudioTrack_start(TrackHandle handle) { ALOGV("Enter AudioTrack_start"); if (handle != NULL) static_cast(handle)->start(); else ALOGV("Handle is invalid and does not call AudioTrack start"); } void AudioTrack_stop(TrackHandle handle) { ALOGV("Enter AudioTrack_stop"); if (handle != NULL) static_cast(handle)->stop(); else ALOGV("Handle is invalid and does not call AudioTrack stop"); } status_type AudioTrack_getposition(TrackHandle handle, uint32 *position) { ALOGV("Enter AudioTrack_getposition"); status_type result = INVALID_PARAM; status_t andrresult; if (handle != NULL && position != NULL) { andrresult = static_cast(handle)->getPosition((uint32_t*) position); result = (status_type) andrresult; ALOGV("Call AudioTrack getPosition and result is %d, position=%d.", (int) andrresult, (int) *position); } else { ALOGV("Handle is invalid and does not call AudioTrack getPosition"); } return result; } size_t AudioTrack_write(TrackHandle handle, const void *buffer, size_t size) { ALOGV("Enter AudioTrack_write and size is %d.", size); size_t result = 0; if (handle != NULL && buffer != NULL && size > 0) { result = static_cast(handle)->write(buffer, size); ALOGV("Call AudioTrack write and result is %d.", result); } else { ALOGV("Handle is invalid and does not call AudioTrack write"); } return result; } void AudioTrack_pause(TrackHandle handle) { ALOGV("Enter AudioTrack_pause"); if (handle != NULL) static_cast(handle)->pause(); else ALOGV("Handle is invalid and does not call AudioTrack pause"); } uint32 AudioTrack_latency(TrackHandle handle) { ALOGV("Enter AudioTrack_latency"); uint32 result = 0; if (handle != NULL) result = static_cast(handle)->latency(); else ALOGV("Handle is invalid and does not call AudioTrack latency"); return result; } void AudioTrack_mute(TrackHandle handle, int muted) { ALOGV("Enter AudioTrack_mute"); if (handle != NULL) static_cast(handle)->mute(muted); else ALOGV("Handle is invalid and does not call AudioTrack mute"); } void DestoryAudioTrack(TrackHandle handle) { ALOGV("Enter DestoryAudioTrack"); if (handle != NULL) { delete static_cast(handle); ALOGV("Delete AudioTrack successfully"); } else { ALOGV("Handle is invalid and does not delete AudioTrack"); } } /* Audio Record related interface */ RecordHandle CreateAudioRecord() { ALOGV("Enter CreateAudioRecord"); AudioRecord* lpRecord = new AudioRecord(); if (lpRecord == NULL) { ALOGV("Error creating uninitialized AudioRecord"); return NULL; } ALOGV("create AudioRecord successfully"); return (RecordHandle) lpRecord; } void DestoryAudioRecord(RecordHandle handle) { ALOGV("Enter DestoryAudioRecord"); if (handle != NULL ) { delete static_cast(handle); ALOGV("Delete AudioRecord successfully"); } else { ALOGV("Handle is invalid and does not deletel AudioRecord "); } } void AudioRecord_start(RecordHandle handle) { ALOGV("Enter AudioRecord_start"); if (handle != NULL) { static_cast(handle)->start(); } else { ALOGV("Handle is invalid and does not call AudioRecord start"); } } void AudioRecord_stop(RecordHandle handle) { ALOGV("Enter AudioRecord_stop"); if (handle != NULL) { static_cast(handle)->stop(); } else { ALOGV("Handle is invalid and does not call AudioRecord stop"); } } status_type AudioRecord_getposition(RecordHandle handle, int32_t *position) { ALOGV("Enter AudioRecord_getposition"); status_type result = INVALID_PARAM; status_t andrresult; if (handle != NULL && position != NULL) { andrresult = static_cast(handle)->getPosition((uint32_t*) position); result = (status_type) andrresult; ALOGV("Call AudioRecord getPosition and result is %d, position=%d.", andrresult, *position); } else { ALOGV("Handle is invalid and does not call AudioRecord getPosition"); } return result; } size_t AudioRecord_read(RecordHandle handle, void *buffer, size_t size) { ALOGV("Enter AudioRecord_read and size is %d.", size); size_t result = 0; if (handle != NULL && buffer != NULL && size > 0) { result = static_cast(handle)->read(buffer, size); ALOGV("Call AudioRecored read and result is %d.", result); } else { ALOGV("Handle is invalid and does not call AudioRecord read"); } return result; } status_type AudioRecord_set(RecordHandle handle, audio_source_t inputsource, uint32 samplerate, audio_format_t format, audio_channel_mask_t channel) { ALOGV("Enter AudioRecord_set and audiosource is %d.", inputsource); status_type result = INVALID_PARAM; status_t andrresult; if (handle != NULL) { andrresult = static_cast(handle)->set(inputsource, samplerate, format, channel); result = (status_type) andrresult; ALOGV("Call AudioRecord set and result is %d", andrresult); } else { ALOGV("Handle is invalid and does not call AudioRecord set"); } return result; } uint32 AudioRecord_latency(RecordHandle handle) { ALOGV("Enter AudioRecord_latency"); uint32 result = 0; if (handle != NULL) result = static_cast(handle)->latency(); else ALOGV("Handle is invalid and does not call AudioRecord latency"); return result; } AudioIOHandle AudioSystem_getOutput(audio_stream_type_t streamtype, uint32 samplerate, audio_format_t format, audio_channel_mask_t channels, audio_output_flags_t flags) { ALOGV(">> AudioSystem_getOutput."); return AudioSystem::getOutput(streamtype, samplerate, format, channels, flags); } status_type AudioSystem_setParameters(AudioIOHandle ioHandle, char *keyvaluepairs) { ALOGV(">> AudioSystem_setParameters, iohandle %d, keypairs %s.", ioHandle, keyvaluepairs); return AudioSystem::setParameters(ioHandle, String8(keyvaluepairs)); } const char * AudioSystem_getParameters(AudioIOHandle ioHandle, char *keys) { ALOGV(">> AudioSystem_getParameters, iohandle %d, keys %s", ioHandle, keys); String8 result = AudioSystem::getParameters(ioHandle, String8(keys)); return strdup(result.string()); } /* Audio System related interface */ /* Master */ status_type AudioSystem_setMasterVolume(float value) { ALOGV(">> AudioSystem_setMasterVolume %f.", value); return AudioSystem::setMasterVolume(value); } status_type AudioSystem_getMasterVolume(float *value) { ALOGV(">> AudioSystem_getMasterVolume."); return AudioSystem::getMasterVolume(value); } status_type AudioSystem_setMasterMute(int mute) { ALOGV(">> AudioSystem_setMasterMute %d.", mute); return AudioSystem::setMasterMute(mute); } status_type AudioSystem_getMasterMute(int *mute) { ALOGV(">> AudioSystem_getMasterMute."); return AudioSystem::getMasterMute((bool*) mute); } status_type AudioSystem_muteMicrophone(int state) { ALOGV(">> AudioSystem_muteMicrophone %d.", state); return AudioSystem::muteMicrophone(state); } status_type AudioSystem_isMicrophoneMuted(int *state) { ALOGV(">> AudioSystem_isMicrophoneMuted."); return AudioSystem::isMicrophoneMuted((bool*) state); } status_type AudioSystem_setMode(audio_mode_t mode) { ALOGV(">> AudioSystem_setMode %d.", (int) mode); return AudioSystem::setMode(mode); } status_type AudioSystem_setVoiceVolume(float volume) { ALOGV(">> AudioSystem_setVoiceVolume %f.", volume); return AudioSystem::setVoiceVolume(volume); } /* Stream */ status_type AudioSystem_initStreamVolume(audio_stream_type_t streamtype, int indexMin, int indexMax) { ALOGV(">> AudioSystem_initStreamVolume: streamtype is %d.", streamtype); return AudioSystem::initStreamVolume(streamtype, indexMin, indexMax); } status_type AudioSystem_getStreamVolumeIndex(audio_stream_type_t streamtype, int *index, audio_devices_t device) { ALOGV(">> AudioSystem_getStreamVolumeIndex: streamtype is %d.", streamtype); return AudioSystem::getStreamVolumeIndex(streamtype, index, device); } status_type AudioSystem_getStreamMute(audio_stream_type_t streamtype, int *mute) { ALOGV(">> AudioSystem_getStreamMute: streamtype is %d.", streamtype); return AudioSystem::getStreamMute(streamtype, (bool*) mute); } status_type AudioSystem_setStreamVolumeIndex(audio_stream_type_t streamtype, int index, audio_devices_t device) { ALOGV(">> AudioSystem_setStreamVolumeIndex:streamtype is %d.", streamtype); return AudioSystem::setStreamVolumeIndex(streamtype, index, device); } status_type AudioSystem_setStreamMute(audio_stream_type_t streamtype, int mute) { ALOGV(">> AudioSystem_setStreamMute:streamtype is %d.", streamtype); return AudioSystem::setStreamMute(streamtype, mute); } status_type AudioSystem_setStreamVolume(audio_stream_type_t streamtype, float value, int output) { ALOGV(">> AudioSystem_setStreamVolume %f.", value); return AudioSystem::setStreamVolume(streamtype, value, output); } status_type AudioSystem_getStreamVolume(audio_stream_type_t streamtype, float *value, int output) { ALOGV(">> AudioSystem_getStreamVolume."); return AudioSystem::getStreamVolume(streamtype, value, output); } } // extern "C" android-audiosystem-1.8+13.10.20130807/lib/waudio/Makefile0000644000015700001700000000325312200324306023373 0ustar pbuserpbgroup00000000000000make_home := ../.. top_srcdir := ../.. include $(make_home)/project_make include $(make_home)/package_make include ../Makefile.defines ####################### # CUSTOMIZE MACROS HERE ####################### # name your library here PKG_LIB = waudio # at least one of following lines must be uncommented # CFILES is .c # CCFILES is .cc # CPPFILES is .cpp # CXXFILES is .cxx CPPFILES = android_audio_wrapper.cpp #CCFILES = #CPPFILES = #CXXFILES = FORCE_CXX_LINK = TRUE # if this library depends on private static library built # by this package, uncomment next line STATIC_LIBS = ../libmedia/libmedia.a ../binder/libbinder.a ../utils/libutils.a ../libcutils/libcutils.a ../liblog/liblog.a ../audio_utils/libaudioutils.a # modify compiler command-line options CFLAGS = -fPIC -DHAVE_ANDROID_OS=1 $(CONFIG_DEFINES) # modify linker command-line options LDFLAGS += --sysroot=$(rootfs_path) $(PKGLDFLAGS) -L ../libmedia/ SHARED_LIBS += -lmedia -lpthread -lrt # build private static library private_lib = NO # for proper SONAME LIBMAJOR = 1 LIBMINOR = 0 # build simple shared library # single header file exported, should be .../lib/include/$(PKG_LIB).h PKGCONFIG = NO # build pkgconfig shared library # change PKGCONFIG to YES and add following three macros # PKG_LIBDESC is one line description of library # PKG_REQUIRES is list of required pkgconfig libraries # PKG_HEADERS is list of header files to export #PKG_LIBDESC = #PKG_REQUIRES = #PKG_HEADERS = MAKESUBDIR = YES LIBSUBDIR = /$(install_lib_rel) HDRSUBDIR = /$(install_hdr_rel) ############################ # END OF MACROS TO CUSTOMIZE ############################ all: $(TARGET) #-include $(DEPENDS) include $(make_home)/target_lib android-audiosystem-1.8+13.10.20130807/lib/audio_utils/0000755000015700001700000000000012200324404022760 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/lib/audio_utils/Android.mk0000644000015700001700000000067512200324306024702 0ustar pbuserpbgroup00000000000000LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := libaudioutils LOCAL_MODULE_TAGS := optional LOCAL_SRC_FILES:= \ fixedfft.cpp.arm \ primitives.c \ resampler.c \ echo_reference.c LOCAL_C_INCLUDES += $(call include-path-for, speex) LOCAL_C_INCLUDES += \ $(call include-path-for, speex) \ $(call include-path-for, audio-utils) LOCAL_SHARED_LIBRARIES := \ libcutils \ libspeexresampler include $(BUILD_SHARED_LIBRARY) android-audiosystem-1.8+13.10.20130807/lib/audio_utils/fixedfft.cpp0000644000015700001700000001532612200324306025273 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* A Fixed point implementation of Fast Fourier Transform (FFT). Complex numbers * are represented by 32-bit integers, where higher 16 bits are real part and * lower ones are imaginary part. Few compromises are made between efficiency, * accuracy, and maintainability. To make it fast, arithmetic shifts are used * instead of divisions, and bitwise inverses are used instead of negates. To * keep it small, only radix-2 Cooley-Tukey algorithm is implemented, and only * half of the twiddle factors are stored. Although there are still ways to make * it even faster or smaller, it costs too much on one of the aspects. */ #include #include #ifdef __arm__ #include #endif #include #define LOG_FFT_SIZE 10 #define MAX_FFT_SIZE (1 << LOG_FFT_SIZE) static const int32_t twiddle[MAX_FFT_SIZE / 4] = { 0x00008000, 0xff378001, 0xfe6e8002, 0xfda58006, 0xfcdc800a, 0xfc13800f, 0xfb4a8016, 0xfa81801e, 0xf9b88027, 0xf8ef8032, 0xf827803e, 0xf75e804b, 0xf6958059, 0xf5cd8068, 0xf5058079, 0xf43c808b, 0xf374809e, 0xf2ac80b2, 0xf1e480c8, 0xf11c80de, 0xf05580f6, 0xef8d8110, 0xeec6812a, 0xedff8146, 0xed388163, 0xec718181, 0xebab81a0, 0xeae481c1, 0xea1e81e2, 0xe9588205, 0xe892822a, 0xe7cd824f, 0xe7078276, 0xe642829d, 0xe57d82c6, 0xe4b982f1, 0xe3f4831c, 0xe3308349, 0xe26d8377, 0xe1a983a6, 0xe0e683d6, 0xe0238407, 0xdf61843a, 0xde9e846e, 0xdddc84a3, 0xdd1b84d9, 0xdc598511, 0xdb998549, 0xdad88583, 0xda1885be, 0xd95885fa, 0xd8988637, 0xd7d98676, 0xd71b86b6, 0xd65c86f6, 0xd59e8738, 0xd4e1877b, 0xd42487c0, 0xd3678805, 0xd2ab884c, 0xd1ef8894, 0xd13488dd, 0xd0798927, 0xcfbe8972, 0xcf0489be, 0xce4b8a0c, 0xcd928a5a, 0xccd98aaa, 0xcc218afb, 0xcb698b4d, 0xcab28ba0, 0xc9fc8bf5, 0xc9468c4a, 0xc8908ca1, 0xc7db8cf8, 0xc7278d51, 0xc6738dab, 0xc5c08e06, 0xc50d8e62, 0xc45b8ebf, 0xc3a98f1d, 0xc2f88f7d, 0xc2488fdd, 0xc198903e, 0xc0e990a1, 0xc03a9105, 0xbf8c9169, 0xbedf91cf, 0xbe329236, 0xbd86929e, 0xbcda9307, 0xbc2f9371, 0xbb8593dc, 0xbadc9448, 0xba3394b5, 0xb98b9523, 0xb8e39592, 0xb83c9603, 0xb7969674, 0xb6f196e6, 0xb64c9759, 0xb5a897ce, 0xb5059843, 0xb46298b9, 0xb3c09930, 0xb31f99a9, 0xb27f9a22, 0xb1df9a9c, 0xb1409b17, 0xb0a29b94, 0xb0059c11, 0xaf689c8f, 0xaecc9d0e, 0xae319d8e, 0xad979e0f, 0xacfd9e91, 0xac659f14, 0xabcd9f98, 0xab36a01c, 0xaaa0a0a2, 0xaa0aa129, 0xa976a1b0, 0xa8e2a238, 0xa84fa2c2, 0xa7bda34c, 0xa72ca3d7, 0xa69ca463, 0xa60ca4f0, 0xa57ea57e, 0xa4f0a60c, 0xa463a69c, 0xa3d7a72c, 0xa34ca7bd, 0xa2c2a84f, 0xa238a8e2, 0xa1b0a976, 0xa129aa0a, 0xa0a2aaa0, 0xa01cab36, 0x9f98abcd, 0x9f14ac65, 0x9e91acfd, 0x9e0fad97, 0x9d8eae31, 0x9d0eaecc, 0x9c8faf68, 0x9c11b005, 0x9b94b0a2, 0x9b17b140, 0x9a9cb1df, 0x9a22b27f, 0x99a9b31f, 0x9930b3c0, 0x98b9b462, 0x9843b505, 0x97ceb5a8, 0x9759b64c, 0x96e6b6f1, 0x9674b796, 0x9603b83c, 0x9592b8e3, 0x9523b98b, 0x94b5ba33, 0x9448badc, 0x93dcbb85, 0x9371bc2f, 0x9307bcda, 0x929ebd86, 0x9236be32, 0x91cfbedf, 0x9169bf8c, 0x9105c03a, 0x90a1c0e9, 0x903ec198, 0x8fddc248, 0x8f7dc2f8, 0x8f1dc3a9, 0x8ebfc45b, 0x8e62c50d, 0x8e06c5c0, 0x8dabc673, 0x8d51c727, 0x8cf8c7db, 0x8ca1c890, 0x8c4ac946, 0x8bf5c9fc, 0x8ba0cab2, 0x8b4dcb69, 0x8afbcc21, 0x8aaaccd9, 0x8a5acd92, 0x8a0cce4b, 0x89becf04, 0x8972cfbe, 0x8927d079, 0x88ddd134, 0x8894d1ef, 0x884cd2ab, 0x8805d367, 0x87c0d424, 0x877bd4e1, 0x8738d59e, 0x86f6d65c, 0x86b6d71b, 0x8676d7d9, 0x8637d898, 0x85fad958, 0x85beda18, 0x8583dad8, 0x8549db99, 0x8511dc59, 0x84d9dd1b, 0x84a3dddc, 0x846ede9e, 0x843adf61, 0x8407e023, 0x83d6e0e6, 0x83a6e1a9, 0x8377e26d, 0x8349e330, 0x831ce3f4, 0x82f1e4b9, 0x82c6e57d, 0x829de642, 0x8276e707, 0x824fe7cd, 0x822ae892, 0x8205e958, 0x81e2ea1e, 0x81c1eae4, 0x81a0ebab, 0x8181ec71, 0x8163ed38, 0x8146edff, 0x812aeec6, 0x8110ef8d, 0x80f6f055, 0x80def11c, 0x80c8f1e4, 0x80b2f2ac, 0x809ef374, 0x808bf43c, 0x8079f505, 0x8068f5cd, 0x8059f695, 0x804bf75e, 0x803ef827, 0x8032f8ef, 0x8027f9b8, 0x801efa81, 0x8016fb4a, 0x800ffc13, 0x800afcdc, 0x8006fda5, 0x8002fe6e, 0x8001ff37, }; /* Returns the multiplication of \conj{a} and {b}. */ static inline int32_t mult(int32_t a, int32_t b) { #if __ARM_ARCH__ >= 6 int32_t t = b; __asm__("smuad %0, %0, %1" : "+r" (t) : "r" (a)); __asm__("smusdx %0, %0, %1" : "+r" (b) : "r" (a)); __asm__("pkhtb %0, %0, %1, ASR #16" : "+r" (t) : "r" (b)); return t; #else return (((a >> 16) * (b >> 16) + (int16_t)a * (int16_t)b) & ~0xFFFF) | ((((a >> 16) * (int16_t)b - (int16_t)a * (b >> 16)) >> 16) & 0xFFFF); #endif } static inline int32_t half(int32_t a) { #if __ARM_ARCH__ >= 6 __asm__("shadd16 %0, %0, %1" : "+r" (a) : "r" (0)); return a; #else return ((a >> 1) & ~0x8000) | (a & 0x8000); #endif } void fixed_fft(int n, int32_t *v) { int scale = LOG_FFT_SIZE, i, p, r; for (r = 0, i = 1; i < n; ++i) { for (p = n; !(p & r); p >>= 1, r ^= p); if (i < r) { int32_t t = v[i]; v[i] = v[r]; v[r] = t; } } for (p = 1; p < n; p <<= 1) { --scale; for (i = 0; i < n; i += p << 1) { int32_t x = half(v[i]); int32_t y = half(v[i + p]); v[i] = x + y; v[i + p] = x - y; } for (r = 1; r < p; ++r) { int32_t w = MAX_FFT_SIZE / 4 - (r << scale); i = w >> 31; w = twiddle[(w ^ i) - i] ^ (i << 16); for (i = r; i < n; i += p << 1) { int32_t x = half(v[i]); int32_t y = mult(w, v[i + p]); v[i] = x - y; v[i + p] = x + y; } } } } void fixed_fft_real(int n, int32_t *v) { int scale = LOG_FFT_SIZE, m = n >> 1, i; fixed_fft(n, v); for (i = 1; i <= n; i <<= 1, --scale); v[0] = mult(~v[0], 0x80008000); v[m] = half(v[m]); for (i = 1; i < n >> 1; ++i) { int32_t x = half(v[i]); int32_t z = half(v[n - i]); int32_t y = z - (x ^ 0xFFFF); x = half(x + (z ^ 0xFFFF)); y = mult(y, twiddle[i << scale]); v[i] = x - y; v[n - i] = (x + y) ^ 0xFFFF; } } android-audiosystem-1.8+13.10.20130807/lib/audio_utils/Makefile0000644000015700001700000000267112200324306024427 0ustar pbuserpbgroup00000000000000make_home := ../../ top_srcdir := ../../ include $(make_home)/project_make WARN = -Wall include $(make_home)/package_make include ../Makefile.defines ####################### # CUSTOMIZE MACROS HERE ####################### # name your library here PKG_LIB = audioutils # at least one of following lines must be uncommented # CFILES is .c # CCFILES is .cc # CPPFILES is .cpp # CXXFILES is .cxx CFILES = primitives.c #CPPFILES #CCFILES = #CPPFILES = #CXXFILES = FORCE_CXX_LINK = TRUE # if this library depends on private static library built # by this package, uncomment next line #STATIC_LIBS = # modify compiler command-line options CFLAGS = -fPIC $(CONFIG_DEFINES) # modify linker command-line options LDFLAGS += -L ../libcutils/ SHARED_LIBS += -lcutils # build private static library private_lib = YES # build simple shared library # single header file exported, should be .../lib/include/$(PKG_LIB).h PKGCONFIG = NO # build pkgconfig shared library # change PKGCONFIG to YES and add following three macros # PKG_LIBDESC is one line description of library # PKG_REQUIRES is list of required pkgconfig libraries # PKG_HEADERS is list of header files to export #PKG_LIBDESC = #PKG_REQUIRES = #PKG_HEADERS = MAKESUBDIR = YES LIBSUBDIR = /$(install_lib_rel) HDRSUBDIR = /$(install_hdr_rel) ############################ # END OF MACROS TO CUSTOMIZE ############################ all: $(TARGET) #-include $(DEPENDS) include $(make_home)/target_lib android-audiosystem-1.8+13.10.20130807/lib/audio_utils/echo_reference.c0000644000015700001700000005172212200324306026070 0ustar pbuserpbgroup00000000000000/* ** Copyright 2011, The Android Open-Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "echo_reference" #include #include #include #include #include #include #include // echo reference state: bit field indicating if read, write or both are active. enum state { ECHOREF_IDLE = 0x00, // idle ECHOREF_READING = 0x01, // reading is active ECHOREF_WRITING = 0x02 // writing is active }; struct echo_reference { struct echo_reference_itfe itfe; int status; // init status uint32_t state; // active state: reading, writing or both audio_format_t rd_format; // read sample format uint32_t rd_channel_count; // read number of channels uint32_t rd_sampling_rate; // read sampling rate in Hz size_t rd_frame_size; // read frame size (bytes per sample) audio_format_t wr_format; // write sample format uint32_t wr_channel_count; // write number of channels uint32_t wr_sampling_rate; // write sampling rate in Hz size_t wr_frame_size; // write frame size (bytes per sample) void *buffer; // main buffer size_t buf_size; // main buffer size in frames size_t frames_in; // number of frames in main buffer void *wr_buf; // buffer for input conversions size_t wr_buf_size; // size of conversion buffer in frames size_t wr_frames_in; // number of frames in conversion buffer size_t wr_curr_frame_size; // number of frames given to current write() function void *wr_src_buf; // resampler input buf (either wr_buf or buffer used by write()) struct timespec wr_render_time; // latest render time indicated by write() // default ALSA gettimeofday() format int32_t playback_delay; // playback buffer delay indicated by last write() int16_t prev_delta_sign; // sign of previous delay difference: // 1: positive, -1: negative, 0: unknown uint16_t delta_count; // number of consecutive delay differences with same sign pthread_mutex_t lock; // mutex protecting read/write concurrency pthread_cond_t cond; // condition signaled when data is ready to read struct resampler_itfe *resampler; // input resampler struct resampler_buffer_provider provider; // resampler buffer provider }; int echo_reference_get_next_buffer(struct resampler_buffer_provider *buffer_provider, struct resampler_buffer* buffer) { struct echo_reference *er; if (buffer_provider == NULL) { return -EINVAL; } er = (struct echo_reference *)((char *)buffer_provider - offsetof(struct echo_reference, provider)); if (er->wr_src_buf == NULL || er->wr_frames_in == 0) { buffer->raw = NULL; buffer->frame_count = 0; return -ENODATA; } buffer->frame_count = (buffer->frame_count > er->wr_frames_in) ? er->wr_frames_in : buffer->frame_count; // this is er->rd_channel_count here as we resample after stereo to mono conversion if any buffer->i16 = (int16_t *)er->wr_src_buf + (er->wr_curr_frame_size - er->wr_frames_in) * er->rd_channel_count; return 0; } void echo_reference_release_buffer(struct resampler_buffer_provider *buffer_provider, struct resampler_buffer* buffer) { struct echo_reference *er; if (buffer_provider == NULL) { return; } er = (struct echo_reference *)((char *)buffer_provider - offsetof(struct echo_reference, provider)); er->wr_frames_in -= buffer->frame_count; } static void echo_reference_reset_l(struct echo_reference *er) { ALOGV("echo_reference_reset_l()"); free(er->buffer); er->buffer = NULL; er->buf_size = 0; er->frames_in = 0; free(er->wr_buf); er->wr_buf = NULL; er->wr_buf_size = 0; er->wr_render_time.tv_sec = 0; er->wr_render_time.tv_nsec = 0; er->delta_count = 0; er->prev_delta_sign = 0; } /* additional space in resampler buffer allowing for extra samples to be returned * by speex resampler when sample rates ratio is not an integer. */ #define RESAMPLER_HEADROOM_SAMPLES 10 static int echo_reference_write(struct echo_reference_itfe *echo_reference, struct echo_reference_buffer *buffer) { struct echo_reference *er = (struct echo_reference *)echo_reference; int status = 0; if (er == NULL) { return -EINVAL; } pthread_mutex_lock(&er->lock); if (buffer == NULL) { ALOGV("echo_reference_write() stop write"); er->state &= ~ECHOREF_WRITING; echo_reference_reset_l(er); goto exit; } ALOGV("echo_reference_write() START trying to write %d frames", buffer->frame_count); ALOGV("echo_reference_write() playbackTimestamp:[%d].[%d], er->playback_delay:[%d]", (int)buffer->time_stamp.tv_sec, (int)buffer->time_stamp.tv_nsec, er->playback_delay); //ALOGV("echo_reference_write() %d frames", buffer->frame_count); // discard writes until a valid time stamp is provided. if ((buffer->time_stamp.tv_sec == 0) && (buffer->time_stamp.tv_nsec == 0) && (er->wr_render_time.tv_sec == 0) && (er->wr_render_time.tv_nsec == 0)) { goto exit; } if ((er->state & ECHOREF_WRITING) == 0) { ALOGV("echo_reference_write() start write"); if (er->resampler != NULL) { er->resampler->reset(er->resampler); } er->state |= ECHOREF_WRITING; } if ((er->state & ECHOREF_READING) == 0) { goto exit; } er->wr_render_time.tv_sec = buffer->time_stamp.tv_sec; er->wr_render_time.tv_nsec = buffer->time_stamp.tv_nsec; er->playback_delay = buffer->delay_ns; // this will be used in the get_next_buffer, to support variable input buffer sizes er->wr_curr_frame_size = buffer->frame_count; void *srcBuf; size_t inFrames; // do stereo to mono and down sampling if necessary if (er->rd_channel_count != er->wr_channel_count || er->rd_sampling_rate != er->wr_sampling_rate) { size_t wrBufSize = buffer->frame_count; inFrames = buffer->frame_count; if (er->rd_sampling_rate != er->wr_sampling_rate) { inFrames = (buffer->frame_count * er->rd_sampling_rate) / er->wr_sampling_rate + RESAMPLER_HEADROOM_SAMPLES; // wr_buf is not only used as resampler output but also for stereo to mono conversion // output so buffer size is driven by both write and read sample rates if (inFrames > wrBufSize) { wrBufSize = inFrames; } } if (er->wr_buf_size < wrBufSize) { ALOGV("echo_reference_write() increasing write buffer size from %d to %d", er->wr_buf_size, wrBufSize); er->wr_buf_size = wrBufSize; er->wr_buf = realloc(er->wr_buf, er->wr_buf_size * er->rd_frame_size); } if (er->rd_channel_count != er->wr_channel_count) { // must be stereo to mono int16_t *src16 = (int16_t *)buffer->raw; int16_t *dst16 = (int16_t *)er->wr_buf; size_t frames = buffer->frame_count; while (frames--) { *dst16++ = (int16_t)(((int32_t)*src16 + (int32_t)*(src16 + 1)) >> 1); src16 += 2; } } if (er->wr_sampling_rate != er->rd_sampling_rate) { if (er->resampler == NULL) { int rc; ALOGV("echo_reference_write() new ReSampler(%d, %d)", er->wr_sampling_rate, er->rd_sampling_rate); er->provider.get_next_buffer = echo_reference_get_next_buffer; er->provider.release_buffer = echo_reference_release_buffer; rc = create_resampler(er->wr_sampling_rate, er->rd_sampling_rate, er->rd_channel_count, RESAMPLER_QUALITY_DEFAULT, &er->provider, &er->resampler); if (rc != 0) { er->resampler = NULL; ALOGV("echo_reference_write() failure to create resampler %d", rc); status = -ENODEV; goto exit; } } // er->wr_src_buf and er->wr_frames_in are used by getNexBuffer() called by the resampler // to get new frames if (er->rd_channel_count != er->wr_channel_count) { er->wr_src_buf = er->wr_buf; } else { er->wr_src_buf = buffer->raw; } er->wr_frames_in = buffer->frame_count; // inFrames is always more than we need here to get frames remaining from previous runs // inFrames is updated by resample() with the number of frames produced ALOGV("echo_reference_write() ReSampling(%d, %d)", er->wr_sampling_rate, er->rd_sampling_rate); er->resampler->resample_from_provider(er->resampler, (int16_t *)er->wr_buf, &inFrames); ALOGV_IF(er->wr_frames_in != 0, "echo_reference_write() er->wr_frames_in not 0 (%d) after resampler", er->wr_frames_in); } srcBuf = er->wr_buf; } else { inFrames = buffer->frame_count; srcBuf = buffer->raw; } if (er->frames_in + inFrames > er->buf_size) { ALOGV("echo_reference_write() increasing buffer size from %d to %d", er->buf_size, er->frames_in + inFrames); er->buf_size = er->frames_in + inFrames; er->buffer = realloc(er->buffer, er->buf_size * er->rd_frame_size); } memcpy((char *)er->buffer + er->frames_in * er->rd_frame_size, srcBuf, inFrames * er->rd_frame_size); er->frames_in += inFrames; ALOGV("echo_reference_write() frames written:[%d], frames total:[%d] buffer size:[%d]\n" " er->wr_render_time:[%d].[%d], er->playback_delay:[%d]", inFrames, er->frames_in, er->buf_size, (int)er->wr_render_time.tv_sec, (int)er->wr_render_time.tv_nsec, er->playback_delay); pthread_cond_signal(&er->cond); exit: pthread_mutex_unlock(&er->lock); ALOGV("echo_reference_write() END"); return status; } // delay jump threshold to update ref buffer: 6 samples at 8kHz in nsecs #define MIN_DELAY_DELTA_NS (375000*2) // number of consecutive delta with same sign between expected and actual delay before adjusting // the buffer #define MIN_DELTA_NUM 4 static int echo_reference_read(struct echo_reference_itfe *echo_reference, struct echo_reference_buffer *buffer) { struct echo_reference *er = (struct echo_reference *)echo_reference; if (er == NULL) { return -EINVAL; } pthread_mutex_lock(&er->lock); if (buffer == NULL) { ALOGV("echo_reference_read() stop read"); er->state &= ~ECHOREF_READING; goto exit; } ALOGV("echo_reference_read() START, delayCapture:[%d], " "er->frames_in:[%d],buffer->frame_count:[%d]", buffer->delay_ns, er->frames_in, buffer->frame_count); if ((er->state & ECHOREF_READING) == 0) { ALOGV("echo_reference_read() start read"); echo_reference_reset_l(er); er->state |= ECHOREF_READING; } if ((er->state & ECHOREF_WRITING) == 0) { memset(buffer->raw, 0, er->rd_frame_size * buffer->frame_count); buffer->delay_ns = 0; goto exit; } // ALOGV("echo_reference_read() %d frames", buffer->frame_count); // allow some time for new frames to arrive if not enough frames are ready for read if (er->frames_in < buffer->frame_count) { uint32_t timeoutMs = (uint32_t)((1000 * buffer->frame_count) / er->rd_sampling_rate / 2); struct timespec ts; ts.tv_sec = timeoutMs/1000; ts.tv_nsec = timeoutMs%1000; pthread_cond_timedwait_relative_np(&er->cond, &er->lock, &ts); ALOGV_IF((er->frames_in < buffer->frame_count), "echo_reference_read() waited %d ms but still not enough frames"\ " er->frames_in: %d, buffer->frame_count = %d", timeoutMs, er->frames_in, buffer->frame_count); } int64_t timeDiff; struct timespec tmp; if ((er->wr_render_time.tv_sec == 0 && er->wr_render_time.tv_nsec == 0) || (buffer->time_stamp.tv_sec == 0 && buffer->time_stamp.tv_nsec == 0)) { ALOGV("echo_reference_read(): NEW:timestamp is zero---------setting timeDiff = 0, "\ "not updating delay this time"); timeDiff = 0; } else { if (buffer->time_stamp.tv_nsec < er->wr_render_time.tv_nsec) { tmp.tv_sec = buffer->time_stamp.tv_sec - er->wr_render_time.tv_sec - 1; tmp.tv_nsec = 1000000000 + buffer->time_stamp.tv_nsec - er->wr_render_time.tv_nsec; } else { tmp.tv_sec = buffer->time_stamp.tv_sec - er->wr_render_time.tv_sec; tmp.tv_nsec = buffer->time_stamp.tv_nsec - er->wr_render_time.tv_nsec; } timeDiff = (((int64_t)tmp.tv_sec * 1000000000 + tmp.tv_nsec)); int64_t expectedDelayNs = er->playback_delay + buffer->delay_ns - timeDiff; if (er->resampler != NULL) { // Resampler already compensates part of the delay int32_t rsmp_delay = er->resampler->delay_ns(er->resampler); expectedDelayNs -= rsmp_delay; } ALOGV("echo_reference_read(): expectedDelayNs[%lld] = " "er->playback_delay[%d] + delayCapture[%d] - timeDiff[%lld]", expectedDelayNs, er->playback_delay, buffer->delay_ns, timeDiff); if (expectedDelayNs > 0) { int64_t delayNs = ((int64_t)er->frames_in * 1000000000) / er->rd_sampling_rate; int64_t deltaNs = delayNs - expectedDelayNs; ALOGV("echo_reference_read(): EchoPathDelayDeviation between reference and DMA [%lld]", deltaNs); if (abs(deltaNs) >= MIN_DELAY_DELTA_NS) { // smooth the variation and update the reference buffer only // if a deviation in the same direction is observed for more than MIN_DELTA_NUM // consecutive reads. int16_t delay_sign = (deltaNs >= 0) ? 1 : -1; if (delay_sign == er->prev_delta_sign) { er->delta_count++; } else { er->delta_count = 1; } er->prev_delta_sign = delay_sign; if (er->delta_count > MIN_DELTA_NUM) { size_t previousFrameIn = er->frames_in; er->frames_in = (size_t)((expectedDelayNs * er->rd_sampling_rate)/1000000000); int offset = er->frames_in - previousFrameIn; ALOGV("echo_reference_read(): deltaNs ENOUGH and %s: " "er->frames_in: %d, previousFrameIn = %d", delay_sign ? "positive" : "negative", er->frames_in, previousFrameIn); if (deltaNs < 0) { // Less data available in the reference buffer than expected if (er->frames_in > er->buf_size) { er->buf_size = er->frames_in; er->buffer = realloc(er->buffer, er->buf_size * er->rd_frame_size); ALOGV("echo_reference_read(): increasing buffer size to %d", er->buf_size); } if (offset > 0) { memset((char *)er->buffer + previousFrameIn * er->rd_frame_size, 0, offset * er->rd_frame_size); ALOGV("echo_reference_read(): pushing ref buffer by [%d]", offset); } } else { // More data available in the reference buffer than expected offset = -offset; if (offset > 0) { memcpy(er->buffer, (char *)er->buffer + (offset * er->rd_frame_size), er->frames_in * er->rd_frame_size); ALOGV("echo_reference_read(): shifting ref buffer by [%d]", er->frames_in); } } } } else { er->delta_count = 0; er->prev_delta_sign = 0; ALOGV("echo_reference_read(): Constant EchoPathDelay - difference " "between reference and DMA %lld", deltaNs); } } else { ALOGV("echo_reference_read(): NEGATIVE expectedDelayNs[%lld] = "\ "er->playback_delay[%d] + delayCapture[%d] - timeDiff[%lld]", expectedDelayNs, er->playback_delay, buffer->delay_ns, timeDiff); } } if (er->frames_in < buffer->frame_count) { if (buffer->frame_count > er->buf_size) { er->buf_size = buffer->frame_count; er->buffer = realloc(er->buffer, er->buf_size * er->rd_frame_size); ALOGV("echo_reference_read(): increasing buffer size to %d", er->buf_size); } // filling up the reference buffer with 0s to match the expected delay. memset((char *)er->buffer + er->frames_in * er->rd_frame_size, 0, (buffer->frame_count - er->frames_in) * er->rd_frame_size); er->frames_in = buffer->frame_count; } memcpy(buffer->raw, (char *)er->buffer, buffer->frame_count * er->rd_frame_size); er->frames_in -= buffer->frame_count; memcpy(er->buffer, (char *)er->buffer + buffer->frame_count * er->rd_frame_size, er->frames_in * er->rd_frame_size); // As the reference buffer is now time aligned to the microphone signal there is a zero delay buffer->delay_ns = 0; ALOGV("echo_reference_read() END %d frames, total frames in %d", buffer->frame_count, er->frames_in); pthread_cond_signal(&er->cond); exit: pthread_mutex_unlock(&er->lock); return 0; } int create_echo_reference(audio_format_t rdFormat, uint32_t rdChannelCount, uint32_t rdSamplingRate, audio_format_t wrFormat, uint32_t wrChannelCount, uint32_t wrSamplingRate, struct echo_reference_itfe **echo_reference) { struct echo_reference *er; ALOGV("create_echo_reference()"); if (echo_reference == NULL) { return -EINVAL; } *echo_reference = NULL; if (rdFormat != AUDIO_FORMAT_PCM_16_BIT || rdFormat != wrFormat) { ALOGW("create_echo_reference bad format rd %d, wr %d", rdFormat, wrFormat); return -EINVAL; } if ((rdChannelCount != 1 && rdChannelCount != 2) || wrChannelCount != 2) { ALOGW("create_echo_reference bad channel count rd %d, wr %d", rdChannelCount, wrChannelCount); return -EINVAL; } er = (struct echo_reference *)calloc(1, sizeof(struct echo_reference)); er->itfe.read = echo_reference_read; er->itfe.write = echo_reference_write; er->state = ECHOREF_IDLE; er->rd_format = rdFormat; er->rd_channel_count = rdChannelCount; er->rd_sampling_rate = rdSamplingRate; er->wr_format = wrFormat; er->wr_channel_count = wrChannelCount; er->wr_sampling_rate = wrSamplingRate; er->rd_frame_size = audio_bytes_per_sample(rdFormat) * rdChannelCount; er->wr_frame_size = audio_bytes_per_sample(wrFormat) * wrChannelCount; *echo_reference = &er->itfe; return 0; } void release_echo_reference(struct echo_reference_itfe *echo_reference) { struct echo_reference *er = (struct echo_reference *)echo_reference; if (er == NULL) { return; } ALOGV("EchoReference dstor"); echo_reference_reset_l(er); if (er->resampler != NULL) { release_resampler(er->resampler); } free(er); } android-audiosystem-1.8+13.10.20130807/lib/audio_utils/resampler.c0000644000015700001700000002315712200324306025127 0ustar pbuserpbgroup00000000000000/* ** Copyright 2011, The Android Open-Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "resampler" #include #include #include #include #include #include struct resampler { struct resampler_itfe itfe; SpeexResamplerState *speex_resampler; // handle on speex resampler struct resampler_buffer_provider *provider; // buffer provider installed by client uint32_t in_sample_rate; // input sampling rate in Hz uint32_t out_sample_rate; // output sampling rate in Hz uint32_t channel_count; // number of channels (interleaved) int16_t *in_buf; // input buffer size_t in_buf_size; // input buffer size size_t frames_in; // number of frames in input buffer size_t frames_rq; // cached number of output frames size_t frames_needed; // minimum number of input frames to produce // frames_rq output frames int32_t speex_delay_ns; // delay introduced by speex resampler in ns }; //------------------------------------------------------------------------------ // speex based resampler //------------------------------------------------------------------------------ static void resampler_reset(struct resampler_itfe *resampler) { struct resampler *rsmp = (struct resampler *)resampler; rsmp->frames_in = 0; rsmp->frames_rq = 0; if (rsmp != NULL && rsmp->speex_resampler != NULL) { speex_resampler_reset_mem(rsmp->speex_resampler); } } static int32_t resampler_delay_ns(struct resampler_itfe *resampler) { struct resampler *rsmp = (struct resampler *)resampler; int32_t delay = (int32_t)((1000000000 * (int64_t)rsmp->frames_in) / rsmp->in_sample_rate); delay += rsmp->speex_delay_ns; return delay; } // outputs a number of frames less or equal to *outFrameCount and updates *outFrameCount // with the actual number of frames produced. int resampler_resample_from_provider(struct resampler_itfe *resampler, int16_t *out, size_t *outFrameCount) { struct resampler *rsmp = (struct resampler *)resampler; if (rsmp == NULL || out == NULL || outFrameCount == NULL) { return -EINVAL; } if (rsmp->provider == NULL) { *outFrameCount = 0; return -ENOSYS; } size_t framesRq = *outFrameCount; // update and cache the number of frames needed at the input sampling rate to produce // the number of frames requested at the output sampling rate if (framesRq != rsmp->frames_rq) { rsmp->frames_needed = (framesRq * rsmp->in_sample_rate) / rsmp->out_sample_rate + 1; rsmp->frames_rq = framesRq; } size_t framesWr = 0; size_t inFrames = 0; while (framesWr < framesRq) { if (rsmp->frames_in < rsmp->frames_needed) { // make sure that the number of frames present in rsmp->in_buf (rsmp->frames_in) is at // least the number of frames needed to produce the number of frames requested at // the output sampling rate if (rsmp->in_buf_size < rsmp->frames_needed) { rsmp->in_buf_size = rsmp->frames_needed; rsmp->in_buf = (int16_t *)realloc(rsmp->in_buf, rsmp->in_buf_size * rsmp->channel_count * sizeof(int16_t)); } struct resampler_buffer buf; buf.frame_count = rsmp->frames_needed - rsmp->frames_in; rsmp->provider->get_next_buffer(rsmp->provider, &buf); if (buf.raw == NULL) { break; } memcpy(rsmp->in_buf + rsmp->frames_in * rsmp->channel_count, buf.raw, buf.frame_count * rsmp->channel_count * sizeof(int16_t)); rsmp->frames_in += buf.frame_count; rsmp->provider->release_buffer(rsmp->provider, &buf); } size_t outFrames = framesRq - framesWr; inFrames = rsmp->frames_in; if (rsmp->channel_count == 1) { speex_resampler_process_int(rsmp->speex_resampler, 0, rsmp->in_buf, &inFrames, out + framesWr, &outFrames); } else { speex_resampler_process_interleaved_int(rsmp->speex_resampler, rsmp->in_buf, &inFrames, out + framesWr * rsmp->channel_count, &outFrames); } framesWr += outFrames; rsmp->frames_in -= inFrames; ALOGW_IF((framesWr != framesRq) && (rsmp->frames_in != 0), "ReSampler::resample() remaining %d frames in and %d frames out", rsmp->frames_in, (framesRq - framesWr)); } if (rsmp->frames_in) { memmove(rsmp->in_buf, rsmp->in_buf + inFrames * rsmp->channel_count, rsmp->frames_in * rsmp->channel_count * sizeof(int16_t)); } *outFrameCount = framesWr; return 0; } int resampler_resample_from_input(struct resampler_itfe *resampler, int16_t *in, size_t *inFrameCount, int16_t *out, size_t *outFrameCount) { struct resampler *rsmp = (struct resampler *)resampler; if (rsmp == NULL || in == NULL || inFrameCount == NULL || out == NULL || outFrameCount == NULL) { return -EINVAL; } if (rsmp->provider != NULL) { *outFrameCount = 0; return -ENOSYS; } if (rsmp->channel_count == 1) { speex_resampler_process_int(rsmp->speex_resampler, 0, in, inFrameCount, out, outFrameCount); } else { speex_resampler_process_interleaved_int(rsmp->speex_resampler, in, inFrameCount, out, outFrameCount); } ALOGV("resampler_resample_from_input() DONE in %d out % d", *inFrameCount, *outFrameCount); return 0; } int create_resampler(uint32_t inSampleRate, uint32_t outSampleRate, uint32_t channelCount, uint32_t quality, struct resampler_buffer_provider* provider, struct resampler_itfe **resampler) { int error; struct resampler *rsmp; ALOGV("create_resampler() In SR %d Out SR %d channels %d", inSampleRate, outSampleRate, channelCount); if (resampler == NULL) { return -EINVAL; } *resampler = NULL; if (quality <= RESAMPLER_QUALITY_MIN || quality >= RESAMPLER_QUALITY_MAX) { return -EINVAL; } rsmp = (struct resampler *)calloc(1, sizeof(struct resampler)); rsmp->speex_resampler = speex_resampler_init(channelCount, inSampleRate, outSampleRate, quality, &error); if (rsmp->speex_resampler == NULL) { ALOGW("ReSampler: Cannot create speex resampler: %s", speex_resampler_strerror(error)); free(rsmp); return -ENODEV; } rsmp->itfe.reset = resampler_reset; rsmp->itfe.resample_from_provider = resampler_resample_from_provider; rsmp->itfe.resample_from_input = resampler_resample_from_input; rsmp->itfe.delay_ns = resampler_delay_ns; rsmp->provider = provider; rsmp->in_sample_rate = inSampleRate; rsmp->out_sample_rate = outSampleRate; rsmp->channel_count = channelCount; rsmp->in_buf = NULL; rsmp->in_buf_size = 0; resampler_reset(&rsmp->itfe); int frames = speex_resampler_get_input_latency(rsmp->speex_resampler); rsmp->speex_delay_ns = (int32_t)((1000000000 * (int64_t)frames) / rsmp->in_sample_rate); frames = speex_resampler_get_output_latency(rsmp->speex_resampler); rsmp->speex_delay_ns += (int32_t)((1000000000 * (int64_t)frames) / rsmp->out_sample_rate); *resampler = &rsmp->itfe; ALOGV("create_resampler() DONE rsmp %p &rsmp->itfe %p speex %p", rsmp, &rsmp->itfe, rsmp->speex_resampler); return 0; } void release_resampler(struct resampler_itfe *resampler) { struct resampler *rsmp = (struct resampler *)resampler; if (rsmp == NULL) { return; } free(rsmp->in_buf); if (rsmp->speex_resampler != NULL) { speex_resampler_destroy(rsmp->speex_resampler); } free(rsmp); } android-audiosystem-1.8+13.10.20130807/lib/audio_utils/primitives.c0000644000015700001700000000310112200324306025313 0ustar pbuserpbgroup00000000000000/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include void ditherAndClamp(int32_t* out, int32_t const *sums, size_t c) { size_t i; for (i=0 ; i> 12; int32_t nr = r >> 12; l = clamp16(nl); r = clamp16(nr); *out++ = (r<<16) | (l & 0xFFFF); } } void memcpy_to_i16_from_u8(int16_t *dst, const uint8_t *src, size_t count) { dst += count; src += count; while (count--) { *--dst = (int16_t)(*--src - 0x80) << 8; } } void downmix_to_mono_i16_from_stereo_i16(int16_t *dst, const int16_t *src, size_t count) { while (count--) { *dst++ = (int16_t)(((int32_t)src[0] + (int32_t)src[1]) >> 1); src += 2; } } void upmix_to_stereo_i16_from_mono_i16(int16_t *dst, const int16_t *src, size_t count) { while (count--) { int32_t temp = *src++; dst[0] = temp; dst[1] = temp; dst += 2; } } android-audiosystem-1.8+13.10.20130807/target_lib0000644000015700001700000000615312200324306021736 0ustar pbuserpbgroup00000000000000 # This file contains make information for building a library leaf TOOLS_PREFIX= ifeq ($(FORCE_CXX_LINK),TRUE) LINKER := $(TOOLS_PREFIX)g++ else LINKER := $(TOOLS_PREFIX)gcc endif ifeq ($(USE_GETTEXT_I18N),TRUE) #Create a target to create a POT file in the po folder GENPOT = $(PODIR)/$(GETTEXT_PACKAGE).pot #Add POT file to the clean list CLEAN += $(GENPOT) #Generate as many .mo files as the number of languages supported #They all go to ${DEBIAN}/usr/local/share/locale//LC_MESSAGES/.mo GENMO = $(foreach LOCALE,$(SUPPORTED_LOCALES), $(install_locale)/$(LOCALE)/LC_MESSAGES/$(GETTEXT_PACKAGE).mo) #Rule to generate mo file in the debian folder $(install_locale)/%/LC_MESSAGES/$(GETTEXT_PACKAGE).mo: $(PODIR)/$(GETTEXT_PACKAGE).%.po mkdir -p $(dir $@) msgfmt $< -o $@ endif ifeq ($(PKGCONFIG),NO) ifeq ($(private_lib),YES) # $(private_lib) = YES # targets for simple static libraries, not exported TARGET = lib$(PKG_LIB).a CLEAN += $(TARGET) all : $(TARGET) lib : $(TARGET) $(TARGET) : $(DEPENDS) $(OBJECTS) $(GENPOT) $(GENMO) $(AR) $(ARFLAGS) $(TARGET) $(OBJECTS) clean : $(REMOVE) $(CLEAN) else # $(private_lib) = NO # targets for simple libraries, single .so and single .h exported LIBVERSION = $(LIBMAJOR).$(LIBMINOR) ifneq ($(LIBVERSION),.) TARGET = lib$(PKG_LIB).so.$(LIBVERSION) SONAME = lib$(PKG_LIB).so.$(LIBMAJOR) else TARGET = lib$(PKG_LIB).so SONAME = $(TARGET) endif CLEAN += lib$(PKG_LIB).so* all : $(TARGET) lib : $(TARGET) $(TARGET) : $(DEPENDS) $(OBJECTS) $(GENPOT) $(GENMO) $(LINKER) $(LDFLAGS) --shared -Wl,-soname,$(SONAME) -o $(TARGET) $(OBJECTS) $(STATIC_LIBS) $(SHARED_LIBS) ifneq ($(LIBVERSION),.) $(LINK) $(TARGET) lib$(PKG_LIB).so.$(LIBMAJOR) $(LINK) $(TARGET) lib$(PKG_LIB).so endif clean : $(REMOVE) $(CLEAN) ifeq ($(MAKESUBDIR),YES) install_lib := $(install_home)/$(LIBSUBDIR) install_hdr := $(install_home)/$(HDRSUBDIR) install : $(TARGET) $(MKDIR) $(install_lib) $(MKDIR) $(install_hdr) $(COPY) lib$(PKG_LIB).so* $(install_lib) $(COPY) $(top_srcdir)/lib/include/$(PKG_LIB).h $(install_hdr) else install : $(TARGET) $(COPY) lib$(PKG_LIB).so* $(install_lib) $(COPY) $(top_srcdir)/lib/include/$(PKG_LIB).h $(install_hdr) endif endif else # $(PKGCONFIG) = YES # pkgconfig shared object library, exported LIBVERSION = $(LIBMAJOR).$(LIBMINOR) ifneq ($(LIBVERSION),.) TARGET = lib$(PKG_LIB).so.$(LIBVERSION) SONAME = lib$(PKG_LIB).so.$(LIBMAJOR) else TARGET = lib$(PKG_LIB).so SONAME = $(TARGET) endif PCNAME = $(PKG_LIB).pc CLEAN += lib$(PKG_LIB).so* $(PCNAME) all : $(TARGET) lib : $(TARGET) $(TARGET) : $(OBJECTS) $(GENPOT) $(GENMO) $(LINKER) $(LDFLAGS) --shared -Wl,-soname,$(SONAME) -o $(TARGET) $(OBJECTS) $(STATIC_LIBS) ifneq ($(LIBVERSION),.) $(LINK) $(TARGET) lib$(PKG_LIB).so.$(LIBMAJOR) $(LINK) $(TARGET) lib$(PKG_LIB).so endif # $(make_home)/gen_pkgconfig $(LIBSUBDIR) $(PCNAME) $(PKG_LIB) "$(PKG_VERSION)" "$(PKG_LIBDESC)" "$(PKG_REQUIRES)" clean : $(REMOVE) $(CLEAN) install : $(TARGET) $(MKDIR) $(install_hdr)/$(PKG_LIB) $(COPY) lib$(PKG_LIB).so* $(install_lib) # $(COPY) $(PCNAME) $(install_lib)/pkgconfig $(COPY) $(PKG_HEADERS) $(install_hdr)/$(PKG_LIB) endif android-audiosystem-1.8+13.10.20130807/build.sh0000755000015700001700000000047512200324306021336 0ustar pbuserpbgroup00000000000000#!/bin/sh apt-get install zlib1g-dev apt-get install libasound2-dev target='armel' export INSTALL_ROOT=1 mkdir -p /usr/lib/ufa mkdir -p /usr/include/ufa cd lib ./build-tree.sh clean $target ./build-tree.sh all $target ./build-tree.sh install $target cd .. cd app ./build.sh cd .. ret_value=$? exit $ret_value android-audiosystem-1.8+13.10.20130807/COPYING.LGPL0000644000015700001700000006347612200324306021502 0ustar pbuserpbgroup00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! android-audiosystem-1.8+13.10.20130807/build-component.sh0000755000015700001700000000565012200324306023336 0ustar pbuserpbgroup00000000000000#!/bin/sh set -e cwd=`pwd` target="" ret_value=0 # build up our list of targets for i; do case $1 in --native) environment=native; shift;; # --cross) environment=cross; shift;; --compile) target="all"; shift;; --clean) target="clean"; shift;; --install) target="install"; shift;; esac if [ $# -eq 0 ] then break fi done architecture=`dpkg-architecture -qDEB_HOST_ARCH` echo "***********************************" echo "architecture[$architecture]..environment[$environment]..target[$target]" echo "***********************************" touch makedirs.$$ # create our file lists find . -name "Makefile" -print >> makedirs.$$ awk '{ print substr($0, 0, index($0, "Makefile")-1) }' makedirs.$$ > dirslist.$$ # create .obj and .dep directories for file in $(cat dirslist.$$) do mkdir -p ${file}/.obj touch ${file}/.obj/.gitignore mkdir -p ${file}/.dep touch ${file}/.dep/.gitignore done mkdir -p lib/libcutils/.obj/arch-arm mkdir -p lib/libcutils/.obj/arch-x86 touch lib/libcutils/.obj/arch-arm/.gitignore touch lib/libcutils/.obj/arch-x86/.gitignore mkdir -p lib/libcutils/.dep/arch-arm mkdir -p lib/libcutils/.dep/arch-x86 rm -fr makedirs.$$ dirslist.$$ # do we have any targets to execute on? if [ V"$target" != V ] then # single or multiple libraries? if [ -d lib -a -e lib/Makefile ] then echo "*******************************************" echo "build-component.sh MAKE ARCH=$architecture -C $cwd/lib $target" echo "*******************************************" make ARCH=$architecture -C $cwd/lib $target ret_value=$? elif [ -d lib ] then echo "********************************************" echo "build-component.sh lib/build-tree.sh $environment $target" echo "********************************************" cd lib ./build-tree.sh $environment $target ret_value=$? cd .. fi if [ $ret_value -eq 0 ] then # single or multiple applications? if [ -d app -a -e app/Makefile ] then echo "*******************************************" echo "build-component.sh MAKE ARCH=$architecture -C $cwd/app $target" echo "*******************************************" make ARCH=$architecture -C $cwd/app $target ret_value=$? elif [ -d app ] then echo "********************************************" echo "build-component.sh app/build-tree.sh $environment $target" echo "********************************************" cd app ./build-tree.sh $environment $target ret_value=$? cd .. fi fi if [ $ret_value -eq 0 ] then if [ "$target" = "install" -a -d $cwd/../data ] then PKG_NAME=`cat pkg_name` echo "********************************************" echo "build-component.sh INSTALLING data directory" echo "********************************************" mkdir -p $cwd/debian/$PKG_NAME/usr/local/share/motorola/$PKG_NAME cp -fa $cwd/../data/* $cwd/debian/$PKG_NAME/usr/local/share/motorola/$PKG_NAME ret_value=$? fi fi fi exit $ret_value android-audiosystem-1.8+13.10.20130807/project_make0000644000015700001700000000757412200324306022275 0ustar pbuserpbgroup00000000000000 # This file contains project specific Makefile information # Macros, targets, etc. DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) ##################### # Directory hierarchy ##################### install_app_rel = usr/bin/ install_lib_rel = usr/lib/$(DEB_HOST_MULTIARCH)/ install_hdr_rel = usr/include/ ifeq ($(INSTALL_ROOT),1) install_home = else install_home = $(top_srcdir)/debian/tmp endif install_app = $(install_home)/$(install_app_rel) install_lib = $(install_home)/$(install_lib_rel) install_hdr = $(install_home)/$(install_hdr_rel) target_locale_dir = /usr/share/locale install_locale = $(install_home)$(target_locale_dir) OBJDIR = .obj DEPDIR = .dep PODIR = po ####### # Tools ####### AR = $(TOOLS_PREFIX)ar CC = $(TOOLS_PREFIX)gcc CXX = $(TOOLS_PREFIX)g++ CPP = $(CC) -E COPY = /bin/cp -a ECHO = /bin/echo LINK = /bin/ln -s MKDIR = /bin/mkdir -p REMOVE = /bin/rm -f TOUCH = /usr/bin/touch XGETTEXT = /usr/bin/xgettext ####### # Flags ####### # compiler flags ################ CFLAGS = INCLUDE = -I. -I$(top_srcdir)/include -I$(top_srcdir)/lib/include -I$(mot_home)/include -I$(oss_home)/include OPTIMIZE = DEBUG = -g -ggdb WARN = -Wall -Werror COMMON_FLAGS = $(X_CC_FLAGS) $(INCLUDE) $(DEBUG) $(OPTIMIZE) $(WARN) $(PKGCFLAGS) $(CFLAGS) -DPKG_NAME='"$(PKG_NAME)"' -DPKG_VERSION='"$(PKG_VERSION)"' -DARCH='"$(ARCH)"' ifeq ($(USE_GETTEXT_I18N),TRUE) COMMON_FLAGS += -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" -DGETTEXT_LOCALE_DIR=\"$(target_locale_dir)\" endif C_FLAGS = $(COMMON_FLAGS) CC_FLAGS = -D__cpluscplus $(COMMON_FLAGS) CXX_FLAGS = -D__cpluscplus $(COMMON_FLAGS) CPP_FLAGS = -D__cpluscplus $(COMMON_FLAGS) XGETTEXT_FLAGS = --no-location --copyright-holder="2010 Motorola Inc. 2011-2012 Canonical, Ltd. All rights reserved." --package-name=$(GETTEXT_PACKAGE) --package-version=1.0 --no-wrap -k_ -kN_ # linker flags ############## OSSLIBS = -L$(oss_home)/lib MOTLIBS = -L$(mot_home)/lib PKGLIBS = LIBS = $(PKGLIBS) $(MOTLIBS) $(OSSLIBS) # filled in by individual Makefile LDSYSLIBS = LDFLAGS = LD_FLAGS = $(X_LD_FLAGS) $(LIBS) $(LDSYSLIBS) $(PKGLDFLAGS) $(LDFLAGS) # archiver flags ################ ARFLAGS = cr OSS_PKG_CONFIG_PATH = $(oss_home)/lib/pkgconfig MOT_PKG_CONFIG_PATH = $(mot_home)/lib/pkgconfig ############################ # Derived Target File Macros ############################ vpath vpath %.o $(OBJDIR) vpath %.d $(DEPDIR) SOURCES = \ $(CPPFILES) \ $(CXXFILES) \ $(CCFILES) \ $(CFILES) \ $(SFILES) \ $(sFILES) OBJECTS = $(addprefix $(OBJDIR)/, $(addsuffix .o, $(basename $(SOURCES)))) DEPENDS = $(addprefix $(DEPDIR)/, $(addsuffix .d, $(basename $(SOURCES)))) CLEAN = $(OBJECTS) $(DEPENDS) GENPOT = GENMO = ######################## # Implicit Rules Section ######################## SUFFIXES = .o .c .cc .cxx .cpp .d .h .xml .s .S .pot .SUFFIXES: .SUFFIXES: $(SUFFIXES) $(OBJDIR)/%.o : %.S $(CC) $(C_FLAGS) -c $< -o $@ $(DEPDIR)/%.d : %.S $(CC) $(C_FLAGS) -MM $< > $@ sed -i "s|$(*F).o|$(*F).o $(@F)|" $@ $(OBJDIR)/%.o : %.s $(CC) $(C_FLAGS) -c $< -o $@ $(DEPDIR)/%.d : %.s $(CC) $(C_FLAGS) -MM $< > $@ sed -i "s|$(*F).o|$(*F).o $(@F)|" $@ $(OBJDIR)/%.o : %.c $(CC) $(C_FLAGS) -c $< -o $@ $(DEPDIR)/%.d : %.c $(CC) $(C_FLAGS) -MM $< > $@ sed -i "s|$(*F).o|$(*F).o $(@F)|" $@ $(OBJDIR)/%.o : %.cc $(CXX) $(CC_FLAGS) -c $< -o $@ $(DEPDIR)/%.d : %.cc $(CXX) $(CC_FLAGS) -MM $< > $@ sed -i "s|$(*F).o|$(*F).o $(@F)|" $@ $(OBJDIR)/%.o : %.cxx $(CXX) $(CXX_FLAGS) -c $< -o $@ $(DEPDIR)/%.d : %.cxx $(CXX) $(CXX_FLAGS) -MM $< > $@ sed -i "s|$(*F).o|$(*F).o $(@F)|" $@ $(OBJDIR)/%.o : %.cpp $(CXX) $(CPP_FLAGS) -c $< -o $@ $(DEPDIR)/%.d : %.cpp $(CXX) $(CPP_FLAGS) -MM $< > $@ sed -i "s|$(*F).o|$(*F).o $(@F)|" $@ #Rule to generate the pot file in the po folder $(PODIR)/%.pot: $(I18NFILES) $(XGETTEXT) $(XGETTEXT_FLAGS) $(I18NFILES) -o $@ .PHONY : all clean app lib install android-audiosystem-1.8+13.10.20130807/etc/0000755000015700001700000000000012200324404020444 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/etc/asound.conf0000644000015700001700000000027412200324306022610 0ustar pbuserpbgroup00000000000000#pcm.!default { # type android # } ctl.!default { type android } pcm.android { type android } ctl.android { type android } android-audiosystem-1.8+13.10.20130807/etc/pulse/0000755000015700001700000000000012200324404021574 5ustar pbuserpbgroup00000000000000android-audiosystem-1.8+13.10.20130807/etc/pulse/daemon.conf0000644000015700001700000000374012200324306023713 0ustar pbuserpbgroup00000000000000# This file is part of PulseAudio. # # PulseAudio is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PulseAudio is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with PulseAudio; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA. ## Configuration file for the PulseAudio daemon. See pulse-daemon.conf(5) for ## more information. Default values a commented out. Use either ; or # for ## commenting. ; daemonize = no ; fail = yes ; disallow-module-loading = no ; disallow-exit = no ; use-pid-file = yes ; system-instance = no ; disable-shm = no ; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB ; high-priority = yes ; nice-level = -11 ; realtime-scheduling = no ; realtime-priority = 5 exit-idle-time = 120 ; module-idle-time = 20 ; scache-idle-time = 20 ; dl-search-path = (depends on architecture) ; load-default-script-file = yes ; default-script-file = ; log-target = auto ; log-level = notice resample-method = ffmpeg ; disable-remixing = no ; disable-lfe-remixing = yes ; no-cpu-limit = no ; rlimit-fsize = -1 ; rlimit-data = -1 ; rlimit-stack = -1 ; rlimit-core = -1 ; rlimit-as = -1 ; rlimit-rss = -1 ; rlimit-nproc = -1 ; rlimit-nofile = 256 ; rlimit-memlock = -1 ; rlimit-locks = -1 ; rlimit-sigpending = -1 ; rlimit-msgqueue = -1 ; rlimit-nice = 31 ; rlimit-rtprio = 9 ; rlimit-rtttime = 1000000 ; default-sample-format = s16le ; default-sample-rate = 44100 ; default-sample-channels = 2 default-fragments = 8 default-fragment-size-msec = 10 android-audiosystem-1.8+13.10.20130807/etc/pulse/default.pa0000644000015700001700000001067012200324306023547 0ustar pbuserpbgroup00000000000000#!/usr/bin/pulseaudio -nF # # This file is part of PulseAudio. # # PulseAudio is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # PulseAudio is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with PulseAudio; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. # This startup script is used only if PulseAudio is started per-user # (i.e. not in system mode) .nofail ### Load something into the sample cache #load-sample-lazy x11-bell /usr/share/sounds/gtk-events/activate.wav #load-sample-lazy pulse-hotplug /usr/share/sounds/startup3.wav #load-sample-lazy pulse-coldplug /usr/share/sounds/startup3.wav #load-sample-lazy pulse-access /usr/share/sounds/generic.wav load-sample-dir-lazy /usr/share/sounds/ubuntu/stereo .fail ### Load additional modules from GConf settings. This can be configured with the paprefs tool. ### Please keep in mind that the modules configured by paprefs might conflict with manually ### loaded modules. .ifexists module-gconf.so .nofail load-module module-gconf .fail .endif ### Automatically suspend sinks/sources that become idle for too long load-module module-suspend-on-idle ### Automatically restore the volume of streams and devices load-module module-device-restore load-module module-stream-restore ### Load audio drivers statically (it's probably better to not load ### these drivers manually, but instead use module-hal-detect -- ### see below -- for doing this automatically) load-module module-alsa-sink device=android #load-module module-alsa-sink #load-module module-alsa-source device=hw:1,0 #load-module module-oss device="/dev/dsp" sink_name=output source_name=input #load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input #load-module module-null-sink #load-module module-pipe-sink ### Automatically load driver modules depending on the hardware available .ifexists module-hal-detect.so load-module module-hal-detect tsched=0 .else ### Alternatively use the static hardware detection module (for systems that ### lack HAL support) #load-module module-detect .endif ### Automatically load driver modules for Bluetooth hardware #.ifexists module-bluetooth-discover.so #load-module module-bluetooth-discover #.endif ### Load several protocols .ifexists module-esound-protocol-unix.so load-module module-esound-protocol-unix .endif load-module module-native-protocol-unix ### Network access (may be configured with paprefs, so leave this commented ### here if you plan to use paprefs) #load-module module-esound-protocol-tcp #load-module module-native-protocol-tcp #load-module module-zeroconf-publish ### Load the RTP reciever module (also configured via paprefs, see above) #load-module module-rtp-recv ### Load the RTP sender module (also configured via paprefs, see above) #load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 description="RTP Multicast Sink" #load-module module-rtp-send source=rtp.monitor ### Automatically restore the default sink/source when changed by the user during runtime load-module module-default-device-restore ### Automatically move streams to the default sink if the sink they are ### connected to dies, similar for sources load-module module-rescue-streams ### Make sure we always have a sink around, even if it is a null sink. load-module module-always-sink ### If autoexit on idle is enabled we want to make sure we only quit ### when no local session needs us anymore. #load-module module-console-kit ### Enable positioned event sounds load-module module-position-event-sounds # X11 modules should not be started from default.pa so that one daemon # can be shared by multiple sessions. ### Load X11 bell module #load-module module-x11-bell sample=bell-windowing-system ### Register ourselves in the X11 session manager #load-module module-x11-xsmp ### Publish connection data in the X11 root window #.ifexists module-x11-publish.so #.nofail #load-module module-x11-publish #.fail #.endif ### Make some devices default #set-default-sink output #set-default-source input