summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2014-07-07 15:08:24 -0700
committerLajos Molnar <lajos@google.com>2014-07-07 16:40:21 -0700
commitd8cbe4a024ef54adf043b6ea31fa22271b8b2c51 (patch)
tree4aa4389dd9656196fd5ffd730c811839cec3723a
parent92cd05b8f2e994aabcdda5d7454c96a707dc9579 (diff)
downloadframeworks_av-d8cbe4a024ef54adf043b6ea31fa22271b8b2c51.zip
frameworks_av-d8cbe4a024ef54adf043b6ea31fa22271b8b2c51.tar.gz
frameworks_av-d8cbe4a024ef54adf043b6ea31fa22271b8b2c51.tar.bz2
stagefright: update ACodec to use CodecBase enumerations directly
Bug: 11784825 Change-Id: I9f322b78b52bfcc5040fda951486df4354cdba4f
-rw-r--r--cmds/stagefright/sf2.cpp22
-rw-r--r--include/media/stagefright/ACodec.h15
-rw-r--r--media/libstagefright/ACodec.cpp32
3 files changed, 24 insertions, 45 deletions
diff --git a/cmds/stagefright/sf2.cpp b/cmds/stagefright/sf2.cpp
index 3c0c7ec..0f729a3 100644
--- a/cmds/stagefright/sf2.cpp
+++ b/cmds/stagefright/sf2.cpp
@@ -211,28 +211,28 @@ protected:
int32_t what;
CHECK(msg->findInt32("what", &what));
- if (what == ACodec::kWhatFillThisBuffer) {
+ if (what == CodecBase::kWhatFillThisBuffer) {
onFillThisBuffer(msg);
- } else if (what == ACodec::kWhatDrainThisBuffer) {
+ } else if (what == CodecBase::kWhatDrainThisBuffer) {
if ((mNumOutputBuffersReceived++ % 16) == 0) {
printf(".");
fflush(stdout);
}
onDrainThisBuffer(msg);
- } else if (what == ACodec::kWhatEOS
- || what == ACodec::kWhatError) {
- printf((what == ACodec::kWhatEOS) ? "$\n" : "E\n");
+ } else if (what == CodecBase::kWhatEOS
+ || what == CodecBase::kWhatError) {
+ printf((what == CodecBase::kWhatEOS) ? "$\n" : "E\n");
printStatistics();
(new AMessage(kWhatStop, id()))->post();
- } else if (what == ACodec::kWhatFlushCompleted) {
+ } else if (what == CodecBase::kWhatFlushCompleted) {
mSeekState = SEEK_FLUSH_COMPLETED;
mCodec->signalResume();
(new AMessage(kWhatSeek, id()))->post(5000000ll);
- } else if (what == ACodec::kWhatOutputFormatChanged) {
- } else if (what == ACodec::kWhatShutdownCompleted) {
+ } else if (what == CodecBase::kWhatOutputFormatChanged) {
+ } else if (what == CodecBase::kWhatShutdownCompleted) {
mDecodeLooper->unregisterHandler(mCodec->id());
if (mDecodeLooper != looper()) {
@@ -240,12 +240,6 @@ protected:
}
looper()->stop();
- } else if (what == ACodec::kWhatError) {
- ALOGE("something went wrong, codec reported an error.");
-
- printf("E\n");
-
- (new AMessage(kWhatStop, id()))->post();
}
break;
}
diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h
index 14750c6..142b7cb 100644
--- a/include/media/stagefright/ACodec.h
+++ b/include/media/stagefright/ACodec.h
@@ -34,21 +34,6 @@ struct ABuffer;
struct MemoryDealer;
struct ACodec : public AHierarchicalStateMachine, public CodecBase {
- enum {
- kWhatFillThisBuffer = CodecBase::kWhatFillThisBuffer,
- kWhatDrainThisBuffer = CodecBase::kWhatDrainThisBuffer,
- kWhatEOS = CodecBase::kWhatEOS,
- kWhatShutdownCompleted = CodecBase::kWhatShutdownCompleted,
- kWhatFlushCompleted = CodecBase::kWhatFlushCompleted,
- kWhatOutputFormatChanged = CodecBase::kWhatOutputFormatChanged,
- kWhatError = CodecBase::kWhatError,
- kWhatComponentAllocated = CodecBase::kWhatComponentAllocated,
- kWhatComponentConfigured = CodecBase::kWhatComponentConfigured,
- kWhatInputSurfaceCreated = CodecBase::kWhatInputSurfaceCreated,
- kWhatSignaledInputEOS = CodecBase::kWhatSignaledInputEOS,
- kWhatBuffersAllocated = CodecBase::kWhatBuffersAllocated,
- };
-
ACodec();
virtual void setNotificationMessage(const sp<AMessage> &msg);
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 2a583d0..9c64d72 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -547,7 +547,7 @@ status_t ACodec::allocateBuffersOnPort(OMX_U32 portIndex) {
}
sp<AMessage> notify = mNotify->dup();
- notify->setInt32("what", ACodec::kWhatBuffersAllocated);
+ notify->setInt32("what", CodecBase::kWhatBuffersAllocated);
notify->setInt32("portIndex", portIndex);
@@ -3005,7 +3005,7 @@ void ACodec::sendFormatChange(const sp<AMessage> &reply) {
void ACodec::signalError(OMX_ERRORTYPE error, status_t internalError) {
sp<AMessage> notify = mNotify->dup();
- notify->setInt32("what", ACodec::kWhatError);
+ notify->setInt32("what", CodecBase::kWhatError);
notify->setInt32("omx-error", error);
notify->setInt32("err", internalError);
notify->post();
@@ -3398,7 +3398,7 @@ void ACodec::BaseState::postFillThisBuffer(BufferInfo *info) {
CHECK_EQ((int)info->mStatus, (int)BufferInfo::OWNED_BY_US);
sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatFillThisBuffer);
+ notify->setInt32("what", CodecBase::kWhatFillThisBuffer);
notify->setInt32("buffer-id", info->mBufferID);
info->mData->meta()->clear();
@@ -3693,7 +3693,7 @@ bool ACodec::BaseState::onOMXFillBufferDone(
info->mData->meta()->setInt64("timeUs", timeUs);
sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatDrainThisBuffer);
+ notify->setInt32("what", CodecBase::kWhatDrainThisBuffer);
notify->setInt32("buffer-id", info->mBufferID);
notify->setBuffer("buffer", info->mData);
notify->setInt32("flags", flags);
@@ -3710,7 +3710,7 @@ bool ACodec::BaseState::onOMXFillBufferDone(
ALOGV("[%s] saw output EOS", mCodec->mComponentName.c_str());
sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatEOS);
+ notify->setInt32("what", CodecBase::kWhatEOS);
notify->setInt32("err", mCodec->mInputEOSResult);
notify->post();
@@ -3891,7 +3891,7 @@ bool ACodec::UninitializedState::onMessageReceived(const sp<AMessage> &msg) {
"cannot keep component allocated on shutdown in Uninitialized state");
sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatShutdownCompleted);
+ notify->setInt32("what", CodecBase::kWhatShutdownCompleted);
notify->post();
handled = true;
@@ -3901,7 +3901,7 @@ bool ACodec::UninitializedState::onMessageReceived(const sp<AMessage> &msg) {
case ACodec::kWhatFlush:
{
sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatFlushCompleted);
+ notify->setInt32("what", CodecBase::kWhatFlushCompleted);
notify->post();
handled = true;
@@ -4023,7 +4023,7 @@ bool ACodec::UninitializedState::onAllocateComponent(const sp<AMessage> &msg) {
{
sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatComponentAllocated);
+ notify->setInt32("what", CodecBase::kWhatComponentAllocated);
notify->setString("componentName", mCodec->mComponentName.c_str());
notify->post();
}
@@ -4073,7 +4073,7 @@ void ACodec::LoadedState::onShutdown(bool keepComponentAllocated) {
if (mCodec->mExplicitShutdown) {
sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatShutdownCompleted);
+ notify->setInt32("what", CodecBase::kWhatShutdownCompleted);
notify->post();
mCodec->mExplicitShutdown = false;
}
@@ -4120,7 +4120,7 @@ bool ACodec::LoadedState::onMessageReceived(const sp<AMessage> &msg) {
case ACodec::kWhatFlush:
{
sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatFlushCompleted);
+ notify->setInt32("what", CodecBase::kWhatFlushCompleted);
notify->post();
handled = true;
@@ -4169,7 +4169,7 @@ bool ACodec::LoadedState::onConfigureComponent(
{
sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatComponentConfigured);
+ notify->setInt32("what", CodecBase::kWhatComponentConfigured);
notify->setMessage("input-format", mCodec->mInputFormat);
notify->setMessage("output-format", mCodec->mOutputFormat);
notify->post();
@@ -4183,7 +4183,7 @@ void ACodec::LoadedState::onCreateInputSurface(
ALOGV("onCreateInputSurface");
sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatInputSurfaceCreated);
+ notify->setInt32("what", CodecBase::kWhatInputSurfaceCreated);
sp<IGraphicBufferProducer> bufferProducer;
status_t err;
@@ -4337,7 +4337,7 @@ bool ACodec::LoadedToIdleState::onMessageReceived(const sp<AMessage> &msg) {
{
// We haven't even started yet, so we're flushed alright...
sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatFlushCompleted);
+ notify->setInt32("what", CodecBase::kWhatFlushCompleted);
notify->post();
return true;
}
@@ -4398,7 +4398,7 @@ bool ACodec::IdleToExecutingState::onMessageReceived(const sp<AMessage> &msg) {
{
// We haven't even started yet, so we're flushed alright...
sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatFlushCompleted);
+ notify->setInt32("what", CodecBase::kWhatFlushCompleted);
notify->post();
return true;
@@ -4701,7 +4701,7 @@ status_t ACodec::setParameters(const sp<AMessage> &params) {
void ACodec::onSignalEndOfInputStream() {
sp<AMessage> notify = mNotify->dup();
- notify->setInt32("what", ACodec::kWhatSignaledInputEOS);
+ notify->setInt32("what", CodecBase::kWhatSignaledInputEOS);
status_t err = mOMX->signalEndOfInputStream(mNode);
if (err != OK) {
@@ -5131,7 +5131,7 @@ void ACodec::FlushingState::changeStateIfWeOwnAllBuffers() {
mCodec->waitUntilAllPossibleNativeWindowBuffersAreReturnedToUs();
sp<AMessage> notify = mCodec->mNotify->dup();
- notify->setInt32("what", ACodec::kWhatFlushCompleted);
+ notify->setInt32("what", CodecBase::kWhatFlushCompleted);
notify->post();
mCodec->mPortEOS[kPortIndexInput] =