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

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

Issue 712593003: Move key frame flag from StreamParserBuffer to DecoderBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address PS1 comments, update mojo type converter Created 6 years, 1 month 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 | « no previous file | media/base/decoder_buffer.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 (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_DECODER_BUFFER_H_ 5 #ifndef MEDIA_BASE_DECODER_BUFFER_H_
6 #define MEDIA_BASE_DECODER_BUFFER_H_ 6 #define MEDIA_BASE_DECODER_BUFFER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 24 matching lines...) Expand all
35 enum { 35 enum {
36 kPaddingSize = 32, 36 kPaddingSize = 32,
37 #if defined(ARCH_CPU_ARM_FAMILY) 37 #if defined(ARCH_CPU_ARM_FAMILY)
38 kAlignmentSize = 16 38 kAlignmentSize = 16
39 #else 39 #else
40 kAlignmentSize = 32 40 kAlignmentSize = 32
41 #endif 41 #endif
42 }; 42 };
43 43
44 // Allocates buffer with |size| >= 0. Buffer will be padded and aligned 44 // Allocates buffer with |size| >= 0. Buffer will be padded and aligned
45 // as necessary. 45 // as necessary, and is_key_frame() will default to false.
xhwang 2014/11/11 23:24:26 s/is_key_frame()/|is_key_frame_|
wolenetz 2014/11/11 23:52:54 Done.
46 explicit DecoderBuffer(int size); 46 explicit DecoderBuffer(int size);
47 47
48 // Create a DecoderBuffer whose |data_| is copied from |data|. Buffer will be 48 // Create a DecoderBuffer whose |data_| is copied from |data|. Buffer will be
49 // padded and aligned as necessary. |data| must not be NULL and |size| >= 0. 49 // padded and aligned as necessary. |data| must not be NULL and |size| >= 0.
50 // The buffer's is_key_frame() will default to false.
xhwang 2014/11/11 23:24:26 ditto
wolenetz 2014/11/11 23:52:54 Done.
50 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size); 51 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size);
51 52
52 // Create a DecoderBuffer whose |data_| is copied from |data| and |side_data_| 53 // Create a DecoderBuffer whose |data_| is copied from |data| and |side_data_|
53 // is copied from |side_data|. Buffers will be padded and aligned as necessary 54 // is copied from |side_data|. Buffers will be padded and aligned as necessary
54 // Data pointers must not be NULL and sizes must be >= 0. 55 // Data pointers must not be NULL and sizes must be >= 0. The buffer's
56 // is_key_frame() will default to false.
xhwang 2014/11/11 23:24:26 ditto
wolenetz 2014/11/11 23:52:54 Done.
55 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size, 57 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size,
56 const uint8* side_data, 58 const uint8* side_data,
57 int side_data_size); 59 int side_data_size);
58 60
59 // Create a DecoderBuffer indicating we've reached end of stream. 61 // Create a DecoderBuffer indicating we've reached end of stream.
60 // 62 //
61 // Calling any method other than end_of_stream() on the resulting buffer 63 // Calling any method other than end_of_stream() on the resulting buffer
62 // is disallowed. 64 // is disallowed.
63 static scoped_refptr<DecoderBuffer> CreateEOSBuffer(); 65 static scoped_refptr<DecoderBuffer> CreateEOSBuffer();
64 66
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 return splice_timestamp_; 149 return splice_timestamp_;
148 } 150 }
149 151
150 // When set to anything but kNoTimestamp() indicates this buffer is part of a 152 // When set to anything but kNoTimestamp() indicates this buffer is part of a
151 // splice around |splice_timestamp|. 153 // splice around |splice_timestamp|.
152 void set_splice_timestamp(base::TimeDelta splice_timestamp) { 154 void set_splice_timestamp(base::TimeDelta splice_timestamp) {
153 DCHECK(!end_of_stream()); 155 DCHECK(!end_of_stream());
154 splice_timestamp_ = splice_timestamp; 156 splice_timestamp_ = splice_timestamp;
155 } 157 }
156 158
159 bool is_key_frame() const {
160 DCHECK(!end_of_stream());
161 return is_key_frame_;
162 }
163
164 void set_is_key_frame(bool is_key_frame) {
165 DCHECK(!end_of_stream());
166 is_key_frame_ = is_key_frame;
167 }
168
157 // Returns a human-readable string describing |*this|. 169 // Returns a human-readable string describing |*this|.
158 std::string AsHumanReadableString(); 170 std::string AsHumanReadableString();
159 171
160 protected: 172 protected:
161 friend class base::RefCountedThreadSafe<DecoderBuffer>; 173 friend class base::RefCountedThreadSafe<DecoderBuffer>;
162 174
163 // Allocates a buffer of size |size| >= 0 and copies |data| into it. Buffer 175 // Allocates a buffer of size |size| >= 0 and copies |data| into it. Buffer
164 // will be padded and aligned as necessary. If |data| is NULL then |data_| is 176 // will be padded and aligned as necessary. If |data| is NULL then |data_| is
165 // set to NULL and |buffer_size_| to 0. 177 // set to NULL and |buffer_size_| to 0. is_key_frame() will default to false.
xhwang 2014/11/11 23:24:26 ditto
wolenetz 2014/11/11 23:52:54 Done.
166 DecoderBuffer(const uint8* data, int size, 178 DecoderBuffer(const uint8* data, int size,
167 const uint8* side_data, int side_data_size); 179 const uint8* side_data, int side_data_size);
168 virtual ~DecoderBuffer(); 180 virtual ~DecoderBuffer();
169 181
170 private: 182 private:
171 base::TimeDelta timestamp_; 183 base::TimeDelta timestamp_;
172 base::TimeDelta duration_; 184 base::TimeDelta duration_;
173 185
174 int size_; 186 int size_;
175 scoped_ptr<uint8, base::AlignedFreeDeleter> data_; 187 scoped_ptr<uint8, base::AlignedFreeDeleter> data_;
176 int side_data_size_; 188 int side_data_size_;
177 scoped_ptr<uint8, base::AlignedFreeDeleter> side_data_; 189 scoped_ptr<uint8, base::AlignedFreeDeleter> side_data_;
178 scoped_ptr<DecryptConfig> decrypt_config_; 190 scoped_ptr<DecryptConfig> decrypt_config_;
179 DiscardPadding discard_padding_; 191 DiscardPadding discard_padding_;
180 base::TimeDelta splice_timestamp_; 192 base::TimeDelta splice_timestamp_;
193 bool is_key_frame_;
181 194
182 // Constructor helper method for memory allocations. 195 // Constructor helper method for memory allocations.
183 void Initialize(); 196 void Initialize();
184 197
185 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); 198 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer);
186 }; 199 };
187 200
188 } // namespace media 201 } // namespace media
189 202
190 #endif // MEDIA_BASE_DECODER_BUFFER_H_ 203 #endif // MEDIA_BASE_DECODER_BUFFER_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/decoder_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698