Shaka Packager SDK
media_parser.h
1 // Copyright 2014 Google LLC. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #ifndef PACKAGER_MEDIA_BASE_MEDIA_PARSER_H_
8 #define PACKAGER_MEDIA_BASE_MEDIA_PARSER_H_
9 
10 #include <functional>
11 #include <memory>
12 #include <string>
13 #include <vector>
14 
15 #include <packager/macros/classes.h>
16 #include <packager/media/base/container_names.h>
17 
18 namespace shaka {
19 namespace media {
20 
21 class KeySource;
22 class MediaSample;
23 class StreamInfo;
24 class TextSample;
25 
26 class MediaParser {
27  public:
28  MediaParser() {}
29  virtual ~MediaParser() {}
30 
34  typedef std::function<void(
35  const std::vector<std::shared_ptr<StreamInfo> >& stream_info)>
37 
43  typedef std::function<bool(uint32_t track_id,
44  std::shared_ptr<MediaSample> media_sample)>
46 
52  typedef std::function<bool(uint32_t track_id,
53  std::shared_ptr<TextSample> text_sample)>
55 
66  virtual void Init(const InitCB& init_cb,
67  const NewMediaSampleCB& new_media_sample_cb,
68  const NewTextSampleCB& new_text_sample_cb,
69  KeySource* decryption_key_source) = 0;
70 
74  [[nodiscard]] virtual bool Flush() = 0;
75 
78  [[nodiscard]] virtual bool Parse(const uint8_t* buf, int size) = 0;
79 
80  private:
81  DISALLOW_COPY_AND_ASSIGN(MediaParser);
82 };
83 
84 } // namespace media
85 } // namespace shaka
86 
87 #endif // PACKAGER_MEDIA_BASE_MEDIA_PARSER_H_
KeySource is responsible for encryption key acquisition.
Definition: key_source.h:52
std::function< bool(uint32_t track_id, std::shared_ptr< MediaSample > media_sample)> NewMediaSampleCB
Definition: media_parser.h:45
std::function< bool(uint32_t track_id, std::shared_ptr< TextSample > text_sample)> NewTextSampleCB
Definition: media_parser.h:54
virtual bool Flush()=0
virtual void Init(const InitCB &init_cb, const NewMediaSampleCB &new_media_sample_cb, const NewTextSampleCB &new_text_sample_cb, KeySource *decryption_key_source)=0
std::function< void(const std::vector< std::shared_ptr< StreamInfo > > &stream_info)> InitCB
Definition: media_parser.h:36
virtual bool Parse(const uint8_t *buf, int size)=0
All the methods that are virtual are virtual for mocking.
Definition: crypto_flags.cc:66