diff options
author | erickung <erickung@chromium.org> | 2014-12-22 12:30:22 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-22 20:31:36 +0000 |
commit | 7218ee391b4251c878f0f74df0bfaf1f5cfcd9fb (patch) | |
tree | df4779f8f7ce930166f26a8e1f0457463900cef5 /chromecast/common | |
parent | 1ea31ca6935e488fdbb116bf81316cec1e7453bf (diff) | |
download | chromium_src-7218ee391b4251c878f0f74df0bfaf1f5cfcd9fb.zip chromium_src-7218ee391b4251c878f0f74df0bfaf1f5cfcd9fb.tar.gz chromium_src-7218ee391b4251c878f0f74df0bfaf1f5cfcd9fb.tar.bz2 |
Add CmaMediaRendererFactory and IPC components on render process
BUG=408189
Review URL: https://codereview.chromium.org/814403002
Cr-Commit-Position: refs/heads/master@{#309455}
Diffstat (limited to 'chromecast/common')
-rw-r--r-- | chromecast/common/chromecast_switches.cc | 3 | ||||
-rw-r--r-- | chromecast/common/chromecast_switches.h | 2 | ||||
-rw-r--r-- | chromecast/common/media/cma_ipc_common.h | 21 | ||||
-rw-r--r-- | chromecast/common/media/cma_messages.h | 27 | ||||
-rw-r--r-- | chromecast/common/media/cma_param_traits_macros.h | 7 | ||||
-rw-r--r-- | chromecast/common/media/shared_memory_chunk.cc | 36 | ||||
-rw-r--r-- | chromecast/common/media/shared_memory_chunk.h | 40 |
7 files changed, 122 insertions, 14 deletions
diff --git a/chromecast/common/chromecast_switches.cc b/chromecast/common/chromecast_switches.cc index 0ccbf7b..d66d2ff 100644 --- a/chromecast/common/chromecast_switches.cc +++ b/chromecast/common/chromecast_switches.cc @@ -6,6 +6,9 @@ namespace switches { +// Enable the CMA media pipeline. +const char kEnableCmaMediaPipeline[] = "enable-cma-media-pipeline"; + #if defined(OS_ANDROID) // Enable file accesses for debug. const char kEnableLocalFileAccesses[] = "enable-local-file-accesses"; diff --git a/chromecast/common/chromecast_switches.h b/chromecast/common/chromecast_switches.h index 4fc0e71..34b0f76 100644 --- a/chromecast/common/chromecast_switches.h +++ b/chromecast/common/chromecast_switches.h @@ -9,6 +9,8 @@ namespace switches { +extern const char kEnableCmaMediaPipeline[]; + #if defined(OS_ANDROID) // Content-implementation switches extern const char kEnableLocalFileAccesses[]; diff --git a/chromecast/common/media/cma_ipc_common.h b/chromecast/common/media/cma_ipc_common.h new file mode 100644 index 0000000..3431104 --- /dev/null +++ b/chromecast/common/media/cma_ipc_common.h @@ -0,0 +1,21 @@ +// Copyright 2014 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 CHROMECAST_COMMON_MEDIA_CMA_IPC_COMMON_H_ +#define CHROMECAST_COMMON_MEDIA_CMA_IPC_COMMON_H_ + +namespace chromecast { +namespace media { + +enum TrackId { + kNoTrackId = -1, + kAudioTrackId = 0, + kVideoTrackId = 1, +}; + +} // namespace media +} // namespace chromecast + +#endif // CHROMECAST_COMMON_MEDIA_CMA_IPC_COMMON_H_ + diff --git a/chromecast/common/media/cma_messages.h b/chromecast/common/media/cma_messages.h index 279147a..8e2b88f 100644 --- a/chromecast/common/media/cma_messages.h +++ b/chromecast/common/media/cma_messages.h @@ -5,6 +5,7 @@ // IPC messages for the Cast Media Acceleration (CMA) pipeline. // Multiply-included message file, hence no include guard. +#include "chromecast/common/media/cma_ipc_common.h" #include "chromecast/common/media/cma_param_traits.h" #include "chromecast/common/media/cma_param_traits_macros.h" #include "chromecast/media/cma/pipeline/load_type.h" @@ -44,23 +45,23 @@ IPC_MESSAGE_CONTROL2(CmaHostMsg_SetPlaybackRate, IPC_MESSAGE_CONTROL3(CmaHostMsg_CreateAvPipe, int /* Media pipeline ID */, - int /* Track ID */, + chromecast::media::TrackId /* Track ID */, size_t /* Fifo size */); IPC_MESSAGE_CONTROL3(CmaHostMsg_AudioInitialize, int /* Media pipeline ID */, - int /* Track ID */, + chromecast::media::TrackId /* Track ID */, media::AudioDecoderConfig /* Audio config */) IPC_MESSAGE_CONTROL3(CmaHostMsg_VideoInitialize, int /* Media pipeline ID */, - int /* Track ID */, + chromecast::media::TrackId /* Track ID */, media::VideoDecoderConfig /* Video config */) IPC_MESSAGE_CONTROL3(CmaHostMsg_SetVolume, int /* Media pipeline ID */, - int /* Track ID */, + chromecast::media::TrackId /* Track ID */, float /* Volume */) IPC_MESSAGE_CONTROL2(CmaHostMsg_NotifyPipeWrite, int /* Media pipeline ID */, - int /* Track ID */) + chromecast::media::TrackId /* Track ID */) IPC_MESSAGE_CONTROL5(CmaHostMsg_NotifyExternalSurface, int /* Surface ID */, @@ -85,30 +86,30 @@ IPC_MESSAGE_CONTROL2(CmaMsg_BufferingNotification, IPC_MESSAGE_CONTROL5(CmaMsg_AvPipeCreated, int /* Media pipeline ID */, - int /* Track ID */, + chromecast::media::TrackId /* Track ID */, bool /* Status */, base::SharedMemoryHandle /* Shared memory */, base::FileDescriptor /* socket handle */) IPC_MESSAGE_CONTROL3(CmaMsg_TrackStateChanged, int /* Media pipeline ID */, - int /* Track ID */, + chromecast::media::TrackId /* Track ID */, media::PipelineStatus /* Status */) IPC_MESSAGE_CONTROL2(CmaMsg_NotifyPipeRead, int /* Media pipeline ID */, - int /* Track ID */) + chromecast::media::TrackId /* Track ID */) IPC_MESSAGE_CONTROL2(CmaMsg_Eos, int /* Media pipeline ID */, - int /* Track ID */) + chromecast::media::TrackId /* Track ID */) IPC_MESSAGE_CONTROL3(CmaMsg_PlaybackError, int /* Media pipeline ID */, - int /* Track ID */, + chromecast::media::TrackId /* Track ID */, media::PipelineStatus /* status */) IPC_MESSAGE_CONTROL3(CmaMsg_PlaybackStatistics, int /* Media pipeline ID */, - int /* Track ID */, + chromecast::media::TrackId /* Track ID */, media::PipelineStatistics /* status */) IPC_MESSAGE_CONTROL3(CmaMsg_NaturalSizeChanged, int /* Media pipeline ID */, - int /* Track ID */, - gfx::Size /* Size */) + chromecast::media::TrackId /* Track ID */, + gfx::Size /* Size */)
\ No newline at end of file diff --git a/chromecast/common/media/cma_param_traits_macros.h b/chromecast/common/media/cma_param_traits_macros.h index abde3ec..7268200 100644 --- a/chromecast/common/media/cma_param_traits_macros.h +++ b/chromecast/common/media/cma_param_traits_macros.h @@ -8,6 +8,7 @@ #ifndef CHROMECAST_COMMON_MEDIA_CMA_PARAM_TRAITS_MACROS_H_ #define CHROMECAST_COMMON_MEDIA_CMA_PARAM_TRAITS_MACROS_H_ +#include "chromecast/common/media/cma_ipc_common.h" #include "chromecast/media/cma/pipeline/load_type.h" #include "ipc/ipc_message_macros.h" #include "ipc/param_traits_macros.h" @@ -23,6 +24,10 @@ IPC_ENUM_TRAITS_MIN_MAX_VALUE(chromecast::media::LoadType, chromecast::media::kLoadTypeURL, chromecast::media::kLoadTypeMediaStream) +IPC_ENUM_TRAITS_MIN_MAX_VALUE(chromecast::media::TrackId, + chromecast::media::kNoTrackId, + chromecast::media::kVideoTrackId) + IPC_ENUM_TRAITS_MIN_MAX_VALUE(media::AudioCodec, media::AudioCodec::kUnknownAudioCodec, media::AudioCodec::kAudioCodecMax) @@ -46,4 +51,4 @@ IPC_STRUCT_TRAITS_BEGIN(media::PipelineStatistics) IPC_STRUCT_TRAITS_MEMBER(video_frames_dropped) IPC_STRUCT_TRAITS_END() -#endif // CHROMECAST_COMMON_MEDIA_CMA_PARAM_TRAITS_MACROS_H_ +#endif // CHROMECAST_COMMON_MEDIA_CMA_PARAM_TRAITS_MACROS_H_
\ No newline at end of file diff --git a/chromecast/common/media/shared_memory_chunk.cc b/chromecast/common/media/shared_memory_chunk.cc new file mode 100644 index 0000000..4053395 --- /dev/null +++ b/chromecast/common/media/shared_memory_chunk.cc @@ -0,0 +1,36 @@ +// Copyright 2014 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 "chromecast/common/media/shared_memory_chunk.h" + +#include "base/memory/shared_memory.h" + +namespace chromecast { +namespace media { + +SharedMemoryChunk::SharedMemoryChunk( + scoped_ptr<base::SharedMemory> shared_mem, + size_t size) + : shared_mem_(shared_mem.Pass()), + size_(size) { +} + +SharedMemoryChunk::~SharedMemoryChunk() { +} + +void* SharedMemoryChunk::data() const { + return shared_mem_->memory(); +} + +size_t SharedMemoryChunk::size() const { + return size_; +} + +bool SharedMemoryChunk::valid() const { + return true; +} + +} // namespace media +} // namespace chromecast + diff --git a/chromecast/common/media/shared_memory_chunk.h b/chromecast/common/media/shared_memory_chunk.h new file mode 100644 index 0000000..a8b71c2 --- /dev/null +++ b/chromecast/common/media/shared_memory_chunk.h @@ -0,0 +1,40 @@ +// Copyright 2014 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 CHROMECAST_COMMON_MEDIA_SHARED_MEMORY_CHUNK_H_ +#define CHROMECAST_COMMON_MEDIA_SHARED_MEMORY_CHUNK_H_ + +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" +#include "chromecast/media/cma/ipc/media_memory_chunk.h" + +namespace base { +class SharedMemory; +} + +namespace chromecast { +namespace media { + +class SharedMemoryChunk : public MediaMemoryChunk { + public: + SharedMemoryChunk(scoped_ptr<base::SharedMemory> shared_mem, + size_t size); + ~SharedMemoryChunk() override; + + // MediaMemoryChunk implementation. + void* data() const override; + size_t size() const override; + bool valid() const override; + + private: + scoped_ptr<base::SharedMemory> shared_mem_; + size_t size_; + + DISALLOW_COPY_AND_ASSIGN(SharedMemoryChunk); +}; + +} // namespace media +} // namespace chromecast + +#endif // CHROMECAST_COMMON_MEDIA_SHARED_MEMORY_CHUNK_H_
\ No newline at end of file |