diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-28 21:21:22 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-28 21:21:22 +0000 |
commit | 083823538f220a0374c061f787d16d5a7e623491 (patch) | |
tree | 05aa84fe6517351811472a7eb05c4b779c755149 /media | |
parent | 867ea80559a87f8870e550c1e1e7630a7d63daa3 (diff) | |
download | chromium_src-083823538f220a0374c061f787d16d5a7e623491.zip chromium_src-083823538f220a0374c061f787d16d5a7e623491.tar.gz chromium_src-083823538f220a0374c061f787d16d5a7e623491.tar.bz2 |
Remove media::VideoDecodeContext as it has no implementation and is unused.
Review URL: http://codereview.chromium.org/8417016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107796 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/filters/ffmpeg_video_decoder.cc | 9 | ||||
-rw-r--r-- | media/filters/ffmpeg_video_decoder.h | 8 | ||||
-rw-r--r-- | media/filters/ffmpeg_video_decoder_unittest.cc | 3 | ||||
-rw-r--r-- | media/media.gyp | 2 | ||||
-rw-r--r-- | media/tools/player_wtl/movie.cc | 2 | ||||
-rw-r--r-- | media/tools/player_x11/player_x11.cc | 3 | ||||
-rw-r--r-- | media/video/ffmpeg_video_decode_engine.cc | 3 | ||||
-rw-r--r-- | media/video/ffmpeg_video_decode_engine.h | 4 | ||||
-rw-r--r-- | media/video/ffmpeg_video_decode_engine_unittest.cc | 6 | ||||
-rw-r--r-- | media/video/video_decode_context.h | 84 | ||||
-rw-r--r-- | media/video/video_decode_engine.h | 14 | ||||
-rw-r--r-- | media/video/video_mock_objects.cc | 18 | ||||
-rw-r--r-- | media/video/video_mock_objects.h | 54 |
13 files changed, 15 insertions, 195 deletions
diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc index cc8f926..deb0bf3 100644 --- a/media/filters/ffmpeg_video_decoder.cc +++ b/media/filters/ffmpeg_video_decoder.cc @@ -14,16 +14,13 @@ #include "media/base/video_frame.h" #include "media/ffmpeg/ffmpeg_common.h" #include "media/video/ffmpeg_video_decode_engine.h" -#include "media/video/video_decode_context.h" namespace media { -FFmpegVideoDecoder::FFmpegVideoDecoder(MessageLoop* message_loop, - VideoDecodeContext* decode_context) +FFmpegVideoDecoder::FFmpegVideoDecoder(MessageLoop* message_loop) : message_loop_(message_loop), state_(kUnInitialized), - decode_engine_(new FFmpegVideoDecodeEngine()), - decode_context_(decode_context) { + decode_engine_(new FFmpegVideoDecodeEngine()) { } FFmpegVideoDecoder::~FFmpegVideoDecoder() {} @@ -67,7 +64,7 @@ void FFmpegVideoDecoder::Initialize(DemuxerStream* demuxer_stream, } state_ = kInitializing; - decode_engine_->Initialize(message_loop_, this, NULL, config); + decode_engine_->Initialize(this, config); } void FFmpegVideoDecoder::OnInitializeComplete(bool success) { diff --git a/media/filters/ffmpeg_video_decoder.h b/media/filters/ffmpeg_video_decoder.h index b22144e..5e1ba1a 100644 --- a/media/filters/ffmpeg_video_decoder.h +++ b/media/filters/ffmpeg_video_decoder.h @@ -12,6 +12,8 @@ #include "media/video/video_decode_engine.h" #include "ui/gfx/size.h" +class MessageLoop; + namespace media { class VideoDecodeEngine; @@ -20,8 +22,7 @@ class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder, public VideoDecodeEngine::EventHandler { public: - FFmpegVideoDecoder(MessageLoop* message_loop, - VideoDecodeContext* decode_context); + explicit FFmpegVideoDecoder(MessageLoop* message_loop); virtual ~FFmpegVideoDecoder(); // Filter implementation. @@ -30,7 +31,7 @@ class MEDIA_EXPORT FFmpegVideoDecoder virtual void Pause(const base::Closure& callback) OVERRIDE; virtual void Flush(const base::Closure& callback) OVERRIDE; - // Decoder implementation. + // VideoDecoder implementation. virtual void Initialize(DemuxerStream* demuxer_stream, const base::Closure& callback, const StatisticsCallback& stats_callback) OVERRIDE; @@ -81,7 +82,6 @@ class MEDIA_EXPORT FFmpegVideoDecoder PtsStream pts_stream_; // Stream of presentation timestamps. DecoderState state_; scoped_ptr<VideoDecodeEngine> decode_engine_; - scoped_ptr<VideoDecodeContext> decode_context_; base::Closure initialize_callback_; base::Closure uninitialize_callback_; diff --git a/media/filters/ffmpeg_video_decoder_unittest.cc b/media/filters/ffmpeg_video_decoder_unittest.cc index bae062f..e0d2ca2 100644 --- a/media/filters/ffmpeg_video_decoder_unittest.cc +++ b/media/filters/ffmpeg_video_decoder_unittest.cc @@ -20,7 +20,6 @@ #include "media/filters/ffmpeg_glue.h" #include "media/filters/ffmpeg_video_decoder.h" #include "media/video/video_decode_engine.h" -#include "media/video/video_decode_context.h" #include "testing/gmock/include/gmock/gmock.h" using ::testing::_; @@ -46,7 +45,7 @@ ACTION_P(ReturnBuffer, buffer) { class FFmpegVideoDecoderTest : public testing::Test { public: FFmpegVideoDecoderTest() - : decoder_(new FFmpegVideoDecoder(&message_loop_, NULL)), + : decoder_(new FFmpegVideoDecoder(&message_loop_)), demuxer_(new StrictMock<MockDemuxerStream>()) { CHECK(FFmpegGlue::GetInstance()); diff --git a/media/media.gyp b/media/media.gyp index b5a56a2..a9baf28 100644 --- a/media/media.gyp +++ b/media/media.gyp @@ -651,8 +651,6 @@ 'base/mock_filter_host.h', 'base/mock_filters.cc', 'base/mock_filters.h', - 'video/video_mock_objects.cc', - 'video/video_mock_objects.h', ], }, { diff --git a/media/tools/player_wtl/movie.cc b/media/tools/player_wtl/movie.cc index 3552c57..9b298ca 100644 --- a/media/tools/player_wtl/movie.cc +++ b/media/tools/player_wtl/movie.cc @@ -75,7 +75,7 @@ bool Movie::Open(const wchar_t* url, WtlVideoRenderer* video_renderer) { collection->AddAudioDecoder(new FFmpegAudioDecoder( message_loop_factory_->GetMessageLoop("AudioDecoderThread"))); collection->AddVideoDecoder(new FFmpegVideoDecoder( - message_loop_factory_->GetMessageLoop("VideoDecoderThread"), NULL)); + message_loop_factory_->GetMessageLoop("VideoDecoderThread"))); if (enable_audio_) { collection->AddAudioRenderer(new ReferenceAudioRenderer()); diff --git a/media/tools/player_x11/player_x11.cc b/media/tools/player_x11/player_x11.cc index c1a8213..7676eef 100644 --- a/media/tools/player_x11/player_x11.cc +++ b/media/tools/player_x11/player_x11.cc @@ -92,8 +92,7 @@ bool InitPipeline(MessageLoop* message_loop, collection->AddAudioDecoder(new media::FFmpegAudioDecoder( message_loop_factory->GetMessageLoop("AudioDecoderThread"))); collection->AddVideoDecoder(new media::FFmpegVideoDecoder( - message_loop_factory->GetMessageLoop("VideoDecoderThread"), - NULL)); + message_loop_factory->GetMessageLoop("VideoDecoderThread"))); if (use_gl) { collection->AddVideoRenderer( diff --git a/media/video/ffmpeg_video_decode_engine.cc b/media/video/ffmpeg_video_decode_engine.cc index 05af31f..dad9fc1 100644 --- a/media/video/ffmpeg_video_decode_engine.cc +++ b/media/video/ffmpeg_video_decode_engine.cc @@ -13,7 +13,6 @@ #include "media/base/pipeline.h" #include "media/base/video_util.h" #include "media/ffmpeg/ffmpeg_common.h" -#include "media/filters/ffmpeg_demuxer.h" namespace media { @@ -37,9 +36,7 @@ FFmpegVideoDecodeEngine::~FFmpegVideoDecodeEngine() { } void FFmpegVideoDecodeEngine::Initialize( - MessageLoop* message_loop, VideoDecodeEngine::EventHandler* event_handler, - VideoDecodeContext* context, const VideoDecoderConfig& config) { frame_rate_numerator_ = config.frame_rate_numerator(); frame_rate_denominator_ = config.frame_rate_denominator(); diff --git a/media/video/ffmpeg_video_decode_engine.h b/media/video/ffmpeg_video_decode_engine.h index 3bc80c7..3ac7411 100644 --- a/media/video/ffmpeg_video_decode_engine.h +++ b/media/video/ffmpeg_video_decode_engine.h @@ -23,9 +23,7 @@ class MEDIA_EXPORT FFmpegVideoDecodeEngine : public VideoDecodeEngine { virtual ~FFmpegVideoDecodeEngine(); // Implementation of the VideoDecodeEngine Interface. - virtual void Initialize(MessageLoop* message_loop, - VideoDecodeEngine::EventHandler* event_handler, - VideoDecodeContext* context, + virtual void Initialize(VideoDecodeEngine::EventHandler* event_handler, const VideoDecoderConfig& config); virtual void ConsumeVideoSample(scoped_refptr<Buffer> buffer); virtual void ProduceVideoFrame(scoped_refptr<VideoFrame> frame); diff --git a/media/video/ffmpeg_video_decode_engine_unittest.cc b/media/video/ffmpeg_video_decode_engine_unittest.cc index c5469b4..8670dc8 100644 --- a/media/video/ffmpeg_video_decode_engine_unittest.cc +++ b/media/video/ffmpeg_video_decode_engine_unittest.cc @@ -61,7 +61,7 @@ class FFmpegVideoDecodeEngineTest void Initialize() { EXPECT_CALL(*this, OnInitializeComplete(true)); - test_engine_->Initialize(MessageLoop::current(), this, NULL, config_); + test_engine_->Initialize(this, config_); } // Decodes the single compressed frame in |buffer| and writes the @@ -154,7 +154,7 @@ TEST_F(FFmpegVideoDecodeEngineTest, Initialize_FindDecoderFails) { // Test avcodec_find_decoder() returning NULL. EXPECT_CALL(*this, OnInitializeComplete(false)); - test_engine_->Initialize(MessageLoop::current(), this, NULL, config); + test_engine_->Initialize(this, config); } TEST_F(FFmpegVideoDecodeEngineTest, Initialize_OpenDecoderFails) { @@ -165,7 +165,7 @@ TEST_F(FFmpegVideoDecodeEngineTest, Initialize_OpenDecoderFails) { kAspectRatio.num, kAspectRatio.den, NULL, 0); EXPECT_CALL(*this, OnInitializeComplete(false)); - test_engine_->Initialize(MessageLoop::current(), this, NULL, config); + test_engine_->Initialize(this, config); } TEST_F(FFmpegVideoDecodeEngineTest, DecodeFrame_Normal) { diff --git a/media/video/video_decode_context.h b/media/video/video_decode_context.h deleted file mode 100644 index 55740f7..0000000 --- a/media/video/video_decode_context.h +++ /dev/null @@ -1,84 +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. - -#ifndef MEDIA_VIDEO_VIDEO_DECODE_CONTEXT_H_ -#define MEDIA_VIDEO_VIDEO_DECODE_CONTEXT_H_ - -#include <vector> - -#include "base/task.h" -#include "media/base/video_frame.h" - -namespace media { - -class VideoFrame; - -// A VideoDecodeContext is used by VideoDecodeEngine to provide the following -// functions: -// -// 1. Provides access to hardware video decoding device. -// 2. Allocate VideoFrame objects that are used to carry the decoded video -// frames. -// 3. Upload a device specific buffer to some common VideoFrame storage types. -// In many cases a VideoDecodeEngine provides its own buffer, these buffer -// are usually device specific and a conversion step is needed. Instead of -// handling these many cases in the renderer a VideoDecodeContext is used -// to convert the device specific buffer to a common storage format, e.g. -// GL textures or system memory. This way we keep the device specific code -// in the VideoDecodeEngine and VideoDecodeContext pair. -class VideoDecodeContext { - public: - virtual ~VideoDecodeContext() {} - - // Obtain a handle to the hardware video decoder device. The type of the - // handle is a contract between the implementation of VideoDecodeContext and - // VideoDecodeEngine. - // - // If a hardware device is not needed this method should return NULL. - virtual void* GetDevice() = 0; - - // Allocate |n| video frames with dimension |width| and |height|. |task| - // is called when allocation has completed. - // - // |frames| is the output parameter for VideFrame(s) allocated. - virtual void AllocateVideoFrames( - int n, size_t width, size_t height, VideoFrame::Format format, - std::vector<scoped_refptr<VideoFrame> >* frames, - Task* task) = 0; - - // Release all video frames allocated by the context. After making this call - // VideoDecodeEngine should not use the VideoFrame allocated because they - // could be destroyed. - virtual void ReleaseAllVideoFrames() = 0; - - // Upload a device specific buffer to a video frame. The video frame was - // allocated via AllocateVideoFrames(). - // This method is used if a VideoDecodeEngine cannot write directly to a - // VideoFrame, e.g. upload should be done on a different thread, the subsystem - // require some special treatment to generate a VideoFrame. The goal is to - // keep VideoDecodeEngine a reusable component and also adapt to different - // system by having a different VideoDecodeContext. - // - // |frame| is a VideoFrame allocated via AllocateVideoFrames(). - // - // |buffer| is of type void*, it is of an internal type in VideoDecodeEngine - // that points to the buffer that contains the video frame. - // Implementor should know how to handle it. - // - // |task| is executed if the operation was completed successfully. - virtual void ConvertToVideoFrame(void* buffer, - scoped_refptr<VideoFrame> frame, - Task* task) = 0; - - // Destroy this context asynchronously. When the operation is done |task| - // is called. It is safe to delete this object only after |task| is called. - // - // ReleaseVideoFrames() need to be called with all the video frames allocated - // before making this call. - virtual void Destroy(Task* task) = 0; -}; - -} // namespace media - -#endif // MEDIA_VIDEO_VIDEO_DECODE_CONTEXT_H_ diff --git a/media/video/video_decode_engine.h b/media/video/video_decode_engine.h index c2b1bfa..2d52b24 100644 --- a/media/video/video_decode_engine.h +++ b/media/video/video_decode_engine.h @@ -11,13 +11,9 @@ #include "media/base/video_decoder_config.h" #include "media/base/video_frame.h" -class MessageLoop; - namespace media { class Buffer; -class VideoDecodeContext; - struct PipelineStatistics; class MEDIA_EXPORT VideoDecodeEngine { @@ -66,17 +62,9 @@ class MEDIA_EXPORT VideoDecodeEngine { // Initialize the engine with specified configuration. // - // |decode_context| is used for allocation of VideoFrame. - // It is important that |decode_context| is called only on |message_loop|. - // - // TODO(hclam): Currently refactoring code to use VideoDecodeContext so - // |context| may be NULL in some cases. - // // Engine should call EventHandler::OnInitializeDone() whether the // initialization operation finished successfully or not. - virtual void Initialize(MessageLoop* message_loop, - EventHandler* event_handler, - VideoDecodeContext* context, + virtual void Initialize(EventHandler* event_handler, const VideoDecoderConfig& config) = 0; // Uninitialize the engine. Engine should destroy all resources and call diff --git a/media/video/video_mock_objects.cc b/media/video/video_mock_objects.cc deleted file mode 100644 index e89fb65..0000000 --- a/media/video/video_mock_objects.cc +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2011 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/video/video_mock_objects.h" - -namespace media { - -MockVideoDecodeEngine::MockVideoDecodeEngine() {} - -MockVideoDecodeEngine::~MockVideoDecodeEngine() {} - -MockVideoDecodeContext::MockVideoDecodeContext() {} - -MockVideoDecodeContext::~MockVideoDecodeContext() {} - - -} // namespace media diff --git a/media/video/video_mock_objects.h b/media/video/video_mock_objects.h deleted file mode 100644 index 4b8ec64..0000000 --- a/media/video/video_mock_objects.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2011 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. - -#ifndef MEDIA_VIDEO_MOCK_OBJECTS_H_ -#define MEDIA_VIDEO_MOCK_OBJECTS_H_ - -#include "media/video/video_decode_context.h" -#include "media/video/video_decode_engine.h" -#include "testing/gmock/include/gmock/gmock.h" - -namespace media { - -class MockVideoDecodeEngine : public VideoDecodeEngine { - public: - MockVideoDecodeEngine(); - virtual ~MockVideoDecodeEngine(); - - MOCK_METHOD4(Initialize, void(MessageLoop* message_loop, - EventHandler* event_handler, - VideoDecodeContext* context, - const VideoDecoderConfig& config)); - MOCK_METHOD0(Uninitialize, void()); - MOCK_METHOD0(Flush, void()); - MOCK_METHOD0(Seek, void()); - MOCK_METHOD1(ConsumeVideoSample, void(scoped_refptr<Buffer> buffer)); - MOCK_METHOD1(ProduceVideoFrame, void(scoped_refptr<VideoFrame> frame)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockVideoDecodeEngine); -}; - -class MockVideoDecodeContext : public VideoDecodeContext { - public: - MockVideoDecodeContext(); - virtual ~MockVideoDecodeContext(); - - MOCK_METHOD0(GetDevice, void*()); - MOCK_METHOD6(AllocateVideoFrames, void( - int n, size_t width, size_t height, VideoFrame::Format format, - std::vector<scoped_refptr<VideoFrame> >* frames, - Task* task)); - MOCK_METHOD0(ReleaseAllVideoFrames, void()); - MOCK_METHOD3(ConvertToVideoFrame, void( - void* buffer, scoped_refptr<VideoFrame> frame, Task* task)); - MOCK_METHOD1(Destroy, void(Task* task)); - - private: - DISALLOW_COPY_AND_ASSIGN(MockVideoDecodeContext); -}; - -} // namespace media - -#endif // MEDIA_VIDEO_MOCK_OBJECTS_H_ |