diff options
Diffstat (limited to 'include')
30 files changed, 564 insertions, 40 deletions
diff --git a/include/camera/CameraParameters.h b/include/camera/CameraParameters.h index ba33ffe..d85050d 100644 --- a/include/camera/CameraParameters.h +++ b/include/camera/CameraParameters.h @@ -19,6 +19,7 @@ #include <utils/KeyedVector.h> #include <utils/String8.h> +#include <camera/CameraParametersExtra.h> namespace android { @@ -554,6 +555,7 @@ public: static const char WHITE_BALANCE_CLOUDY_DAYLIGHT[]; static const char WHITE_BALANCE_TWILIGHT[]; static const char WHITE_BALANCE_SHADE[]; + static const char WHITE_BALANCE_MANUAL_CCT[]; // Values for effect settings. static const char EFFECT_NONE[]; @@ -677,12 +679,18 @@ public: // other modes. static const char FOCUS_MODE_CONTINUOUS_PICTURE[]; + static const char FOCUS_MODE_MANUAL_POSITION[]; + // Values for light special effects // Low-light enhancement mode static const char LIGHTFX_LOWLIGHT[]; // High-dynamic range mode static const char LIGHTFX_HDR[]; +#ifdef CAMERA_PARAMETERS_EXTRA_H +CAMERA_PARAMETERS_EXTRA_H +#endif + /** * Returns the the supported preview formats as an enum given in graphics.h * corrsponding to the format given in the input string or -1 if no such diff --git a/include/camera/CameraParametersExtra.h b/include/camera/CameraParametersExtra.h new file mode 100644 index 0000000..80a67cc --- /dev/null +++ b/include/camera/CameraParametersExtra.h @@ -0,0 +1,35 @@ +// Overload this file in your device specific config if you need +// to add extra camera parameters. +// A typical file would look like this: +/* + * Copyright (C) 2014 The CyanogenMod Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* +#define CAMERA_PARAMETERS_EXTRA_C \ +const char CameraParameters::KEY_SUPPORTED_BURST_NUM[] = "supported-burst-num"; \ +const char CameraParameters::KEY_BURST_NUM[] = "burst-num"; \ +const char CameraParameters::KEY_SUPPORTED_HDR_MODES[] = "supported-hdr-modes"; \ +const char CameraParameters::KEY_HDR_MODE[] = "hdr-mode"; \ +const char CameraParameters::HDR_MODE_OFF[] = "hdr-mode-off"; \ +const char CameraParameters::HDR_MODE_HDR[] = "hdr-mode-hdr"; + +#define CAMERA_PARAMETERS_EXTRA_H \ + static const char KEY_SUPPORTED_BURST_NUM[]; \ + static const char KEY_BURST_NUM[]; \ + static const char KEY_SUPPORTED_HDR_MODES[]; \ + static const char KEY_HDR_MODE[]; \ + static const char HDR_MODE_OFF[]; \ + static const char HDR_MODE_HDR[]; +*/ diff --git a/include/media/AudioParameter.h b/include/media/AudioParameter.h index 891bc4b..c769c4b 100644 --- a/include/media/AudioParameter.h +++ b/include/media/AudioParameter.h @@ -48,6 +48,7 @@ public: static const char * const keyFrameCount; static const char * const keyInputSource; static const char * const keyScreenState; + static const char * const keyDevShutdown; String8 toString(); diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h index e02f1b7..191802d 100644 --- a/include/media/AudioTrack.h +++ b/include/media/AudioTrack.h @@ -31,6 +31,7 @@ namespace android { struct audio_track_cblk_t; class AudioTrackClientProxy; class StaticAudioTrackClientProxy; +struct ExtendedMediaUtils; // ---------------------------------------------------------------------------- @@ -623,6 +624,7 @@ private: */ status_t obtainBuffer(Buffer* audioBuffer, const struct timespec *requested, struct timespec *elapsed = NULL, size_t *nonContig = NULL); + friend struct ExtendedMediaUtils; public: /* Public API for TRANSFER_OBTAIN mode. @@ -940,6 +942,8 @@ protected: // For Device Selection API // a value of AUDIO_PORT_HANDLE_NONE indicated default (AudioPolicyManager) routing. audio_port_handle_t mSelectedDeviceId; + bool mPlaybackRateSet; + bool mTrackOffloaded; private: class DeathNotifier : public IBinder::DeathRecipient { @@ -957,6 +961,7 @@ private: pid_t mClientPid; sp<AudioSystem::AudioDeviceCallback> mDeviceCallback; + friend struct ExtendedMediaUtils; }; class TimedAudioTrack : public AudioTrack diff --git a/include/media/IMediaPlayer.h b/include/media/IMediaPlayer.h index 0fd8933..5957535 100644 --- a/include/media/IMediaPlayer.h +++ b/include/media/IMediaPlayer.h @@ -109,6 +109,16 @@ public: virtual status_t getMetadata(bool update_only, bool apply_filter, Parcel *metadata) = 0; + + // Suspend the video player + // In other words, just release the audio decoder and the video decoder + // @return OK if the video player was suspended successfully + virtual status_t suspend() = 0; + + // Resume the video player + // Init the audio decoder and the video decoder + // @return OK if the video player was resumed successfully + virtual status_t resume() = 0; }; // ---------------------------------------------------------------------------- diff --git a/include/media/IMediaRecorder.h b/include/media/IMediaRecorder.h index 77ed5d3..7e6befd 100644 --- a/include/media/IMediaRecorder.h +++ b/include/media/IMediaRecorder.h @@ -58,6 +58,8 @@ public: virtual status_t release() = 0; virtual status_t setInputSurface(const sp<IGraphicBufferConsumer>& surface) = 0; virtual sp<IGraphicBufferProducer> querySurfaceMediaSource() = 0; + + virtual status_t pause() = 0; }; // ---------------------------------------------------------------------------- diff --git a/include/media/MediaPlayerInterface.h b/include/media/MediaPlayerInterface.h index de82554..4810b7e 100644 --- a/include/media/MediaPlayerInterface.h +++ b/include/media/MediaPlayerInterface.h @@ -46,12 +46,12 @@ class IGraphicBufferProducer; template<typename T> class SortedVector; enum player_type { - STAGEFRIGHT_PLAYER = 3, NU_PLAYER = 4, // Test players are available only in the 'test' and 'eng' builds. // The shared library with the test player is passed passed as an // argument to the 'test:' url in the setDataSource call. TEST_PLAYER = 5, + DASH_PLAYER = 6, }; @@ -267,6 +267,14 @@ public: return INVALID_OPERATION; } + virtual status_t suspend() { + return INVALID_OPERATION; + } + + virtual status_t resume() { + return INVALID_OPERATION; + } + private: friend class MediaPlayerService; diff --git a/include/media/MediaProfiles.h b/include/media/MediaProfiles.h index e02918f..a45dc58 100644..100755 --- a/include/media/MediaProfiles.h +++ b/include/media/MediaProfiles.h @@ -1,4 +1,6 @@ /* + ** Copyright (c) 2014, The Linux Foundation. All rights reserved. + ** Not a Contribution. ** ** Copyright 2010, The Android Open Source Project. ** @@ -56,6 +58,20 @@ enum camcorder_quality { CAMCORDER_QUALITY_HIGH_SPEED_1080P = 2004, CAMCORDER_QUALITY_HIGH_SPEED_2160P = 2005, CAMCORDER_QUALITY_HIGH_SPEED_LIST_END = 2005, + + CAMCORDER_QUALITY_VENDOR_START = 10000, + CAMCORDER_QUALITY_VGA = 10000, + CAMCORDER_QUALITY_4KDCI = 10001, + CAMCORDER_QUALITY_TIME_LAPSE_VGA = 10002, + CAMCORDER_QUALITY_TIME_LAPSE_4KDCI = 10003, + CAMCORDER_QUALITY_HIGH_SPEED_CIF = 10004, + CAMCORDER_QUALITY_HIGH_SPEED_VGA = 10005, + CAMCORDER_QUALITY_HIGH_SPEED_4KDCI = 10006, + CAMCORDER_QUALITY_QHD = 10007, + CAMCORDER_QUALITY_2k = 10008, + CAMCORDER_QUALITY_TIME_LAPSE_QHD = 10009, + CAMCORDER_QUALITY_TIME_LAPSE_2k = 10010, + CAMCORDER_QUALITY_VENDOR_END = 10010, }; enum video_decoder { @@ -126,6 +142,9 @@ public: * enc.vid.bps.max - max bit rate in bits per second * enc.vid.fps.min - min frame rate in frames per second * enc.vid.fps.max - max frame rate in frames per second + * enc.vid.hfr.width.max - max hfr video frame width + * enc.vid.hfr.height.max - max hfr video frame height + * enc.vid.hfr.mode.max - max hfr mode */ int getVideoEncoderParamByName(const char *name, video_encoder codec) const; @@ -264,12 +283,16 @@ private: int minBitRate, int maxBitRate, int minFrameWidth, int maxFrameWidth, int minFrameHeight, int maxFrameHeight, - int minFrameRate, int maxFrameRate) + int minFrameRate, int maxFrameRate, + int maxHFRFrameWidth, int maxHFRFrameHeight, + int maxHFRMode) : mCodec(codec), mMinBitRate(minBitRate), mMaxBitRate(maxBitRate), mMinFrameWidth(minFrameWidth), mMaxFrameWidth(maxFrameWidth), mMinFrameHeight(minFrameHeight), mMaxFrameHeight(maxFrameHeight), - mMinFrameRate(minFrameRate), mMaxFrameRate(maxFrameRate) {} + mMinFrameRate(minFrameRate), mMaxFrameRate(maxFrameRate), + mMaxHFRFrameWidth(maxHFRFrameWidth), mMaxHFRFrameHeight(maxHFRFrameHeight), + mMaxHFRMode(maxHFRMode) {} ~VideoEncoderCap() {} @@ -278,6 +301,8 @@ private: int mMinFrameWidth, mMaxFrameWidth; int mMinFrameHeight, mMaxFrameHeight; int mMinFrameRate, mMaxFrameRate; + int mMaxHFRFrameWidth, mMaxHFRFrameHeight; + int mMaxHFRMode; }; struct AudioEncoderCap { @@ -392,6 +417,8 @@ private: static VideoEncoderCap* createDefaultH263VideoEncoderCap(); static VideoEncoderCap* createDefaultM4vVideoEncoderCap(); static AudioEncoderCap* createDefaultAmrNBEncoderCap(); + static AudioEncoderCap* createDefaultAacEncoderCap(); + static AudioEncoderCap* createDefaultLpcmEncoderCap(); static int findTagForName(const NameToTagMap *map, size_t nMappings, const char *name); diff --git a/include/media/MediaRecorderBase.h b/include/media/MediaRecorderBase.h index d6cc4bb..4290563 100644 --- a/include/media/MediaRecorderBase.h +++ b/include/media/MediaRecorderBase.h @@ -60,13 +60,17 @@ struct MediaRecorderBase { virtual status_t setInputSurface(const sp<IGraphicBufferConsumer>& surface) = 0; virtual sp<IGraphicBufferProducer> querySurfaceMediaSource() const = 0; - protected: String16 mOpPackageName; private: MediaRecorderBase(const MediaRecorderBase &); MediaRecorderBase &operator=(const MediaRecorderBase &); + +public: + virtual status_t pause() = 0; + + }; } // namespace android diff --git a/include/media/Visualizer.h b/include/media/Visualizer.h index 186e018..f14977b 100644 --- a/include/media/Visualizer.h +++ b/include/media/Visualizer.h @@ -97,6 +97,7 @@ public: // and the capture format is according to flags (see callback_flags). status_t setCaptureCallBack(capture_cbk_t cbk, void* user, uint32_t flags, uint32_t rate, bool force = false); + void cancelCaptureCallBack(); // set the capture size capture size must be a power of two in the range // [VISUALIZER_CAPTURE_SIZE_MAX. VISUALIZER_CAPTURE_SIZE_MIN] diff --git a/include/media/mediaplayer.h b/include/media/mediaplayer.h index 3fe749c..3d4a6e2 100644 --- a/include/media/mediaplayer.h +++ b/include/media/mediaplayer.h @@ -53,7 +53,7 @@ enum media_event_type { MEDIA_ERROR = 100, MEDIA_INFO = 200, MEDIA_SUBTITLE_DATA = 201, - MEDIA_META_DATA = 202, + MEDIA_META_DATA = 202 }; // Generic error codes for the media player framework. Errors are fatal, the @@ -147,7 +147,8 @@ enum media_player_states { MEDIA_PLAYER_STARTED = 1 << 4, MEDIA_PLAYER_PAUSED = 1 << 5, MEDIA_PLAYER_STOPPED = 1 << 6, - MEDIA_PLAYER_PLAYBACK_COMPLETE = 1 << 7 + MEDIA_PLAYER_PLAYBACK_COMPLETE = 1 << 7, + MEDIA_PLAYER_SUSPENDED = 1 << 8 }; // Keep KEY_PARAMETER_* in sync with MediaPlayer.java. @@ -209,7 +210,7 @@ public: void died(); void disconnect(); - status_t setDataSource( + virtual status_t setDataSource( const sp<IMediaHTTPService> &httpService, const char *url, const KeyedVector<String8, String8> *headers); @@ -224,7 +225,7 @@ public: status_t prepareAsync(); status_t start(); status_t stop(); - status_t pause(); + virtual status_t pause(); bool isPlaying(); status_t setPlaybackSettings(const AudioPlaybackRate& rate); status_t getPlaybackSettings(AudioPlaybackRate* rate /* nonnull */); @@ -234,7 +235,7 @@ public: float* videoFps /* nonnull */); status_t getVideoWidth(int *w); status_t getVideoHeight(int *h); - status_t seekTo(int msec); + virtual status_t seekTo(int msec); status_t getCurrentPosition(int *msec); status_t getDuration(int *msec); status_t reset(); @@ -243,7 +244,7 @@ public: status_t setLooping(int loop); bool isLooping(); status_t setVolume(float leftVolume, float rightVolume); - void notify(int msg, int ext1, int ext2, const Parcel *obj = NULL); + virtual void notify(int msg, int ext1, int ext2, const Parcel *obj = NULL); 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); @@ -255,6 +256,8 @@ public: status_t getParameter(int key, Parcel* reply); status_t setRetransmitEndpoint(const char* addrString, uint16_t port); status_t setNextMediaPlayer(const sp<MediaPlayer>& player); + status_t suspend(); + status_t resume(); private: void clear_l(); @@ -289,6 +292,7 @@ private: float mSendLevel; struct sockaddr_in mRetransmitEndpoint; bool mRetransmitEndpointValid; + friend class QCMediaPlayer; }; }; // namespace android diff --git a/include/media/mediarecorder.h b/include/media/mediarecorder.h index 15ff82d..0cf1146 100644..100755 --- a/include/media/mediarecorder.h +++ b/include/media/mediarecorder.h @@ -1,4 +1,7 @@ /* + ** Copyright (c) 2014, The Linux Foundation. All rights reserved. + ** Not a Contribution. + ** ** Copyright (C) 2008 The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -74,6 +77,9 @@ enum output_format { /* VP8/VORBIS data in a WEBM container */ OUTPUT_FORMAT_WEBM = 9, + OUTPUT_FORMAT_QCP = 20, + OUTPUT_FORMAT_WAVE = 21, + OUTPUT_FORMAT_LIST_END // must be last - used to validate format type }; @@ -86,6 +92,10 @@ enum audio_encoder { AUDIO_ENCODER_AAC_ELD = 5, AUDIO_ENCODER_VORBIS = 6, + AUDIO_ENCODER_EVRC = 10, + AUDIO_ENCODER_QCELP = 11, + AUDIO_ENCODER_LPCM = 12, + AUDIO_ENCODER_LIST_END // must be the last - used to validate the audio encoder type }; @@ -96,7 +106,11 @@ enum video_encoder { VIDEO_ENCODER_MPEG_4_SP = 3, VIDEO_ENCODER_VP8 = 4, - VIDEO_ENCODER_LIST_END // must be the last - used to validate the video encoder type + VIDEO_ENCODER_LIST_END, // must be the last - used to validate the video encoder type + + VIDEO_ENCODER_LIST_VENDOR_START = 1000, + VIDEO_ENCODER_H265 = 1001, + VIDEO_ENCODER_LIST_VENDOR_END, }; /* @@ -120,6 +134,9 @@ enum media_recorder_states { // Recording is in progress. MEDIA_RECORDER_RECORDING = 1 << 4, + + // Recording is paused. + MEDIA_RECORDER_PAUSED = 1 << 5, }; // The "msg" code passed to the listener in notify. @@ -225,13 +242,13 @@ public: status_t setOutputFile(int fd, int64_t offset, int64_t length); status_t setVideoSize(int width, int height); status_t setVideoFrameRate(int frames_per_second); - status_t setParameters(const String8& params); + virtual status_t setParameters(const String8& params); status_t setListener(const sp<MediaRecorderListener>& listener); status_t setClientName(const String16& clientName); status_t prepare(); status_t getMaxAmplitude(int* max); - status_t start(); - status_t stop(); + virtual status_t start(); + virtual status_t stop(); status_t reset(); status_t init(); status_t close(); @@ -240,7 +257,7 @@ public: status_t setInputSurface(const sp<PersistentSurface>& surface); sp<IGraphicBufferProducer> querySurfaceMediaSourceFromMediaServer(); -private: +protected: void doCleanUp(); status_t doReset(); @@ -260,6 +277,9 @@ private: bool mIsOutputFileSet; Mutex mLock; Mutex mNotifyLock; + +public: + virtual status_t pause(); }; }; // namespace android diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h index 8b5b862..3c5a457 100644 --- a/include/media/stagefright/ACodec.h +++ b/include/media/stagefright/ACodec.h @@ -28,6 +28,8 @@ #include <media/stagefright/SkipCutBuffer.h> #include <OMX_Audio.h> +#include <system/audio.h> + #define TRACK_BUFFER_TIMING 0 namespace android { @@ -93,8 +95,11 @@ struct ACodec : public AHierarchicalStateMachine, public CodecBase { protected: virtual ~ACodec(); + virtual status_t setupCustomCodec( + status_t err, const char *mime, const sp<AMessage> &msg); + virtual status_t GetVideoCodingTypeFromMime( + const char *mime, OMX_VIDEO_CODINGTYPE *codingType); -private: struct BaseState; struct UninitializedState; struct LoadedState; @@ -152,6 +157,7 @@ private: }; struct BufferInfo { + BufferInfo() : mCustomData(-1) {} enum Status { OWNED_BY_US, OWNED_BY_COMPONENT, @@ -173,6 +179,7 @@ private: sp<GraphicBuffer> mGraphicBuffer; int mFenceFd; FrameRenderTracker::Info *mRenderInfo; + int mCustomData; // The following field and 4 methods are used for debugging only bool mIsReadFence; @@ -271,7 +278,7 @@ private: status_t setCyclicIntraMacroblockRefresh(const sp<AMessage> &msg, int32_t mode); status_t allocateBuffersOnPort(OMX_U32 portIndex); status_t freeBuffersOnPort(OMX_U32 portIndex); - status_t freeBuffer(OMX_U32 portIndex, size_t i); + virtual status_t freeBuffer(OMX_U32 portIndex, size_t i); status_t handleSetSurface(const sp<Surface> &surface); status_t setupNativeWindowSizeFormatAndUsage( @@ -284,6 +291,9 @@ private: status_t submitOutputMetadataBuffer(); void signalSubmitOutputMetadataBufferIfEOS_workaround(); status_t allocateOutputBuffersFromNativeWindow(); +#ifdef USE_SAMSUNG_COLORFORMAT + void setNativeWindowColorFormat(OMX_COLOR_FORMATTYPE &eNativeColorFormat); +#endif status_t cancelBufferToNativeWindow(BufferInfo *info); status_t freeOutputBuffersNotOwnedByComponent(); BufferInfo *dequeueBufferFromNativeWindow(); @@ -300,8 +310,8 @@ private: uint32_t portIndex, IOMX::buffer_id bufferID, ssize_t *index = NULL); - status_t setComponentRole(bool isEncoder, const char *mime); - status_t configureCodec(const char *mime, const sp<AMessage> &msg); + virtual status_t setComponentRole(bool isEncoder, const char *mime); + virtual status_t configureCodec(const char *mime, const sp<AMessage> &msg); status_t configureTunneledVideoPlayback(int32_t audioHwSync, const sp<ANativeWindow> &nativeWindow); @@ -314,10 +324,10 @@ private: status_t setSupportedOutputFormat(bool getLegacyFlexibleFormat); - status_t setupVideoDecoder( + virtual status_t setupVideoDecoder( const char *mime, const sp<AMessage> &msg, bool usingNativeBuffers); - status_t setupVideoEncoder( + virtual status_t setupVideoEncoder( const char *mime, const sp<AMessage> &msg); status_t setVideoFormatOnPort( @@ -340,9 +350,11 @@ private: int32_t maxOutputChannelCount, const drcParams_t& drc, int32_t pcmLimiterEnable); - status_t setupAC3Codec(bool encoder, int32_t numChannels, int32_t sampleRate); + status_t setupAC3Codec(bool encoder, int32_t numChannels, int32_t sampleRate, + int32_t bitsPerSample = 16); - status_t setupEAC3Codec(bool encoder, int32_t numChannels, int32_t sampleRate); + status_t setupEAC3Codec(bool encoder, int32_t numChannels, int32_t sampleRate, + int32_t bitsPerSample = 16); status_t selectAudioPortFormat( OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE desiredFormat); @@ -372,7 +384,7 @@ private: status_t configureBitrate( int32_t bitrate, OMX_VIDEO_CONTROLRATETYPE bitrateMode); - status_t setupErrorCorrectionParameters(); + virtual status_t setupErrorCorrectionParameters(); status_t initNativeWindow(); @@ -408,7 +420,7 @@ private: bool dropIncomplete = false, FrameRenderTracker::Info *until = NULL); void sendFormatChange(const sp<AMessage> &reply); - status_t getPortFormat(OMX_U32 portIndex, sp<AMessage> ¬ify); + virtual status_t getPortFormat(OMX_U32 portIndex, sp<AMessage> ¬ify); void signalError( OMX_ERRORTYPE error = OMX_ErrorUndefined, @@ -420,11 +432,40 @@ private: DescribeColorFormatParams &describeParams); status_t requestIDRFrame(); - status_t setParameters(const sp<AMessage> ¶ms); + virtual status_t setParameters(const sp<AMessage> ¶ms); // Send EOS on input stream. void onSignalEndOfInputStream(); + virtual void setBFrames(OMX_VIDEO_PARAM_MPEG4TYPE *mpeg4type) {} + virtual void setBFrames(OMX_VIDEO_PARAM_AVCTYPE *h264type, + const int32_t iFramesInterval, const int32_t frameRate) {} + + virtual status_t getVQZIPInfo(const sp<AMessage> &msg) { + return OK; + } + virtual bool canAllocateBuffer(OMX_U32 /* portIndex */) { + return false; + } + virtual void enableCustomAllocationMode(const sp<AMessage> &/* msg */) {} + virtual status_t allocateBuffer( + OMX_U32 portIndex, size_t bufSize, BufferInfo &info); + + virtual status_t setDSModeHint(sp<AMessage>& msg, + OMX_U32 flags, int64_t timeUs) { + return UNKNOWN_ERROR; + } + + virtual bool getDSModeHint(const sp<AMessage>& msg) { + return false; + } + + sp<IOMXObserver> createObserver(); + + status_t setupRawAudioFormatInternal( + OMX_U32 portIndex, int32_t sampleRate, int32_t numChannels, + int32_t bitsPerSample); + DISALLOW_EVIL_CONSTRUCTORS(ACodec); }; diff --git a/include/media/stagefright/AudioPlayer.h b/include/media/stagefright/AudioPlayer.h index e0cd965..edc9f25 100644 --- a/include/media/stagefright/AudioPlayer.h +++ b/include/media/stagefright/AudioPlayer.h @@ -103,6 +103,7 @@ private: int64_t mSeekTimeUs; bool mStarted; + bool mSourcePaused; bool mIsFirstBuffer; status_t mFirstBufferResult; @@ -115,6 +116,7 @@ private: bool mPlaying; int64_t mStartPosUs; const uint32_t mCreateFlags; + bool mPauseRequired; static void AudioCallback(int event, void *user, void *info); void AudioCallback(int event, void *info); diff --git a/include/media/stagefright/AudioSource.h b/include/media/stagefright/AudioSource.h index 3074910..699b1b4 100644 --- a/include/media/stagefright/AudioSource.h +++ b/include/media/stagefright/AudioSource.h @@ -58,9 +58,11 @@ struct AudioSource : public MediaSource, public MediaBufferObserver { protected: virtual ~AudioSource(); -private: +protected: enum { - kMaxBufferSize = 2048, + //calculated for max duration 80 msec with 48K sampling rate. + kMaxBufferSize = 30720, + // After the initial mute, we raise the volume linearly // over kAutoRampDurationUs. @@ -68,7 +70,7 @@ private: // This is the initial mute duration to suppress // the video recording signal tone - kAutoRampStartUs = 0, + kAutoRampStartUs = 500000, }; Mutex mLock; @@ -90,6 +92,8 @@ private: int64_t mNumFramesReceived; int64_t mNumClientOwnedBuffers; + bool mRecPaused; + List<MediaBuffer * > mBuffersReceived; void trackMaxAmplitude(int16_t *data, int nSamples); @@ -100,13 +104,17 @@ private: int32_t startFrame, int32_t rampDurationFrames, uint8_t *data, size_t bytes); - void queueInputBuffer_l(MediaBuffer *buffer, int64_t timeUs); + virtual void queueInputBuffer_l(MediaBuffer *buffer, int64_t timeUs); void releaseQueuedFrames_l(); void waitOutstandingEncodingFrames_l(); - status_t reset(); + virtual status_t reset(); AudioSource(const AudioSource &); AudioSource &operator=(const AudioSource &); + +public: + virtual status_t pause(); + }; } // namespace android diff --git a/include/media/stagefright/CameraSource.h b/include/media/stagefright/CameraSource.h index 069e897..70149cc 100644 --- a/include/media/stagefright/CameraSource.h +++ b/include/media/stagefright/CameraSource.h @@ -92,6 +92,8 @@ public: virtual status_t read( MediaBuffer **buffer, const ReadOptions *options = NULL); + virtual status_t pause(); + /** * Check whether a CameraSource object is properly initialized. * Must call this method before stop(). @@ -189,7 +191,7 @@ protected: void releaseCamera(); -private: +protected: friend struct CameraSourceListener; Mutex mLock; @@ -206,6 +208,11 @@ private: bool mCollectStats; bool mIsMetaDataStoredInVideoBuffers; + int64_t mPauseAdjTimeUs; + int64_t mPauseStartTimeUs; + int64_t mPauseEndTimeUs; + bool mRecPause; + void releaseQueuedFrames(); void releaseOneRecordingFrame(const sp<IMemory>& frame); diff --git a/include/media/stagefright/CameraSourceTimeLapse.h b/include/media/stagefright/CameraSourceTimeLapse.h index 34213be..eeb453f 100644 --- a/include/media/stagefright/CameraSourceTimeLapse.h +++ b/include/media/stagefright/CameraSourceTimeLapse.h @@ -20,6 +20,7 @@ #include <pthread.h> +#include <media/stagefright/CameraSource.h> #include <utils/RefBase.h> #include <utils/threads.h> #include <utils/String16.h> @@ -56,7 +57,7 @@ public: // returning quickly. void startQuickReadReturns(); -private: +protected: // size of the encoded video. int32_t mVideoWidth; int32_t mVideoHeight; @@ -66,6 +67,9 @@ private: // Real timestamp of the last encoded time lapse frame int64_t mLastTimeLapseFrameRealTimestampUs; + // Adjusted continuous timestamp based on recording fps + // of the last encoded time lapse frame + int64_t mLastTimeLapseFrameTimeStampUs; // Variable set in dataCallbackTimestamp() to help skipCurrentFrame() // to know if current frame needs to be skipped. @@ -152,7 +156,7 @@ private: // the frame needs to be encoded, it returns false and also modifies // the time stamp to be one frame time ahead of the last encoded // frame's time stamp. - bool skipFrameAndModifyTimeStamp(int64_t *timestampUs); + virtual bool skipFrameAndModifyTimeStamp(int64_t *timestampUs); // Wrapper to enter threadTimeLapseEntry() static void *ThreadTimeLapseWrapper(void *me); diff --git a/include/media/stagefright/DataSource.h b/include/media/stagefright/DataSource.h index dcde36f..de5ddd3 100644 --- a/include/media/stagefright/DataSource.h +++ b/include/media/stagefright/DataSource.h @@ -51,7 +51,8 @@ public: const char *uri, const KeyedVector<String8, String8> *headers = NULL, String8 *contentType = NULL, - HTTPBase *httpSource = NULL); + HTTPBase *httpSource = NULL, + bool useExtendedCache = false); static sp<DataSource> CreateMediaHTTP(const sp<IMediaHTTPService> &httpService); static sp<DataSource> CreateFromIDataSource(const sp<IDataSource> &source); @@ -113,9 +114,11 @@ protected: private: static Mutex gSnifferMutex; static List<SnifferFunc> gSniffers; + static List<SnifferFunc> gExtraSniffers; static bool gSniffersRegistered; static void RegisterSniffer_l(SnifferFunc func); + static void RegisterSnifferPlugin(); DataSource(const DataSource &); DataSource &operator=(const DataSource &); diff --git a/include/media/stagefright/ExtendedMediaDefs.h b/include/media/stagefright/ExtendedMediaDefs.h new file mode 100644 index 0000000..18b5e9a --- /dev/null +++ b/include/media/stagefright/ExtendedMediaDefs.h @@ -0,0 +1,69 @@ +/*Copyright (c) 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _EXTENDED_MEDIA_DEFS_H_ +#define _EXTENDED_MEDIA_DEFS_H_ + +namespace android { + +extern const char *MEDIA_MIMETYPE_AUDIO_EVRC; +extern const char *MEDIA_MIMETYPE_VIDEO_WMV; +extern const char *MEDIA_MIMETYPE_VIDEO_WMV_VC1; +extern const char *MEDIA_MIMETYPE_AUDIO_WMA; +extern const char *MEDIA_MIMETYPE_AUDIO_WMA_PRO; +extern const char *MEDIA_MIMETYPE_AUDIO_WMA_LOSSLESS; +extern const char *MEDIA_MIMETYPE_CONTAINER_ASF; +extern const char *MEDIA_MIMETYPE_VIDEO_DIVX; +extern const char *MEDIA_MIMETYPE_CONTAINER_AAC; +extern const char *MEDIA_MIMETYPE_CONTAINER_QCP; +extern const char *MEDIA_MIMETYPE_VIDEO_DIVX311; +extern const char *MEDIA_MIMETYPE_VIDEO_DIVX4; +extern const char *MEDIA_MIMETYPE_CONTAINER_MPEG2; +extern const char *MEDIA_MIMETYPE_CONTAINER_3G2; +extern const char *MEDIA_MIMETYPE_AUDIO_DTS; +extern const char *MEDIA_MIMETYPE_AUDIO_DTS_LBR; +extern const char *MEDIA_MIMETYPE_AUDIO_AMR_WB_PLUS; +extern const char *MEDIA_MIMETYPE_AUDIO_AIFF; +extern const char *MEDIA_MIMETYPE_AUDIO_ALAC; +extern const char *MEDIA_MIMETYPE_AUDIO_APE; +extern const char *MEDIA_MIMETYPE_CONTAINER_QCAMR_NB; +extern const char *MEDIA_MIMETYPE_CONTAINER_QCAMR_WB; +extern const char *MEDIA_MIMETYPE_CONTAINER_QCMPEG; +extern const char *MEDIA_MIMETYPE_CONTAINER_QCWAV; +extern const char *MEDIA_MIMETYPE_CONTAINER_QCMPEG2TS; +extern const char *MEDIA_MIMETYPE_CONTAINER_QCMPEG2PS; +extern const char *MEDIA_MIMETYPE_CONTAINER_QCMPEG4; +extern const char *MEDIA_MIMETYPE_CONTAINER_QCMATROSKA; +extern const char *MEDIA_MIMETYPE_CONTAINER_QCOGG; +extern const char *MEDIA_MIMETYPE_CONTAINER_QCFLV; +extern const char *MEDIA_MIMETYPE_VIDEO_VPX; +extern const char *MEDIA_MIMETYPE_CONTAINER_QTIFLAC; +extern const char *MEDIA_MIMETYPE_VIDEO_MPEG4_DP; + +} // namespace android + +#endif // _EXTENDED_MEDIA_DEFS_H_ diff --git a/include/media/stagefright/FFMPEGSoftCodec.h b/include/media/stagefright/FFMPEGSoftCodec.h new file mode 100644 index 0000000..79ea229 --- /dev/null +++ b/include/media/stagefright/FFMPEGSoftCodec.h @@ -0,0 +1,140 @@ +/* + * Copyright (C) 2014 The CyanogenMod Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef FFMPEG_SOFT_CODEC_H_ +#define FFMPEG_SOFT_CODEC_H_ + +#include <media/IOMX.h> +#include <media/MediaCodecInfo.h> + +#include <media/stagefright/foundation/AMessage.h> +#include <media/stagefright/foundation/AString.h> + +#include <media/stagefright/MetaData.h> + +#include <OMX_Audio.h> +#include <OMX_Video.h> + +namespace android { + +struct FFMPEGSoftCodec { + + enum { + kPortIndexInput = 0, + kPortIndexOutput = 1 + }; + + static void convertMessageToMetaDataFF( + const sp<AMessage> &msg, sp<MetaData> &meta); + + static void convertMetaDataToMessageFF( + const sp<MetaData> &meta, sp<AMessage> *format); + + static const char* overrideComponentName( + uint32_t quirks, const sp<MetaData> &meta, + const char *mime, bool isEncoder); + + static void overrideComponentName( + uint32_t quirks, const sp<AMessage> &msg, + AString* componentName, AString* mime, + int32_t isEncoder); + + static status_t setSupportedRole( + const sp<IOMX> &omx, IOMX::node_id node, + bool isEncoder, const char *mime); + + static status_t setAudioFormat( + const sp<AMessage> &msg, const char* mime, + sp<IOMX> OMXhandle, IOMX::node_id nodeID); + + static status_t setVideoFormat( + const sp<AMessage> &msg, const char* mime, + sp<IOMX> OMXhandle,IOMX::node_id nodeID, + bool isEncoder, OMX_VIDEO_CODINGTYPE *compressionFormat, + const char* componentName); + + static status_t getAudioPortFormat( + OMX_U32 portIndex, int coding, + sp<AMessage> ¬ify, sp<IOMX> OMXhandle, IOMX::node_id nodeID); + + static status_t getVideoPortFormat( + OMX_U32 portIndex, int coding, + sp<AMessage> ¬ify, sp<IOMX> OMXhandle, IOMX::node_id nodeID); + +private: + static const char* getMsgKey(int key); + + static status_t setWMVFormat( + const sp<AMessage> &msg, sp<IOMX> OMXhandle, + IOMX::node_id nodeID); + + static status_t setRVFormat( + const sp<AMessage> &msg, sp<IOMX> OMXhandle, + IOMX::node_id nodeID); + + static status_t setFFmpegVideoFormat( + const sp<AMessage> &msg, sp<IOMX> OMXhandle, + IOMX::node_id nodeID); + + static status_t setRawAudioFormat( + const sp<AMessage> &msg, sp<IOMX> OMXhandle, + IOMX::node_id nodeID); + + static status_t setWMAFormat( + const sp<AMessage> &msg, sp<IOMX> OMXhandle, + IOMX::node_id nodeID); + + static status_t setVORBISFormat( + const sp<AMessage> &msg, sp<IOMX> OMXhandle, + IOMX::node_id nodeID); + + static status_t setRAFormat( + const sp<AMessage> &msg, sp<IOMX> OMXhandle, + IOMX::node_id nodeID); + + static status_t setFLACFormat( + const sp<AMessage> &msg, sp<IOMX> OMXhandle, + IOMX::node_id nodeID); + + static status_t setMP2Format( + const sp<AMessage> &msg, sp<IOMX> OMXhandle, + IOMX::node_id nodeID); + + static status_t setAC3Format( + const sp<AMessage> &msg, sp<IOMX> OMXhandle, + IOMX::node_id nodeID); + + static status_t setAPEFormat( + const sp<AMessage> &msg, sp<IOMX> OMXhandle, + IOMX::node_id nodeID); + + static status_t setDTSFormat( + const sp<AMessage> &msg, sp<IOMX> OMXhandle, + IOMX::node_id nodeID); + + static status_t setFFmpegAudioFormat( + const sp<AMessage> &msg, sp<IOMX> OMXhandle, + IOMX::node_id nodeID); + +#ifdef QCOM_HARDWARE + static status_t setQCDIVXFormat( + const sp<AMessage> &msg, const char* mime, + sp<IOMX> OMXhandle, IOMX::node_id nodeID, int port_index); +#endif + +}; + +} +#endif diff --git a/include/media/stagefright/FileSource.h b/include/media/stagefright/FileSource.h index a981d1c..f4f874f 100644 --- a/include/media/stagefright/FileSource.h +++ b/include/media/stagefright/FileSource.h @@ -43,11 +43,16 @@ public: virtual void getDrmInfo(sp<DecryptHandle> &handle, DrmManagerClient **client); + virtual String8 getUri() { + return mUri; + } + protected: virtual ~FileSource(); private: int mFd; + String8 mUri; int64_t mOffset; int64_t mLength; Mutex mLock; @@ -56,10 +61,11 @@ private: sp<DecryptHandle> mDecryptHandle; DrmManagerClient *mDrmManagerClient; int64_t mDrmBufOffset; - size_t mDrmBufSize; + ssize_t mDrmBufSize; unsigned char *mDrmBuf; ssize_t readAtDRM(off64_t offset, void *data, size_t size); + void fetchUriFromFd(int fd); FileSource(const FileSource &); FileSource &operator=(const FileSource &); diff --git a/include/media/stagefright/MPEG4Writer.h b/include/media/stagefright/MPEG4Writer.h index a195fe8..055c079 100644 --- a/include/media/stagefright/MPEG4Writer.h +++ b/include/media/stagefright/MPEG4Writer.h @@ -108,6 +108,8 @@ private: sp<AMessage> mMetaKeys; + bool mIsVideoHEVC; + void setStartTimestampUs(int64_t timeUs); int64_t getStartTimestampUs(); // Not const status_t startTracks(MetaData *params); @@ -181,6 +183,9 @@ private: // By default, real time recording is on. bool isRealTimeRecording() const; + // To use 3gp4 box for clips with AMR audio + bool mIsAudioAMR; + void lock(); void unlock(); diff --git a/include/media/stagefright/MediaCodec.h b/include/media/stagefright/MediaCodec.h index cdfa159..e2588a4 100644 --- a/include/media/stagefright/MediaCodec.h +++ b/include/media/stagefright/MediaCodec.h @@ -51,6 +51,8 @@ struct MediaCodec : public AHandler { BUFFER_FLAG_SYNCFRAME = 1, BUFFER_FLAG_CODECCONFIG = 2, BUFFER_FLAG_EOS = 4, + BUFFER_FLAG_EXTRADATA = 0x1000, + BUFFER_FLAG_DATACORRUPT = 0x2000, }; enum { diff --git a/include/media/stagefright/MediaCodecSource.h b/include/media/stagefright/MediaCodecSource.h index 71f58a9..d41d87b 100644 --- a/include/media/stagefright/MediaCodecSource.h +++ b/include/media/stagefright/MediaCodecSource.h @@ -28,7 +28,7 @@ class AMessage; struct AReplyToken; class IGraphicBufferProducer; class IGraphicBufferConsumer; -class MediaCodec; +struct MediaCodec; class MetaData; struct MediaCodecSource : public MediaSource, diff --git a/include/media/stagefright/MediaDefs.h b/include/media/stagefright/MediaDefs.h index 21eb04a..ffbd20c 100644 --- a/include/media/stagefright/MediaDefs.h +++ b/include/media/stagefright/MediaDefs.h @@ -66,6 +66,43 @@ extern const char *MEDIA_MIMETYPE_TEXT_VTT; extern const char *MEDIA_MIMETYPE_TEXT_CEA_608; extern const char *MEDIA_MIMETYPE_DATA_TIMED_ID3; +extern const char *MEDIA_MIMETYPE_AUDIO_EAC3_JOC; +extern const char *MEDIA_MIMETYPE_AUDIO_EAC3; + +extern const char *MEDIA_MIMETYPE_VIDEO_FLV1; +extern const char *MEDIA_MIMETYPE_VIDEO_MJPEG; +extern const char *MEDIA_MIMETYPE_VIDEO_RV; +extern const char *MEDIA_MIMETYPE_VIDEO_VC1; +extern const char *MEDIA_MIMETYPE_VIDEO_WMV; +extern const char *MEDIA_MIMETYPE_VIDEO_HEVC; +extern const char *MEDIA_MIMETYPE_VIDEO_FFMPEG; + +extern const char *MEDIA_MIMETYPE_AUDIO_AC3; +extern const char *MEDIA_MIMETYPE_AUDIO_PCM; +extern const char *MEDIA_MIMETYPE_AUDIO_RA; +extern const char *MEDIA_MIMETYPE_AUDIO_WMA; +extern const char *MEDIA_MIMETYPE_AUDIO_FFMPEG; + +extern const char *MEDIA_MIMETYPE_CONTAINER_APE; +extern const char *MEDIA_MIMETYPE_CONTAINER_DIVX; +extern const char *MEDIA_MIMETYPE_CONTAINER_DTS; +extern const char *MEDIA_MIMETYPE_CONTAINER_FLAC; +extern const char *MEDIA_MIMETYPE_CONTAINER_FLV; +extern const char *MEDIA_MIMETYPE_CONTAINER_MOV; +extern const char *MEDIA_MIMETYPE_CONTAINER_MP2; +extern const char *MEDIA_MIMETYPE_CONTAINER_MPG; +extern const char *MEDIA_MIMETYPE_CONTAINER_RA; +extern const char *MEDIA_MIMETYPE_CONTAINER_RM; +extern const char *MEDIA_MIMETYPE_CONTAINER_TS; +extern const char *MEDIA_MIMETYPE_CONTAINER_WEBM; +extern const char *MEDIA_MIMETYPE_CONTAINER_VC1; +extern const char *MEDIA_MIMETYPE_CONTAINER_HEVC; +extern const char *MEDIA_MIMETYPE_CONTAINER_WMA; +extern const char *MEDIA_MIMETYPE_CONTAINER_WMV; +extern const char *MEDIA_MIMETYPE_CONTAINER_FFMPEG; + } // namespace android +#include <media/stagefright/ExtendedMediaDefs.h> + #endif // MEDIA_DEFS_H_ diff --git a/include/media/stagefright/MediaExtractor.h b/include/media/stagefright/MediaExtractor.h index 183933a..2f2057f 100644 --- a/include/media/stagefright/MediaExtractor.h +++ b/include/media/stagefright/MediaExtractor.h @@ -19,17 +19,30 @@ #define MEDIA_EXTRACTOR_H_ #include <utils/RefBase.h> +#include <media/stagefright/DataSource.h> namespace android { -class DataSource; class MediaSource; class MetaData; class MediaExtractor : public RefBase { public: + typedef MediaExtractor *(*CreateFunc)(const sp<DataSource> &source, + const char *mime, const sp<AMessage> &meta); + + struct Plugin { + DataSource::SnifferFunc sniff; + CreateFunc create; + }; + + static Plugin *getPlugin() { + return &sPlugin; + } + static sp<MediaExtractor> Create( - const sp<DataSource> &source, const char *mime = NULL); + const sp<DataSource> &source, const char *mime = NULL, + const uint32_t flags = 0); virtual size_t countTracks() = 0; virtual sp<MediaSource> getTrack(size_t index) = 0; @@ -67,6 +80,7 @@ public: } virtual void setUID(uid_t uid) { } + virtual void setExtraFlags(uint32_t flag) {} protected: MediaExtractor() : mIsDrm(false) {} @@ -74,6 +88,7 @@ protected: private: bool mIsDrm; + static Plugin sPlugin; MediaExtractor(const MediaExtractor &); MediaExtractor &operator=(const MediaExtractor &); diff --git a/include/media/stagefright/MediaHTTP.h b/include/media/stagefright/MediaHTTP.h index 006d8d8..88683bd 100644 --- a/include/media/stagefright/MediaHTTP.h +++ b/include/media/stagefright/MediaHTTP.h @@ -54,7 +54,7 @@ protected: virtual String8 getUri(); virtual String8 getMIMEType() const; -private: +protected: status_t mInitCheck; sp<IMediaHTTPConnection> mHTTPConnection; diff --git a/include/media/stagefright/MetaData.h b/include/media/stagefright/MetaData.h index 8d4e15a..0dd5995 100644 --- a/include/media/stagefright/MetaData.h +++ b/include/media/stagefright/MetaData.h @@ -50,6 +50,10 @@ enum { kKeySampleRate = 'srte', // int32_t (audio sampling rate Hz) kKeyFrameRate = 'frmR', // int32_t (video frame rate fps) kKeyBitRate = 'brte', // int32_t (bps) + kKeyCodecId = 'cdid', // int32_t + kKeyBitsPerSample = 'sbit', // int32_t (DUPE of kKeySampleBits) + kKeyCodedSampleBits = 'cosb', // int32_t + kKeySampleFormat = 'sfmt', // int32_t kKeyESDS = 'esds', // raw data kKeyAACProfile = 'aacp', // int32_t kKeyAVCC = 'avcc', // raw data @@ -131,6 +135,23 @@ enum { kKeyIsUnreadable = 'unre', // bool (int32_t) + kKeyRawCodecSpecificData = 'rcsd', // raw data - added to support mmParser + kKeyDivXVersion = 'DivX', // int32_t + kKeyDivXDrm = 'QDrm', // void * + kKeyWMAEncodeOpt = 'eopt', // int32_t + kKeyWMABlockAlign = 'blka', // int32_t + kKeyWMAVersion = 'wmav', // int32_t + kKeyWMAAdvEncOpt1 = 'ade1', // int16_t + kKeyWMAAdvEncOpt2 = 'ade2', // int32_t + kKeyWMAFormatTag = 'fmtt', // int64_t + kKeyWMABitspersample = 'bsps', // int64_t + kKeyWMAVirPktSize = 'vpks', // int64_t + kKeyWMVProfile = 'wmvp', // int32_t + + kKeyWMVVersion = 'wmvv', // int32_t + kKeyRVVersion = '#rvv', // int32_t + kKeyBlockAlign = 'ablk', // int32_t , should be different from kKeyWMABlockAlign + // An indication that a video buffer has been rendered. kKeyRendered = 'rend', // bool (int32_t) @@ -181,6 +202,9 @@ enum { // H264 supplemental enhancement information offsets/sizes kKeySEI = 'sei ', // raw data + + kKeyPCMFormat = 'pfmt', + kKeyArbitraryMode = 'ArbM', }; enum { @@ -190,6 +214,32 @@ enum { kTypeD263 = 'd263', }; +enum { + kTypeDivXVer_3_11, + kTypeDivXVer_4, + kTypeDivXVer_5, + kTypeDivXVer_6, +}; + +enum { + kTypeWMA, + kTypeWMAPro, + kTypeWMALossLess, +}; + +enum { + kTypeWMVVer_7, // WMV1 + kTypeWMVVer_8, // WMV2 + kTypeWMVVer_9, // WMV3 +}; + +// http://en.wikipedia.org/wiki/RealVideo +enum { + kTypeRVVer_G2, // rv20: RealVideo G2 + kTypeRVVer_8, // rv30: RealVideo 8 + kTypeRVVer_9, // rv40: RealVideo 9 +}; + class MetaData : public RefBase { public: MetaData(); diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h index 7fabcb3..ea534e0 100644 --- a/include/media/stagefright/OMXCodec.h +++ b/include/media/stagefright/OMXCodec.h @@ -139,6 +139,9 @@ private: EXECUTING_TO_IDLE, IDLE_TO_LOADED, RECONFIGURING, + PAUSING, + FLUSHING, + PAUSED, ERROR }; @@ -348,6 +351,7 @@ private: status_t waitForBufferFilled_l(); + status_t resumeLocked(bool drainInputBuf); int64_t getDecodingTimeUs(); status_t parseHEVCCodecSpecificData( diff --git a/include/media/stagefright/Utils.h b/include/media/stagefright/Utils.h index 5e9d7d4..847ea36 100644 --- a/include/media/stagefright/Utils.h +++ b/include/media/stagefright/Utils.h @@ -85,6 +85,12 @@ void writeToAMessage(sp<AMessage> msg, const AVSyncSettings &sync, float videoFp void readFromAMessage( const sp<AMessage> &msg, AVSyncSettings *sync /* nonnull */, float *videoFps /* nonnull */); +audio_format_t getPCMFormat(const sp<AMessage> &format); + +void updateVideoTrackInfoFromESDS_MPEG4Video(sp<MetaData> meta); +bool checkDPFromVOLHeader(const uint8_t *ptr, size_t size); +bool checkDPFromCodecSpecificData(const uint8_t *ptr, size_t size); + } // namespace android #endif // UTILS_H_ |