diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-22 22:36:38 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-22 22:36:38 +0000 |
commit | 0d76062cda4c5654b28cfd0a6c429166fb716f75 (patch) | |
tree | fd78a66fb75c07a166e23720c71a7938c90ae504 /media | |
parent | 1303a7a465110eaee31488e067b8024e41a4f609 (diff) | |
download | chromium_src-0d76062cda4c5654b28cfd0a6c429166fb716f75.zip chromium_src-0d76062cda4c5654b28cfd0a6c429166fb716f75.tar.gz chromium_src-0d76062cda4c5654b28cfd0a6c429166fb716f75.tar.bz2 |
OmxInputBuffer removed as it is not used anywhere.
BUG=28654
TEST=none
Review URL: http://codereview.chromium.org/1763006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45364 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/media.gyp | 3 | ||||
-rw-r--r-- | media/omx/omx_input_buffer.cc | 39 | ||||
-rw-r--r-- | media/omx/omx_input_buffer.h | 53 | ||||
-rw-r--r-- | media/omx/omx_input_buffer_unittest.cc | 67 |
4 files changed, 0 insertions, 162 deletions
diff --git a/media/media.gyp b/media/media.gyp index 7190cf3..dbb6856 100644 --- a/media/media.gyp +++ b/media/media.gyp @@ -217,7 +217,6 @@ 'omx/mock_omx.cc', 'omx/mock_omx.h', 'omx/omx_codec_unittest.cc', - 'omx/omx_input_buffer_unittest.cc', ], 'conditions': [ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { @@ -332,8 +331,6 @@ 'omx/omx_codec.h', 'omx/omx_configurator.cc', 'omx/omx_configurator.h', - 'omx/omx_input_buffer.cc', - 'omx/omx_input_buffer.h', ], 'hard_dependency': 1, 'export_dependent_settings': [ diff --git a/media/omx/omx_input_buffer.cc b/media/omx/omx_input_buffer.cc deleted file mode 100644 index b4864fe..0000000 --- a/media/omx/omx_input_buffer.cc +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this -// source code is governed by a BSD-style license that can be found in the -// LICENSE file. - -#include "media/omx/omx_input_buffer.h" - -#include <algorithm> - -#include "base/logging.h" - -namespace media { - -OmxInputBuffer::OmxInputBuffer() - : size_(0), - used_(0) { -} - -OmxInputBuffer::OmxInputBuffer(uint8* data, int size) - : data_(data), - size_(size), - used_(0) { - DCHECK_GE(size, 0); -} - -OmxInputBuffer::~OmxInputBuffer() { -} - -int OmxInputBuffer::Read(uint8* output_data, int output_size) { - int copy = std::min(output_size, size_ - used_); - memcpy(output_data, data_.get() + used_, copy); - used_ += copy; - return copy; -} - -bool OmxInputBuffer::Used() { - return used_ == size_; -} - -} // namespace media diff --git a/media/omx/omx_input_buffer.h b/media/omx/omx_input_buffer.h deleted file mode 100644 index 10a9049..0000000 --- a/media/omx/omx_input_buffer.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this -// source code is governed by a BSD-style license that can be found in the -// LICENSE file. - -// Defines the input buffer object for the video decoder. This provides -// the interface needed by the video decoder to read input data. -// -// This object is implemened using system memory. - -#ifndef MEDIA_OMX_OMX_INPUT_BUFFER_H_ -#define MEDIA_OMX_OMX_INPUT_BUFFER_H_ - -#include "base/basictypes.h" -#include "base/scoped_ptr.h" -#include "media/base/buffers.h" - -namespace media { - -class OmxInputBuffer : public Buffer { - public: - // Creates an empty input buffer. - OmxInputBuffer(); - - // Creates an input buffer given |data| and |size|. - // After construction, this object will be given the ownership of - // |data| and is responsible for deleting it. - OmxInputBuffer(uint8* data, int size); - virtual ~OmxInputBuffer(); - - // Read from the this buffer into |data| with the maximum |size| bytes. - // Returns number of bytes read. If a read is successful, the number - // of used bytes will advances accordingly. - // Returns a negative number on error. - int Read(uint8* data, int size); - - // Returns true if this buffer is used. - bool Used(); - - private: - virtual const uint8* GetData() const { return data_.get(); } - - virtual size_t GetDataSize() const { return size_; } - - scoped_array<uint8> data_; - int size_; - int used_; - - DISALLOW_COPY_AND_ASSIGN(OmxInputBuffer); -}; - -} // namespace media - -#endif // MEDIA_OMX_OMX_INPUT_BUFFER_H_ diff --git a/media/omx/omx_input_buffer_unittest.cc b/media/omx/omx_input_buffer_unittest.cc deleted file mode 100644 index 50a2302..0000000 --- a/media/omx/omx_input_buffer_unittest.cc +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "media/omx/omx_input_buffer.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace { - -const int kSize = 256; - -void GenerateData(uint8** data, int size) { - *data = new uint8[size]; - for (int i = 0; i < size; ++i) { - (*data)[i] = static_cast<uint8>(i); - } -} - -bool VerifyData(uint8* data, int size, int offset) { - bool data_mismatch = false; - for (int i = 0; i < size; ++i) { - if (data[i] != static_cast<uint8>(offset + i)) { - data_mismatch = true; - break; - } - } - return !data_mismatch; -} - -} // namespace - -namespace media { - -TEST(OmxInputBufferTest, Read) { - scoped_array<uint8> read_buffer(new uint8[kSize]); - uint8* data; - GenerateData(&data, kSize); - scoped_refptr<OmxInputBuffer> buffer(new OmxInputBuffer(data, kSize)); - EXPECT_FALSE(buffer->Used()); - - // Perform the first read. - EXPECT_EQ(10, buffer->Read(read_buffer.get(), 10)); - EXPECT_FALSE(buffer->Used()); - EXPECT_TRUE(VerifyData(read_buffer.get(), 10, 0)); - - // Perform the second read. - EXPECT_EQ(10, buffer->Read(read_buffer.get(), 10)); - EXPECT_FALSE(buffer->Used()); - EXPECT_TRUE(VerifyData(read_buffer.get(), 10, 10)); - - // Perform the last read. - EXPECT_EQ(kSize - 20, buffer->Read(read_buffer.get(), kSize)); - EXPECT_TRUE(buffer->Used()); - EXPECT_TRUE(VerifyData(read_buffer.get(), kSize - 20, 20)); - - // This read will return nothing. - EXPECT_EQ(0, buffer->Read(read_buffer.get(), kSize)); - EXPECT_TRUE(buffer->Used()); -} - -TEST(OmxInputBufferTest, EmptyBuffer) { - scoped_refptr<OmxInputBuffer> buffer(new OmxInputBuffer(NULL, 0)); - EXPECT_TRUE(buffer->IsEndOfStream()); - EXPECT_TRUE(buffer->Used()); -} - -} // namespace media |