Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(782)

Side by Side Diff: media/base/android/media_source_player_impl.h

Issue 1076013002: Added stub MediaSourcePlayer for developing behind the flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary changes from non_thread_safe.h Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_IMPL_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_IMPL_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/media_export.h"
14 #include "ui/gl/android/scoped_java_surface.h"
15
16 namespace media {
17
18 class BrowserCdm;
19
20 // This class implements the media source extensions on Android.
21
22 // The separation between MediaSourcePlayer and MediaSourcePlayerImpl
23 // is introduced for the postponed destruction of MediaSourcePlayerImpl
24 // that happens on the Media thread.
25
26 class MEDIA_EXPORT MediaSourcePlayerImpl : public DemuxerAndroidClient {
27 public:
28 // Constructs a player with the given ID and demuxer. |manager| must outlive
29 // the lifetime of this object.
30 MediaSourcePlayerImpl(scoped_ptr<DemuxerAndroid> demuxer);
31 ~MediaSourcePlayerImpl();
32
33 // Forwarded from MediaSourceImpl
34 void SetVideoSurface(gfx::ScopedJavaSurface surface);
35 void Start();
36 void Pause();
37 void SeekTo(base::TimeDelta timestamp);
38 void Release();
39 void SetVolume(double volume);
40 int GetVideoWidth();
41 int GetVideoHeight();
42 base::TimeDelta GetCurrentTime();
43 base::TimeDelta GetDuration();
44 bool IsPlaying();
45 bool CanPause();
46 bool CanSeekForward();
47 bool CanSeekBackward();
48 bool IsPlayerReady();
49 void SetCdm(BrowserCdm* cdm);
50
51 // DemuxerAndroidClient implementation.
52 void OnDemuxerConfigsAvailable(const DemuxerConfigs& params) override;
53 void OnDemuxerDataAvailable(const DemuxerData& params) override;
54 void OnDemuxerSeekDone(base::TimeDelta actual_browser_seek_time) override;
55 void OnDemuxerDurationChanged(base::TimeDelta duration) override;
56
57 // Helper methods
58 void Initialize();
59 void DestroySelf();
60
61 private:
62 scoped_ptr<DemuxerAndroid> demuxer_;
63
64 base::WeakPtr<MediaSourcePlayerImpl> weak_this_;
65 // NOTE: Weak pointers must be invalidated before all other member variables.
66 base::WeakPtrFactory<MediaSourcePlayerImpl> weak_factory_;
67
68 DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayerImpl);
69 };
70
71 } // namespace media
72
73 #endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698