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 25 matching lines...) Expand all Loading... |
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 scoped_ptr<DemuxerAndroid> demuxer, | 44 scoped_ptr<DemuxerAndroid> demuxer, |
45 const GURL& frame_url); | 45 const GURL& frame_url); |
46 virtual ~MediaSourcePlayer(); | 46 ~MediaSourcePlayer() override; |
47 | 47 |
48 // MediaPlayerAndroid implementation. | 48 // MediaPlayerAndroid implementation. |
49 virtual void SetVideoSurface(gfx::ScopedJavaSurface surface) override; | 49 void SetVideoSurface(gfx::ScopedJavaSurface surface) override; |
50 virtual void Start() override; | 50 void Start() override; |
51 virtual void Pause(bool is_media_related_action) override; | 51 void Pause(bool is_media_related_action) override; |
52 virtual void SeekTo(base::TimeDelta timestamp) override; | 52 void SeekTo(base::TimeDelta timestamp) override; |
53 virtual void Release() override; | 53 void Release() override; |
54 virtual void SetVolume(double volume) override; | 54 void SetVolume(double volume) override; |
55 virtual int GetVideoWidth() override; | 55 int GetVideoWidth() override; |
56 virtual int GetVideoHeight() override; | 56 int GetVideoHeight() override; |
57 virtual base::TimeDelta GetCurrentTime() override; | 57 base::TimeDelta GetCurrentTime() override; |
58 virtual base::TimeDelta GetDuration() override; | 58 base::TimeDelta GetDuration() override; |
59 virtual bool IsPlaying() override; | 59 bool IsPlaying() override; |
60 virtual bool CanPause() override; | 60 bool CanPause() override; |
61 virtual bool CanSeekForward() override; | 61 bool CanSeekForward() override; |
62 virtual bool CanSeekBackward() override; | 62 bool CanSeekBackward() override; |
63 virtual bool IsPlayerReady() override; | 63 bool IsPlayerReady() override; |
64 virtual void SetCdm(BrowserCdm* cdm) override; | 64 void SetCdm(BrowserCdm* cdm) override; |
65 | 65 |
66 // DemuxerAndroidClient implementation. | 66 // DemuxerAndroidClient implementation. |
67 virtual void OnDemuxerConfigsAvailable(const DemuxerConfigs& params) override; | 67 void OnDemuxerConfigsAvailable(const DemuxerConfigs& params) override; |
68 virtual void OnDemuxerDataAvailable(const DemuxerData& params) override; | 68 void OnDemuxerDataAvailable(const DemuxerData& params) override; |
69 virtual void OnDemuxerSeekDone( | 69 void OnDemuxerSeekDone(base::TimeDelta actual_browser_seek_time) override; |
70 base::TimeDelta actual_browser_seek_time) override; | 70 void OnDemuxerDurationChanged(base::TimeDelta duration) override; |
71 virtual void OnDemuxerDurationChanged(base::TimeDelta duration) override; | |
72 | 71 |
73 private: | 72 private: |
74 friend class MediaSourcePlayerTest; | 73 friend class MediaSourcePlayerTest; |
75 | 74 |
76 // Update the current timestamp. | 75 // Update the current timestamp. |
77 void UpdateTimestamps(base::TimeDelta current_presentation_timestamp, | 76 void UpdateTimestamps(base::TimeDelta current_presentation_timestamp, |
78 base::TimeDelta max_presentation_timestamp); | 77 base::TimeDelta max_presentation_timestamp); |
79 | 78 |
80 // Helper function for starting media playback. | 79 // Helper function for starting media playback. |
81 void StartInternal(); | 80 void StartInternal(); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 base::WeakPtr<MediaSourcePlayer> weak_this_; | 275 base::WeakPtr<MediaSourcePlayer> weak_this_; |
277 // NOTE: Weak pointers must be invalidated before all other member variables. | 276 // NOTE: Weak pointers must be invalidated before all other member variables. |
278 base::WeakPtrFactory<MediaSourcePlayer> weak_factory_; | 277 base::WeakPtrFactory<MediaSourcePlayer> weak_factory_; |
279 | 278 |
280 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer); | 279 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayer); |
281 }; | 280 }; |
282 | 281 |
283 } // namespace media | 282 } // namespace media |
284 | 283 |
285 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ | 284 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_H_ |
OLD | NEW |