diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:45 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:45 -0800 |
commit | 15f767b960b38059a74a42a33e16d8df2aec8bc1 (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /include | |
parent | ad04d9201452001dbaac4349f084cc9316190b89 (diff) | |
download | frameworks_av-15f767b960b38059a74a42a33e16d8df2aec8bc1.zip frameworks_av-15f767b960b38059a74a42a33e16d8df2aec8bc1.tar.gz frameworks_av-15f767b960b38059a74a42a33e16d8df2aec8bc1.tar.bz2 |
auto import from //depot/cupcake/@135843
Diffstat (limited to 'include')
33 files changed, 0 insertions, 4141 deletions
diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h deleted file mode 100644 index dd585c9..0000000 --- a/include/media/AudioRecord.h +++ /dev/null @@ -1,337 +0,0 @@ -/* - * 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 <stdint.h> -#include <sys/types.h> - -#include <media/IAudioFlinger.h> -#include <media/IAudioRecord.h> -#include <media/AudioTrack.h> - -#include <utils/RefBase.h> -#include <utils/Errors.h> -#include <utils/IInterface.h> -#include <utils/IMemory.h> -#include <utils/threads.h> - - -namespace android { - -// ---------------------------------------------------------------------------- - -class AudioRecord -{ -public: - - enum stream_type { - DEFAULT_INPUT =-1, - MIC_INPUT = 0, - NUM_STREAM_TYPES - }; - - static const int DEFAULT_SAMPLE_RATE = 8000; - - /* Events used by AudioRecord callback function (callback_t). - * - * to keep in sync with frameworks/base/media/java/android/media/AudioRecord.java - */ - enum event_type { - EVENT_MORE_DATA = 0, // Request to reqd 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; - int format; - size_t frameCount; - size_t size; - union { - void* raw; - short* i16; - int8_t* i8; - }; - }; - - /* These are static methods to control the system-wide AudioFlinger - * only privileged processes can have access to them - */ - -// static status_t setMasterMute(bool mute); - - /* 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 an uin32_t containing the marker position in frames. - * - EVENT_NEW_POS: pointer to an uin32_t containing the new position in frames. - */ - - typedef void (*callback_t)(int event, void* user, void *info); - - /* 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: - * - * streamType: Select the audio input to record to (e.g. AudioRecord::MIC_INPUT). - * sampleRate: Track sampling rate in Hz. - * format: PCM sample format (e.g AudioSystem::PCM_16_BIT for signed - * 16 bits per sample). - * channelCount: Number of PCM channels (e.g 2 for stereo). - * frameCount: Total size of track PCM buffer in frames. This defines the - * latency of the track. - * flags: Reserved for future use. - * cbf: Callback function. If not null, this function is called periodically - * to provide new PCM data. - * notificationFrames: The callback function is called each time notificationFrames PCM - * frames are ready in record track output buffer. - * user Context for use by the callback receiver. - */ - - AudioRecord(int streamType, - uint32_t sampleRate = 0, - int format = 0, - int channelCount = 0, - int frameCount = 0, - uint32_t flags = 0, - callback_t cbf = 0, - void* user = 0, - int notificationFrames = 0); - - - /* Terminates the AudioRecord and unregisters it from AudioFlinger. - * Also destroys all resources assotiated 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 (channelCount, format, sampleRate...) - * - NO_INIT: audio server or audio hardware not initialized - * - PERMISSION_DENIED: recording is not allowed for the requesting process - * */ - status_t set(int streamType = 0, - uint32_t sampleRate = 0, - int format = 0, - int channelCount = 0, - int frameCount = 0, - uint32_t flags = 0, - callback_t cbf = 0, - void* user = 0, - int notificationFrames = 0, - bool threadCanCallJava = false); - - - /* 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 */ - - uint32_t sampleRate() const; - int format() const; - int channelCount() const; - uint32_t frameCount() const; - int frameSize() const; - - - /* After it's created the track is not active. Call start() to - * make it active. If set, the callback will start being called. - */ - status_t 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. - */ - status_t stop(); - bool stopped() const; - - /* get sample rate for this track - */ - uint32_t getSampleRate(); - - /* 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); - - - /* 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); - - - /* 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); - - - - /* 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 availlable, - * 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 lockBuffer/unlockBuffer. - */ - ssize_t read(void* buffer, size_t size); - -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 ClientRecordThread : public Thread - { - public: - ClientRecordThread(AudioRecord& receiver, bool bCanCallJava = false); - private: - friend class AudioRecord; - virtual bool threadLoop(); - virtual status_t readyToRun() { return NO_ERROR; } - virtual void onFirstRef() {} - AudioRecord& mReceiver; - Mutex mLock; - }; - - bool processAudioBuffer(const sp<ClientRecordThread>& thread); - - sp<IAudioFlinger> mAudioFlinger; - sp<IAudioRecord> mAudioRecord; - sp<IMemory> mCblkMemory; - sp<ClientRecordThread> mClientRecordThread; - Mutex mRecordThreadLock; - - uint32_t mSampleRate; - uint32_t mFrameCount; - - audio_track_cblk_t* mCblk; - uint8_t mFormat; - uint8_t mChannelCount; - uint8_t mReserved[2]; - status_t mStatus; - uint32_t mLatency; - - volatile int32_t mActive; - - callback_t mCbf; - void* mUserData; - uint32_t mNotificationFrames; - uint32_t mRemainingFrames; - uint32_t mMarkerPosition; - uint32_t mNewPosition; - uint32_t mUpdatePeriod; -}; - -}; // namespace android - -#endif /*AUDIORECORD_H_*/ diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h deleted file mode 100644 index 77c90ba..0000000 --- a/include/media/AudioSystem.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * 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 <utils/RefBase.h> -#include <utils/threads.h> -#include <media/IAudioFlinger.h> - -namespace android { - -typedef void (*audio_error_callback)(status_t err); - -class AudioSystem -{ -public: - - enum stream_type { - DEFAULT =-1, - VOICE_CALL = 0, - SYSTEM = 1, - RING = 2, - MUSIC = 3, - ALARM = 4, - NOTIFICATION = 5, - BLUETOOTH_SCO = 6, - NUM_STREAM_TYPES - }; - - enum audio_output_type { - AUDIO_OUTPUT_DEFAULT =-1, - AUDIO_OUTPUT_HARDWARE = 0, - AUDIO_OUTPUT_A2DP = 1, - NUM_AUDIO_OUTPUT_TYPES - }; - - enum audio_format { - FORMAT_DEFAULT = 0, - PCM_16_BIT, - PCM_8_BIT, - INVALID_FORMAT - }; - - enum audio_mode { - MODE_INVALID = -2, - MODE_CURRENT = -1, - MODE_NORMAL = 0, - MODE_RINGTONE, - MODE_IN_CALL, - NUM_MODES // not a valid entry, denotes end-of-list - }; - - enum audio_routes { - ROUTE_EARPIECE = (1 << 0), - ROUTE_SPEAKER = (1 << 1), - ROUTE_BLUETOOTH_SCO = (1 << 2), - ROUTE_HEADSET = (1 << 3), - ROUTE_BLUETOOTH_A2DP = (1 << 4), - ROUTE_ALL = -1UL, - }; - - enum audio_in_acoustics { - AGC_ENABLE = 0x0001, - AGC_DISABLE = 0, - NS_ENABLE = 0x0002, - NS_DISABLE = 0, - TX_IIR_ENABLE = 0x0004, - TX_DISABLE = 0 - }; - - /* These are static methods to control the system-wide AudioFlinger - * only privileged processes can have access to them - */ - - // routing helper functions - static status_t speakerphone(bool state); - static status_t isSpeakerphoneOn(bool* state); - static status_t bluetoothSco(bool state); - static status_t isBluetoothScoOn(bool* state); - static status_t muteMicrophone(bool state); - static status_t isMicrophoneMuted(bool *state); - - static status_t setMasterVolume(float value); - static status_t setMasterMute(bool mute); - static status_t getMasterVolume(float* volume); - static status_t getMasterMute(bool* mute); - - static status_t setStreamVolume(int stream, float value); - static status_t setStreamMute(int stream, bool mute); - static status_t getStreamVolume(int stream, float* volume); - static status_t getStreamMute(int stream, bool* mute); - - static status_t setMode(int mode); - static status_t getMode(int* mode); - - static status_t setRouting(int mode, uint32_t routes, uint32_t mask); - static status_t getRouting(int mode, uint32_t* routes); - - static status_t isMusicActive(bool *state); - - // Temporary interface, do not use - // TODO: Replace with a more generic key:value get/set mechanism - static status_t setParameter(const char* key, const char* value); - - static void setErrorCallback(audio_error_callback cb); - - // helper function to obtain AudioFlinger service handle - static const sp<IAudioFlinger>& get_audio_flinger(); - - static float linearToLog(int volume); - static int logToLinear(float volume); - - static status_t getOutputSamplingRate(int* samplingRate, int stream = DEFAULT); - static status_t getOutputFrameCount(int* frameCount, int stream = DEFAULT); - static status_t getOutputLatency(uint32_t* latency, int stream = DEFAULT); - - static bool routedToA2dpOutput(int streamType); - - static status_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount, - size_t* buffSize); - - // ---------------------------------------------------------------------------- - -private: - - class AudioFlingerClient: public IBinder::DeathRecipient, public BnAudioFlingerClient - { - public: - AudioFlingerClient() { - } - - // DeathRecipient - virtual void binderDied(const wp<IBinder>& who); - - // IAudioFlingerClient - virtual void a2dpEnabledChanged(bool enabled); - - }; - static int getOutput(int streamType); - - static sp<AudioFlingerClient> gAudioFlingerClient; - - friend class AudioFlingerClient; - - static Mutex gLock; - static sp<IAudioFlinger> gAudioFlinger; - static audio_error_callback gAudioErrorCallback; - static int gOutSamplingRate[NUM_AUDIO_OUTPUT_TYPES]; - static int gOutFrameCount[NUM_AUDIO_OUTPUT_TYPES]; - static uint32_t gOutLatency[NUM_AUDIO_OUTPUT_TYPES]; - static bool gA2dpEnabled; - - static size_t gInBuffSize; - // previous parameters for recording buffer size queries - static uint32_t gPrevInSamplingRate; - static int gPrevInFormat; - static int gPrevInChannelCount; - -}; - -}; // namespace android - -#endif /*ANDROID_AUDIOSYSTEM_H_*/ diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h deleted file mode 100644 index 659f5f8..0000000 --- a/include/media/AudioTrack.h +++ /dev/null @@ -1,419 +0,0 @@ -/* - * 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 <stdint.h> -#include <sys/types.h> - -#include <media/IAudioFlinger.h> -#include <media/IAudioTrack.h> -#include <media/AudioSystem.h> - -#include <utils/RefBase.h> -#include <utils/Errors.h> -#include <utils/IInterface.h> -#include <utils/IMemory.h> -#include <utils/threads.h> - - -namespace android { - -// ---------------------------------------------------------------------------- - -class audio_track_cblk_t; - -// ---------------------------------------------------------------------------- - -class AudioTrack -{ -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. - }; - - /* Create Buffer on the stack and pass it to obtainBuffer() - * and releaseBuffer(). - */ - - class Buffer - { - public: - enum { - MUTE = 0x00000001 - }; - uint32_t flags; - int channelCount; - int format; - size_t frameCount; - size_t size; - 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 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); - - /* 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. AudioSystem::MUSIC). - * sampleRate: Track sampling rate in Hz. - * format: PCM sample format (e.g AudioSystem::PCM_16_BIT for signed - * 16 bits per sample). - * channelCount: Number of PCM channels (e.g 2 for stereo). - * frameCount: Total size of track PCM buffer in frames. This defines the - * latency of the track. - * flags: Reserved for future use. - * cbf: Callback function. If not null, this function is called periodically - * to request new PCM data. - * notificationFrames: The callback function is called each time notificationFrames PCM - * frames have been comsumed from track input buffer. - * user Context for use by the callback receiver. - */ - - AudioTrack( int streamType, - uint32_t sampleRate = 0, - int format = 0, - int channelCount = 0, - int frameCount = 0, - uint32_t flags = 0, - callback_t cbf = 0, - void* user = 0, - int notificationFrames = 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 into memory before the AudioTrack is started. - * The Write() and Flush() methods are not supported in this case. - * It is recommented to pass a callback function to be notified of playback end by an - * EVENT_UNDERRUN event. - */ - - AudioTrack( int streamType, - uint32_t sampleRate = 0, - int format = 0, - int channelCount = 0, - const sp<IMemory>& sharedBuffer = 0, - uint32_t flags = 0, - callback_t cbf = 0, - void* user = 0, - int notificationFrames = 0); - - /* Terminates the AudioTrack and unregisters it from AudioFlinger. - * Also destroys all resources assotiated with the AudioTrack. - */ - ~AudioTrack(); - - - /* Initialize an uninitialized AudioTrack. - * Returned status (from utils/Errors.h) can be: - * - NO_ERROR: successful intialization - * - INVALID_OPERATION: AudioTrack is already intitialized - * - BAD_VALUE: invalid parameter (channelCount, format, sampleRate...) - * - NO_INIT: audio server or audio hardware not initialized - * */ - status_t set(int streamType =-1, - uint32_t sampleRate = 0, - int format = 0, - int channelCount = 0, - int frameCount = 0, - uint32_t flags = 0, - callback_t cbf = 0, - void* user = 0, - int notificationFrames = 0, - const sp<IMemory>& sharedBuffer = 0, - bool threadCanCallJava = false); - - - /* Result of constructing the AudioTrack. This must be checked - * before using any AudioTrack API (except for set()), using - * an uninitialized AudioTrack 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 AudioTrack buffer size, AudioMixer (if any) - * and audio hardware driver. - */ - uint32_t latency() const; - - /* getters, see constructor */ - - int streamType() const; - uint32_t sampleRate() const; - int format() const; - int channelCount() const; - uint32_t frameCount() const; - int frameSize() const; - sp<IMemory>& 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 stoped. - */ - 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 unmutes this track. - * While mutted, the callback, if set, is still called. - */ - void mute(bool); - bool muted() const; - - - /* set volume for this track, mostly used for games' sound effects - */ - void setVolume(float left, float right); - void getVolume(float* left, float* right); - - /* set sample rate for this track, mostly used for games' sound effects - */ - void setSampleRate(int sampleRate); - uint32_t getSampleRate(); - - /* 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); - status_t getLoop(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); - - - /* 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); - - - /* 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 <position> 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(); - - /* 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 availlable, - * 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 write() interface to the audio buffer. - * This is implemented on top of lockBuffer/unlockBuffer. For best - * performance - * - */ - ssize_t write(const void* buffer, size_t size); - - /* - * Dumps the state of an audio track. - */ - status_t dump(int fd, const Vector<String16>& args) const; - -private: - /* 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); - private: - friend class AudioTrack; - virtual bool threadLoop(); - virtual status_t readyToRun(); - virtual void onFirstRef(); - AudioTrack& mReceiver; - Mutex mLock; - }; - - bool processAudioBuffer(const sp<AudioTrackThread>& thread); - - sp<IAudioFlinger> mAudioFlinger; - sp<IAudioTrack> mAudioTrack; - sp<IMemory> mCblkMemory; - sp<AudioTrackThread> mAudioTrackThread; - - float mVolume[2]; - uint32_t mSampleRate; - uint32_t mFrameCount; - - audio_track_cblk_t* mCblk; - uint8_t mStreamType; - uint8_t mFormat; - uint8_t mChannelCount; - uint8_t mMuted; - status_t mStatus; - uint32_t mLatency; - - volatile int32_t mActive; - - callback_t mCbf; - void* mUserData; - uint32_t mNotificationFrames; - sp<IMemory> mSharedBuffer; - int mLoopCount; - uint32_t mRemainingFrames; - uint32_t mMarkerPosition; - uint32_t mNewPosition; - uint32_t mUpdatePeriod; -}; - - -}; // namespace android - -#endif // ANDROID_AUDIOTRACK_H diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h deleted file mode 100644 index 6f13fe0..0000000 --- a/include/media/IAudioFlinger.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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 <stdint.h> -#include <sys/types.h> -#include <unistd.h> - -#include <utils/RefBase.h> -#include <utils/Errors.h> -#include <utils/IInterface.h> -#include <media/IAudioTrack.h> -#include <media/IAudioRecord.h> -#include <media/IAudioFlingerClient.h> - - -namespace android { - -// ---------------------------------------------------------------------------- - -class IAudioFlinger : public IInterface -{ -public: - DECLARE_META_INTERFACE(AudioFlinger); - - /* create an audio track and registers it with AudioFlinger. - * return null if the track cannot be created. - */ - virtual sp<IAudioTrack> createTrack( - pid_t pid, - int streamType, - uint32_t sampleRate, - int format, - int channelCount, - int frameCount, - uint32_t flags, - const sp<IMemory>& sharedBuffer, - status_t *status) = 0; - - virtual sp<IAudioRecord> openRecord( - pid_t pid, - int streamType, - uint32_t sampleRate, - int format, - int channelCount, - int frameCount, - uint32_t flags, - status_t *status) = 0; - - /* query the audio hardware state. This state never changes, - * and therefore can be cached. - */ - virtual uint32_t sampleRate(int output) const = 0; - virtual int channelCount(int output) const = 0; - virtual int format(int output) const = 0; - virtual size_t frameCount(int output) const = 0; - virtual uint32_t latency(int 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(int stream, float value) = 0; - virtual status_t setStreamMute(int stream, bool muted) = 0; - - virtual float streamVolume(int stream) const = 0; - virtual bool streamMute(int stream) const = 0; - - // set/get audio routing - virtual status_t setRouting(int mode, uint32_t routes, uint32_t mask) = 0; - virtual uint32_t getRouting(int mode) const = 0; - - // set/get audio mode - virtual status_t setMode(int mode) = 0; - virtual int getMode() const = 0; - - // mic mute/state - virtual status_t setMicMute(bool state) = 0; - virtual bool getMicMute() const = 0; - - // is a music stream active? - virtual bool isMusicActive() const = 0; - - // pass a generic configuration parameter to libaudio - // Temporary interface, do not use - // TODO: Replace with a more generic key:value get/set mechanism - virtual status_t setParameter(const char* key, const char* value) = 0; - - // register a current process for audio output change notifications - virtual void registerClient(const sp<IAudioFlingerClient>& client) = 0; - - // retrieve the audio recording buffer size - virtual size_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount) = 0; - - // force AudioFlinger thread out of standby - virtual void wakeUp() = 0; - - // is A2DP output enabled - virtual bool isA2dpEnabled() const = 0; -}; - - -// ---------------------------------------------------------------------------- - -class BnAudioFlinger : public BnInterface<IAudioFlinger> -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------------- - -}; // namespace android - -#endif // ANDROID_IAUDIOFLINGER_H diff --git a/include/media/IAudioFlingerClient.h b/include/media/IAudioFlingerClient.h deleted file mode 100644 index c3deb0b..0000000 --- a/include/media/IAudioFlingerClient.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 <utils/RefBase.h> -#include <utils/IInterface.h> - - -namespace android { - -// ---------------------------------------------------------------------------- - -class IAudioFlingerClient : public IInterface -{ -public: - DECLARE_META_INTERFACE(AudioFlingerClient); - - // Notifies a change of audio output from/to hardware to/from A2DP. - virtual void a2dpEnabledChanged(bool enabled) = 0; - -}; - - -// ---------------------------------------------------------------------------- - -class BnAudioFlingerClient : public BnInterface<IAudioFlingerClient> -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------------- - -}; // namespace android - -#endif // ANDROID_IAUDIOFLINGERCLIENT_H diff --git a/include/media/IAudioRecord.h b/include/media/IAudioRecord.h deleted file mode 100644 index 9d45d2d..0000000 --- a/include/media/IAudioRecord.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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 <stdint.h> -#include <sys/types.h> - -#include <utils/RefBase.h> -#include <utils/Errors.h> -#include <utils/IInterface.h> -#include <utils/IMemory.h> - - -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. 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; - - /* get this tracks control block */ - virtual sp<IMemory> getCblk() const = 0; -}; - -// ---------------------------------------------------------------------------- - -class BnAudioRecord : public BnInterface<IAudioRecord> -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------------- - -}; // namespace android - -#endif /*IAUDIORECORD_H_*/ diff --git a/include/media/IAudioTrack.h b/include/media/IAudioTrack.h deleted file mode 100644 index 12f2111..0000000 --- a/include/media/IAudioTrack.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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 <stdint.h> -#include <sys/types.h> - -#include <utils/RefBase.h> -#include <utils/Errors.h> -#include <utils/IInterface.h> -#include <utils/IMemory.h> - - -namespace android { - -// ---------------------------------------------------------------------------- - -class IAudioTrack : public IInterface -{ -public: - DECLARE_META_INTERFACE(AudioTrack); - - /* 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; - - /* get this tracks control block */ - virtual sp<IMemory> getCblk() const = 0; -}; - -// ---------------------------------------------------------------------------- - -class BnAudioTrack : public BnInterface<IAudioTrack> -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------------- - -}; // namespace android - -#endif // ANDROID_IAUDIOTRACK_H diff --git a/include/media/IMediaMetadataRetriever.h b/include/media/IMediaMetadataRetriever.h deleted file mode 100644 index c677e83..0000000 --- a/include/media/IMediaMetadataRetriever.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -** -** 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 <utils/RefBase.h> -#include <utils/IInterface.h> -#include <utils/Parcel.h> -#include <utils/IMemory.h> - -namespace android { - -class IMediaMetadataRetriever: public IInterface -{ -public: - DECLARE_META_INTERFACE(MediaMetadataRetriever); - virtual void disconnect() = 0; - virtual status_t setDataSource(const char* srcUrl) = 0; - virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0; - virtual status_t setMode(int mode) = 0; - virtual status_t getMode(int* mode) const = 0; - virtual sp<IMemory> captureFrame() = 0; - virtual sp<IMemory> extractAlbumArt() = 0; - virtual const char* extractMetadata(int keyCode) = 0; -}; - -// ---------------------------------------------------------------------------- - -class BnMediaMetadataRetriever: public BnInterface<IMediaMetadataRetriever> -{ -public: - virtual status_t onTransact(uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -}; // namespace android - -#endif // ANDROID_IMEDIAMETADATARETRIEVER_H - diff --git a/include/media/IMediaPlayer.h b/include/media/IMediaPlayer.h deleted file mode 100644 index a683e74..0000000 --- a/include/media/IMediaPlayer.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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 <utils/RefBase.h> -#include <utils/IInterface.h> -#include <utils/Parcel.h> - -namespace android { - -class ISurface; - -class IMediaPlayer: public IInterface -{ -public: - DECLARE_META_INTERFACE(MediaPlayer); - - virtual void disconnect() = 0; - - virtual status_t setVideoSurface(const sp<ISurface>& surface) = 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(int type) = 0; - virtual status_t setLooping(int loop) = 0; - virtual status_t setVolume(float leftVolume, float rightVolume) = 0; -}; - -// ---------------------------------------------------------------------------- - -class BnMediaPlayer: public BnInterface<IMediaPlayer> -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -}; // namespace android - -#endif // ANDROID_IMEDIAPLAYER_H - diff --git a/include/media/IMediaPlayerClient.h b/include/media/IMediaPlayerClient.h deleted file mode 100644 index 5d32811..0000000 --- a/include/media/IMediaPlayerClient.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 <utils/RefBase.h> -#include <utils/IInterface.h> -#include <utils/Parcel.h> - -namespace android { - -class IMediaPlayerClient: public IInterface -{ -public: - DECLARE_META_INTERFACE(MediaPlayerClient); - - virtual void notify(int msg, int ext1, int ext2) = 0; -}; - -// ---------------------------------------------------------------------------- - -class BnMediaPlayerClient: public BnInterface<IMediaPlayerClient> -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -}; // namespace android - -#endif // ANDROID_IMEDIAPLAYERCLIENT_H - diff --git a/include/media/IMediaPlayerService.h b/include/media/IMediaPlayerService.h deleted file mode 100644 index 8125cc9..0000000 --- a/include/media/IMediaPlayerService.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 <utils/RefBase.h> -#include <utils/IInterface.h> -#include <utils/Parcel.h> - -#include <media/IMediaPlayerClient.h> -#include <media/IMediaPlayer.h> -#include <media/IMediaMetadataRetriever.h> - -namespace android { - -class IMediaRecorder; - -class IMediaPlayerService: public IInterface -{ -public: - DECLARE_META_INTERFACE(MediaPlayerService); - - virtual sp<IMediaRecorder> createMediaRecorder(pid_t pid) = 0; - virtual sp<IMediaMetadataRetriever> createMetadataRetriever(pid_t pid) = 0; - - virtual sp<IMediaPlayer> create(pid_t pid, const sp<IMediaPlayerClient>& client, const char* url) = 0; - virtual sp<IMediaPlayer> create(pid_t pid, const sp<IMediaPlayerClient>& client, int fd, int64_t offset, int64_t length) = 0; - virtual sp<IMemory> decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, int* pFormat) = 0; - virtual sp<IMemory> decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, int* pFormat) = 0; -}; - -// ---------------------------------------------------------------------------- - -class BnMediaPlayerService: public BnInterface<IMediaPlayerService> -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -}; // namespace android - -#endif // ANDROID_IMEDIAPLAYERSERVICE_H - diff --git a/include/media/IMediaRecorder.h b/include/media/IMediaRecorder.h deleted file mode 100644 index 0dff84e..0000000 --- a/include/media/IMediaRecorder.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - ** - ** Copyright 2008, HTC Inc. - ** - ** Licensed under the Apache License, Version 2.0 (the "License"); - ** you may not use this file except in compliance with the License. - ** You may obtain a copy of the License at - ** - ** http://www.apache.org/licenses/LICENSE-2.0 - ** - ** Unless required by applicable law or agreed to in writing, software - ** distributed under the License is distributed on an "AS IS" BASIS, - ** WITHOUT WARRANTIES 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 <utils/IInterface.h> - -namespace android { - -class ISurface; -class ICamera; - -class IMediaRecorder: public IInterface -{ -public: - DECLARE_META_INTERFACE(MediaRecorder); - - virtual status_t setCamera(const sp<ICamera>& camera) = 0; - virtual status_t setPreviewSurface(const sp<ISurface>& 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 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; -}; - -// ---------------------------------------------------------------------------- - -class BnMediaRecorder: public BnInterface<IMediaRecorder> -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -}; // namespace android - -#endif // ANDROID_IMEDIARECORDER_H - diff --git a/include/media/JetPlayer.h b/include/media/JetPlayer.h deleted file mode 100644 index 16764a9..0000000 --- a/include/media/JetPlayer.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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 <utils/threads.h> -#include <nativehelper/jni.h> - -#include <libsonivox/jet.h> -#include <libsonivox/eas_types.h> -#include "AudioTrack.h" - - -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(jobject 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: - static int renderThread(void*); - int render(); - void fireUpdateOnStatusChange(); - void fireEventsFromJetQueue(); - - JetPlayer() {} // no default constructor - void dump(); - void dumpJetStatus(S_JET_STATUS* pJetStatus); - - jetevent_callback mEventCallback; - - jobject 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[256]; - - -}; // end class JetPlayer - -} // end namespace android - - - -#endif /*JETPLAYER_H_*/ diff --git a/include/media/MediaMetadataRetrieverInterface.h b/include/media/MediaMetadataRetrieverInterface.h deleted file mode 100644 index b178836..0000000 --- a/include/media/MediaMetadataRetrieverInterface.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -** -** 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 <utils/RefBase.h> -#include <media/mediametadataretriever.h> -#include <private/media/VideoFrame.h> - -namespace android { - -// Abstract base class -class MediaMetadataRetrieverBase : public RefBase -{ -public: - MediaMetadataRetrieverBase() {} - virtual ~MediaMetadataRetrieverBase() {} - virtual status_t setDataSource(const char *url) = 0; - virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0; - virtual status_t setMode(int mode) = 0; - virtual status_t getMode(int* mode) const = 0; - virtual VideoFrame* captureFrame() = 0; - virtual MediaAlbumArt* extractAlbumArt() = 0; - virtual const char* extractMetadata(int keyCode) = 0; -}; - -// MediaMetadataRetrieverInterface -class MediaMetadataRetrieverInterface : public MediaMetadataRetrieverBase -{ -public: - virtual ~MediaMetadataRetrieverInterface() {} -}; - -}; // namespace android - -#endif // ANDROID_MEDIAMETADATARETRIEVERINTERFACE_H - diff --git a/include/media/MediaPlayerInterface.h b/include/media/MediaPlayerInterface.h deleted file mode 100644 index 7f0e7b3..0000000 --- a/include/media/MediaPlayerInterface.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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 <ui/ISurface.h> -#include <utils/RefBase.h> - -#include <media/mediaplayer.h> -#include <media/AudioSystem.h> - -namespace android { - -enum player_type { - PV_PLAYER = 1, - SONIVOX_PLAYER = 2, - VORBIS_PLAYER = 3 -}; - -#define DEFAULT_AUDIOSINK_BUFFERCOUNT 4 -#define DEFAULT_AUDIOSINK_BUFFERSIZE 1200 -#define DEFAULT_AUDIOSINK_SAMPLERATE 44100 - - -// callback mechanism for passing messages to MediaPlayer object -typedef void (*notify_callback_f)(void* cookie, int msg, int ext1, int ext2); - -// abstract base class - use MediaPlayerInterface -class MediaPlayerBase : public RefBase -{ -public: - - // AudioSink: abstraction layer for audio output - class AudioSink : public RefBase { - public: - 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 open(uint32_t sampleRate, int channelCount, int format=AudioSystem::PCM_16_BIT, int bufferCount=DEFAULT_AUDIOSINK_BUFFERCOUNT) = 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; - }; - - MediaPlayerBase() : mCookie(0), mNotify(0) {} - virtual ~MediaPlayerBase() {} - virtual status_t initCheck() = 0; - virtual bool hardwareOutput() = 0; - virtual status_t setDataSource(const char *url) = 0; - virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0; - virtual status_t setVideoSurface(const sp<ISurface>& surface) = 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 void setNotifyCallback(void* cookie, notify_callback_f notifyFunc) { - mCookie = cookie; mNotify = notifyFunc; } - -protected: - virtual void sendEvent(int msg, int ext1=0, int ext2=0) { if (mNotify) mNotify(mCookie, msg, ext1, ext2); } - - 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>& audioSink) { mAudioSink = audioSink; } -protected: - sp<AudioSink> mAudioSink; -}; - -// Implement this class for media players that output directo 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(int streamType) = 0; -}; - -}; // namespace android - -#endif // __cplusplus - - -#endif // ANDROID_MEDIAPLAYERINTERFACE_H - diff --git a/include/media/PVMediaRecorder.h b/include/media/PVMediaRecorder.h deleted file mode 100644 index f795d04..0000000 --- a/include/media/PVMediaRecorder.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - ** - ** Copyright 2008, HTC Inc. - ** - ** Licensed under the Apache License, Version 2.0 (the "License"); - ** you may not use this file except in compliance with the License. - ** You may obtain a copy of the License at - ** - ** http://www.apache.org/licenses/LICENSE-2.0 - ** - ** Unless required by applicable law or agreed to in writing, software - ** distributed under the License is distributed on an "AS IS" BASIS, - ** WITHOUT WARRANTIES 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_PVMEDIARECORDER_H -#define ANDROID_PVMEDIARECORDER_H - -#include <media/mediarecorder.h> - -namespace android { - -class ISurface; -class ICamera; -class AuthorDriverWrapper; - -class PVMediaRecorder -{ -public: - PVMediaRecorder(); - ~PVMediaRecorder(); - - status_t init(); - status_t setAudioSource(audio_source as); - status_t setVideoSource(video_source vs); - status_t setOutputFormat(output_format of); - status_t setAudioEncoder(audio_encoder ae); - status_t setVideoEncoder(video_encoder ve); - status_t setVideoSize(int width, int height); - status_t setVideoFrameRate(int frames_per_second); - status_t setCamera(const sp<ICamera>& camera); - status_t setPreviewSurface(const sp<ISurface>& surface); - status_t setOutputFile(const char *path); - status_t setOutputFile(int fd, int64_t offset, int64_t length); - status_t prepare(); - status_t start(); - status_t stop(); - status_t close(); - status_t reset(); - status_t getMaxAmplitude(int *max); - -private: - status_t doStop(); - - AuthorDriverWrapper* mAuthorDriverWrapper; -}; - -}; // namespace android - -#endif // ANDROID_PVMEDIARECORDER_H - diff --git a/include/media/PVMetadataRetriever.h b/include/media/PVMetadataRetriever.h deleted file mode 100644 index c202dfe..0000000 --- a/include/media/PVMetadataRetriever.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -** -** 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_PVMETADATARETRIEVER_H -#define ANDROID_PVMETADATARETRIEVER_H - -#include <utils/Errors.h> -#include <media/MediaMetadataRetrieverInterface.h> -#include <private/media/VideoFrame.h> - -namespace android { - -class MetadataDriver; - -class PVMetadataRetriever : public MediaMetadataRetrieverInterface -{ -public: - PVMetadataRetriever(); - virtual ~PVMetadataRetriever(); - - virtual status_t setDataSource(const char *url); - virtual status_t setDataSource(int fd, int64_t offset, int64_t length); - virtual status_t setMode(int mode); - virtual status_t getMode(int* mode) const; - virtual VideoFrame* captureFrame(); - virtual MediaAlbumArt* extractAlbumArt(); - virtual const char* extractMetadata(int keyCode); - -private: - mutable Mutex mLock; - MetadataDriver* mMetadataDriver; - char* mDataSourcePath; -}; - -}; // namespace android - -#endif // ANDROID_PVMETADATARETRIEVER_H diff --git a/include/media/PVPlayer.h b/include/media/PVPlayer.h deleted file mode 100644 index 6d98852..0000000 --- a/include/media/PVPlayer.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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_PVPLAYER_H -#define ANDROID_PVPLAYER_H - -#include <utils/Errors.h> -#include <media/MediaPlayerInterface.h> - -#define MAX_OPENCORE_INSTANCES 25 - -#ifdef MAX_OPENCORE_INSTANCES -#include <cutils/atomic.h> -#endif - -class PlayerDriver; - -namespace android { - -class PVPlayer : public MediaPlayerInterface -{ -public: - PVPlayer(); - virtual ~PVPlayer(); - - virtual status_t initCheck(); - virtual status_t setDataSource(const char *url); - virtual status_t setDataSource(int fd, int64_t offset, int64_t length); - virtual status_t setVideoSurface(const sp<ISurface>& surface); - virtual status_t prepare(); - virtual status_t prepareAsync(); - virtual status_t start(); - virtual status_t stop(); - virtual status_t pause(); - virtual bool isPlaying(); - virtual status_t seekTo(int msec); - virtual status_t getCurrentPosition(int *msec); - virtual status_t getDuration(int *msec); - virtual status_t reset(); - virtual status_t setLooping(int loop); - virtual player_type playerType() { return PV_PLAYER; } - - // make available to PlayerDriver - void sendEvent(int msg, int ext1=0, int ext2=0) { MediaPlayerBase::sendEvent(msg, ext1, ext2); } - -private: - static void do_nothing(status_t s, void *cookie, bool cancelled) { } - static void run_init(status_t s, void *cookie, bool cancelled); - static void run_set_video_surface(status_t s, void *cookie, bool cancelled); - static void run_set_audio_output(status_t s, void *cookie, bool cancelled); - static void run_prepare(status_t s, void *cookie, bool cancelled); - - PlayerDriver* mPlayerDriver; - char * mDataSourcePath; - bool mIsDataSourceSet; - sp<ISurface> mSurface; - int mSharedFd; - status_t mInit; - int mDuration; - -#ifdef MAX_OPENCORE_INSTANCES - static volatile int32_t sNumInstances; -#endif -}; - -}; // namespace android - -#endif // ANDROID_PVPLAYER_H diff --git a/include/media/ToneGenerator.h b/include/media/ToneGenerator.h deleted file mode 100644 index ec64e4d..0000000 --- a/include/media/ToneGenerator.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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 <utils/RefBase.h> -#include <utils/Vector.h> -#include <utils/threads.h> -#include <media/AudioSystem.h> -#include <media/AudioTrack.h> - -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: 425Hz, continuous - TONE_SUP_BUSY, // Busy tone: 425Hz, 500ms ON, 500ms OFF... - TONE_SUP_CONGESTION, // Congestion tone: 425Hz, 200ms ON, 200ms OFF... - TONE_SUP_RADIO_ACK, // Radio path acknowlegment: 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: 425Hz, 200ms ON, 600ms OFF, 200ms ON, 3s OFF... - TONE_SUP_RINGTONE, // Ring Tone: 425Hz, 1s ON, 4s OFF... - // 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 - NUM_TONES - }; - - ToneGenerator(int streamType, float volume); - ~ToneGenerator(); - - bool startTone(int toneType); - void stopTone(); - - bool isInited() { return (mState == TONE_IDLE)?false:true;} - -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_RESTARTING // - }; - - static const unsigned int TONEGEN_MAX_WAVES = 3; - static const unsigned int TONEGEN_MAX_SEGMENTS = 4; // Maximun number of elenemts in - 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[] contains the frequencies of all individual waves making the multi-tone. - // 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. - // - 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. - - class ToneDescriptor { - public: - unsigned short waveFreq[TONEGEN_MAX_WAVES+1]; - unsigned long segments[TONEGEN_MAX_SEGMENTS+1]; - unsigned long repeatCnt; - }; - - static const ToneDescriptor toneDescriptors[NUM_TONES]; - - 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 short mCurSegment; // Current segment index in ToneDescriptor segments[] - unsigned short mCurCount; // Current sequence repeat count - volatile unsigned short mState; // ToneGenerator state (tone_state) - const ToneDescriptor *mpToneDesc; // pointer to active tone descriptor - const ToneDescriptor *mpNewToneDesc; // pointer to next active tone descriptor - - 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 - int 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(); - void clearWaveGens(); - - // 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 - }; - - Vector<WaveGenerator *> mWaveGens; // list of active wave generators. -}; - -} -; // namespace android - -#endif /*ANDROID_TONEGENERATOR_H_*/ diff --git a/include/media/mediametadataretriever.h b/include/media/mediametadataretriever.h deleted file mode 100644 index f2719d3..0000000 --- a/include/media/mediametadataretriever.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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 <utils/Errors.h> // for status_t -#include <utils/threads.h> -#include <utils/IMemory.h> -#include <media/IMediaMetadataRetriever.h> - -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_IS_DRM_CRIPPLED = 11, - METADATA_KEY_CODEC = 12, - METADATA_KEY_RATING = 13, - METADATA_KEY_COMMENT = 14, - METADATA_KEY_COPYRIGHT = 15, - METADATA_KEY_BIT_RATE = 16, - METADATA_KEY_FRAME_RATE = 17, - METADATA_KEY_VIDEO_FORMAT = 18, - METADATA_KEY_VIDEO_HEIGHT = 19, - METADATA_KEY_VIDEO_WIDTH = 20, - // Add more here... -}; - - -class MediaMetadataRetriever: public RefBase -{ -public: - MediaMetadataRetriever(); - ~MediaMetadataRetriever(); - void disconnect(); - status_t setDataSource(const char* dataSourceUrl); - status_t setDataSource(int fd, int64_t offset, int64_t length); - status_t setMode(int mode); - status_t getMode(int* mode); - sp<IMemory> captureFrame(); - sp<IMemory> extractAlbumArt(); - const char* extractMetadata(int keyCode); - -private: - static const sp<IMediaPlayerService>& getService(); - - class DeathNotifier: public IBinder::DeathRecipient - { - public: - DeathNotifier() {} - virtual ~DeathNotifier(); - virtual void binderDied(const wp<IBinder>& who); - }; - - static sp<DeathNotifier> sDeathNotifier; - static Mutex sServiceLock; - static sp<IMediaPlayerService> sService; - - Mutex mLock; - sp<IMediaMetadataRetriever> mRetriever; - -}; - -}; // namespace android - -#endif // MEDIAMETADATARETRIEVER_H diff --git a/include/media/mediaplayer.h b/include/media/mediaplayer.h deleted file mode 100644 index 7288445..0000000 --- a/include/media/mediaplayer.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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 <utils/IMemory.h> -#include <ui/Surface.h> -#include <media/IMediaPlayerClient.h> -#include <media/IMediaPlayer.h> -#include <media/IMediaPlayerService.h> -#include <utils/SortedVector.h> - -namespace android { - -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_ERROR = 100, -}; - -typedef int media_error_type; -const media_error_type MEDIA_ERROR_UNKNOWN = 1; -const media_error_type MEDIA_ERROR_SERVER_DIED = 100; - -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 -}; - -// ---------------------------------------------------------------------------- -// ref-counted object for callbacks -class MediaPlayerListener: virtual public RefBase -{ -public: - virtual void notify(int msg, int ext1, int ext2) = 0; -}; - -class MediaPlayer : public BnMediaPlayerClient -{ -public: - MediaPlayer(); - ~MediaPlayer(); - void onFirstRef(); - void disconnect(); - status_t setDataSource(const char *url); - status_t setDataSource(int fd, int64_t offset, int64_t length); - status_t setVideoSurface(const sp<Surface>& surface); - status_t setListener(const sp<MediaPlayerListener>& 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(int type); - status_t setLooping(int loop); - bool isLooping(); - status_t setVolume(float leftVolume, float rightVolume); - void notify(int msg, int ext1, int ext2); - static sp<IMemory> decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, int* pFormat); - static sp<IMemory> decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, int* pFormat); - -private: - void clear_l(); - status_t seekTo_l(int msec); - status_t prepareAsync_l(); - status_t getDuration_l(int *msec); - status_t setDataSource(const sp<IMediaPlayer>& player); - - static const sp<IMediaPlayerService>& getMediaPlayerService(); - static void addObitRecipient(const wp<MediaPlayer>& recipient); - static void removeObitRecipient(const wp<MediaPlayer>& recipient); - - class DeathNotifier: public IBinder::DeathRecipient - { - public: - DeathNotifier() {} - virtual ~DeathNotifier(); - - virtual void binderDied(const wp<IBinder>& who); - }; - - sp<IMediaPlayer> mPlayer; - Mutex mLock; - Mutex mNotifyLock; - Condition mSignal; - sp<MediaPlayerListener> mListener; - void* mCookie; - media_player_states mCurrentState; - int mDuration; - int mCurrentPosition; - int mSeekPosition; - bool mPrepareSync; - status_t mPrepareStatus; - int mStreamType; - bool mLoop; - float mLeftVolume; - float mRightVolume; - int mVideoWidth; - int mVideoHeight; - - friend class DeathNotifier; - - static Mutex sServiceLock; - static sp<IMediaPlayerService> sMediaPlayerService; - static sp<DeathNotifier> sDeathNotifier; - static SortedVector< wp<MediaPlayer> > sObitRecipients; -}; - -}; // namespace android - -#endif // ANDROID_MEDIAPLAYER_H - diff --git a/include/media/mediarecorder.h b/include/media/mediarecorder.h deleted file mode 100644 index 436e8f1..0000000 --- a/include/media/mediarecorder.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - ** 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_MEDIARECORDER_H -#define ANDROID_MEDIARECORDER_H - -#include <utils.h> - -namespace android { - -class Surface; -class IMediaRecorder; -class ICamera; - -typedef void (*media_completion_f)(status_t status, void *cookie); - -/* Do not change these values without updating their counterparts - * in java/android/android/media/MediaRecorder.java! - */ -enum audio_source { - AUDIO_SOURCE_DEFAULT = 0, - AUDIO_SOURCE_MIC = 1, -}; - -enum video_source { - VIDEO_SOURCE_DEFAULT = 0, - VIDEO_SOURCE_CAMERA = 1, -}; - -//Please update java/android/android/media/MediaRecorder.java if the following is updated. -enum output_format { - OUTPUT_FORMAT_DEFAULT = 0, - OUTPUT_FORMAT_THREE_GPP, - OUTPUT_FORMAT_MPEG_4, - OUTPUT_FORMAT_RAW_AMR, - OUTPUT_FORMAT_LIST_END // must be last - used to validate format type -}; - -enum audio_encoder { - AUDIO_ENCODER_DEFAULT = 0, - AUDIO_ENCODER_AMR_NB = 1, -}; - -enum video_encoder { - VIDEO_ENCODER_DEFAULT = 0, - VIDEO_ENCODER_H263 = 1, - VIDEO_ENCODER_H264 = 2, - VIDEO_ENCODER_MPEG_4_SP = 3, -}; - -// Maximum frames per second is 24 -#define MEDIA_RECORDER_MAX_FRAME_RATE 24 - -/* - * The state machine of the media_recorder uses a set of different state names. - * The mapping between the media_recorder and the pvauthorengine is shown below: - * - * mediarecorder pvauthorengine - * ---------------------------------------------------------------- - * MEDIA_RECORDER_ERROR ERROR - * MEDIA_RECORDER_IDLE IDLE - * MEDIA_RECORDER_INITIALIZED OPENED - * MEDIA_RECORDER_DATASOURCE_CONFIGURED - * MEDIA_RECORDER_PREPARED INITIALIZED - * MEDIA_RECORDER_RECORDING RECORDING - */ -enum media_recorder_states { - MEDIA_RECORDER_ERROR = 0, - MEDIA_RECORDER_IDLE = 1 << 0, - MEDIA_RECORDER_INITIALIZED = 1 << 1, - MEDIA_RECORDER_DATASOURCE_CONFIGURED = 1 << 2, - MEDIA_RECORDER_PREPARED = 1 << 3, - MEDIA_RECORDER_RECORDING = 1 << 4, -}; - -class MediaRecorder -{ -public: - MediaRecorder(); - ~MediaRecorder(); - - status_t initCheck(); - status_t setCamera(const sp<ICamera>& camera); - status_t setPreviewSurface(const sp<Surface>& 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 prepare(); - status_t getMaxAmplitude(int* max); - status_t start(); - status_t stop(); - status_t reset(); - status_t init(); - status_t close(); - status_t release(); - -private: - void doCleanUp(); - status_t doReset(); - - sp<IMediaRecorder> mMediaRecorder; - media_recorder_states mCurrentState; - bool mIsAudioSourceSet; - bool mIsVideoSourceSet; - bool mIsAudioEncoderSet; - bool mIsVideoEncoderSet; - bool mIsOutputFileSet; -}; - -}; // namespace android - -#endif // ANDROID_MEDIARECORDER_H diff --git a/include/media/mediascanner.h b/include/media/mediascanner.h deleted file mode 100644 index fbef1db..0000000 --- a/include/media/mediascanner.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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 <utils.h> -#include <pthread.h> - -namespace android { - -class MediaScannerClient; -class StringArray; - -class MediaScanner -{ -public: - MediaScanner(); - ~MediaScanner(); - - typedef bool (*ExceptionCheck)(void* env); - - status_t processFile(const char *path, const char *mimeType, MediaScannerClient& client); - status_t processDirectory(const char *path, const char* extensions, - MediaScannerClient& client, ExceptionCheck exceptionCheck, void* exceptionEnv); - void setLocale(const char* locale); - - // extracts album art as a block of data - char* extractAlbumArt(int fd); - - static void uninitializeForThread(); - -private: - status_t doProcessDirectory(char *path, int pathRemaining, const char* extensions, - MediaScannerClient& client, ExceptionCheck exceptionCheck, void* exceptionEnv); - void initializeForThread(); - - // current locale (like "ja_JP"), created/destroyed with strdup()/free() - char* mLocale; -}; - - -class MediaScannerClient -{ -public: - MediaScannerClient(); - virtual ~MediaScannerClient(); - void setLocale(const char* locale); - void beginFile(); - bool addStringTag(const char* name, const char* value); - void endFile(); - - virtual bool scanFile(const char* path, long long lastModified, long long fileSize) = 0; - virtual bool handleStringTag(const char* name, const char* value) = 0; - virtual bool 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 - diff --git a/include/media/thread_init.h b/include/media/thread_init.h deleted file mode 100644 index 2c0c1f1..0000000 --- a/include/media/thread_init.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 THREAD_INIT_H -#define THREAD_INIT_H - -bool InitializeForThread(); -void UninitializeForThread(); -void keydestructor(void*); - -#endif /* THREAD_INIT_H*/ - diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h deleted file mode 100644 index 1991aa7..0000000 --- a/include/private/media/AudioTrackShared.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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 <stdint.h> -#include <sys/types.h> - -#include <utils/threads.h> - -namespace android { - -// ---------------------------------------------------------------------------- - -#define MAX_SAMPLE_RATE 65535 -#define THREAD_PRIORITY_AUDIO_CLIENT (ANDROID_PRIORITY_AUDIO) -// 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 - - -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. - Mutex lock; - Condition cv; - volatile uint32_t user; - volatile uint32_t server; - uint32_t userBase; - uint32_t serverBase; - void* buffers; - uint32_t frameCount; - // Cache line boundary - uint32_t loopStart; - uint32_t loopEnd; - int loopCount; - volatile union { - uint16_t volume[2]; - uint32_t volumeLR; - }; - uint16_t sampleRate; - uint16_t channels; - int16_t flowControlFlag; // underrun (out) or overrrun (in) indication - uint8_t out; // out equals 1 for AudioTrack and 0 for AudioRecord - uint8_t forceReady; - uint16_t bufferTimeoutMs; // Maximum cumulated timeout before restarting audioflinger - uint16_t waitTimeMs; // Cumulated wait time - // Padding ensuring that data buffer starts on a cache line boundary (32 bytes). - // See AudioFlinger::TrackBase constructor - int32_t Padding[3]; - - audio_track_cblk_t(); - uint32_t stepUser(uint32_t frameCount); - bool stepServer(uint32_t frameCount); - void* buffer(uint32_t offset) const; - uint32_t framesAvailable(); - uint32_t framesAvailable_l(); - uint32_t framesReady(); -}; - - -// ---------------------------------------------------------------------------- - -}; // namespace android - -#endif // ANDROID_AUDIO_TRACK_SHARED_H diff --git a/include/private/media/VideoFrame.h b/include/private/media/VideoFrame.h deleted file mode 100644 index 9c35274..0000000 --- a/include/private/media/VideoFrame.h +++ /dev/null @@ -1,127 +0,0 @@ -/* -** -** 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 <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <utils/Log.h> - -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 -}; - -}; // namespace android - -#endif // ANDROID_VIDEO_FRAME_H diff --git a/include/private/opengles/gl_context.h b/include/private/opengles/gl_context.h deleted file mode 100644 index 0c7ad46..0000000 --- a/include/private/opengles/gl_context.h +++ /dev/null @@ -1,632 +0,0 @@ -/* - * 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 <stdint.h> -#include <stddef.h> -#include <sys/types.h> -#include <pthread.h> -#ifdef HAVE_ANDROID_OS -#include <bionic_tls.h> -#endif - -#include <private/pixelflinger/ggl_context.h> - -#include <GLES/gl.h> -#include <GLES/glext.h> - -namespace android { - -const unsigned int OGLES_NUM_COMPRESSED_TEXTURE_FORMATS = 10; - -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<typename T> -static inline void swap(T& a, T& b) { - T t(a); a = b; b = t; -} -template<typename T> -inline T max(T a, T b) { - return a<b ? b : a; -} -template<typename T> -inline T max(T a, T b, T c) { - return max(a, max(b, c)); -} -template<typename T> -inline T min(T a, T b) { - return a<b ? a : b; -} -template<typename T> -inline T min(T a, T b, T c) { - return min(a, min(b, c)); -} -template<typename T> -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<<INDEX_BITS)-1), - INDEX_SEQ = 1LU<<INDEX_BITS, - }; - vertex_t* vBuffer; - vertex_t* vCache; - uint32_t sequence; - void* base; - uint32_t total; - uint32_t misses; - int64_t startTime; - void init(); - void uninit(); - void clear(); - void dump_stats(GLenum mode); -}; - -// ---------------------------------------------------------------------------- -// fog -// ---------------------------------------------------------------------------- - -struct fog_t { - GLfixed density; - GLfixed start; - GLfixed end; - GLfixed invEndMinusStart; - GLenum mode; - GLfixed (*fog)(ogles_context_t* c, GLfixed z); -}; - -// ---------------------------------------------------------------------------- -// user clip planes -// ---------------------------------------------------------------------------- - -const unsigned int OGLES_MAX_CLIP_PLANES = 6; - -struct clip_plane_t { - vec4_t equation; -}; - -struct user_clip_planes_t { - clip_plane_t plane[OGLES_MAX_CLIP_PLANES]; - uint32_t enable; -}; - -// ---------------------------------------------------------------------------- -// lighting -// ---------------------------------------------------------------------------- - -const unsigned int OGLES_MAX_LIGHTS = 8; - -struct light_t { - vec4_t ambient; - vec4_t diffuse; - vec4_t specular; - vec4_t implicitAmbient; - vec4_t implicitDiffuse; - vec4_t implicitSpecular; - vec4_t position; // position in eye space - vec4_t objPosition; - vec4_t normalizedObjPosition; - vec4_t spotDir; - vec4_t normalizedSpotDir; - GLfixed spotExp; - GLfixed spotCutoff; - GLfixed spotCutoffCosine; - GLfixed attenuation[3]; - GLfixed rConstAttenuation; - GLboolean enable; -}; - -struct material_t { - vec4_t ambient; - vec4_t diffuse; - vec4_t specular; - vec4_t emission; - GLfixed shininess; -}; - -struct light_model_t { - vec4_t ambient; - GLboolean twoSide; -}; - -struct color_material_t { - GLenum face; - GLenum mode; - GLboolean enable; -}; - -struct lighting_t { - light_t lights[OGLES_MAX_LIGHTS]; - material_t front; - light_model_t lightModel; - color_material_t colorMaterial; - uint32_t enabledLights; - GLboolean enable; - vec4_t implicitSceneEmissionAndAmbient; - GLenum shadeModel; - typedef void (*light_fct_t)(ogles_context_t*, vertex_t*); - void (*lightVertex)(ogles_context_t* c, vertex_t* v); - void (*lightTriangle)(ogles_context_t* c, - vertex_t* v0, vertex_t* v1, vertex_t* v2); -}; - -struct culling_t { - GLenum cullFace; - GLenum frontFace; - GLboolean enable; -}; - -// ---------------------------------------------------------------------------- -// textures -// ---------------------------------------------------------------------------- - -struct texture_unit_t { - GLuint name; - EGLTextureObject* texture; - uint8_t dirty; -}; - -struct texture_state_t -{ - texture_unit_t tmu[GGL_TEXTURE_UNIT_COUNT]; - int active; // active tmu - EGLTextureObject* defaultTexture; - GGLContext* ggl; - uint8_t packAlignment; - uint8_t unpackAlignment; -}; - -// ---------------------------------------------------------------------------- -// transformation and matrices -// ---------------------------------------------------------------------------- - -struct matrixf_t; - -struct matrixx_t { - GLfixed m[16]; - void load(const matrixf_t& rhs); -}; - -struct matrix_stack_t; - - -struct matrixf_t { - void loadIdentity(); - void load(const matrixf_t& rhs); - - inline GLfloat* editElements() { return m; } - inline GLfloat const* elements() const { return m; } - - void set(const GLfixed* rhs); - void set(const GLfloat* rhs); - - static void multiply(matrixf_t& r, - const matrixf_t& lhs, const matrixf_t& rhs); - - void dump(const char* what); - -private: - friend struct matrix_stack_t; - GLfloat m[16]; - void load(const GLfixed* rhs); - void load(const GLfloat* rhs); - void multiply(const matrixf_t& rhs); - void translate(GLfloat x, GLfloat y, GLfloat z); - void scale(GLfloat x, GLfloat y, GLfloat z); - void rotate(GLfloat a, GLfloat x, GLfloat y, GLfloat z); -}; - -enum { - OP_IDENTITY = 0x00, - OP_TRANSLATE = 0x01, - OP_UNIFORM_SCALE = 0x02, - OP_SCALE = 0x05, - OP_ROTATE = 0x08, - OP_SKEW = 0x10, - OP_ALL = 0x1F -}; - -struct transform_t { - enum { - FLAGS_2D_PROJECTION = 0x1 - }; - matrixx_t matrix; - uint32_t flags; - uint32_t ops; - - union { - struct { - void (*point2)(transform_t const* t, vec4_t*, vec4_t const*); - void (*point3)(transform_t const* t, vec4_t*, vec4_t const*); - void (*point4)(transform_t const* t, vec4_t*, vec4_t const*); - }; - void (*pointv[3])(transform_t const* t, vec4_t*, vec4_t const*); - }; - - void loadIdentity(); - void picker(); - void dump(const char* what); -}; - -struct mvui_transform_t : public transform_t -{ - void picker(); -}; - -struct matrix_stack_t { - enum { - DO_PICKER = 0x1, - DO_FLOAT_TO_FIXED = 0x2 - }; - transform_t transform; - uint8_t maxDepth; - uint8_t depth; - uint8_t dirty; - uint8_t reserved; - matrixf_t *stack; - uint8_t *ops; - void init(int depth); - void uninit(); - void loadIdentity(); - void load(const GLfixed* rhs); - void load(const GLfloat* rhs); - void multiply(const matrixf_t& rhs); - void translate(GLfloat x, GLfloat y, GLfloat z); - void scale(GLfloat x, GLfloat y, GLfloat z); - void rotate(GLfloat a, GLfloat x, GLfloat y, GLfloat z); - GLint push(); - GLint pop(); - void validate(); - matrixf_t& top() { return stack[depth]; } - const matrixf_t& top() const { return stack[depth]; } - const uint32_t top_ops() const { return ops[depth]; } - inline bool isRigidBody() const { - return !(ops[depth] & ~(OP_TRANSLATE|OP_UNIFORM_SCALE|OP_ROTATE)); - } -}; - -struct vp_transform_t { - transform_t transform; - matrixf_t matrix; - GLfloat zNear; - GLfloat zFar; - void loadIdentity(); -}; - -struct transform_state_t { - enum { - MODELVIEW = 0x01, - PROJECTION = 0x02, - VIEWPORT = 0x04, - TEXTURE = 0x08, - MVUI = 0x10, - MVIT = 0x20, - MVP = 0x40, - }; - matrix_stack_t *current; - matrix_stack_t modelview; - matrix_stack_t projection; - matrix_stack_t texture[GGL_TEXTURE_UNIT_COUNT]; - - // modelview * projection - transform_t mvp __attribute__((aligned(32))); - // viewport transformation - vp_transform_t vpt __attribute__((aligned(32))); - // same for 4-D vertices - transform_t mvp4; - // full modelview inverse transpose - transform_t mvit4; - // upper 3x3 of mv-inverse-transpose (for normals) - mvui_transform_t mvui; - - GLenum matrixMode; - GLenum rescaleNormals; - uint32_t dirty; - void invalidate(); - void update_mvp(); - void update_mvit(); - void update_mvui(); -}; - -struct viewport_t { - GLint x; - GLint y; - GLsizei w; - GLsizei h; - struct { - GLint x; - GLint y; - } surfaceport; - struct { - GLint x; - GLint y; - GLsizei w; - GLsizei h; - } scissor; -}; - -// ---------------------------------------------------------------------------- -// Lerping -// ---------------------------------------------------------------------------- - -struct compute_iterators_t -{ - void initTriangle( - vertex_t const* v0, - vertex_t const* v1, - vertex_t const* v2); - - void initLine( - vertex_t const* v0, - vertex_t const* v1); - - inline void initLerp(vertex_t const* v0, uint32_t enables); - - int iteratorsScale(int32_t it[3], - int32_t c0, int32_t c1, int32_t c2) const; - - void iterators1616(GGLfixed it[3], - GGLfixed c0, GGLfixed c1, GGLfixed c2) const; - - void iterators0032(int32_t it[3], - int32_t c0, int32_t c1, int32_t c2) const; - - void iterators0032(int64_t it[3], - int32_t c0, int32_t c1, int32_t c2) const; - - GGLcoord area() const { return m_area; } - -private: - // don't change order of members here -- used by iterators.S - GGLcoord m_dx01, m_dy10, m_dx20, m_dy02; - GGLcoord m_x0, m_y0; - GGLcoord m_area; - uint8_t m_scale; - uint8_t m_area_scale; - uint8_t m_reserved[2]; - -}; - -// ---------------------------------------------------------------------------- -// state -// ---------------------------------------------------------------------------- - -#ifdef HAVE_ANDROID_OS - // We have a dedicated TLS slot in bionic - inline void setGlThreadSpecific(ogles_context_t *value) { - ((uint32_t *)__get_tls())[TLS_SLOT_OPENGL] = (uint32_t)value; - } - inline ogles_context_t* getGlThreadSpecific() { - return (ogles_context_t *)(((unsigned *)__get_tls())[TLS_SLOT_OPENGL]); - } -#else - extern pthread_key_t gGLKey; - inline void setGlThreadSpecific(ogles_context_t *value) { - pthread_setspecific(gGLKey, value); - } - inline ogles_context_t* getGlThreadSpecific() { - return static_cast<ogles_context_t*>(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 - diff --git a/include/private/ui/LayerState.h b/include/private/ui/LayerState.h deleted file mode 100644 index b6fcd80..0000000 --- a/include/private/ui/LayerState.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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_COMPOSER_LAYER_STATE_H -#define ANDROID_COMPOSER_LAYER_STATE_H - -#include <stdint.h> -#include <sys/types.h> - -#include <utils/Errors.h> - -#include <ui/ISurfaceFlingerClient.h> -#include <ui/Region.h> - -#include <private/ui/SharedState.h> - -namespace android { - -class Parcel; - -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; - int32_t x; - int32_t 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; -}; - -}; // namespace android - -#endif // ANDROID_COMPOSER_LAYER_STATE_H - diff --git a/include/private/ui/SharedState.h b/include/private/ui/SharedState.h deleted file mode 100644 index 546d0ad..0000000 --- a/include/private/ui/SharedState.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * 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_UI_SHARED_STATE_H -#define ANDROID_UI_SHARED_STATE_H - -#include <stdint.h> -#include <sys/types.h> - -#include <utils/threads.h> - -namespace android { - -/* - * These structures are shared between the composer process and its clients - */ - -// --------------------------------------------------------------------------- - -struct surface_info_t { // 4 longs, 16 bytes - enum { - eBufferDirty = 0x01 - }; - uint16_t w; - uint16_t h; - uint16_t stride; - uint16_t bpr; - uint16_t reserved; - uint8_t format; - uint8_t flags; - ssize_t bits_offset; -}; - -// --------------------------------------------------------------------------- - -const uint32_t NUM_LAYERS_MAX = 31; - -enum { // layer_cblk_t swapState - eIndex = 0x00000001, - eFlipRequested = 0x00000002, - - eResizeBuffer0 = 0x00000004, - eResizeBuffer1 = 0x00000008, - eResizeRequested = eResizeBuffer0 | eResizeBuffer1, - - eBusy = 0x00000010, - eLocked = 0x00000020, - eNextFlipPending = 0x00000040, - eInvalidSurface = 0x00000080 -}; - -enum { // layer_cblk_t flags - eLayerNotPosted = 0x00000001, - eNoCopyBack = 0x00000002, - eReserved = 0x0000007C, - eBufferIndexShift = 7, - eBufferIndex = 1<<eBufferIndexShift, -}; - -struct flat_region_t // 40 bytes -{ - int32_t count; - int16_t l; - int16_t t; - int16_t r; - int16_t b; - uint16_t runs[14]; -}; - -struct layer_cblk_t // (128 bytes) -{ - volatile int32_t swapState; // 4 - volatile int32_t flags; // 4 - volatile int32_t identity; // 4 - int32_t reserved; // 4 - surface_info_t surface[2]; // 32 - flat_region_t region[2]; // 80 - - static inline int backBuffer(uint32_t state) { - return ((state & eIndex) ^ ((state & eFlipRequested)>>1)); - } - static inline int frontBuffer(uint32_t state) { - return 1 - backBuffer(state); - } -}; - -// --------------------------------------------------------------------------- - -struct per_client_cblk_t // 4KB max -{ - Mutex lock; - Condition cv; - layer_cblk_t layers[NUM_LAYERS_MAX] __attribute__((aligned(32))); - - enum { - BLOCKING = 0x00000001, - INSPECT = 0x00000002 - }; - - per_client_cblk_t(); - - // these functions are used by the clients - status_t validate(size_t i) const; - int32_t lock_layer(size_t i, uint32_t flags); - uint32_t unlock_layer_and_post(size_t i); - void unlock_layer(size_t i); -}; -// --------------------------------------------------------------------------- - -const uint32_t 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 -{ - surface_flinger_cblk_t(); - - uint8_t connected; - uint8_t reserved[3]; - uint32_t pad[7]; - - display_cblk_t displays[NUM_DISPLAY_MAX]; -}; - -// --------------------------------------------------------------------------- - -template<bool> struct CTA; -template<> struct CTA<true> { }; - -// compile-time assertions. just to avoid catastrophes. -inline void compile_time_asserts() { - CTA<sizeof(layer_cblk_t) == 128> sizeof__layer_cblk_t__eq_128; - (void)sizeof__layer_cblk_t__eq_128; // we don't want a warning - CTA<sizeof(per_client_cblk_t) <= 4096> sizeof__per_client_cblk_t__le_4096; - (void)sizeof__per_client_cblk_t__le_4096; // we don't want a warning - CTA<sizeof(surface_flinger_cblk_t) <= 4096> sizeof__surface_flinger_cblk_t__le_4096; - (void)sizeof__surface_flinger_cblk_t__le_4096; // we don't want a warning -} - -}; // namespace android - -#endif // ANDROID_UI_SHARED_STATE_H - diff --git a/include/private/ui/SurfaceFlingerSynchro.h b/include/private/ui/SurfaceFlingerSynchro.h deleted file mode 100644 index ff91b61..0000000 --- a/include/private/ui/SurfaceFlingerSynchro.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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_SURFACE_FLINGER_SYNCHRO_H -#define ANDROID_SURFACE_FLINGER_SYNCHRO_H - -#include <stdint.h> -#include <sys/types.h> -#include <utils/Errors.h> -#include <utils/threads.h> -#include <ui/ISurfaceComposer.h> - -namespace android { - -class SurfaceFlinger; - -class SurfaceFlingerSynchro -{ -public: - - // client constructor - SurfaceFlingerSynchro(const sp<ISurfaceComposer>& flinger); - ~SurfaceFlingerSynchro(); - - // signal surfaceflinger for some work - status_t signal(); - -private: - class Barrier { - public: - Barrier(); - ~Barrier(); - void open(); - void close(); - void waitAndClose(); - status_t waitAndClose(nsecs_t timeout); - private: - enum { OPENED, CLOSED }; - mutable Mutex lock; - mutable Condition cv; - volatile int state; - }; - - friend class SurfaceFlinger; - - // server constructor - SurfaceFlingerSynchro(); - - void open(); - - // wait until there is some work to do - status_t wait(); - status_t wait(nsecs_t timeout); - - sp<ISurfaceComposer> mSurfaceComposer; - Barrier mBarrier; -}; - -}; // namespace android - -#endif // ANDROID_SURFACE_FLINGER_SYNCHRO_H - diff --git a/include/private/utils/Static.h b/include/private/utils/Static.h deleted file mode 100644 index f1439b7..0000000 --- a/include/private/utils/Static.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 <utils/threads.h> -#include <utils/KeyedVector.h> - -#ifndef LIBUTILS_NATIVE -#include <utils/IBinder.h> -#include <utils/IMemory.h> -#include <utils/ProcessState.h> -#include <utils/IPermissionController.h> -#include <utils/IServiceManager.h> -#endif - -namespace android { -// For TextStream.cpp -extern Vector<int32_t> gTextBuffers; - -// For String8.cpp -extern void initialize_string8(); -extern void terminate_string8(); - -// For String16.cpp -extern void initialize_string16(); -extern void terminate_string16(); - - - -#ifndef LIBUTILS_NATIVE - -// For ProcessState.cpp -extern Mutex gProcessMutex; -extern sp<ProcessState> gProcess; - -// For ServiceManager.cpp -extern Mutex gDefaultServiceManagerLock; -extern sp<IServiceManager> gDefaultServiceManager; -extern sp<IPermissionController> gPermissionController; - -#endif - -} // namespace android diff --git a/include/private/utils/binder_module.h b/include/private/utils/binder_module.h deleted file mode 100644 index fdf327e..0000000 --- a/include/private/utils/binder_module.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * 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 - -#if defined(HAVE_ANDROID_OS) - -/* obtain structures and constants from the kernel header */ - -#include <sys/ioctl.h> -#include <linux/binder.h> - -#else - -/* Some parts of the simulator need fake versions of this - * stuff in order to compile. Really this should go away - * entirely... - */ - -#define BINDER_CURRENT_PROTOCOL_VERSION 7 - -#define BINDER_TYPE_BINDER 1 -#define BINDER_TYPE_WEAK_BINDER 2 -#define BINDER_TYPE_HANDLE 3 -#define BINDER_TYPE_WEAK_HANDLE 4 -#define BINDER_TYPE_FD 5 - -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_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; -}; - -enum transaction_flags { - TF_ONE_WAY = 0x01, - TF_ROOT_OBJECT = 0x04, - TF_STATUS_CODE = 0x08, - TF_ACCEPT_FDS = 0x10, -}; - - -enum { - FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff, - FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100, -}; - -enum BinderDriverReturnProtocol { - 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, -}; - -enum BinderDriverCommandProtocol { - 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, -}; - -#endif - -#ifdef __cplusplus -} // namespace android -#endif - -#endif // _BINDER_MODULE_H_ diff --git a/include/private/utils/futex_synchro.h b/include/private/utils/futex_synchro.h deleted file mode 100644 index ac2ab19..0000000 --- a/include/private/utils/futex_synchro.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 _FUTEX_SYNCHRO_H -#define _FUTEX_SYNCHRO_H - -#ifndef HAVE_FUTEX -#error "HAVE_FUTEX not defined" -#endif - -#define FUTEX_WAIT_INFINITE (0) - -typedef struct futex_mutex_t futex_mutex_t; - -struct futex_mutex_t -{ - volatile int value; -}; - -typedef struct futex_cond_t futex_cond_t; - -struct futex_cond_t -{ - volatile int value; -}; - - -#if __cplusplus -extern "C" { -#endif - -void futex_mutex_init(futex_mutex_t *m); -int futex_mutex_lock(futex_mutex_t *m, unsigned msec); -void futex_mutex_unlock(futex_mutex_t *m); -int futex_mutex_trylock(futex_mutex_t *m); - -void futex_cond_init(futex_cond_t *c); -int futex_cond_wait(futex_cond_t *c, futex_mutex_t *m, unsigned msec); -void futex_cond_signal(futex_cond_t *c); -void futex_cond_broadcast(futex_cond_t *c); - -#if __cplusplus -} // extern "C" -#endif - -#endif // _FUTEX_SYNCHRO_H - |