blob: 6d45c9019cda752477b927045a6a02a581115102 [file] [log] [blame]
Marco Nelissencb30d842018-01-26 15:29:02 -08001/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <media/MediaSourceBase.h>
18
19namespace android {
20
21MediaSourceBase::MediaSourceBase() {}
22
23MediaSourceBase::~MediaSourceBase() {}
24
25////////////////////////////////////////////////////////////////////////////////
26
27MediaSourceBase::ReadOptions::ReadOptions() {
28 reset();
29}
30
31void MediaSourceBase::ReadOptions::reset() {
32 mOptions = 0;
33 mSeekTimeUs = 0;
34 mNonBlocking = false;
35}
36
37void MediaSourceBase::ReadOptions::setNonBlocking() {
38 mNonBlocking = true;
39}
40
41void MediaSourceBase::ReadOptions::clearNonBlocking() {
42 mNonBlocking = false;
43}
44
45bool MediaSourceBase::ReadOptions::getNonBlocking() const {
46 return mNonBlocking;
47}
48
49void MediaSourceBase::ReadOptions::setSeekTo(int64_t time_us, SeekMode mode) {
50 mOptions |= kSeekTo_Option;
51 mSeekTimeUs = time_us;
52 mSeekMode = mode;
53}
54
55void MediaSourceBase::ReadOptions::clearSeekTo() {
56 mOptions &= ~kSeekTo_Option;
57 mSeekTimeUs = 0;
58 mSeekMode = SEEK_CLOSEST_SYNC;
59}
60
61bool MediaSourceBase::ReadOptions::getSeekTo(
62 int64_t *time_us, SeekMode *mode) const {
63 *time_us = mSeekTimeUs;
64 *mode = mSeekMode;
65 return (mOptions & kSeekTo_Option) != 0;
66}
67
68} // namespace android