Andreas Huber | 20111aa | 2009-07-14 16:56:47 -0700 | [diff] [blame] | 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 | |
Dongwon Kang | d91dc5a | 2017-10-10 00:07:09 -0700 | [diff] [blame^] | 17 | #include <media/MediaSource.h> |
| 18 | #include <media/IMediaSource.h> |
Andreas Huber | 20111aa | 2009-07-14 16:56:47 -0700 | [diff] [blame] | 19 | |
| 20 | namespace android { |
| 21 | |
| 22 | MediaSource::MediaSource() {} |
| 23 | |
| 24 | MediaSource::~MediaSource() {} |
| 25 | |
Dongwon Kang | d91dc5a | 2017-10-10 00:07:09 -0700 | [diff] [blame^] | 26 | //////////////////////////////////////////////////////////////////////////////// |
| 27 | |
| 28 | MediaSource::ReadOptions::ReadOptions() { |
| 29 | reset(); |
Dongwon Kang | ba8128f | 2017-08-07 18:51:24 -0700 | [diff] [blame] | 30 | } |
| 31 | |
Dongwon Kang | d91dc5a | 2017-10-10 00:07:09 -0700 | [diff] [blame^] | 32 | void MediaSource::ReadOptions::reset() { |
| 33 | mOptions = 0; |
| 34 | mSeekTimeUs = 0; |
| 35 | mLatenessUs = 0; |
| 36 | mNonBlocking = false; |
| 37 | } |
| 38 | |
| 39 | void MediaSource::ReadOptions::setNonBlocking() { |
| 40 | mNonBlocking = true; |
| 41 | } |
| 42 | |
| 43 | void MediaSource::ReadOptions::clearNonBlocking() { |
| 44 | mNonBlocking = false; |
| 45 | } |
| 46 | |
| 47 | bool MediaSource::ReadOptions::getNonBlocking() const { |
| 48 | return mNonBlocking; |
| 49 | } |
| 50 | |
| 51 | void MediaSource::ReadOptions::setSeekTo(int64_t time_us, SeekMode mode) { |
| 52 | mOptions |= kSeekTo_Option; |
| 53 | mSeekTimeUs = time_us; |
| 54 | mSeekMode = mode; |
| 55 | } |
| 56 | |
| 57 | void MediaSource::ReadOptions::clearSeekTo() { |
| 58 | mOptions &= ~kSeekTo_Option; |
| 59 | mSeekTimeUs = 0; |
| 60 | mSeekMode = SEEK_CLOSEST_SYNC; |
| 61 | } |
| 62 | |
| 63 | bool MediaSource::ReadOptions::getSeekTo( |
| 64 | int64_t *time_us, SeekMode *mode) const { |
| 65 | *time_us = mSeekTimeUs; |
| 66 | *mode = mSeekMode; |
| 67 | return (mOptions & kSeekTo_Option) != 0; |
| 68 | } |
| 69 | |
| 70 | void MediaSource::ReadOptions::setLateBy(int64_t lateness_us) { |
| 71 | mLatenessUs = lateness_us; |
| 72 | } |
| 73 | |
| 74 | int64_t MediaSource::ReadOptions::getLateBy() const { |
| 75 | return mLatenessUs; |
Dongwon Kang | ba8128f | 2017-08-07 18:51:24 -0700 | [diff] [blame] | 76 | } |
| 77 | |
Andreas Huber | 20111aa | 2009-07-14 16:56:47 -0700 | [diff] [blame] | 78 | } // namespace android |