blob: c26b9f72553b78d4afc1c670769a96fc1967c58e (
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
40
41
42
43
|
// 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/input_buffer.h"
#include <algorithm>
#include "base/logging.h"
namespace media {
InputBuffer::InputBuffer()
: size_(0),
used_(0) {
}
InputBuffer::InputBuffer(uint8* data, int size)
: data_(data),
size_(size),
used_(0) {
DCHECK_GE(size, 0);
}
InputBuffer::~InputBuffer() {
}
int InputBuffer::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 InputBuffer::Used() {
return used_ == size_;
}
bool InputBuffer::IsEndOfStream() {
return data_.get() == NULL || size_ == 0;
}
} // namespace media
|