Shaka Player Embedded
demuxer.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_DEMUXER_H_
16 #define SHAKA_EMBEDDED_MEDIA_DEMUXER_H_
17 
18 #include <functional>
19 #include <memory>
20 
21 #include "../eme/configuration.h"
22 #include "../macros.h"
23 #include "frames.h"
24 
25 namespace shaka {
26 namespace media {
27 
36  public:
43  public:
45 
51  virtual void OnLoadedMetaData(double duration) = 0;
52 
57  virtual void OnEncrypted(eme::MediaKeyInitDataType type,
58  const uint8_t* data, size_t size) = 0;
59  };
60 
62 
72  virtual bool SwitchType(const std::string& mime_type);
73 
81  virtual void Reset() = 0;
82 
102  virtual bool Demux(double timestamp_offset, const uint8_t* data, size_t size,
103  std::vector<std::shared_ptr<EncodedFrame>>* frames) = 0;
104 };
105 
111  public:
113 
115  static const DemuxerFactory* GetFactory();
116 
125  static void SetFactory(const DemuxerFactory* factory);
126 
127 
133  virtual bool IsTypeSupported(const std::string& mime_type) const = 0;
134 
143  virtual bool IsCodecVideo(const std::string& codec) const = 0;
144 
153  virtual bool CanSwitchType(const std::string& old_mime_type,
154  const std::string& new_mime_type) const;
155 
164  virtual std::unique_ptr<Demuxer> Create(const std::string& mime_type,
165  Demuxer::Client* client) const = 0;
166 };
167 
168 } // namespace media
169 } // namespace shaka
170 
171 #endif // SHAKA_EMBEDDED_MEDIA_DEMUXER_H_
#define SHAKA_EXPORT
Definition: macros.h:30
ExceptionCode type
#define SHAKA_DECLARE_INTERFACE_METHODS(Type)
Definition: macros.h:55
std::list< std::shared_ptr< BaseFrame > > frames
Definition: streams.cc:128