diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/media/AudioSystem.h | 15 | ||||
-rw-r--r-- | include/media/stagefright/foundation/ADebug.h | 30 | ||||
-rw-r--r-- | include/media/stagefright/foundation/AStringUtils.h | 36 |
3 files changed, 73 insertions, 8 deletions
diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h index 6a0f2a6..1614525 100644 --- a/include/media/AudioSystem.h +++ b/include/media/AudioSystem.h @@ -90,7 +90,7 @@ public: static void setErrorCallback(audio_error_callback cb); // helper function to obtain AudioFlinger service handle - static const sp<IAudioFlinger>& get_audio_flinger(); + static const sp<IAudioFlinger> get_audio_flinger(); static float linearToLog(int volume); static int logToLinear(float volume); @@ -99,8 +99,6 @@ public: // to be non-zero if status == NO_ERROR static status_t getOutputSamplingRate(uint32_t* samplingRate, audio_stream_type_t stream); - static status_t getOutputSamplingRateForAttr(uint32_t* samplingRate, - const audio_attributes_t *attr); static status_t getOutputFrameCount(size_t* frameCount, audio_stream_type_t stream); static status_t getOutputLatency(uint32_t* latency, @@ -272,7 +270,7 @@ public: // and output configuration cache (gOutputs) static void clearAudioConfigCache(); - static const sp<IAudioPolicyService>& get_audio_policy_service(); + static const sp<IAudioPolicyService> get_audio_policy_service(); // helpers for android.media.AudioManager.getProperty(), see description there for meaning static uint32_t getPrimaryOutputSamplingRate(); @@ -375,10 +373,11 @@ private: friend class AudioFlingerClient; friend class AudioPolicyServiceClient; - static Mutex gLock; // protects all members except gAudioPolicyService, - // gAudioPolicyServiceClient, and gAudioPortCallback - static Mutex gLockAPS; // protects gAudioPolicyService and gAudioPolicyServiceClient - static Mutex gLockAPC; // protects gAudioPortCallback + static Mutex gLock; // protects gAudioFlinger and gAudioErrorCallback, + static Mutex gLockCache; // protects gOutputs, gPrevInSamplingRate, gPrevInFormat, + // gPrevInChannelMask and gInBuffSize + static Mutex gLockAPS; // protects gAudioPolicyService and gAudioPolicyServiceClient + static Mutex gLockAPC; // protects gAudioPortCallback static sp<IAudioFlinger> gAudioFlinger; static audio_error_callback gAudioErrorCallback; diff --git a/include/media/stagefright/foundation/ADebug.h b/include/media/stagefright/foundation/ADebug.h index 450dcfe..1d0e2cb 100644 --- a/include/media/stagefright/foundation/ADebug.h +++ b/include/media/stagefright/foundation/ADebug.h @@ -80,6 +80,36 @@ MAKE_COMPARATOR(GT,>) __FILE__ ":" LITERAL_TO_STRING(__LINE__) \ " Should not be here."); +struct ADebug { + enum Level { + kDebugNone, // no debug + kDebugLifeCycle, // lifecycle events: creation/deletion + kDebugState, // commands and events + kDebugConfig, // configuration + kDebugInternalState, // internal state changes + kDebugAll, // all + kDebugMax = kDebugAll, + + }; + + // parse the property or string to get the debug level for a component name + // string format is: + // <level>[:<glob>][,<level>[:<glob>]...] + // - <level> is 0-5 corresponding to ADebug::Level + // - <glob> is used to match component name case insensitively, if omitted, it + // matches all components + // - string is read left-to-right, and the last matching level is returned, or + // the def if no terms matched + static Level GetDebugLevelFromProperty( + const char *name, const char *propertyName, Level def = kDebugNone); + static Level GetDebugLevelFromString( + const char *name, const char *value, Level def = kDebugNone); + + // remove redundant segments of a codec name, and return a newly allocated + // string suitable for debugging + static char *GetDebugName(const char *name); +}; + } // namespace android #endif // A_DEBUG_H_ diff --git a/include/media/stagefright/foundation/AStringUtils.h b/include/media/stagefright/foundation/AStringUtils.h new file mode 100644 index 0000000..76a7791 --- /dev/null +++ b/include/media/stagefright/foundation/AStringUtils.h @@ -0,0 +1,36 @@ +/* + * Copyright 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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_UTILS_H_ +#define A_STRING_UTILS_H_ + +#include <stdlib.h> + +namespace android { + +struct AStringUtils { + // similar to strncmp or strcasecmp, but case sensitivity is parametric + static int Compare(const char *a, const char *b, size_t len, bool ignoreCase); + + // matches a string (str) to a glob pattern that supports: + // * - matches any number of characters + static bool MatchesGlob( + const char *glob, size_t globLen, const char *str, size_t strLen, bool ignoreCase); +}; + +} // namespace android + +#endif // A_STRING_UTILS_H_ |