OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_RENDERER_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_ | 5 #ifndef WEBKIT_RENDERER_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_ |
6 #define WEBKIT_RENDERER_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_ | 6 #define WEBKIT_RENDERER_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 inline void operator()(void* media_source_delegate) const { | 43 inline void operator()(void* media_source_delegate) const { |
44 static_cast<MediaSourceDelegate*>(media_source_delegate)->Destroy(); | 44 static_cast<MediaSourceDelegate*>(media_source_delegate)->Destroy(); |
45 } | 45 } |
46 }; | 46 }; |
47 | 47 |
48 MediaSourceDelegate(WebMediaPlayerProxyAndroid* proxy, | 48 MediaSourceDelegate(WebMediaPlayerProxyAndroid* proxy, |
49 int player_id, | 49 int player_id, |
50 media::MediaLog* media_log); | 50 media::MediaLog* media_log); |
51 // Initialize the MediaSourceDelegate. |media_source| will be owned by | 51 // Initialize the MediaSourceDelegate. |media_source| will be owned by |
52 // this object after this call. | 52 // this object after this call. |
53 void Initialize(WebKit::WebMediaSource* media_source, | 53 void InitializeMediaSource( |
54 const media::NeedKeyCB& need_key_cb, | 54 WebKit::WebMediaSource* media_source, |
55 const UpdateNetworkStateCB& update_network_state_cb); | 55 const media::NeedKeyCB& need_key_cb, |
| 56 const UpdateNetworkStateCB& update_network_state_cb); |
| 57 #if defined(GOOGLE_TV) |
| 58 void InitializeMediaStream( |
| 59 media::Demuxer* demuxer, |
| 60 const UpdateNetworkStateCB& update_network_state_cb); |
| 61 #endif |
56 | 62 |
57 const WebKit::WebTimeRanges& Buffered(); | 63 const WebKit::WebTimeRanges& Buffered(); |
58 size_t DecodedFrameCount() const; | 64 size_t DecodedFrameCount() const; |
59 size_t DroppedFrameCount() const; | 65 size_t DroppedFrameCount() const; |
60 size_t AudioDecodedByteCount() const; | 66 size_t AudioDecodedByteCount() const; |
61 size_t VideoDecodedByteCount() const; | 67 size_t VideoDecodedByteCount() const; |
62 | 68 |
63 void Seek(base::TimeDelta time); | 69 void Seek(base::TimeDelta time); |
64 | 70 |
65 void CancelPendingSeek(); | 71 void CancelPendingSeek(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 media::DemuxerStream* stream, | 110 media::DemuxerStream* stream, |
105 media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params* params, | 111 media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params* params, |
106 size_t index); | 112 size_t index); |
107 void OnBufferReady( | 113 void OnBufferReady( |
108 media::DemuxerStream* stream, | 114 media::DemuxerStream* stream, |
109 media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params* params, | 115 media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params* params, |
110 size_t index, | 116 size_t index, |
111 media::DemuxerStream::Status status, | 117 media::DemuxerStream::Status status, |
112 const scoped_refptr<media::DecoderBuffer>& buffer); | 118 const scoped_refptr<media::DecoderBuffer>& buffer); |
113 | 119 |
| 120 // Helper function for calculating duration. |
| 121 int GetDurationMs(); |
| 122 |
114 base::WeakPtrFactory<MediaSourceDelegate> weak_this_; | 123 base::WeakPtrFactory<MediaSourceDelegate> weak_this_; |
115 | 124 |
116 WebMediaPlayerProxyAndroid* proxy_; | 125 WebMediaPlayerProxyAndroid* proxy_; |
117 int player_id_; | 126 int player_id_; |
118 | 127 |
119 scoped_refptr<media::MediaLog> media_log_; | 128 scoped_refptr<media::MediaLog> media_log_; |
120 UpdateNetworkStateCB update_network_state_cb_; | 129 UpdateNetworkStateCB update_network_state_cb_; |
121 | 130 |
122 scoped_ptr<media::ChunkDemuxer> chunk_demuxer_; | 131 scoped_ptr<media::ChunkDemuxer> chunk_demuxer_; |
123 scoped_ptr<WebKit::WebMediaSource> media_source_; | 132 scoped_ptr<WebKit::WebMediaSource> media_source_; |
| 133 media::Demuxer* demuxer_; |
124 | 134 |
125 media::PipelineStatistics statistics_; | 135 media::PipelineStatistics statistics_; |
126 media::Ranges<base::TimeDelta> buffered_time_ranges_; | 136 media::Ranges<base::TimeDelta> buffered_time_ranges_; |
127 // Keep a list of buffered time ranges. | 137 // Keep a list of buffered time ranges. |
128 WebKit::WebTimeRanges buffered_web_time_ranges_; | 138 WebKit::WebTimeRanges buffered_web_time_ranges_; |
129 | 139 |
130 media::NeedKeyCB need_key_cb_; | 140 media::NeedKeyCB need_key_cb_; |
131 | 141 |
132 // The currently selected key system. Empty string means that no key system | 142 // The currently selected key system. Empty string means that no key system |
133 // has been selected. | 143 // has been selected. |
134 WebKit::WebString current_key_system_; | 144 WebKit::WebString current_key_system_; |
135 | 145 |
136 // Temporary for EME v0.1. In the future the init data type should be passed | 146 // Temporary for EME v0.1. In the future the init data type should be passed |
137 // through GenerateKeyRequest() directly from WebKit. | 147 // through GenerateKeyRequest() directly from WebKit. |
138 std::string init_data_type_; | 148 std::string init_data_type_; |
139 | 149 |
140 scoped_ptr<media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params> audio_params_; | 150 scoped_ptr<media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params> audio_params_; |
141 scoped_ptr<media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params> video_params_; | 151 scoped_ptr<media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params> video_params_; |
142 | 152 |
143 bool seeking_; | 153 bool seeking_; |
| 154 size_t access_unit_size_; |
144 | 155 |
145 DISALLOW_COPY_AND_ASSIGN(MediaSourceDelegate); | 156 DISALLOW_COPY_AND_ASSIGN(MediaSourceDelegate); |
146 }; | 157 }; |
147 | 158 |
148 } // namespace webkit_media | 159 } // namespace webkit_media |
149 #endif // WEBKIT_RENDERER_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_ | 160 #endif // WEBKIT_RENDERER_MEDIA_ANDROID_MEDIA_SOURCE_DELEGATE_H_ |
OLD | NEW |