MediaSource.cpp revision 2ffcb6c4fe5be89b38b72803182cbc5f3fbad43a
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/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 37void MediaSource::ReadOptions::setSeekTo(int64_t time_us) { 38 mOptions |= kSeekTo_Option; 39 mSeekTimeUs = time_us; 40} 41 42void MediaSource::ReadOptions::clearSeekTo() { 43 mOptions &= ~kSeekTo_Option; 44 mSeekTimeUs = 0; 45} 46 47bool MediaSource::ReadOptions::getSeekTo(int64_t *time_us) const { 48 *time_us = mSeekTimeUs; 49 return (mOptions & kSeekTo_Option) != 0; 50} 51 52void MediaSource::ReadOptions::setLateBy(int64_t lateness_us) { 53 mLatenessUs = lateness_us; 54} 55 56int64_t MediaSource::ReadOptions::getLateBy() const { 57 return mLatenessUs; 58} 59 60} // namespace android 61