diff options
author | Surajit Podder <spodder@codeaurora.org> | 2014-09-03 15:48:24 +0530 |
---|---|---|
committer | Surajit Podder <spodder@codeaurora.org> | 2014-09-03 15:48:24 +0530 |
commit | 7ab84a41acdb62621f67e1f479f5e225531edbca (patch) | |
tree | 0a961a06a6441b3bf5c1e49be6ec1426f0dc5ee6 | |
parent | 0d1fb5808d1a52916c8837988ea7d105207d7d55 (diff) | |
download | android_hardware_qcom_media-7ab84a41acdb62621f67e1f479f5e225531edbca.tar.gz android_hardware_qcom_media-7ab84a41acdb62621f67e1f479f5e225531edbca.tar.bz2 android_hardware_qcom_media-7ab84a41acdb62621f67e1f479f5e225531edbca.zip |
dashplayer: DashCodec to derive from CodecBase .
DashCodec derives from abstract struct CodecBase.
This is comply with the new framework change
where CodecBase is abstract interface from which
ACodec, DashCodec derive and implement
Change-Id: I2ffc7f980765504882c00579c81793d10ae0f6af
-rw-r--r-- | dashplayer/DashCodec.cpp | 22 | ||||
-rw-r--r-- | dashplayer/DashCodec.h | 54 |
2 files changed, 42 insertions, 34 deletions
diff --git a/dashplayer/DashCodec.cpp b/dashplayer/DashCodec.cpp index 5bf409e0..8db7840e 100644 --- a/dashplayer/DashCodec.cpp +++ b/dashplayer/DashCodec.cpp @@ -516,7 +516,7 @@ status_t DashCodec::allocateBuffersOnPort(OMX_U32 portIndex) { } sp<AMessage> notify = mNotify->dup(); - notify->setInt32("what", DashCodec::kWhatBuffersAllocated); + notify->setInt32("what", CodecBase::kWhatBuffersAllocated); notify->setInt32("portIndex", portIndex); @@ -2367,7 +2367,7 @@ void DashCodec::sendFormatChange() { void DashCodec::signalError(OMX_ERRORTYPE error, status_t internalError) { sp<AMessage> notify = mNotify->dup(); - notify->setInt32("what", DashCodec::kWhatError); + notify->setInt32("what", CodecBase::kWhatError); notify->setInt32("omx-error", error); notify->setInt32("err", internalError); notify->post(); @@ -2584,7 +2584,7 @@ bool DashCodec::BaseState::onMessageReceived(const sp<AMessage> &msg) { case DashCodec::kWhatFlush: { sp<AMessage> notify = mCodec->mNotify->dup(); - notify->setInt32("what", DashCodec::kWhatFlushCompleted); + notify->setInt32("what", CodecBase::kWhatFlushCompleted); notify->post(); return true; } @@ -2742,7 +2742,7 @@ void DashCodec::BaseState::postFillThisBuffer(BufferInfo *info) { CHECK_EQ((int)info->mStatus, (int)BufferInfo::OWNED_BY_US); sp<AMessage> notify = mCodec->mNotify->dup(); - notify->setInt32("what", DashCodec::kWhatFillThisBuffer); + notify->setInt32("what", CodecBase::kWhatFillThisBuffer); notify->setInt32("buffer-id", info->mBufferID); info->mData->meta()->clear(); @@ -2995,7 +2995,7 @@ bool DashCodec::BaseState::onOMXFillBufferDone( ALOGE("[%s] saw output EOS", mCodec->mComponentName.c_str()); sp<AMessage> notify = mCodec->mNotify->dup(); - notify->setInt32("what", DashCodec::kWhatEOS); + notify->setInt32("what", CodecBase::kWhatEOS); notify->setInt32("err", mCodec->mInputEOSResult); notify->post(); @@ -3022,7 +3022,7 @@ bool DashCodec::BaseState::onOMXFillBufferDone( info->mData->meta()->setInt64("timeUs", timeUs); sp<AMessage> notify = mCodec->mNotify->dup(); - notify->setInt32("what", DashCodec::kWhatDrainThisBuffer); + notify->setInt32("what", CodecBase::kWhatDrainThisBuffer); notify->setInt32("buffer-id", info->mBufferID); notify->setBuffer("buffer", info->mData); notify->setInt32("flags", flags); @@ -3180,7 +3180,7 @@ bool DashCodec::UninitializedState::onMessageReceived(const sp<AMessage> &msg) { CHECK(!keepComponentAllocated); sp<AMessage> notify = mCodec->mNotify->dup(); - notify->setInt32("what", DashCodec::kWhatShutdownCompleted); + notify->setInt32("what", CodecBase::kWhatShutdownCompleted); notify->post(); handled = true; @@ -3297,7 +3297,7 @@ bool DashCodec::UninitializedState::onAllocateComponent(const sp<AMessage> &msg) { sp<AMessage> notify = mCodec->mNotify->dup(); - notify->setInt32("what", DashCodec::kWhatComponentAllocated); + notify->setInt32("what", CodecBase::kWhatComponentAllocated); notify->setString("componentName", mCodec->mComponentName.c_str()); notify->post(); } @@ -3341,7 +3341,7 @@ void DashCodec::LoadedState::onShutdown(bool keepComponentAllocated) { } sp<AMessage> notify = mCodec->mNotify->dup(); - notify->setInt32("what", DashCodec::kWhatShutdownCompleted); + notify->setInt32("what", CodecBase::kWhatShutdownCompleted); notify->post(); } @@ -3423,7 +3423,7 @@ bool DashCodec::LoadedState::onConfigureComponent( { sp<AMessage> notify = mCodec->mNotify->dup(); - notify->setInt32("what", DashCodec::kWhatComponentConfigured); + notify->setInt32("what", CodecBase::kWhatComponentConfigured); notify->post(); } @@ -4089,7 +4089,7 @@ void DashCodec::FlushingState::changeStateIfWeOwnAllBuffers() { && mFlushComplete[kPortIndexOutput] && mCodec->allYourBuffersAreBelongToUs()) { sp<AMessage> notify = mCodec->mNotify->dup(); - notify->setInt32("what", DashCodec::kWhatFlushCompleted); + notify->setInt32("what", CodecBase::kWhatFlushCompleted); notify->post(); mCodec->mPortEOS[kPortIndexInput] = diff --git a/dashplayer/DashCodec.h b/dashplayer/DashCodec.h index 7848bcbe..561a64a2 100644 --- a/dashplayer/DashCodec.h +++ b/dashplayer/DashCodec.h @@ -24,6 +24,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> #include <OMX_Component.h> @@ -35,36 +36,43 @@ namespace android { struct ABuffer; struct MemoryDealer; -struct DashCodec : public AHierarchicalStateMachine { - enum { - kWhatFillThisBuffer = 'fill', - kWhatDrainThisBuffer = 'drai', - kWhatEOS = 'eos ', - kWhatShutdownCompleted = 'scom', - kWhatFlushCompleted = 'fcom', - kWhatOutputFormatChanged = 'outC', - kWhatError = 'erro', - kWhatComponentAllocated = 'cAll', - kWhatComponentConfigured = 'cCon', - kWhatBuffersAllocated = 'allc', - }; - +struct DashCodec : public AHierarchicalStateMachine, public CodecBase { DashCodec(); - 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 initiateAllocateComponent(const sp<AMessage> &msg); - void initiateConfigureComponent(const sp<AMessage> &msg); - void initiateStart(); + virtual void initiateAllocateComponent(const sp<AMessage> &msg); + virtual void initiateConfigureComponent(const sp<AMessage> &msg); + virtual void initiateCreateInputSurface() { + return; + } + virtual void initiateStart(); + virtual void initiateShutdown(bool keepComponentAllocated = false); + + virtual void signalFlush(); + virtual void signalResume(); + + virtual void signalSetParameters(const sp<AMessage> &msg) { + return; + } + virtual void signalEndOfInputStream() { + return; + } + virtual void signalRequestIDRFrame(); - void signalRequestIDRFrame(); void queueNextFormat(); void clearCachedFormats(); - struct PortDescription : public RefBase { + + static status_t PushBlankBuffersToNativeWindow(sp<ANativeWindow> nativeWindow); + + // AHierarchicalStateMachine implements the message handling + virtual void onMessageReceived(const sp<AMessage> &msg) { + handleMessage(msg); + } + + struct PortDescription : public CodecBase::PortDescription { size_t countBuffers(); IOMX::buffer_id bufferIDAt(size_t index) const; sp<ABuffer> bufferAt(size_t index) const; |