| 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 23 matching lines...) Expand all Loading... |
| 34 // This class handles media source extensions on Android. It uses Android | 34 // This class handles media source extensions on Android. It uses Android |
| 35 // MediaCodec to decode audio and video streams in two separate threads. | 35 // MediaCodec to decode audio and video streams in two separate threads. |
| 36 class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid, | 36 class MEDIA_EXPORT MediaSourcePlayer : public MediaPlayerAndroid, |
| 37 public DemuxerAndroidClient { | 37 public DemuxerAndroidClient { |
| 38 public: | 38 public: |
| 39 // Constructs a player with the given ID and demuxer. |manager| must outlive | 39 // Constructs a player with the given ID and demuxer. |manager| must outlive |
| 40 // the lifetime of this object. | 40 // the lifetime of this object. |
| 41 MediaSourcePlayer(int player_id, | 41 MediaSourcePlayer(int player_id, |
| 42 MediaPlayerManager* manager, | 42 MediaPlayerManager* manager, |
| 43 const RequestMediaResourcesCB& request_media_resources_cb, | 43 const RequestMediaResourcesCB& request_media_resources_cb, |
| 44 const ReleaseMediaResourcesCB& release_media_resources_cb, | |
| 45 scoped_ptr<DemuxerAndroid> demuxer, | 44 scoped_ptr<DemuxerAndroid> demuxer, |
| 46 const GURL& frame_url); | 45 const GURL& frame_url); |
| 47 virtual ~MediaSourcePlayer(); | 46 virtual ~MediaSourcePlayer(); |
| 48 | 47 |
| 49 // MediaPlayerAndroid implementation. | 48 // MediaPlayerAndroid implementation. |
| 50 virtual void SetVideoSurface(gfx::ScopedJavaSurface surface) OVERRIDE; | 49 virtual void SetVideoSurface(gfx::ScopedJavaSurface surface) OVERRIDE; |
| 51 virtual void Start() OVERRIDE; | 50 virtual void Start() OVERRIDE; |
| 52 virtual void Pause(bool is_media_related_action ALLOW_UNUSED) OVERRIDE; | 51 virtual void Pause(bool is_media_related_action ALLOW_UNUSED) OVERRIDE; |
| 53 virtual void SeekTo(base::TimeDelta timestamp) OVERRIDE; | 52 virtual void SeekTo(base::TimeDelta timestamp) OVERRIDE; |
| 54 virtual void Release() OVERRIDE; | 53 virtual void Release() OVERRIDE; |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 251 |
| 253 // Indicates whether the player is waiting for audio or video decoder to be | 252 // Indicates whether the player is waiting for audio or video decoder to be |
| 254 // created. This could happen if video surface is not available or key is | 253 // created. This could happen if video surface is not available or key is |
| 255 // not added. | 254 // not added. |
| 256 bool is_waiting_for_audio_decoder_; | 255 bool is_waiting_for_audio_decoder_; |
| 257 bool is_waiting_for_video_decoder_; | 256 bool is_waiting_for_video_decoder_; |
| 258 | 257 |
| 259 // Test-only callback for hooking the completion of the next decode cycle. | 258 // Test-only callback for hooking the completion of the next decode cycle. |
| 260 base::Closure decode_callback_for_testing_; | 259 base::Closure decode_callback_for_testing_; |
| 261 | 260 |
| 262 // Whether |surface_| is currently used by the player. | |
| 263 bool is_surface_in_use_; | |
| 264 | |
| 265 // Weak pointer passed to media decoder jobs for callbacks. | 261 // Weak pointer passed to media decoder jobs for callbacks. |
| 266 // NOTE: Weak pointers must be invalidated before all other member variables. | 262 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 267 base::WeakPtrFactory<MediaSourcePlayer> weak_factory_; | 263 base::WeakPtrFactory<MediaSourcePlayer> weak_factory_; |
| 268 base::WeakPtr<MediaSourcePlayer> weak_this_; | 264 base::WeakPtr<MediaSourcePlayer> weak_this_; |
| 269 | 265 |
| 270 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer); | 266 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer); |
| 271 }; | 267 }; |
| 272 | 268 |
| 273 } // namespace media | 269 } // namespace media |
| 274 | 270 |
| 275 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ | 271 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ |
| OLD | NEW |