diff options
author | jiesun@google.com <jiesun@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-10 01:05:41 +0000 |
---|---|---|
committer | jiesun@google.com <jiesun@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-10 01:05:41 +0000 |
commit | ee68378a4c92a66b80288a42e584dbd9b4e89619 (patch) | |
tree | 866beac2a4023529ade2e91c39d2d7f6312e7db3 /chrome/common/gpu_video_common.h | |
parent | b2df464d2783521f8fabbbe76f74a4129dd8417e (diff) | |
download | chromium_src-ee68378a4c92a66b80288a42e584dbd9b4e89619.zip chromium_src-ee68378a4c92a66b80288a42e584dbd9b4e89619.tar.gz chromium_src-ee68378a4c92a66b80288a42e584dbd9b4e89619.tar.bz2 |
1. ipc_video_decoder.cc/h is media pipeline filter which use the gpu decoder facilities in video stack. it is only enabled when (a) hardware composition is on (b) hardware decoding command line is on (c) h264 codec is specified.
2. gpu_video_service.cc/h is a singleton in gpu process which provide video services for renderer process, through it we could create decoder. ( in my imagination, in the future, we could create encoder or capturer too)
3. gpu_video_decoder.cc/h. abstract interface for hardware decoder.
4. gpu_video_service_host.cc/h is singleton in renderer process which provide proxy for gpu_video_service.
5. gpu_video_decoder_host.cc/h is proxy for gpu_video_decoder. (1 to 1 map).basically there is one global GpuVideoService in GPU process, one GpuVideoServiceHost in Renderer process. for each renderer process, there are could be multiple renderer view, each could had multiple GpuVideoDecoderHost the connect to GpuVideoDeocder through GPUCHannelHOst/GpuChannel.
6. gpu_video_common.cc/h: IPC message definition and pickle/marshaling support.
ISSUES:
1. in media pipeline, we need let decoder to determine if bit stream filter should be used instead of let command line to determine it.
2. stop readback from D3D surface use ANGLE.
3. Flush logic still need fine tuning.
4. CreateThread in GpuVideoDecoder, and post message in message handler, and derived classs handle message loop. ?
5. Error handling.
6. Input ring buffer implementation. Current impl is naive.
7.Add output queue for MFT decoder.
8. Query Capabilities at GetVideoServices()...
BUG=None
TEST=Windows7
Review URL: http://codereview.chromium.org/2873089
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55516 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/gpu_video_common.h')
-rw-r--r-- | chrome/common/gpu_video_common.h | 172 |
1 files changed, 172 insertions, 0 deletions
diff --git a/chrome/common/gpu_video_common.h b/chrome/common/gpu_video_common.h new file mode 100644 index 0000000..34974a6 --- /dev/null +++ b/chrome/common/gpu_video_common.h @@ -0,0 +1,172 @@ +// 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 CHROME_COMMON_GPU_VIDEO_COMMON_H_ +#define CHROME_COMMON_GPU_VIDEO_COMMON_H_ + +#include "base/basictypes.h" +#include "base/shared_memory.h" +#include "chrome/common/common_param_traits.h" + +class GpuVideoServiceInfoParam { + public: + // route id for GpuVideoService on GPU process side for this channel. + int32 video_service_route_id_; + // route id for GpuVideoServiceHost on Render process side for this channel. + int32 video_service_host_route_id_; + // TODO(jiesun): define capabilities of video service. + int32 service_available_; +}; + +class GpuVideoDecoderInfoParam { + public: + // global decoder id. + int32 decoder_id_; + // route id for GpuVideoDecoder on GPU process side for this channel. + int32 decoder_route_id_; + // route id for GpuVideoServiceHost on Render process side for this channel. + int32 decoder_host_route_id_; +}; + +class GpuVideoDecoderInitParam { + public: + int32 codec_id_; + int32 width_; + int32 height_; + int32 profile_; + int32 level_; + int32 frame_rate_den_; + int32 frame_rate_num_; + int32 aspect_ratio_den_; + int32 aspect_ratio_num_; +}; + +class GpuVideoDecoderInitDoneParam { + public: + enum SurfaceType { + SurfaceTypeSystemMemory, + SurfaceTypeD3D, + SurfaceTypeEGLImage, + }; + enum SurfaceFormat { + SurfaceFormat_YV12, + SurfaceFormat_NV12, + SurfaceFormat_XRGB, + }; + int32 success_; // other parameter is only meaningful when this is true. + int32 provides_buffer; + int32 format_; + int32 surface_type_; + int32 stride_; + int32 input_buffer_size_; + int32 output_buffer_size_; + base::SharedMemoryHandle input_buffer_handle_; + // we do not need this if hardware composition is ready. + base::SharedMemoryHandle output_buffer_handle_; +}; + +class GpuVideoDecoderInputBufferParam { + public: + int64 timestamp_; // In unit of microseconds. + int32 offset_; + int32 size_; + int32 flags_; // miscellaneous flag bit mask +}; + +class GpuVideoDecoderOutputBufferParam { + public: + int64 timestamp_; // In unit of microseconds. + int64 duration_; // In unit of microseconds. + int32 flags_; // miscellaneous flag bit mask + + enum { + kFlagsEndOfStream = 0x00000001, + kFlagsDiscontinuous = 0x00000002, + }; +}; + +class GpuVideoDecoderErrorInfoParam { + public: + int32 error_id; // TODO(jiesun): define enum. +}; + +// TODO(jiesun): define this. +class GpuVideoDecoderFormatChangeParam { + public: + int32 stride_; + int32 input_buffer_size_; + int32 output_buffer_size_; + base::SharedMemoryHandle input_buffer_handle_; + base::SharedMemoryHandle output_buffer_handle_; +}; + +namespace IPC { + +template <> +struct ParamTraits<GpuVideoServiceInfoParam> { + typedef GpuVideoServiceInfoParam param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::wstring* l); +}; + +template <> +struct ParamTraits<GpuVideoDecoderInfoParam> { + typedef GpuVideoDecoderInfoParam param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::wstring* l); +}; + +template <> +struct ParamTraits<GpuVideoDecoderInitParam> { + typedef GpuVideoDecoderInitParam param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::wstring* l); +}; + +template <> +struct ParamTraits<GpuVideoDecoderInitDoneParam> { + typedef GpuVideoDecoderInitDoneParam param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::wstring* l); +}; + +template <> +struct ParamTraits<GpuVideoDecoderInputBufferParam> { + typedef GpuVideoDecoderInputBufferParam param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::wstring* l); +}; + +template <> +struct ParamTraits<GpuVideoDecoderOutputBufferParam> { + typedef GpuVideoDecoderOutputBufferParam param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::wstring* l); +}; + +template <> +struct ParamTraits<GpuVideoDecoderErrorInfoParam> { + typedef GpuVideoDecoderErrorInfoParam param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::wstring* l); +}; + +template <> +struct ParamTraits<GpuVideoDecoderFormatChangeParam> { + typedef GpuVideoDecoderFormatChangeParam param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::wstring* l); +}; +}; + +#endif // CHROME_COMMON_GPU_VIDEO_COMMON_H_ + |