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 class TextSample;
24 
25 class MediaParser {
26  public:
27  MediaParser() {}
28  virtual ~MediaParser() {}
29 
33  typedef base::Callback<void(
34  const std::vector<std::shared_ptr<StreamInfo> >& stream_info)>
36 
42  typedef base::Callback<bool(uint32_t track_id,
43  std::shared_ptr<MediaSample> media_sample)>
45 
51  typedef base::Callback<bool(uint32_t track_id,
52  std::shared_ptr<TextSample> text_sample)>
54 
65  virtual void Init(const InitCB& init_cb,
66  const NewMediaSampleCB& new_media_sample_cb,
67  const NewTextSampleCB& new_text_sample_cb,
68  KeySource* decryption_key_source) = 0;
69 
73  virtual bool Flush() WARN_UNUSED_RESULT = 0;
74 
77  virtual bool Parse(const uint8_t* buf, int size) WARN_UNUSED_RESULT = 0;
78 
79  private:
80  DISALLOW_COPY_AND_ASSIGN(MediaParser);
81 };
82 
83 } // namespace media
84 } // namespace shaka
85 
86 #endif // PACKAGER_MEDIA_BASE_MEDIA_PARSER_H_
shaka::media::MediaParser
Definition: media_parser.h:25
shaka
All the methods that are virtual are virtual for mocking.
Definition: gflags_hex_bytes.cc:11
shaka::media::MediaParser::NewMediaSampleCB
base::Callback< bool(uint32_t track_id, std::shared_ptr< MediaSample > media_sample)> NewMediaSampleCB
Definition: media_parser.h:44
shaka::media::MediaParser::InitCB
base::Callback< void(const std::vector< std::shared_ptr< StreamInfo > > &stream_info)> InitCB
Definition: media_parser.h:35
shaka::media::MediaParser::Flush
virtual bool Flush() WARN_UNUSED_RESULT=0
shaka::media::KeySource
KeySource is responsible for encryption key acquisition.
Definition: key_source.h:51
shaka::media::MediaParser::NewTextSampleCB
base::Callback< bool(uint32_t track_id, std::shared_ptr< TextSample > text_sample)> NewTextSampleCB
Definition: media_parser.h:53
shaka::media::MediaParser::Init
virtual void Init(const InitCB &init_cb, const NewMediaSampleCB &new_media_sample_cb, const NewTextSampleCB &new_text_sample_cb, KeySource *decryption_key_source)=0
shaka::media::MediaParser::Parse
virtual bool Parse(const uint8_t *buf, int size) WARN_UNUSED_RESULT=0