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

Unified 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, 8 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 side-by-side diff with in-line comments
Download patch
Index: media/base/android/media_source_player_impl.h
diff --git a/media/base/android/media_source_player_impl.h b/media/base/android/media_source_player_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..299f09e94849d444d4ea0723340e409fa920b083
--- /dev/null
+++ b/media/base/android/media_source_player_impl.h
@@ -0,0 +1,73 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_IMPL_H_
+#define MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_IMPL_H_
+
+#include "base/android/scoped_java_ref.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "base/threading/thread.h"
+#include "media/base/android/demuxer_android.h"
+#include "media/base/media_export.h"
+#include "ui/gl/android/scoped_java_surface.h"
+
+namespace media {
+
+class BrowserCdm;
+
+// This class implements the media source extensions on Android.
+
+// The separation between MediaSourcePlayer and MediaSourcePlayerImpl
+// is introduced for the postponed destruction of MediaSourcePlayerImpl
+// that happens on the Media thread.
+
+class MEDIA_EXPORT MediaSourcePlayerImpl : public DemuxerAndroidClient {
+ public:
+ // Constructs a player with the given ID and demuxer. |manager| must outlive
+ // the lifetime of this object.
+ MediaSourcePlayerImpl(scoped_ptr<DemuxerAndroid> demuxer);
+ ~MediaSourcePlayerImpl();
+
+ // Forwarded from MediaSourceImpl
+ void SetVideoSurface(gfx::ScopedJavaSurface surface);
+ void Start();
+ void Pause();
+ void SeekTo(base::TimeDelta timestamp);
+ void Release();
+ void SetVolume(double volume);
+ int GetVideoWidth();
+ int GetVideoHeight();
+ base::TimeDelta GetCurrentTime();
+ base::TimeDelta GetDuration();
+ bool IsPlaying();
+ bool CanPause();
+ bool CanSeekForward();
+ bool CanSeekBackward();
+ bool IsPlayerReady();
+ void SetCdm(BrowserCdm* cdm);
+
+ // DemuxerAndroidClient implementation.
+ void OnDemuxerConfigsAvailable(const DemuxerConfigs& params) override;
+ void OnDemuxerDataAvailable(const DemuxerData& params) override;
+ void OnDemuxerSeekDone(base::TimeDelta actual_browser_seek_time) override;
+ void OnDemuxerDurationChanged(base::TimeDelta duration) override;
+
+ // Helper methods
+ void Initialize();
+ void DestroySelf();
+
+ private:
+ scoped_ptr<DemuxerAndroid> demuxer_;
+
+ base::WeakPtr<MediaSourcePlayerImpl> weak_this_;
+ // NOTE: Weak pointers must be invalidated before all other member variables.
+ base::WeakPtrFactory<MediaSourcePlayerImpl> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(MediaSourcePlayerImpl);
+};
+
+} // namespace media
+
+#endif // MEDIA_BASE_ANDROID_MEDIA_SOURCE_PLAYER_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698