Native Player  1.0
stream_manager.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 //
3 // Copyright (c) 2016, Samsung Electronics Co., Ltd
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to
7 // deal in the Software without restriction, including without limitation the
8 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 // sell copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM
20 // , OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 // THE SOFTWARE.
22 //
23 // @author Tomasz Borkowski
24 // Jacob Tarasiewicz
25 //
26 // ----------------------------------------------------------------------------
27 
28 #ifndef NATIVE_PLAYER_SRC_PLAYER_ES_DASH_PLAYER_STREAM_MANAGER_H_
29 #define NATIVE_PLAYER_SRC_PLAYER_ES_DASH_PLAYER_STREAM_MANAGER_H_
30 
31 #include <common.h>
32 #include <list>
33 #include <memory>
34 #include <string>
35 #include <vector>
36 
37 #include "nacl_player/elementary_stream_listener.h"
38 #include "nacl_player/es_data_source.h"
39 #include "nacl_player/media_common.h"
40 #include "nacl_player/media_player.h"
41 #include "ppapi/cpp/instance.h"
42 
44 
47 
78 
79 class StreamManager : public Samsung::NaClPlayer::ElementaryStreamListener,
80  public std::enable_shared_from_this<StreamManager> {
81  public:
93  explicit StreamManager(pp::InstanceHandle instance, StreamType type);
94 
98 
121  bool Initialize(
122  std::unique_ptr<MediaSegmentSequence> segment_sequence,
123  std::shared_ptr<Samsung::NaClPlayer::ESDataSource> es_data_source,
124  std::function<void(StreamType)> stream_configured_callback,
125  Samsung::NaClPlayer::DRMType drm_type =
126  Samsung::NaClPlayer::DRMType_Unknown);
127 
138  std::unique_ptr<MediaSegmentSequence> segment_sequence);
139 
150  Samsung::NaClPlayer::TimeTicks UpdateBuffer(
151  Samsung::NaClPlayer::TimeTicks playback_time);
152 
159  bool IsInitialized();
160 
161  private:
162  void OnNeedData(int32_t bytes_max) override;
163  void OnEnoughData() override;
164  void OnSeekData(Samsung::NaClPlayer::TimeTicks new_position) override;
165 
166  class Impl;
167  std::unique_ptr<Impl> pimpl_;
168 };
169 
170 #endif // NATIVE_PLAYER_SRC_PLAYER_ES_DASH_PLAYER_STREAM_MANAGER_H_
StreamType
Definition: common.h:55
StreamManager(pp::InstanceHandle instance, StreamType type)
bool Initialize(std::unique_ptr< MediaSegmentSequence > segment_sequence, std::shared_ptr< Samsung::NaClPlayer::ESDataSource > es_data_source, std::function< void(StreamType)> stream_configured_callback, Samsung::NaClPlayer::DRMType drm_type=Samsung::NaClPlayer::DRMType_Unknown)
Samsung::NaClPlayer::TimeTicks UpdateBuffer(Samsung::NaClPlayer::TimeTicks playback_time)
This file defines MediaSegmentSequence class.
void SetMediaSegmentSequence(std::unique_ptr< MediaSegmentSequence > segment_sequence)
bool IsInitialized()