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

Side by Side Diff: media/base/stream_parser.h

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_BASE_STREAM_PARSER_H_ 5 #ifndef MEDIA_BASE_STREAM_PARSER_H_
6 #define MEDIA_BASE_STREAM_PARSER_H_ 6 #define MEDIA_BASE_STREAM_PARSER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 const BufferQueue&, 99 const BufferQueue&,
100 const TextBufferQueueMap&)> NewBuffersCB; 100 const TextBufferQueueMap&)> NewBuffersCB;
101 101
102 // Signals the beginning of a new media segment. 102 // Signals the beginning of a new media segment.
103 typedef base::Callback<void()> NewMediaSegmentCB; 103 typedef base::Callback<void()> NewMediaSegmentCB;
104 104
105 // A new potentially encrypted stream has been parsed. 105 // A new potentially encrypted stream has been parsed.
106 // First parameter - The type of the initialization data associated with the 106 // First parameter - The type of the initialization data associated with the
107 // stream. 107 // stream.
108 // Second parameter - The initialization data associated with the stream. 108 // Second parameter - The initialization data associated with the stream.
109 typedef base::Callback<void(EmeInitDataType, const std::vector<uint8>&)> 109 typedef base::Callback<void(EmeInitDataType, const std::vector<uint8_t>&)>
110 EncryptedMediaInitDataCB; 110 EncryptedMediaInitDataCB;
111 111
112 StreamParser(); 112 StreamParser();
113 virtual ~StreamParser(); 113 virtual ~StreamParser();
114 114
115 // Initializes the parser with necessary callbacks. Must be called before any 115 // Initializes the parser with necessary callbacks. Must be called before any
116 // data is passed to Parse(). |init_cb| will be called once enough data has 116 // data is passed to Parse(). |init_cb| will be called once enough data has
117 // been parsed to determine the initial stream configurations, presentation 117 // been parsed to determine the initial stream configurations, presentation
118 // start time, and duration. If |ignore_text_track| is true, then no text 118 // start time, and duration. If |ignore_text_track| is true, then no text
119 // buffers should be passed later by the parser to |new_buffers_cb|. 119 // buffers should be passed later by the parser to |new_buffers_cb|.
120 virtual void Init( 120 virtual void Init(
121 const InitCB& init_cb, 121 const InitCB& init_cb,
122 const NewConfigCB& config_cb, 122 const NewConfigCB& config_cb,
123 const NewBuffersCB& new_buffers_cb, 123 const NewBuffersCB& new_buffers_cb,
124 bool ignore_text_track, 124 bool ignore_text_track,
125 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, 125 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
126 const NewMediaSegmentCB& new_segment_cb, 126 const NewMediaSegmentCB& new_segment_cb,
127 const base::Closure& end_of_segment_cb, 127 const base::Closure& end_of_segment_cb,
128 const scoped_refptr<MediaLog>& media_log) = 0; 128 const scoped_refptr<MediaLog>& media_log) = 0;
129 129
130 // Called when a seek occurs. This flushes the current parser state 130 // Called when a seek occurs. This flushes the current parser state
131 // and puts the parser in a state where it can receive data for the new seek 131 // and puts the parser in a state where it can receive data for the new seek
132 // point. 132 // point.
133 virtual void Flush() = 0; 133 virtual void Flush() = 0;
134 134
135 // Called when there is new data to parse. 135 // Called when there is new data to parse.
136 // 136 //
137 // Returns true if the parse succeeds. 137 // Returns true if the parse succeeds.
138 virtual bool Parse(const uint8* buf, int size) = 0; 138 virtual bool Parse(const uint8_t* buf, int size) = 0;
139 139
140 private: 140 private:
141 DISALLOW_COPY_AND_ASSIGN(StreamParser); 141 DISALLOW_COPY_AND_ASSIGN(StreamParser);
142 }; 142 };
143 143
144 // Appends to |merged_buffers| the provided buffers in decode-timestamp order. 144 // Appends to |merged_buffers| the provided buffers in decode-timestamp order.
145 // Any previous contents of |merged_buffers| is assumed to have lower 145 // Any previous contents of |merged_buffers| is assumed to have lower
146 // decode timestamps versus the provided buffers. All provided buffer queues 146 // decode timestamps versus the provided buffers. All provided buffer queues
147 // are assumed to already be in decode-timestamp order. 147 // are assumed to already be in decode-timestamp order.
148 // Returns false if any of the provided audio/video/text buffers are found 148 // Returns false if any of the provided audio/video/text buffers are found
149 // to not be in decode timestamp order, or have a decode timestamp less than 149 // to not be in decode timestamp order, or have a decode timestamp less than
150 // the last buffer, if any, in |merged_buffers|. Partial results may exist 150 // the last buffer, if any, in |merged_buffers|. Partial results may exist
151 // in |merged_buffers| in this case. Returns true on success. 151 // in |merged_buffers| in this case. Returns true on success.
152 // No validation of media type within the various buffer queues is done here. 152 // No validation of media type within the various buffer queues is done here.
153 // TODO(wolenetz/acolwell): Merge incrementally in parsers to eliminate 153 // TODO(wolenetz/acolwell): Merge incrementally in parsers to eliminate
154 // subtle issues with tie-breaking. See http://crbug.com/338484. 154 // subtle issues with tie-breaking. See http://crbug.com/338484.
155 MEDIA_EXPORT bool MergeBufferQueues( 155 MEDIA_EXPORT bool MergeBufferQueues(
156 const StreamParser::BufferQueue& audio_buffers, 156 const StreamParser::BufferQueue& audio_buffers,
157 const StreamParser::BufferQueue& video_buffers, 157 const StreamParser::BufferQueue& video_buffers,
158 const StreamParser::TextBufferQueueMap& text_buffers, 158 const StreamParser::TextBufferQueueMap& text_buffers,
159 StreamParser::BufferQueue* merged_buffers); 159 StreamParser::BufferQueue* merged_buffers);
160 160
161 } // namespace media 161 } // namespace media
162 162
163 #endif // MEDIA_BASE_STREAM_PARSER_H_ 163 #endif // MEDIA_BASE_STREAM_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698