blob: fd0e79c34f0ef4362fec0c8fea940aefaefa7f83 [file] [log] [blame]
Andreas Hubere46b7be2009-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
17#include <media/stagefright/MediaSource.h>
18
19namespace android {
20
21MediaSource::MediaSource() {}
22
23MediaSource::~MediaSource() {}
24
25////////////////////////////////////////////////////////////////////////////////
26
27MediaSource::ReadOptions::ReadOptions() {
28 reset();
29}
30
31void MediaSource::ReadOptions::reset() {
32 mOptions = 0;
33 mSeekTimeUs = 0;
34 mLatenessUs = 0;
35}
36
Andreas Huber6624c9f2010-07-20 15:04:28 -070037void MediaSource::ReadOptions::setSeekTo(int64_t time_us, SeekMode mode) {
Andreas Hubere46b7be2009-07-14 16:56:47 -070038 mOptions |= kSeekTo_Option;
39 mSeekTimeUs = time_us;
Andreas Huber6624c9f2010-07-20 15:04:28 -070040 mSeekMode = mode;
Andreas Hubere46b7be2009-07-14 16:56:47 -070041}
42
43void MediaSource::ReadOptions::clearSeekTo() {
44 mOptions &= ~kSeekTo_Option;
45 mSeekTimeUs = 0;
Andreas Huber6624c9f2010-07-20 15:04:28 -070046 mSeekMode = SEEK_CLOSEST_SYNC;
Andreas Hubere46b7be2009-07-14 16:56:47 -070047}
48
Andreas Huber6624c9f2010-07-20 15:04:28 -070049bool MediaSource::ReadOptions::getSeekTo(
50 int64_t *time_us, SeekMode *mode) const {
Andreas Hubere46b7be2009-07-14 16:56:47 -070051 *time_us = mSeekTimeUs;
Andreas Huber6624c9f2010-07-20 15:04:28 -070052 *mode = mSeekMode;
Andreas Hubere46b7be2009-07-14 16:56:47 -070053 return (mOptions & kSeekTo_Option) != 0;
54}
55
Andreas Hubere46b7be2009-07-14 16:56:47 -070056void MediaSource::ReadOptions::setLateBy(int64_t lateness_us) {
57 mLatenessUs = lateness_us;
58}
59
60int64_t MediaSource::ReadOptions::getLateBy() const {
61 return mLatenessUs;
62}
63
64} // namespace android