Shaka Player Embedded
buffer_writer.cc
Go to the documentation of this file.
1 // Copyright 2019 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "src/util/buffer_writer.h"
16 
17 #include <glog/logging.h>
18 
19 #include <cstring>
20 
21 namespace shaka {
22 namespace util {
23 
24 BufferWriter::BufferWriter(uint8_t* data, size_t data_size)
25  : data_(data), size_(data_size) {}
26 
27 void BufferWriter::Write(const void* src, size_t src_size) {
28  CHECK(size_ >= src_size) << "No output remaining";
29  std::memcpy(data_, src, src_size);
30  data_ += src_size;
31  size_ -= src_size;
32 }
33 
34 } // namespace util
35 } // namespace shaka
void Write(T value, Endianness endian=kBigEndian)
Definition: buffer_writer.h:62
BufferWriter(uint8_t *data, size_t data_size)