diff options
Diffstat (limited to 'include')
28 files changed, 203 insertions, 59 deletions
diff --git a/include/media/AudioResamplerPublic.h b/include/media/AudioResamplerPublic.h index 07d946d..53b8c13 100644 --- a/include/media/AudioResamplerPublic.h +++ b/include/media/AudioResamplerPublic.h @@ -18,6 +18,9 @@ #define ANDROID_AUDIO_RESAMPLER_PUBLIC_H #include <stdint.h> +#include <math.h> + +namespace android { // AUDIO_RESAMPLER_DOWN_RATIO_MAX is the maximum ratio between the original // audio sample rate and the target rate when downsampling, @@ -34,13 +37,76 @@ // an int32_t of the phase increments, making the resulting sample rate inexact. #define AUDIO_RESAMPLER_UP_RATIO_MAX 65536 -#define AUDIO_TIMESTRETCH_SPEED_MIN 0.5f -#define AUDIO_TIMESTRETCH_SPEED_MAX 2.0f +// AUDIO_TIMESTRETCH_SPEED_MIN and AUDIO_TIMESTRETCH_SPEED_MAX define the min and max time stretch +// speeds supported by the system. These are enforced by the system and values outside this range +// will result in a runtime error. +// Depending on the AudioPlaybackRate::mStretchMode, the effective limits might be narrower than +// the ones specified here +// AUDIO_TIMESTRETCH_SPEED_MIN_DELTA is the minimum absolute speed difference that might trigger a +// parameter update +#define AUDIO_TIMESTRETCH_SPEED_MIN 0.01f +#define AUDIO_TIMESTRETCH_SPEED_MAX 20.0f #define AUDIO_TIMESTRETCH_SPEED_NORMAL 1.0f +#define AUDIO_TIMESTRETCH_SPEED_MIN_DELTA 0.0001f -#define AUDIO_TIMESTRETCH_PITCH_MIN 0.5f -#define AUDIO_TIMESTRETCH_PITCH_MAX 2.0f +// AUDIO_TIMESTRETCH_PITCH_MIN and AUDIO_TIMESTRETCH_PITCH_MAX define the min and max time stretch +// pitch shifting supported by the system. These are not enforced by the system and values +// outside this range might result in a pitch different than the one requested. +// Depending on the AudioPlaybackRate::mStretchMode, the effective limits might be narrower than +// the ones specified here. +// AUDIO_TIMESTRETCH_PITCH_MIN_DELTA is the minimum absolute pitch difference that might trigger a +// parameter update +#define AUDIO_TIMESTRETCH_PITCH_MIN 0.25f +#define AUDIO_TIMESTRETCH_PITCH_MAX 4.0f #define AUDIO_TIMESTRETCH_PITCH_NORMAL 1.0f +#define AUDIO_TIMESTRETCH_PITCH_MIN_DELTA 0.0001f + + +//Determines the current algorithm used for stretching +enum AudioTimestretchStretchMode : int32_t { + AUDIO_TIMESTRETCH_STRETCH_DEFAULT = 0, + AUDIO_TIMESTRETCH_STRETCH_SPEECH = 1, + //TODO: add more stretch modes/algorithms +}; + +//Limits for AUDIO_TIMESTRETCH_STRETCH_SPEECH mode +#define TIMESTRETCH_SONIC_SPEED_MIN 0.1f +#define TIMESTRETCH_SONIC_SPEED_MAX 6.0f + +//Determines behavior of Timestretch if current algorithm can't perform +//with current parameters. +// FALLBACK_CUT_REPEAT: (internal only) for speed <1.0 will truncate frames +// for speed > 1.0 will repeat frames +// FALLBACK_MUTE: will set all processed frames to zero +// FALLBACK_FAIL: will stop program execution and log a fatal error +enum AudioTimestretchFallbackMode : int32_t { + AUDIO_TIMESTRETCH_FALLBACK_CUT_REPEAT = -1, + AUDIO_TIMESTRETCH_FALLBACK_DEFAULT = 0, + AUDIO_TIMESTRETCH_FALLBACK_MUTE = 1, + AUDIO_TIMESTRETCH_FALLBACK_FAIL = 2, +}; + +struct AudioPlaybackRate { + float mSpeed; + float mPitch; + enum AudioTimestretchStretchMode mStretchMode; + enum AudioTimestretchFallbackMode mFallbackMode; +}; + +static const AudioPlaybackRate AUDIO_PLAYBACK_RATE_DEFAULT = { + AUDIO_TIMESTRETCH_SPEED_NORMAL, + AUDIO_TIMESTRETCH_PITCH_NORMAL, + AUDIO_TIMESTRETCH_STRETCH_DEFAULT, + AUDIO_TIMESTRETCH_FALLBACK_DEFAULT +}; + +static inline bool isAudioPlaybackRateEqual(const AudioPlaybackRate &pr1, + const AudioPlaybackRate &pr2) { + return fabs(pr1.mSpeed - pr2.mSpeed) < AUDIO_TIMESTRETCH_SPEED_MIN_DELTA && + fabs(pr1.mPitch - pr2.mPitch) < AUDIO_TIMESTRETCH_PITCH_MIN_DELTA && + pr2.mStretchMode == pr2.mStretchMode && + pr2.mFallbackMode == pr2.mFallbackMode; +} // TODO: Consider putting these inlines into a class scope @@ -77,4 +143,8 @@ static inline size_t sourceFramesNeededWithTimestretch( return required * (double)speed + 1 + 1; // accounting for rounding dependencies } +} // namespace android + +// --------------------------------------------------------------------------- + #endif // ANDROID_AUDIO_RESAMPLER_PUBLIC_H diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h index a06197f..2d34c02 100644 --- a/include/media/AudioTrack.h +++ b/include/media/AudioTrack.h @@ -21,6 +21,7 @@ #include <media/AudioSystem.h> #include <media/AudioTimestamp.h> #include <media/IAudioTrack.h> +#include <media/AudioResamplerPublic.h> #include <utils/threads.h> namespace android { @@ -369,10 +370,10 @@ public: * Speed increases the playback rate of media, but does not alter pitch. * Pitch increases the "tonal frequency" of media, but does not affect the playback rate. */ - status_t setPlaybackRate(float speed, float pitch); + status_t setPlaybackRate(const AudioPlaybackRate &playbackRate); /* Return current playback rate */ - void getPlaybackRate(float *speed, float *pitch) const; + const AudioPlaybackRate& getPlaybackRate() const; /* Enables looping and sets the start and end points of looping. * Only supported for static buffer mode. @@ -748,8 +749,7 @@ protected: float mVolume[2]; float mSendLevel; mutable uint32_t mSampleRate; // mutable because getSampleRate() can update it - float mSpeed; // timestretch: 1.0f for normal speed. - float mPitch; // timestretch: 1.0f for normal pitch. + AudioPlaybackRate mPlaybackRate; size_t mFrameCount; // corresponds to current IAudioTrack, value is // reported back by AudioFlinger to the client size_t mReqFrameCount; // frame count to request the first or next time diff --git a/include/media/ICrypto.h b/include/media/ICrypto.h index aa04dbe..ea316de 100644 --- a/include/media/ICrypto.h +++ b/include/media/ICrypto.h @@ -25,7 +25,7 @@ namespace android { struct AString; -struct IMemory; +class IMemory; struct ICrypto : public IInterface { DECLARE_META_INTERFACE(Crypto); diff --git a/include/media/IDataSource.h b/include/media/IDataSource.h new file mode 100644 index 0000000..07e46f7 --- /dev/null +++ b/include/media/IDataSource.h @@ -0,0 +1,61 @@ +/* + * Copyright 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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_IDATASOURCE_H +#define ANDROID_IDATASOURCE_H + +#include <binder/IInterface.h> +#include <media/stagefright/foundation/ABase.h> +#include <utils/Errors.h> + +namespace android { + +class IMemory; + +// A binder interface for implementing a stagefright DataSource remotely. +class IDataSource : public IInterface { +public: + DECLARE_META_INTERFACE(DataSource); + + // Get the memory that readAt writes into. + virtual sp<IMemory> getIMemory() = 0; + // Read up to |size| bytes into the memory returned by getIMemory(). Returns + // the number of bytes read, or -1 on error. |size| must not be larger than + // the buffer. + virtual ssize_t readAt(off64_t offset, size_t size) = 0; + // Get the size, or -1 if the size is unknown. + virtual status_t getSize(off64_t* size) = 0; + // This should be called before deleting |this|. The other methods may + // return errors if they're called after calling close(). + virtual void close() = 0; + +private: + DISALLOW_EVIL_CONSTRUCTORS(IDataSource); +}; + +// ---------------------------------------------------------------------------- + +class BnDataSource : public BnInterface<IDataSource> { +public: + virtual status_t onTransact(uint32_t code, + const Parcel& data, + Parcel* reply, + uint32_t flags = 0); +}; + +}; // namespace android + +#endif // ANDROID_IDATASOURCE_H diff --git a/include/media/IMediaMetadataRetriever.h b/include/media/IMediaMetadataRetriever.h index 2529800..c90f254 100644 --- a/include/media/IMediaMetadataRetriever.h +++ b/include/media/IMediaMetadataRetriever.h @@ -26,6 +26,7 @@ namespace android { +class IDataSource; struct IMediaHTTPService; class IMediaMetadataRetriever: public IInterface @@ -40,6 +41,7 @@ public: const KeyedVector<String8, String8> *headers = NULL) = 0; virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0; + virtual status_t setDataSource(const sp<IDataSource>& dataSource) = 0; virtual sp<IMemory> getFrameAtTime(int64_t timeUs, int option) = 0; virtual sp<IMemory> extractAlbumArt() = 0; virtual const char* extractMetadata(int keyCode) = 0; diff --git a/include/media/IMediaPlayer.h b/include/media/IMediaPlayer.h index 4153c25..df6130d 100644 --- a/include/media/IMediaPlayer.h +++ b/include/media/IMediaPlayer.h @@ -31,7 +31,8 @@ namespace android { class Parcel; class Surface; -class IStreamSource; +class IDataSource; +struct IStreamSource; class IGraphicBufferProducer; struct IMediaHTTPService; @@ -49,6 +50,7 @@ public: virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0; virtual status_t setDataSource(const sp<IStreamSource>& source) = 0; + virtual status_t setDataSource(const sp<IDataSource>& source) = 0; virtual status_t setVideoSurfaceTexture( const sp<IGraphicBufferProducer>& bufferProducer) = 0; virtual status_t prepareAsync() = 0; diff --git a/include/media/IStreamSource.h b/include/media/IStreamSource.h index 149bd49..4a6aafd 100644 --- a/include/media/IStreamSource.h +++ b/include/media/IStreamSource.h @@ -23,7 +23,7 @@ namespace android { struct AMessage; -struct IMemory; +class IMemory; struct IStreamListener; struct IStreamSource : public IInterface { diff --git a/include/media/MediaCodecInfo.h b/include/media/MediaCodecInfo.h index 895a13a..4067b47 100644 --- a/include/media/MediaCodecInfo.h +++ b/include/media/MediaCodecInfo.h @@ -32,7 +32,7 @@ namespace android { struct AMessage; -struct Parcel; +class Parcel; struct CodecCapabilities; typedef KeyedVector<AString, AString> CodecSettings; diff --git a/include/media/MediaMetadataRetrieverInterface.h b/include/media/MediaMetadataRetrieverInterface.h index 38dbb20..bce6ee3 100644 --- a/include/media/MediaMetadataRetrieverInterface.h +++ b/include/media/MediaMetadataRetrieverInterface.h @@ -25,6 +25,7 @@ namespace android { +class DataSource; struct IMediaHTTPService; // Abstract base class @@ -40,6 +41,7 @@ public: const KeyedVector<String8, String8> *headers = NULL) = 0; virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0; + virtual status_t setDataSource(const sp<DataSource>& source) = 0; virtual VideoFrame* getFrameAtTime(int64_t timeUs, int option) = 0; virtual MediaAlbumArt* extractAlbumArt() = 0; virtual const char* extractMetadata(int keyCode) = 0; diff --git a/include/media/MediaPlayerInterface.h b/include/media/MediaPlayerInterface.h index d6fe390..824762a 100644 --- a/include/media/MediaPlayerInterface.h +++ b/include/media/MediaPlayerInterface.h @@ -36,6 +36,7 @@ struct sockaddr_in; namespace android { +class DataSource; class Parcel; class Surface; class IGraphicBufferProducer; @@ -131,11 +132,11 @@ public: virtual void pause() = 0; virtual void close() = 0; - virtual status_t setPlaybackRatePermille(int32_t rate) { return INVALID_OPERATION; } + virtual status_t setPlaybackRatePermille(int32_t /* rate */) { return INVALID_OPERATION;} virtual bool needsTrailingPadding() { return true; } - virtual status_t setParameters(const String8& keyValuePairs) { return NO_ERROR; }; - virtual String8 getParameters(const String8& keys) { return String8::empty(); }; + virtual status_t setParameters(const String8& /* keyValuePairs */) { return NO_ERROR; } + virtual String8 getParameters(const String8& /* keys */) { return String8::empty(); } }; MediaPlayerBase() : mCookie(0), mNotify(0) {} @@ -143,7 +144,7 @@ public: virtual status_t initCheck() = 0; virtual bool hardwareOutput() = 0; - virtual status_t setUID(uid_t uid) { + virtual status_t setUID(uid_t /* uid */) { return INVALID_OPERATION; } @@ -154,7 +155,11 @@ public: virtual status_t setDataSource(int fd, int64_t offset, int64_t length) = 0; - virtual status_t setDataSource(const sp<IStreamSource> &source) { + virtual status_t setDataSource(const sp<IStreamSource>& /* source */) { + return INVALID_OPERATION; + } + + virtual status_t setDataSource(const sp<DataSource>& /* source */) { return INVALID_OPERATION; } @@ -168,7 +173,7 @@ public: virtual status_t stop() = 0; virtual status_t pause() = 0; virtual bool isPlaying() = 0; - virtual status_t setPlaybackRate(float rate) { return INVALID_OPERATION; } + virtual status_t setPlaybackRate(float /* rate */) { return INVALID_OPERATION; } virtual status_t seekTo(int msec) = 0; virtual status_t getCurrentPosition(int *msec) = 0; virtual status_t getDuration(int *msec) = 0; @@ -179,13 +184,13 @@ public: virtual status_t getParameter(int key, Parcel *reply) = 0; // default no-op implementation of optional extensions - virtual status_t setRetransmitEndpoint(const struct sockaddr_in* endpoint) { + virtual status_t setRetransmitEndpoint(const struct sockaddr_in* /* endpoint */) { return INVALID_OPERATION; } - virtual status_t getRetransmitEndpoint(struct sockaddr_in* endpoint) { + virtual status_t getRetransmitEndpoint(struct sockaddr_in* /* endpoint */) { return INVALID_OPERATION; } - virtual status_t setNextPlayer(const sp<MediaPlayerBase>& next) { + virtual status_t setNextPlayer(const sp<MediaPlayerBase>& /* next */) { return OK; } @@ -205,8 +210,8 @@ public: // the known metadata should be returned. // @param[inout] records Parcel where the player appends its metadata. // @return OK if the call was successful. - virtual status_t getMetadata(const media::Metadata::Filter& ids, - Parcel *records) { + virtual status_t getMetadata(const media::Metadata::Filter& /* ids */, + Parcel* /* records */) { return INVALID_OPERATION; }; @@ -229,7 +234,7 @@ public: if (notifyCB) notifyCB(cookie, msg, ext1, ext2, obj); } - virtual status_t dump(int fd, const Vector<String16> &args) const { + virtual status_t dump(int /* fd */, const Vector<String16>& /* args */) const { return INVALID_OPERATION; } diff --git a/include/media/mediametadataretriever.h b/include/media/mediametadataretriever.h index 7191965..f655f35 100644 --- a/include/media/mediametadataretriever.h +++ b/include/media/mediametadataretriever.h @@ -25,6 +25,7 @@ namespace android { +class IDataSource; struct IMediaHTTPService; class IMediaPlayerService; class IMediaMetadataRetriever; @@ -75,6 +76,7 @@ public: const KeyedVector<String8, String8> *headers = NULL); status_t setDataSource(int fd, int64_t offset, int64_t length); + status_t setDataSource(const sp<IDataSource>& dataSource); sp<IMemory> getFrameAtTime(int64_t timeUs, int option); sp<IMemory> extractAlbumArt(); const char* extractMetadata(int keyCode); diff --git a/include/media/mediaplayer.h b/include/media/mediaplayer.h index 808e893..256fa9a 100644 --- a/include/media/mediaplayer.h +++ b/include/media/mediaplayer.h @@ -50,6 +50,7 @@ enum media_event_type { MEDIA_ERROR = 100, MEDIA_INFO = 200, MEDIA_SUBTITLE_DATA = 201, + MEDIA_META_DATA = 202, }; // Generic error codes for the media player framework. Errors are fatal, the @@ -183,6 +184,7 @@ enum media_track_type { MEDIA_TRACK_TYPE_AUDIO = 2, MEDIA_TRACK_TYPE_TIMEDTEXT = 3, MEDIA_TRACK_TYPE_SUBTITLE = 4, + MEDIA_TRACK_TYPE_METADATA = 5, }; // ---------------------------------------------------------------------------- @@ -211,6 +213,7 @@ public: status_t setDataSource(int fd, int64_t offset, int64_t length); status_t setDataSource(const sp<IStreamSource> &source); + status_t setDataSource(const sp<IDataSource> &source); status_t setVideoSurfaceTexture( const sp<IGraphicBufferProducer>& bufferProducer); status_t setListener(const sp<MediaPlayerListener>& listener); diff --git a/include/media/stagefright/AACWriter.h b/include/media/stagefright/AACWriter.h index 86417a5..aa60a19 100644 --- a/include/media/stagefright/AACWriter.h +++ b/include/media/stagefright/AACWriter.h @@ -24,7 +24,7 @@ namespace android { struct MediaSource; -struct MetaData; +class MetaData; struct AACWriter : public MediaWriter { AACWriter(int fd); diff --git a/include/media/stagefright/AMRWriter.h b/include/media/stagefright/AMRWriter.h index bac878b..b38be55 100644 --- a/include/media/stagefright/AMRWriter.h +++ b/include/media/stagefright/AMRWriter.h @@ -26,7 +26,7 @@ namespace android { struct MediaSource; -struct MetaData; +class MetaData; struct AMRWriter : public MediaWriter { AMRWriter(int fd); diff --git a/include/media/stagefright/AudioPlayer.h b/include/media/stagefright/AudioPlayer.h index 14afb85..98c4fa7 100644 --- a/include/media/stagefright/AudioPlayer.h +++ b/include/media/stagefright/AudioPlayer.h @@ -27,7 +27,7 @@ namespace android { class MediaSource; class AudioTrack; -class AwesomePlayer; +struct AwesomePlayer; class AudioPlayer : public TimeSource { public: diff --git a/include/media/stagefright/CameraSource.h b/include/media/stagefright/CameraSource.h index dd0a106..96dfd7e 100644 --- a/include/media/stagefright/CameraSource.h +++ b/include/media/stagefright/CameraSource.h @@ -188,7 +188,7 @@ protected: void releaseCamera(); private: - friend class CameraSourceListener; + friend struct CameraSourceListener; Mutex mLock; Condition mFrameAvailableCondition; diff --git a/include/media/stagefright/DataSource.h b/include/media/stagefright/DataSource.h index 3630263..dcde36f 100644 --- a/include/media/stagefright/DataSource.h +++ b/include/media/stagefright/DataSource.h @@ -32,6 +32,7 @@ namespace android { struct AMessage; struct AString; +class IDataSource; struct IMediaHTTPService; class String8; struct HTTPBase; @@ -53,11 +54,15 @@ public: HTTPBase *httpSource = NULL); static sp<DataSource> CreateMediaHTTP(const sp<IMediaHTTPService> &httpService); + static sp<DataSource> CreateFromIDataSource(const sp<IDataSource> &source); DataSource() {} virtual status_t initCheck() const = 0; + // Returns the number of bytes read, or -1 on failure. It's not an error if + // this returns zero; it just means the given offset is equal to, or + // beyond, the end of the source. virtual ssize_t readAt(off64_t offset, void *data, size_t size) = 0; // Convenience methods: diff --git a/include/media/stagefright/MediaCodec.h b/include/media/stagefright/MediaCodec.h index d98fa1a..f2b21c9 100644 --- a/include/media/stagefright/MediaCodec.h +++ b/include/media/stagefright/MediaCodec.h @@ -33,7 +33,7 @@ struct AString; struct CodecBase; struct IBatteryStats; struct ICrypto; -struct IMemory; +class IMemory; struct MemoryDealer; class IResourceManagerClient; class IResourceManagerService; @@ -304,6 +304,7 @@ private: sp<AMessage> mActivityNotify; bool mHaveInputSurface; + bool mHavePendingInputBuffers; MediaCodec(const sp<ALooper> &looper); diff --git a/include/media/stagefright/MediaCodecSource.h b/include/media/stagefright/MediaCodecSource.h index 7b8f59d..9d1f222 100644 --- a/include/media/stagefright/MediaCodecSource.h +++ b/include/media/stagefright/MediaCodecSource.h @@ -23,7 +23,7 @@ namespace android { -class ALooper; +struct ALooper; class AMessage; struct AReplyToken; class IGraphicBufferProducer; diff --git a/include/media/stagefright/MediaDefs.h b/include/media/stagefright/MediaDefs.h index a0036e0..3b58122 100644 --- a/include/media/stagefright/MediaDefs.h +++ b/include/media/stagefright/MediaDefs.h @@ -64,6 +64,7 @@ extern const char *MEDIA_MIMETYPE_TEXT_3GPP; extern const char *MEDIA_MIMETYPE_TEXT_SUBRIP; extern const char *MEDIA_MIMETYPE_TEXT_VTT; extern const char *MEDIA_MIMETYPE_TEXT_CEA_608; +extern const char *MEDIA_MIMETYPE_DATA_METADATA; } // namespace android diff --git a/include/media/stagefright/MediaMuxer.h b/include/media/stagefright/MediaMuxer.h index e6538d1..fa855a8 100644 --- a/include/media/stagefright/MediaMuxer.h +++ b/include/media/stagefright/MediaMuxer.h @@ -29,9 +29,9 @@ namespace android { struct ABuffer; struct AMessage; struct MediaAdapter; -struct MediaBuffer; +class MediaBuffer; struct MediaSource; -struct MetaData; +class MetaData; struct MediaWriter; // MediaMuxer is used to mux multiple tracks into a video. Currently, we only diff --git a/include/media/stagefright/MediaWriter.h b/include/media/stagefright/MediaWriter.h index e27ea1d..8e02506 100644 --- a/include/media/stagefright/MediaWriter.h +++ b/include/media/stagefright/MediaWriter.h @@ -24,7 +24,7 @@ namespace android { struct MediaSource; -struct MetaData; +class MetaData; struct MediaWriter : public RefBase { MediaWriter() diff --git a/include/media/stagefright/NuMediaExtractor.h b/include/media/stagefright/NuMediaExtractor.h index 402e7f8..fd74452 100644 --- a/include/media/stagefright/NuMediaExtractor.h +++ b/include/media/stagefright/NuMediaExtractor.h @@ -30,12 +30,12 @@ namespace android { struct ABuffer; struct AMessage; -struct DataSource; +class DataSource; struct IMediaHTTPService; -struct MediaBuffer; +class MediaBuffer; struct MediaExtractor; struct MediaSource; -struct MetaData; +class MetaData; struct NuMediaExtractor : public RefBase { enum SampleFlags { diff --git a/include/media/stagefright/Utils.h b/include/media/stagefright/Utils.h index ec3a10e..0ce1603 100644 --- a/include/media/stagefright/Utils.h +++ b/include/media/stagefright/Utils.h @@ -41,7 +41,7 @@ uint64_t U64LE_AT(const uint8_t *ptr); uint64_t ntoh64(uint64_t x); uint64_t hton64(uint64_t x); -struct MetaData; +class MetaData; struct AMessage; status_t convertMetaDataToMessage( const sp<MetaData> &meta, sp<AMessage> *format); @@ -71,7 +71,7 @@ struct HLSTime { sp<AMessage> mMeta; HLSTime(const sp<AMessage> &meta = NULL); - int64_t getSegmentTimeUs(bool midpoint = false) const; + int64_t getSegmentTimeUs() const; }; bool operator <(const HLSTime &t0, const HLSTime &t1); diff --git a/include/media/stagefright/foundation/AMessage.h b/include/media/stagefright/foundation/AMessage.h index 4c6bd21..83b9444 100644 --- a/include/media/stagefright/foundation/AMessage.h +++ b/include/media/stagefright/foundation/AMessage.h @@ -28,7 +28,7 @@ namespace android { struct ABuffer; struct AHandler; struct AString; -struct Parcel; +class Parcel; struct AReplyToken : public RefBase { AReplyToken(const sp<ALooper> &looper) diff --git a/include/media/stagefright/foundation/AString.h b/include/media/stagefright/foundation/AString.h index 822dbb3..2f6d532 100644 --- a/include/media/stagefright/foundation/AString.h +++ b/include/media/stagefright/foundation/AString.h @@ -24,7 +24,7 @@ namespace android { class String8; -struct Parcel; +class Parcel; struct AString { AString(); diff --git a/include/media/stagefright/timedtext/TimedTextDriver.h b/include/media/stagefright/timedtext/TimedTextDriver.h index 37ef674..6f7c693 100644 --- a/include/media/stagefright/timedtext/TimedTextDriver.h +++ b/include/media/stagefright/timedtext/TimedTextDriver.h @@ -24,7 +24,7 @@ namespace android { -class ALooper; +struct ALooper; struct IMediaHTTPService; class MediaPlayerBase; class MediaSource; diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h index 6cc2e2b..1e5064f 100644 --- a/include/private/media/AudioTrackShared.h +++ b/include/private/media/AudioTrackShared.h @@ -114,13 +114,7 @@ struct AudioTrackSharedStatic { mPosLoopQueue; }; - -struct AudioTrackPlaybackRate { - float mSpeed; - float mPitch; -}; - -typedef SingleStateQueue<AudioTrackPlaybackRate> AudioTrackPlaybackRateQueue; +typedef SingleStateQueue<AudioPlaybackRate> PlaybackRateQueue; // ---------------------------------------------------------------------------- @@ -168,7 +162,7 @@ private: uint32_t mSampleRate; // AudioTrack only: client's requested sample rate in Hz // or 0 == default. Write-only client, read-only server. - AudioTrackPlaybackRateQueue::Shared mPlaybackRateQueue; + PlaybackRateQueue::Shared mPlaybackRateQueue; // client write-only, server read-only uint16_t mSendLevel; // Fixed point U4.12 so 0x1000 means 1.0 @@ -345,10 +339,7 @@ public: mCblk->mSampleRate = sampleRate; } - void setPlaybackRate(float speed, float pitch) { - AudioTrackPlaybackRate playbackRate; - playbackRate.mSpeed = speed; - playbackRate.mPitch = pitch; + void setPlaybackRate(const AudioPlaybackRate& playbackRate) { mPlaybackRateMutator.push(playbackRate); } @@ -365,7 +356,7 @@ public: status_t waitStreamEndDone(const struct timespec *requested); private: - AudioTrackPlaybackRateQueue::Mutator mPlaybackRateMutator; + PlaybackRateQueue::Mutator mPlaybackRateMutator; }; class StaticAudioTrackClientProxy : public AudioTrackClientProxy { @@ -483,8 +474,7 @@ public: : ServerProxy(cblk, buffers, frameCount, frameSize, true /*isOut*/, clientInServer), mPlaybackRateObserver(&cblk->mPlaybackRateQueue) { mCblk->mSampleRate = sampleRate; - mPlaybackRate.mSpeed = AUDIO_TIMESTRETCH_SPEED_NORMAL; - mPlaybackRate.mPitch = AUDIO_TIMESTRETCH_PITCH_NORMAL; + mPlaybackRate = AUDIO_PLAYBACK_RATE_DEFAULT; } protected: virtual ~AudioTrackServerProxy() { } @@ -520,11 +510,11 @@ public: virtual size_t framesReleased() const { return mCblk->mServer; } // Return the playback speed and pitch read atomically. Not multi-thread safe on server side. - void getPlaybackRate(float *speed, float *pitch); + AudioPlaybackRate getPlaybackRate(); private: - AudioTrackPlaybackRate mPlaybackRate; // last observed playback rate - AudioTrackPlaybackRateQueue::Observer mPlaybackRateObserver; + AudioPlaybackRate mPlaybackRate; // last observed playback rate + PlaybackRateQueue::Observer mPlaybackRateObserver; }; class StaticAudioTrackServerProxy : public AudioTrackServerProxy { |