OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROMECAST_RENDERER_MEDIA_MEDIA_CHANNEL_PROXY_H_ |
| 6 #define CHROMECAST_RENDERER_MEDIA_MEDIA_CHANNEL_PROXY_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chromecast/media/cma/pipeline/load_type.h" |
| 12 #include "chromecast/renderer/media/cma_message_filter_proxy.h" |
| 13 |
| 14 namespace IPC { |
| 15 class Message; |
| 16 } |
| 17 |
| 18 namespace chromecast { |
| 19 namespace media { |
| 20 |
| 21 // MediaChannelProxy - Manage the lifetime of a CMA ipc channel. |
| 22 // Must be invoked from the IO thread of the renderer process. |
| 23 class MediaChannelProxy |
| 24 : public base::RefCountedThreadSafe<MediaChannelProxy> { |
| 25 public: |
| 26 MediaChannelProxy(); |
| 27 |
| 28 // Opens a CMA ipc channel. |
| 29 void Open(LoadType load_type); |
| 30 |
| 31 // Closes the ipc channel. |
| 32 void Close(); |
| 33 |
| 34 // Returns the ID of the CMA ipc channel. |
| 35 // Returns 0 or negative ID if no channel has been opened. |
| 36 int GetId() { return id_; } |
| 37 |
| 38 // Manages delegates. |
| 39 bool SetMediaDelegate( |
| 40 const CmaMessageFilterProxy::MediaDelegate& media_delegate); |
| 41 bool SetAudioDelegate( |
| 42 const CmaMessageFilterProxy::AudioDelegate& audio_delegate); |
| 43 bool SetVideoDelegate( |
| 44 const CmaMessageFilterProxy::VideoDelegate& video_delegate); |
| 45 |
| 46 // Sends an IPC message over this CMA ipc channel. |
| 47 bool Send(scoped_ptr<IPC::Message> message); |
| 48 |
| 49 private: |
| 50 friend class base::RefCountedThreadSafe<MediaChannelProxy>; |
| 51 virtual ~MediaChannelProxy(); |
| 52 |
| 53 // Message filter running on the renderer side. |
| 54 scoped_refptr<CmaMessageFilterProxy> filter_; |
| 55 |
| 56 // Indicates whether the CMA channel is open. |
| 57 bool is_open_; |
| 58 |
| 59 // Unique identifier per media pipeline. |
| 60 int id_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(MediaChannelProxy); |
| 63 }; |
| 64 |
| 65 } // namespace media |
| 66 } // namespace chromecast |
| 67 |
| 68 #endif // CHROMECAST_RENDERER_MEDIA_MEDIA_CHANNEL_PROXY_H_ |
OLD | NEW |