Shaka Player Embedded
data.cc
Go to the documentation of this file.
1 // Copyright 2018 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 "shaka/eme/data.h"
16 
17 #include <glog/logging.h>
18 
19 #include "src/core/ref_ptr.h"
22 #include "src/mapping/js_utils.h"
24 #include "src/util/macros.h"
25 
26 namespace shaka {
27 namespace eme {
28 
29 class Data::Impl {
30  public:
32  : buffer(MakeJsRef<ByteBuffer>(std::move(buffer))) {}
33  ~Impl() {}
34 
36 
38 };
39 
40 Data::Data(Data&& other) = default;
42 
43 Data& Data::operator=(Data&& other) = default;
44 
45 const uint8_t* Data::data() const {
46  return impl_->buffer->data();
47 }
48 
49 size_t Data::size() const {
50  return impl_->buffer->size();
51 }
52 
53 Data::Data(ByteBuffer* buffer) : impl_(new Impl(std::move(*buffer))) {}
54 
55 } // namespace eme
56 } // namespace shaka
Impl(ByteBuffer buffer)
Definition: data.cc:31
Data(const Data &other)=delete
SHAKA_NON_COPYABLE_OR_MOVABLE_TYPE(Impl)
size_t size() const
Definition: data.cc:49
Data & operator=(const Data &other)=delete
const uint8_t * data() const
Definition: data.cc:45
RefPtr< ByteBuffer > buffer
Definition: data.cc:37
RefPtr< T > MakeJsRef(Args &&... args)
Definition: js_utils.h:52