Shaka Packager SDK
Loading...
Searching...
No Matches
es_parser_h264.h
1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef PACKAGER_MEDIA_FORMATS_MP2T_ES_PARSER_H264_H_
6#define PACKAGER_MEDIA_FORMATS_MP2T_ES_PARSER_H264_H_
7
8#include <cstdint>
9#include <functional>
10#include <memory>
11
12#include <packager/media/formats/mp2t/es_parser_h26x.h>
13
14namespace shaka {
15namespace media {
16
17class H264Parser;
18
19namespace mp2t {
20
21// Remark:
22// In this h264 parser, frame splitting is based on AUD nals.
23// Mpeg2 TS spec: "2.14 Carriage of Rec. ITU-T H.264 | ISO/IEC 14496-10 video"
24// "Each AVC access unit shall contain an access unit delimiter NAL Unit;"
25//
26class EsParserH264 : public EsParserH26x {
27 public:
28 EsParserH264(uint32_t pid,
29 const NewStreamInfoCB& new_stream_info_cb,
30 const EmitSampleCB& emit_sample_cb);
31 ~EsParserH264() override;
32
33 // EsParserH26x implementation override.
34 void Reset() override;
35
36 private:
37 // Processes a NAL unit found in ParseInternal.
38 bool ProcessNalu(const Nalu& nalu, VideoSliceInfo* video_slice_info) override;
39
40 // Update the video decoder config based on an H264 SPS.
41 // Return true if successful.
42 bool UpdateVideoDecoderConfig(int sps_id) override;
43 // Calculate video sample duration based on SPS data
44 int64_t CalculateSampleDuration(int pps_id) override;
45 // Callback to pass the stream configuration.
46 NewStreamInfoCB new_stream_info_cb_;
47
48 std::shared_ptr<StreamInfo> last_video_decoder_config_;
49 bool decoder_config_check_pending_;
50
51 std::unique_ptr<H264Parser> h264_parser_;
52};
53
54} // namespace mp2t
55} // namespace media
56} // namespace shaka
57
58#endif
All the methods that are virtual are virtual for mocking.