OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ | 5 #ifndef WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ |
6 #define WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ | 6 #define WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "media/base/pipeline.h" | 14 #include "media/base/pipeline.h" |
15 #include "media/crypto/decryptor_client.h" | |
15 #include "media/filters/chunk_demuxer.h" | 16 #include "media/filters/chunk_demuxer.h" |
16 #include "media/filters/chunk_demuxer_client.h" | 17 #include "media/filters/chunk_demuxer_client.h" |
17 #include "media/filters/ffmpeg_video_decoder.h" | 18 #include "media/filters/ffmpeg_video_decoder.h" |
18 #include "webkit/media/buffered_data_source.h" | 19 #include "webkit/media/buffered_data_source.h" |
19 #include "webkit/media/skcanvas_video_renderer.h" | 20 #include "webkit/media/skcanvas_video_renderer.h" |
20 | 21 |
21 class SkCanvas; | 22 class SkCanvas; |
22 | 23 |
23 namespace base { | 24 namespace base { |
24 class MessageLoopProxy; | 25 class MessageLoopProxy; |
25 } | 26 } |
26 | 27 |
27 namespace gfx { | 28 namespace gfx { |
28 class Rect; | 29 class Rect; |
29 } | 30 } |
30 | 31 |
31 namespace media { | 32 namespace media { |
32 class VideoFrame; | 33 class VideoFrame; |
33 class VideoRendererBase; | 34 class VideoRendererBase; |
34 } | 35 } |
35 | 36 |
36 namespace webkit_media { | 37 namespace webkit_media { |
37 | 38 |
38 class WebMediaPlayerImpl; | 39 class WebMediaPlayerImpl; |
39 | 40 |
40 // Acts as a thread proxy between the various threads used for multimedia and | 41 // Acts as a thread proxy between the various threads used for multimedia and |
41 // the render thread that WebMediaPlayerImpl is running on. | 42 // the render thread that WebMediaPlayerImpl is running on. |
42 class WebMediaPlayerProxy | 43 class WebMediaPlayerProxy |
43 : public base::RefCountedThreadSafe<WebMediaPlayerProxy>, | 44 : public base::RefCountedThreadSafe<WebMediaPlayerProxy>, |
44 public media::ChunkDemuxerClient { | 45 public media::ChunkDemuxerClient, |
46 public media::DecryptorClient { | |
45 public: | 47 public: |
46 WebMediaPlayerProxy(const scoped_refptr<base::MessageLoopProxy>& render_loop, | 48 WebMediaPlayerProxy(const scoped_refptr<base::MessageLoopProxy>& render_loop, |
47 WebMediaPlayerImpl* webmediaplayer); | 49 WebMediaPlayerImpl* webmediaplayer); |
48 const scoped_refptr<BufferedDataSource>& data_source() { | 50 const scoped_refptr<BufferedDataSource>& data_source() { |
49 return data_source_; | 51 return data_source_; |
50 } | 52 } |
51 void set_data_source(const scoped_refptr<BufferedDataSource>& data_source) { | 53 void set_data_source(const scoped_refptr<BufferedDataSource>& data_source) { |
52 data_source_ = data_source; | 54 data_source_ = data_source; |
53 } | 55 } |
54 | 56 |
(...skipping 28 matching lines...) Expand all Loading... | |
83 // Methods for Pipeline -> WebMediaPlayerImpl communication. | 85 // Methods for Pipeline -> WebMediaPlayerImpl communication. |
84 void PipelineInitializationCallback(media::PipelineStatus status); | 86 void PipelineInitializationCallback(media::PipelineStatus status); |
85 void PipelineSeekCallback(media::PipelineStatus status); | 87 void PipelineSeekCallback(media::PipelineStatus status); |
86 void PipelineEndedCallback(media::PipelineStatus status); | 88 void PipelineEndedCallback(media::PipelineStatus status); |
87 void PipelineErrorCallback(media::PipelineStatus error); | 89 void PipelineErrorCallback(media::PipelineStatus error); |
88 void NetworkEventCallback(media::NetworkEvent type); | 90 void NetworkEventCallback(media::NetworkEvent type); |
89 | 91 |
90 // ChunkDemuxerClient implementation. | 92 // ChunkDemuxerClient implementation. |
91 virtual void DemuxerOpened(media::ChunkDemuxer* demuxer) OVERRIDE; | 93 virtual void DemuxerOpened(media::ChunkDemuxer* demuxer) OVERRIDE; |
92 virtual void DemuxerClosed() OVERRIDE; | 94 virtual void DemuxerClosed() OVERRIDE; |
93 virtual void KeyNeeded(scoped_array<uint8> init_data, | 95 virtual void DemuxerKeyNeeded(scoped_array<uint8> init_data, |
94 int init_data_size) OVERRIDE; | 96 int init_data_size) OVERRIDE; |
95 | 97 |
96 // Methods for Demuxer communication. | 98 // Methods for Demuxer communication. |
97 void DemuxerStartWaitingForSeek(); | 99 void DemuxerStartWaitingForSeek(); |
98 media::ChunkDemuxer::Status DemuxerAddId(const std::string& id, | 100 media::ChunkDemuxer::Status DemuxerAddId(const std::string& id, |
99 const std::string& type, | 101 const std::string& type, |
100 std::vector<std::string>& codecs); | 102 std::vector<std::string>& codecs); |
101 void DemuxerRemoveId(const std::string& id); | 103 void DemuxerRemoveId(const std::string& id); |
102 bool DemuxerBufferedRange(const std::string& id, | 104 bool DemuxerBufferedRange(const std::string& id, |
103 media::ChunkDemuxer::Ranges* ranges_out); | 105 media::ChunkDemuxer::Ranges* ranges_out); |
104 bool DemuxerAppend(const std::string& id, const uint8* data, size_t length); | 106 bool DemuxerAppend(const std::string& id, const uint8* data, size_t length); |
105 void DemuxerAbort(const std::string& id); | 107 void DemuxerAbort(const std::string& id); |
106 void DemuxerEndOfStream(media::PipelineStatus status); | 108 void DemuxerEndOfStream(media::PipelineStatus status); |
107 void DemuxerShutdown(); | 109 void DemuxerShutdown(); |
108 | 110 |
109 void DemuxerOpenedTask(const scoped_refptr<media::ChunkDemuxer>& demuxer); | 111 void DemuxerOpenedTask(const scoped_refptr<media::ChunkDemuxer>& demuxer); |
110 void DemuxerClosedTask(); | 112 void DemuxerClosedTask(); |
111 void KeyNeededTask(scoped_array<uint8> init_data, int init_data_size); | 113 |
114 // DecryptorClient implementation. | |
115 virtual void KeyAdded(const std::string& key_system, | |
116 const std::string& session_id) OVERRIDE; | |
117 virtual void KeyError(const std::string& key_system, | |
118 const std::string& session_id, | |
119 media::AesDecryptor::KeyError error_code, | |
120 int system_code) OVERRIDE; | |
121 virtual void KeyMessage(const std::string& key_system, | |
122 const std::string& session_id, | |
123 scoped_array<uint8> message, | |
124 int message_length, | |
125 const std::string& default_url) OVERRIDE; | |
126 virtual void KeyNeeded(const std::string& key_system, | |
127 const std::string& session_id, | |
128 scoped_array<uint8> init_data, | |
129 int init_data_size) OVERRIDE; | |
130 | |
131 // Methods for DecryptorClient -> WebMediaPlayerImpl communication. | |
ddorwin
2012/06/11 21:02:40
These should be private, right?
scherkus (not reviewing)
2012/06/12 03:15:58
yep
xhwang
2012/06/12 19:01:15
Done.
xhwang
2012/06/12 19:01:15
Done.
| |
132 void KeyAddedTask(const std::string& key_system, | |
133 const std::string& session_id); | |
134 void KeyErrorTask(const std::string& key_system, | |
135 const std::string& session_id, | |
136 media::AesDecryptor::KeyError error_code, | |
137 int system_code); | |
138 void KeyMessageTask(const std::string& key_system, | |
139 const std::string& session_id, | |
140 scoped_array<uint8> message, | |
141 int message_length, | |
142 const std::string& default_url); | |
143 void KeyNeededTask(const std::string& key_system, | |
144 const std::string& session_id, | |
145 scoped_array<uint8> init_data, | |
146 int init_data_size); | |
112 | 147 |
113 private: | 148 private: |
114 friend class base::RefCountedThreadSafe<WebMediaPlayerProxy>; | 149 friend class base::RefCountedThreadSafe<WebMediaPlayerProxy>; |
115 virtual ~WebMediaPlayerProxy(); | 150 virtual ~WebMediaPlayerProxy(); |
116 | 151 |
117 // Invoke |webmediaplayer_| to perform a repaint. | 152 // Invoke |webmediaplayer_| to perform a repaint. |
118 void RepaintTask(); | 153 void RepaintTask(); |
119 | 154 |
120 // Notify |webmediaplayer_| that initialization has finished. | 155 // Notify |webmediaplayer_| that initialization has finished. |
121 void PipelineInitializationTask(media::PipelineStatus status); | 156 void PipelineInitializationTask(media::PipelineStatus status); |
(...skipping 27 matching lines...) Expand all Loading... | |
149 int outstanding_repaints_; | 184 int outstanding_repaints_; |
150 | 185 |
151 scoped_refptr<media::ChunkDemuxer> chunk_demuxer_; | 186 scoped_refptr<media::ChunkDemuxer> chunk_demuxer_; |
152 | 187 |
153 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerProxy); | 188 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMediaPlayerProxy); |
154 }; | 189 }; |
155 | 190 |
156 } // namespace webkit_media | 191 } // namespace webkit_media |
157 | 192 |
158 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ | 193 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_PROXY_H_ |
OLD | NEW |