Loading cmds/stagefright/stagefright.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -345,12 +345,12 @@ int main(int argc, char **argv) { sp<IOMX> omx = service->getOMX(); CHECK(omx.get() != NULL); List<String8> list; List<IOMX::ComponentInfo> list; omx->listNodes(&list); for (List<String8>::iterator it = list.begin(); for (List<IOMX::ComponentInfo>::iterator it = list.begin(); it != list.end(); ++it) { printf("%s\n", (*it).string()); printf("%s\n", (*it).mName.string()); } } Loading include/media/IOMX.h +5 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,11 @@ public: typedef void *buffer_id; typedef void *node_id; virtual status_t listNodes(List<String8> *list) = 0; struct ComponentInfo { String8 mName; List<String8> mRoles; }; virtual status_t listNodes(List<ComponentInfo> *list) = 0; virtual status_t allocateNode( const char *name, const sp<IOMXObserver> &observer, Loading media/libmedia/IOMX.cpp +18 −6 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ public: : BpInterface<IOMX>(impl) { } virtual status_t listNodes(List<String8> *list) { virtual status_t listNodes(List<ComponentInfo> *list) { list->clear(); Parcel data, reply; Loading @@ -84,9 +84,14 @@ public: int32_t n = reply.readInt32(); for (int32_t i = 0; i < n; ++i) { String8 s = reply.readString8(); list->push_back(ComponentInfo()); ComponentInfo &info = *--list->end(); list->push_back(s); info.mName = reply.readString8(); int32_t numRoles = reply.readInt32(); for (int32_t j = 0; j < numRoles; ++j) { info.mRoles.push_back(reply.readString8()); } } return OK; Loading Loading @@ -368,13 +373,20 @@ status_t BnOMX::onTransact( { CHECK_INTERFACE(IOMX, data, reply); List<String8> list; List<ComponentInfo> list; listNodes(&list); reply->writeInt32(list.size()); for (List<String8>::iterator it = list.begin(); for (List<ComponentInfo>::iterator it = list.begin(); it != list.end(); ++it) { reply->writeString8(*it); ComponentInfo &cur = *it; reply->writeString8(cur.mName); reply->writeInt32(cur.mRoles.size()); for (List<String8>::iterator role_it = cur.mRoles.begin(); role_it != cur.mRoles.end(); ++role_it) { reply->writeString8(*role_it); } } return NO_ERROR; Loading media/libstagefright/MPEG4Extractor.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -534,8 +534,8 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) { uint16_t sample_size = U16_AT(&buffer[18]); uint32_t sample_rate = U32_AT(&buffer[24]) >> 16; printf("*** coding='%s' %d channels, size %d, rate %d\n", chunk, num_channels, sample_size, sample_rate); // printf("*** coding='%s' %d channels, size %d, rate %d\n", // chunk, num_channels, sample_size, sample_rate); mLastTrack->meta->setCString(kKeyMIMEType, FourCC2MIME(chunk_type)); mLastTrack->meta->setInt32(kKeyChannelCount, num_channels); Loading Loading @@ -576,8 +576,8 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) { uint16_t width = U16_AT(&buffer[6 + 18]); uint16_t height = U16_AT(&buffer[6 + 20]); printf("*** coding='%s' width=%d height=%d\n", chunk, width, height); // printf("*** coding='%s' width=%d height=%d\n", // chunk, width, height); mLastTrack->meta->setCString(kKeyMIMEType, FourCC2MIME(chunk_type)); mLastTrack->meta->setInt32(kKeyWidth, width); Loading media/libstagefright/OMXCodec.cpp +27 −24 Original line number Diff line number Diff line Loading @@ -425,14 +425,9 @@ sp<MediaSource> OMXCodec::Create( esds.getCodecSpecificInfo( &codec_specific_data, &codec_specific_data_size); printf("found codec-specific data of size %d\n", codec_specific_data_size); codec->addCodecSpecificData( codec_specific_data, codec_specific_data_size); } else if (meta->findData(kKeyAVCC, &type, &data, &size)) { printf("found avcc of size %d\n", size); // Parse the AVCDecoderConfigurationRecord const uint8_t *ptr = (const uint8_t *)data; Loading Loading @@ -1223,7 +1218,7 @@ status_t OMXCodec::allocateBuffersOnPort(OMX_U32 portIndex) { portIndex == kPortIndexInput ? "input" : "output"); } dumpPortStatus(portIndex); // dumpPortStatus(portIndex); return OK; } Loading Loading @@ -1273,7 +1268,6 @@ void OMXCodec::on_message(const omx_message &msg) { CHECK_EQ(mPortStatus[kPortIndexInput], ENABLED); drainInputBuffer(&buffers->editItemAt(i)); } break; } Loading @@ -1282,12 +1276,10 @@ void OMXCodec::on_message(const omx_message &msg) { IOMX::buffer_id buffer = msg.u.extended_buffer_data.buffer; OMX_U32 flags = msg.u.extended_buffer_data.flags; CODEC_LOGV("FILL_BUFFER_DONE(buffer: %p, size: %ld, flags: 0x%08lx)", CODEC_LOGV("FILL_BUFFER_DONE(buffer: %p, size: %ld, flags: 0x%08lx, timestamp: %lld us (%.2f secs))", buffer, msg.u.extended_buffer_data.range_length, flags); CODEC_LOGV("FILL_BUFFER_DONE(timestamp: %lld us (%.2f secs))", flags, msg.u.extended_buffer_data.timestamp, msg.u.extended_buffer_data.timestamp / 1E6); Loading Loading @@ -1315,11 +1307,13 @@ void OMXCodec::on_message(const omx_message &msg) { CHECK_EQ(err, OK); buffers->removeAt(i); #if 0 } else if (mPortStatus[kPortIndexOutput] == ENABLED && (flags & OMX_BUFFERFLAG_EOS)) { CODEC_LOGV("No more output data."); mNoMoreOutputData = true; mBufferFilled.signal(); #endif } else if (mPortStatus[kPortIndexOutput] != SHUTTING_DOWN) { CHECK_EQ(mPortStatus[kPortIndexOutput], ENABLED); Loading Loading @@ -1351,6 +1345,11 @@ void OMXCodec::on_message(const omx_message &msg) { mFilledBuffers.push_back(i); mBufferFilled.signal(); if (msg.u.extended_buffer_data.flags & OMX_BUFFERFLAG_EOS) { CODEC_LOGV("No more output data."); mNoMoreOutputData = true; } } break; Loading @@ -1374,7 +1373,7 @@ void OMXCodec::onEvent(OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) { case OMX_EventError: { LOGE("ERROR(%ld, %ld)", data1, data2); LOGE("ERROR(0x%08lx, %ld)", data1, data2); setState(ERROR); break; Loading @@ -1386,6 +1385,7 @@ void OMXCodec::onEvent(OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) { break; } #if 0 case OMX_EventBufferFlag: { CODEC_LOGV("EVENT_BUFFER_FLAG(%ld)", data1); Loading @@ -1395,6 +1395,7 @@ void OMXCodec::onEvent(OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) { } break; } #endif default: { Loading Loading @@ -1565,13 +1566,6 @@ void OMXCodec::onCmdComplete(OMX_COMMANDTYPE cmd, OMX_U32 data) { CODEC_LOGV("Finished flushing both ports, now continuing from" " seek-time."); // Clear this flag in case the decoder sent us either // the EVENT_BUFFER_FLAG(1) or an output buffer with // the EOS flag set _while_ flushing. Since we're going // to submit "fresh" input data now, this flag no longer // applies to our future. mNoMoreOutputData = false; drainInputBuffers(); fillOutputBuffers(); } Loading Loading @@ -1832,6 +1826,8 @@ void OMXCodec::drainInputBuffer(BufferInfo *info) { memcpy(info->mMem->pointer(), specific->mData, specific->mSize); } mNoMoreOutputData = false; status_t err = mOMX->emptyBuffer( mNode, info->mBuffer, 0, size, OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_CODECCONFIG, Loading @@ -1849,7 +1845,9 @@ void OMXCodec::drainInputBuffer(BufferInfo *info) { if (mSeekTimeUs >= 0) { MediaSource::ReadOptions options; options.setSeekTo(mSeekTimeUs); mSeekTimeUs = -1; mBufferFilled.signal(); err = mSource->read(&srcBuffer, &options); } else { Loading @@ -1866,6 +1864,8 @@ void OMXCodec::drainInputBuffer(BufferInfo *info) { mSignalledEOS = true; } else { mNoMoreOutputData = false; srcLength = srcBuffer->range_length(); if (info->mMem->size() < srcLength) { Loading @@ -1878,9 +1878,9 @@ void OMXCodec::drainInputBuffer(BufferInfo *info) { srcLength); if (srcBuffer->meta_data()->findInt64(kKeyTime, ×tampUs)) { CODEC_LOGV("Calling emptyBuffer on buffer %p (length %d)", info->mBuffer, srcLength); CODEC_LOGV("Calling emptyBuffer with timestamp %lld us (%.2f secs)", CODEC_LOGV("Calling emptyBuffer on buffer %p (length %d), " "timestamp %lld us (%.2f secs)", info->mBuffer, srcLength, timestampUs, timestampUs / 1E6); } } Loading Loading @@ -2298,7 +2298,6 @@ status_t OMXCodec::read( CODEC_LOGV("seeking to %lld us (%.2f secs)", seekTimeUs, seekTimeUs / 1E6); mSignalledEOS = false; mNoMoreOutputData = false; CHECK(seekTimeUs >= 0); mSeekTimeUs = seekTimeUs; Loading @@ -2317,6 +2316,10 @@ status_t OMXCodec::read( if (emulateOutputFlushCompletion) { onCmdComplete(OMX_CommandFlush, kPortIndexOutput); } while (mSeekTimeUs >= 0) { mBufferFilled.wait(mLock); } } while (mState != ERROR && !mNoMoreOutputData && mFilledBuffers.empty()) { Loading Loading
cmds/stagefright/stagefright.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -345,12 +345,12 @@ int main(int argc, char **argv) { sp<IOMX> omx = service->getOMX(); CHECK(omx.get() != NULL); List<String8> list; List<IOMX::ComponentInfo> list; omx->listNodes(&list); for (List<String8>::iterator it = list.begin(); for (List<IOMX::ComponentInfo>::iterator it = list.begin(); it != list.end(); ++it) { printf("%s\n", (*it).string()); printf("%s\n", (*it).mName.string()); } } Loading
include/media/IOMX.h +5 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,11 @@ public: typedef void *buffer_id; typedef void *node_id; virtual status_t listNodes(List<String8> *list) = 0; struct ComponentInfo { String8 mName; List<String8> mRoles; }; virtual status_t listNodes(List<ComponentInfo> *list) = 0; virtual status_t allocateNode( const char *name, const sp<IOMXObserver> &observer, Loading
media/libmedia/IOMX.cpp +18 −6 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ public: : BpInterface<IOMX>(impl) { } virtual status_t listNodes(List<String8> *list) { virtual status_t listNodes(List<ComponentInfo> *list) { list->clear(); Parcel data, reply; Loading @@ -84,9 +84,14 @@ public: int32_t n = reply.readInt32(); for (int32_t i = 0; i < n; ++i) { String8 s = reply.readString8(); list->push_back(ComponentInfo()); ComponentInfo &info = *--list->end(); list->push_back(s); info.mName = reply.readString8(); int32_t numRoles = reply.readInt32(); for (int32_t j = 0; j < numRoles; ++j) { info.mRoles.push_back(reply.readString8()); } } return OK; Loading Loading @@ -368,13 +373,20 @@ status_t BnOMX::onTransact( { CHECK_INTERFACE(IOMX, data, reply); List<String8> list; List<ComponentInfo> list; listNodes(&list); reply->writeInt32(list.size()); for (List<String8>::iterator it = list.begin(); for (List<ComponentInfo>::iterator it = list.begin(); it != list.end(); ++it) { reply->writeString8(*it); ComponentInfo &cur = *it; reply->writeString8(cur.mName); reply->writeInt32(cur.mRoles.size()); for (List<String8>::iterator role_it = cur.mRoles.begin(); role_it != cur.mRoles.end(); ++role_it) { reply->writeString8(*role_it); } } return NO_ERROR; Loading
media/libstagefright/MPEG4Extractor.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -534,8 +534,8 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) { uint16_t sample_size = U16_AT(&buffer[18]); uint32_t sample_rate = U32_AT(&buffer[24]) >> 16; printf("*** coding='%s' %d channels, size %d, rate %d\n", chunk, num_channels, sample_size, sample_rate); // printf("*** coding='%s' %d channels, size %d, rate %d\n", // chunk, num_channels, sample_size, sample_rate); mLastTrack->meta->setCString(kKeyMIMEType, FourCC2MIME(chunk_type)); mLastTrack->meta->setInt32(kKeyChannelCount, num_channels); Loading Loading @@ -576,8 +576,8 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) { uint16_t width = U16_AT(&buffer[6 + 18]); uint16_t height = U16_AT(&buffer[6 + 20]); printf("*** coding='%s' width=%d height=%d\n", chunk, width, height); // printf("*** coding='%s' width=%d height=%d\n", // chunk, width, height); mLastTrack->meta->setCString(kKeyMIMEType, FourCC2MIME(chunk_type)); mLastTrack->meta->setInt32(kKeyWidth, width); Loading
media/libstagefright/OMXCodec.cpp +27 −24 Original line number Diff line number Diff line Loading @@ -425,14 +425,9 @@ sp<MediaSource> OMXCodec::Create( esds.getCodecSpecificInfo( &codec_specific_data, &codec_specific_data_size); printf("found codec-specific data of size %d\n", codec_specific_data_size); codec->addCodecSpecificData( codec_specific_data, codec_specific_data_size); } else if (meta->findData(kKeyAVCC, &type, &data, &size)) { printf("found avcc of size %d\n", size); // Parse the AVCDecoderConfigurationRecord const uint8_t *ptr = (const uint8_t *)data; Loading Loading @@ -1223,7 +1218,7 @@ status_t OMXCodec::allocateBuffersOnPort(OMX_U32 portIndex) { portIndex == kPortIndexInput ? "input" : "output"); } dumpPortStatus(portIndex); // dumpPortStatus(portIndex); return OK; } Loading Loading @@ -1273,7 +1268,6 @@ void OMXCodec::on_message(const omx_message &msg) { CHECK_EQ(mPortStatus[kPortIndexInput], ENABLED); drainInputBuffer(&buffers->editItemAt(i)); } break; } Loading @@ -1282,12 +1276,10 @@ void OMXCodec::on_message(const omx_message &msg) { IOMX::buffer_id buffer = msg.u.extended_buffer_data.buffer; OMX_U32 flags = msg.u.extended_buffer_data.flags; CODEC_LOGV("FILL_BUFFER_DONE(buffer: %p, size: %ld, flags: 0x%08lx)", CODEC_LOGV("FILL_BUFFER_DONE(buffer: %p, size: %ld, flags: 0x%08lx, timestamp: %lld us (%.2f secs))", buffer, msg.u.extended_buffer_data.range_length, flags); CODEC_LOGV("FILL_BUFFER_DONE(timestamp: %lld us (%.2f secs))", flags, msg.u.extended_buffer_data.timestamp, msg.u.extended_buffer_data.timestamp / 1E6); Loading Loading @@ -1315,11 +1307,13 @@ void OMXCodec::on_message(const omx_message &msg) { CHECK_EQ(err, OK); buffers->removeAt(i); #if 0 } else if (mPortStatus[kPortIndexOutput] == ENABLED && (flags & OMX_BUFFERFLAG_EOS)) { CODEC_LOGV("No more output data."); mNoMoreOutputData = true; mBufferFilled.signal(); #endif } else if (mPortStatus[kPortIndexOutput] != SHUTTING_DOWN) { CHECK_EQ(mPortStatus[kPortIndexOutput], ENABLED); Loading Loading @@ -1351,6 +1345,11 @@ void OMXCodec::on_message(const omx_message &msg) { mFilledBuffers.push_back(i); mBufferFilled.signal(); if (msg.u.extended_buffer_data.flags & OMX_BUFFERFLAG_EOS) { CODEC_LOGV("No more output data."); mNoMoreOutputData = true; } } break; Loading @@ -1374,7 +1373,7 @@ void OMXCodec::onEvent(OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) { case OMX_EventError: { LOGE("ERROR(%ld, %ld)", data1, data2); LOGE("ERROR(0x%08lx, %ld)", data1, data2); setState(ERROR); break; Loading @@ -1386,6 +1385,7 @@ void OMXCodec::onEvent(OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) { break; } #if 0 case OMX_EventBufferFlag: { CODEC_LOGV("EVENT_BUFFER_FLAG(%ld)", data1); Loading @@ -1395,6 +1395,7 @@ void OMXCodec::onEvent(OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) { } break; } #endif default: { Loading Loading @@ -1565,13 +1566,6 @@ void OMXCodec::onCmdComplete(OMX_COMMANDTYPE cmd, OMX_U32 data) { CODEC_LOGV("Finished flushing both ports, now continuing from" " seek-time."); // Clear this flag in case the decoder sent us either // the EVENT_BUFFER_FLAG(1) or an output buffer with // the EOS flag set _while_ flushing. Since we're going // to submit "fresh" input data now, this flag no longer // applies to our future. mNoMoreOutputData = false; drainInputBuffers(); fillOutputBuffers(); } Loading Loading @@ -1832,6 +1826,8 @@ void OMXCodec::drainInputBuffer(BufferInfo *info) { memcpy(info->mMem->pointer(), specific->mData, specific->mSize); } mNoMoreOutputData = false; status_t err = mOMX->emptyBuffer( mNode, info->mBuffer, 0, size, OMX_BUFFERFLAG_ENDOFFRAME | OMX_BUFFERFLAG_CODECCONFIG, Loading @@ -1849,7 +1845,9 @@ void OMXCodec::drainInputBuffer(BufferInfo *info) { if (mSeekTimeUs >= 0) { MediaSource::ReadOptions options; options.setSeekTo(mSeekTimeUs); mSeekTimeUs = -1; mBufferFilled.signal(); err = mSource->read(&srcBuffer, &options); } else { Loading @@ -1866,6 +1864,8 @@ void OMXCodec::drainInputBuffer(BufferInfo *info) { mSignalledEOS = true; } else { mNoMoreOutputData = false; srcLength = srcBuffer->range_length(); if (info->mMem->size() < srcLength) { Loading @@ -1878,9 +1878,9 @@ void OMXCodec::drainInputBuffer(BufferInfo *info) { srcLength); if (srcBuffer->meta_data()->findInt64(kKeyTime, ×tampUs)) { CODEC_LOGV("Calling emptyBuffer on buffer %p (length %d)", info->mBuffer, srcLength); CODEC_LOGV("Calling emptyBuffer with timestamp %lld us (%.2f secs)", CODEC_LOGV("Calling emptyBuffer on buffer %p (length %d), " "timestamp %lld us (%.2f secs)", info->mBuffer, srcLength, timestampUs, timestampUs / 1E6); } } Loading Loading @@ -2298,7 +2298,6 @@ status_t OMXCodec::read( CODEC_LOGV("seeking to %lld us (%.2f secs)", seekTimeUs, seekTimeUs / 1E6); mSignalledEOS = false; mNoMoreOutputData = false; CHECK(seekTimeUs >= 0); mSeekTimeUs = seekTimeUs; Loading @@ -2317,6 +2316,10 @@ status_t OMXCodec::read( if (emulateOutputFlushCompletion) { onCmdComplete(OMX_CommandFlush, kPortIndexOutput); } while (mSeekTimeUs >= 0) { mBufferFilled.wait(mLock); } } while (mState != ERROR && !mNoMoreOutputData && mFilledBuffers.empty()) { Loading