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 <string>
14#include <vector>
15
16#include <packager/macros/classes.h>
17#include <packager/media/base/container_names.h>
18
19namespace shaka {
20namespace media {
21
22class KeySource;
23class MediaSample;
24class StreamInfo;
25class TextSample;
26
28 public:
29 MediaParser() {}
30 virtual ~MediaParser() {}
31
35 typedef std::function<void(
36 const std::vector<std::shared_ptr<StreamInfo> >& stream_info)>
38
44 typedef std::function<bool(uint32_t track_id,
45 std::shared_ptr<MediaSample> media_sample)>
47
53 typedef std::function<bool(uint32_t track_id,
54 std::shared_ptr<TextSample> text_sample)>
56
67 virtual void Init(const InitCB& init_cb,
68 const NewMediaSampleCB& new_media_sample_cb,
69 const NewTextSampleCB& new_text_sample_cb,
70 KeySource* decryption_key_source) = 0;
71
75 [[nodiscard]] virtual bool Flush() = 0;
76
79 [[nodiscard]] virtual bool Parse(const uint8_t* buf, int size) = 0;
80
81 private:
82 DISALLOW_COPY_AND_ASSIGN(MediaParser);
83};
84
85} // namespace media
86} // namespace shaka
87
88#endif // PACKAGER_MEDIA_BASE_MEDIA_PARSER_H_
KeySource is responsible for encryption key acquisition.
Definition key_source.h:53
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.