OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_WITH_DEDICATED_THREAD_H_ |
| 6 #define MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_WITH_DEDICATED_THREAD_H_ |
| 7 |
| 8 #include "base/android/scoped_java_ref.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/threading/thread.h" |
| 12 #include "media/base/android/demuxer_android.h" |
| 13 #include "media/base/android/media_player_android.h" |
| 14 #include "media/base/media_export.h" |
| 15 |
| 16 namespace media { |
| 17 |
| 18 class MediaSourcePlayerImpl; |
| 19 |
| 20 // Returns the task runner for the media thread |
| 21 scoped_refptr<base::SingleThreadTaskRunner> GetMediaTaskRunner(); |
| 22 |
| 23 // This class handles media source extensions on Android. |
| 24 class MEDIA_EXPORT MediaSourcePlayerWithDedicatedThread : |
| 25 public MediaPlayerAndroid { |
| 26 public: |
| 27 // Constructs a player with the given ID and demuxer. |manager| must outlive |
| 28 // the lifetime of this object. |
| 29 MediaSourcePlayerWithDedicatedThread( |
| 30 int player_id, |
| 31 MediaPlayerManager* manager, |
| 32 const RequestMediaResourcesCB& request_media_resources_cb, |
| 33 scoped_ptr<DemuxerAndroid> demuxer, |
| 34 const GURL& frame_url); |
| 35 ~MediaSourcePlayerWithDedicatedThread() override; |
| 36 |
| 37 // MediaPlayerAndroid implementation. |
| 38 void SetVideoSurface(gfx::ScopedJavaSurface surface) override; |
| 39 void Start() override; |
| 40 void Pause(bool is_media_related_action) override; |
| 41 void SeekTo(base::TimeDelta timestamp) override; |
| 42 void Release() override; |
| 43 void SetVolume(double volume) override; |
| 44 int GetVideoWidth() override; |
| 45 int GetVideoHeight() override; |
| 46 base::TimeDelta GetCurrentTime() override; |
| 47 base::TimeDelta GetDuration() override; |
| 48 bool IsPlaying() override; |
| 49 bool CanPause() override; |
| 50 bool CanSeekForward() override; |
| 51 bool CanSeekBackward() override; |
| 52 bool IsPlayerReady() override; |
| 53 void SetCdm(BrowserCdm* cdm) override; |
| 54 |
| 55 |
| 56 private: |
| 57 MediaSourcePlayerImpl* impl_; |
| 58 |
| 59 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 60 base::WeakPtrFactory<MediaSourcePlayerWithDedicatedThread> weak_factory_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayerWithDedicatedThread); |
| 63 }; |
| 64 |
| 65 } // namespace media |
| 66 |
| 67 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_WITH_DEDICATED_THREAD_H_ |
OLD | NEW |