blob: b4864fe52d696f989d5fdaaa1f57aee03a11200c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
// source code is governed by a BSD-style license that can be found in the
// LICENSE file.
#include "media/omx/omx_input_buffer.h"
#include <algorithm>
#include "base/logging.h"
namespace media {
OmxInputBuffer::OmxInputBuffer()
: size_(0),
used_(0) {
}
OmxInputBuffer::OmxInputBuffer(uint8* data, int size)
: data_(data),
size_(size),
used_(0) {
DCHECK_GE(size, 0);
}
OmxInputBuffer::~OmxInputBuffer() {
}
int OmxInputBuffer::Read(uint8* output_data, int output_size) {
int copy = std::min(output_size, size_ - used_);
memcpy(output_data, data_.get() + used_, copy);
used_ += copy;
return copy;
}
bool OmxInputBuffer::Used() {
return used_ == size_;
}
} // namespace media
|