summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2014-09-03 10:42:12 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2014-09-03 10:42:12 -0700
commit9881de6ef0b85e8e5fa81f8363d2f0fe398c4ec8 (patch)
tree0a961a06a6441b3bf5c1e49be6ec1426f0dc5ee6
parenta21e59ad57fd98a7be411eb29bfab8d4c32ae2bd (diff)
parent7ab84a41acdb62621f67e1f479f5e225531edbca (diff)
downloadandroid_hardware_qcom_media-9881de6ef0b85e8e5fa81f8363d2f0fe398c4ec8.tar.gz
android_hardware_qcom_media-9881de6ef0b85e8e5fa81f8363d2f0fe398c4ec8.tar.bz2
android_hardware_qcom_media-9881de6ef0b85e8e5fa81f8363d2f0fe398c4ec8.zip
Merge "dashplayer: DashCodec to derive from CodecBase ."
-rw-r--r--dashplayer/DashCodec.cpp22
-rw-r--r--dashplayer/DashCodec.h54
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;