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

Unified Diff: media/base/android/mt/player.h

Issue 1076013002: Added stub MediaSourcePlayer for developing behind the flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/mt/player.h
diff --git a/media/base/android/mt/player.h b/media/base/android/mt/player.h
new file mode 100644
index 0000000000000000000000000000000000000000..f950ed2d702a77f99abbe7d3ea3840d6b6e0f106
--- /dev/null
+++ b/media/base/android/mt/player.h
@@ -0,0 +1,82 @@
+// 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_MT_PLAYER_H_
+#define MEDIA_BASE_ANDROID_MT_PLAYER_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/android/media_player_android.h"
+#include "media/base/media_export.h"
+
+namespace media {
+namespace mt {
timav 2015/04/09 21:10:02 Nested namespace and nested mt/ directory. "mt" st
+
+// Returns the task runner for the media thread
+scoped_refptr<base::SingleThreadTaskRunner> GetMediaTaskRunner();
+
+// This class handles media source extensions on Android.
+class MEDIA_EXPORT Player : public MediaPlayerAndroid,
+ public DemuxerAndroidClient {
+ public:
+ // Constructs a player with the given ID and demuxer. |manager| must outlive
+ // the lifetime of this object.
+ Player(int player_id,
+ MediaPlayerManager* manager,
+ const RequestMediaResourcesCB& request_media_resources_cb,
+ scoped_ptr<DemuxerAndroid> demuxer,
+ const GURL& frame_url);
+ ~Player() override;
+
+ // MediaPlayerAndroid implementation.
+ void SetVideoSurface(gfx::ScopedJavaSurface surface) override;
+ void Start() override;
+ void Pause(bool is_media_related_action) override;
+ void SeekTo(base::TimeDelta timestamp) override;
+ void Release() override;
+ void SetVolume(double volume) override;
+ int GetVideoWidth() override;
+ int GetVideoHeight() override;
+ base::TimeDelta GetCurrentTime() override;
+ base::TimeDelta GetDuration() override;
+ bool IsPlaying() override;
+ bool CanPause() override;
+ bool CanSeekForward() override;
+ bool CanSeekBackward() override;
+ bool IsPlayerReady() override;
+ void SetCdm(BrowserCdm* cdm) override;
+
+ // 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;
+
+ private:
+
+ // Events from UI posted to Media thread
+ void SetVideoSurfaceInternal(gfx::ScopedJavaSurface surface);
+ void StartInternal();
+ void PauseInternal();
+ void SeekToInternal(base::TimeDelta timestamp);
+ void ReleaseInternal();
+
+ // Data
+
+ scoped_ptr<DemuxerAndroid> demuxer_;
+
+ base::WeakPtr<Player> weak_this_;
+ // NOTE: Weak pointers must be invalidated before all other member variables.
+ base::WeakPtrFactory<Player> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(Player);
+};
+
+} // namespace mt
+} // namespace media
+
+#endif // MEDIA_BASE_ANDROID_MT_PLAYER_H_

Powered by Google App Engine
This is Rietveld 408576698