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

Side by Side Diff: media/formats/mp4/box_reader.cc

Issue 1718773002: Parse ELNG box in MP4 container Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
« no previous file with comments | « media/formats/mp4/box_reader.h ('k') | media/formats/mp4/fourccs.h » ('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 #include "media/formats/mp4/box_reader.h" 5 #include "media/formats/mp4/box_reader.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 60 }
61 61
62 bool BufferReader::ReadVec(std::vector<uint8_t>* vec, uint64_t count) { 62 bool BufferReader::ReadVec(std::vector<uint8_t>* vec, uint64_t count) {
63 RCHECK(HasBytes(count)); 63 RCHECK(HasBytes(count));
64 vec->clear(); 64 vec->clear();
65 vec->insert(vec->end(), buf_ + pos_, buf_ + pos_ + count); 65 vec->insert(vec->end(), buf_ + pos_, buf_ + pos_ + count);
66 pos_ += count; 66 pos_ += count;
67 return true; 67 return true;
68 } 68 }
69 69
70 bool BufferReader::ReadString(std::string* v) {
71 RCHECK(v);
72 *v = "";
73 uint8_t c = 0;
74 while (Read1(&c) && c != 0) {
75 v->push_back(c);
76 }
77 // Return error if we didn't find the terminating zero character.
78 if (c != 0)
79 return false;
80 return true;
81 }
82
70 bool BufferReader::SkipBytes(uint64_t bytes) { 83 bool BufferReader::SkipBytes(uint64_t bytes) {
71 RCHECK(HasBytes(bytes)); 84 RCHECK(HasBytes(bytes));
72 pos_ += bytes; 85 pos_ += bytes;
73 return true; 86 return true;
74 } 87 }
75 88
76 bool BufferReader::Read4Into8(uint64_t* v) { 89 bool BufferReader::Read4Into8(uint64_t* v) {
77 uint32_t tmp; 90 uint32_t tmp;
78 RCHECK(Read4(&tmp)); 91 RCHECK(Read4(&tmp));
79 *v = tmp; 92 *v = tmp;
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 291 }
279 292
280 // Note that the pos_ head has advanced to the byte immediately after the 293 // Note that the pos_ head has advanced to the byte immediately after the
281 // header, which is where we want it. 294 // header, which is where we want it.
282 size_ = size; 295 size_ = size;
283 return true; 296 return true;
284 } 297 }
285 298
286 } // namespace mp4 299 } // namespace mp4
287 } // namespace media 300 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/mp4/box_reader.h ('k') | media/formats/mp4/fourccs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698