summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2012-12-17 16:35:08 -0800
committerMarco Nelissen <marcone@google.com>2012-12-18 15:16:00 -0800
commit6fc72b01a3b67903b52f1d33b1ad5c960b5365f1 (patch)
tree329c9f306defb16fb17e085af0596bb9a6be4718
parent53bc0a2fc54330534330118edd5c393f39eff8ab (diff)
downloadframeworks_av-6fc72b01a3b67903b52f1d33b1ad5c960b5365f1.zip
frameworks_av-6fc72b01a3b67903b52f1d33b1ad5c960b5365f1.tar.gz
frameworks_av-6fc72b01a3b67903b52f1d33b1ad5c960b5365f1.tar.bz2
Make codecs reconfigurable
Change-Id: I3dd46cb4401493becbf6152f4dcd5a8f1e9a0b44
-rw-r--r--media/libstagefright/codecs/aacdec/SoftAAC2.cpp5
-rw-r--r--media/libstagefright/codecs/aacdec/SoftAAC2.h1
-rw-r--r--media/libstagefright/codecs/mp3dec/SoftMP3.cpp5
-rw-r--r--media/libstagefright/codecs/mp3dec/SoftMP3.h1
-rw-r--r--media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp5
-rw-r--r--media/libstagefright/codecs/vorbis/dec/SoftVorbis.h1
-rw-r--r--media/libstagefright/include/SimpleSoftOMXComponent.h1
-rw-r--r--media/libstagefright/omx/SimpleSoftOMXComponent.cpp8
8 files changed, 27 insertions, 0 deletions
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
index d88813e..a8ab2ac 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
+++ b/media/libstagefright/codecs/aacdec/SoftAAC2.cpp
@@ -594,6 +594,11 @@ void SoftAAC2::onPortFlushCompleted(OMX_U32 portIndex) {
}
}
+void SoftAAC2::onReset() {
+ aacDecoder_SetParam(mAACDecoder, AAC_TPDEC_CLEAR_BUFFER, 1);
+ mIsFirst = true;
+}
+
void SoftAAC2::onPortEnableCompleted(OMX_U32 portIndex, bool enabled) {
if (portIndex != 1) {
return;
diff --git a/media/libstagefright/codecs/aacdec/SoftAAC2.h b/media/libstagefright/codecs/aacdec/SoftAAC2.h
index 0353196..6957ade 100644
--- a/media/libstagefright/codecs/aacdec/SoftAAC2.h
+++ b/media/libstagefright/codecs/aacdec/SoftAAC2.h
@@ -41,6 +41,7 @@ protected:
virtual void onQueueFilled(OMX_U32 portIndex);
virtual void onPortFlushCompleted(OMX_U32 portIndex);
virtual void onPortEnableCompleted(OMX_U32 portIndex, bool enabled);
+ virtual void onReset();
private:
enum {
diff --git a/media/libstagefright/codecs/mp3dec/SoftMP3.cpp b/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
index fb1135c..849be87 100644
--- a/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
+++ b/media/libstagefright/codecs/mp3dec/SoftMP3.cpp
@@ -343,6 +343,11 @@ void SoftMP3::onPortEnableCompleted(OMX_U32 portIndex, bool enabled) {
}
}
+void SoftMP3::onReset() {
+ pvmp3_InitDecoder(mConfig, mDecoderBuf);
+ mIsFirst = true;
+}
+
} // namespace android
android::SoftOMXComponent *createSoftOMXComponent(
diff --git a/media/libstagefright/codecs/mp3dec/SoftMP3.h b/media/libstagefright/codecs/mp3dec/SoftMP3.h
index 3a05466..4af91ea 100644
--- a/media/libstagefright/codecs/mp3dec/SoftMP3.h
+++ b/media/libstagefright/codecs/mp3dec/SoftMP3.h
@@ -42,6 +42,7 @@ protected:
virtual void onQueueFilled(OMX_U32 portIndex);
virtual void onPortFlushCompleted(OMX_U32 portIndex);
virtual void onPortEnableCompleted(OMX_U32 portIndex, bool enabled);
+ virtual void onReset();
private:
enum {
diff --git a/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp b/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp
index ac88107..13dfc8c 100644
--- a/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp
+++ b/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp
@@ -410,6 +410,11 @@ void SoftVorbis::onPortFlushCompleted(OMX_U32 portIndex) {
}
}
+void SoftVorbis::onReset() {
+ mNumFramesOutput = 0;
+ vorbis_dsp_restart(mState);
+}
+
void SoftVorbis::onPortEnableCompleted(OMX_U32 portIndex, bool enabled) {
if (portIndex != 1) {
return;
diff --git a/media/libstagefright/codecs/vorbis/dec/SoftVorbis.h b/media/libstagefright/codecs/vorbis/dec/SoftVorbis.h
index e252f55..cb628a0 100644
--- a/media/libstagefright/codecs/vorbis/dec/SoftVorbis.h
+++ b/media/libstagefright/codecs/vorbis/dec/SoftVorbis.h
@@ -43,6 +43,7 @@ protected:
virtual void onQueueFilled(OMX_U32 portIndex);
virtual void onPortFlushCompleted(OMX_U32 portIndex);
virtual void onPortEnableCompleted(OMX_U32 portIndex, bool enabled);
+ virtual void onReset();
private:
enum {
diff --git a/media/libstagefright/include/SimpleSoftOMXComponent.h b/media/libstagefright/include/SimpleSoftOMXComponent.h
index 50cd275..f8c61eb 100644
--- a/media/libstagefright/include/SimpleSoftOMXComponent.h
+++ b/media/libstagefright/include/SimpleSoftOMXComponent.h
@@ -71,6 +71,7 @@ protected:
virtual void onPortFlushCompleted(OMX_U32 portIndex);
virtual void onPortEnableCompleted(OMX_U32 portIndex, bool enabled);
+ virtual void onReset();
PortInfo *editPortInfo(OMX_U32 portIndex);
diff --git a/media/libstagefright/omx/SimpleSoftOMXComponent.cpp b/media/libstagefright/omx/SimpleSoftOMXComponent.cpp
index c79e01f..4999663 100644
--- a/media/libstagefright/omx/SimpleSoftOMXComponent.cpp
+++ b/media/libstagefright/omx/SimpleSoftOMXComponent.cpp
@@ -450,6 +450,10 @@ void SimpleSoftOMXComponent::onChangeState(OMX_STATETYPE state) {
checkTransitions();
}
+void SimpleSoftOMXComponent::onReset() {
+ // no-op
+}
+
void SimpleSoftOMXComponent::onPortEnable(OMX_U32 portIndex, bool enable) {
CHECK_LT(portIndex, mPorts.size());
@@ -581,6 +585,10 @@ void SimpleSoftOMXComponent::checkTransitions() {
if (transitionComplete) {
mState = mTargetState;
+ if (mState == OMX_StateLoaded) {
+ onReset();
+ }
+
notify(OMX_EventCmdComplete, OMX_CommandStateSet, mState, NULL);
}
}