Shaka Player Embedded
proxy_media_player.h
Go to the documentation of this file.
1 // Copyright 2019 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef SHAKA_EMBEDDED_MEDIA_PROXY_MEDIA_PLAYER_H_
16 #define SHAKA_EMBEDDED_MEDIA_PROXY_MEDIA_PLAYER_H_
17 
18 #include <memory>
19 #include <string>
20 
21 #include "../macros.h"
22 #include "media_player.h"
23 
24 namespace shaka {
25 namespace media {
26 
40  public:
42  ~ProxyMediaPlayer() override;
43 
44  struct VideoPlaybackQuality VideoPlaybackQuality() const override;
45  void AddClient(Client* client) const override;
46  void RemoveClient(Client* client) const override;
47  std::vector<BufferedRange> GetBuffered() const override;
48  VideoReadyState ReadyState() const override;
49  VideoPlaybackState PlaybackState() const override;
50 
51  bool SetVideoFillMode(VideoFillMode mode) override;
52  uint32_t Width() const override;
53  uint32_t Height() const override;
54  double Volume() const override;
55  void SetVolume(double volume) override;
56  bool Muted() const override;
57  void SetMuted(bool muted) override;
58 
59  void Play() override;
60  void Pause() override;
61  double CurrentTime() const override;
62  void SetCurrentTime(double time) override;
63  double Duration() const override;
64  void SetDuration(double duration) override;
65  double PlaybackRate() const override;
66  void SetPlaybackRate(double rate) override;
67 
68  bool AttachSource(const std::string& src) override;
69  bool AttachMse() override;
70  bool AddMseBuffer(const std::string& mime, bool is_video,
71  const ElementaryStream* stream) override;
72  void LoadedMetaData(double duration) override;
73  void MseEndOfStream() override;
74  bool SetEmeImplementation(const std::string& key_system,
75  eme::Implementation* implementation) override;
76  void Detach() override;
77 
78  protected:
80  ClientList* GetClientList() const;
81 
82  private:
91  virtual MediaPlayer* CreateMse() = 0;
92 
103  virtual MediaPlayer* CreateSource(const std::string& src) = 0;
104 
105  void SetFields(MediaPlayer* player);
106 
107  class Impl;
108  std::unique_ptr<Impl> impl_;
109 };
110 
111 } // namespace media
112 } // namespace shaka
113 
114 #endif // SHAKA_EMBEDDED_PROXY_MEDIA_MEDIA_PLAYER_H_
#define SHAKA_EXPORT
Definition: macros.h:30
VideoFillMode
Definition: utils.h:41