Shaka Packager SDK
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 <stdint.h>
9 #include <memory>
10 #include "packager/base/callback.h"
11 #include "packager/media/formats/mp2t/es_parser_h26x.h"
12 
13 namespace shaka {
14 namespace media {
15 
16 class H264Parser;
17 
18 namespace mp2t {
19 
20 // Remark:
21 // In this h264 parser, frame splitting is based on AUD nals.
22 // Mpeg2 TS spec: "2.14 Carriage of Rec. ITU-T H.264 | ISO/IEC 14496-10 video"
23 // "Each AVC access unit shall contain an access unit delimiter NAL Unit;"
24 //
25 class EsParserH264 : public EsParserH26x {
26  public:
27  EsParserH264(uint32_t pid,
28  const NewStreamInfoCB& new_stream_info_cb,
29  const EmitSampleCB& emit_sample_cb);
30  ~EsParserH264() override;
31 
32  // EsParserH26x implementation override.
33  void Reset() override;
34 
35  private:
36  // Processes a NAL unit found in ParseInternal.
37  bool ProcessNalu(const Nalu& nalu, VideoSliceInfo* video_slice_info) override;
38 
39  // Update the video decoder config based on an H264 SPS.
40  // Return true if successful.
41  bool UpdateVideoDecoderConfig(int sps_id) override;
42 
43  // Callback to pass the stream configuration.
44  NewStreamInfoCB new_stream_info_cb_;
45 
46  std::shared_ptr<StreamInfo> last_video_decoder_config_;
47  bool decoder_config_check_pending_;
48 
49  std::unique_ptr<H264Parser> h264_parser_;
50 };
51 
52 } // namespace mp2t
53 } // namespace media
54 } // namespace shaka
55 
56 #endif
shaka::media::Nalu
Definition: nalu_reader.h:27
shaka
All the methods that are virtual are virtual for mocking.
Definition: gflags_hex_bytes.cc:11
shaka::media::mp2t::EsParserH26x::VideoSliceInfo
Definition: es_parser_h26x.h:42
shaka::media::mp2t::EsParserH264
Definition: es_parser_h264.h:25
shaka::media::mp2t::EsParserH26x
Definition: es_parser_h26x.h:28