1/*
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/MediaTrack.h>
18
19namespace android {
20
21MediaTrack::MediaTrack() {}
22
23MediaTrack::~MediaTrack() {}
24
25////////////////////////////////////////////////////////////////////////////////
26
27MediaTrack::ReadOptions::ReadOptions() {
28    reset();
29}
30
31void MediaTrack::ReadOptions::reset() {
32    mOptions = 0;
33    mSeekTimeUs = 0;
34    mNonBlocking = false;
35}
36
37void MediaTrack::ReadOptions::setNonBlocking() {
38    mNonBlocking = true;
39}
40
41void MediaTrack::ReadOptions::clearNonBlocking() {
42    mNonBlocking = false;
43}
44
45bool MediaTrack::ReadOptions::getNonBlocking() const {
46    return mNonBlocking;
47}
48
49void MediaTrack::ReadOptions::setSeekTo(int64_t time_us, SeekMode mode) {
50    mOptions |= kSeekTo_Option;
51    mSeekTimeUs = time_us;
52    mSeekMode = mode;
53}
54
55void MediaTrack::ReadOptions::clearSeekTo() {
56    mOptions &= ~kSeekTo_Option;
57    mSeekTimeUs = 0;
58    mSeekMode = SEEK_CLOSEST_SYNC;
59}
60
61bool MediaTrack::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
69