Shaka Packager SDK
media_parser.h
1 // Copyright 2014 Google Inc. 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 <memory>
11 #include <string>
12 #include <vector>
13 #include "packager/base/callback.h"
14 #include "packager/base/compiler_specific.h"
15 #include "packager/media/base/container_names.h"
16 
17 namespace shaka {
18 namespace media {
19 
20 class KeySource;
21 class MediaSample;
22 class StreamInfo;
23 
24 class MediaParser {
25  public:
26  MediaParser() {}
27  virtual ~MediaParser() {}
28 
32  typedef base::Callback<void(
33  const std::vector<std::shared_ptr<StreamInfo> >& stream_info)>
35 
41  typedef base::Callback<bool(uint32_t track_id,
42  const std::shared_ptr<MediaSample>& media_sample)>
44 
52  virtual void Init(const InitCB& init_cb,
53  const NewSampleCB& new_sample_cb,
54  KeySource* decryption_key_source) = 0;
55 
59  virtual bool Flush() WARN_UNUSED_RESULT = 0;
60 
63  virtual bool Parse(const uint8_t* buf, int size) WARN_UNUSED_RESULT = 0;
64 
65  private:
66  DISALLOW_COPY_AND_ASSIGN(MediaParser);
67 };
68 
69 } // namespace media
70 } // namespace shaka
71 
72 #endif // PACKAGER_MEDIA_BASE_MEDIA_PARSER_H_
virtual bool Parse(const uint8_t *buf, int size) WARN_UNUSED_RESULT=0
All the methods that are virtual are virtual for mocking.
base::Callback< void(const std::vector< std::shared_ptr< StreamInfo > > &stream_info)> InitCB
Definition: media_parser.h:34
base::Callback< bool(uint32_t track_id, const std::shared_ptr< MediaSample > &media_sample)> NewSampleCB
Definition: media_parser.h:43
virtual void Init(const InitCB &init_cb, const NewSampleCB &new_sample_cb, KeySource *decryption_key_source)=0
virtual bool Flush() WARN_UNUSED_RESULT=0
KeySource is responsible for encryption key acquisition.
Definition: key_source.h:48