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

Side by Side Diff: media/formats/mp4/mp4_stream_parser.h

Issue 784493002: Encrypted Media: Rename NeedKey to EncryptedMediaInitData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 6 years 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
« no previous file with comments | « media/formats/mp2t/mp2t_stream_parser.cc ('k') | media/formats/mp4/mp4_stream_parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_MP4_MP4_STREAM_PARSER_H_ 5 #ifndef MEDIA_FORMATS_MP4_MP4_STREAM_PARSER_H_
6 #define MEDIA_FORMATS_MP4_MP4_STREAM_PARSER_H_ 6 #define MEDIA_FORMATS_MP4_MP4_STREAM_PARSER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 10 matching lines...) Expand all
21 namespace mp4 { 21 namespace mp4 {
22 22
23 struct Movie; 23 struct Movie;
24 class BoxReader; 24 class BoxReader;
25 25
26 class MEDIA_EXPORT MP4StreamParser : public StreamParser { 26 class MEDIA_EXPORT MP4StreamParser : public StreamParser {
27 public: 27 public:
28 MP4StreamParser(const std::set<int>& audio_object_types, bool has_sbr); 28 MP4StreamParser(const std::set<int>& audio_object_types, bool has_sbr);
29 virtual ~MP4StreamParser(); 29 virtual ~MP4StreamParser();
30 30
31 virtual void Init(const InitCB& init_cb, const NewConfigCB& config_cb, 31 virtual void Init(
32 const NewBuffersCB& new_buffers_cb, 32 const InitCB& init_cb,
33 bool ignore_text_tracks, 33 const NewConfigCB& config_cb,
34 const NeedKeyCB& need_key_cb, 34 const NewBuffersCB& new_buffers_cb,
35 const NewMediaSegmentCB& new_segment_cb, 35 bool ignore_text_tracks,
36 const base::Closure& end_of_segment_cb, 36 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
37 const LogCB& log_cb) override; 37 const NewMediaSegmentCB& new_segment_cb,
38 const base::Closure& end_of_segment_cb,
39 const LogCB& log_cb) override;
38 virtual void Flush() override; 40 virtual void Flush() override;
39 virtual bool Parse(const uint8* buf, int size) override; 41 virtual bool Parse(const uint8* buf, int size) override;
40 42
41 private: 43 private:
42 enum State { 44 enum State {
43 kWaitingForInit, 45 kWaitingForInit,
44 kParsingBoxes, 46 kParsingBoxes,
45 kWaitingForSampleData, 47 kWaitingForSampleData,
46 kEmittingSamples, 48 kEmittingSamples,
47 kError 49 kError
48 }; 50 };
49 51
50 bool ParseBox(bool* err); 52 bool ParseBox(bool* err);
51 bool ParseMoov(mp4::BoxReader* reader); 53 bool ParseMoov(mp4::BoxReader* reader);
52 bool ParseMoof(mp4::BoxReader* reader); 54 bool ParseMoof(mp4::BoxReader* reader);
53 55
54 void EmitNeedKeyIfNecessary( 56 void OnEncryptedMediaInitData(
55 const std::vector<ProtectionSystemSpecificHeader>& headers); 57 const std::vector<ProtectionSystemSpecificHeader>& headers);
56 58
57 // To retain proper framing, each 'mdat' atom must be read; to limit memory 59 // To retain proper framing, each 'mdat' atom must be read; to limit memory
58 // usage, the atom's data needs to be discarded incrementally as frames are 60 // usage, the atom's data needs to be discarded incrementally as frames are
59 // extracted from the stream. This function discards data from the stream up 61 // extracted from the stream. This function discards data from the stream up
60 // to |max_clear_offset|, updating the |mdat_tail_| value so that framing can 62 // to |max_clear_offset|, updating the |mdat_tail_| value so that framing can
61 // be retained after all 'mdat' information has been read. |max_clear_offset| 63 // be retained after all 'mdat' information has been read. |max_clear_offset|
62 // is the upper bound on what can be removed from |queue_|. Anything below 64 // is the upper bound on what can be removed from |queue_|. Anything below
63 // this offset is no longer needed by the parser. 65 // this offset is no longer needed by the parser.
64 // Returns 'true' on success, 'false' if there was an error. 66 // Returns 'true' on success, 'false' if there was an error.
(...skipping 22 matching lines...) Expand all
87 89
88 // Sets |highest_end_offset_| based on the data in |moov_| 90 // Sets |highest_end_offset_| based on the data in |moov_|
89 // and |moof|. Returns true if |highest_end_offset_| was successfully 91 // and |moof|. Returns true if |highest_end_offset_| was successfully
90 // computed. 92 // computed.
91 bool ComputeHighestEndOffset(const MovieFragment& moof); 93 bool ComputeHighestEndOffset(const MovieFragment& moof);
92 94
93 State state_; 95 State state_;
94 InitCB init_cb_; 96 InitCB init_cb_;
95 NewConfigCB config_cb_; 97 NewConfigCB config_cb_;
96 NewBuffersCB new_buffers_cb_; 98 NewBuffersCB new_buffers_cb_;
97 NeedKeyCB need_key_cb_; 99 EncryptedMediaInitDataCB encrypted_media_init_data_cb_;
98 NewMediaSegmentCB new_segment_cb_; 100 NewMediaSegmentCB new_segment_cb_;
99 base::Closure end_of_segment_cb_; 101 base::Closure end_of_segment_cb_;
100 LogCB log_cb_; 102 LogCB log_cb_;
101 103
102 OffsetByteQueue queue_; 104 OffsetByteQueue queue_;
103 105
104 // These two parameters are only valid in the |kEmittingSegments| state. 106 // These two parameters are only valid in the |kEmittingSegments| state.
105 // 107 //
106 // |moof_head_| is the offset of the start of the most recently parsed moof 108 // |moof_head_| is the offset of the start of the most recently parsed moof
107 // block. All byte offsets in sample information are relative to this offset, 109 // block. All byte offsets in sample information are relative to this offset,
(...skipping 21 matching lines...) Expand all
129 bool is_audio_track_encrypted_; 131 bool is_audio_track_encrypted_;
130 bool is_video_track_encrypted_; 132 bool is_video_track_encrypted_;
131 133
132 DISALLOW_COPY_AND_ASSIGN(MP4StreamParser); 134 DISALLOW_COPY_AND_ASSIGN(MP4StreamParser);
133 }; 135 };
134 136
135 } // namespace mp4 137 } // namespace mp4
136 } // namespace media 138 } // namespace media
137 139
138 #endif // MEDIA_FORMATS_MP4_MP4_STREAM_PARSER_H_ 140 #endif // MEDIA_FORMATS_MP4_MP4_STREAM_PARSER_H_
OLDNEW
« no previous file with comments | « media/formats/mp2t/mp2t_stream_parser.cc ('k') | media/formats/mp4/mp4_stream_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698