Loading media/libstagefright/OMXCodec.cpp +13 −11 Original line number Diff line number Diff line Loading @@ -293,6 +293,7 @@ sp<MediaSource> OMXCodec::Create( CHECK(success); #if BUILD_WITH_FULL_STAGEFRIGHT if (!createEncoder) { if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AAC)) { return new AACDecoder(source); } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AMR_NB)) { Loading @@ -305,6 +306,7 @@ sp<MediaSource> OMXCodec::Create( && (flags & kPreferSoftwareCodecs)) { return new AVCDecoder(source); } } #endif Vector<String8> matchingCodecs; Loading media/libstagefright/codecs/aacdec/AACDecoder.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -128,16 +128,18 @@ sp<MetaData> AACDecoder::getFormat() { int32_t numChannels; int32_t sampleRate; int64_t durationUs; CHECK(srcFormat->findInt32(kKeyChannelCount, &numChannels)); CHECK(srcFormat->findInt32(kKeySampleRate, &sampleRate)); CHECK(srcFormat->findInt64(kKeyDuration, &durationUs)); sp<MetaData> meta = new MetaData; meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_RAW); meta->setInt32(kKeyChannelCount, numChannels); meta->setInt32(kKeySampleRate, sampleRate); int64_t durationUs; if (srcFormat->findInt64(kKeyDuration, &durationUs)) { meta->setInt64(kKeyDuration, durationUs); } return meta; } Loading media/libstagefright/codecs/amrnb/dec/AMRNBDecoder.cpp +14 −7 Original line number Diff line number Diff line Loading @@ -87,7 +87,6 @@ sp<MetaData> AMRNBDecoder::getFormat() { int32_t numChannels; int32_t sampleRate; int64_t durationUs; CHECK(srcFormat->findInt32(kKeyChannelCount, &numChannels)); CHECK_EQ(numChannels, 1); Loading @@ -95,13 +94,15 @@ sp<MetaData> AMRNBDecoder::getFormat() { CHECK(srcFormat->findInt32(kKeySampleRate, &sampleRate)); CHECK_EQ(sampleRate, kSampleRate); CHECK(srcFormat->findInt64(kKeyDuration, &durationUs)); sp<MetaData> meta = new MetaData; meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_RAW); meta->setInt32(kKeyChannelCount, numChannels); meta->setInt32(kKeySampleRate, sampleRate); int64_t durationUs; if (srcFormat->findInt64(kKeyDuration, &durationUs)) { meta->setInt64(kKeyDuration, durationUs); } return meta; } Loading Loading @@ -160,10 +161,16 @@ status_t AMRNBDecoder::read( buffer->set_range(0, kNumSamplesPerFrame * sizeof(int16_t)); CHECK_EQ(numBytesRead, mInputBuffer->range_length()); CHECK(numBytesRead <= mInputBuffer->range_length()); mInputBuffer->set_range( mInputBuffer->range_offset() + numBytesRead, mInputBuffer->range_length() - numBytesRead); if (mInputBuffer->range_length() == 0) { mInputBuffer->release(); mInputBuffer = NULL; } buffer->meta_data()->setInt64( kKeyTime, Loading media/libstagefright/codecs/amrwb/AMRWBDecoder.cpp +14 −7 Original line number Diff line number Diff line Loading @@ -93,7 +93,6 @@ sp<MetaData> AMRWBDecoder::getFormat() { int32_t numChannels; int32_t sampleRate; int64_t durationUs; CHECK(srcFormat->findInt32(kKeyChannelCount, &numChannels)); CHECK_EQ(numChannels, 1); Loading @@ -101,13 +100,15 @@ sp<MetaData> AMRWBDecoder::getFormat() { CHECK(srcFormat->findInt32(kKeySampleRate, &sampleRate)); CHECK_EQ(sampleRate, kSampleRate); CHECK(srcFormat->findInt64(kKeyDuration, &durationUs)); sp<MetaData> meta = new MetaData; meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_RAW); meta->setInt32(kKeyChannelCount, numChannels); meta->setInt32(kKeySampleRate, sampleRate); int64_t durationUs; if (srcFormat->findInt64(kKeyDuration, &durationUs)) { meta->setInt64(kKeyDuration, durationUs); } return meta; } Loading Loading @@ -170,7 +171,7 @@ status_t AMRWBDecoder::read( int16 mode = ((inputPtr[0] >> 3) & 0x0f); size_t frameSize = getFrameSize(mode); CHECK_EQ(mInputBuffer->range_length(), frameSize); CHECK(mInputBuffer->range_length() >= frameSize); int16 frameType; RX_State rx_state; Loading @@ -197,8 +198,14 @@ status_t AMRWBDecoder::read( buffer->set_range(0, numSamplesOutput * sizeof(int16_t)); mInputBuffer->set_range( mInputBuffer->range_offset() + frameSize, mInputBuffer->range_length() - frameSize); if (mInputBuffer->range_length() == 0) { mInputBuffer->release(); mInputBuffer = NULL; } buffer->meta_data()->setInt64( kKeyTime, Loading media/libstagefright/codecs/avc/dec/AVCDecoder.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,11 @@ AVCDecoder::AVCDecoder(const sp<MediaSource> &source) mFormat->setInt32(kKeyHeight, height); mFormat->setInt32(kKeyColorFormat, OMX_COLOR_FormatYUV420Planar); mFormat->setCString(kKeyDecoderComponent, "AVCDecoder"); int64_t durationUs; if (mSource->getFormat()->findInt64(kKeyDuration, &durationUs)) { mFormat->setInt64(kKeyDuration, durationUs); } } AVCDecoder::~AVCDecoder() { Loading Loading
media/libstagefright/OMXCodec.cpp +13 −11 Original line number Diff line number Diff line Loading @@ -293,6 +293,7 @@ sp<MediaSource> OMXCodec::Create( CHECK(success); #if BUILD_WITH_FULL_STAGEFRIGHT if (!createEncoder) { if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AAC)) { return new AACDecoder(source); } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AMR_NB)) { Loading @@ -305,6 +306,7 @@ sp<MediaSource> OMXCodec::Create( && (flags & kPreferSoftwareCodecs)) { return new AVCDecoder(source); } } #endif Vector<String8> matchingCodecs; Loading
media/libstagefright/codecs/aacdec/AACDecoder.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -128,16 +128,18 @@ sp<MetaData> AACDecoder::getFormat() { int32_t numChannels; int32_t sampleRate; int64_t durationUs; CHECK(srcFormat->findInt32(kKeyChannelCount, &numChannels)); CHECK(srcFormat->findInt32(kKeySampleRate, &sampleRate)); CHECK(srcFormat->findInt64(kKeyDuration, &durationUs)); sp<MetaData> meta = new MetaData; meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_RAW); meta->setInt32(kKeyChannelCount, numChannels); meta->setInt32(kKeySampleRate, sampleRate); int64_t durationUs; if (srcFormat->findInt64(kKeyDuration, &durationUs)) { meta->setInt64(kKeyDuration, durationUs); } return meta; } Loading
media/libstagefright/codecs/amrnb/dec/AMRNBDecoder.cpp +14 −7 Original line number Diff line number Diff line Loading @@ -87,7 +87,6 @@ sp<MetaData> AMRNBDecoder::getFormat() { int32_t numChannels; int32_t sampleRate; int64_t durationUs; CHECK(srcFormat->findInt32(kKeyChannelCount, &numChannels)); CHECK_EQ(numChannels, 1); Loading @@ -95,13 +94,15 @@ sp<MetaData> AMRNBDecoder::getFormat() { CHECK(srcFormat->findInt32(kKeySampleRate, &sampleRate)); CHECK_EQ(sampleRate, kSampleRate); CHECK(srcFormat->findInt64(kKeyDuration, &durationUs)); sp<MetaData> meta = new MetaData; meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_RAW); meta->setInt32(kKeyChannelCount, numChannels); meta->setInt32(kKeySampleRate, sampleRate); int64_t durationUs; if (srcFormat->findInt64(kKeyDuration, &durationUs)) { meta->setInt64(kKeyDuration, durationUs); } return meta; } Loading Loading @@ -160,10 +161,16 @@ status_t AMRNBDecoder::read( buffer->set_range(0, kNumSamplesPerFrame * sizeof(int16_t)); CHECK_EQ(numBytesRead, mInputBuffer->range_length()); CHECK(numBytesRead <= mInputBuffer->range_length()); mInputBuffer->set_range( mInputBuffer->range_offset() + numBytesRead, mInputBuffer->range_length() - numBytesRead); if (mInputBuffer->range_length() == 0) { mInputBuffer->release(); mInputBuffer = NULL; } buffer->meta_data()->setInt64( kKeyTime, Loading
media/libstagefright/codecs/amrwb/AMRWBDecoder.cpp +14 −7 Original line number Diff line number Diff line Loading @@ -93,7 +93,6 @@ sp<MetaData> AMRWBDecoder::getFormat() { int32_t numChannels; int32_t sampleRate; int64_t durationUs; CHECK(srcFormat->findInt32(kKeyChannelCount, &numChannels)); CHECK_EQ(numChannels, 1); Loading @@ -101,13 +100,15 @@ sp<MetaData> AMRWBDecoder::getFormat() { CHECK(srcFormat->findInt32(kKeySampleRate, &sampleRate)); CHECK_EQ(sampleRate, kSampleRate); CHECK(srcFormat->findInt64(kKeyDuration, &durationUs)); sp<MetaData> meta = new MetaData; meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_RAW); meta->setInt32(kKeyChannelCount, numChannels); meta->setInt32(kKeySampleRate, sampleRate); int64_t durationUs; if (srcFormat->findInt64(kKeyDuration, &durationUs)) { meta->setInt64(kKeyDuration, durationUs); } return meta; } Loading Loading @@ -170,7 +171,7 @@ status_t AMRWBDecoder::read( int16 mode = ((inputPtr[0] >> 3) & 0x0f); size_t frameSize = getFrameSize(mode); CHECK_EQ(mInputBuffer->range_length(), frameSize); CHECK(mInputBuffer->range_length() >= frameSize); int16 frameType; RX_State rx_state; Loading @@ -197,8 +198,14 @@ status_t AMRWBDecoder::read( buffer->set_range(0, numSamplesOutput * sizeof(int16_t)); mInputBuffer->set_range( mInputBuffer->range_offset() + frameSize, mInputBuffer->range_length() - frameSize); if (mInputBuffer->range_length() == 0) { mInputBuffer->release(); mInputBuffer = NULL; } buffer->meta_data()->setInt64( kKeyTime, Loading
media/libstagefright/codecs/avc/dec/AVCDecoder.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,11 @@ AVCDecoder::AVCDecoder(const sp<MediaSource> &source) mFormat->setInt32(kKeyHeight, height); mFormat->setInt32(kKeyColorFormat, OMX_COLOR_FormatYUV420Planar); mFormat->setCString(kKeyDecoderComponent, "AVCDecoder"); int64_t durationUs; if (mSource->getFormat()->findInt64(kKeyDuration, &durationUs)) { mFormat->setInt64(kKeyDuration, durationUs); } } AVCDecoder::~AVCDecoder() { Loading