Loading include/media/stagefright/ACodec.h +17 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,23 @@ struct ACodec : public AHierarchicalStateMachine { void initiateConfigureComponent(const sp<AMessage> &msg); void initiateStart(); struct PortDescription : public RefBase { size_t countBuffers(); IOMX::buffer_id bufferIDAt(size_t index) const; sp<ABuffer> bufferAt(size_t index) const; private: friend struct ACodec; Vector<IOMX::buffer_id> mBufferIDs; Vector<sp<ABuffer> > mBuffers; PortDescription(); void addBuffer(IOMX::buffer_id id, const sp<ABuffer> &buffer); DISALLOW_EVIL_CONSTRUCTORS(PortDescription); }; protected: virtual ~ACodec(); Loading media/libstagefright/ACodec.cpp +29 −4 Original line number Diff line number Diff line Loading @@ -472,14 +472,16 @@ status_t ACodec::allocateBuffersOnPort(OMX_U32 portIndex) { notify->setInt32("what", ACodec::kWhatBuffersAllocated); notify->setInt32("portIndex", portIndex); sp<PortDescription> desc = new PortDescription; for (size_t i = 0; i < mBuffers[portIndex].size(); ++i) { AString name = StringPrintf("buffer-id_%d", i); notify->setPointer(name.c_str(), mBuffers[portIndex][i].mBufferID); const BufferInfo &info = mBuffers[portIndex][i]; name = StringPrintf("data_%d", i); notify->setBuffer(name.c_str(), mBuffers[portIndex][i].mData); desc->addBuffer(info.mBufferID, info.mData); } notify->setObject("portDesc", desc); notify->post(); return OK; Loading Loading @@ -2110,6 +2112,29 @@ void ACodec::signalError(OMX_ERRORTYPE error, status_t internalError) { //////////////////////////////////////////////////////////////////////////////// ACodec::PortDescription::PortDescription() { } void ACodec::PortDescription::addBuffer( IOMX::buffer_id id, const sp<ABuffer> &buffer) { mBufferIDs.push_back(id); mBuffers.push_back(buffer); } size_t ACodec::PortDescription::countBuffers() { return mBufferIDs.size(); } IOMX::buffer_id ACodec::PortDescription::bufferIDAt(size_t index) const { return mBufferIDs.itemAt(index); } sp<ABuffer> ACodec::PortDescription::bufferAt(size_t index) const { return mBuffers.itemAt(index); } //////////////////////////////////////////////////////////////////////////////// ACodec::BaseState::BaseState(ACodec *codec, const sp<AState> &parentState) : AState(parentState), mCodec(codec) { Loading media/libstagefright/MediaCodec.cpp +9 −9 Original line number Diff line number Diff line Loading @@ -562,20 +562,20 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { mPortBuffers[portIndex].clear(); Vector<BufferInfo> *buffers = &mPortBuffers[portIndex]; for (size_t i = 0;; ++i) { AString name = StringPrintf("buffer-id_%d", i); void *bufferID; if (!msg->findPointer(name.c_str(), &bufferID)) { break; } sp<RefBase> obj; CHECK(msg->findObject("portDesc", &obj)); sp<ACodec::PortDescription> portDesc = static_cast<ACodec::PortDescription *>(obj.get()); name = StringPrintf("data_%d", i); size_t numBuffers = portDesc->countBuffers(); for (size_t i = 0; i < numBuffers; ++i) { BufferInfo info; info.mBufferID = bufferID; info.mBufferID = portDesc->bufferIDAt(i); info.mOwnedByClient = false; CHECK(msg->findBuffer(name.c_str(), &info.mData)); info.mData = portDesc->bufferAt(i); if (portIndex == kPortIndexInput && mCrypto != NULL) { info.mEncryptedData = Loading media/libstagefright/codecs/aacdec/SoftAAC.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ void SoftAAC::initPorts() { def.nPortIndex = 0; def.eDir = OMX_DirInput; def.nBufferCountMin = kNumBuffers; def.nBufferCountMin = kNumInputBuffers; def.nBufferCountActual = def.nBufferCountMin; def.nBufferSize = 8192; def.bEnabled = OMX_TRUE; Loading @@ -87,7 +87,7 @@ void SoftAAC::initPorts() { def.nPortIndex = 1; def.eDir = OMX_DirOutput; def.nBufferCountMin = kNumBuffers; def.nBufferCountMin = kNumOutputBuffers; def.nBufferCountActual = def.nBufferCountMin; def.nBufferSize = 8192; def.bEnabled = OMX_TRUE; Loading media/libstagefright/codecs/aacdec/SoftAAC.h +2 −1 Original line number Diff line number Diff line Loading @@ -45,7 +45,8 @@ protected: private: enum { kNumBuffers = 4 kNumInputBuffers = 32, kNumOutputBuffers = 4, }; tPVMP4AudioDecoderExternal *mConfig; Loading Loading
include/media/stagefright/ACodec.h +17 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,23 @@ struct ACodec : public AHierarchicalStateMachine { void initiateConfigureComponent(const sp<AMessage> &msg); void initiateStart(); struct PortDescription : public RefBase { size_t countBuffers(); IOMX::buffer_id bufferIDAt(size_t index) const; sp<ABuffer> bufferAt(size_t index) const; private: friend struct ACodec; Vector<IOMX::buffer_id> mBufferIDs; Vector<sp<ABuffer> > mBuffers; PortDescription(); void addBuffer(IOMX::buffer_id id, const sp<ABuffer> &buffer); DISALLOW_EVIL_CONSTRUCTORS(PortDescription); }; protected: virtual ~ACodec(); Loading
media/libstagefright/ACodec.cpp +29 −4 Original line number Diff line number Diff line Loading @@ -472,14 +472,16 @@ status_t ACodec::allocateBuffersOnPort(OMX_U32 portIndex) { notify->setInt32("what", ACodec::kWhatBuffersAllocated); notify->setInt32("portIndex", portIndex); sp<PortDescription> desc = new PortDescription; for (size_t i = 0; i < mBuffers[portIndex].size(); ++i) { AString name = StringPrintf("buffer-id_%d", i); notify->setPointer(name.c_str(), mBuffers[portIndex][i].mBufferID); const BufferInfo &info = mBuffers[portIndex][i]; name = StringPrintf("data_%d", i); notify->setBuffer(name.c_str(), mBuffers[portIndex][i].mData); desc->addBuffer(info.mBufferID, info.mData); } notify->setObject("portDesc", desc); notify->post(); return OK; Loading Loading @@ -2110,6 +2112,29 @@ void ACodec::signalError(OMX_ERRORTYPE error, status_t internalError) { //////////////////////////////////////////////////////////////////////////////// ACodec::PortDescription::PortDescription() { } void ACodec::PortDescription::addBuffer( IOMX::buffer_id id, const sp<ABuffer> &buffer) { mBufferIDs.push_back(id); mBuffers.push_back(buffer); } size_t ACodec::PortDescription::countBuffers() { return mBufferIDs.size(); } IOMX::buffer_id ACodec::PortDescription::bufferIDAt(size_t index) const { return mBufferIDs.itemAt(index); } sp<ABuffer> ACodec::PortDescription::bufferAt(size_t index) const { return mBuffers.itemAt(index); } //////////////////////////////////////////////////////////////////////////////// ACodec::BaseState::BaseState(ACodec *codec, const sp<AState> &parentState) : AState(parentState), mCodec(codec) { Loading
media/libstagefright/MediaCodec.cpp +9 −9 Original line number Diff line number Diff line Loading @@ -562,20 +562,20 @@ void MediaCodec::onMessageReceived(const sp<AMessage> &msg) { mPortBuffers[portIndex].clear(); Vector<BufferInfo> *buffers = &mPortBuffers[portIndex]; for (size_t i = 0;; ++i) { AString name = StringPrintf("buffer-id_%d", i); void *bufferID; if (!msg->findPointer(name.c_str(), &bufferID)) { break; } sp<RefBase> obj; CHECK(msg->findObject("portDesc", &obj)); sp<ACodec::PortDescription> portDesc = static_cast<ACodec::PortDescription *>(obj.get()); name = StringPrintf("data_%d", i); size_t numBuffers = portDesc->countBuffers(); for (size_t i = 0; i < numBuffers; ++i) { BufferInfo info; info.mBufferID = bufferID; info.mBufferID = portDesc->bufferIDAt(i); info.mOwnedByClient = false; CHECK(msg->findBuffer(name.c_str(), &info.mData)); info.mData = portDesc->bufferAt(i); if (portIndex == kPortIndexInput && mCrypto != NULL) { info.mEncryptedData = Loading
media/libstagefright/codecs/aacdec/SoftAAC.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ void SoftAAC::initPorts() { def.nPortIndex = 0; def.eDir = OMX_DirInput; def.nBufferCountMin = kNumBuffers; def.nBufferCountMin = kNumInputBuffers; def.nBufferCountActual = def.nBufferCountMin; def.nBufferSize = 8192; def.bEnabled = OMX_TRUE; Loading @@ -87,7 +87,7 @@ void SoftAAC::initPorts() { def.nPortIndex = 1; def.eDir = OMX_DirOutput; def.nBufferCountMin = kNumBuffers; def.nBufferCountMin = kNumOutputBuffers; def.nBufferCountActual = def.nBufferCountMin; def.nBufferSize = 8192; def.bEnabled = OMX_TRUE; Loading
media/libstagefright/codecs/aacdec/SoftAAC.h +2 −1 Original line number Diff line number Diff line Loading @@ -45,7 +45,8 @@ protected: private: enum { kNumBuffers = 4 kNumInputBuffers = 32, kNumOutputBuffers = 4, }; tPVMP4AudioDecoderExternal *mConfig; Loading