Shaka Packager SDK
Loading...
Searching...
No Matches
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 <cstdint>
11#include <functional>
12#include <memory>
13#include <vector>
14
15#include <packager/macros/classes.h>
16
17namespace shaka {
18namespace media {
19
20class KeySource;
21class MediaSample;
22class StreamInfo;
23class TextSample;
24
26 public:
27 MediaParser() {}
28 virtual ~MediaParser() {}
29
33 typedef std::function<void(
34 const std::vector<std::shared_ptr<StreamInfo> >& stream_info)>
36
42 typedef std::function<bool(uint32_t track_id,
43 std::shared_ptr<MediaSample> media_sample)>
45
51 typedef std::function<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 [[nodiscard]] virtual bool Flush() = 0;
74
77 [[nodiscard]] virtual bool Parse(const uint8_t* buf, int size) = 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_
KeySource is responsible for encryption key acquisition.
Definition key_source.h:56
std::function< bool(uint32_t track_id, std::shared_ptr< MediaSample > media_sample)> NewMediaSampleCB
std::function< bool(uint32_t track_id, std::shared_ptr< TextSample > text_sample)> NewTextSampleCB
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
virtual bool Parse(const uint8_t *buf, int size)=0
All the methods that are virtual are virtual for mocking.