diff options
author | jiesun@google.com <jiesun@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-27 16:38:55 +0000 |
---|---|---|
committer | jiesun@google.com <jiesun@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-27 16:38:55 +0000 |
commit | f8bb2b0094c03e6e75d05bcc963719430cdb5f23 (patch) | |
tree | d4880134030566d2bc25fe9e3c549b6c673de937 /media/tools/omx_test | |
parent | 238049450762af7812c709f14c623a6419f8cf81 (diff) | |
download | chromium_src-f8bb2b0094c03e6e75d05bcc963719430cdb5f23.zip chromium_src-f8bb2b0094c03e6e75d05bcc963719430cdb5f23.tar.gz chromium_src-f8bb2b0094c03e6e75d05bcc963719430cdb5f23.tar.bz2 |
Remove OmxSink interface because Buffer Allocation will go through Allocator in the future, and all allocation required parameters will be passed to "Allocator factory" during intiailized phase of render/decoder.
Remove OMX_BUFFERHEADERTYPE merge logic, this is based on assumptions that all vendor will use one frame per buffer scheme instead of one slice(multiple rows) per buffer which is specified by OpenMAX IL Spec.
Review URL: http://codereview.chromium.org/1786001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45705 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/tools/omx_test')
-rw-r--r-- | media/tools/omx_test/file_sink.cc | 34 | ||||
-rw-r--r-- | media/tools/omx_test/file_sink.h | 14 | ||||
-rw-r--r-- | media/tools/omx_test/omx_test.cc | 11 |
3 files changed, 7 insertions, 52 deletions
diff --git a/media/tools/omx_test/file_sink.cc b/media/tools/omx_test/file_sink.cc index abee305..2191980 100644 --- a/media/tools/omx_test/file_sink.cc +++ b/media/tools/omx_test/file_sink.cc @@ -10,36 +10,8 @@ namespace media { -bool FileSink::AllocateEGLImages(int width, int height, - std::vector<EGLImageKHR>* images) { - NOTREACHED() << "This method is never used"; - return false; -} - -void FileSink::ReleaseEGLImages(const std::vector<EGLImageKHR>& images) { - NOTREACHED() << "This method is never used"; -} - -void FileSink::UseThisBuffer(int buffer_id, OMX_BUFFERHEADERTYPE* buffer) { - CHECK(omx_buffers_.find(buffer_id) == omx_buffers_.end()); - omx_buffers_[buffer_id] = buffer; -} - -void FileSink::StopUsingThisBuffer(int id) { - omx_buffers_.erase(id); -} - -void FileSink::BufferReady(int buffer_id, BufferUsedCallback* callback) { - CHECK(omx_buffers_.find(buffer_id) != omx_buffers_.end()); - CHECK(callback); - - OMX_BUFFERHEADERTYPE* omx_buffer = omx_buffers_[buffer_id]; - uint8* buffer = omx_buffer->pBuffer; - int size = omx_buffer->nFilledLen; - - // We never receive an end-of-stream buffer here. - CHECK(!(omx_buffer->nFlags & OMX_BUFFERFLAG_EOS)); +void FileSink::BufferReady(int size, uint8* buffer) { if (size > copy_buf_size_) { copy_buf_.reset(new uint8[size]); copy_buf_size_ = size; @@ -62,10 +34,6 @@ void FileSink::BufferReady(int buffer_id, BufferUsedCallback* callback) { if (output_file_.get()) fwrite(out_buffer, sizeof(uint8), size, output_file_.get()); - - // Always make the callback. - callback->Run(buffer_id); - delete callback; } bool FileSink::Initialize() { diff --git a/media/tools/omx_test/file_sink.h b/media/tools/omx_test/file_sink.h index 58edb04..a20bca1 100644 --- a/media/tools/omx_test/file_sink.h +++ b/media/tools/omx_test/file_sink.h @@ -11,13 +11,12 @@ #include "base/basictypes.h" #include "base/scoped_handle.h" #include "base/scoped_ptr.h" -#include "media/omx/omx_output_sink.h" namespace media { // This class writes output of a frame decoded by OmxCodec and save it to // a file. -class FileSink : public OmxOutputSink { +class FileSink { public: FileSink(std::string output_filename, bool simulate_copy, @@ -31,14 +30,7 @@ class FileSink : public OmxOutputSink { csc_buf_size_(0) { } - // OmxOutputSink implementations. - virtual bool ProvidesEGLImages() const { return false; } - virtual bool AllocateEGLImages(int width, int height, - std::vector<EGLImageKHR>* images); - virtual void ReleaseEGLImages(const std::vector<EGLImageKHR>& images); - virtual void UseThisBuffer(int buffer_id, OMX_BUFFERHEADERTYPE* buffer); - virtual void StopUsingThisBuffer(int id); - virtual void BufferReady(int buffer_id, BufferUsedCallback* callback); + virtual void BufferReady(int size, uint8* buffer); // Initialize this object. Returns true if successful. bool Initialize(); @@ -65,8 +57,6 @@ class FileSink : public OmxOutputSink { scoped_array<uint8> csc_buf_; int csc_buf_size_; - std::map<int, OMX_BUFFERHEADERTYPE*> omx_buffers_; - DISALLOW_COPY_AND_ASSIGN(FileSink); }; diff --git a/media/tools/omx_test/omx_test.cc b/media/tools/omx_test/omx_test.cc index 947147e..284572f 100644 --- a/media/tools/omx_test/omx_test.cc +++ b/media/tools/omx_test/omx_test.cc @@ -20,7 +20,6 @@ #include "media/filters/bitstream_converter.h" #include "media/omx/omx_codec.h" #include "media/base/data_buffer.h" -#include "media/omx/omx_output_sink.h" #include "media/tools/omx_test/color_space_util.h" #include "media/tools/omx_test/file_reader_util.h" #include "media/tools/omx_test/file_sink.h" @@ -34,7 +33,6 @@ using media::OmxCodec; using media::OmxConfigurator; using media::OmxDecoderConfigurator; using media::OmxEncoderConfigurator; -using media::OmxOutputSink; using media::YuvFileReader; using media::Buffer; using media::DataBuffer; @@ -111,8 +109,7 @@ class TestApp { FeedInputBuffer(); } - void ReadCompleteCallback(int buffer, - FileSink::BufferUsedCallback* callback) { + void ReadCompleteCallback(OMX_BUFFERHEADERTYPE* buffer) { // This callback is received when the decoder has completed a decoding // task and given us some output data. The buffer is owned by the decoder. if (stopped_ || error_) @@ -122,7 +119,7 @@ class TestApp { first_sample_delivered_time_ = base::TimeTicks::HighResNow(); // If we are readding to the end, then stop. - if (buffer == OmxCodec::kEosBuffer) { + if (buffer == NULL) { codec_->Stop(NewCallback(this, &TestApp::StopCallback)); return; } @@ -131,7 +128,7 @@ class TestApp { codec_->Read(NewCallback(this, &TestApp::ReadCompleteCallback)); if (file_sink_.get()) - file_sink_->BufferReady(buffer, callback); + file_sink_->BufferReady(buffer->nFilledLen, buffer->pBuffer); // could OMX IL return patial sample for decoder? frame_count_++; @@ -151,7 +148,7 @@ class TestApp { // Setup the |codec_| with the message loop of the current thread. Also // setup component name, codec format and callbacks. codec_ = new OmxCodec(&message_loop_); - codec_->Setup(configurator_.get(), file_sink_.get()); + codec_->Setup(configurator_.get()); codec_->SetErrorCallback(NewCallback(this, &TestApp::ErrorCallback)); codec_->SetFormatCallback(NewCallback(this, &TestApp::FormatCallback)); |