diff options
| author | Dongwon Kang <dwkang@google.com> | 2018-02-01 13:44:57 -0800 |
|---|---|---|
| committer | Dongwon Kang <dwkang@google.com> | 2018-02-12 23:59:34 -0800 |
| commit | 1889c3edad32995c0cf26ae2248fe7c957b7ec84 (patch) | |
| tree | 5a4bd7fec36d039f75d04124b46d6295ac65e200 /cmds | |
| parent | 405b3c70ccf6c6671fbbe72557a8493e4e0f6097 (diff) | |
| download | frameworks_av-1889c3edad32995c0cf26ae2248fe7c957b7ec84.tar.gz frameworks_av-1889c3edad32995c0cf26ae2248fe7c957b7ec84.tar.bz2 frameworks_av-1889c3edad32995c0cf26ae2248fe7c957b7ec84.zip | |
Add MediaBufferBase and use it in MediaSource and MediaBufferGroup.
MediaBuffer class exposes internal classes, ABuffer and IMemory, which
we don't want to expose to plugins. This change introduces
MediaBufferBase which does not expose any classes from system library.
Test: build and post-submit media cts tests
Bug: 67908556
Change-Id: Ic9ee239caf9b84b2b3740e2d533257afa25c8784
Diffstat (limited to 'cmds')
| -rw-r--r-- | cmds/stagefright/SineSource.cpp | 5 | ||||
| -rw-r--r-- | cmds/stagefright/SineSource.h | 2 | ||||
| -rw-r--r-- | cmds/stagefright/audioloop.cpp | 2 | ||||
| -rw-r--r-- | cmds/stagefright/record.cpp | 2 | ||||
| -rw-r--r-- | cmds/stagefright/recordvideo.cpp | 2 | ||||
| -rw-r--r-- | cmds/stagefright/stagefright.cpp | 14 |
6 files changed, 14 insertions, 13 deletions
diff --git a/cmds/stagefright/SineSource.cpp b/cmds/stagefright/SineSource.cpp index cad8caff67..9e40a0fc26 100644 --- a/cmds/stagefright/SineSource.cpp +++ b/cmds/stagefright/SineSource.cpp @@ -4,6 +4,7 @@ #include <media/stagefright/MediaBufferGroup.h> #include <media/stagefright/foundation/ADebug.h> +#include <media/stagefright/MediaBuffer.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MetaData.h> @@ -59,10 +60,10 @@ sp<MetaData> SineSource::getFormat() { } status_t SineSource::read( - MediaBuffer **out, const ReadOptions * /* options */) { + MediaBufferBase **out, const ReadOptions * /* options */) { *out = NULL; - MediaBuffer *buffer; + MediaBufferBase *buffer; status_t err = mGroup->acquire_buffer(&buffer); if (err != OK) { diff --git a/cmds/stagefright/SineSource.h b/cmds/stagefright/SineSource.h index f1fb96dcc8..1817291e8a 100644 --- a/cmds/stagefright/SineSource.h +++ b/cmds/stagefright/SineSource.h @@ -18,7 +18,7 @@ struct SineSource : public MediaSource { virtual sp<MetaData> getFormat(); virtual status_t read( - MediaBuffer **out, const ReadOptions *options = NULL); + MediaBufferBase **out, const ReadOptions *options = NULL); protected: virtual ~SineSource(); diff --git a/cmds/stagefright/audioloop.cpp b/cmds/stagefright/audioloop.cpp index fc246461ed..d4f2e8d8d4 100644 --- a/cmds/stagefright/audioloop.cpp +++ b/cmds/stagefright/audioloop.cpp @@ -169,7 +169,7 @@ ALOGI("Line: %d", __LINE__); ALOGI("Line: %d", __LINE__); } else { CHECK_EQ(decoder->start(), (status_t)OK); - MediaBuffer* buffer; + MediaBufferBase* buffer; while (decoder->read(&buffer) == OK) { // do something with buffer (save it eventually?) // need to stop after some count though... diff --git a/cmds/stagefright/record.cpp b/cmds/stagefright/record.cpp index 073ee6bf42..44b0015f0f 100644 --- a/cmds/stagefright/record.cpp +++ b/cmds/stagefright/record.cpp @@ -328,7 +328,7 @@ int main(int /* argc */, char ** /* argv */) { int32_t n = 0; status_t err; - MediaBuffer *buffer; + MediaBufferBase *buffer; while ((err = encoder->read(&buffer)) == OK) { printf("."); fflush(stdout); diff --git a/cmds/stagefright/recordvideo.cpp b/cmds/stagefright/recordvideo.cpp index af39d4624b..b7a5066c04 100644 --- a/cmds/stagefright/recordvideo.cpp +++ b/cmds/stagefright/recordvideo.cpp @@ -90,7 +90,7 @@ public: } virtual status_t read( - MediaBuffer **buffer, const MediaSource::ReadOptions *options __unused) { + MediaBufferBase **buffer, const MediaSource::ReadOptions *options __unused) { if (mNumFramesOutput % 10 == 0) { fprintf(stderr, "."); diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp index bb517aae7d..5fa830461f 100644 --- a/cmds/stagefright/stagefright.cpp +++ b/cmds/stagefright/stagefright.cpp @@ -150,7 +150,7 @@ static void dumpSource(const sp<MediaSource> &source, const String8 &filename) { status_t err; for (;;) { - MediaBuffer *mbuf; + MediaBufferBase *mbuf; err = source->read(&mbuf); if (err == INFO_FORMAT_CHANGED) { @@ -234,7 +234,7 @@ static void playSource(sp<MediaSource> &source) { CHECK(meta->findInt64(kKeyDuration, &durationUs)); status_t err; - MediaBuffer *buffer; + MediaBufferBase *buffer; MediaSource::ReadOptions options; int64_t seekTimeUs = -1; for (;;) { @@ -321,7 +321,7 @@ static void playSource(sp<MediaSource> &source) { while (numIterationsLeft-- > 0) { long numFrames = 0; - MediaBuffer *buffer; + MediaBufferBase *buffer; for (;;) { int64_t startDecodeUs = getNowUs(); @@ -416,7 +416,7 @@ struct DetectSyncSource : public MediaSource { virtual sp<MetaData> getFormat(); virtual status_t read( - MediaBuffer **buffer, const ReadOptions *options); + MediaBufferBase **buffer, const ReadOptions *options); private: enum StreamType { @@ -465,7 +465,7 @@ sp<MetaData> DetectSyncSource::getFormat() { return mSource->getFormat(); } -static bool isIDRFrame(MediaBuffer *buffer) { +static bool isIDRFrame(MediaBufferBase *buffer) { const uint8_t *data = (const uint8_t *)buffer->data() + buffer->range_offset(); size_t size = buffer->range_length(); @@ -482,7 +482,7 @@ static bool isIDRFrame(MediaBuffer *buffer) { } status_t DetectSyncSource::read( - MediaBuffer **buffer, const ReadOptions *options) { + MediaBufferBase **buffer, const ReadOptions *options) { for (;;) { status_t err = mSource->read(buffer, options); @@ -562,7 +562,7 @@ static void performSeekTest(const sp<MediaSource> &source) { options.setSeekTo( seekTimeUs, MediaSource::ReadOptions::SEEK_PREVIOUS_SYNC); - MediaBuffer *buffer; + MediaBufferBase *buffer; status_t err; for (;;) { err = source->read(&buffer, &options); |
