DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
es_parser_h265.h
1 // Copyright 2016 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 MEDIA_FORMATS_MP2T_ES_PARSER_H265_H_
8 #define MEDIA_FORMATS_MP2T_ES_PARSER_H265_H_
9 
10 #include <stdint.h>
11 
12 #include <list>
13 #include <utility>
14 
15 #include "packager/base/callback.h"
16 #include "packager/base/compiler_specific.h"
17 #include "packager/base/memory/scoped_ptr.h"
18 #include "packager/media/formats/mp2t/es_parser_h26x.h"
19 
20 namespace shaka {
21 namespace media {
22 
23 class H265Parser;
24 
25 namespace mp2t {
26 
27 class EsParserH265 : public EsParserH26x {
28  public:
29  EsParserH265(uint32_t pid,
30  const NewStreamInfoCB& new_stream_info_cb,
31  const EmitSampleCB& emit_sample_cb);
32  ~EsParserH265() override;
33 
34  // EsParserH26x implementation override.
35  void Reset() override;
36 
37  private:
38  // Processes a NAL unit found in ParseInternal. The @a pps_id_for_access_unit
39  // value will be passed to UpdateVideoDecoderConfig.
40  bool ProcessNalu(const Nalu& nalu,
41  bool* is_key_frame,
42  int* pps_id_for_access_unit) override;
43 
44  // Update the video decoder config based on an H264 SPS.
45  // Return true if successful.
46  bool UpdateVideoDecoderConfig(int sps_id) override;
47 
48  // Callback to pass the stream configuration.
49  NewStreamInfoCB new_stream_info_cb_;
50 
51  // Last video decoder config.
52  scoped_refptr<StreamInfo> last_video_decoder_config_;
53  bool decoder_config_check_pending_;
54 
55  scoped_ptr<H265Parser> h265_parser_;
56 };
57 
58 } // namespace mp2t
59 } // namespace media
60 } // namespace shaka
61 
62 #endif // MEDIA_FORMATS_MP2T_ES_PARSER_H265_H_