Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: media/formats/mp2t/es_parser_h264.h

Issue 1517473002: Support HLS MPEG2 TS with SAMPLE-AES encryption. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@encryption_scheme
Patch Set: move some gn defs Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_FORMATS_MP2T_ES_PARSER_H264_H_ 5 #ifndef MEDIA_FORMATS_MP2T_ES_PARSER_H264_H_
6 #define MEDIA_FORMATS_MP2T_ES_PARSER_H264_H_ 6 #define MEDIA_FORMATS_MP2T_ES_PARSER_H264_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "media/base/media_export.h" 17 #include "media/base/media_export.h"
18 #include "media/base/ranges.h"
18 #include "media/base/video_decoder_config.h" 19 #include "media/base/video_decoder_config.h"
19 #include "media/formats/mp2t/es_adapter_video.h" 20 #include "media/formats/mp2t/es_adapter_video.h"
20 #include "media/formats/mp2t/es_parser.h" 21 #include "media/formats/mp2t/es_parser.h"
22 #include "media/media_features.h"
21 23
22 namespace media { 24 namespace media {
23 class EncryptionScheme; 25 class EncryptionScheme;
24 class H264Parser; 26 class H264Parser;
25 struct H264SPS; 27 struct H264SPS;
26 class OffsetByteQueue; 28 class OffsetByteQueue;
27 } 29 }
28 30
29 namespace media { 31 namespace media {
30 namespace mp2t { 32 namespace mp2t {
31 33
32 // A few remarks: 34 // A few remarks:
33 // - In this h264 parser, frame splitting is based on AUD nals. 35 // - In this h264 parser, frame splitting is based on AUD nals.
34 // Mpeg2 TS spec: "2.14 Carriage of Rec. ITU-T H.264 | ISO/IEC 14496-10 video" 36 // Mpeg2 TS spec: "2.14 Carriage of Rec. ITU-T H.264 | ISO/IEC 14496-10 video"
35 // "Each AVC access unit shall contain an access unit delimiter NAL Unit;" 37 // "Each AVC access unit shall contain an access unit delimiter NAL Unit;"
36 // - PES packets do not necessarily map to an H264 access unit although the HLS 38 // - PES packets do not necessarily map to an H264 access unit although the HLS
37 // recommendation is to use one PES for each access unit. In this parser, 39 // recommendation is to use one PES for each access unit. In this parser,
38 // we handle the general case and do not make any assumption about the access 40 // we handle the general case and do not make any assumption about the access
39 // unit organization within PES packets. 41 // unit organization within PES packets.
40 // 42 //
41 class MEDIA_EXPORT EsParserH264 : public EsParser { 43 class MEDIA_EXPORT EsParserH264 : public EsParser {
42 public: 44 public:
43 typedef base::Callback<void(const VideoDecoderConfig&)> NewVideoConfigCB; 45 typedef base::Callback<void(const VideoDecoderConfig&)> NewVideoConfigCB;
44 46
45 EsParserH264(const NewVideoConfigCB& new_video_config_cb, 47 EsParserH264(const NewVideoConfigCB& new_video_config_cb,
46 const EmitBufferCB& emit_buffer_cb); 48 const EmitBufferCB& emit_buffer_cb);
49 #if BUILDFLAG(ENABLE_HLS_SAMPLE_AES)
50 EsParserH264(const NewVideoConfigCB& new_video_config_cb,
51 const EmitBufferCB& emit_buffer_cb,
52 const GetDecryptConfigCB& get_decrypt_config_cb,
53 bool use_hls_sample_aes);
ddorwin 2016/04/12 00:40:47 ditto on ordering
dougsteed 2016/05/08 23:18:44 Done.
54 #endif
47 ~EsParserH264() override; 55 ~EsParserH264() override;
48 56
49 // EsParser implementation. 57 // EsParser implementation.
50 void Flush() override; 58 void Flush() override;
51 59
52 private: 60 private:
53 // EsParser implementation. 61 // EsParser implementation.
54 bool ParseFromEsQueue() override; 62 bool ParseFromEsQueue() override;
55 void ResetInternal() override; 63 void ResetInternal() override;
56 64
(...skipping 17 matching lines...) Expand all
74 const EncryptionScheme& scheme); 82 const EncryptionScheme& scheme);
75 83
76 EsAdapterVideo es_adapter_; 84 EsAdapterVideo es_adapter_;
77 85
78 // H264 parser state. 86 // H264 parser state.
79 // - |current_access_unit_pos_| is pointing to an annexB syncword 87 // - |current_access_unit_pos_| is pointing to an annexB syncword
80 // representing the first NALU of an H264 access unit. 88 // representing the first NALU of an H264 access unit.
81 scoped_ptr<H264Parser> h264_parser_; 89 scoped_ptr<H264Parser> h264_parser_;
82 int64_t current_access_unit_pos_; 90 int64_t current_access_unit_pos_;
83 int64_t next_access_unit_pos_; 91 int64_t next_access_unit_pos_;
92 #if BUILDFLAG(ENABLE_HLS_SAMPLE_AES)
93 Ranges<int> protected_blocks_;
94 // Callback to obtain the current decrypt_config.
95 // Only called if use_hls_sample_aes_ is true.
96 GetDecryptConfigCB get_decrypt_config_cb_;
97 bool use_hls_sample_aes_;
98 #endif
84 99
85 // Last video decoder config. 100 // Last video decoder config.
86 VideoDecoderConfig last_video_decoder_config_; 101 VideoDecoderConfig last_video_decoder_config_;
87 102
88 DISALLOW_COPY_AND_ASSIGN(EsParserH264); 103 DISALLOW_COPY_AND_ASSIGN(EsParserH264);
89 }; 104 };
90 105
91 } // namespace mp2t 106 } // namespace mp2t
92 } // namespace media 107 } // namespace media
93 108
94 #endif 109 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698