diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/media/IMediaPlayerService.h | 11 | ||||
-rw-r--r-- | include/media/JetPlayer.h | 5 | ||||
-rw-r--r-- | include/media/MediaPlayerInterface.h | 3 | ||||
-rw-r--r-- | include/media/MidiIoWrapper.h | 50 | ||||
-rw-r--r-- | include/media/SoundPool.h | 241 | ||||
-rw-r--r-- | include/media/ToneGenerator.h | 9 | ||||
-rw-r--r-- | include/media/mediaplayer.h | 11 | ||||
-rw-r--r-- | include/media/stagefright/AACWriter.h | 1 | ||||
-rw-r--r-- | include/media/stagefright/ACodec.h | 2 | ||||
-rw-r--r-- | include/media/stagefright/ClockEstimator.h | 2 | ||||
-rw-r--r-- | include/media/stagefright/MediaDefs.h | 1 | ||||
-rw-r--r-- | include/media/stagefright/MediaMuxer.h | 2 | ||||
-rw-r--r-- | include/media/stagefright/OMXCodec.h | 2 | ||||
-rw-r--r-- | include/media/stagefright/SurfaceMediaSource.h | 4 | ||||
-rw-r--r-- | include/media/stagefright/foundation/AHandler.h | 7 | ||||
-rw-r--r-- | include/media/stagefright/foundation/ALooperRoster.h | 3 | ||||
-rw-r--r-- | include/media/stagefright/foundation/AString.h | 4 | ||||
-rw-r--r-- | include/ndk/NdkMediaDrm.h | 10 |
18 files changed, 83 insertions, 285 deletions
diff --git a/include/media/IMediaPlayerService.h b/include/media/IMediaPlayerService.h index d7e584a..67b599a 100644 --- a/include/media/IMediaPlayerService.h +++ b/include/media/IMediaPlayerService.h @@ -51,17 +51,6 @@ public: virtual sp<IMediaMetadataRetriever> createMetadataRetriever() = 0; virtual sp<IMediaPlayer> create(const sp<IMediaPlayerClient>& client, int audioSessionId = 0) = 0; - virtual status_t decode( - const sp<IMediaHTTPService> &httpService, - const char* url, - uint32_t *pSampleRate, - int* pNumChannels, - audio_format_t* pFormat, - const sp<IMemoryHeap>& heap, size_t *pSize) = 0; - - virtual status_t decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, - int* pNumChannels, audio_format_t* pFormat, - const sp<IMemoryHeap>& heap, size_t *pSize) = 0; virtual sp<IOMX> getOMX() = 0; virtual sp<ICrypto> makeCrypto() = 0; virtual sp<IDrm> makeDrm() = 0; diff --git a/include/media/JetPlayer.h b/include/media/JetPlayer.h index 388f767..63d1980 100644 --- a/include/media/JetPlayer.h +++ b/include/media/JetPlayer.h @@ -22,6 +22,7 @@ #include <libsonivox/jet.h> #include <libsonivox/eas_types.h> #include <media/AudioTrack.h> +#include <media/MidiIoWrapper.h> namespace android { @@ -86,15 +87,13 @@ private: int mMaxTracks; // max number of MIDI tracks, usually 32 EAS_DATA_HANDLE mEasData; - EAS_FILE_LOCATOR mEasJetFileLoc; + sp<MidiIoWrapper> mIoWrapper; EAS_PCM* mAudioBuffer;// EAS renders the MIDI data into this buffer, sp<AudioTrack> mAudioTrack; // and we play it in this audio track int mTrackBufferSize; S_JET_STATUS mJetStatus; S_JET_STATUS mPreviousJetStatus; - char mJetFilePath[PATH_MAX]; - class JetPlayerThread : public Thread { public: JetPlayerThread(JetPlayer *player) : mPlayer(player) { diff --git a/include/media/MediaPlayerInterface.h b/include/media/MediaPlayerInterface.h index c412299..4a6bf28 100644 --- a/include/media/MediaPlayerInterface.h +++ b/include/media/MediaPlayerInterface.h @@ -43,8 +43,6 @@ class IGraphicBufferProducer; template<typename T> class SortedVector; enum player_type { - PV_PLAYER = 1, - SONIVOX_PLAYER = 2, STAGEFRIGHT_PLAYER = 3, NU_PLAYER = 4, // Test players are available only in the 'test' and 'eng' builds. @@ -90,7 +88,6 @@ 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; diff --git a/include/media/MidiIoWrapper.h b/include/media/MidiIoWrapper.h new file mode 100644 index 0000000..e6f8cf7 --- /dev/null +++ b/include/media/MidiIoWrapper.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef MIDI_IO_WRAPPER_H_ +#define MIDI_IO_WRAPPER_H_ + +#include <libsonivox/eas_types.h> + +#include "media/stagefright/DataSource.h" + +namespace android { + +class MidiIoWrapper : public RefBase { +public: + MidiIoWrapper(const char *path); + MidiIoWrapper(int fd, off64_t offset, int64_t size); + MidiIoWrapper(const sp<DataSource> &source); + + ~MidiIoWrapper(); + + int readAt(void *buffer, int offset, int size); + int size(); + + EAS_FILE_LOCATOR getLocator(); + +private: + int mFd; + off64_t mBase; + int64_t mLength; + sp<DataSource> mDataSource; + EAS_FILE mEasFile; +}; + + +} // namespace android + +#endif // MIDI_IO_WRAPPER_H_ diff --git a/include/media/SoundPool.h b/include/media/SoundPool.h deleted file mode 100644 index 5830475..0000000 --- a/include/media/SoundPool.h +++ /dev/null @@ -1,241 +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 SOUNDPOOL_H_ -#define SOUNDPOOL_H_ - -#include <utils/threads.h> -#include <utils/List.h> -#include <utils/Vector.h> -#include <utils/KeyedVector.h> -#include <media/AudioTrack.h> -#include <binder/MemoryHeapBase.h> -#include <binder/MemoryBase.h> - -namespace android { - -static const int IDLE_PRIORITY = -1; - -// forward declarations -class SoundEvent; -class SoundPoolThread; -class SoundPool; - -// for queued events -class SoundPoolEvent { -public: - SoundPoolEvent(int msg, int arg1=0, int arg2=0) : - mMsg(msg), mArg1(arg1), mArg2(arg2) {} - int mMsg; - int mArg1; - int mArg2; - enum MessageType { INVALID, SAMPLE_LOADED }; -}; - -// callback function prototype -typedef void SoundPoolCallback(SoundPoolEvent event, SoundPool* soundPool, void* user); - -// tracks samples used by application -class Sample : public RefBase { -public: - enum sample_state { UNLOADED, LOADING, READY, UNLOADING }; - Sample(int sampleID, const char* url); - Sample(int sampleID, int fd, int64_t offset, int64_t length); - ~Sample(); - int sampleID() { return mSampleID; } - int numChannels() { return mNumChannels; } - int sampleRate() { return mSampleRate; } - audio_format_t format() { return mFormat; } - size_t size() { return mSize; } - int state() { return mState; } - uint8_t* data() { return static_cast<uint8_t*>(mData->pointer()); } - status_t doLoad(); - void startLoad() { mState = LOADING; } - sp<IMemory> getIMemory() { return mData; } - - // hack - void init(int numChannels, int sampleRate, audio_format_t format, size_t size, - sp<IMemory> data ) { - mNumChannels = numChannels; mSampleRate = sampleRate; mFormat = format; mSize = size; - mData = data; } - -private: - void init(); - - size_t mSize; - volatile int32_t mRefCount; - uint16_t mSampleID; - uint16_t mSampleRate; - uint8_t mState : 3; - uint8_t mNumChannels : 2; - audio_format_t mFormat; - int mFd; - int64_t mOffset; - int64_t mLength; - char* mUrl; - sp<IMemory> mData; - sp<MemoryHeapBase> mHeap; -}; - -// stores pending events for stolen channels -class SoundEvent -{ -public: - SoundEvent() : mChannelID(0), mLeftVolume(0), mRightVolume(0), - mPriority(IDLE_PRIORITY), mLoop(0), mRate(0) {} - void set(const sp<Sample>& sample, int channelID, float leftVolume, - float rightVolume, int priority, int loop, float rate); - sp<Sample> sample() { return mSample; } - int channelID() { return mChannelID; } - float leftVolume() { return mLeftVolume; } - float rightVolume() { return mRightVolume; } - int priority() { return mPriority; } - int loop() { return mLoop; } - float rate() { return mRate; } - void clear() { mChannelID = 0; mSample.clear(); } - -protected: - sp<Sample> mSample; - int mChannelID; - float mLeftVolume; - float mRightVolume; - int mPriority; - int mLoop; - float mRate; -}; - -// for channels aka AudioTracks -class SoundChannel : public SoundEvent { -public: - enum state { IDLE, RESUMING, STOPPING, PAUSED, PLAYING }; - SoundChannel() : mState(IDLE), mNumChannels(1), - mPos(0), mToggle(0), mAutoPaused(false) {} - ~SoundChannel(); - void init(SoundPool* soundPool); - void play(const sp<Sample>& sample, int channelID, float leftVolume, float rightVolume, - int priority, int loop, float rate); - void setVolume_l(float leftVolume, float rightVolume); - void setVolume(float leftVolume, float rightVolume); - void stop_l(); - void stop(); - void pause(); - void autoPause(); - void resume(); - void autoResume(); - void setRate(float rate); - int state() { return mState; } - void setPriority(int priority) { mPriority = priority; } - void setLoop(int loop); - int numChannels() { return mNumChannels; } - void clearNextEvent() { mNextEvent.clear(); } - void nextEvent(); - int nextChannelID() { return mNextEvent.channelID(); } - void dump(); - -private: - static void callback(int event, void* user, void *info); - void process(int event, void *info, unsigned long toggle); - bool doStop_l(); - - SoundPool* mSoundPool; - sp<AudioTrack> mAudioTrack; - SoundEvent mNextEvent; - Mutex mLock; - int mState; - int mNumChannels; - int mPos; - int mAudioBufferSize; - unsigned long mToggle; - bool mAutoPaused; -}; - -// application object for managing a pool of sounds -class SoundPool { - friend class SoundPoolThread; - friend class SoundChannel; -public: - SoundPool(int maxChannels, const audio_attributes_t* pAttributes); - ~SoundPool(); - int load(const char* url, int priority); - int load(int fd, int64_t offset, int64_t length, int priority); - bool unload(int sampleID); - int play(int sampleID, float leftVolume, float rightVolume, int priority, - int loop, float rate); - void pause(int channelID); - void autoPause(); - void resume(int channelID); - void autoResume(); - void stop(int channelID); - void setVolume(int channelID, float leftVolume, float rightVolume); - void setPriority(int channelID, int priority); - void setLoop(int channelID, int loop); - void setRate(int channelID, float rate); - const audio_attributes_t* attributes() { return &mAttributes; } - - // called from SoundPoolThread - void sampleLoaded(int sampleID); - - // called from AudioTrack thread - void done_l(SoundChannel* channel); - - // callback function - void setCallback(SoundPoolCallback* callback, void* user); - void* getUserData() { return mUserData; } - -private: - SoundPool() {} // no default constructor - bool startThreads(); - void doLoad(sp<Sample>& sample); - sp<Sample> findSample(int sampleID) { return mSamples.valueFor(sampleID); } - SoundChannel* findChannel (int channelID); - SoundChannel* findNextChannel (int channelID); - SoundChannel* allocateChannel_l(int priority); - void moveToFront_l(SoundChannel* channel); - void notify(SoundPoolEvent event); - void dump(); - - // restart thread - void addToRestartList(SoundChannel* channel); - void addToStopList(SoundChannel* channel); - static int beginThread(void* arg); - int run(); - void quit(); - - Mutex mLock; - Mutex mRestartLock; - Condition mCondition; - SoundPoolThread* mDecodeThread; - SoundChannel* mChannelPool; - List<SoundChannel*> mChannels; - List<SoundChannel*> mRestart; - List<SoundChannel*> mStop; - DefaultKeyedVector< int, sp<Sample> > mSamples; - int mMaxChannels; - audio_attributes_t mAttributes; - int mAllocated; - int mNextSampleID; - int mNextChannelID; - bool mQuit; - - // callback - Mutex mCallbackLock; - SoundPoolCallback* mCallback; - void* mUserData; -}; - -} // end namespace android - -#endif /*SOUNDPOOL_H_*/ diff --git a/include/media/ToneGenerator.h b/include/media/ToneGenerator.h index 98c4332..8406ed6 100644 --- a/include/media/ToneGenerator.h +++ b/include/media/ToneGenerator.h @@ -17,11 +17,12 @@ #ifndef ANDROID_TONEGENERATOR_H_ #define ANDROID_TONEGENERATOR_H_ -#include <utils/RefBase.h> -#include <utils/KeyedVector.h> -#include <utils/threads.h> #include <media/AudioSystem.h> #include <media/AudioTrack.h> +#include <utils/Compat.h> +#include <utils/KeyedVector.h> +#include <utils/RefBase.h> +#include <utils/threads.h> namespace android { @@ -207,7 +208,7 @@ private: static const unsigned int TONEGEN_MAX_WAVES = 3; // Maximun number of sine waves in a tone segment static const unsigned int TONEGEN_MAX_SEGMENTS = 12; // Maximun number of segments in a tone descriptor static const unsigned int TONEGEN_INF = 0xFFFFFFFF; // Represents infinite time duration - static const float TONEGEN_GAIN = 0.9; // Default gain passed to WaveGenerator(). + static const CONSTEXPR float TONEGEN_GAIN = 0.9; // Default gain passed to WaveGenerator(). // ToneDescriptor class contains all parameters needed to generate a tone: // - The array waveFreq[]: diff --git a/include/media/mediaplayer.h b/include/media/mediaplayer.h index 9cc208e..5830933 100644 --- a/include/media/mediaplayer.h +++ b/include/media/mediaplayer.h @@ -232,17 +232,6 @@ public: bool isLooping(); status_t setVolume(float leftVolume, float rightVolume); void notify(int msg, int ext1, int ext2, const Parcel *obj = NULL); - static status_t decode( - const sp<IMediaHTTPService> &httpService, - const char* url, - uint32_t *pSampleRate, - int* pNumChannels, - audio_format_t* pFormat, - const sp<IMemoryHeap>& heap, - size_t *pSize); - static status_t decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, - int* pNumChannels, audio_format_t* pFormat, - const sp<IMemoryHeap>& heap, size_t *pSize); status_t invoke(const Parcel& request, Parcel *reply); status_t setMetadataFilter(const Parcel& filter); status_t getMetadata(bool update_only, bool apply_filter, Parcel *metadata); diff --git a/include/media/stagefright/AACWriter.h b/include/media/stagefright/AACWriter.h index df1b053..d22707a 100644 --- a/include/media/stagefright/AACWriter.h +++ b/include/media/stagefright/AACWriter.h @@ -17,6 +17,7 @@ #ifndef AAC_WRITER_H_ #define AAC_WRITER_H_ +#include "foundation/ABase.h" #include <media/stagefright/MediaWriter.h> #include <utils/threads.h> diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h index 595ace8..cd2bd27 100644 --- a/include/media/stagefright/ACodec.h +++ b/include/media/stagefright/ACodec.h @@ -290,7 +290,7 @@ private: OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE desiredFormat); status_t setupAMRCodec(bool encoder, bool isWAMR, int32_t bitRate); - status_t setupG711Codec(bool encoder, int32_t numChannels); + status_t setupG711Codec(bool encoder, int32_t sampleRate, int32_t numChannels); status_t setupFlacCodec( bool encoder, int32_t numChannels, int32_t sampleRate, int32_t compressionLevel); diff --git a/include/media/stagefright/ClockEstimator.h b/include/media/stagefright/ClockEstimator.h index 2fd6e75..1455b7f 100644 --- a/include/media/stagefright/ClockEstimator.h +++ b/include/media/stagefright/ClockEstimator.h @@ -19,7 +19,7 @@ #define CLOCK_ESTIMATOR_H_ - +#include "foundation/ABase.h" #include <utils/RefBase.h> #include <utils/Vector.h> diff --git a/include/media/stagefright/MediaDefs.h b/include/media/stagefright/MediaDefs.h index 13695d5..a0036e0 100644 --- a/include/media/stagefright/MediaDefs.h +++ b/include/media/stagefright/MediaDefs.h @@ -36,6 +36,7 @@ extern const char *MEDIA_MIMETYPE_AUDIO_AMR_WB; extern const char *MEDIA_MIMETYPE_AUDIO_MPEG; // layer III extern const char *MEDIA_MIMETYPE_AUDIO_MPEG_LAYER_I; extern const char *MEDIA_MIMETYPE_AUDIO_MPEG_LAYER_II; +extern const char *MEDIA_MIMETYPE_AUDIO_MIDI; extern const char *MEDIA_MIMETYPE_AUDIO_AAC; extern const char *MEDIA_MIMETYPE_AUDIO_QCELP; extern const char *MEDIA_MIMETYPE_AUDIO_VORBIS; diff --git a/include/media/stagefright/MediaMuxer.h b/include/media/stagefright/MediaMuxer.h index bbe4303..9da98d9 100644 --- a/include/media/stagefright/MediaMuxer.h +++ b/include/media/stagefright/MediaMuxer.h @@ -22,6 +22,8 @@ #include <utils/Vector.h> #include <utils/threads.h> +#include "foundation/ABase.h" + namespace android { struct ABuffer; diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h index e341160..84b1b1a 100644 --- a/include/media/stagefright/OMXCodec.h +++ b/include/media/stagefright/OMXCodec.h @@ -250,7 +250,7 @@ private: status_t setAC3Format(int32_t numChannels, int32_t sampleRate); - void setG711Format(int32_t numChannels); + void setG711Format(int32_t sampleRate, int32_t numChannels); status_t setVideoPortFormatType( OMX_U32 portIndex, diff --git a/include/media/stagefright/SurfaceMediaSource.h b/include/media/stagefright/SurfaceMediaSource.h index d15a226..2177c00 100644 --- a/include/media/stagefright/SurfaceMediaSource.h +++ b/include/media/stagefright/SurfaceMediaSource.h @@ -25,6 +25,8 @@ #include <media/stagefright/MediaSource.h> #include <media/stagefright/MediaBuffer.h> +#include "foundation/ABase.h" + namespace android { // ---------------------------------------------------------------------------- @@ -233,7 +235,7 @@ private: Condition mMediaBuffersAvailableCondition; // Avoid copying and equating and default constructor - DISALLOW_IMPLICIT_CONSTRUCTORS(SurfaceMediaSource); + DISALLOW_EVIL_CONSTRUCTORS(SurfaceMediaSource); }; // ---------------------------------------------------------------------------- diff --git a/include/media/stagefright/foundation/AHandler.h b/include/media/stagefright/foundation/AHandler.h index b008b54..41ade77 100644 --- a/include/media/stagefright/foundation/AHandler.h +++ b/include/media/stagefright/foundation/AHandler.h @@ -19,6 +19,7 @@ #define A_HANDLER_H_ #include <media/stagefright/foundation/ALooper.h> +#include <utils/KeyedVector.h> #include <utils/RefBase.h> namespace android { @@ -27,7 +28,8 @@ struct AMessage; struct AHandler : public RefBase { AHandler() - : mID(0) { + : mID(0), + mMessageCounter(0) { } ALooper::handler_id id() const { @@ -48,6 +50,9 @@ private: mID = id; } + uint32_t mMessageCounter; + KeyedVector<uint32_t, uint32_t> mMessages; + DISALLOW_EVIL_CONSTRUCTORS(AHandler); }; diff --git a/include/media/stagefright/foundation/ALooperRoster.h b/include/media/stagefright/foundation/ALooperRoster.h index 4d76b64..a0be8eb 100644 --- a/include/media/stagefright/foundation/ALooperRoster.h +++ b/include/media/stagefright/foundation/ALooperRoster.h @@ -20,6 +20,7 @@ #include <media/stagefright/foundation/ALooper.h> #include <utils/KeyedVector.h> +#include <utils/String16.h> namespace android { @@ -42,6 +43,8 @@ struct ALooperRoster { sp<ALooper> findLooper(ALooper::handler_id handlerID); + void dump(int fd, const Vector<String16>& args); + private: struct HandlerInfo { wp<ALooper> mLooper; diff --git a/include/media/stagefright/foundation/AString.h b/include/media/stagefright/foundation/AString.h index 7c98699..822dbb3 100644 --- a/include/media/stagefright/foundation/AString.h +++ b/include/media/stagefright/foundation/AString.h @@ -23,7 +23,7 @@ namespace android { -struct String8; +class String8; struct Parcel; struct AString { @@ -102,7 +102,7 @@ private: void makeMutable(); }; -AString StringPrintf(const char *format, ...); +AString AStringPrintf(const char *format, ...); } // namespace android diff --git a/include/ndk/NdkMediaDrm.h b/include/ndk/NdkMediaDrm.h index 10afdd9..3c312a9 100644 --- a/include/ndk/NdkMediaDrm.h +++ b/include/ndk/NdkMediaDrm.h @@ -327,24 +327,24 @@ media_status_t AMediaDrm_releaseSecureStops(AMediaDrm *, /** * String property name: identifies the maker of the DRM engine plugin */ -const char *PROPERTY_VENDOR = "vendor"; +#define PROPERTY_VENDOR "vendor" /** * String property name: identifies the version of the DRM engine plugin */ -const char *PROPERTY_VERSION = "version"; +#define PROPERTY_VERSION "version" /** * String property name: describes the DRM engine plugin */ -const char *PROPERTY_DESCRIPTION = "description"; +#define PROPERTY_DESCRIPTION "description" /** * String property name: a comma-separated list of cipher and mac algorithms * supported by CryptoSession. The list may be empty if the DRM engine * plugin does not support CryptoSession operations. */ -const char *PROPERTY_ALGORITHMS = "algorithms"; +#define PROPERTY_ALGORITHMS "algorithms" /** * Read a DRM engine plugin String property value, given the property name string. @@ -361,7 +361,7 @@ media_status_t AMediaDrm_getPropertyString(AMediaDrm *, const char *propertyName * Byte array property name: the device unique identifier is established during * device provisioning and provides a means of uniquely identifying each device. */ -const char *PROPERTY_DEVICE_UNIQUE_ID = "deviceUniqueId"; +#define PROPERTY_DEVICE_UNIQUE_ID "deviceUniqueId" /** * Read a DRM engine plugin byte array property value, given the property name string. |