diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-30 19:31:30 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-30 19:31:30 +0000 |
commit | e785780e0ac206abf27dff864be6aebdf91cbdda (patch) | |
tree | 2dd2e652b43f63014e582a780a1939a353dbe4c9 /content | |
parent | f677a530fdaebae4104da112627874e4877348fe (diff) | |
download | chromium_src-e785780e0ac206abf27dff864be6aebdf91cbdda.zip chromium_src-e785780e0ac206abf27dff864be6aebdf91cbdda.tar.gz chromium_src-e785780e0ac206abf27dff864be6aebdf91cbdda.tar.bz2 |
Checking in media::BitstreamBuffer and media::VideoDecodeAccelerator interfaces.
Also includes stubbed out implementation VideoDecodeAcceleratorHost.
Part of a patch by vmr@chromium.org:
http://codereview.chromium.org/6541068/
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6675040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79878 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/content_renderer.gypi | 2 | ||||
-rw-r--r-- | content/renderer/video_decode_accelerator_host.cc | 87 | ||||
-rw-r--r-- | content/renderer/video_decode_accelerator_host.h | 75 |
3 files changed, 164 insertions, 0 deletions
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi index 082d607..77c1b4a 100644 --- a/content/content_renderer.gypi +++ b/content/content_renderer.gypi @@ -119,6 +119,8 @@ 'renderer/renderer_webstoragenamespace_impl.h', 'renderer/speech_input_dispatcher.cc', 'renderer/speech_input_dispatcher.h', + 'renderer/video_decode_accelerator_host.cc', + 'renderer/video_decode_accelerator_host.h', 'renderer/webgraphicscontext3d_command_buffer_impl.cc', 'renderer/webgraphicscontext3d_command_buffer_impl.h', 'renderer/webplugin_delegate_proxy.cc', diff --git a/content/renderer/video_decode_accelerator_host.cc b/content/renderer/video_decode_accelerator_host.cc new file mode 100644 index 0000000..013277a --- /dev/null +++ b/content/renderer/video_decode_accelerator_host.cc @@ -0,0 +1,87 @@ +// 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 "content/renderer/video_decode_accelerator_host.h" + +#include "base/logging.h" +#include "base/task.h" + +using media::VideoDecodeAccelerator; +using media::VideoDecodeAcceleratorCallback; + +VideoDecodeAcceleratorHost::VideoDecodeAcceleratorHost( + MessageRouter* router, + IPC::Message::Sender* ipc_sender, + int32 decoder_host_id) + : message_loop_(NULL), + router_(router), + ipc_sender_(ipc_sender), + context_route_id_(0), + decoder_host_id_(decoder_host_id), + decoder_id_(0) { +} + +VideoDecodeAcceleratorHost::~VideoDecodeAcceleratorHost() {} + +void VideoDecodeAcceleratorHost::OnChannelConnected(int32 peer_pid) {} + +void VideoDecodeAcceleratorHost::OnChannelError() { + ipc_sender_ = NULL; +} + +bool VideoDecodeAcceleratorHost::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; + DCHECK(handled); + return handled; +} + +const std::vector<uint32>& VideoDecodeAcceleratorHost::GetConfig( + const std::vector<uint32>& prototype_config) { + // TODO(vmr): implement. + NOTIMPLEMENTED(); + return configs_; +} + +bool VideoDecodeAcceleratorHost::Initialize( + const std::vector<uint32>& config) { + // TODO(vmr): implement. + NOTIMPLEMENTED(); + return false; +} + +bool VideoDecodeAcceleratorHost::Decode( + media::BitstreamBuffer* bitstream_buffer, + VideoDecodeAcceleratorCallback* callback) { + // TODO(vmr): implement. + NOTIMPLEMENTED(); + return false; +} + +void VideoDecodeAcceleratorHost::AssignPictureBuffer( + std::vector<PictureBuffer*> picture_buffers) { + // TODO(vmr): implement. + NOTIMPLEMENTED(); +} + +void VideoDecodeAcceleratorHost::ReusePictureBuffer( + PictureBuffer* picture_buffer) { + // TODO(vmr): implement. + NOTIMPLEMENTED(); +} + +bool VideoDecodeAcceleratorHost::Flush( + VideoDecodeAcceleratorCallback* callback) { + // TODO(vmr): implement. + NOTIMPLEMENTED(); + return false; +} + +bool VideoDecodeAcceleratorHost::Abort( + VideoDecodeAcceleratorCallback* callback) { + // TODO(vmr): implement. + NOTIMPLEMENTED(); + return false; +} + +DISABLE_RUNNABLE_METHOD_REFCOUNT(VideoDecodeAcceleratorHost); diff --git a/content/renderer/video_decode_accelerator_host.h b/content/renderer/video_decode_accelerator_host.h new file mode 100644 index 0000000..c19b0b5 --- /dev/null +++ b/content/renderer/video_decode_accelerator_host.h @@ -0,0 +1,75 @@ +// 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 CONTENT_RENDERER_VIDEO_DECODE_ACCELERATOR_HOST_H_ +#define CONTENT_RENDERER_VIDEO_DECODE_ACCELERATOR_HOST_H_ + +#include <vector> + +#include "base/memory/scoped_ptr.h" +#include "base/shared_memory.h" +#include "ipc/ipc_channel.h" +#include "media/video/video_decode_accelerator.h" + +class MessageLoop; +class MessageRouter; + +// This class is used to talk to VideoDecodeAccelerator in the GPU process +// through IPC messages. +class VideoDecodeAcceleratorHost : public IPC::Channel::Listener, + public media::VideoDecodeAccelerator { + public: + // |router| is used to dispatch IPC messages to this object. + // |ipc_sender| is used to send IPC messages to GPU process. + VideoDecodeAcceleratorHost(MessageRouter* router, + IPC::Message::Sender* ipc_sender, + int32 decoder_host_id); + virtual ~VideoDecodeAcceleratorHost(); + + // IPC::Channel::Listener implementation. + virtual void OnChannelConnected(int32 peer_pid); + virtual void OnChannelError(); + virtual bool OnMessageReceived(const IPC::Message& message); + + // media::VideoDecodeAccelerator implementation. + virtual const std::vector<uint32>& GetConfig( + const std::vector<uint32>& prototype_config); + virtual bool Initialize(const std::vector<uint32>& config); + virtual bool Decode(media::BitstreamBuffer* bitstream_buffer, + media::VideoDecodeAcceleratorCallback* callback); + virtual void AssignPictureBuffer( + std::vector<PictureBuffer*> picture_buffers); + virtual void ReusePictureBuffer(PictureBuffer* picture_buffer); + virtual bool Flush(media::VideoDecodeAcceleratorCallback* callback); + virtual bool Abort(media::VideoDecodeAcceleratorCallback* callback); + + private: + // Message loop that this object runs on. + MessageLoop* message_loop_; + + // A router used to send us IPC messages. + MessageRouter* router_; + + // Sends IPC messages to the GPU process. + IPC::Message::Sender* ipc_sender_; + + // Route ID of the GLES2 context in the GPU process. + int context_route_id_; + + // ID of this VideoDecodeAcceleratorHost. + int32 decoder_host_id_; + + // ID of VideoDecodeAccelerator in the GPU process. + int32 decoder_id_; + + // Transfer buffers for both input and output. + // TODO(vmr): move into plugin provided IPC buffers. + scoped_ptr<base::SharedMemory> input_transfer_buffer_; + + std::vector<uint32> configs_; + + DISALLOW_COPY_AND_ASSIGN(VideoDecodeAcceleratorHost); +}; + +#endif // CONTENT_RENDERER_VIDEO_DECODE_ACCELERATOR_HOST_H_ |