OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ |
6 #define MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 bool is_audio, MediaCodecStatus status, | 90 bool is_audio, MediaCodecStatus status, |
91 const base::TimeDelta& presentation_timestamp, | 91 const base::TimeDelta& presentation_timestamp, |
92 size_t audio_output_bytes); | 92 size_t audio_output_bytes); |
93 | 93 |
94 // Gets MediaCrypto object from |drm_bridge_|. | 94 // Gets MediaCrypto object from |drm_bridge_|. |
95 base::android::ScopedJavaLocalRef<jobject> GetMediaCrypto(); | 95 base::android::ScopedJavaLocalRef<jobject> GetMediaCrypto(); |
96 | 96 |
97 // Callback to notify that MediaCrypto is ready in |drm_bridge_|. | 97 // Callback to notify that MediaCrypto is ready in |drm_bridge_|. |
98 void OnMediaCryptoReady(); | 98 void OnMediaCryptoReady(); |
99 | 99 |
100 // Handle pending events when all the decoder jobs finished. | 100 // Handle pending events if all the decoder jobs are not currently decoding. |
101 void ProcessPendingEvents(); | 101 void ProcessPendingEvents(); |
102 | 102 |
103 // Helper method to clear any pending |SURFACE_CHANGE_EVENT_PENDING| | 103 // Helper method to clear any pending |SURFACE_CHANGE_EVENT_PENDING| |
104 // and reset |video_decoder_job_| to null. | 104 // and reset |video_decoder_job_| to null. |
105 void ResetVideoDecoderJob(); | 105 void ResetVideoDecoderJob(); |
106 | 106 |
107 // Helper methods to configure the decoder jobs. | 107 // Helper methods to configure the decoder jobs. |
108 void ConfigureVideoDecoderJob(); | 108 void ConfigureVideoDecoderJob(); |
109 void ConfigureAudioDecoderJob(); | 109 void ConfigureAudioDecoderJob(); |
110 | 110 |
111 // Flush the decoders and clean up all the data needs to be decoded. | 111 // Flush the decoders and clean up all the data needs to be decoded. |
112 void ClearDecodingData(); | 112 void ClearDecodingData(); |
113 | 113 |
114 // Called to decode more data. | 114 // Called to decode more data. |
115 void DecodeMoreAudio(); | 115 void DecodeMoreAudio(); |
116 void DecodeMoreVideo(); | 116 void DecodeMoreVideo(); |
117 | 117 |
118 // Functions check whether audio/video is present. | 118 // Functions check whether audio/video is present. |
119 bool HasVideo(); | 119 bool HasVideo(); |
120 bool HasAudio(); | 120 bool HasAudio(); |
121 | 121 |
| 122 // Functions that check whether audio/video stream has reached end of output |
| 123 // or are not present in player configuration. |
| 124 bool AudioFinished(); |
| 125 bool VideoFinished(); |
| 126 |
122 // Determine seekability based on duration. | 127 // Determine seekability based on duration. |
123 bool Seekable(); | 128 bool Seekable(); |
124 | 129 |
125 // Called when the |decoder_starvation_callback_| times out. | 130 // Called when the |decoder_starvation_callback_| times out. |
126 void OnDecoderStarved(); | 131 void OnDecoderStarved(); |
127 | 132 |
128 // Starts the |decoder_starvation_callback_| task with the timeout value. | 133 // Starts the |decoder_starvation_callback_| task with the timeout value. |
129 // |presentation_timestamp| - The presentation timestamp used for starvation | 134 // |presentation_timestamp| - The presentation timestamp used for starvation |
130 // timeout computations. It represents the timestamp of the last piece of | 135 // timeout computations. It represents the timestamp of the last piece of |
131 // decoded data. | 136 // decoded data. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // Stats about the media. | 196 // Stats about the media. |
192 base::TimeDelta duration_; | 197 base::TimeDelta duration_; |
193 int width_; | 198 int width_; |
194 int height_; | 199 int height_; |
195 AudioCodec audio_codec_; | 200 AudioCodec audio_codec_; |
196 VideoCodec video_codec_; | 201 VideoCodec video_codec_; |
197 int num_channels_; | 202 int num_channels_; |
198 int sampling_rate_; | 203 int sampling_rate_; |
199 // TODO(xhwang/qinmin): Add |video_extra_data_|. | 204 // TODO(xhwang/qinmin): Add |video_extra_data_|. |
200 std::vector<uint8> audio_extra_data_; | 205 std::vector<uint8> audio_extra_data_; |
201 bool audio_finished_; | 206 bool reached_audio_eos_; |
202 bool video_finished_; | 207 bool reached_video_eos_; |
203 bool playing_; | 208 bool playing_; |
204 bool is_audio_encrypted_; | 209 bool is_audio_encrypted_; |
205 bool is_video_encrypted_; | 210 bool is_video_encrypted_; |
206 double volume_; | 211 double volume_; |
207 | 212 |
208 // base::TickClock used by |clock_|. | 213 // base::TickClock used by |clock_|. |
209 base::DefaultTickClock default_tick_clock_; | 214 base::DefaultTickClock default_tick_clock_; |
210 | 215 |
211 // Reference clock. Keeps track of current playback time. | 216 // Reference clock. Keeps track of current playback time. |
212 Clock clock_; | 217 Clock clock_; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 // Test-only callback for hooking the completion of the next decode cycle. | 280 // Test-only callback for hooking the completion of the next decode cycle. |
276 base::Closure decode_callback_for_testing_; | 281 base::Closure decode_callback_for_testing_; |
277 | 282 |
278 friend class MediaSourcePlayerTest; | 283 friend class MediaSourcePlayerTest; |
279 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer); | 284 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer); |
280 }; | 285 }; |
281 | 286 |
282 } // namespace media | 287 } // namespace media |
283 | 288 |
284 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ | 289 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ |
OLD | NEW |