| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 // Playback is completed for one channel. | 84 // Playback is completed for one channel. |
| 85 void PlaybackCompleted(bool is_audio); | 85 void PlaybackCompleted(bool is_audio); |
| 86 | 86 |
| 87 // Called when the decoder finishes its task. | 87 // Called when the decoder finishes its task. |
| 88 void MediaDecoderCallback( | 88 void MediaDecoderCallback( |
| 89 bool is_audio, MediaCodecStatus status, | 89 bool is_audio, MediaCodecStatus status, |
| 90 base::TimeDelta current_presentation_timestamp, | 90 base::TimeDelta current_presentation_timestamp, |
| 91 base::TimeDelta max_presentation_timestamp); | 91 base::TimeDelta max_presentation_timestamp); |
| 92 | 92 |
| 93 bool IsPrerollFinished(bool is_audio) const; |
| 94 |
| 93 // Gets MediaCrypto object from |drm_bridge_|. | 95 // Gets MediaCrypto object from |drm_bridge_|. |
| 94 base::android::ScopedJavaLocalRef<jobject> GetMediaCrypto(); | 96 base::android::ScopedJavaLocalRef<jobject> GetMediaCrypto(); |
| 95 | 97 |
| 96 // Callback to notify that MediaCrypto is ready in |drm_bridge_|. | 98 // Callback to notify that MediaCrypto is ready in |drm_bridge_|. |
| 97 void OnMediaCryptoReady(); | 99 void OnMediaCryptoReady(); |
| 98 | 100 |
| 99 // Handle pending events if all the decoder jobs are not currently decoding. | 101 // Handle pending events if all the decoder jobs are not currently decoding. |
| 100 void ProcessPendingEvents(); | 102 void ProcessPendingEvents(); |
| 101 | 103 |
| 102 // Flush the decoders and clean up all the data needs to be decoded. | 104 // Flush the decoders and clean up all the data needs to be decoded. |
| 103 void ClearDecodingData(); | 105 void ClearDecodingData(); |
| 104 | 106 |
| 105 // Called to decode more data. | 107 // Called to decode more data. |
| 106 void DecodeMoreAudio(); | 108 void DecodeMoreAudio(); |
| 107 void DecodeMoreVideo(); | 109 void DecodeMoreVideo(); |
| 108 | 110 |
| 109 // Functions check whether audio/video is present. | 111 // Functions check whether audio/video is present. |
| 110 bool HasVideo(); | 112 bool HasVideo() const; |
| 111 bool HasAudio(); | 113 bool HasAudio() const; |
| 112 | 114 |
| 113 // Functions that check whether audio/video stream has reached end of output | 115 // Functions that check whether audio/video stream has reached end of output |
| 114 // or are not present in player configuration. | 116 // or are not present in player configuration. |
| 115 bool AudioFinished(); | 117 bool AudioFinished(); |
| 116 bool VideoFinished(); | 118 bool VideoFinished(); |
| 117 | 119 |
| 118 // Determine seekability based on duration. | 120 // Determine seekability based on duration. |
| 119 bool Seekable(); | 121 bool Seekable(); |
| 120 | 122 |
| 121 // Called when the |decoder_starvation_callback_| times out. | 123 // Called when the |decoder_starvation_callback_| times out. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 253 |
| 252 // Indicates whether the player is waiting for audio or video decoder to be | 254 // Indicates whether the player is waiting for audio or video decoder to be |
| 253 // created. This could happen if video surface is not available or key is | 255 // created. This could happen if video surface is not available or key is |
| 254 // not added. | 256 // not added. |
| 255 bool is_waiting_for_audio_decoder_; | 257 bool is_waiting_for_audio_decoder_; |
| 256 bool is_waiting_for_video_decoder_; | 258 bool is_waiting_for_video_decoder_; |
| 257 | 259 |
| 258 // Test-only callback for hooking the completion of the next decode cycle. | 260 // Test-only callback for hooking the completion of the next decode cycle. |
| 259 base::Closure decode_callback_for_testing_; | 261 base::Closure decode_callback_for_testing_; |
| 260 | 262 |
| 263 // Whether audio or video decoder is in the process of prerolling. |
| 264 bool prerolling_; |
| 265 |
| 261 // Weak pointer passed to media decoder jobs for callbacks. | 266 // Weak pointer passed to media decoder jobs for callbacks. |
| 262 // NOTE: Weak pointers must be invalidated before all other member variables. | 267 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 263 base::WeakPtrFactory<MediaSourcePlayer> weak_factory_; | 268 base::WeakPtrFactory<MediaSourcePlayer> weak_factory_; |
| 264 base::WeakPtr<MediaSourcePlayer> weak_this_; | 269 base::WeakPtr<MediaSourcePlayer> weak_this_; |
| 265 | 270 |
| 266 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer); | 271 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer); |
| 267 }; | 272 }; |
| 268 | 273 |
| 269 } // namespace media | 274 } // namespace media |
| 270 | 275 |
| 271 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ | 276 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ |
| OLD | NEW |