summaryrefslogtreecommitdiffstats
path: root/include/media/stagefright/ACodec.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/media/stagefright/ACodec.h')
-rw-r--r--include/media/stagefright/ACodec.h90
1 files changed, 57 insertions, 33 deletions
diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h
index 46c62dc..da4c20c 100644
--- a/include/media/stagefright/ACodec.h
+++ b/include/media/stagefright/ACodec.h
@@ -22,6 +22,7 @@
#include <android/native_window.h>
#include <media/IOMX.h>
#include <media/stagefright/foundation/AHierarchicalStateMachine.h>
+#include <media/stagefright/CodecBase.h>
#include <media/stagefright/SkipCutBuffer.h>
#include <OMX_Audio.h>
@@ -31,45 +32,34 @@ namespace android {
struct ABuffer;
struct MemoryDealer;
+struct DescribeColorFormatParams;
-struct ACodec : public AHierarchicalStateMachine {
- enum {
- kWhatFillThisBuffer = 'fill',
- kWhatDrainThisBuffer = 'drai',
- kWhatEOS = 'eos ',
- kWhatShutdownCompleted = 'scom',
- kWhatFlushCompleted = 'fcom',
- kWhatOutputFormatChanged = 'outC',
- kWhatError = 'erro',
- kWhatComponentAllocated = 'cAll',
- kWhatComponentConfigured = 'cCon',
- kWhatInputSurfaceCreated = 'isfc',
- kWhatSignaledInputEOS = 'seos',
- kWhatBuffersAllocated = 'allc',
- kWhatOMXDied = 'OMXd',
- };
-
+struct ACodec : public AHierarchicalStateMachine, public CodecBase {
ACodec();
- void setNotificationMessage(const sp<AMessage> &msg);
+ virtual void setNotificationMessage(const sp<AMessage> &msg);
+
void initiateSetup(const sp<AMessage> &msg);
- void signalFlush();
- void signalResume();
- void initiateShutdown(bool keepComponentAllocated = false);
- void signalSetParameters(const sp<AMessage> &msg);
- void signalEndOfInputStream();
+ virtual void initiateAllocateComponent(const sp<AMessage> &msg);
+ virtual void initiateConfigureComponent(const sp<AMessage> &msg);
+ virtual void initiateCreateInputSurface();
+ virtual void initiateStart();
+ virtual void initiateShutdown(bool keepComponentAllocated = false);
- void initiateAllocateComponent(const sp<AMessage> &msg);
- void initiateConfigureComponent(const sp<AMessage> &msg);
- void initiateCreateInputSurface();
- void initiateStart();
+ virtual void signalFlush();
+ virtual void signalResume();
- void signalRequestIDRFrame();
+ virtual void signalSetParameters(const sp<AMessage> &msg);
+ virtual void signalEndOfInputStream();
+ virtual void signalRequestIDRFrame();
- bool isConfiguredForAdaptivePlayback() { return mIsConfiguredForAdaptivePlayback; }
+ // AHierarchicalStateMachine implements the message handling
+ virtual void onMessageReceived(const sp<AMessage> &msg) {
+ handleMessage(msg);
+ }
- struct PortDescription : public RefBase {
+ struct PortDescription : public CodecBase::PortDescription {
size_t countBuffers();
IOMX::buffer_id bufferIDAt(size_t index) const;
sp<ABuffer> bufferAt(size_t index) const;
@@ -86,6 +76,10 @@ struct ACodec : public AHierarchicalStateMachine {
DISALLOW_EVIL_CONSTRUCTORS(PortDescription);
};
+ static bool isFlexibleColorFormat(
+ const sp<IOMX> &omx, IOMX::node_id node,
+ uint32_t colorFormat, OMX_U32 *flexibleEquivalent);
+
protected:
virtual ~ACodec();
@@ -119,6 +113,7 @@ private:
kWhatRequestIDRFrame = 'ridr',
kWhatSetParameters = 'setP',
kWhatSubmitOutputMetaDataBufferIfEOS = 'subm',
+ kWhatOMXDied = 'OMXd',
};
enum {
@@ -178,6 +173,8 @@ private:
sp<MemoryDealer> mDealer[2];
sp<ANativeWindow> mNativeWindow;
+ sp<AMessage> mInputFormat;
+ sp<AMessage> mOutputFormat;
Vector<BufferInfo> mBuffers[2];
bool mPortEOS[2];
@@ -189,7 +186,7 @@ private:
bool mIsEncoder;
bool mUseMetadataOnEncoderOutput;
bool mShutdownInProgress;
- bool mIsConfiguredForAdaptivePlayback;
+ bool mExplicitShutdown;
// If "mKeepComponentAllocated" we only transition back to Loaded state
// and do not release the component instance.
@@ -197,6 +194,7 @@ private:
int32_t mEncoderDelay;
int32_t mEncoderPadding;
+ int32_t mRotationDegrees;
bool mChannelMaskPresent;
int32_t mChannelMask;
@@ -208,6 +206,11 @@ private:
int64_t mRepeatFrameDelayUs;
int64_t mMaxPtsGapUs;
+ int64_t mTimePerFrameUs;
+ int64_t mTimePerCaptureUs;
+
+ bool mCreateInputBuffersSuspended;
+
status_t setCyclicIntraMacroblockRefresh(const sp<AMessage> &msg, int32_t mode);
status_t allocateBuffersOnPort(OMX_U32 portIndex);
status_t freeBuffersOnPort(OMX_U32 portIndex);
@@ -231,6 +234,9 @@ private:
status_t setComponentRole(bool isEncoder, const char *mime);
status_t configureCodec(const char *mime, const sp<AMessage> &msg);
+ status_t configureTunneledVideoPlayback(int32_t audioHwSync,
+ const sp<ANativeWindow> &nativeWindow);
+
status_t setVideoPortFormatType(
OMX_U32 portIndex,
OMX_VIDEO_CODINGTYPE compressionFormat,
@@ -239,7 +245,7 @@ private:
status_t setSupportedOutputFormat();
status_t setupVideoDecoder(
- const char *mime, int32_t width, int32_t height);
+ const char *mime, const sp<AMessage> &msg);
status_t setupVideoEncoder(
const char *mime, const sp<AMessage> &msg);
@@ -249,10 +255,21 @@ private:
int32_t width, int32_t height,
OMX_VIDEO_CODINGTYPE compressionFormat);
+ typedef struct drcParams {
+ int32_t drcCut;
+ int32_t drcBoost;
+ int32_t heavyCompression;
+ int32_t targetRefLevel;
+ int32_t encodedTargetLevel;
+ } drcParams_t;
+
status_t setupAACCodec(
bool encoder,
int32_t numChannels, int32_t sampleRate, int32_t bitRate,
- int32_t aacProfile, bool isADTS);
+ int32_t aacProfile, bool isADTS, int32_t sbrMode,
+ int32_t maxOutputChannelCount, const drcParams_t& drc);
+
+ status_t setupAC3Codec(bool encoder, int32_t numChannels, int32_t sampleRate);
status_t selectAudioPortFormat(
OMX_U32 portIndex, OMX_AUDIO_CODINGTYPE desiredFormat);
@@ -271,6 +288,7 @@ private:
status_t setupMPEG4EncoderParameters(const sp<AMessage> &msg);
status_t setupH263EncoderParameters(const sp<AMessage> &msg);
status_t setupAVCEncoderParameters(const sp<AMessage> &msg);
+ status_t setupHEVCEncoderParameters(const sp<AMessage> &msg);
status_t setupVPXEncoderParameters(const sp<AMessage> &msg);
status_t verifySupportForProfileAndLevel(int32_t profile, int32_t level);
@@ -299,11 +317,17 @@ private:
void processDeferredMessages();
void sendFormatChange(const sp<AMessage> &reply);
+ status_t getPortFormat(OMX_U32 portIndex, sp<AMessage> &notify);
void signalError(
OMX_ERRORTYPE error = OMX_ErrorUndefined,
status_t internalError = UNKNOWN_ERROR);
+ static bool describeDefaultColorFormat(DescribeColorFormatParams &describeParams);
+ static bool describeColorFormat(
+ const sp<IOMX> &omx, IOMX::node_id node,
+ DescribeColorFormatParams &describeParams);
+
status_t requestIDRFrame();
status_t setParameters(const sp<AMessage> &params);