blob: a5d41f79e9ceae8f8043b8f83568e5adf2d60fd8 [file] [log] [blame]
Andreas Huber20111aa2009-07-14 16:56:47 -07001/*
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
Dongwon Kangd91dc5a2017-10-10 00:07:09 -070017#include <media/MediaSource.h>
18#include <media/IMediaSource.h>
Andreas Huber20111aa2009-07-14 16:56:47 -070019
20namespace android {
21
22MediaSource::MediaSource() {}
23
24MediaSource::~MediaSource() {}
25
Dongwon Kangd91dc5a2017-10-10 00:07:09 -070026////////////////////////////////////////////////////////////////////////////////
27
28MediaSource::ReadOptions::ReadOptions() {
29 reset();
Dongwon Kangba8128f2017-08-07 18:51:24 -070030}
31
Dongwon Kangd91dc5a2017-10-10 00:07:09 -070032void MediaSource::ReadOptions::reset() {
33 mOptions = 0;
34 mSeekTimeUs = 0;
Dongwon Kangd91dc5a2017-10-10 00:07:09 -070035 mNonBlocking = false;
36}
37
38void MediaSource::ReadOptions::setNonBlocking() {
39 mNonBlocking = true;
40}
41
42void MediaSource::ReadOptions::clearNonBlocking() {
43 mNonBlocking = false;
44}
45
46bool MediaSource::ReadOptions::getNonBlocking() const {
47 return mNonBlocking;
48}
49
50void MediaSource::ReadOptions::setSeekTo(int64_t time_us, SeekMode mode) {
51 mOptions |= kSeekTo_Option;
52 mSeekTimeUs = time_us;
53 mSeekMode = mode;
54}
55
56void MediaSource::ReadOptions::clearSeekTo() {
57 mOptions &= ~kSeekTo_Option;
58 mSeekTimeUs = 0;
59 mSeekMode = SEEK_CLOSEST_SYNC;
60}
61
62bool MediaSource::ReadOptions::getSeekTo(
63 int64_t *time_us, SeekMode *mode) const {
64 *time_us = mSeekTimeUs;
65 *mode = mSeekMode;
66 return (mOptions & kSeekTo_Option) != 0;
67}
68
Andreas Huber20111aa2009-07-14 16:56:47 -070069} // namespace android