diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/camera/ICameraServiceProxy.h | 52 | ||||
| -rw-r--r-- | include/camera/camera2/ICameraDeviceUser.h | 2 | ||||
| -rw-r--r-- | include/media/AudioSystem.h | 3 | ||||
| -rw-r--r-- | include/media/AudioTrack.h | 45 | ||||
| -rw-r--r-- | include/media/IAudioFlinger.h | 3 | ||||
| -rw-r--r-- | include/media/IOMX.h | 58 | ||||
| -rw-r--r-- | include/media/MediaPlayerInterface.h | 4 | ||||
| -rw-r--r-- | include/media/MediaProfiles.h | 79 | ||||
| -rw-r--r-- | include/media/stagefright/ACodec.h | 38 | ||||
| -rw-r--r-- | include/media/stagefright/CameraSource.h | 4 | ||||
| -rw-r--r-- | include/media/stagefright/MediaCodec.h | 2 | ||||
| -rw-r--r-- | include/media/stagefright/MediaCodecList.h | 7 | ||||
| -rw-r--r-- | include/media/stagefright/MediaDefs.h | 2 | ||||
| -rw-r--r-- | include/media/stagefright/foundation/ADebug.h | 25 | 
14 files changed, 213 insertions, 111 deletions
diff --git a/include/camera/ICameraServiceProxy.h b/include/camera/ICameraServiceProxy.h new file mode 100644 index 0000000..12a555f --- /dev/null +++ b/include/camera/ICameraServiceProxy.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 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_HARDWARE_ICAMERASERVICEPROXY_H +#define ANDROID_HARDWARE_ICAMERASERVICEPROXY_H + +#include <utils/RefBase.h> +#include <binder/IInterface.h> +#include <binder/Parcel.h> + +namespace android { + +class ICameraServiceProxy : public IInterface { +public: +    enum { +        PING_FOR_USER_UPDATE = IBinder::FIRST_CALL_TRANSACTION, +    }; + +    DECLARE_META_INTERFACE(CameraServiceProxy); + +    virtual void pingForUserUpdate() = 0; +}; + +class BnCameraServiceProxy: public BnInterface<ICameraServiceProxy> +{ +public: +    virtual status_t    onTransact( uint32_t code, +                                    const Parcel& data, +                                    Parcel* reply, +                                    uint32_t flags = 0); +}; + + + +}; // namespace android + +#endif // ANDROID_HARDWARE_ICAMERASERVICEPROXY_H + + diff --git a/include/camera/camera2/ICameraDeviceUser.h b/include/camera/camera2/ICameraDeviceUser.h index 619b161..b3dd140 100644 --- a/include/camera/camera2/ICameraDeviceUser.h +++ b/include/camera/camera2/ICameraDeviceUser.h @@ -97,7 +97,7 @@ public:       * must be called before any requests can be submitted.       * <p>       */ -    virtual status_t        endConfigure() = 0; +    virtual status_t        endConfigure(bool isConstrainedHighSpeed = false) = 0;      virtual status_t        deleteStream(int streamId) = 0; diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h index 3241e9c..26cffa6 100644 --- a/include/media/AudioSystem.h +++ b/include/media/AudioSystem.h @@ -158,6 +158,9 @@ public:      // or no HW sync source is used.      static audio_hw_sync_t getAudioHwSyncForSession(audio_session_t sessionId); +    // Indicate JAVA services are ready (scheduling, power management ...) +    static status_t systemReady(); +      // Events used to synchronize actions between audio sessions.      // For instance SYNC_EVENT_PRESENTATION_COMPLETE can be used to delay recording start until      // playback is complete on another audio session. diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h index 458f4b4..c0bc516 100644 --- a/include/media/AudioTrack.h +++ b/include/media/AudioTrack.h @@ -43,25 +43,35 @@ public:       */      enum event_type {          EVENT_MORE_DATA = 0,        // Request to write more data to buffer. +                                    // This event only occurs for TRANSFER_CALLBACK.                                      // If this event is delivered but the callback handler -                                    // does not want to write more data, the handler must explicitly +                                    // does not want to write more data, the handler must                                      // ignore the event by setting frameCount to zero. -        EVENT_UNDERRUN = 1,         // Buffer underrun occurred. +                                    // This might occur, for example, if the application is +                                    // waiting for source data or is at the end of stream. +                                    // +                                    // For data filling, it is preferred that the callback +                                    // does not block and instead returns a short count on +                                    // the amount of data actually delivered +                                    // (or 0, if no data is currently available). +        EVENT_UNDERRUN = 1,         // Buffer underrun occurred. This will not occur for +                                    // static tracks.          EVENT_LOOP_END = 2,         // Sample loop end was reached; playback restarted from -                                    // loop start if loop count was not 0. +                                    // loop start if loop count was not 0 for a static track.          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. -                                    // Not currently used by android.media.AudioTrack. +        EVENT_BUFFER_END = 5,       // Playback has completed for a static track.          EVENT_NEW_IAUDIOTRACK = 6,  // IAudioTrack was re-created, either due to re-routing and                                      // voluntary invalidation by mediaserver, or mediaserver crash.          EVENT_STREAM_END = 7,       // Sent after all the buffers queued in AF and HW are played -                                    // back (after stop is called) +                                    // back (after stop is called) for an offloaded track. +#if 0   // FIXME not yet implemented          EVENT_NEW_TIMESTAMP = 8,    // Delivered periodically and when there's a significant change                                      // in the mapping from frame position to presentation time.                                      // See AudioTimestamp for the information included with event. +#endif      };      /* Client should declare a Buffer and pass the address to obtainBuffer() @@ -183,6 +193,10 @@ public:       * pid:                Process ID of the app which initially requested this AudioTrack       *                     for power management tracking, or -1 for current process ID.       * pAttributes:        If not NULL, supersedes streamType for use case selection. +     * doNotReconnect:     If set to true, AudioTrack won't automatically recreate the IAudioTrack +                           binder to AudioFlinger. +                           It will return an error instead.  The application will recreate +                           the track based on offloading or different channel configuration, etc.       * threadCanCallJava:  Not present in parameter list, and so is fixed at false.       */ @@ -200,7 +214,8 @@ public:                                      const audio_offload_info_t *offloadInfo = NULL,                                      int uid = -1,                                      pid_t pid = -1, -                                    const audio_attributes_t* pAttributes = NULL); +                                    const audio_attributes_t* pAttributes = NULL, +                                    bool doNotReconnect = false);      /* Creates an audio track and registers it with AudioFlinger.       * With this constructor, the track is configured for static buffer mode. @@ -228,7 +243,8 @@ public:                                      const audio_offload_info_t *offloadInfo = NULL,                                      int uid = -1,                                      pid_t pid = -1, -                                    const audio_attributes_t* pAttributes = NULL); +                                    const audio_attributes_t* pAttributes = NULL, +                                    bool doNotReconnect = false);      /* Terminates the AudioTrack and unregisters it from AudioFlinger.       * Also destroys all resources associated with the AudioTrack. @@ -272,7 +288,8 @@ public:                              const audio_offload_info_t *offloadInfo = NULL,                              int uid = -1,                              pid_t pid = -1, -                            const audio_attributes_t* pAttributes = NULL); +                            const audio_attributes_t* pAttributes = NULL, +                            bool doNotReconnect = false);      /* Result of constructing the AudioTrack. This must be checked for successful initialization       * before using any AudioTrack API (except for set()), because using @@ -792,6 +809,13 @@ protected:      size_t                  mReqFrameCount;         // frame count to request the first or next time                                                      // a new IAudioTrack is needed, non-decreasing +    // The following AudioFlinger server-side values are cached in createAudioTrack_l(). +    // These values can be used for informational purposes until the track is invalidated, +    // whereupon restoreTrack_l() calls createTrack_l() to update the values. +    uint32_t                mAfLatency;             // AudioFlinger latency in ms +    size_t                  mAfFrameCount;          // AudioFlinger frame count +    uint32_t                mAfSampleRate;          // AudioFlinger sample rate +      // constant after constructor or set()      audio_format_t          mFormat;                // as requested by client, not forced to 16-bit      audio_stream_type_t     mStreamType;            // mStreamType == AUDIO_STREAM_DEFAULT implies @@ -870,6 +894,7 @@ protected:                                                      // only used for offloaded and direct tracks.      bool                    mPreviousTimestampValid;// true if mPreviousTimestamp is valid +    bool                    mTimestampStartupGlitchReported; // reduce log spam      bool                    mRetrogradeMotionReported; // reduce log spam      AudioTimestamp          mPreviousTimestamp;     // used to detect retrograde motion @@ -877,6 +902,8 @@ protected:          // const after set(), except for bits AUDIO_OUTPUT_FLAG_FAST and AUDIO_OUTPUT_FLAG_OFFLOAD.          // mLock must be held to read or write those bits reliably. +    bool                    mDoNotReconnect; +      int                     mSessionId;      int                     mAuxEffectId; diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h index 3f7fd09..5051aff 100644 --- a/include/media/IAudioFlinger.h +++ b/include/media/IAudioFlinger.h @@ -243,6 +243,9 @@ public:      /* Get the HW synchronization source used for an audio session */      virtual audio_hw_sync_t getAudioHwSyncForSession(audio_session_t sessionId) = 0; + +    /* Indicate JAVA services are ready (scheduling, power management ...) */ +    virtual status_t systemReady() = 0;  }; diff --git a/include/media/IOMX.h b/include/media/IOMX.h index d33d142..7023453 100644 --- a/include/media/IOMX.h +++ b/include/media/IOMX.h @@ -25,6 +25,10 @@  #include <utils/List.h>  #include <utils/String8.h> +#include <list> + +#include <media/hardware/MetadataBufferType.h> +  #include <OMX_Core.h>  #include <OMX_Video.h> @@ -81,14 +85,16 @@ public:      virtual status_t getState(              node_id node, OMX_STATETYPE* state) = 0; +    // This will set *type to previous metadata buffer type on OMX error (not on binder error), and +    // new metadata buffer type on success.      virtual status_t storeMetaDataInBuffers( -            node_id node, OMX_U32 port_index, OMX_BOOL enable) = 0; +            node_id node, OMX_U32 port_index, OMX_BOOL enable, MetadataBufferType *type = NULL) = 0;      virtual status_t prepareForAdaptivePlayback(              node_id node, OMX_U32 portIndex, OMX_BOOL enable,              OMX_U32 maxFrameWidth, OMX_U32 maxFrameHeight) = 0; -   virtual status_t configureVideoTunnelMode( +    virtual status_t configureVideoTunnelMode(              node_id node, OMX_U32 portIndex, OMX_BOOL tunneled,              OMX_U32 audioHwSync, native_handle_t **sidebandHandle) = 0; @@ -98,9 +104,10 @@ public:      virtual status_t getGraphicBufferUsage(              node_id node, OMX_U32 port_index, OMX_U32* usage) = 0; +    // Use |params| as an OMX buffer, but limit the size of the OMX buffer to |allottedSize|.      virtual status_t useBuffer(              node_id node, OMX_U32 port_index, const sp<IMemory> ¶ms, -            buffer_id *buffer) = 0; +            buffer_id *buffer, OMX_U32 allottedSize) = 0;      virtual status_t useGraphicBuffer(              node_id node, OMX_U32 port_index, @@ -110,17 +117,23 @@ public:              node_id node, OMX_U32 port_index,              const sp<GraphicBuffer> &graphicBuffer, buffer_id buffer) = 0; +    // This will set *type to resulting metadata buffer type on OMX error (not on binder error) as +    // well as on success.      virtual status_t createInputSurface(              node_id node, OMX_U32 port_index, -            sp<IGraphicBufferProducer> *bufferProducer) = 0; +            sp<IGraphicBufferProducer> *bufferProducer, +            MetadataBufferType *type = NULL) = 0;      virtual status_t createPersistentInputSurface(              sp<IGraphicBufferProducer> *bufferProducer,              sp<IGraphicBufferConsumer> *bufferConsumer) = 0; +    // This will set *type to resulting metadata buffer type on OMX error (not on binder error) as +    // well as on success.      virtual status_t setInputSurface(              node_id node, OMX_U32 port_index, -            const sp<IGraphicBufferConsumer> &bufferConsumer) = 0; +            const sp<IGraphicBufferConsumer> &bufferConsumer, +            MetadataBufferType *type) = 0;      virtual status_t signalEndOfInputStream(node_id node) = 0; @@ -132,20 +145,32 @@ public:              node_id node, OMX_U32 port_index, size_t size,              buffer_id *buffer, void **buffer_data) = 0; +    // Allocate an OMX buffer of size |allotedSize|. Use |params| as the backup buffer, which +    // may be larger.      virtual status_t allocateBufferWithBackup(              node_id node, OMX_U32 port_index, const sp<IMemory> ¶ms, -            buffer_id *buffer) = 0; +            buffer_id *buffer, OMX_U32 allottedSize) = 0;      virtual status_t freeBuffer(              node_id node, OMX_U32 port_index, buffer_id buffer) = 0; -    virtual status_t fillBuffer(node_id node, buffer_id buffer) = 0; - +    enum { +        kFenceTimeoutMs = 1000 +    }; +    // Calls OMX_FillBuffer on buffer, and passes |fenceFd| to component if it supports +    // fences. Otherwise, it waits on |fenceFd| before calling OMX_FillBuffer. +    // Takes ownership of |fenceFd| even if this call fails. +    virtual status_t fillBuffer(node_id node, buffer_id buffer, int fenceFd = -1) = 0; + +    // Calls OMX_EmptyBuffer on buffer (after updating buffer header with |range_offset|, +    // |range_length|, |flags| and |timestamp|). Passes |fenceFd| to component if it +    // supports fences. Otherwise, it waits on |fenceFd| before calling OMX_EmptyBuffer. +    // Takes ownership of |fenceFd| even if this call fails.      virtual status_t emptyBuffer(              node_id node,              buffer_id buffer,              OMX_U32 range_offset, OMX_U32 range_length, -            OMX_U32 flags, OMX_TICKS timestamp) = 0; +            OMX_U32 flags, OMX_TICKS timestamp, int fenceFd = -1) = 0;      virtual status_t getExtensionIndex(              node_id node, @@ -177,6 +202,7 @@ struct omx_message {      } type;      IOMX::node_id node; +    int fenceFd; // used for EMPTY_BUFFER_DONE and FILL_BUFFER_DONE; client must close this      union {          // if type == EVENT @@ -207,7 +233,8 @@ class IOMXObserver : public IInterface {  public:      DECLARE_META_INTERFACE(OMXObserver); -    virtual void onMessage(const omx_message &msg) = 0; +    // Handle (list of) messages. +    virtual void onMessages(const std::list<omx_message> &messages) = 0;  };  //////////////////////////////////////////////////////////////////////////////// @@ -233,4 +260,15 @@ struct CodecProfileLevel {  }  // namespace android +inline static const char *asString(android::MetadataBufferType i, const char *def = "??") { +    using namespace android; +    switch (i) { +        case kMetadataBufferTypeCameraSource:   return "CameraSource"; +        case kMetadataBufferTypeGrallocSource:  return "GrallocSource"; +        case kMetadataBufferTypeANWBuffer:      return "ANWBuffer"; +        case kMetadataBufferTypeInvalid:        return "Invalid"; +        default:                                return def; +    } +} +  #endif  // ANDROID_IOMX_H_ diff --git a/include/media/MediaPlayerInterface.h b/include/media/MediaPlayerInterface.h index fa917f9..de82554 100644 --- a/include/media/MediaPlayerInterface.h +++ b/include/media/MediaPlayerInterface.h @@ -113,7 +113,9 @@ public:                  AudioCallback cb = NULL,                  void *cookie = NULL,                  audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE, -                const audio_offload_info_t *offloadInfo = NULL) = 0; +                const audio_offload_info_t *offloadInfo = NULL, +                bool doNotReconnect = false, +                uint32_t suggestedFrameCount = 0) = 0;          virtual status_t    start() = 0; diff --git a/include/media/MediaProfiles.h b/include/media/MediaProfiles.h index f061d22..e02918f 100644 --- a/include/media/MediaProfiles.h +++ b/include/media/MediaProfiles.h @@ -58,24 +58,6 @@ enum camcorder_quality {      CAMCORDER_QUALITY_HIGH_SPEED_LIST_END = 2005,  }; -/** - * Set CIF as default maximum import and export resolution of video editor. - * The maximum import and export resolutions are platform specific, - * which should be defined in media_profiles.xml. - * Set default maximum prefetch YUV frames to 6, which means video editor can - * queue up to 6 YUV frames in the video encoder source. - * This value is used to limit the amount of memory used by video editor - * engine when the encoder consumes YUV frames at a lower speed - * than video editor engine produces. - */ -enum videoeditor_capability { -    VIDEOEDITOR_DEFAULT_MAX_INPUT_FRAME_WIDTH = 352, -    VIDEOEDITOR_DEFUALT_MAX_INPUT_FRAME_HEIGHT = 288, -    VIDEOEDITOR_DEFAULT_MAX_OUTPUT_FRAME_WIDTH = 352, -    VIDEOEDITOR_DEFUALT_MAX_OUTPUT_FRAME_HEIGHT = 288, -    VIDEOEDITOR_DEFAULT_MAX_PREFETCH_YUV_FRAMES = 6 -}; -  enum video_decoder {      VIDEO_DECODER_WMV,  }; @@ -148,32 +130,6 @@ public:      int getVideoEncoderParamByName(const char *name, video_encoder codec) const;      /** -     * Returns the value for the given param name for the video editor cap -     * param or -1 if error. -     * Supported param name are: -     * videoeditor.input.width.max - max input video frame width -     * videoeditor.input.height.max - max input video frame height -     * videoeditor.output.width.max - max output video frame width -     * videoeditor.output.height.max - max output video frame height -     * maxPrefetchYUVFrames - max prefetch YUV frames in video editor engine. This value is used -     * to limit the memory consumption. -     */ -    int getVideoEditorCapParamByName(const char *name) const; - -    /** -     * Returns the value for the given param name for the video editor export codec format -     * param or -1 if error. -     * Supported param name are: -     * videoeditor.export.profile - export video profile -     * videoeditor.export.level - export video level -     * Supported param codec are: -     * 1 for h263 -     * 2 for h264 -     * 3 for mpeg4 -     */ -    int getVideoEditorExportParamByName(const char *name, int codec) const; - -    /**       * Returns the audio encoders supported.       */      Vector<audio_encoder> getAudioEncoders() const; @@ -221,7 +177,7 @@ private:      MediaProfiles& operator=(const MediaProfiles&);  // Don't call me      MediaProfiles(const MediaProfiles&);             // Don't call me -    MediaProfiles() { mVideoEditorCap = NULL; }        // Dummy default constructor +    MediaProfiles() {}                               // Dummy default constructor      ~MediaProfiles();                                // Don't delete me      struct VideoCodec { @@ -366,31 +322,6 @@ private:          int mCameraId;          Vector<int> mLevels;      }; -    struct ExportVideoProfile { -        ExportVideoProfile(int codec, int profile, int level) -            :mCodec(codec),mProfile(profile),mLevel(level) {} -        ~ExportVideoProfile() {} -        int mCodec; -        int mProfile; -        int mLevel; -    }; -    struct VideoEditorCap { -        VideoEditorCap(int inFrameWidth, int inFrameHeight, -            int outFrameWidth, int outFrameHeight, int frames) -            : mMaxInputFrameWidth(inFrameWidth), -              mMaxInputFrameHeight(inFrameHeight), -              mMaxOutputFrameWidth(outFrameWidth), -              mMaxOutputFrameHeight(outFrameHeight), -              mMaxPrefetchYUVFrames(frames) {} - -        ~VideoEditorCap() {} - -        int mMaxInputFrameWidth; -        int mMaxInputFrameHeight; -        int mMaxOutputFrameWidth; -        int mMaxOutputFrameHeight; -        int mMaxPrefetchYUVFrames; -    };      int getCamcorderProfileIndex(int cameraId, camcorder_quality quality) const;      void initRequiredProfileRefs(const Vector<int>& cameraIds); @@ -403,7 +334,6 @@ private:      static void logAudioEncoderCap(const AudioEncoderCap& cap);      static void logVideoDecoderCap(const VideoDecoderCap& cap);      static void logAudioDecoderCap(const AudioDecoderCap& cap); -    static void logVideoEditorCap(const VideoEditorCap& cap);      // If the xml configuration file does exist, use the settings      // from the xml @@ -415,9 +345,6 @@ private:      static VideoDecoderCap* createVideoDecoderCap(const char **atts);      static VideoEncoderCap* createVideoEncoderCap(const char **atts);      static AudioEncoderCap* createAudioEncoderCap(const char **atts); -    static VideoEditorCap* createVideoEditorCap( -                const char **atts, MediaProfiles *profiles); -    static ExportVideoProfile* createExportVideoProfile(const char **atts);      static CamcorderProfile* createCamcorderProfile(                  int cameraId, const char **atts, Vector<int>& cameraIds); @@ -461,8 +388,6 @@ private:      static void createDefaultEncoderOutputFileFormats(MediaProfiles *profiles);      static void createDefaultImageEncodingQualityLevels(MediaProfiles *profiles);      static void createDefaultImageDecodingMaxMemory(MediaProfiles *profiles); -    static void createDefaultVideoEditorCap(MediaProfiles *profiles); -    static void createDefaultExportVideoProfiles(MediaProfiles *profiles);      static VideoEncoderCap* createDefaultH263VideoEncoderCap();      static VideoEncoderCap* createDefaultM4vVideoEncoderCap(); @@ -520,8 +445,6 @@ private:      RequiredProfiles *mRequiredProfileRefs;      Vector<int>              mCameraIds; -    VideoEditorCap* mVideoEditorCap; -    Vector<ExportVideoProfile*> mVideoEditorExportProfiles;  };  }; // namespace android diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h index 4ed97e5..d4891a1 100644 --- a/include/media/stagefright/ACodec.h +++ b/include/media/stagefright/ACodec.h @@ -20,6 +20,7 @@  #include <stdint.h>  #include <android/native_window.h> +#include <media/hardware/MetadataBufferType.h>  #include <media/IOMX.h>  #include <media/stagefright/foundation/AHierarchicalStateMachine.h>  #include <media/stagefright/CodecBase.h> @@ -108,6 +109,7 @@ private:      enum {          kWhatSetup                   = 'setu',          kWhatOMXMessage              = 'omx ', +        kWhatOMXMessageList          = 'omxL',          kWhatInputBufferFilled       = 'inpF',          kWhatOutputBufferDrained     = 'outD',          kWhatShutdown                = 'shut', @@ -123,7 +125,7 @@ private:          kWhatStart                   = 'star',          kWhatRequestIDRFrame         = 'ridr',          kWhatSetParameters           = 'setP', -        kWhatSubmitOutputMetaDataBufferIfEOS = 'subm', +        kWhatSubmitOutputMetadataBufferIfEOS = 'subm',          kWhatOMXDied                 = 'OMXd',          kWhatReleaseCodecInstance    = 'relC',      }; @@ -159,11 +161,25 @@ private:          sp<ABuffer> mData;          sp<GraphicBuffer> mGraphicBuffer; +        int mFenceFd; + +        // The following field and 4 methods are used for debugging only +        bool mIsReadFence; +        // Store |fenceFd| and set read/write flag. Log error, if there is already a fence stored. +        void setReadFence(int fenceFd, const char *dbg); +        void setWriteFence(int fenceFd, const char *dbg); +        // Log error, if the current fence is not a read/write fence. +        void checkReadFence(const char *dbg); +        void checkWriteFence(const char *dbg);      };      static const char *_asString(BufferInfo::Status s);      void dumpBuffers(OMX_U32 portIndex); +    // If |fd| is non-negative, waits for fence with |fd| and logs an error if it fails. Returns +    // the error code or OK on success. If |fd| is negative, it returns OK +    status_t waitForFence(int fd, const char *dbg); +  #if TRACK_BUFFER_TIMING      struct BufferStats {          int64_t mEmptyBufferTimeUs; @@ -207,7 +223,6 @@ private:      bool mSentFormat;      bool mIsVideo;      bool mIsEncoder; -    bool mUseMetadataOnEncoderOutput;      bool mShutdownInProgress;      bool mExplicitShutdown; @@ -222,9 +237,10 @@ private:      bool mChannelMaskPresent;      int32_t mChannelMask;      unsigned mDequeueCounter; -    bool mStoreMetaDataInOutputBuffers; +    MetadataBufferType mInputMetadataType; +    MetadataBufferType mOutputMetadataType;      bool mLegacyAdaptiveExperiment; -    int32_t mMetaDataBuffersToSubmit; +    int32_t mMetadataBuffersToSubmit;      size_t mNumUndequeuedBuffers;      int64_t mRepeatFrameDelayUs; @@ -249,14 +265,22 @@ private:      status_t configureOutputBuffersFromNativeWindow(              OMX_U32 *nBufferCount, OMX_U32 *nBufferSize,              OMX_U32 *nMinUndequeuedBuffers); -    status_t allocateOutputMetaDataBuffers(); -    status_t submitOutputMetaDataBuffer(); -    void signalSubmitOutputMetaDataBufferIfEOS_workaround(); +    status_t allocateOutputMetadataBuffers(); +    status_t submitOutputMetadataBuffer(); +    void signalSubmitOutputMetadataBufferIfEOS_workaround();      status_t allocateOutputBuffersFromNativeWindow();      status_t cancelBufferToNativeWindow(BufferInfo *info);      status_t freeOutputBuffersNotOwnedByComponent();      BufferInfo *dequeueBufferFromNativeWindow(); +    inline bool storingMetadataInDecodedBuffers() { +        return mOutputMetadataType >= 0 && !mIsEncoder; +    } + +    inline bool usingMetadataOnEncoderOutput() { +        return mOutputMetadataType >= 0 && mIsEncoder; +    } +      BufferInfo *findBufferByID(              uint32_t portIndex, IOMX::buffer_id bufferID,              ssize_t *index = NULL); diff --git a/include/media/stagefright/CameraSource.h b/include/media/stagefright/CameraSource.h index 96dfd7e..069e897 100644 --- a/include/media/stagefright/CameraSource.h +++ b/include/media/stagefright/CameraSource.h @@ -83,7 +83,7 @@ public:                                            Size videoSize,                                            int32_t frameRate,                                            const sp<IGraphicBufferProducer>& surface, -                                          bool storeMetaDataInVideoBuffers = false); +                                          bool storeMetaDataInVideoBuffers = true);      virtual ~CameraSource(); @@ -149,6 +149,8 @@ protected:      int32_t  mNumInputBuffers;      int32_t  mVideoFrameRate;      int32_t  mColorFormat; +    int32_t  mEncoderFormat; +    int32_t  mEncoderDataSpace;      status_t mInitCheck;      sp<Camera>   mCamera; diff --git a/include/media/stagefright/MediaCodec.h b/include/media/stagefright/MediaCodec.h index 6e14fc5..d62b35d 100644 --- a/include/media/stagefright/MediaCodec.h +++ b/include/media/stagefright/MediaCodec.h @@ -60,8 +60,6 @@ struct MediaCodec : public AHandler {          CB_RESOURCE_RECLAIMED = 5,      }; -    struct BatteryNotifier; -      static sp<MediaCodec> CreateByType(              const sp<ALooper> &looper, const char *mime, bool encoder, status_t *err = NULL); diff --git a/include/media/stagefright/MediaCodecList.h b/include/media/stagefright/MediaCodecList.h index ce34338..3aaa032 100644 --- a/include/media/stagefright/MediaCodecList.h +++ b/include/media/stagefright/MediaCodecList.h @@ -32,6 +32,8 @@  namespace android { +extern const char *kMaxEncoderInputBuffers; +  struct AMessage;  struct MediaCodecList : public BnMediaCodecList { @@ -53,7 +55,10 @@ struct MediaCodecList : public BnMediaCodecList {      // to be used by MediaPlayerService alone      static sp<IMediaCodecList> getLocalInstance(); -    // only to be used in getLocalInstance +    // only to be used by getLocalInstance +    static void *profilerThreadWrapper(void * /*arg*/); + +    // only to be used by MediaPlayerService      void parseTopLevelXMLFile(const char *path, bool ignore_errors = false);  private: diff --git a/include/media/stagefright/MediaDefs.h b/include/media/stagefright/MediaDefs.h index 3b58122..21eb04a 100644 --- a/include/media/stagefright/MediaDefs.h +++ b/include/media/stagefright/MediaDefs.h @@ -64,7 +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; +extern const char *MEDIA_MIMETYPE_DATA_TIMED_ID3;  }  // namespace android diff --git a/include/media/stagefright/foundation/ADebug.h b/include/media/stagefright/foundation/ADebug.h index a97dd9b..24df85a 100644 --- a/include/media/stagefright/foundation/ADebug.h +++ b/include/media/stagefright/foundation/ADebug.h @@ -24,6 +24,31 @@  #include <media/stagefright/foundation/AString.h>  #include <utils/Log.h> +inline static const char *asString(android::status_t i, const char *def = "??") { +    using namespace android; +    switch (i) { +        case NO_ERROR:              return "NO_ERROR"; +        case UNKNOWN_ERROR:         return "UNKNOWN_ERROR"; +        case NO_MEMORY:             return "NO_MEMORY"; +        case INVALID_OPERATION:     return "INVALID_OPERATION"; +        case BAD_VALUE:             return "BAD_VALUE"; +        case BAD_TYPE:              return "BAD_TYPE"; +        case NAME_NOT_FOUND:        return "NAME_NOT_FOUND"; +        case PERMISSION_DENIED:     return "PERMISSION_DENIED"; +        case NO_INIT:               return "NO_INIT"; +        case ALREADY_EXISTS:        return "ALREADY_EXISTS"; +        case DEAD_OBJECT:           return "DEAD_OBJECT"; +        case FAILED_TRANSACTION:    return "FAILED_TRANSACTION"; +        case BAD_INDEX:             return "BAD_INDEX"; +        case NOT_ENOUGH_DATA:       return "NOT_ENOUGH_DATA"; +        case WOULD_BLOCK:           return "WOULD_BLOCK"; +        case TIMED_OUT:             return "TIMED_OUT"; +        case UNKNOWN_TRANSACTION:   return "UNKNOWN_TRANSACTION"; +        case FDS_NOT_ALLOWED:       return "FDS_NOT_ALLOWED"; +        default:                    return def; +    } +} +  namespace android {  #define LITERAL_TO_STRING_INTERNAL(x)    #x  | 
